tiptop-editor 1.0.0

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.
@@ -0,0 +1,160 @@
1
+ (function(xt,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],w):(xt=typeof globalThis<"u"?globalThis:xt||self,w(xt.TiptopEditor={},xt.React,xt.ReactDOM))})(this,function(xt,w,Ec){"use strict";function Rg(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ir=Rg(w);function Lg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qr={exports:{}},or={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Cc;function $g(){if(Cc)return or;Cc=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var a in s)a!=="key"&&(i[a]=s[a])}else i=s;return s=i.ref,{$$typeof:t,type:r,key:o,ref:s!==void 0?s:null,props:i}}return or.Fragment=e,or.jsx=n,or.jsxs=n,or}var ar={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Mc;function Vg(){return Mc||(Mc=1,process.env.NODE_ENV!=="production"&&function(){function t(E){if(E==null)return null;if(typeof E=="function")return E.$$typeof===U?null:E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case m:return"Fragment";case y:return"Profiler";case g:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case _:return"Activity"}if(typeof E=="object")switch(typeof E.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),E.$$typeof){case p:return"Portal";case S:return(E.displayName||"Context")+".Provider";case k:return(E._context.displayName||"Context")+".Consumer";case N:var z=E.render;return E=E.displayName,E||(E=z.displayName||z.name||"",E=E!==""?"ForwardRef("+E+")":"ForwardRef"),E;case R:return z=E.displayName||null,z!==null?z:t(E.type)||"Memo";case x:z=E._payload,E=E._init;try{return t(E(z))}catch{}}return null}function e(E){return""+E}function n(E){try{e(E);var z=!1}catch{z=!0}if(z){z=console;var Z=z.error,K=typeof Symbol=="function"&&Symbol.toStringTag&&E[Symbol.toStringTag]||E.constructor.name||"Object";return Z.call(z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",K),e(E)}}function r(E){if(E===m)return"<>";if(typeof E=="object"&&E!==null&&E.$$typeof===x)return"<...>";try{var z=t(E);return z?"<"+z+">":"<...>"}catch{return"<...>"}}function s(){var E=b.A;return E===null?null:E.getOwner()}function i(){return Error("react-stack-top-frame")}function o(E){if(D.call(E,"key")){var z=Object.getOwnPropertyDescriptor(E,"key").get;if(z&&z.isReactWarning)return!1}return E.key!==void 0}function a(E,z){function Z(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",z))}Z.isReactWarning=!0,Object.defineProperty(E,"key",{get:Z,configurable:!0})}function l(){var E=t(this.type);return v[E]||(v[E]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),E=this.props.ref,E!==void 0?E:null}function c(E,z,Z,K,Q,Se,Gt,de){return Z=Se.ref,E={$$typeof:h,type:E,key:z,props:Se,_owner:Q},(Z!==void 0?Z:null)!==null?Object.defineProperty(E,"ref",{enumerable:!1,get:l}):Object.defineProperty(E,"ref",{enumerable:!1,value:null}),E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(E,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(E,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Gt}),Object.defineProperty(E,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E}function u(E,z,Z,K,Q,Se,Gt,de){var be=z.children;if(be!==void 0)if(K)if(V(be)){for(K=0;K<be.length;K++)d(be[K]);Object.freeze&&Object.freeze(be)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(be);if(D.call(z,"key")){be=t(E);var et=Object.keys(z).filter(function(Zr){return Zr!=="key"});K=0<et.length?"{key: someKey, "+et.join(": ..., ")+": ...}":"{key: someKey}",q[be+K]||(et=0<et.length?"{"+et.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,K,be,et,be),q[be+K]=!0)}if(be=null,Z!==void 0&&(n(Z),be=""+Z),o(z)&&(n(z.key),be=""+z.key),"key"in z){Z={};for(var qt in z)qt!=="key"&&(Z[qt]=z[qt])}else Z=z;return be&&a(Z,typeof E=="function"?E.displayName||E.name||"Unknown":E),c(E,be,Se,Q,s(),Z,Gt,de)}function d(E){typeof E=="object"&&E!==null&&E.$$typeof===h&&E._store&&(E._store.validated=1)}var f=w,h=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),S=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),U=Symbol.for("react.client.reference"),b=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,V=Array.isArray,C=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(E){return E()}};var L,v={},O=f.react_stack_bottom_frame.bind(f,i)(),M=C(r(i)),q={};ar.Fragment=m,ar.jsx=function(E,z,Z,K,Q){var Se=1e4>b.recentlyCreatedOwnerStacks++;return u(E,z,Z,!1,K,Q,Se?Error("react-stack-top-frame"):O,Se?C(r(E)):M)},ar.jsxs=function(E,z,Z,K,Q){var Se=1e4>b.recentlyCreatedOwnerStacks++;return u(E,z,Z,!0,K,Q,Se?Error("react-stack-top-frame"):O,Se?C(r(E)):M)}}()),ar}var Ac;function Fg(){return Ac||(Ac=1,process.env.NODE_ENV==="production"?Qr.exports=$g():Qr.exports=Vg()),Qr.exports}var ne=Fg();function Oc(t={}){const{strict:e=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=t,s=ir.createContext(void 0);s.displayName=r;function i(){var o;const a=ir.useContext(s);if(!a&&e){const l=new Error(n);throw l.name="ContextError",(o=Error.captureStackTrace)==null||o.call(Error,l,i),l}return a}return[s.Provider,i,s]}function Bg(t){const e=w.useRef(null);return w.useImperativeHandle(t,()=>e.current),e}process.env.NODE_ENV,process.env.NODE_ENV;var lr=t=>t?"true":void 0;function Pc(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=Pc(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function Nc(...t){for(var e=0,n,r,s="";e<t.length;)(n=t[e++])&&(r=Pc(n))&&(s&&(s+=" "),s+=r);return s}function zg(t){return`${t}-${Math.floor(Math.random()*1e6)}`}function _g(t){if(!t||typeof t!="object")return"";try{return JSON.stringify(t)}catch{return""}}function Hg(t,e,n){return Math.min(Math.max(t,e),n)}function Dc(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}var Ic=new Map;function jg(t,e){if(t===e)return t;let n=Ic.get(t);if(n)return n.forEach(s=>s.current=e),e;let r=Ic.get(e);return r?(r.forEach(s=>s.current=t),t):e}function Kg(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let s in r){let i=e[s],o=r[s];typeof i=="function"&&typeof o=="function"&&s[0]==="o"&&s[1]==="n"&&s.charCodeAt(2)>=65&&s.charCodeAt(2)<=90?e[s]=Dc(i,o):(s==="className"||s==="UNSAFE_className")&&typeof i=="string"&&typeof o=="string"?e[s]=Nc(i,o):s==="id"&&i&&o?e.id=jg(i,o):e[s]=o!==void 0?o:i}}return e}var Wg=new Set(["id","type","style","title","role","tabIndex","htmlFor","width","height","abbr","accept","acceptCharset","accessKey","action","allowFullScreen","allowTransparency","alt","async","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","challenge","charset","checked","cite","class","className","cols","colSpan","command","content","contentEditable","contextMenu","controls","coords","crossOrigin","data","dateTime","default","defer","dir","disabled","download","draggable","dropzone","encType","enterKeyHint","for","form","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","headers","hidden","high","href","hrefLang","httpEquiv","icon","inputMode","isMap","itemId","itemProp","itemRef","itemScope","itemType","kind","label","lang","list","loop","manifest","max","maxLength","media","mediaGroup","method","min","minLength","multiple","muted","name","noValidate","open","optimum","pattern","ping","placeholder","poster","preload","radioGroup","referrerPolicy","readOnly","rel","required","rows","rowSpan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","slot","sortable","span","spellCheck","src","srcDoc","srcSet","start","step","target","translate","typeMustMatch","useMap","value","wmode","wrap"]),Ug=new Set(["onCopy","onCut","onPaste","onLoad","onError","onWheel","onScroll","onCompositionEnd","onCompositionStart","onCompositionUpdate","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onSubmit","onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPointerDown","onPointerEnter","onPointerLeave","onPointerUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd"]),Rc=/^(data-.*)$/,Gg=/^(aria-.*)$/,es=/^(on[A-Z].*)$/;function Lc(t,e={}){let{labelable:n=!0,enabled:r=!0,propNames:s,omitPropNames:i,omitEventNames:o,omitDataProps:a,omitEventProps:l}=e,c={};if(!r)return t;for(const u in t)i?.has(u)||o?.has(u)&&es.test(u)||es.test(u)&&!Ug.has(u)||a&&Rc.test(u)||l&&es.test(u)||(Object.prototype.hasOwnProperty.call(t,u)&&(Wg.has(u)||n&&Gg.test(u)||s?.has(u)||Rc.test(u))||es.test(u))&&(c[u]=t[u]);return c}var[RM,qg]=Oc({name:"ProviderContext",strict:!1});function Jg(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Yg(t,e,n){Jg(t,e),e.set(t,n)}const ro=typeof document<"u"?w.useLayoutEffect:()=>{};var so;const Xg=(so=w.useInsertionEffect)!==null&&so!==void 0?so:ro;function wt(t){const e=w.useRef(null);return Xg(()=>{e.current=t},[t]),w.useCallback((...n)=>{const r=e.current;return r?.(...n)},[])}let io=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{io.delete(t)});function Zg(t,e){if(t===e)return t;let n=io.get(t);if(n)return n.forEach(s=>s.current=e),e;let r=io.get(e);return r?(r.forEach(s=>s.current=t),t):e}function $c(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const Me=t=>{var e;return(e=t?.ownerDocument)!==null&&e!==void 0?e:document},He=t=>t&&"window"in t&&t.window===t?t:Me(t).defaultView||window;function Qg(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&typeof t.nodeType=="number"}function ey(t){return Qg(t)&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}let ty=!1;function oo(){return ty}function ae(t,e){if(!oo())return e&&t?t.contains(e):!1;if(!t||!e)return!1;let n=e;for(;n!==null;){if(n===t)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:ey(n)?n=n.host:n=n.parentNode}return!1}const cr=(t=document)=>{var e;if(!oo())return t.activeElement;let n=t.activeElement;for(;n&&"shadowRoot"in n&&(!((e=n.shadowRoot)===null||e===void 0)&&e.activeElement);)n=n.shadowRoot.activeElement;return n};function re(t){return oo()&&t.target.shadowRoot&&t.composedPath?t.composedPath()[0]:t.target}function Vc(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=Vc(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ny(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Vc(t))&&(r&&(r+=" "),r+=e);return r}function Sn(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let s in r){let i=e[s],o=r[s];typeof i=="function"&&typeof o=="function"&&s[0]==="o"&&s[1]==="n"&&s.charCodeAt(2)>=65&&s.charCodeAt(2)<=90?e[s]=$c(i,o):(s==="className"||s==="UNSAFE_className")&&typeof i=="string"&&typeof o=="string"?e[s]=ny(i,o):s==="id"&&i&&o?e.id=Zg(i,o):e[s]=o!==void 0?o:i}}return e}const ry=new Set(["id"]),sy=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),iy=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),oy=new Set(["dir","lang","hidden","inert","translate"]),Fc=new Set(["onClick","onAuxClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionCancel","onTransitionEnd","onTransitionRun","onTransitionStart"]),ay=/^(data-.*)$/;function ly(t,e={}){let{labelable:n,isLink:r,global:s,events:i=s,propNames:o}=e,a={};for(const l in t)Object.prototype.hasOwnProperty.call(t,l)&&(ry.has(l)||n&&sy.has(l)||r&&iy.has(l)||s&&oy.has(l)||i&&Fc.has(l)||l.endsWith("Capture")&&Fc.has(l.slice(0,-7))||o?.has(l)||ay.test(l))&&(a[l]=t[l]);return a}function Tn(t){if(cy())t.focus({preventScroll:!0});else{let e=uy(t);t.focus(),dy(e)}}let ts=null;function cy(){if(ts==null){ts=!1;try{document.createElement("div").focus({get preventScroll(){return ts=!0,!0}})}catch{}}return ts}function uy(t){let e=t.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==r;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&n.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function dy(t){for(let{element:e,scrollTop:n,scrollLeft:r}of t)e.scrollTop=n,e.scrollLeft=r}function ns(t){var e;if(typeof window>"u"||window.navigator==null)return!1;let n=(e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands;return Array.isArray(n)&&n.some(r=>t.test(r.brand))||t.test(window.navigator.userAgent)}function ao(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function lt(t){if(process.env.NODE_ENV==="test")return t;let e=null;return()=>(e==null&&(e=t()),e)}const En=lt(function(){return ao(/^Mac/i)}),fy=lt(function(){return ao(/^iPhone/i)}),Bc=lt(function(){return ao(/^iPad/i)||En()&&navigator.maxTouchPoints>1}),lo=lt(function(){return fy()||Bc()});lt(function(){return En()||lo()});const hy=lt(function(){return ns(/AppleWebKit/i)&&!py()}),py=lt(function(){return ns(/Chrome/i)}),zc=lt(function(){return ns(/Android/i)}),my=lt(function(){return ns(/Firefox/i)});function ur(t,e,n=!0){var r,s;let{metaKey:i,ctrlKey:o,altKey:a,shiftKey:l}=e;my()&&(!((s=window.event)===null||s===void 0||(r=s.type)===null||r===void 0)&&r.startsWith("key"))&&t.target==="_blank"&&(En()?i=!0:o=!0);let c=hy()&&En()&&!Bc()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:i,ctrlKey:o,altKey:a,shiftKey:l}):new MouseEvent("click",{metaKey:i,ctrlKey:o,altKey:a,shiftKey:l,bubbles:!0,cancelable:!0});ur.isOpening=n,Tn(t),t.dispatchEvent(c),ur.isOpening=!1}ur.isOpening=!1;let St=new Map,co=new Set;function _c(){if(typeof window>"u")return;function t(r){return"propertyName"in r}let e=r=>{if(!t(r)||!r.target)return;let s=St.get(r.target);s||(s=new Set,St.set(r.target,s),r.target.addEventListener("transitioncancel",n,{once:!0})),s.add(r.propertyName)},n=r=>{if(!t(r)||!r.target)return;let s=St.get(r.target);if(s&&(s.delete(r.propertyName),s.size===0&&(r.target.removeEventListener("transitioncancel",n),St.delete(r.target)),St.size===0)){for(let i of co)i();co.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?_c():document.addEventListener("DOMContentLoaded",_c));function gy(){for(const[t]of St)"isConnected"in t&&!t.isConnected&&St.delete(t)}function Hc(t){requestAnimationFrame(()=>{gy(),St.size===0?t():co.add(t)})}function uo(){let t=w.useRef(new Map),e=w.useCallback((s,i,o,a)=>{let l=a?.once?(...c)=>{t.current.delete(o),o(...c)}:o;t.current.set(o,{type:i,eventTarget:s,fn:l,options:a}),s.addEventListener(i,l,a)},[]),n=w.useCallback((s,i,o,a)=>{var l;let c=((l=t.current.get(o))===null||l===void 0?void 0:l.fn)||o;s.removeEventListener(i,c,a),t.current.delete(o)},[]),r=w.useCallback(()=>{t.current.forEach((s,i)=>{n(s.eventTarget,s.type,i,s.options)})},[n]);return w.useEffect(()=>r,[r]),{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}}function jc(t,e){ro(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function fo(t){return t.mozInputSource===0&&t.isTrusted?!0:zc()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function yy(t){return!zc()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}const by=typeof Element<"u"&&"checkVisibility"in Element.prototype;function vy(t){const e=He(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:n,visibility:r}=t.style,s=n!=="none"&&r!=="hidden"&&r!=="collapse";if(s){const{getComputedStyle:i}=t.ownerDocument.defaultView;let{display:o,visibility:a}=i(t);s=o!=="none"&&a!=="hidden"&&a!=="collapse"}return s}function ky(t,e){return!t.hasAttribute("hidden")&&!t.hasAttribute("data-react-aria-prevent-focus")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function Kc(t,e){return by?t.checkVisibility():t.nodeName!=="#comment"&&vy(t)&&ky(t,e)&&(!t.parentElement||Kc(t.parentElement,t))}const Wc=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],xy=Wc.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Wc.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function wy(t){return t.matches(xy)&&Kc(t)&&!Sy(t)}function Sy(t){let e=t;for(;e!=null;){if(e instanceof e.ownerDocument.defaultView.HTMLElement&&e.inert)return!0;e=e.parentElement}return!1}const Uc=w.createContext({});function ho(t){const e=w.useRef(null);return e.current===null&&(e.current=t()),e.current}const po=typeof window<"u",Gc=po?w.useLayoutEffect:w.useEffect,rs=w.createContext(null);function Ty(t,e){t.indexOf(e)===-1&&t.push(e)}function Ey(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Jt=(t,e,n)=>n>e?e:n<t?t:n;function mo(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Cn=()=>{},Tt=()=>{};process.env.NODE_ENV!=="production"&&(Cn=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(mo(e,n))},Tt=(t,e,n)=>{if(!t)throw new Error(mo(e,n))});const ct={},qc=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Cy(t){return typeof t=="object"&&t!==null}const Jc=t=>/^0[^.\s]+$/u.test(t);function go(t){let e;return()=>(e===void 0&&(e=t()),e)}const Mn=t=>t,My=(t,e)=>n=>e(t(n)),ss=(...t)=>t.reduce(My),Yc=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Xc{constructor(){this.subscriptions=[]}add(e){return Ty(this.subscriptions,e),()=>Ey(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const tt=t=>t*1e3,ut=t=>t/1e3;function Zc(t,e){return e?t*(1e3/e):0}const Qc=new Set;function yo(t,e,n){t||Qc.has(e)||(console.warn(mo(e,n)),Qc.add(e))}const eu=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ay=1e-7,Oy=12;function Py(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=eu(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>Ay&&++a<Oy);return o}function dr(t,e,n,r){if(t===e&&n===r)return Mn;const s=i=>Py(i,0,1,t,n);return i=>i===0||i===1?i:eu(s(i),e,r)}const tu=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,nu=t=>e=>1-t(1-e),ru=dr(.33,1.53,.69,.99),bo=nu(ru),su=tu(bo),iu=t=>(t*=2)<1?.5*bo(t):.5*(2-Math.pow(2,-10*(t-1))),vo=t=>1-Math.sin(Math.acos(t)),Ny=nu(vo),ou=tu(vo),Dy=dr(.42,0,1,1),Iy=dr(0,0,.58,1),au=dr(.42,0,.58,1),Ry=t=>Array.isArray(t)&&typeof t[0]!="number",lu=t=>Array.isArray(t)&&typeof t[0]=="number",cu={linear:Mn,easeIn:Dy,easeInOut:au,easeOut:Iy,circIn:vo,circInOut:ou,circOut:Ny,backIn:bo,backInOut:su,backOut:ru,anticipate:iu},Ly=t=>typeof t=="string",uu=t=>{if(lu(t)){Tt(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,r,s]=t;return dr(e,n,r,s)}else if(Ly(t))return Tt(cu[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),cu[t];return t},is=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function $y(t,e){let n=new Set,r=new Set,s=!1,i=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(c.schedule(u),t()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?n:r;return d&&o.add(u),p.has(u)||p.add(u),u},cancel:u=>{r.delete(u),o.delete(u)},process:u=>{if(a=u,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(l),n.clear(),s=!1,i&&(i=!1,c.process(u))}};return c}const Vy=40;function du(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=is.reduce((S,N)=>(S[N]=$y(i),S),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:h,postRender:p}=o,m=()=>{const S=ct.useManualTiming?s.timestamp:performance.now();n=!1,ct.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(S-s.timestamp,Vy),1)),s.timestamp=S,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),p.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(m))},g=()=>{n=!0,r=!0,s.isProcessing||t(m)};return{schedule:is.reduce((S,N)=>{const T=o[N];return S[N]=(A,R=!1,x=!1)=>(n||g(),T.schedule(A,R,x)),S},{}),cancel:S=>{for(let N=0;N<is.length;N++)o[is[N]].cancel(S)},state:s,steps:o}}const{schedule:Ye,cancel:ko,state:as}=du(typeof requestAnimationFrame<"u"?requestAnimationFrame:Mn,!0);let ls;function Fy(){ls=void 0}const je={now:()=>(ls===void 0&&je.set(as.isProcessing||ct.useManualTiming?as.timestamp:performance.now()),ls),set:t=>{ls=t,queueMicrotask(Fy)}},fu=t=>e=>typeof e=="string"&&e.startsWith(t),hu=fu("--"),By=fu("var(--"),xo=t=>By(t)?zy.test(t.split("/*")[0].trim()):!1,zy=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,An={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},fr={...An,transform:t=>Jt(0,1,t)},cs={...An,default:1},hr=t=>Math.round(t*1e5)/1e5,wo=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function _y(t){return t==null}const Hy=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,So=(t,e)=>n=>!!(typeof n=="string"&&Hy.test(n)&&n.startsWith(t)||e&&!_y(n)&&Object.prototype.hasOwnProperty.call(n,e)),pu=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(wo);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},jy=t=>Jt(0,255,t),To={...An,transform:t=>Math.round(jy(t))},Yt={test:So("rgb","red"),parse:pu("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+To.transform(t)+", "+To.transform(e)+", "+To.transform(n)+", "+hr(fr.transform(r))+")"};function Ky(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Eo={test:So("#"),parse:Ky,transform:Yt.transform},pr=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Et=pr("deg"),On=pr("%"),W=pr("px"),Wy=pr("vh"),Uy=pr("vw"),mu={...On,parse:t=>On.parse(t)/100,transform:t=>On.transform(t*100)},Pn={test:So("hsl","hue"),parse:pu("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+On.transform(hr(e))+", "+On.transform(hr(n))+", "+hr(fr.transform(r))+")"},fe={test:t=>Yt.test(t)||Eo.test(t)||Pn.test(t),parse:t=>Yt.test(t)?Yt.parse(t):Pn.test(t)?Pn.parse(t):Eo.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Yt.transform(t):Pn.transform(t),getAnimatableNone:t=>{const e=fe.parse(t);return e.alpha=0,fe.transform(e)}},Gy=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function qy(t){return isNaN(t)&&typeof t=="string"&&(t.match(wo)?.length||0)+(t.match(Gy)?.length||0)>0}const gu="number",yu="color",Jy="var",Yy="var(",bu="${}",Xy=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function mr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(Xy,l=>(fe.test(l)?(r.color.push(i),s.push(yu),n.push(fe.parse(l))):l.startsWith(Yy)?(r.var.push(i),s.push(Jy),n.push(l)):(r.number.push(i),s.push(gu),n.push(parseFloat(l))),++i,bu)).split(bu);return{values:n,split:a,indexes:r,types:s}}function vu(t){return mr(t).values}function ku(t){const{split:e,types:n}=mr(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=n[o];a===gu?i+=hr(s[o]):a===yu?i+=fe.transform(s[o]):i+=s[o]}return i}}const Zy=t=>typeof t=="number"?0:fe.test(t)?fe.getAnimatableNone(t):t;function Qy(t){const e=vu(t);return ku(t)(e.map(Zy))}const Nn={test:qy,parse:vu,createTransformer:ku,getAnimatableNone:Qy};function Co(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function eb({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=Co(l,a,t+1/3),i=Co(l,a,t),o=Co(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function us(t,e){return n=>n>0?e:t}const ds=(t,e,n)=>t+(e-t)*n,Mo=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},tb=[Eo,Yt,Pn],nb=t=>tb.find(e=>e.test(t));function xu(t){const e=nb(t);if(Cn(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===Pn&&(n=eb(n)),n}const wu=(t,e)=>{const n=xu(t),r=xu(e);if(!n||!r)return us(t,e);const s={...n};return i=>(s.red=Mo(n.red,r.red,i),s.green=Mo(n.green,r.green,i),s.blue=Mo(n.blue,r.blue,i),s.alpha=ds(n.alpha,r.alpha,i),Yt.transform(s))},Ao=new Set(["none","hidden"]);function rb(t,e){return Ao.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function sb(t,e){return n=>ds(t,e,n)}function Oo(t){return typeof t=="number"?sb:typeof t=="string"?xo(t)?us:fe.test(t)?wu:ab:Array.isArray(t)?Su:typeof t=="object"?fe.test(t)?wu:ib:us}function Su(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>Oo(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function ib(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=Oo(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function ob(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],o=t.indexes[i][r[i]],a=t.values[o]??0;n[s]=a,r[i]++}return n}const ab=(t,e)=>{const n=Nn.createTransformer(e),r=mr(t),s=mr(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Ao.has(t)&&!s.values.length||Ao.has(e)&&!r.values.length?rb(t,e):ss(Su(ob(r,s),s.values),n):(Cn(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),us(t,e))};function Tu(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ds(t,e,n):Oo(t)(t,e)}const lb=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Ye.update(e,n),stop:()=>ko(e),now:()=>as.isProcessing?as.timestamp:je.now()}},Eu=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},fs=2e4;function Po(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<fs;)e+=n,r=t.next(e);return e>=fs?1/0:e}function cb(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Po(r),fs);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:ut(s)}}const ub=5;function Cu(t,e,n){const r=Math.max(e-ub,0);return Zc(n-t(r),e-r)}const ie={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},No=.001;function db({duration:t=ie.duration,bounce:e=ie.bounce,velocity:n=ie.velocity,mass:r=ie.mass}){let s,i;Cn(t<=tt(ie.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=Jt(ie.minDamping,ie.maxDamping,o),t=Jt(ie.minDuration,ie.maxDuration,ut(t)),o<1?(s=c=>{const u=c*o,d=u*t,f=u-n,h=Do(c,o),p=Math.exp(-d);return No-f/h*p},i=c=>{const d=c*o*t,f=d*n+n,h=Math.pow(o,2)*Math.pow(c,2)*t,p=Math.exp(-d),m=Do(Math.pow(c,2),o);return(-s(c)+No>0?-1:1)*((f-h)*p)/m}):(s=c=>{const u=Math.exp(-c*t),d=(c-n)*t+1;return-No+u*d},i=c=>{const u=Math.exp(-c*t),d=(n-c)*(t*t);return u*d});const a=5/t,l=hb(s,i,a);if(t=tt(t),isNaN(l))return{stiffness:ie.stiffness,damping:ie.damping,duration:t};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:t}}}const fb=12;function hb(t,e,n){let r=n;for(let s=1;s<fb;s++)r=r-t(r)/e(r);return r}function Do(t,e){return t*Math.sqrt(1-e*e)}const pb=["duration","bounce"],mb=["stiffness","damping","mass"];function Mu(t,e){return e.some(n=>t[n]!==void 0)}function gb(t){let e={velocity:ie.velocity,stiffness:ie.stiffness,damping:ie.damping,mass:ie.mass,isResolvedFromDuration:!1,...t};if(!Mu(t,mb)&&Mu(t,pb))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Jt(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:ie.mass,stiffness:s,damping:i}}else{const n=db(t);e={...e,...n,mass:ie.mass},e.isResolvedFromDuration=!0}return e}function hs(t=ie.visualDuration,e=ie.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:c,mass:u,duration:d,velocity:f,isResolvedFromDuration:h}=gb({...n,velocity:-ut(n.velocity||0)}),p=f||0,m=c/(2*Math.sqrt(l*u)),g=o-i,y=ut(Math.sqrt(l/u)),k=Math.abs(g)<5;r||(r=k?ie.restSpeed.granular:ie.restSpeed.default),s||(s=k?ie.restDelta.granular:ie.restDelta.default);let S;if(m<1){const T=Do(y,m);S=A=>{const R=Math.exp(-m*y*A);return o-R*((p+m*y*g)/T*Math.sin(T*A)+g*Math.cos(T*A))}}else if(m===1)S=T=>o-Math.exp(-y*T)*(g+(p+y*g)*T);else{const T=y*Math.sqrt(m*m-1);S=A=>{const R=Math.exp(-m*y*A),x=Math.min(T*A,300);return o-R*((p+m*y*g)*Math.sinh(x)+T*g*Math.cosh(x))/T}}const N={calculatedDuration:h&&d||null,next:T=>{const A=S(T);if(h)a.done=T>=d;else{let R=T===0?p:0;m<1&&(R=T===0?tt(p):Cu(S,T,A));const x=Math.abs(R)<=r,_=Math.abs(o-A)<=s;a.done=x&&_}return a.value=a.done?o:A,a},toString:()=>{const T=Math.min(Po(N),fs),A=Eu(R=>N.next(T*R).value,T,30);return T+"ms "+A},toTransition:()=>{}};return N}hs.applyToOptions=t=>{const e=cb(t,100,hs);return t.ease=e.ease,t.duration=tt(e.duration),t.type="keyframes",t};function Io({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=t[0],f={done:!1,value:d},h=x=>a!==void 0&&x<a||l!==void 0&&x>l,p=x=>a===void 0?l:l===void 0||Math.abs(a-x)<Math.abs(l-x)?a:l;let m=n*e;const g=d+m,y=o===void 0?g:o(g);y!==g&&(m=y-d);const k=x=>-m*Math.exp(-x/r),S=x=>y+k(x),N=x=>{const _=k(x),U=S(x);f.done=Math.abs(_)<=c,f.value=f.done?y:U};let T,A;const R=x=>{h(f.value)&&(T=x,A=hs({keyframes:[f.value,p(f.value)],velocity:Cu(S,x,f.value),damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return R(0),{calculatedDuration:null,next:x=>{let _=!1;return!A&&T===void 0&&(_=!0,N(x),R(x)),T!==void 0&&x>=T?A.next(x-T):(!_&&N(x),f)}}}function yb(t,e,n){const r=[],s=n||ct.mix||Tu,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||Mn:e;a=ss(l,a)}r.push(a)}return r}function bb(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(Tt(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=yb(e,r,s),l=a.length,c=u=>{if(o&&u<t[0])return e[0];let d=0;if(l>1)for(;d<t.length-2&&!(u<t[d+1]);d++);const f=Yc(t[d],t[d+1],u);return a[d](f)};return n?u=>c(Jt(t[0],t[i-1],u)):c}function vb(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Yc(0,e,r);t.push(ds(n,1,s))}}function kb(t){const e=[0];return vb(e,t.length-1),e}function xb(t,e){return t.map(n=>n*e)}function wb(t,e){return t.map(()=>e||au).splice(0,t.length-1)}function Dn({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=Ry(r)?r.map(uu):uu(r),i={done:!1,value:e[0]},o=xb(n&&n.length===e.length?n:kb(e),t),a=bb(o,e,{ease:Array.isArray(s)?s:wb(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const Sb=t=>t!==null;function Ro(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(Sb),a=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const Tb={decay:Io,inertia:Io,tween:Dn,keyframes:Dn,spring:hs};function Au(t){typeof t.type=="string"&&(t.type=Tb[t.type])}class Lo{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const Eb=t=>t/100;class $o extends Lo{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==je.now()&&this.tick(je.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Au(e);const{type:n=Dn,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:a}=e;const l=n||Dn;process.env.NODE_ENV!=="production"&&l!==Dn&&Tt(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),l!==Dn&&typeof a[0]!="number"&&(this.mixKeyframes=ss(Eb,Tu(a[0],a[1])),a=[0,100]);const c=l({...e,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Po(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=c}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:f,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let S=this.currentTime,N=r;if(d){const x=Math.min(this.currentTime,s)/a;let _=Math.floor(x),U=x%1;!U&&x>=1&&(U=1),U===1&&_--,_=Math.min(_,d+1),!!(_%2)&&(f==="reverse"?(U=1-U,h&&(U-=h/a)):f==="mirror"&&(N=o)),S=Jt(0,1,U)*a}const T=k?{done:!1,value:u[0]}:N.next(S);i&&(T.value=i(T.value));let{done:A}=T;!k&&l!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return R&&p!==Io&&(T.value=Ro(u,this.options,g,this.speed)),m&&m(T.value),R&&this.finish(),T}then(e,n){return this.finished.then(e,n)}get duration(){return ut(this.calculatedDuration)}get time(){return ut(this.currentTime)}set time(e){e=tt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(je.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ut(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=lb,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(je.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Cb(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Xt=t=>t*180/Math.PI,Vo=t=>{const e=Xt(Math.atan2(t[1],t[0]));return Fo(e)},Mb={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Vo,rotateZ:Vo,skewX:t=>Xt(Math.atan(t[1])),skewY:t=>Xt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Fo=t=>(t=t%360,t<0&&(t+=360),t),Ou=Vo,Pu=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Nu=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ab={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Pu,scaleY:Nu,scale:t=>(Pu(t)+Nu(t))/2,rotateX:t=>Fo(Xt(Math.atan2(t[6],t[5]))),rotateY:t=>Fo(Xt(Math.atan2(-t[2],t[0]))),rotateZ:Ou,rotate:Ou,skewX:t=>Xt(Math.atan(t[4])),skewY:t=>Xt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Bo(t){return t.includes("scale")?1:0}function zo(t,e){if(!t||t==="none")return Bo(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Ab,s=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Mb,s=a}if(!s)return Bo(e);const i=r[e],o=s[1].split(",").map(Pb);return typeof i=="function"?i(o):o[i]}const Ob=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return zo(n,e)};function Pb(t){return parseFloat(t.trim())}const In=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Rn=new Set(In),Du=t=>t===An||t===W,Nb=new Set(["x","y","z"]),Db=In.filter(t=>!Nb.has(t));function Ib(t){const e=[];return Db.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Zt={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>zo(e,"x"),y:(t,{transform:e})=>zo(e,"y")};Zt.translateX=Zt.x,Zt.translateY=Zt.y;const Qt=new Set;let _o=!1,Ho=!1,jo=!1;function Iu(){if(Ho){const t=Array.from(Qt).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=Ib(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{r.getValue(i)?.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Ho=!1,_o=!1,Qt.forEach(t=>t.complete(jo)),Qt.clear()}function Ru(){Qt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ho=!0)})}function Rb(){jo=!0,Ru(),Iu(),jo=!1}class Ko{constructor(e,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Qt.add(this),_o||(_o=!0,Ye.read(Ru),Ye.resolveKeyframes(Iu))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s?.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const a=r.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}Cb(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Qt.delete(this)}cancel(){this.state==="scheduled"&&(Qt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Lb=t=>t.startsWith("--");function $b(t,e,n){Lb(e)?t.style.setProperty(e,n):t.style[e]=n}const Vb=go(()=>window.ScrollTimeline!==void 0),Fb={};function Bb(t,e){const n=go(t);return()=>Fb[e]??n()}const Lu=Bb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),gr=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,$u={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gr([0,.65,.55,1]),circOut:gr([.55,0,1,.45]),backIn:gr([.31,.01,.66,-.59]),backOut:gr([.33,1.53,.69,.99])};function Vu(t,e){if(t)return typeof t=="function"?Lu()?Eu(t,e):"ease-out":lu(t)?gr(t):Array.isArray(t)?t.map(n=>Vu(n,e)||$u.easeOut):$u[t]}function zb(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=Vu(a,s);Array.isArray(d)&&(u.easing=d);const f={delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),t.animate(u,f)}function Fu(t){return typeof t=="function"&&"applyToOptions"in t}function _b({type:t,...e}){return Fu(t)&&Lu()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Hb extends Lo{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,Tt(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=_b(e);this.animation=zb(n,r,s,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=Ro(s,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):$b(n,r,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return ut(Number(e))}get time(){return ut(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=tt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Vb()?(this.animation.timeline=e,Mn):n(this)}}const Bu={anticipate:iu,backInOut:su,circInOut:ou};function jb(t){return t in Bu}function Kb(t){typeof t.ease=="string"&&jb(t.ease)&&(t.ease=Bu[t.ease])}const zu=10;class Wb extends Hb{constructor(e){Kb(e),Au(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new $o({...o,autoplay:!1}),l=tt(this.finishedTime??this.time);n.setWithVelocity(a.sample(l-zu).value,a.sample(l).value,zu),a.stop()}}const _u=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Nn.test(t)||t==="0")&&!t.startsWith("url("));function Ub(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Gb(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=_u(s,e),a=_u(i,e);return Cn(o===a,`You are trying to animate ${e} from "${s}" to "${i}". "${o?i:s}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:Ub(t)||(n==="spring"||Fu(n))&&r}function Wo(t){t.duration=0,t.type}const qb=new Set(["opacity","clipPath","filter","transform"]),Jb=go(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Yb(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Jb()&&n&&qb.has(n)&&(n!=="transform"||!c)&&!l&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const Xb=40;class Zb extends Lo{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=je.now();const f={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:l,motionValue:c,element:u,...d},h=u?.KeyframeResolver||Ko;this.keyframeResolver=new h(a,(p,m,g)=>this.onKeyframesResolved(p,m,f,!g),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=je.now(),Gb(e,i,o,a)||((ct.instantAnimations||!l)&&u?.(Ro(e,r,n)),e[0]=e[e.length-1],Wo(r),r.repeat=0);const f={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Xb?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},h=!c&&Yb(f)?new Wb({...f,element:f.motionValue.owner.current}):new $o(f);h.finished.then(()=>this.notifyFinished()).catch(Mn),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Rb()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Qb=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function e0(t){const e=Qb.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}const t0=4;function Hu(t,e,n=1){Tt(n<=t0,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,s]=e0(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return qc(o)?parseFloat(o):o}return xo(s)?Hu(s,e,n+1):s}function ju(t,e){return t?.[e]??t?.default??t}const Ku=new Set(["width","height","top","left","right","bottom",...In]),n0={test:t=>t==="auto",parse:t=>t},Wu=t=>e=>e.test(t),Uu=[An,W,On,Et,Uy,Wy,n0],Gu=t=>Uu.find(Wu(t));function r0(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Jc(t):!0}const s0=new Set(["brightness","contrast","saturate","opacity"]);function i0(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(wo)||[];if(!r)return t;const s=n.replace(r,"");let i=s0.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const o0=/\b([a-z-]*)\(.*?\)/gu,Uo={...Nn,getAnimatableNone:t=>{const e=t.match(o0);return e?e.map(i0).join(" "):t}},qu={...An,transform:Math.round},Go={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,radius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,backgroundPositionX:W,backgroundPositionY:W,...{rotate:Et,rotateX:Et,rotateY:Et,rotateZ:Et,scale:cs,scaleX:cs,scaleY:cs,scaleZ:cs,skew:Et,skewX:Et,skewY:Et,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:fr,originX:mu,originY:mu,originZ:W},zIndex:qu,fillOpacity:fr,strokeOpacity:fr,numOctaves:qu},a0={...Go,color:fe,backgroundColor:fe,outlineColor:fe,fill:fe,stroke:fe,borderColor:fe,borderTopColor:fe,borderRightColor:fe,borderBottomColor:fe,borderLeftColor:fe,filter:Uo,WebkitFilter:Uo},Ju=t=>a0[t];function Yu(t,e){let n=Ju(t);return n!==Uo&&(n=Nn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const l0=new Set(["auto","none","0"]);function c0(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!l0.has(i)&&mr(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=Yu(n,s)}class u0 extends Ko{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),xo(c))){const u=Hu(c,n.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!Ku.has(r)||e.length!==2)return;const[s,i]=e,o=Gu(s),a=Gu(i);if(o!==a)if(Du(o)&&Du(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else Zt[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||r0(e[s]))&&r.push(s);r.length&&c0(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Zt[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,o=r[i];r[i]=Zt[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{e.getValue(a).set(l)}),this.resolveNoneKeyframes()}}function d0(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const s=n?.[t]??r.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const Xu=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Zu(t){return Cy(t)&&"offsetHeight"in t}const Qu=30,f0=t=>!isNaN(parseFloat(t));class h0{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=je.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=je.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=f0(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&yo(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Xc);const r=this.events[e].add(n);return e==="change"?()=>{r(),Ye.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=je.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Qu)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Qu);return Zc(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ps(t,e){return new h0(t,e)}const{schedule:p0}=du(queueMicrotask,!1),m0={y:!1};function g0(){return m0.y}function ed(t,e){const n=d0(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function td(t){return!(t.pointerType==="touch"||g0())}function y0(t,e,n={}){const[r,s,i]=ed(t,n),o=a=>{if(!td(a))return;const{target:l}=a,c=e(l,a);if(typeof c!="function"||!l)return;const u=d=>{td(d)&&(c(d),l.removeEventListener("pointerleave",u))};l.addEventListener("pointerleave",u,s)};return r.forEach(a=>{a.addEventListener("pointerenter",o,s)}),i}const nd=(t,e)=>e?t===e?!0:nd(t,e.parentElement):!1,b0=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,v0=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function k0(t){return v0.has(t.tagName)||t.tabIndex!==-1}const ms=new WeakSet;function rd(t){return e=>{e.key==="Enter"&&t(e)}}function qo(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const x0=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=rd(()=>{if(ms.has(n))return;qo(n,"down");const s=rd(()=>{qo(n,"up")}),i=()=>qo(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function sd(t){return b0(t)&&!0}function w0(t,e,n={}){const[r,s,i]=ed(t,n),o=a=>{const l=a.currentTarget;if(!sd(a))return;ms.add(l);const c=e(l,a),u=(h,p)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),ms.has(l)&&ms.delete(l),sd(h)&&typeof c=="function"&&c(h,{success:p})},d=h=>{u(h,l===window||l===document||n.useGlobalTarget||nd(l,h.target))},f=h=>{u(h,!1)};window.addEventListener("pointerup",d,s),window.addEventListener("pointercancel",f,s)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),Zu(a)&&(a.addEventListener("focus",c=>x0(c,s)),!k0(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}const Ne=t=>!!(t&&t.getVelocity),S0=[...Uu,fe,Nn],T0=t=>S0.find(Wu(t)),Jo=w.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class E0 extends ir.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=Zu(r)&&r.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=s-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function C0({children:t,isPresent:e,anchorX:n,root:r}){const s=w.useId(),i=w.useRef(null),o=w.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=w.useContext(Jo);return w.useInsertionEffect(()=>{const{width:l,height:c,top:u,left:d,right:f}=o.current;if(e||!i.current||!l||!c)return;const h=n==="left"?`left: ${d}`:`right: ${f}`;i.current.dataset.motionPopId=s;const p=document.createElement("style");a&&(p.nonce=a);const m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
23
+ [data-motion-pop-id="${s}"] {
24
+ position: absolute !important;
25
+ width: ${l}px !important;
26
+ height: ${c}px !important;
27
+ ${h}px !important;
28
+ top: ${u}px !important;
29
+ }
30
+ `),()=>{m.contains(p)&&m.removeChild(p)}},[e]),ne.jsx(E0,{isPresent:e,childRef:i,sizeRef:o,children:ir.cloneElement(t,{ref:i})})}const M0=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:a,root:l})=>{const c=ho(A0),u=w.useId();let d=!0,f=w.useMemo(()=>(d=!1,{id:u,initial:e,isPresent:n,custom:s,onExitComplete:h=>{c.set(h,!0);for(const p of c.values())if(!p)return;r&&r()},register:h=>(c.set(h,!1),()=>c.delete(h))}),[n,c,r]);return i&&d&&(f={...f}),w.useMemo(()=>{c.forEach((h,p)=>c.set(p,!1))},[n]),ir.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),o==="popLayout"&&(t=ne.jsx(C0,{isPresent:n,anchorX:a,root:l,children:t})),ne.jsx(rs.Provider,{value:f,children:t})};function A0(){return new Map}function O0(t=!0){const e=w.useContext(rs);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=w.useId();w.useEffect(()=>{if(t)return s(i)},[t]);const o=w.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const gs=t=>t.key||"";function id(t){const e=[];return w.Children.forEach(t,n=>{w.isValidElement(n)&&e.push(n)}),e}const P0=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",root:l})=>{const[c,u]=O0(o),d=w.useMemo(()=>id(t),[t]),f=o&&!c?[]:d.map(gs),h=w.useRef(!0),p=w.useRef(d),m=ho(()=>new Map),[g,y]=w.useState(d),[k,S]=w.useState(d);Gc(()=>{h.current=!1,p.current=d;for(let A=0;A<k.length;A++){const R=gs(k[A]);f.includes(R)?m.delete(R):m.get(R)!==!0&&m.set(R,!1)}},[k,f.length,f.join("-")]);const N=[];if(d!==g){let A=[...d];for(let R=0;R<k.length;R++){const x=k[R],_=gs(x);f.includes(_)||(A.splice(R,0,x),N.push(x))}return i==="wait"&&N.length&&(A=N),S(id(A)),y(d),null}process.env.NODE_ENV!=="production"&&i==="wait"&&k.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:T}=w.useContext(Uc);return ne.jsx(ne.Fragment,{children:k.map(A=>{const R=gs(A),x=o&&!c?!1:d===k||f.includes(R),_=()=>{if(m.has(R))m.set(R,!0);else return;let U=!0;m.forEach(b=>{b||(U=!1)}),U&&(T?.(),S(p.current),o&&u?.(),r&&r())};return ne.jsx(M0,{isPresent:x,initial:!h.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:l,onExitComplete:x?void 0:_,anchorX:a,children:A},R)})})},Yo=w.createContext({strict:!1}),od={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ln={};for(const t in od)Ln[t]={isEnabled:e=>od[t].some(n=>!!e[n])};function Xo(t){for(const e in t)Ln[e]={...Ln[e],...t[e]}}function N0({children:t,features:e,strict:n=!1}){const[,r]=w.useState(!Zo(e)),s=w.useRef(void 0);if(!Zo(e)){const{renderer:i,...o}=e;s.current=i,Xo(o)}return w.useEffect(()=>{Zo(e)&&e().then(({renderer:i,...o})=>{Xo(o),s.current=i,r(!0)})},[]),ne.jsx(Yo.Provider,{value:{renderer:s.current,strict:n},children:t})}function Zo(t){return typeof t=="function"}const D0=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ys(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||D0.has(t)}let ad=t=>!ys(t);function I0(t){typeof t=="function"&&(ad=e=>e.startsWith("on")?!ys(e):t(e))}try{I0(require("@emotion/is-prop-valid").default)}catch{}function R0(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(ad(s)||n===!0&&ys(s)||!e&&!ys(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const bs=w.createContext({});function vs(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function yr(t){return typeof t=="string"||Array.isArray(t)}const Qo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ea=["initial",...Qo];function ks(t){return vs(t.animate)||ea.some(e=>yr(t[e]))}function ld(t){return!!(ks(t)||t.variants)}function L0(t,e){if(ks(t)){const{initial:n,animate:r}=t;return{initial:n===!1||yr(n)?n:void 0,animate:yr(r)?r:void 0}}return t.inherit!==!1?e:{}}function $0(t){const{initial:e,animate:n}=L0(t,w.useContext(bs));return w.useMemo(()=>({initial:e,animate:n}),[cd(e),cd(n)])}function cd(t){return Array.isArray(t)?t.join(" "):t}const V0={};function ud(t,{layout:e,layoutId:n}){return Rn.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!V0[t]||t==="opacity")}const F0={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},B0=In.length;function z0(t,e,n){let r="",s=!0;for(let i=0;i<B0;i++){const o=In[i],a=t[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const c=Xu(a,Go[o]);if(!l){s=!1;const u=F0[o]||o;r+=`${u}(${c}) `}n&&(e[o]=c)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function ta(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,a=!1;for(const l in e){const c=e[l];if(Rn.has(l)){o=!0;continue}else if(hu(l)){s[l]=c;continue}else{const u=Xu(c,Go[l]);l.startsWith("origin")?(a=!0,i[l]=u):r[l]=u}}if(e.transform||(o||n?r.transform=z0(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=i;r.transformOrigin=`${l} ${c} ${u}`}}const na=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function dd(t,e,n){for(const r in e)!Ne(e[r])&&!ud(r,n)&&(t[r]=e[r])}function _0({transformTemplate:t},e){return w.useMemo(()=>{const n=na();return ta(n,e,t),Object.assign({},n.vars,n.style)},[e])}function H0(t,e){const n=t.style||{},r={};return dd(r,n,t),Object.assign(r,_0(t,e)),r}function j0(t,e){const n={},r=H0(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const K0={offset:"stroke-dashoffset",array:"stroke-dasharray"},W0={offset:"strokeDashoffset",array:"strokeDasharray"};function U0(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?K0:W0;t[i.offset]=W.transform(-r);const o=W.transform(e),a=W.transform(n);t[i.array]=`${o} ${a}`}function fd(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...a},l,c,u){if(ta(t,a,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:d,style:f}=t;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete d.transformBox),e!==void 0&&(d.x=e),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),s!==void 0&&U0(d,s,i,o,!1)}const hd=()=>({...na(),attrs:{}}),pd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function G0(t,e,n,r){const s=w.useMemo(()=>{const i=hd();return fd(i,e,pd(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};dd(i,t.style,t),s.style={...i,...s.style}}return s}const q0=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ra(t){return typeof t!="string"||t.includes("-")?!1:!!(q0.indexOf(t)>-1||/[A-Z]/u.test(t))}function J0(t,e,n,{latestValues:r},s,i=!1){const a=(ra(t)?G0:j0)(e,r,s,t),l=R0(e,typeof t=="string",i),c=t!==w.Fragment?{...l,...a,ref:n}:{},{children:u}=e,d=w.useMemo(()=>Ne(u)?u.get():u,[u]);return w.createElement(t,{...c,children:d})}function md(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function sa(t,e,n,r){if(typeof e=="function"){const[s,i]=md(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=md(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function Y0(t){return Ne(t)?t.get():t}function X0({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:Z0(n,r,s,t),renderState:e()}}function Z0(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=Y0(i[f]);let{initial:o,animate:a}=t;const l=ks(t),c=ld(t);e&&c&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const d=u?a:o;if(d&&typeof d!="boolean"&&!vs(d)){const f=Array.isArray(d)?d:[d];for(let h=0;h<f.length;h++){const p=sa(t,f[h]);if(p){const{transitionEnd:m,transition:g,...y}=p;for(const k in y){let S=y[k];if(Array.isArray(S)){const N=u?S.length-1:0;S=S[N]}S!==null&&(s[k]=S)}for(const k in m)s[k]=m[k]}}}return s}const gd=t=>(e,n)=>{const r=w.useContext(bs),s=w.useContext(rs),i=()=>X0(t,e,r,s);return n?i():ho(i)};function ia(t,e,n){const{style:r}=t,s={};for(const i in r)(Ne(r[i])||e.style&&Ne(e.style[i])||ud(i,t)||n?.getValue(i)?.liveStyle!==void 0)&&(s[i]=r[i]);return s}const Q0=gd({scrapeMotionValuesFromProps:ia,createRenderState:na});function yd(t,e,n){const r=ia(t,e,n);for(const s in t)if(Ne(t[s])||Ne(e[s])){const i=In.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}const ev=gd({scrapeMotionValuesFromProps:yd,createRenderState:hd}),tv=Symbol.for("motionComponentSymbol");function bd(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function nv(t,e,n){return w.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):bd(n)&&(n.current=r))},[e])}const oa=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),vd="data-"+oa("framerAppearId"),rv=w.createContext({});function sv(t,e,n,r,s){const{visualElement:i}=w.useContext(bs),o=w.useContext(Yo),a=w.useContext(rs),l=w.useContext(Jo).reducedMotion,c=w.useRef(null);r=r||o.renderer,!c.current&&r&&(c.current=r(t,{visualState:e,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,d=w.useContext(rv);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&iv(c.current,n,s,d);const f=w.useRef(!1);w.useInsertionEffect(()=>{u&&f.current&&u.update(n,a)});const h=n[vd],p=w.useRef(!!h&&!window.MotionHandoffIsComplete?.(h)&&window.MotionHasOptimisedAnimation?.(h));return Gc(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),p.current&&u.animationState&&u.animationState.animateChanges())}),w.useEffect(()=>{u&&(!p.current&&u.animationState&&u.animationState.animateChanges(),p.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(h)}),p.current=!1),u.enteringChildren=void 0)}),u}function iv(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:kd(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&bd(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c})}function kd(t){if(t)return t.options.allowProjection!==!1?t.projection:kd(t.parent)}function aa(t,{forwardMotionProps:e=!1}={},n,r){n&&Xo(n);const s=ra(t)?ev:Q0;function i(a,l){let c;const u={...w.useContext(Jo),...a,layoutId:ov(a)},{isStatic:d}=u,f=$0(a),h=s(a,d);if(!d&&po){av(u,n);const p=lv(u);c=p.MeasureLayout,f.visualElement=sv(t,h,u,r,p.ProjectionNode)}return ne.jsxs(bs.Provider,{value:f,children:[c&&f.visualElement?ne.jsx(c,{visualElement:f.visualElement,...u}):null,J0(t,a,nv(h,f.visualElement,l),h,d,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=w.forwardRef(i);return o[tv]=t,o}function ov({layoutId:t}){const e=w.useContext(Uc).id;return e&&t!==void 0?e+"-"+t:t}function av(t,e){const n=w.useContext(Yo).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Cn(!1,r,"lazy-strict-mode"):Tt(!1,r,"lazy-strict-mode")}}function lv(t){const{drag:e,layout:n}=Ln;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function cv(t,e){if(typeof Proxy>"u")return aa;const n=new Map,r=(i,o)=>aa(i,o,t,e),s=(i,o)=>(process.env.NODE_ENV!=="production"&&yo(!1,"motion() is deprecated. Use motion.create() instead."),r(i,o));return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,aa(o,void 0,t,e)),n.get(o))})}const uv=cv();function dv({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function fv(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function hv(t,e){return dv(fv(t.getBoundingClientRect(),e))}const xd=()=>({min:0,max:0}),wd=()=>({x:xd(),y:xd()}),la={current:null},Sd={current:!1};function pv(){if(Sd.current=!0,!!po)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>la.current=t.matches;t.addEventListener("change",e),e()}else la.current=!1}const mv=new WeakMap;function gv(t,e,n){for(const r in e){const s=e[r],i=n[r];if(Ne(s))t.addValue(r,s);else if(Ne(i))t.addValue(r,ps(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,ps(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Td=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class yv{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ko,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=je.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Ye.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=ks(n),this.isVariantNode=ld(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in d){const h=d[f];l[f]!==void 0&&Ne(h)&&h.set(l[f])}}mount(e){this.current=e,mv.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),Sd.current||pv(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:la.current,process.env.NODE_ENV!=="production"&&yo(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),ko(this.notifyUpdate),ko(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Rn.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Ye.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ln){const n=Ln[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):wd()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Td.length;r++){const s=Td[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=gv(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=ps(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(qc(r)||Jc(r))?r=parseFloat(r):!T0(r)&&Nn.test(n)&&(r=Yu(e,n)),this.setBaseTarget(e,Ne(r)?r.get():r)),Ne(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=sa(this.props,n,this.presenceContext?.custom);i&&(r=i[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Ne(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Xc),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){p0.render(this.render)}}class Ed extends yv{constructor(){super(...arguments),this.KeyframeResolver=u0}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ne(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Cd(t,{style:e,vars:n},r,s){const i=t.style;let o;for(o in e)i[o]=e[o];s?.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}function bv(t){return window.getComputedStyle(t)}class vv extends Ed{constructor(){super(...arguments),this.type="html",this.renderInstance=Cd}readValueFromInstance(e,n){if(Rn.has(n))return this.projection?.isProjecting?Bo(n):Ob(e,n);{const r=bv(e),s=(hu(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return hv(e,n)}build(e,n,r){ta(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return ia(e,n,r)}}const Md=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function kv(t,e,n,r){Cd(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(Md.has(s)?s:oa(s),e.attrs[s])}class xv extends Ed{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wd}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Rn.has(n)){const r=Ju(n);return r&&r.default||0}return n=Md.has(n)?n:oa(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return yd(e,n,r)}build(e,n,r){fd(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){kv(e,n,r,s)}mount(e){this.isSVGTag=pd(e.tagName),super.mount(e)}}const wv=(t,e)=>ra(t)?new xv(e):new vv(e,{allowProjection:t!==w.Fragment});function $n(t,e,n){const r=t.getProps();return sa(r,e,n!==void 0?n:r.custom,t)}const ca=t=>Array.isArray(t);function Sv(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ps(n))}function Tv(t){return ca(t)?t[t.length-1]||0:t}function Ev(t,e){const n=$n(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Tv(i[o]);Sv(t,o,a)}}function Cv(t){return!!(Ne(t)&&t.add)}function Mv(t,e){const n=t.getValue("willChange");if(Cv(n))return n.add(e);if(!n&&ct.WillChange){const r=new ct.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function Av(t){return t.props[vd]}const Ov=t=>t!==null;function Pv(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Ov),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[i]}const Nv={type:"spring",stiffness:500,damping:25,restSpeed:10},Dv=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Iv={type:"keyframes",duration:.8},Rv={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Lv=(t,{keyframes:e})=>e.length>2?Iv:Rn.has(t)?t.startsWith("scale")?Dv(e[1]):Nv:Rv;function $v({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const Vv=(t,e,n,r={},s,i)=>o=>{const a=ju(r,t)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-tt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};$v(a)||Object.assign(u,Lv(t,u)),u.duration&&(u.duration=tt(u.duration)),u.repeatDelay&&(u.repeatDelay=tt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Wo(u),u.delay===0&&(d=!0)),(ct.instantAnimations||ct.skipAnimations)&&(d=!0,Wo(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!i&&e.get()!==void 0){const f=Pv(u.keyframes,a);if(f!==void 0){Ye.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new $o(u):new Zb(u)};function Fv({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function Ad(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...a}=e;r&&(i=r);const l=[],c=s&&t.animationState&&t.animationState.getState()[s];for(const u in a){const d=t.getValue(u,t.latestValues[u]??null),f=a[u];if(f===void 0||c&&Fv(c,u))continue;const h={delay:n,...ju(i||{},u)},p=d.get();if(p!==void 0&&!d.isAnimating&&!Array.isArray(f)&&f===p&&!h.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const y=Av(t);if(y){const k=window.MotionHandoffAnimation(y,u,Ye);k!==null&&(h.startTime=k,m=!0)}}Mv(t,u),d.start(Vv(u,d,f,t.shouldReduceMotion&&Ku.has(u)?{type:!1}:h,t,m));const g=d.animation;g&&l.push(g)}return o&&Promise.all(l).then(()=>{Ye.update(()=>{o&&Ev(t,o)})}),l}function Od(t,e,n,r=0,s=1){const i=Array.from(t).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),o=t.size,a=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:a-i*r}function ua(t,e,n={}){const r=$n(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(Ad(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:d}=s;return Bv(t,e,l,c,u,d,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,c]=a==="beforeChildren"?[i,o]:[o,i];return l().then(()=>c())}else return Promise.all([i(),o(n.delay)])}function Bv(t,e,n=0,r=0,s=0,i=1,o){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(ua(l,e,{...o,delay:n+(typeof r=="function"?0:r)+Od(t.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function zv(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>ua(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=ua(t,e,n);else{const s=typeof e=="function"?$n(t,e,n.custom):e;r=Promise.all(Ad(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function Pd(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const _v=ea.length;function Nd(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Nd(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<_v;n++){const r=ea[n],s=t.props[r];(yr(s)||s===!1)&&(e[r]=s)}return e}const Hv=[...Qo].reverse(),jv=Qo.length;function Kv(t){return e=>Promise.all(e.map(({animation:n,options:r})=>zv(t,n,r)))}function Wv(t){let e=Kv(t),n=Dd(),r=!0;const s=l=>(c,u)=>{const d=$n(t,u,l==="exit"?t.presenceContext?.custom:void 0);if(d){const{transition:f,transitionEnd:h,...p}=d;c={...c,...p,...h}}return c};function i(l){e=l(t)}function o(l){const{props:c}=t,u=Nd(t.parent)||{},d=[],f=new Set;let h={},p=1/0;for(let g=0;g<jv;g++){const y=Hv[g],k=n[y],S=c[y]!==void 0?c[y]:u[y],N=yr(S),T=y===l?k.isActive:null;T===!1&&(p=g);let A=S===u[y]&&S!==c[y]&&N;if(A&&r&&t.manuallyAnimateOnMount&&(A=!1),k.protectedKeys={...h},!k.isActive&&T===null||!S&&!k.prevProp||vs(S)||typeof S=="boolean")continue;const R=Uv(k.prevProp,S);let x=R||y===l&&k.isActive&&!A&&N||g>p&&N,_=!1;const U=Array.isArray(S)?S:[S];let b=U.reduce(s(y),{});T===!1&&(b={});const{prevResolvedValues:D={}}=k,V={...D,...b},C=O=>{x=!0,f.has(O)&&(_=!0,f.delete(O)),k.needsAnimating[O]=!0;const M=t.getValue(O);M&&(M.liveStyle=!1)};for(const O in V){const M=b[O],q=D[O];if(h.hasOwnProperty(O))continue;let E=!1;ca(M)&&ca(q)?E=!Pd(M,q):E=M!==q,E?M!=null?C(O):f.add(O):M!==void 0&&f.has(O)?C(O):k.protectedKeys[O]=!0}k.prevProp=S,k.prevResolvedValues=b,k.isActive&&(h={...h,...b}),r&&t.blockInitialAnimation&&(x=!1);const L=A&&R;x&&(!L||_)&&d.push(...U.map(O=>{const M={type:y};if(typeof O=="string"&&r&&!L&&t.manuallyAnimateOnMount&&t.parent){const{parent:q}=t,E=$n(q,O);if(q.enteringChildren&&E){const{delayChildren:z}=E.transition||{};M.delay=Od(q.enteringChildren,t,z)}}return{animation:O,options:M}}))}if(f.size){const g={};if(typeof c.initial!="boolean"){const y=$n(t,Array.isArray(c.initial)?c.initial[0]:c.initial);y&&y.transition&&(g.transition=y.transition)}f.forEach(y=>{const k=t.getBaseTarget(y),S=t.getValue(y);S&&(S.liveStyle=!0),g[y]=k??null}),d.push({animation:g})}let m=!!d.length;return r&&(c.initial===!1||c.initial===c.animate)&&!t.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(d):Promise.resolve()}function a(l,c){if(n[l].isActive===c)return Promise.resolve();t.variantChildren?.forEach(d=>d.animationState?.setActive(l,c)),n[l].isActive=c;const u=o(l);for(const d in n)n[d].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Dd(),r=!0}}}function Uv(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Pd(e,t):!1}function en(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Dd(){return{animate:en(!0),whileInView:en(),whileHover:en(),whileTap:en(),whileDrag:en(),whileFocus:en(),exit:en()}}class Vn{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Gv extends Vn{constructor(e){super(e),e.animationState||(e.animationState=Wv(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();vs(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let qv=0;class Jv extends Vn{constructor(){super(...arguments),this.id=qv++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Yv={animation:{Feature:Gv},exit:{Feature:Jv}};function Id(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Rd(t){return{point:{x:t.pageX,y:t.pageY}}}function Ld(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ye.postRender(()=>i(e,Rd(e)))}class Xv extends Vn{mount(){const{current:e}=this.node;e&&(this.unmount=y0(e,(n,r)=>(Ld(this.node,r,"Start"),s=>Ld(this.node,s,"End"))))}unmount(){}}class Zv extends Vn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ss(Id(this.node.current,"focus",()=>this.onFocus()),Id(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $d(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ye.postRender(()=>i(e,Rd(e)))}class Qv extends Vn{mount(){const{current:e}=this.node;e&&(this.unmount=w0(e,(n,r)=>($d(this.node,r,"Start"),(s,{success:i})=>$d(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const da=new WeakMap,fa=new WeakMap,ek=t=>{const e=da.get(t.target);e&&e(t)},tk=t=>{t.forEach(ek)};function nk({root:t,...e}){const n=t||document;fa.has(n)||fa.set(n,{});const r=fa.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(tk,{root:t,...e})),r[s]}function rk(t,e,n){const r=nk(e);return da.set(t,n),r.observe(t),()=>{da.delete(t),r.unobserve(t)}}const sk={some:0,all:1};class ik extends Vn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:sk[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:d}=this.node.getProps(),f=c?u:d;f&&f(l)};return rk(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(ok(e,n))&&this.startObserver()}unmount(){}}function ok({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const ak={renderer:wv,...Yv,...{inView:{Feature:ik},tap:{Feature:Qv},focus:{Feature:Zv},hover:{Feature:Xv}}};function ha(t){let e=t;return e.nativeEvent=t,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function Vd(t,e){Object.defineProperty(t,"target",{value:e}),Object.defineProperty(t,"currentTarget",{value:e})}function Fd(t){let e=w.useRef({isFocused:!1,observer:null});ro(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=wt(r=>{t?.(r)});return w.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){e.current.isFocused=!0;let s=r.target,i=o=>{if(e.current.isFocused=!1,s.disabled){let a=ha(o);n(a)}e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};s.addEventListener("focusout",i,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&s.disabled){var o;(o=e.current.observer)===null||o===void 0||o.disconnect();let a=s===document.activeElement?null:document.activeElement;s.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),s.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),e.current.observer.observe(s,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let xs=!1;function Bd(t){for(;t&&!wy(t);)t=t.parentElement;let e=He(t),n=e.document.activeElement;if(!n||n===t)return;xs=!0;let r=!1,s=u=>{(u.target===n||r)&&u.stopImmediatePropagation()},i=u=>{(u.target===n||r)&&(u.stopImmediatePropagation(),!t&&!r&&(r=!0,Tn(n),l()))},o=u=>{(u.target===t||r)&&u.stopImmediatePropagation()},a=u=>{(u.target===t||r)&&(u.stopImmediatePropagation(),r||(r=!0,Tn(n),l()))};e.addEventListener("blur",s,!0),e.addEventListener("focusout",i,!0),e.addEventListener("focusin",a,!0),e.addEventListener("focus",o,!0);let l=()=>{cancelAnimationFrame(c),e.removeEventListener("blur",s,!0),e.removeEventListener("focusout",i,!0),e.removeEventListener("focusin",a,!0),e.removeEventListener("focus",o,!0),xs=!1,r=!1},c=requestAnimationFrame(l);return l}let Fn="default",pa="",ws=new WeakMap;function zd(t){if(lo()){if(Fn==="default"){const e=Me(t);pa=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}Fn="disabled"}else if(t instanceof HTMLElement||t instanceof SVGElement){let e="userSelect"in t.style?"userSelect":"webkitUserSelect";ws.set(t,t.style[e]),t.style[e]="none"}}function ma(t){if(lo()){if(Fn!=="disabled")return;Fn="restoring",setTimeout(()=>{Hc(()=>{if(Fn==="restoring"){const e=Me(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=pa||""),pa="",Fn="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&ws.has(t)){let e=ws.get(t),n="userSelect"in t.style?"userSelect":"webkitUserSelect";t.style[n]==="none"&&(t.style[n]=e),t.getAttribute("style")===""&&t.removeAttribute("style"),ws.delete(t)}}const _d=w.createContext({register:()=>{}});_d.displayName="PressResponderContext";function lk(t,e){return e.get?e.get.call(t):e.value}function Hd(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function ck(t,e){var n=Hd(t,e,"get");return lk(t,n)}function uk(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}function jd(t,e,n){var r=Hd(t,e,"set");return uk(t,r,n),n}function dk(t){let e=w.useContext(_d);if(e){let{register:n,...r}=e;t=Sn(r,t),n()}return jc(e,t.ref),t}var Ss=new WeakMap;class Ts{continuePropagation(){jd(this,Ss,!1)}get shouldStopPropagation(){return ck(this,Ss)}constructor(e,n,r,s){Yg(this,Ss,{writable:!0,value:void 0}),jd(this,Ss,!0);var i;let o=(i=s?.target)!==null&&i!==void 0?i:r.currentTarget;const a=o?.getBoundingClientRect();let l,c=0,u,d=null;r.clientX!=null&&r.clientY!=null&&(u=r.clientX,d=r.clientY),a&&(u!=null&&d!=null?(l=u-a.left,c=d-a.top):(l=a.width/2,c=a.height/2)),this.type=e,this.pointerType=n,this.target=r.currentTarget,this.shiftKey=r.shiftKey,this.metaKey=r.metaKey,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.x=l,this.y=c}}const Kd=Symbol("linkClicked"),Wd="react-aria-pressable-style",Ud="data-react-aria-pressable";function fk(t){let{onPress:e,onPressChange:n,onPressStart:r,onPressEnd:s,onPressUp:i,onClick:o,isDisabled:a,isPressed:l,preventFocusOnPress:c,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:d,ref:f,...h}=dk(t),[p,m]=w.useState(!1),g=w.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:y,removeAllGlobalListeners:k}=uo(),S=wt((b,D)=>{let V=g.current;if(a||V.didFirePressStart)return!1;let C=!0;if(V.isTriggeringEvent=!0,r){let L=new Ts("pressstart",D,b);r(L),C=L.shouldStopPropagation}return n&&n(!0),V.isTriggeringEvent=!1,V.didFirePressStart=!0,m(!0),C}),N=wt((b,D,V=!0)=>{let C=g.current;if(!C.didFirePressStart)return!1;C.didFirePressStart=!1,C.isTriggeringEvent=!0;let L=!0;if(s){let v=new Ts("pressend",D,b);s(v),L=v.shouldStopPropagation}if(n&&n(!1),m(!1),e&&V&&!a){let v=new Ts("press",D,b);e(v),L&&(L=v.shouldStopPropagation)}return C.isTriggeringEvent=!1,L}),T=wt((b,D)=>{let V=g.current;if(a)return!1;if(i){V.isTriggeringEvent=!0;let C=new Ts("pressup",D,b);return i(C),V.isTriggeringEvent=!1,C.shouldStopPropagation}return!0}),A=wt(b=>{let D=g.current;if(D.isPressed&&D.target){D.didFirePressStart&&D.pointerType!=null&&N(tn(D.target,b),D.pointerType,!1),D.isPressed=!1,D.isOverTarget=!1,D.activePointerId=null,D.pointerType=null,k(),d||ma(D.target);for(let V of D.disposables)V();D.disposables=[]}}),R=wt(b=>{u&&A(b)}),x=wt(b=>{o?.(b)}),_=wt((b,D)=>{if(o){let V=new MouseEvent("click",b);Vd(V,D),o(ha(V))}}),U=w.useMemo(()=>{let b=g.current,D={onKeyDown(C){if(ya(C.nativeEvent,C.currentTarget)&&ae(C.currentTarget,re(C.nativeEvent))){var L;Jd(re(C.nativeEvent),C.key)&&C.preventDefault();let v=!0;if(!b.isPressed&&!C.repeat){b.target=C.currentTarget,b.isPressed=!0,b.pointerType="keyboard",v=S(C,"keyboard");let O=C.currentTarget,M=q=>{ya(q,O)&&!q.repeat&&ae(O,re(q))&&b.target&&T(tn(b.target,q),"keyboard")};y(Me(C.currentTarget),"keyup",$c(M,V),!0)}v&&C.stopPropagation(),C.metaKey&&En()&&((L=b.metaKeyEvents)===null||L===void 0||L.set(C.key,C.nativeEvent))}else C.key==="Meta"&&(b.metaKeyEvents=new Map)},onClick(C){if(!(C&&!ae(C.currentTarget,re(C.nativeEvent)))&&C&&C.button===0&&!b.isTriggeringEvent&&!ur.isOpening){let L=!0;if(a&&C.preventDefault(),!b.ignoreEmulatedMouseEvents&&!b.isPressed&&(b.pointerType==="virtual"||fo(C.nativeEvent))){let v=S(C,"virtual"),O=T(C,"virtual"),M=N(C,"virtual");x(C),L=v&&O&&M}else if(b.isPressed&&b.pointerType!=="keyboard"){let v=b.pointerType||C.nativeEvent.pointerType||"virtual",O=T(tn(C.currentTarget,C),v),M=N(tn(C.currentTarget,C),v,!0);L=O&&M,b.isOverTarget=!1,x(C),A(C)}b.ignoreEmulatedMouseEvents=!1,L&&C.stopPropagation()}}},V=C=>{var L;if(b.isPressed&&b.target&&ya(C,b.target)){var v;Jd(re(C),C.key)&&C.preventDefault();let M=re(C),q=ae(b.target,re(C));N(tn(b.target,C),"keyboard",q),q&&_(C,b.target),k(),C.key!=="Enter"&&ga(b.target)&&ae(b.target,M)&&!C[Kd]&&(C[Kd]=!0,ur(b.target,C,!1)),b.isPressed=!1,(v=b.metaKeyEvents)===null||v===void 0||v.delete(C.key)}else if(C.key==="Meta"&&(!((L=b.metaKeyEvents)===null||L===void 0)&&L.size)){var O;let M=b.metaKeyEvents;b.metaKeyEvents=void 0;for(let q of M.values())(O=b.target)===null||O===void 0||O.dispatchEvent(new KeyboardEvent("keyup",q))}};if(typeof PointerEvent<"u"){D.onPointerDown=v=>{if(v.button!==0||!ae(v.currentTarget,re(v.nativeEvent)))return;if(yy(v.nativeEvent)){b.pointerType="virtual";return}b.pointerType=v.pointerType;let O=!0;if(!b.isPressed){b.isPressed=!0,b.isOverTarget=!0,b.activePointerId=v.pointerId,b.target=v.currentTarget,d||zd(b.target),O=S(v,b.pointerType);let M=re(v.nativeEvent);"releasePointerCapture"in M&&M.releasePointerCapture(v.pointerId),y(Me(v.currentTarget),"pointerup",C,!1),y(Me(v.currentTarget),"pointercancel",L,!1)}O&&v.stopPropagation()},D.onMouseDown=v=>{if(ae(v.currentTarget,re(v.nativeEvent))&&v.button===0){if(c){let O=Bd(v.target);O&&b.disposables.push(O)}v.stopPropagation()}},D.onPointerUp=v=>{!ae(v.currentTarget,re(v.nativeEvent))||b.pointerType==="virtual"||v.button===0&&!b.isPressed&&T(v,b.pointerType||v.pointerType)},D.onPointerEnter=v=>{v.pointerId===b.activePointerId&&b.target&&!b.isOverTarget&&b.pointerType!=null&&(b.isOverTarget=!0,S(tn(b.target,v),b.pointerType))},D.onPointerLeave=v=>{v.pointerId===b.activePointerId&&b.target&&b.isOverTarget&&b.pointerType!=null&&(b.isOverTarget=!1,N(tn(b.target,v),b.pointerType,!1),R(v))};let C=v=>{if(v.pointerId===b.activePointerId&&b.isPressed&&v.button===0&&b.target){if(ae(b.target,re(v))&&b.pointerType!=null){let O=!1,M=setTimeout(()=>{b.isPressed&&b.target instanceof HTMLElement&&(O?A(v):(Tn(b.target),b.target.click()))},80);y(v.currentTarget,"click",()=>O=!0,!0),b.disposables.push(()=>clearTimeout(M))}else A(v);b.isOverTarget=!1}},L=v=>{A(v)};D.onDragStart=v=>{ae(v.currentTarget,re(v.nativeEvent))&&A(v)}}else if(process.env.NODE_ENV==="test"){D.onMouseDown=v=>{if(v.button!==0||!ae(v.currentTarget,re(v.nativeEvent)))return;if(b.ignoreEmulatedMouseEvents){v.stopPropagation();return}if(b.isPressed=!0,b.isOverTarget=!0,b.target=v.currentTarget,b.pointerType=fo(v.nativeEvent)?"virtual":"mouse",Ec.flushSync(()=>S(v,b.pointerType))&&v.stopPropagation(),c){let M=Bd(v.target);M&&b.disposables.push(M)}y(Me(v.currentTarget),"mouseup",C,!1)},D.onMouseEnter=v=>{if(!ae(v.currentTarget,re(v.nativeEvent)))return;let O=!0;b.isPressed&&!b.ignoreEmulatedMouseEvents&&b.pointerType!=null&&(b.isOverTarget=!0,O=S(v,b.pointerType)),O&&v.stopPropagation()},D.onMouseLeave=v=>{if(!ae(v.currentTarget,re(v.nativeEvent)))return;let O=!0;b.isPressed&&!b.ignoreEmulatedMouseEvents&&b.pointerType!=null&&(b.isOverTarget=!1,O=N(v,b.pointerType,!1),R(v)),O&&v.stopPropagation()},D.onMouseUp=v=>{ae(v.currentTarget,re(v.nativeEvent))&&!b.ignoreEmulatedMouseEvents&&v.button===0&&!b.isPressed&&T(v,b.pointerType||"mouse")};let C=v=>{if(v.button===0){if(b.ignoreEmulatedMouseEvents){b.ignoreEmulatedMouseEvents=!1;return}b.target&&b.target.contains(v.target)&&b.pointerType!=null||A(v),b.isOverTarget=!1}};D.onTouchStart=v=>{if(!ae(v.currentTarget,re(v.nativeEvent)))return;let O=hk(v.nativeEvent);if(!O)return;b.activePointerId=O.identifier,b.ignoreEmulatedMouseEvents=!0,b.isOverTarget=!0,b.isPressed=!0,b.target=v.currentTarget,b.pointerType="touch",d||zd(b.target),S(Ct(b.target,v),b.pointerType)&&v.stopPropagation(),y(He(v.currentTarget),"scroll",L,!0)},D.onTouchMove=v=>{if(!ae(v.currentTarget,re(v.nativeEvent)))return;if(!b.isPressed){v.stopPropagation();return}let O=Gd(v.nativeEvent,b.activePointerId),M=!0;O&&qd(O,v.currentTarget)?!b.isOverTarget&&b.pointerType!=null&&(b.isOverTarget=!0,M=S(Ct(b.target,v),b.pointerType)):b.isOverTarget&&b.pointerType!=null&&(b.isOverTarget=!1,M=N(Ct(b.target,v),b.pointerType,!1),R(Ct(b.target,v))),M&&v.stopPropagation()},D.onTouchEnd=v=>{if(!ae(v.currentTarget,re(v.nativeEvent)))return;if(!b.isPressed){v.stopPropagation();return}let O=Gd(v.nativeEvent,b.activePointerId),M=!0;O&&qd(O,v.currentTarget)&&b.pointerType!=null?(T(Ct(b.target,v),b.pointerType),M=N(Ct(b.target,v),b.pointerType),_(v.nativeEvent,b.target)):b.isOverTarget&&b.pointerType!=null&&(M=N(Ct(b.target,v),b.pointerType,!1)),M&&v.stopPropagation(),b.isPressed=!1,b.activePointerId=null,b.isOverTarget=!1,b.ignoreEmulatedMouseEvents=!0,b.target&&!d&&ma(b.target),k()},D.onTouchCancel=v=>{ae(v.currentTarget,re(v.nativeEvent))&&(v.stopPropagation(),b.isPressed&&A(Ct(b.target,v)))};let L=v=>{b.isPressed&&ae(re(v),b.target)&&A({currentTarget:b.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};D.onDragStart=v=>{ae(v.currentTarget,re(v.nativeEvent))&&A(v)}}return D},[y,a,c,k,d,A,R,N,S,T,x,_]);return w.useEffect(()=>{if(!f||process.env.NODE_ENV==="test")return;const b=Me(f.current);if(!b||!b.head||b.getElementById(Wd))return;const D=b.createElement("style");D.id=Wd,D.textContent=`
31
+ @layer {
32
+ [${Ud}] {
33
+ touch-action: pan-x pan-y pinch-zoom;
34
+ }
35
+ }
36
+ `.trim(),b.head.prepend(D)},[f]),w.useEffect(()=>{let b=g.current;return()=>{var D;d||ma((D=b.target)!==null&&D!==void 0?D:void 0);for(let V of b.disposables)V();b.disposables=[]}},[d]),{isPressed:l||p,pressProps:Sn(h,U,{[Ud]:!0})}}function ga(t){return t.tagName==="A"&&t.hasAttribute("href")}function ya(t,e){const{key:n,code:r}=t,s=e,i=s.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(s instanceof He(s).HTMLInputElement&&!Yd(s,n)||s instanceof He(s).HTMLTextAreaElement||s.isContentEditable)&&!((i==="link"||!i&&ga(s))&&n!=="Enter")}function hk(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function Gd(t,e){const n=t.changedTouches;for(let r=0;r<n.length;r++){const s=n[r];if(s.identifier===e)return s}return null}function Ct(t,e){let n=0,r=0;return e.targetTouches&&e.targetTouches.length===1&&(n=e.targetTouches[0].clientX,r=e.targetTouches[0].clientY),{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r}}function tn(t,e){let n=e.clientX,r=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r}}function pk(t){let e=0,n=0;return t.width!==void 0?e=t.width/2:t.radiusX!==void 0&&(e=t.radiusX),t.height!==void 0?n=t.height/2:t.radiusY!==void 0&&(n=t.radiusY),{top:t.clientY-n,right:t.clientX+e,bottom:t.clientY+n,left:t.clientX-e}}function mk(t,e){return!(t.left>e.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function qd(t,e){let n=e.getBoundingClientRect(),r=pk(t);return mk(n,r)}function gk(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!ga(t)}function Jd(t,e){return t instanceof HTMLInputElement?!Yd(t,e):gk(t)}const yk=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Yd(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":yk.has(t.type)}let Bn=null,ba=new Set,br=new Map,nn=!1,va=!1;const bk={Tab:!0,Escape:!0};function ka(t,e){for(let n of ba)n(t,e)}function vk(t){return!(t.metaKey||!En()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function Es(t){nn=!0,vk(t)&&(Bn="keyboard",ka("keyboard",t))}function Ke(t){Bn="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(nn=!0,ka("pointer",t))}function Xd(t){fo(t)&&(nn=!0,Bn="virtual")}function Zd(t){t.target===window||t.target===document||xs||!t.isTrusted||(!nn&&!va&&(Bn="virtual",ka("virtual",t)),nn=!1,va=!1)}function Qd(){xs||(nn=!1,va=!0)}function xa(t){if(typeof window>"u"||typeof document>"u"||br.get(He(t)))return;const e=He(t),n=Me(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){nn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Es,!0),n.addEventListener("keyup",Es,!0),n.addEventListener("click",Xd,!0),e.addEventListener("focus",Zd,!0),e.addEventListener("blur",Qd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Ke,!0),n.addEventListener("pointermove",Ke,!0),n.addEventListener("pointerup",Ke,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Ke,!0),n.addEventListener("mousemove",Ke,!0),n.addEventListener("mouseup",Ke,!0)),e.addEventListener("beforeunload",()=>{ef(t)},{once:!0}),br.set(e,{focus:r})}const ef=(t,e)=>{const n=He(t),r=Me(t);e&&r.removeEventListener("DOMContentLoaded",e),br.has(n)&&(n.HTMLElement.prototype.focus=br.get(n).focus,r.removeEventListener("keydown",Es,!0),r.removeEventListener("keyup",Es,!0),r.removeEventListener("click",Xd,!0),n.removeEventListener("focus",Zd,!0),n.removeEventListener("blur",Qd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Ke,!0),r.removeEventListener("pointermove",Ke,!0),r.removeEventListener("pointerup",Ke,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Ke,!0),r.removeEventListener("mousemove",Ke,!0),r.removeEventListener("mouseup",Ke,!0)),br.delete(n))};function kk(t){const e=Me(t);let n;return e.readyState!=="loading"?xa(t):(n=()=>{xa(t)},e.addEventListener("DOMContentLoaded",n)),()=>ef(t,n)}typeof document<"u"&&kk();function tf(){return Bn!=="pointer"}function xk(){return Bn}const wk=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Sk(t,e,n){let r=Me(n?.target);const s=typeof window<"u"?He(n?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?He(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?He(n?.target).HTMLElement:HTMLElement,a=typeof window<"u"?He(n?.target).KeyboardEvent:KeyboardEvent;return t=t||r.activeElement instanceof s&&!wk.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(t&&e==="keyboard"&&n instanceof a&&!bk[n.key])}function Tk(t,e,n){xa(),w.useEffect(()=>{let r=(s,i)=>{Sk(!!n?.isTextInput,s,i)&&t(tf())};return ba.add(r),()=>{ba.delete(r)}},e)}function Ek(t){const e=Me(t),n=cr(e);if(xk()==="virtual"){let r=n;Hc(()=>{cr(e)===r&&t.isConnected&&Tn(t)})}else Tn(t)}function nf(t){let{isDisabled:e,onFocus:n,onBlur:r,onFocusChange:s}=t;const i=w.useCallback(l=>{if(l.target===l.currentTarget)return r&&r(l),s&&s(!1),!0},[r,s]),o=Fd(i),a=w.useCallback(l=>{const c=Me(l.target),u=c?cr(c):cr();l.target===l.currentTarget&&u===re(l.nativeEvent)&&(n&&n(l),s&&s(!0),o(l))},[s,n,o]);return{focusProps:{onFocus:!e&&(n||s||r)?a:void 0,onBlur:!e&&(r||s)?i:void 0}}}function rf(t){if(!t)return;let e=!0;return n=>{let r={...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){e&&process.env.NODE_ENV!=="production"?console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior."):e=!0},continuePropagation(){e=!1},isPropagationStopped(){return e}};t(r),e&&n.stopPropagation()}}function Ck(t){return{keyboardProps:t.isDisabled?{}:{onKeyDown:rf(t.onKeyDown),onKeyUp:rf(t.onKeyUp)}}}let Mk=w.createContext(null);function Ak(t){let e=w.useContext(Mk)||{};jc(e,t);let{ref:n,...r}=e;return r}function Ok(t,e){let{focusProps:n}=nf(t),{keyboardProps:r}=Ck(t),s=Sn(n,r),i=Ak(e),o=t.isDisabled?{}:i,a=w.useRef(t.autoFocus);w.useEffect(()=>{a.current&&e.current&&Ek(e.current),a.current=!1},[e]);let l=t.excludeFromTabOrder?-1:0;return t.isDisabled&&(l=void 0),{focusableProps:Sn({...s,tabIndex:l},o)}}function Pk(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:s}=t,i=w.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:a}=uo(),l=w.useCallback(d=>{d.currentTarget.contains(d.target)&&i.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(i.current.isFocusWithin=!1,a(),n&&n(d),s&&s(!1))},[n,s,i,a]),c=Fd(l),u=w.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=Me(d.target),h=cr(f);if(!i.current.isFocusWithin&&h===re(d.nativeEvent)){r&&r(d),s&&s(!0),i.current.isFocusWithin=!0,c(d);let p=d.currentTarget;o(f,"focus",m=>{if(i.current.isFocusWithin&&!ae(p,m.target)){let g=new f.defaultView.FocusEvent("blur",{relatedTarget:m.target});Vd(g,p);let y=ha(g);l(y)}},{capture:!0})}},[r,s,c,o,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:l}}}let Cs=!1,Ms=0;function wa(){Cs=!0,setTimeout(()=>{Cs=!1},50)}function sf(t){t.pointerType==="touch"&&wa()}function Nk(){if(!(typeof document>"u"))return Ms===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",sf):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",wa)),Ms++,()=>{Ms--,!(Ms>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",sf):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",wa))}}function Dk(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:s}=t,[i,o]=w.useState(!1),a=w.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;w.useEffect(Nk,[]);let{addGlobalListener:l,removeAllGlobalListeners:c}=uo(),{hoverProps:u,triggerHoverEnd:d}=w.useMemo(()=>{let f=(m,g)=>{if(a.pointerType=g,s||g==="touch"||a.isHovered||!m.currentTarget.contains(m.target))return;a.isHovered=!0;let y=m.currentTarget;a.target=y,l(Me(m.target),"pointerover",k=>{a.isHovered&&a.target&&!ae(a.target,k.target)&&h(k,k.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:y,pointerType:g}),n&&n(!0),o(!0)},h=(m,g)=>{let y=a.target;a.pointerType="",a.target=null,!(g==="touch"||!a.isHovered||!y)&&(a.isHovered=!1,c(),r&&r({type:"hoverend",target:y,pointerType:g}),n&&n(!1),o(!1))},p={};return typeof PointerEvent<"u"?(p.onPointerEnter=m=>{Cs&&m.pointerType==="mouse"||f(m,m.pointerType)},p.onPointerLeave=m=>{!s&&m.currentTarget.contains(m.target)&&h(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(p.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},p.onMouseEnter=m=>{!a.ignoreEmulatedMouseEvents&&!Cs&&f(m,"mouse"),a.ignoreEmulatedMouseEvents=!1},p.onMouseLeave=m=>{!s&&m.currentTarget.contains(m.target)&&h(m,"mouse")}),{hoverProps:p,triggerHoverEnd:h}},[e,n,r,s,a,l,c]);return w.useEffect(()=>{s&&d({currentTarget:a.target},a.pointerType)},[s]),{hoverProps:u,isHovered:i}}function Ik(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,s=w.useRef({isFocused:!1,isFocusVisible:e||tf()}),[i,o]=w.useState(!1),[a,l]=w.useState(()=>s.current.isFocused&&s.current.isFocusVisible),c=w.useCallback(()=>l(s.current.isFocused&&s.current.isFocusVisible),[]),u=w.useCallback(h=>{s.current.isFocused=h,o(h),c()},[c]);Tk(h=>{s.current.isFocusVisible=h,c()},[],{isTextInput:n});let{focusProps:d}=nf({isDisabled:r,onFocusChange:u}),{focusWithinProps:f}=Pk({isDisabled:!r,onFocusWithinChange:u});return{isFocused:i,isFocusVisible:a,focusProps:r?f:d}}function Rk(t){return w.forwardRef(t)}var Lk=(t,e,n=!0)=>{if(!e)return[t,{}];const r=e.reduce((s,i)=>i in t?{...s,[i]:t[i]}:s,{});return n?[Object.keys(t).filter(i=>!e.includes(i)).reduce((i,o)=>({...i,[o]:t[o]}),{}),r]:[t,r]},$k={".spinner-bar-animation":{"animation-delay":"calc(-1.2s + (0.1s * var(--bar-index)))",transform:"rotate(calc(30deg * var(--bar-index)))translate(140%)"},".spinner-dot-animation":{"animation-delay":"calc(250ms * var(--dot-index))"},".spinner-dot-blink-animation":{"animation-delay":"calc(200ms * var(--dot-index))"}},Vk={".leading-inherit":{"line-height":"inherit"},".bg-img-inherit":{"background-image":"inherit"},".bg-clip-inherit":{"background-clip":"inherit"},".text-fill-inherit":{"-webkit-text-fill-color":"inherit"},".tap-highlight-transparent":{"-webkit-tap-highlight-color":"transparent"},".input-search-cancel-button-none":{"&::-webkit-search-cancel-button":{"-webkit-appearance":"none"}}},Fk={".scrollbar-hide":{"-ms-overflow-style":"none","scrollbar-width":"none","&::-webkit-scrollbar":{display:"none"}},".scrollbar-default":{"-ms-overflow-style":"auto","scrollbar-width":"auto","&::-webkit-scrollbar":{display:"block"}}},Bk={".text-tiny":{"font-size":"var(--heroui-font-size-tiny)","line-height":"var(--heroui-line-height-tiny)"},".text-small":{"font-size":"var(--heroui-font-size-small)","line-height":"var(--heroui-line-height-small)"},".text-medium":{"font-size":"var(--heroui-font-size-medium)","line-height":"var(--heroui-line-height-medium)"},".text-large":{"font-size":"var(--heroui-font-size-large)","line-height":"var(--heroui-line-height-large)"}},nt="250ms",zk={".transition-background":{"transition-property":"background","transition-timing-function":"ease","transition-duration":nt},".transition-colors-opacity":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity","transition-timing-function":"ease","transition-duration":nt},".transition-width":{"transition-property":"width","transition-timing-function":"ease","transition-duration":nt},".transition-height":{"transition-property":"height","transition-timing-function":"ease","transition-duration":nt},".transition-size":{"transition-property":"width, height","transition-timing-function":"ease","transition-duration":nt},".transition-left":{"transition-property":"left","transition-timing-function":"ease","transition-duration":nt},".transition-transform-opacity":{"transition-property":"transform, scale, opacity rotate","transition-timing-function":"ease","transition-duration":nt},".transition-transform-background":{"transition-property":"transform, scale, background","transition-timing-function":"ease","transition-duration":nt},".transition-transform-colors":{"transition-property":"transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke","transition-timing-function":"ease","transition-duration":nt},".transition-transform-colors-opacity":{"transition-property":"transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke, opacity","transition-timing-function":"ease","transition-duration":nt}},_k={...Vk,...zk,...Fk,...Bk,...$k},As=["small","medium","large"],of={theme:{spacing:["divider"],radius:As},classGroups:{shadow:[{shadow:As}],opacity:[{opacity:["disabled"]}],"font-size":[{text:["tiny",...As]}],"border-w":[{border:As}],"bg-image":["bg-stripe-gradient-default","bg-stripe-gradient-primary","bg-stripe-gradient-secondary","bg-stripe-gradient-success","bg-stripe-gradient-warning","bg-stripe-gradient-danger"],transition:Object.keys(_k).filter(t=>t.includes(".transition")).map(t=>t.replace(".",""))}},af=t=>t===!1?"false":t===!0?"true":t===0?"0":t,$e=t=>{if(!t||typeof t!="object")return!0;for(let e in t)return!1;return!0},Hk=(t,e)=>{if(t===e)return!0;if(!t||!e)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++){let i=n[s];if(!r.includes(i)||t[i]!==e[i])return!1}return!0};function lf(t,e){for(let n=0;n<t.length;n++){let r=t[n];Array.isArray(r)?lf(r,e):e.push(r)}}var cf=(...t)=>{let e=[];lf(t,e);let n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n},uf=(t,e)=>{let n={};for(let r in t){let s=t[r];if(r in e){let i=e[r];Array.isArray(s)||Array.isArray(i)?n[r]=cf(i,s):typeof s=="object"&&typeof i=="object"&&s&&i?n[r]=uf(s,i):n[r]=i+" "+s}else n[r]=s}for(let r in e)r in t||(n[r]=e[r]);return n},jk=/\s+/g,df=t=>!t||typeof t!="string"?t:t.replace(jk," ").trim();const Sa="-",Kk=t=>{const e=Uk(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(Sa);return a[0]===""&&a.length!==1&&a.shift(),ff(a,e)||Wk(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},ff=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?ff(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(Sa);return e.validators.find(({validator:o})=>o(i))?.classGroupId},hf=/^\[(.+)\]$/,Wk=t=>{if(hf.test(t)){const e=hf.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Uk=t=>{const{theme:e,classGroups:n}=t,r={nextPart:new Map,validators:[]};for(const s in n)Ta(n[s],r,s,e);return r},Ta=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:pf(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(Gk(s)){Ta(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Ta(o,pf(e,i),n,r)})})},pf=(t,e)=>{let n=t;return e.split(Sa).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Gk=t=>t.isThemeGetter,qk=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Ea="!",Ca=":",Jk=Ca.length,Yk=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let o=0,a=0,l=0,c;for(let p=0;p<s.length;p++){let m=s[p];if(o===0&&a===0){if(m===Ca){i.push(s.slice(l,p)),l=p+Jk;continue}if(m==="/"){c=p;continue}}m==="["?o++:m==="]"?o--:m==="("?a++:m===")"&&a--}const u=i.length===0?s:s.substring(l),d=Xk(u),f=d!==u,h=c&&c>l?c-l:void 0;return{modifiers:i,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}};if(e){const s=e+Ca,i=r;r=o=>o.startsWith(s)?i(o.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},Xk=t=>t.endsWith(Ea)?t.substring(0,t.length-1):t.startsWith(Ea)?t.substring(1):t,Zk=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const s=[];let i=[];return r.forEach(o=>{o[0]==="["||e[o]?(s.push(...i.sort(),o),i=[]):i.push(o)}),s.push(...i.sort()),s}},Qk=t=>({cache:qk(t.cacheSize),parseClassName:Yk(t),sortModifiers:Zk(t),...Kk(t)}),ex=/\s+/,tx=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,o=[],a=t.trim().split(ex);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let g=!!m,y=r(g?p.substring(0,m):p);if(!y){if(!g){l=u+(l.length>0?" "+l:l);continue}if(y=r(p),!y){l=u+(l.length>0?" "+l:l);continue}g=!1}const k=i(f).join(":"),S=h?k+Ea:k,N=S+y;if(o.includes(N))continue;o.push(N);const T=s(y,g);for(let A=0;A<T.length;++A){const R=T[A];o.push(S+R)}l=u+(l.length>0?" "+l:l)}return l};function nx(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=mf(e))&&(r&&(r+=" "),r+=n);return r}const mf=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=mf(t[r]))&&(n&&(n+=" "),n+=e);return n};function Ma(t,...e){let n,r,s,i=o;function o(l){const c=e.reduce((u,d)=>d(u),t());return n=Qk(c),r=n.cache.get,s=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=tx(l,n);return s(l,u),u}return function(){return i(nx.apply(null,arguments))}}const ye=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},gf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rx=/^\d+\/\d+$/,sx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ix=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ox=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ax=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zn=t=>rx.test(t),X=t=>!!t&&!Number.isNaN(Number(t)),Mt=t=>!!t&&Number.isInteger(Number(t)),Aa=t=>t.endsWith("%")&&X(t.slice(0,-1)),dt=t=>sx.test(t),cx=()=>!0,ux=t=>ix.test(t)&&!ox.test(t),bf=()=>!1,dx=t=>ax.test(t),fx=t=>lx.test(t),hx=t=>!F(t)&&!B(t),px=t=>_n(t,Sf,bf),F=t=>gf.test(t),rn=t=>_n(t,Tf,ux),Oa=t=>_n(t,vx,X),vf=t=>_n(t,xf,bf),mx=t=>_n(t,wf,fx),Os=t=>_n(t,Ef,dx),B=t=>yf.test(t),vr=t=>Hn(t,Tf),gx=t=>Hn(t,kx),kf=t=>Hn(t,xf),yx=t=>Hn(t,Sf),bx=t=>Hn(t,wf),Ps=t=>Hn(t,Ef,!0),_n=(t,e,n)=>{const r=gf.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Hn=(t,e,n=!1)=>{const r=yf.exec(t);return r?r[1]?e(r[1]):n:!1},xf=t=>t==="position"||t==="percentage",wf=t=>t==="image"||t==="url",Sf=t=>t==="length"||t==="size"||t==="bg-size",Tf=t=>t==="length",vx=t=>t==="number",kx=t=>t==="family-name",Ef=t=>t==="shadow",Pa=()=>{const t=ye("color"),e=ye("font"),n=ye("text"),r=ye("font-weight"),s=ye("tracking"),i=ye("leading"),o=ye("breakpoint"),a=ye("container"),l=ye("spacing"),c=ye("radius"),u=ye("shadow"),d=ye("inset-shadow"),f=ye("text-shadow"),h=ye("drop-shadow"),p=ye("blur"),m=ye("perspective"),g=ye("aspect"),y=ye("ease"),k=ye("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...N(),B,F],A=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],x=()=>[B,F,l],_=()=>[zn,"full","auto",...x()],U=()=>[Mt,"none","subgrid",B,F],b=()=>["auto",{span:["full",Mt,B,F]},Mt,B,F],D=()=>[Mt,"auto",B,F],V=()=>["auto","min","max","fr",B,F],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],v=()=>["auto",...x()],O=()=>[zn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],M=()=>[t,B,F],q=()=>[...N(),kf,vf,{position:[B,F]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",yx,px,{size:[B,F]}],Z=()=>[Aa,vr,rn],K=()=>["","none","full",c,B,F],Q=()=>["",X,vr,rn],Se=()=>["solid","dashed","dotted","double"],Gt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[X,Aa,kf,vf],be=()=>["","none",p,B,F],et=()=>["none",X,B,F],qt=()=>["none",X,B,F],Zr=()=>[X,B,F],no=()=>[zn,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dt],breakpoint:[dt],color:[cx],container:[dt],"drop-shadow":[dt],ease:["in","out","in-out"],font:[hx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dt],shadow:[dt],spacing:["px",X],text:[dt],"text-shadow":[dt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zn,F,B,g]}],container:["container"],columns:[{columns:[X,F,B,a]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Mt,"auto",B,F]}],basis:[{basis:[zn,"full","auto",a,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[X,zn,"auto","initial","none",F]}],grow:[{grow:["",X,B,F]}],shrink:[{shrink:["",X,B,F]}],order:[{order:[Mt,"first","last","none",B,F]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:b()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:b()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:v()}],mx:[{mx:v()}],my:[{my:v()}],ms:[{ms:v()}],me:[{me:v()}],mt:[{mt:v()}],mr:[{mr:v()}],mb:[{mb:v()}],ml:[{ml:v()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[a,"screen",...O()]}],"min-w":[{"min-w":[a,"screen","none",...O()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,vr,rn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,B,Oa]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Aa,F]}],"font-family":[{font:[gx,F,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,B,F]}],"line-clamp":[{"line-clamp":[X,"none",B,Oa]}],leading:[{leading:[i,...x()]}],"list-image":[{"list-image":["none",B,F]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",B,F]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[X,"from-font","auto",B,rn]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[X,"auto",B,F]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",B,F]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",B,F]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mt,B,F],radial:["",B,F],conic:[Mt,B,F]},bx,mx]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[X,B,F]}],"outline-w":[{outline:["",X,vr,rn]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,Ps,Os]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",d,Ps,Os]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[X,rn]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,Ps,Os]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[X,B,F]}],"mix-blend":[{"mix-blend":[...Gt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Gt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[X]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[B,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[X]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",B,F]}],filter:[{filter:["","none",B,F]}],blur:[{blur:be()}],brightness:[{brightness:[X,B,F]}],contrast:[{contrast:[X,B,F]}],"drop-shadow":[{"drop-shadow":["","none",h,Ps,Os]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",X,B,F]}],"hue-rotate":[{"hue-rotate":[X,B,F]}],invert:[{invert:["",X,B,F]}],saturate:[{saturate:[X,B,F]}],sepia:[{sepia:["",X,B,F]}],"backdrop-filter":[{"backdrop-filter":["","none",B,F]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[X,B,F]}],"backdrop-contrast":[{"backdrop-contrast":[X,B,F]}],"backdrop-grayscale":[{"backdrop-grayscale":["",X,B,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[X,B,F]}],"backdrop-invert":[{"backdrop-invert":["",X,B,F]}],"backdrop-opacity":[{"backdrop-opacity":[X,B,F]}],"backdrop-saturate":[{"backdrop-saturate":[X,B,F]}],"backdrop-sepia":[{"backdrop-sepia":["",X,B,F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",B,F]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[X,"initial",B,F]}],ease:[{ease:["linear","initial",y,B,F]}],delay:[{delay:[X,B,F]}],animate:[{animate:["none",k,B,F]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,B,F]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:et()}],"rotate-x":[{"rotate-x":et()}],"rotate-y":[{"rotate-y":et()}],"rotate-z":[{"rotate-z":et()}],scale:[{scale:qt()}],"scale-x":[{"scale-x":qt()}],"scale-y":[{"scale-y":qt()}],"scale-z":[{"scale-z":qt()}],"scale-3d":["scale-3d"],skew:[{skew:Zr()}],"skew-x":[{"skew-x":Zr()}],"skew-y":[{"skew-y":Zr()}],transform:[{transform:[B,F,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:no()}],"translate-x":[{"translate-x":no()}],"translate-y":[{"translate-y":no()}],"translate-z":[{"translate-z":no()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",B,F]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",B,F]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[X,vr,rn,Oa]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},xx=(t,{cacheSize:e,prefix:n,experimentalParseClassName:r,extend:s={},override:i={}})=>(kr(t,"cacheSize",e),kr(t,"prefix",n),kr(t,"experimentalParseClassName",r),Ns(t.theme,i.theme),Ns(t.classGroups,i.classGroups),Ns(t.conflictingClassGroups,i.conflictingClassGroups),Ns(t.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),kr(t,"orderSensitiveModifiers",i.orderSensitiveModifiers),Ds(t.theme,s.theme),Ds(t.classGroups,s.classGroups),Ds(t.conflictingClassGroups,s.conflictingClassGroups),Ds(t.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),Cf(t,s,"orderSensitiveModifiers"),t),kr=(t,e,n)=>{n!==void 0&&(t[e]=n)},Ns=(t,e)=>{if(e)for(const n in e)kr(t,n,e[n])},Ds=(t,e)=>{if(e)for(const n in e)Cf(t,e,n)},Cf=(t,e,n)=>{const r=e[n];r!==void 0&&(t[n]=t[n]?t[n].concat(r):r)},wx=(t,...e)=>typeof t=="function"?Ma(Pa,t,...e):Ma(()=>xx(Pa(),t),...e),Sx=Ma(Pa);var Tx=t=>$e(t)?Sx:wx({...t,extend:{theme:t.theme,classGroups:t.classGroups,conflictingClassGroupModifiers:t.conflictingClassGroupModifiers,conflictingClassGroups:t.conflictingClassGroups,...t.extend}}),Ex={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Is=(...t)=>{let e=[];Mf(t,e);let n="";for(let r=0;r<e.length;r++)e[r]&&(n&&(n+=" "),n+=e[r]);return n||void 0};function Mf(t,e){for(let n=0;n<t.length;n++){let r=t[n];Array.isArray(r)?Mf(r,e):r&&e.push(r)}}var Na=null,Da={},Ia=!1,Rs=(...t)=>e=>{let n=Is(t);return!n||!e.twMerge?n:((!Na||Ia)&&(Ia=!1,Na=Tx(Da)),Na(n)||void 0)},Af=(t,e)=>{for(let n in e)n in t?t[n]=Is(t[n],e[n]):t[n]=e[n];return t},Cx=(t,e)=>{let{extend:n=null,slots:r={},variants:s={},compoundVariants:i=[],compoundSlots:o=[],defaultVariants:a={}}=t,l={...Ex,...e},c=n?.base?Is(n.base,t?.base):t?.base,u=n?.variants&&!$e(n.variants)?uf(s,n.variants):s,d=n?.defaultVariants&&!$e(n.defaultVariants)?{...n.defaultVariants,...a}:a;!$e(l.twMergeConfig)&&!Hk(l.twMergeConfig,Da)&&(Ia=!0,Da=l.twMergeConfig);let f=$e(n?.slots),h=$e(r)?{}:{base:Is(t?.base,f&&n?.base),...r},p=f?h:Af({...n?.slots},$e(h)?{base:t?.base}:h),m=$e(n?.compoundVariants)?i:cf(n?.compoundVariants,i),g=k=>{if($e(u)&&$e(r)&&f)return Rs(c,k?.class,k?.className)(l);if(m&&!Array.isArray(m))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof m}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let S=(D,V,C=[],L)=>{let v=C;if(typeof V=="string"){let O=df(V).split(" ");for(let M=0;M<O.length;M++)v.push(`${D}:${O[M]}`)}else if(Array.isArray(V))for(let O=0;O<V.length;O++)v.push(`${D}:${V[O]}`);else if(typeof V=="object"&&typeof L=="string"&&L in V){let O=V[L];if(O&&typeof O=="string"){let M=df(O).split(" "),q=[];for(let E=0;E<M.length;E++)q.push(`${D}:${M[E]}`);v[L]=v[L]?v[L].concat(q):q}else if(Array.isArray(O)&&O.length>0){let M=[];for(let q=0;q<O.length;q++)M.push(`${D}:${O[q]}`);v[L]=M}}return v},N=(D,V=u,C=null,L=null)=>{let v=V[D];if(!v||$e(v))return null;let O=L?.[D]??k?.[D];if(O===null)return null;let M=af(O),q=Array.isArray(l.responsiveVariants)&&l.responsiveVariants.length>0||l.responsiveVariants===!0,E=d?.[D],z=[];if(typeof M=="object"&&q)for(let[Q,Se]of Object.entries(M)){let Gt=v[Se];if(Q==="initial"){E=Se;continue}Array.isArray(l.responsiveVariants)&&!l.responsiveVariants.includes(Q)||(z=S(Q,Gt,z,C))}let Z=M!=null&&typeof M!="object"?M:af(E),K=v[Z||"false"];return typeof z=="object"&&typeof C=="string"&&z[C]?Af(z,K):z.length>0?(z.push(K),C==="base"?z.join(" "):z):K},T=()=>{if(!u)return null;let D=Object.keys(u),V=[];for(let C=0;C<D.length;C++){let L=N(D[C],u);L&&V.push(L)}return V},A=(D,V)=>{if(!u||typeof u!="object")return null;let C=[];for(let L in u){let v=N(L,u,D,V),O=D==="base"&&typeof v=="string"?v:v&&v[D];O&&C.push(O)}return C},R={};for(let D in k){let V=k[D];V!==void 0&&(R[D]=V)}let x=(D,V)=>{let C=typeof k?.[D]=="object"?{[D]:k[D]?.initial}:{};return{...d,...R,...C,...V}},_=(D=[],V)=>{let C=[],L=D.length;for(let v=0;v<L;v++){let{class:O,className:M,...q}=D[v],E=!0,z=x(null,V);for(let Z in q){let K=q[Z],Q=z[Z];if(Array.isArray(K)){if(!K.includes(Q)){E=!1;break}}else{if((K==null||K===!1)&&(Q==null||Q===!1))continue;if(Q!==K){E=!1;break}}}E&&(O&&C.push(O),M&&C.push(M))}return C},U=D=>{let V=_(m,D);if(!Array.isArray(V))return V;let C={},L=Rs;for(let v=0;v<V.length;v++){let O=V[v];if(typeof O=="string")C.base=L(C.base,O)(l);else if(typeof O=="object")for(let M in O)C[M]=L(C[M],O[M])(l)}return C},b=D=>{if(o.length<1)return null;let V={},C=x(null,D);for(let L=0;L<o.length;L++){let{slots:v=[],class:O,className:M,...q}=o[L];if(!$e(q)){let E=!0;for(let z in q){let Z=C[z],K=q[z];if(Z===void 0||(Array.isArray(K)?!K.includes(Z):K!==Z)){E=!1;break}}if(!E)continue}for(let E=0;E<v.length;E++){let z=v[E];V[z]||(V[z]=[]),V[z].push([O,M])}}return V};if(!$e(r)||!f){let D={};if(typeof p=="object"&&!$e(p)){let V=Rs;for(let C in p)D[C]=L=>{let v=U(L),O=b(L);return V(p[C],A(C,L),v?v[C]:void 0,O?O[C]:void 0,L?.class,L?.className)(l)}}return D}return Rs(c,T(),_(m),k?.class,k?.className)(l)},y=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return g.variantKeys=y(),g.extend=n,g.base=c,g.slots=p,g.variants=u,g.defaultVariants=d,g.compoundSlots=o,g.compoundVariants=m,g},Mx=(t,e)=>{var n,r,s;return Cx(t,{...e,twMerge:(n=void 0)!=null?n:!0,twMergeConfig:{theme:{...(r=void 0)==null?void 0:r.theme,...of.theme},classGroups:{...(s=void 0)==null?void 0:s.classGroups,...of.classGroups}}})},Ax=["outline-solid outline-transparent","data-[focus-visible=true]:z-10","data-[focus-visible=true]:outline-2","data-[focus-visible=true]:outline-focus","data-[focus-visible=true]:outline-offset-2"],Of=Mx({slots:{base:["flex","flex-col","relative","overflow-hidden","h-auto","outline-solid outline-transparent","text-foreground","box-border","bg-content1",...Ax],header:["flex","p-3","z-10","w-full","justify-start","items-center","shrink-0","overflow-inherit","color-inherit","subpixel-antialiased"],body:["relative","flex","flex-1","w-full","p-3","flex-auto","flex-col","place-content-inherit","align-items-inherit","h-auto","break-words","text-left","overflow-y-auto","subpixel-antialiased"],footer:["p-3","h-auto","flex","w-full","items-center","overflow-hidden","color-inherit","subpixel-antialiased"]},variants:{shadow:{none:{base:"shadow-none"},sm:{base:"shadow-small"},md:{base:"shadow-medium"},lg:{base:"shadow-large"}},radius:{none:{base:"rounded-none",header:"rounded-none",footer:"rounded-none"},sm:{base:"rounded-small",header:"rounded-t-small",footer:"rounded-b-small"},md:{base:"rounded-medium",header:"rounded-t-medium",footer:"rounded-b-medium"},lg:{base:"rounded-large",header:"rounded-t-large",footer:"rounded-b-large"}},fullWidth:{true:{base:"w-full"}},isHoverable:{true:{base:"data-[hover=true]:bg-content2 dark:data-[hover=true]:bg-content2"}},isPressable:{true:{base:"cursor-pointer"}},isBlurred:{true:{base:["bg-background/80","dark:bg-background/20","backdrop-blur-md","backdrop-saturate-150"]}},isFooterBlurred:{true:{footer:["bg-background/10","backdrop-blur","backdrop-saturate-150"]}},isDisabled:{true:{base:"opacity-disabled cursor-not-allowed"}},disableAnimation:{true:"",false:{base:"transition-transform-background motion-reduce:transition-none"}}},compoundVariants:[{isPressable:!0,class:"data-[pressed=true]:scale-[0.97] tap-highlight-transparent"}],defaultVariants:{radius:"lg",shadow:"md",fullWidth:!1,isHoverable:!1,isPressable:!1,isDisabled:!1,isFooterBlurred:!1}});function Ox(t,e){let{elementType:n="button",isDisabled:r,onPress:s,onPressStart:i,onPressEnd:o,onPressUp:a,onPressChange:l,preventFocusOnPress:c,allowFocusWhenDisabled:u,onClick:d,href:f,target:h,rel:p,type:m="button",allowTextSelectionOnPress:g}=t,y;n==="button"?y={type:m,disabled:r}:y={role:"button",href:n==="a"&&!r?f:void 0,target:n==="a"?h:void 0,type:n==="input"?m:void 0,disabled:n==="input"?r:void 0,"aria-disabled":!r||n==="input"?void 0:r,rel:n==="a"?p:void 0};let{pressProps:k,isPressed:S}=fk({onClick:d,onPressStart:i,onPressEnd:o,onPressUp:a,onPressChange:l,onPress:s,isDisabled:r,preventFocusOnPress:c,allowTextSelectionOnPress:g,ref:e}),{focusableProps:N}=Ok(t,e);u&&(N.tabIndex=r?-1:N.tabIndex);let T=Sn(N,k,ly(t,{labelable:!0}));return{isPressed:S,buttonProps:Sn(y,T,{"aria-haspopup":t["aria-haspopup"],"aria-expanded":t["aria-expanded"],"aria-controls":t["aria-controls"],"aria-pressed":t["aria-pressed"],"aria-current":t["aria-current"]})}}var Px=()=>Promise.resolve().then(()=>IM).then(t=>t.default),Pf=t=>{const{ripples:e=[],motionProps:n,color:r="currentColor",style:s,onClear:i}=t;return ne.jsx(ne.Fragment,{children:e.map(o=>{const a=Hg(.01*o.size,.2,o.size>100?.75:.5);return ne.jsx(N0,{features:Px,children:ne.jsx(P0,{mode:"popLayout",children:ne.jsx(uv.span,{animate:{transform:"scale(2)",opacity:0},className:"heroui-ripple",exit:{opacity:0},initial:{transform:"scale(0)",opacity:.35},style:{position:"absolute",backgroundColor:r,borderRadius:"100%",transformOrigin:"center",pointerEvents:"none",overflow:"hidden",inset:0,zIndex:0,top:o.y,left:o.x,width:`${o.size}px`,height:`${o.size}px`,...s},transition:{duration:a},onAnimationComplete:()=>{i(o.key)},...n})})},o.key)})})};Pf.displayName="HeroUI.Ripple";var Nx=Pf;function Dx(t={}){const[e,n]=w.useState([]),r=w.useCallback(i=>{const o=i.target,a=Math.max(o.clientWidth,o.clientHeight);n(l=>[...l,{key:zg(l.length.toString()),size:a,x:i.x-a/2,y:i.y-a/2}])},[]),s=w.useCallback(i=>{n(o=>o.filter(a=>a.key!==i))},[]);return{ripples:e,onClear:s,onPress:r,...t}}var[Ix,FM]=Oc({name:"CardContext",strict:!0,errorMessage:"useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"});function Rx(t){var e,n,r,s;const i=qg(),[o,a]=Lk(t,Of.variantKeys),{ref:l,as:c,children:u,onClick:d,onPress:f,autoFocus:h,className:p,classNames:m,allowTextSelectionOnPress:g=!0,...y}=o,k=Bg(l),S=c||(t.isPressable?"button":"div"),N=typeof S=="string",T=(n=(e=t.disableAnimation)!=null?e:i?.disableAnimation)!=null?n:!1,A=(s=(r=t.disableRipple)!=null?r:i?.disableRipple)!=null?s:!1,R=Nc(m?.base,p),{onClear:x,onPress:_,ripples:U}=Dx(),b=w.useCallback(K=>{A||T||k.current&&_(K)},[A,T,k,_]),{buttonProps:D,isPressed:V}=Ox({onPress:Dc(f,b),elementType:c,isDisabled:!t.isPressable,onClick:d,allowTextSelectionOnPress:g,...y},k),{hoverProps:C,isHovered:L}=Dk({isDisabled:!t.isHoverable,...y}),{isFocusVisible:v,isFocused:O,focusProps:M}=Ik({autoFocus:h}),q=w.useMemo(()=>Of({...a,disableAnimation:T}),[_g(a),T]),E=w.useMemo(()=>({slots:q,classNames:m,disableAnimation:T,isDisabled:t.isDisabled,isFooterBlurred:t.isFooterBlurred,fullWidth:t.fullWidth}),[q,m,t.isDisabled,t.isFooterBlurred,T,t.fullWidth]),z=w.useCallback((K={})=>({ref:k,className:q.base({class:R}),tabIndex:t.isPressable?0:-1,"data-hover":lr(L),"data-pressed":lr(V),"data-focus":lr(O),"data-focus-visible":lr(v),"data-disabled":lr(t.isDisabled),...Kg(t.isPressable?{...D,...M,role:"button"}:{},t.isHoverable?C:{},Lc(y,{enabled:N}),Lc(K))}),[k,q,R,N,t.isPressable,t.isHoverable,t.isDisabled,L,V,v,D,M,C,y]),Z=w.useCallback(()=>({ripples:U,onClear:x}),[U,x]);return{context:E,domRef:k,Component:S,classNames:m,children:u,isHovered:L,isPressed:V,disableAnimation:T,isPressable:t.isPressable,isHoverable:t.isHoverable,disableRipple:A,handlePress:b,isFocusVisible:v,getCardProps:z,getRippleProps:Z}}var Nf=Rk((t,e)=>{const{children:n,context:r,Component:s,isPressable:i,disableAnimation:o,disableRipple:a,getCardProps:l,getRippleProps:c}=Rx({...t,ref:e});return ne.jsxs(s,{...l(),children:[ne.jsx(Ix,{value:r,children:n}),i&&!o&&!a&&ne.jsx(Nx,{...c()})]})});Nf.displayName="HeroUI.Card";var Lx=Nf,Ls={exports:{}},Ra={};/**
37
+ * @license React
38
+ * use-sync-external-store-shim.production.js
39
+ *
40
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ */var Df;function $x(){if(Df)return Ra;Df=1;var t=w;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,g=p[1];return i(function(){m.value=h,m.getSnapshot=f,l(m)&&g({inst:m})},[d,h,f]),s(function(){return l(m)&&g({inst:m}),d(function(){l(m)&&g({inst:m})})},[d]),o(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ra.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ra}var La={};/**
45
+ * @license React
46
+ * use-sync-external-store-shim.development.js
47
+ *
48
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ */var If;function Vx(){return If||(If=1,process.env.NODE_ENV!=="production"&&function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||s.startTransition===void 0||(u=!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=p();if(!d){var g=p();i(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}g=o({inst:{value:m,getSnapshot:p}});var y=g[0].inst,k=g[1];return l(function(){y.value=m,y.getSnapshot=p,n(y)&&k({inst:y})},[h,m,p]),a(function(){return n(y)&&k({inst:y}),h(function(){n(y)&&k({inst:y})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!i(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=w,i=typeof Object.is=="function"?Object.is:t,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,c=s.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;La.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),La}var Rf;function $a(){return Rf||(Rf=1,process.env.NODE_ENV==="production"?Ls.exports=$x():Ls.exports=Vx()),Ls.exports}var Lf=$a();function Te(t){this.content=t}Te.prototype={constructor:Te,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,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new Te(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 Te(n)},addToStart:function(t,e){return new Te([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Te(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new Te(s)},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=Te.from(t),t.size?new Te(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Te.from(t),t.size?new Te(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Te.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}},Te.from=function(t){if(t instanceof Te)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Te(e)};function $f(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=$f(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Vf(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Vf(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class P{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,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!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,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new P(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new P(r,s)}cutByIndex(e,n){return e==n?P.empty:e==0&&n==this.content.length?this:new P(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new P(s,i)}addToStart(e){return new P([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new P(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 s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return $f(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Vf(this,e,n,r)}findIndex(e){if(e==0)return $s(0,e);if(e==this.size)return $s(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 s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?$s(n+1,i):$s(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 P.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new P(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return P.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new P(n||e,r)}static from(e){if(!e)return P.empty;if(e instanceof P)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new P([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}P.empty=new P([],0);const Va={index:0,offset:0};function $s(t,e){return Va.index=t,Va.offset=e,Va}function Vs(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(!Vs(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Vs(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let te=class Sc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),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&&Vs(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 s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}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 Sc.none;if(e instanceof Sc)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};te.none=[];class Fs extends Error{}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=Bf(this.content,e+this.openStart,n);return r&&new $(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $(Ff(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 $.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $(P.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=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)s++;return new $(e,r,s)}}$.empty=new $(P.empty,0,0);function Ff(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Ff(i.content,e-s-1,n-s-1)))}function Bf(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Bf(o.content,e-i-1,n);return a&&t.replaceChild(s,o.copy(a))}function Fx(t,e,n){if(n.openStart>t.depth)throw new Fs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Fs("Inconsistent open depths");return zf(t,e,n,0)}function zf(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=zf(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return on(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Bx(n,t);return on(i,Hf(t,o,a,e,r))}else return on(i,Bs(t,e,r))}function _f(t,e){if(!e.type.compatibleContent(t.type))throw new Fs("Cannot join "+e.type.name+" onto "+t.type.name)}function Fa(t,e,n){let r=t.node(n);return _f(r,e.node(n)),r}function sn(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 xr(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(sn(t.nodeAfter,r),i++));for(let a=i;a<o;a++)sn(s.child(a),r);e&&e.depth==n&&e.textOffset&&sn(e.nodeBefore,r)}function on(t,e){return t.type.checkContent(e),t.copy(e)}function Hf(t,e,n,r,s){let i=t.depth>s&&Fa(t,e,s+1),o=r.depth>s&&Fa(n,r,s+1),a=[];return xr(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(_f(i,o),sn(on(i,Hf(t,e,n,r,s+1)),a)):(i&&sn(on(i,Bs(t,e,s+1)),a),xr(e,n,s,a),o&&sn(on(o,Bs(n,r,s+1)),a)),xr(r,null,s,a),new P(a)}function Bs(t,e,n){let r=[];if(xr(null,t,n,r),t.depth>n){let s=Fa(t,e,n+1);sn(on(s,Bs(t,e,n+1)),r)}return xr(e,null,n,r),new P(r)}function Bx(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(P.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class wr{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],s=e.child(n);return r?e.child(n).cut(r):s}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],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.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 zs(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=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new wr(n,r,i)}static resolveCached(e,n){let r=jf.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else jf.set(e,r=new zx);let s=r.elts[r.i]=wr.resolve(e,n);return r.i=(r.i+1)%_x,s}}class zx{constructor(){this.elts=[],this.i=0}}const _x=12,jf=new WeakMap;class zs{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)}}const Hx=Object.create(null);let At=class Tc{constructor(e,n,r,s=te.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||P.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,s=0){this.content.nodesBetween(e,n,r,s,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,s){return this.content.textBetween(e,n,r,s)}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&&Vs(this.attrs,n||e.defaultAttrs||Hx)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new Tc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Tc(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 $.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new $(c,s.depth-o,i.depth-o)}replace(e,n,r){return Fx(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+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 s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return wr.resolveCached(this,e)}resolveNoCache(e){return wr.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Kf(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=P.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.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=te.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(!te.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 s=P.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};At.prototype.text=void 0;class _s extends At{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Kf(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 _s(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _s(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 Kf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new jx(e,n);if(r.next==null)return an.empty;let s=Wf(r);r.next&&r.err("Unexpected trailing text");let i=Yx(Jx(s));return Xx(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 s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return P.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,a.concat(u));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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),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 s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
53
+ `)}}an.empty=new an(!0);class jx{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 Wf(t){let e=[];do e.push(Kx(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Kx(t){let e=[];do e.push(Wx(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wx(t){let e=qx(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=Ux(t,e);else break;return e}function Uf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Ux(t,e){let n=Uf(t),r=n;return t.eat(",")&&(t.next!="}"?r=Uf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Gx(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function qx(t){if(t.eat("(")){let e=Wf(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=Gx(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 Jx(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Gf(t,e){return e-t}function qf(t,e){let n=[];return r(e),n.sort(Gf);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function Yx(t){let e=Object.create(null);return n(qf(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);qf(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new an(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Gf);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function Xx(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Jf(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 Yf(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function Xf(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function Zf(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Qx(t,r,e[r]);return n}let Qf=class Og{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=Zf(e,r.attrs),this.defaultAttrs=Jf(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==an.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:Yf(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new At(this,this.computeAttrs(e),P.from(n),te.setFrom(r))}createChecked(e=null,n,r){return n=P.from(n),this.checkContent(n),new At(this,this.computeAttrs(e),n,te.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=P.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(P.empty,!0);return i?new At(this,e,n.append(i),te.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){Xf(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:te.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Og(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");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 Zx(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class Qx{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Zx(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Zf(e,s.attrs),this.excluded=null;let i=Jf(this.attrs);this.instance=i?new te(this,i):null}create(e=null){return!e&&this.instance?this.instance:new te(this,Yf(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Hs(i,s++,n,o)),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){Xf(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class eh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Te.from(e.nodes),n.marks=Te.from(e.marks||{}),this.nodes=Qf.compile(this.spec.nodes,this),this.marks=Hs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=an.parse(o,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?th(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:th(this,o.split(" "))}this.nodeFromJSON=s=>At.fromJSON(this,s),this.markFromJSON=s=>te.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Qf){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,s)}text(e,n){let r=this.nodes.text;return new _s(r,r.defaultAttrs,e,te.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 th(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function e1(t){return t.tag!=null}function t1(t){return t.style!=null}class Ot{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(e1(s))this.tags.push(s);else if(t1(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new ih(this,n,!1);return r.addAll(e,te.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new ih(this,n,!0);return r.addAll(e,te.none,n.from,n.to),$.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(s1(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=oh(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=oh(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ot(e,Ot.schemaRules(e)))}}const nh={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},n1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rh={ol:!0,ul:!0},Sr=1,Ba=2,Tr=4;function sh(t,e,n){return e!=null?(e?Sr:0)|(e==="full"?Ba:0):t&&t.whitespace=="pre"?Sr|Ba:n&~Tr}class js{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=te.none,this.match=i||(o&Tr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(P.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Sr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=P.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(P.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&&!nh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ih{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=sh(null,n.preserveWhitespace,0)|(r?Tr:0);s?i=new js(s.type,s.attrs,te.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new js(null,null,te.none,!0,null,o):i=new js(e.schema.topNodeType,null,te.none,!0,null,o),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,s=this.top,i=s.options&Ba?"full":this.localPreserveWS||(s.options&Sr)>0;if(i==="full"||s.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,`
54
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=s.content[s.content.length-1],a=e.previousSibling;(!o||a&&a.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.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 s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;rh.hasOwnProperty(o)&&this.parser.normalizeLists&&r1(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:n1.hasOwnProperty(o))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,u=this.needsBlock;if(nh.hasOwnProperty(o))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 d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
55
+ `),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 s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,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,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,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(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);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,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],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 s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=te.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):ah(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=sh(e,i,o.options);o.options&Tr&&o.content.length==0&&(a|=Tr);let l=te.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ah(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new js(e,n,l,s,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|=Sr)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(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(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(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 r1(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&rh.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function s1(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function oh(t){let e={};for(let n in t)e[n]=t[n];return e}function ah(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class ln{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=za(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.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;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=Ks(za(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Ks(za(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Ks(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=lh(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return lh(e.marks)}}function lh(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function za(t){return t.document||window.document}const ch=new WeakMap;function i1(t){let e=ch.get(t);return e===void 0&&ch.set(t,e=o1(t)),e}function o1(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 s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Ks(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 s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=i1(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 o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Ks(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const uh=65535,dh=Math.pow(2,16);function a1(t,e){return t+e*dh}function fh(t){return t&uh}function l1(t){return(t-(t&uh))/dh}const hh=1,ph=2,Ws=4,mh=8;class _a{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&mh)>0}get deletedBefore(){return(this.delInfo&(hh|Ws))>0}get deletedAfter(){return(this.delInfo&(ph|Ws))>0}get deletedAcross(){return(this.delInfo&Ws)>0}}class Be{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Be.empty)return Be.empty}recover(e){let n=0,r=fh(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+l1(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 s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+s+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:a1(a/3,e-l),m=e==l?ph:e==d?hh:Ws;return(n<0?e!=l:e!=d)&&(m|=mh),new _a(h,m,p)}s+=u-c}return r?e+s:new _a(e+s,0,null)}touches(e,n){let r=0,s=fh(n),i=this.inverted?2:1,o=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],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Be(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Be.empty:new Be(e<0?[0,-e,0]:[0,0,e])}}Be.empty=new Be([]);class Er{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Er(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 s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s: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 s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Er;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 s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.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}}s|=a.delInfo,e=a.pos}return r?e:new _a(e,s,null)}}const Ha=Object.create(null);class Ae{getMap(){return Be.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}}class he{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new he(e,null)}static fail(e){return new he(null,e)}static fromReplace(e,n,r,s){try{return he.ok(e.replace(n,r,s))}catch(i){if(i instanceof Fs)return he.fail(i.message);throw i}}}function ja(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(ja(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return P.fromArray(r)}class Pt extends Ae{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),s=r.node(r.sharedDepth(this.to)),i=new $(ja(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return he.fromReplace(e,this.from,this.to,i)}invert(){return new Xe(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 Pt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(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 Pt(n.from,n.to,e.markFromJSON(n.mark))}}Ae.jsonID("addMark",Pt);class Xe extends Ae{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 $(ja(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return he.fromReplace(e,this.from,this.to,r)}invert(){return new Pt(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 Xe(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xe(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 Xe(n.from,n.to,e.markFromJSON(n.mark))}}Ae.jsonID("removeMark",Xe);class Nt extends Ae{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return he.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return he.fromReplace(e,this.pos,this.pos+1,new $(P.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 s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Nt(this.pos,n.marks[s]);return new Nt(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nt(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 Nt(n.pos,e.markFromJSON(n.mark))}}Ae.jsonID("addNodeMark",Nt);class cn extends Ae{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return he.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return he.fromReplace(e,this.pos,this.pos+1,new $(P.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Nt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new cn(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 cn(n.pos,e.markFromJSON(n.mark))}}Ae.jsonID("removeNodeMark",cn);class ve extends Ae{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Ka(e,this.from,this.to)?he.fail("Structure replace would overwrite content"):he.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Be([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(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 ve(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||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?$.empty:new $(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(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?$.empty:new $(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(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 ve(n.from,n.to,$.fromJSON(e,n.slice),!!n.structure)}}Ae.jsonID("replace",ve);class ke extends Ae{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return he.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return he.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?he.fromReplace(e,this.from,this.to,r):he.fail("Content does not fit in gap")}getMap(){return new Be([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 ke(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),s=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||s<n.pos||i>r.pos?null:new ke(n.pos,r.pos,s,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 ke(n.from,n.to,n.gapFrom,n.gapTo,$.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ae.jsonID("replaceAround",ke);function Ka(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function c1(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new Xe(f,h,d[m])));a&&a.to==f?a.to=h:i.push(a=new Pt(f,h,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function u1(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof Hs){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Xe(o.from,o.to,o.style)))}function Wa(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new ve(a,u,$.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Xe(a,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new $(P.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new ve(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(P.empty,!0);t.replace(a,a,new $(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function d1(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function jn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let s=t.$from.node(r),i=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&s.canReplace(i,o,n))return r;if(r==0||s.type.spec.isolating||!d1(s,i,o))break}return null}function f1(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=P.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=P.from(r.node(p).copy(u)),d++):l--;let f=P.empty,h=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=P.from(s.node(p).copy(f)),h++):c++;t.step(new ke(l,c,o,a,new $(u.append(f),d,h),u.size-d,!0))}function Ua(t,e,n=null,r=t){let s=h1(t,e),i=s&&p1(r,e);return i?s.map(gh).concat({type:e,attrs:n}).concat(i.map(gh)):null}function gh(t){return{type:t,attrs:null}}function h1(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function p1(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function m1(t,e,n){let r=P.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].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=P.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new ke(s,i,s,i,new $(r,0,0),n.length,!0))}function g1(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&y1(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&bh(t,o,a,i),Wa(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return t.step(new ke(d,f,d+1,f-1,new $(P.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&yh(t,o,a,i),!1}})}function yh(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function bh(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
56
+ `))}})}function y1(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function b1(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ke(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new $(P.from(o),0,0),1,!0))}function ft(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),f=s.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function v1(t,e,n=1,r){let s=t.doc.resolve(e),i=P.empty,o=P.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=P.from(s.node(a).copy(i));let u=r&&r[c];o=P.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new ve(e,e,new $(i.append(o),n,n),!0))}function Dt(t,e){let n=t.resolve(e),r=n.index();return vh(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function k1(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function vh(t,e){return!!(t&&e&&!t.isLeaf&&k1(t,e))}function Us(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&vh(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function x1(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);bh(t,u.node(),u.before(),a)}o.inlineContent&&Wa(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new ve(c,l.map(e+n,-1),$.empty,!0)),r===!0){let u=t.doc.resolve(c);yh(t,u.node(),u.before(),t.steps.length)}return t}function w1(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 s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function kh(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Gs(t,e,n=e,r=$.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return xh(s,i,r)?new ve(e,n,r):new S1(s,i,r).fit()}function xh(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class S1{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=P.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=P.from(e.node(s).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,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new $(i,o,a);return e>-1?new ke(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new ve(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=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 s,i=null;r?(i=Ga(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(P.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Ga(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new $(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Ga(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new $(Cr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new $(Cr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)u.push(s.child(m));d=d.matchFragment(s)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(wh(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Mr(this.placed,n,P.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?$.empty:new $(Cr(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new $(Cr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qa(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,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=qa(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=qa(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,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=Mr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Mr(this.placed,this.depth,P.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(P.empty,!0);n.childCount&&(this.placed=Mr(this.placed,this.frontier.length,n))}}function Cr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Cr(t.firstChild.content,e-1,n)))}function Mr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Mr(t.lastChild.content,e-1,n)))}function Ga(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function wh(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,wh(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(P.empty,!0)))),t.copy(r)}function qa(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!T1(n,i.content,o)?a:null}function T1(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function E1(t){return t.spec.defining||t.spec.definingForContent}function C1(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(xh(s,i,r))return t.step(new ve(e,n,r));let o=Th(s,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let f=s.depth,h=s.pos-1;f>0;f--,h--){let p=s.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:s.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=E1(h.type);if(p&&!h.sameMarkup(s.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let k=s.node(g-1),S=s.index(g-1);if(k.canReplaceWith(S,S,p.type,p.marks))return t.replace(s.before(g),y?i.after(g):n,new $(Sh(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=s.before(h),n=i.after(h))}}function Sh(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Sh(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(P.empty,!0))}return t}function M1(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=w1(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new $(P.from(r),0,0))}function A1(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=Th(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Th(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Kn extends Ae{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 he.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 s=n.type.create(r,null,n.marks);return he.fromReplace(e,this.pos,this.pos+1,new $(P.from(s),0,n.isLeaf?0:1))}getMap(){return Be.empty}invert(e){return new Kn(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 Kn(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 Kn(n.pos,n.attr,n.value)}}Ae.jsonID("attr",Kn);class Ar extends Ae{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return he.ok(r)}getMap(){return Be.empty}invert(e){return new Ar(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 Ar(n.attr,n.value)}}Ae.jsonID("docAttr",Ar);let Wn=class extends Error{};Wn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Wn.prototype=Object.create(Error.prototype),Wn.prototype.constructor=Wn,Wn.prototype.name="TransformError";class Eh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Er}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Wn(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=$.empty){let s=Gs(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new $(P.from(r),0,0))}delete(e,n){return this.replace(e,n,$.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return C1(this,e,n,r),this}replaceRangeWith(e,n,r){return M1(this,e,n,r),this}deleteRange(e,n){return A1(this,e,n),this}lift(e,n){return f1(this,e,n),this}join(e,n=1){return x1(this,e,n),this}wrap(e,n){return m1(this,e,n),this}setBlockType(e,n=e,r,s=null){return g1(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return b1(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Kn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ar(e,n)),this}addNodeMark(e,n){return this.step(new Nt(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 te)n.isInSet(r.marks)&&this.step(new cn(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new cn(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return v1(this,e,n,r),this}addMark(e,n,r){return c1(this,e,n,r),this}removeMark(e,n,r){return u1(this,e,n,r),this}clearIncompatible(e,n,r){return Wa(this,e,n,r),this}}const Ja=Object.create(null);class J{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new O1(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=$.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?$.empty:n),a==0&&Ah(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Ah(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new G(e):Un(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Un(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Un(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ze(e.node(0))}static atStart(e){return Un(e,e,0,0,1)||new ze(e)}static atEnd(e){return Un(e,e,e.content.size,e.childCount,-1)||new ze(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 G.between(this.$anchor,this.$head).getBookmark()}}J.prototype.visible=!0;class O1{constructor(e,n){this.$from=e,this.$to=n}}let Ch=!1;function Mh(t){!Ch&&!t.parent.inlineContent&&(Ch=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class G extends J{constructor(e,n=e){Mh(e),Mh(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 J.near(r);let s=e.resolve(n.map(this.anchor));return new G(s.parent.inlineContent?s:r,r)}replace(e,n=$.empty){if(super.replace(e,n),n==$.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof G&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new qs(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 G(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=J.findFrom(n,r,!0)||J.findFrom(n,-r,!0);if(i)n=i.$head;else return J.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(J.findFrom(e,-r,!0)||J.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new G(e,n)}}J.jsonID("text",G);class qs{constructor(e,n){this.anchor=e,this.head=n}map(e){return new qs(e.map(this.anchor),e.map(this.head))}resolve(e){return G.between(e.resolve(this.anchor),e.resolve(this.head))}}class j extends J{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:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?J.near(i):new j(i)}content(){return new $(P.from(this.node),0,0)}eq(e){return e instanceof j&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ya(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new j(e.resolve(n.anchor))}static create(e,n){return new j(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}j.prototype.visible=!1,J.jsonID("node",j);class Ya{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new qs(r,r):new Ya(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&j.isSelectable(r)?new j(n):J.near(n)}}class ze extends J{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=$.empty){if(n==$.empty){e.delete(0,e.doc.content.size);let r=J.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ze(e)}map(e){return new ze(e)}eq(e){return e instanceof ze}getBookmark(){return P1}}J.jsonID("all",ze);const P1={map(){return this},resolve(t){return new ze(t)}};function Un(t,e,n,r,s,i=!1){if(e.inlineContent)return G.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&j.isSelectable(a))return j.create(t,n-(s<0?a.nodeSize:0))}else{let l=Un(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function Ah(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof ve||s instanceof ke))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(J.near(t.doc.resolve(o),n))}const Oh=1,Js=2,Ph=4;class N1 extends Eh{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|Oh)&~Js,this.storedMarks=null,this}get selectionSet(){return(this.updated&Oh)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Js,this}ensureMarks(e){return te.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&Js)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Js,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)||te.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.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 o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),this.selection.empty||this.setSelection(J.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|=Ph,this}get scrolledIntoView(){return(this.updated&Ph)>0}}function Nh(t,e){return!e||!t?t:t.bind(e)}class Or{constructor(e,n,r){this.name=e,this.init=Nh(n.init,r),this.apply=Nh(n.apply,r)}}const D1=[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||J.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}})];class Xa{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=D1.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))})}}class Gn{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 s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={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 Gn(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new N1(this)}static create(e){let n=new Xa(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Gn(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Xa(this.schema,e.plugins),r=n.fields,s=new Gn(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}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 s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.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 s=new Xa(e.schema,e.plugins),i=new Gn(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=At.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=J.fromJSON(i.doc,n.selection);else if(o.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==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function Dh(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Dh(s,e,{})),n[r]=s}return n}class le{constructor(e){this.spec=e,this.props={},e.props&&Dh(e.props,this,this.props),this.key=e.key?e.key.key:Ih("plugin")}getState(e){return e[this.key]}}const Za=Object.create(null);function Ih(t){return t in Za?t+"$"+ ++Za[t]:(Za[t]=0,t+"$")}class xe{constructor(e="key"){this.key=Ih(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ee=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},qn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Qa=null;const ht=function(t,e,n){let r=Qa||(Qa=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},I1=function(){Qa=null},un=function(t,e,n,r){return n&&(Rh(t,e,n,r,-1)||Rh(t,e,n,r,1))},R1=/^(img|br|input|textarea|hr)$/i;function Rh(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:We(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Pr(t)||R1.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ee(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?We(t):0}else return!1}}function We(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function L1(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=We(t)}else if(t.parentNode&&!Pr(t))e=Ee(t),t=t.parentNode;else return null}}function $1(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&&!Pr(t))e=Ee(t)+1,t=t.parentNode;else return null}}function V1(t,e,n){for(let r=e==0,s=e==We(t);r||s;){if(t==n)return!0;let i=Ee(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==We(t)}}function Pr(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)}const Ys=function(t){return t.focusNode&&un(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function dn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function F1(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function B1(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(We(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(We(r.startContainer),r.startOffset)}}}const rt=typeof navigator<"u"?navigator:null,Lh=typeof document<"u"?document:null,It=rt&&rt.userAgent||"",el=/Edge\/(\d+)/.exec(It),$h=/MSIE \d/.exec(It),tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(It),Ve=!!($h||tl||el),Rt=$h?document.documentMode:tl?+tl[1]:el?+el[1]:0,Ze=!Ve&&/gecko\/(\d+)/i.test(It);Ze&&+(/Firefox\/(\d+)/.exec(It)||[0,0])[1];const nl=!Ve&&/Chrome\/(\d+)/.exec(It),Oe=!!nl,Vh=nl?+nl[1]:0,De=!Ve&&!!rt&&/Apple Computer/.test(rt.vendor),Jn=De&&(/Mobile\/\w+/.test(It)||!!rt&&rt.maxTouchPoints>2),Ue=Jn||(rt?/Mac/.test(rt.platform):!1),z1=rt?/Win/.test(rt.platform):!1,pt=/Android \d/.test(It),Nr=!!Lh&&"webkitFontSmoothing"in Lh.documentElement.style,_1=Nr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function H1(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 mt(t,e){return typeof t=="number"?t:t[e]}function j1(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 Fh(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=qn(o);continue}let a=o,l=a==i.body,c=l?H1(i):j1(a),u=0,d=0;if(e.top<c.top+mt(r,"top")?d=-(c.top-e.top+mt(s,"top")):e.bottom>c.bottom-mt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+mt(s,"top")-c.top:e.bottom-c.bottom+mt(s,"bottom")),e.left<c.left+mt(r,"left")?u=-(c.left-e.left+mt(s,"left")):e.right>c.right-mt(r,"right")&&(u=e.right-c.right+mt(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:qn(o)}}function K1(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:Bh(t.dom)}}function Bh(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=qn(r));return e}function W1({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;zh(n,r==0?0:r-e)}function zh(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Yn=null;function U1(t){if(t.setActive)return t.setActive();if(Yn)return t.focus(Yn);let e=Bh(t);t.focus(Yn==null?{get preventScroll(){return Yn={preventScroll:!0},!0}}:void 0),Yn||(Yn=!1,zh(e,0))}function _h(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ht(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?G1(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:_h(n,s)}function G1(t,e){let n=t.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Lt(r,1);if(i.top!=i.bottom&&rl(e,i))return{node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function rl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function q1(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function J1(t,e,n){let{node:r,offset:s}=_h(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function Y1(t,e,n,r){let s=-1;for(let i=e,o=!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)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<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 s>-1?s:t.docView.posFromDOM(e,n,-1)}function Hh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(rl(e,c))return Hh(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function X1(t,e){let n=t.dom.ownerDocument,r,s=0,i=B1(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!rl(e,c)||(o=Hh(t.dom,e,c),!o))return null}if(De)for(let c=o;r&&c;c=qn(c))c.draggable&&(r=void 0);if(o=q1(o,e),r){if(Ze&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Nr&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=Y1(t,r,s,e))}a==null&&(a=J1(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function jh(t){return t.top<t.bottom||t.left<t.right}function Lt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(jh(r))return r}return Array.prototype.find.call(n,jh)||t.getBoundingClientRect()}const Z1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Kh(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Nr||Ze;if(r.nodeType==3)if(o&&(Z1.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Lt(ht(r,s,s),n);if(Ze&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Lt(ht(r,s-1,s-1),-1);if(c.top==l.top){let u=Lt(ht(r,s,s+1),-1);if(u.top!=l.top)return Dr(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Dr(Lt(ht(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==We(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return sl(l.getBoundingClientRect(),!1)}if(i==null&&s<We(r)){let l=r.childNodes[s];if(l.nodeType==1)return sl(l.getBoundingClientRect(),!0)}return sl(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==We(r))){let l=r.childNodes[s-1],c=l.nodeType==3?ht(l,We(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Dr(Lt(c,1),!1)}if(i==null&&s<We(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ht(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Dr(Lt(c,-1),!0)}return Dr(Lt(r.nodeType==3?ht(r):r,-n),n>=0)}function Dr(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 sl(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 Wh(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function Q1(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return Wh(t,e,()=>{let{node:i}=t.docView.domFromPos(s.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 o=Kh(t,s.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=ht(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const ew=/[\u0590-\u08ac]/;function tw(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!ew.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:Wh(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let Uh=null,Gh=null,qh=!1;function nw(t,e,n){return Uh==e&&Gh==n?qh:(Uh=e,Gh=n,qh=n=="up"||n=="down"?Q1(t,e,n):tw(t,e,n))}const Ge=0,Jh=1,fn=2,st=3;class Ir{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Ge,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 s=this.children[n];if(s==e)return r;r+=s.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,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>Ee(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==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 s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof Zh){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Yh&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ee(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ee(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 s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=Ee(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Ee(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,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,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(i>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,s);p=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ze||De)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
57
+ `),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ee(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ze&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&De)&&un(a.node,a.offset,u.anchorNode,u.anchorOffset)&&un(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!d){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}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,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?fn:Jh,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=st:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?fn:st}r=o}this.dirty=fn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?fn:Jh;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Yh extends Ir{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Ge&&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}}class rw extends Ir{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}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}}class hn extends Ir{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=ln.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new hn(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&st||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=st&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ge){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ge}}slice(e,n,r){let s=hn.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=ol(i,n,o,r)),e>0&&(i=ol(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class $t extends Ir{constructor(e,n,r,s,i,o,a,l,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ln.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=tp(u,r,n),c?l=new sw(e,n,r,s,u,d||null,f,c,i,o+1):n.isText?new Xs(e,n,r,s,u,f,i):new $t(e,n,r,s,u,d||null,f,i,o+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=()=>P.empty)}return e}matchesNode(e,n,r){return this.dirty==Ge&&e.eq(this.node)&&Zs(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,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new ow(this,o&&o.node,e);cw(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?te.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,s)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==fn)&&(o&&this.protectLocalComposition(e,o),Qh(this.contentDOM,this.children,e),Jn&&uw(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof G)||r<n||s>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 o=i.nodeValue,a=dw(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){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 o=new rw(this,i,n,s);e.input.compositionNodes.push(o),this.children=ol(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==st||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Ge}updateOuterDeco(e){if(Zs(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ep(this.dom,this.nodeDOM,il(this.outerDeco,this.node,n),il(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 Xh(t,e,n,r,s){tp(r,e,t);let i=new $t(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Xs extends $t{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,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,s){return this.dirty==st||this.dirty!=Ge&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ge||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Ge,!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 s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Xs(this.parent,s,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=st)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Zh extends Ir{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ge&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class sw extends $t{constructor(e,n,r,s,i,o,a,l,c,u){super(e,n,r,s,i,o,a,c,u),this.spec=l}update(e,n,r,s){if(this.dirty==st)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,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}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 Qh(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=np(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof hn){let l=r?r.previousSibling:t.lastChild;Qh(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=np(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Rr=function(t){t&&(this.nodeName=t)};Rr.prototype=Object.create(null);const pn=[new Rr];function il(t,e,n){if(t.length==0)return pn;let r=n?pn[0]:new Rr,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Rr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new Rr(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 s}function ep(t,e,n,r){if(n==pn&&r==pn)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=pn[0]),s=l}iw(s,a||pn[0],o)}return s}function iw(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):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function tp(t,e,n){return ep(t,t,pn,il(e,n,t.nodeType!=1))}function Zs(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 np(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ow{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=aw(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 s=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Ge,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=hn.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,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,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,s,i){let o=this.top.children[s];return o.dirty==st&&o.dom==o.contentDOM&&(o.dirty=fn),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof $t){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=st&&Zs(n,l.outerDeco));if(!f&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=fn,d.updateChildren(s,o+1),d.dirty=Ge),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Zs(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=$t.create(this.top,n,r,s,i,o);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,s,i){let o=$t.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new Yh(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 hn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Xs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((De||Oe)&&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 s=new Zh(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function aw(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof hn)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(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function lw(t,e){return t.type.side-e.type.side}function cw(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let g=s[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(lw);for(let g=0;g<d.length;g++)n(d[g],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=i&&a.splice(g--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let p=i+f.nodeSize;if(f.isText){let g=p;o<s.length&&s[o].from<g&&(g=s[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=f.cut(g-i),f=f.cut(0,g-i),p=g,h=-1)}else for(;o<s.length&&s[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,m,e.forChild(i,f),h),i=p}}function uw(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 dw(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);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 ol(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function al(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Ys(n)){for(l=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&j.isSelectable(d)&&s.parent&&!(d.isInline&&V1(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new j(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=cl(t,u,a,d)}return c}function rp(t){return t.editable?t.hasFocus():up(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function gt(t,e=!1){let n=t.state.selection;if(ap(t,n),!!rp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Oe){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&un(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)hw(t);else{let{anchor:r,head:s}=n,i,o;sp&&!(n instanceof G)&&(n.$from.parent.inlineContent||(i=ip(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ip(t,n.to))),t.docView.setSelection(r,s,t,e),sp&&(i&&op(i),o&&op(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&fw(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const sp=De||Oe&&Vh<63;function ip(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(De&&s&&s.contentEditable=="false")return ll(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ll(s);if(i)return ll(i)}}function ll(t){return t.contentEditable="true",De&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function op(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function fw(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!rp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hw(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,s=r.nodeName=="IMG";s?n.setStart(r.parentNode,Ee(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!s&&!t.state.selection.visible&&Ve&&Rt<=11&&(r.disabled=!0,r.disabled=!1)}function ap(t,e){if(e instanceof j){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(lp(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else lp(t)}function lp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function cl(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||G.between(e,n,r)}function cp(t){return t.editable&&!t.hasFocus()?!1:up(t)}function up(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 pw(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return un(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ul(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&J.findFrom(i,e)}function Vt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function dp(t,e,n){let r=t.state.selection;if(r instanceof G)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Vt(t,new G(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=ul(t.state,e);return s&&s instanceof j?Vt(t,s):!1}else if(!(Ue&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?j.isSelectable(i)?Vt(t,new j(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Nr?Vt(t,new G(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof j&&r.node.isInline)return Vt(t,new G(e>0?r.$to:r.$from));{let s=ul(t.state,e);return s?Vt(t,s):!1}}}function Qs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Lr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Xn(t,e){return e<0?mw(t):gw(t)}function mw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Ze&&n.nodeType==1&&r<Qs(n)&&Lr(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Lr(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(fp(n))break;{let a=n.previousSibling;for(;a&&Lr(a,-1);)s=n.parentNode,i=Ee(a),a=a.previousSibling;if(a)n=a,r=Qs(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?dl(t,n,r):s&&dl(t,s,i)}function gw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=Qs(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Lr(a,1))i=n,o=++r;else break}else{if(fp(n))break;{let a=n.nextSibling;for(;a&&Lr(a,1);)i=a.parentNode,o=Ee(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=Qs(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&dl(t,i,o)}function fp(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function yw(t,e){for(;t&&e==t.childNodes.length&&!Pr(t);)e=Ee(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 bw(t,e){for(;t&&!e&&!Pr(t);)e=Ee(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 dl(t,e,n){if(e.nodeType!=3){let i,o;(o=yw(e,n))?(e=o,n=0):(i=bw(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ys(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:s}=t;setTimeout(()=>{t.state==s&&gt(t)},50)}function hp(t,e){let n=t.state.doc.resolve(e);if(!(Oe||z1)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function pp(t,e,n){let r=t.state.selection;if(r instanceof G&&!r.empty||n.indexOf("s")>-1||Ue&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ul(t.state,e);if(o&&o instanceof j)return Vt(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof ze?J.near(o,e):J.findFrom(o,e);return a?Vt(t,a):!1}return!1}function mp(t,e){if(!(t.state.selection instanceof G))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)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 o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function gp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function vw(t){if(!De||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;gp(t,r,"true"),setTimeout(()=>gp(t,r,"false"),20)}return!1}function kw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function xw(t,e){let n=e.keyCode,r=kw(e);if(n==8||Ue&&n==72&&r=="c")return mp(t,-1)||Xn(t,-1);if(n==46&&!e.shiftKey||Ue&&n==68&&r=="c")return mp(t,1)||Xn(t,1);if(n==13||n==27)return!0;if(n==37||Ue&&n==66&&r=="c"){let s=n==37?hp(t,t.state.selection.from)=="ltr"?-1:1:-1;return dp(t,s,r)||Xn(t,s)}else if(n==39||Ue&&n==70&&r=="c"){let s=n==39?hp(t,t.state.selection.from)=="ltr"?1:-1:1;return dp(t,s,r)||Xn(t,s)}else{if(n==38||Ue&&n==80&&r=="c")return pp(t,-1,r)||Xn(t,-1);if(n==40||Ue&&n==78&&r=="c")return vw(t)||pp(t,1,r)||Xn(t,1);if(r==(Ue?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function fl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||ln.fromSchema(t.state.schema),a=Tp(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=wp[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
58
+
59
+ `);return{dom:l,text:f,slice:e}}function yp(t,e,n,r,s){let i=s.parent.type.spec.code,o,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 $(P.from(t.state.schema.text(e.replace(/\r\n?/g,`
60
+ `))),0,0):$.empty;let d=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(d)a=d;else{let f=s.marks(),{schema:h}=t.state,p=ln.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Ew(n),Nr&&Cw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Ot.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ww.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Mw(xp(a,+u[1],+u[2]),u[4]);else if(a=$.maxOpen(Sw(a.content,s),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=xp(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const ww=/^(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 Sw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&vp(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=kp(o[o.length-1],i.length));let u=bp(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return P.from(o)}return t}function bp(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,P.from(t));return t}function vp(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=vp(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(P.from(bp(n,t,s+1))))}}function kp(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,kp(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(P.empty,!0);return t.copy(n.append(r))}function hl(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=hl(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(P.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function xp(t,e,n){return e<t.openStart&&(t=new $(hl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new $(hl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const wp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Sp=null;function Tp(){return Sp||(Sp=document.implementation.createHTMLDocument("title"))}let pl=null;function Tw(t){let e=window.trustedTypes;return e?(pl||(pl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),pl.createHTML(t)):t}function Ew(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Tp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&wp[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Tw(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function Cw(t){let e=t.querySelectorAll(Oe?"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==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Mw(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:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=P.from(l.create(r[a+1],s)),i++,o++}return new $(s,i,o)}const Ie={},Re={},Aw={touchstart:!0,touchmove:!0};class Ow{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 Pw(t){for(let e in Ie){let n=Ie[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Dw(t,r)&&!gl(t,r)&&(t.editable||!(r.type in Re))&&n(t,r)},Aw[e]?{passive:!0}:void 0)}De&&t.dom.addEventListener("input",()=>null),ml(t)}function Ft(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Nw(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=>gl(t,r))})}function gl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Dw(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 Iw(t,e){!gl(t,e)&&Ie[e.type]&&(t.editable||!(e.type in Re))&&Ie[e.type](t,e)}Re.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Cp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(pt&&Oe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Jn&&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",s=>s(t,dn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||xw(t,n)?n.preventDefault():Ft(t,"key")},Re.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Re.keypress=(t,e)=>{let n=e;if(Cp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ue&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof G)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function ei(t){return{left:t.clientX,top:t.clientY}}function Rw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function yl(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Zn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Lw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&j.isSelectable(r)?(Zn(t,new j(n)),!0):!1}function $w(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof j&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(j.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Zn(t,j.create(t.state.doc,s)),!0):!1}function Vw(t,e,n,r,s){return yl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?$w(t,n):Lw(t,n))}function Fw(t,e,n,r){return yl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function Bw(t,e,n,r){return yl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||zw(t,n,r)}function zw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zn(t,G.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)Zn(t,G.create(r,a+1,a+1+o.content.size));else if(j.isSelectable(o))Zn(t,j.create(r,a));else continue;return!0}}function bl(t){return ti(t)}const Ep=Ue?"metaKey":"ctrlKey";Ie.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=bl(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Rw(n,t.input.lastClick)&&!n[Ep]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(ei(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new _w(t,o,n,!!r)):(i=="doubleClick"?Fw:Bw)(t,o.pos,o.inside,n)?n.preventDefault():Ft(t,"pointer"))};class _w{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ep],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?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 j&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ze&&!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)),Ft(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(()=>gt(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(ei(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ft(this.view,"pointer"):Vw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||De&&this.mightDrag&&!this.mightDrag.node.isAtom||Oe&&!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)?(Zn(this.view,J.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ft(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ft(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)}}Ie.touchstart=t=>{t.input.lastTouch=Date.now(),bl(t),Ft(t,"pointer")},Ie.touchmove=t=>{t.input.lastTouch=Date.now(),Ft(t,"pointer")},Ie.contextmenu=t=>bl(t);function Cp(t,e){return t.composing?!0:De&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Hw=pt?5e3:-1;Re.compositionstart=Re.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof G&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),ti(t,!0),t.markCursor=null;else if(ti(t,!e.selection.empty),Ze&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Mp(t,Hw)},Re.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++,Mp(t,20))};function Mp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ti(t),e))}function Ap(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Kw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function jw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=L1(e.focusNode,e.focusOffset),r=$1(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Kw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ti(t,e=!1){if(!(pt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ap(t),e||t.docView&&t.docView.dirty){let n=al(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 Ww(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(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const $r=Ve&&Rt<15||Jn&&_1<604;Ie.copy=Re.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=$r?null:n.clipboardData,o=r.content(),{dom:a,text:l}=fl(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Ww(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Uw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Gw(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 s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Vr(t,r.value,null,s,e):Vr(t,r.textContent,r.innerHTML,s,e)},50)}function Vr(t,e,n,r,s){let i=yp(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||$.empty)))return!0;if(!i)return!1;let o=Uw(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Op(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," "):""}Re.paste=(t,e)=>{let n=e;if(t.composing&&!pt)return;let r=$r?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Vr(t,Op(r),r.getData("text/html"),s,n)?n.preventDefault():Gw(t,n)};class Pp{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const qw=Ue?"altKey":"ctrlKey";function Np(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[qw]}Ie.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(ei(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof j?s.to-1:s.to))){if(r&&r.mightDrag)o=j.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=j.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=fl(t,a);(!n.dataTransfer.files.length||!Oe||Vh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($r?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",$r||n.dataTransfer.setData("text/plain",c),t.dragging=new Pp(u,Np(t,n),o)},Ie.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Re.dragover=Re.dragenter=(t,e)=>e.preventDefault(),Re.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let s=t.posAtCoords(ei(n));if(!s)return;let i=t.state.doc.resolve(s.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=yp(t,Op(n.dataTransfer),$r?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&Np(t,n));if(t.someProp("handleDrop",p=>p(t,n,o||$.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?kh(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&j.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new j(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,k)=>p=k),c.setSelection(cl(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ie.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())&&gt(t)},20))},Ie.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)},Ie.beforeinput=(t,e)=>{if(Oe&&pt&&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,dn(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Re)Ie[t]=Re[t];function Fr(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}class ni{constructor(e,n){this.toDOM=e,this.spec=n||mn,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Le(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ni&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Bt{constructor(e,n){this.attrs=e,this.spec=n||mn}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Le(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Bt&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)}static is(e){return e.type instanceof Bt}destroy(){}}class vl{constructor(e,n){this.attrs=e,this.spec=n||mn}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Le(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof vl&&Fr(this.attrs,e.attrs)&&Fr(this.spec,e.spec)}destroy(){}}class Le{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Le(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 Le(e,e,new ni(n,r))}static inline(e,n,r,s){return new Le(e,n,new Bt(r,s))}static node(e,n,r,s){return new Le(e,n,new vl(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Bt}get widget(){return this.type instanceof ni}}const Qn=[],mn={};class oe{constructor(e,n){this.local=e.length?e:Qn,this.children=n.length?n:Qn}static create(e,n){return n.length?ri(n,e,0,mn):Pe}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==Pe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||mn)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Jw(this.children,o||[],e,n,r,s,i):o?new oe(o.sort(gn),Qn):Pe}add(e,n){return n.length?this==Pe?oe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Ip(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,ri(u,a,c+1,mn)),i+=3}});let o=Dp(i?Rp(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new oe(o.length?this.local.concat(o).sort(gn):this.local,s||this.children)}remove(e){return e.length==0||this==Pe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=Pe?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new oe(s,r):Pe}forChild(e,n){if(this==Pe)return this;if(n.isLeaf)return oe.empty;let r,s;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,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Bt){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new oe(s.sort(gn),Qn);return r?new zt([a,r]):a}return r||Pe}eq(e){if(this==e)return!0;if(!(e instanceof oe)||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 kl(this.localsInner(e))}localsInner(e){if(this==Pe)return Qn;if(e.inlineContent||!this.local.some(Bt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Bt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}oe.empty=new oe([],[]),oe.removeOverlap=kl;const Pe=oe.empty;class zt{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,mn));return zt.from(r)}forChild(e,n){if(n.isLeaf)return oe.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=Pe&&(i instanceof zt?r=r.concat(i.members):r.push(i))}return zt.from(r)}eq(e){if(!(e instanceof zt)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?kl(r?n:n.sort(gn)):Qn}static from(e){switch(e.length){case 0:return Pe;case 1:return e[0];default:return new zt(e.every(n=>n instanceof oe)?e:e.reduce((n,r)=>n.concat(r instanceof oe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Jw(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let y=0;y<a.length;y+=3){let k=a[y+1];if(k<0||f>k+u-d)continue;let S=a[y]+u-d;h>=S?a[y+1]=f<=S?-2:-1:f>=u&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),u=n.maps[c].map(u,-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 u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-s,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=a[c+2].mapInner(n,g,u+1,t[c]+i+1,o);y!=Pe?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Yw(a,t,e,n,s,i,o),u=ri(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new oe(e.sort(gn),a)}function Dp(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Le(s.from+e,s.to+e,s.type))}return n}function Yw(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+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 Ip(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function Rp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ri(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=Ip(t,a,l+n);if(c){i=!0;let u=ri(c,a,n+l+1,r);u!=Pe&&s.push(l,l+a.nodeSize,u)}});let o=Dp(i?Rp(t):t,-n).sort(gn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new oe(o,s):Pe}function gn(t,e){return t.from-e.from||t.to-e.to}function kl(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Lp(e,s+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),Lp(e,s,r.copy(i.from,r.to)));break}}}return e}function Lp(t,e,n){for(;e<t.length&&gn(n,t[e])>0;)e++;t.splice(e,0,n)}function xl(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Pe&&e.push(r)}),t.cursorWrapper&&e.push(oe.create(t.state.doc,[t.cursorWrapper.deco])),zt.from(e)}const Xw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Zw=Ve&&Rt<=11;class Qw{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}}class eS{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Ve&&Rt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),Zw&&(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,Xw)),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(cp(this.view)){if(this.suppressingSelectionUpdates)return gt(this.view);if(Ve&&Rt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&un(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=qn(i))n.add(i);for(let i=e.anchorNode;i;i=qn(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&cp(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Ze&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||rS(e,d)!=h)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ys(r)&&(c=al(e))&&c.eq(J.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,gt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),tS(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||gt(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 u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Ve&&Rt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?Ee(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?Ee(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})}}let $p=new WeakMap,Vp=!1;function tS(t){if(!$p.has(t)&&($p.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ze,Vp)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."),Vp=!0}}function Fp(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return un(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function nS(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Fp(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Fp(t,n):null}function rS(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 sS(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Ys(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Oe&&t.input.lastKeyCode===8)for(let g=i;g>s;g--){let y=r.childNodes[g-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){i=g;break}if(!k||k.size)break}let d=t.state.doc,f=t.someProp("domParser")||Ot.fromSchema(t.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:iS,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function iS(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(De&&/^(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||De&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const oS=/^(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 aS(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,_=al(t,x);if(_&&!t.state.selection.eq(_)){if(Oe&&pt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",b=>b(t,dn(13,"Enter"))))return;let U=t.state.tr.setSelection(_);x=="pointer"?U.setMeta("pointer",!0):x=="key"&&U.scrollIntoView(),i&&U.setMeta("composition",i),t.dispatch(U)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=sS(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=uS(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Jn&&t.input.lastIOSEnter>Date.now()-225||pt)&&s.some(x=>x.nodeType==1&&!oS.test(x.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",x=>x(t,dn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof G&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let x=Bp(t,t.state.doc,c.sel);if(x&&!x.eq(t.state.selection)){let _=t.state.tr.setSelection(x);i&&_.setMeta("composition",i),t.dispatch(_)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof G&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Ve&&Rt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,S;if((Jn&&t.input.lastIOSEnter>Date.now()-225&&(!k||s.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"",""))&&(S=J.findFrom(c.doc.resolve(m.pos+1),1,!0))&&S.head>m.pos)&&t.someProp("handleKeyDown",x=>x(t,dn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&cS(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",x=>x(t,dn(8,"Backspace")))){pt&&Oe&&t.domObserver.suppressSelectionUpdates();return}Oe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),pt&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,dn(13,"Enter"))})},20));let N=p.start,T=p.endA,A=x=>{let _=x||t.state.tr.replace(N,T,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let U=Bp(t,_.doc,c.sel);U&&!(Oe&&t.composing&&U.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(U.head==N||U.head==_.mapping.map(T)-1)||Ve&&U.empty&&U.head==N)&&_.setSelection(U)}return i&&_.setMeta("composition",i),_.scrollIntoView()},R;if(k){if(m.pos==g.pos){Ve&&Rt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>gt(t),20));let x=A(t.state.tr.delete(N,T)),_=u.resolve(p.start).marksAcross(u.resolve(p.endA));_&&x.ensureMarks(_),t.dispatch(x)}else if(p.endA==p.endB&&(R=lS(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let x=A(t.state.tr);R.type=="add"?x.addMark(N,T,R.mark):x.removeMark(N,T,R.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,g.parentOffset),_=()=>A(t.state.tr.insertText(x,N,T));t.someProp("handleTextInput",U=>U(t,N,T,x,_))||t.dispatch(_())}}else t.dispatch(A())}function Bp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:cl(t,e.resolve(n.anchor),e.resolve(n.head))}function lS(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(P.from(c).eq(t))return{mark:a,type:o}}function cS(t,e,n,r,s){if(n-e<=s.pos-r.pos||wl(r,!0,!1)<s.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 o=t.resolve(wl(i,!0,!0));return!o.parent.isTextblock||o.pos>n||wl(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function wl(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function uS(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&t.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<e.size&&zp(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&zp(t.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function zp(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}class _p{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 Ow,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Up),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=Kp(this),jp(this),this.nodeViews=Wp(this),this.docView=Xh(this.state.doc,Hp(this),xl(this),this.dom,this),this.domObserver=new eS(this,(r,s,i,o)=>aS(this,r,s,i,o)),this.domObserver.start(),Pw(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(Up),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Ap(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Wp(this);fS(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ml(this),this.editable=Kp(this),jp(this);let l=xl(this),c=Hp(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&K1(this);if(o){this.domObserver.stop();let h=d&&(Ve||Oe)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&dS(s.selection,e.selection);if(d){let p=Oe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=jw(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Xh(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&pw(this))?gt(this,h):(ap(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&W1(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 j){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Fh(this,n.getBoundingClientRect(),e)}else Fh(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,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=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&&(s=i)}this.dragging=new Pp(e.slice,e.move,s<0?void 0:j.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(Ve){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&&U1(this.dom),gt(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 X1(this,e)}coordsAtPos(e,n=1){return Kh(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 s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return nw(this,n||this.state,e)}pasteHTML(e,n){return Vr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Vr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return fl(this,e)}destroy(){this.docView&&(Nw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],xl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,I1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Iw(this,e)}domSelectionRange(){let e=this.domSelection();return e?De&&this.root.nodeType===11&&F1(this.dom.ownerDocument)==this.dom&&nS(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}_p.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Hp(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"),[Le.node(0,t.state.doc.content.size,e)]}function jp(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:Le.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Kp(t){return!t.someProp("editable",e=>e(t.state)===!1)}function dS(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 Wp(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function fS(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Up(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")}for(var _t={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:"'"},si={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hS=typeof navigator<"u"&&/Mac/.test(navigator.platform),pS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ce=0;Ce<10;Ce++)_t[48+Ce]=_t[96+Ce]=String(Ce);for(var Ce=1;Ce<=24;Ce++)_t[Ce+111]="F"+Ce;for(var Ce=65;Ce<=90;Ce++)_t[Ce]=String.fromCharCode(Ce+32),si[Ce]=String.fromCharCode(Ce);for(var Sl in _t)si.hasOwnProperty(Sl)||(si[Sl]=_t[Sl]);function mS(t){var e=hS&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pS&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?si:_t)[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}const gS=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),yS=typeof navigator<"u"&&/Win/.test(navigator.platform);function bS(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))gS?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function vS(t){let e=Object.create(null);for(let n in t)e[bS(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 kS(t){return new le({props:{handleKeyDown:Gp(t)}})}function Gp(t){let e=vS(t);return function(n,r){let s=mS(r),i,o=e[Tl(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[Tl(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(yS&&r.ctrlKey&&r.altKey)&&(i=_t[r.keyCode])&&i!=s){let a=e[Tl(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const El=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function qp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Jp=(t,e,n)=>{let r=qp(t,n);if(!r)return!1;let s=Cl(r);if(!s){let o=r.blockRange(),a=o&&jn(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(sm(t,s,e,-1))return!0;if(r.parent.content.size==0&&(er(i,"end")||j.isSelectable(i)))for(let o=r.depth;;o--){let a=Gs(t.doc,r.before(o),r.after(o),$.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(er(i,"end")?J.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):j.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},xS=(t,e,n)=>{let r=qp(t,n);if(!r)return!1;let s=Cl(r);return s?Yp(t,s,e):!1},wS=(t,e,n)=>{let r=Zp(t,n);if(!r)return!1;let s=Ml(r);return s?Yp(t,s,e):!1};function Yp(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Gs(t.doc,i,l,$.empty);if(!c||c.from!=i||c instanceof ve&&c.slice.size>=l-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(G.create(u.doc,i)),n(u.scrollIntoView())}return!0}function er(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}const Xp=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Cl(r)}let o=i&&i.nodeBefore;return!o||!j.isSelectable(o)?!1:(e&&e(t.tr.setSelection(j.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Cl(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 Zp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Qp=(t,e,n)=>{let r=Zp(t,n);if(!r)return!1;let s=Ml(r);if(!s)return!1;let i=s.nodeAfter;if(sm(t,s,e,1))return!0;if(r.parent.content.size==0&&(er(i,"start")||j.isSelectable(i))){let o=Gs(t.doc,r.before(),r.after(),$.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(er(i,"start")?J.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):j.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},em=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Ml(r)}let o=i&&i.nodeAfter;return!o||!j.isSelectable(o)?!1:(e&&e(t.tr.setSelection(j.create(t.doc,i.pos)).scrollIntoView()),!0)};function Ml(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}const SS=(t,e)=>{let n=t.selection,r=n instanceof j,s;if(r){if(n.node.isTextblock||!Dt(t.doc,n.from))return!1;s=n.from}else if(s=Us(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(j.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},TS=(t,e)=>{let n=t.selection,r;if(n instanceof j){if(n.node.isTextblock||!Dt(t.doc,n.to))return!1;r=n.to}else if(r=Us(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},ES=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&jn(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},tm=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
61
+ `).scrollIntoView()),!0)};function Al(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const CS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Al(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(J.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},nm=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof ze||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Al(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(G.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},rm=(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(ft(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&jn(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function MS(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof j&&e.selection.node.isBlock)return!r.parentOffset||!ft(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Al(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof G||e.selection instanceof ze)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=ft(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=ft(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(o).type!=a){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const AS=MS(),OS=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(j.create(t.doc,s))),!0)};function PS(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.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)||!(s.isTextblock||Dt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function sm(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&PS(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=P.empty;for(let y=o.length-1;y>=0;y--)p=P.from(o[y].create(null,p));p=P.from(s.copy(p));let m=t.tr.step(new ke(e.pos-1,h,e.pos,h,new $(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==s.type&&Dt(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:J.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&jn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&er(i,"start",!0)&&er(s,"end")){let h=s,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let y=P.empty;for(let S=p.length-1;S>=0;S--)y=P.from(p[S].copy(y));let k=t.tr.step(new ke(e.pos-p.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new $(y,p.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function im(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(G.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const NS=im(-1),DS=im(1);function IS(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&Ua(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function om(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function Ol(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}Ol(El,Jp,Xp),Ol(El,Qp,em),Ol(tm,nm,rm,AS),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function RS(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return LS(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function LS(t,e,n,r=null){let s=!1,i=e,o=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=o.resolve(e.start-2);i=new zs(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new zs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=Ua(i,n,r,e);return a?(t&&$S(t,e,a,s,n),!0):!1}function $S(t,e,n,r,s){let i=P.empty;for(let u=n.length-1;u>=0;u--)i=P.from(n[u].type.create(n[u].attrs,i));t.step(new ke(e.start-(r?2:0),e.end,e.start,e.end,new $(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&ft(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function VS(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?FS(e,n,t,i):BS(e,n,i):!0:!1}}function FS(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new ke(i-1,o,i,o,new $(P.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new zs(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=jn(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Dt(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function BS(t,e,n){let r=t.tr,s=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=s.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?P.empty:P.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new ke(d-(a?1:0),f+(l?1:0),d+1,f-1,new $((a?P.empty:P.from(s.copy(P.empty))).append(l?P.empty:P.from(s.copy(P.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function zS(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=P.from(c?t.create():null),d=new $(P.from(t.create(null,P.from(a.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new ke(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var _S=Object.defineProperty,am=(t,e)=>{for(var n in e)_S(t,n,{get:e[n],enumerable:!0})};function ii(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=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 s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var oi=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(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(l,e),g=f(...p)(m);return o.push(g),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:ii({state:s,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)(o)]))}};return o}},HS=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function lm(t,e){const n=new Eh(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}var cm=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&cm(r)}return t};function ai(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return cm(n)}function Br(t,e,n){if(t instanceof At||t instanceof P)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return P.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}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),Br("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new eh({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=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Ot.fromSchema(l).parseSlice(ai(t),n.parseOptions):Ot.fromSchema(l).parse(ai(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Ot.fromSchema(e);return n.slice?i.parseSlice(ai(t),n.parseOptions).content:i.parse(ai(t),n.parseOptions)}return Br("",e,n)}function Pl(t,e,n={},r={}){return Br(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function jS(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function KS(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function WS(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function li(t){return e=>WS(e.$from,t)}function H(t,e,n){return t.config[e]===void 0&&t.parent?H(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?H(t.parent,e,n):null}):t.config[e]}function Nl(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=H(e,"addExtensions",n);return r?[e,...Nl(r())]:e}).flat(10)}function Dl(t,e){const n=ln.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function um(t){return typeof t=="function"}function ee(t,e=void 0,...n){return um(t)?e?t.bind(e)(...n):t(...n):t}function US(t={}){return Object.keys(t).length===0&&t.constructor===Object}function zr(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function dm(t){const e=[],{nodeExtensions:n,markExtensions:r}=zr(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:s},l=H(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),s.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=H(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function pe(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[s]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=i}),r},{})}function ci(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)=>pe(n,r),{})}function GS(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function fm(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):GS(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function hm(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&US(n)?!1:n!=null))}function qS(t,e){var n;const r=dm(t),{nodeExtensions:s,markExtensions:i}=zr(t),o=(n=s.find(c=>H(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,k)=>{const S=H(k,"extendNodeSchema",d);return{...y,...S?S(c):{}}},{}),h=hm({...f,content:ee(H(c,"content",d)),marks:ee(H(c,"marks",d)),group:ee(H(c,"group",d)),inline:ee(H(c,"inline",d)),atom:ee(H(c,"atom",d)),selectable:ee(H(c,"selectable",d)),draggable:ee(H(c,"draggable",d)),code:ee(H(c,"code",d)),whitespace:ee(H(c,"whitespace",d)),linebreakReplacement:ee(H(c,"linebreakReplacement",d)),defining:ee(H(c,"defining",d)),isolating:ee(H(c,"isolating",d)),attrs:Object.fromEntries(u.map(y=>{var k,S;return[y.name,{default:(k=y?.attribute)==null?void 0:k.default,validate:(S=y?.attribute)==null?void 0:S.validate}]}))}),p=ee(H(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>fm(y,u)));const m=H(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:ci(y,u)}));const g=H(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,y)=>{const k=H(y,"extendMarkSchema",d);return{...g,...k?k(c):{}}},{}),h=hm({...f,inclusive:ee(H(c,"inclusive",d)),excludes:ee(H(c,"excludes",d)),group:ee(H(c,"group",d)),spanning:ee(H(c,"spanning",d)),code:ee(H(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var y,k;return[g.name,{default:(y=g?.attribute)==null?void 0:y.default,validate:(k=g?.attribute)==null?void 0:k.validate}]}))}),p=ee(H(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>fm(g,u)));const m=H(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:ci(g,u)})),[c.name,h]}));return new eh({topNode:o,nodes:a,marks:l})}function JS(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Il(t){return t.sort((n,r)=>{const s=H(n,"priority")||100,i=H(r,"priority")||100;return s>i?-1:s<i?1:0})}function pm(t){const e=Il(Nl(t)),n=JS(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 mm(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
62
+
63
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const h=o?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),a}function YS(t,e){const n={from:0,to:t.content.size};return mm(t,n,e)}function gm(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function yt(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 ym(t,e){const n=yt(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function me(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 XS(t,e){const n=me(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function ui(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function bm(t,e){const n=ui(typeof e=="string"?e:e.name,t.schema);return n==="node"?XS(t,e):n==="mark"?ym(t,e):{}}function ZS(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function QS(t){const e=ZS(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==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 vm(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),QS(r)}function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function di(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Rl(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function km(t,e,n={}){return t.find(r=>r.type===e&&di(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function xm(t,e,n={}){return!!km(t,e,n)}function Ll(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!km([...s.node.marks],e,n)))return;let o=s.index,a=t.start()+s.offset,l=o+1,c=a+s.node.nodeSize;for(;o>0&&xm([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&xm([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function $l(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Ll(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var eT=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);a?.type.name===e?o=a:i-=1}return[o,i]};function Vl(t,e){return e.nodes[t]||e.marks[t]||null}function fi(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var tT=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Fl(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?yt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>di(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),k=Math.min(p,g+m.nodeSize),S=k-y;o+=S,a.push(...m.marks.map(N=>({mark:N,from:y,to:k})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>di(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function Ht(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?me(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(s,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=s-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>di(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}function nT(t,e,n={}){if(!e)return Ht(t,null,n)||Fl(t,null,n);const r=ui(e,t.schema);return r==="node"?Ht(t,e,n):r==="mark"?Fl(t,e,n):!1}var rT=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=li(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},sT=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function wm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Sm(t,e){const{nodeExtensions:n}=zr(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=ee(H(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function hi(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 s=!0;return t.content.forEach(i=>{s!==!1&&(hi(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Tm(t){return t instanceof j}function Em(t){return t instanceof G}function yn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Cm(t,e=null){if(!e)return null;const n=J.atStart(t),r=J.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?G.create(t,yn(0,s,i),yn(t.content.size,s,i)):G.create(t,yn(e,s,i),yn(e,s,i))}function iT(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof ve||s instanceof ke))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(J.near(t.doc.resolve(o),n))}var pi=class{constructor(t){this.find=t.find,this.handler=t.handler}},oT=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const 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 mi(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const 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 u=!1;const d=tT(c)+i;return o.forEach(f=>{if(u)return;const h=oT(d,f.find);if(!h)return;const p=l.state.tr,m=ii({state:l.state,transaction:p}),g={from:r-(h[0].length-i.length),to:s},{commands:y,chain:k,can:S}=new oi({editor:n,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:k,can:S})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:s,text:i}),l.dispatch(p),u=!0)}),u}function aT(t){const{editor:e,rules:n}=t,r=new le({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Dl(P.from(u),o.schema);const{from:d}=l,f=d+u.length;mi({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return mi({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&mi({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?mi({editor:e,from:o.pos,to:o.pos,text:`
64
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function lT(t){return Object.prototype.toString.call(t).slice(8,-1)}function gi(t){return lT(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mm(t,e){const n={...t};return gi(t)&&gi(e)&&Object.keys(e).forEach(r=>{gi(e[r])&&gi(t[r])?n[r]=Mm(t[r],e[r]):n[r]=e[r]}),n}var Bl=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{...ee(H(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ee(H(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mm(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const 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}},bn=class Pg extends Bl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Pg(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>c?.type.name===n.name))return!1;const l=o.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function cT(t){return typeof t=="number"}var uT=class{constructor(t){this.find=t.find,this.handler=t.handler}},dT=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function fT(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new oi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(s,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");dT(y,i.find,o).forEach(S=>{if(S.index===void 0)return;const N=m+S.index+1,T=N+S[0].length,A={from:n.tr.mapping.map(N),to:n.tr.mapping.map(T)},R=i.handler({state:n,range:A,match:S,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(R)})}),d.every(h=>h!==null)}var yi=null,hT=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function pT(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=ii({state:u,transaction:m});if(!(!fT({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new le({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(yi=e)},h=()=>{yi&&(yi=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const h=yi;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,s=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!s,g=p.getMeta("uiEvent")==="drop"&&!i,y=p.getMeta("applyPasteRules"),k=!!y;if(!m&&!g&&!k)return;if(k){let{text:T}=y;typeof T=="string"?T=T:T=Dl(P.from(T),h.schema);const{from:A}=y,R=A+T.length,x=hT(T);return l({rule:u,state:h,from:A,to:{b:R},pasteEvt:x})}const S=f.doc.content.findDiffStart(h.doc.content),N=f.doc.content.findDiffEnd(h.doc.content);if(!(!cT(S)||!N||S===N.b))return l({rule:u,state:h,from:S,to:N,pasteEvt:o})}}))}var bi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=pm(t),this.schema=qS(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vl(e.name,this.schema)},r=H(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this,e=Il([...this.extensions].reverse()),n=[],r=[],s=e.map(i=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Vl(i.name,this.schema)},a=[],l=H(i,"addKeyboardShortcuts",o);let c={};if(i.type==="mark"&&H(i,"exitable",o)&&(c.ArrowRight=()=>bn.handleExit({editor:t,mark:i})),l){const p=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:t})]));c={...c,...p}}const u=kS(c);a.push(u);const d=H(i,"addInputRules",o);wm(i,t.options.enableInputRules)&&d&&n.push(...d());const f=H(i,"addPasteRules",o);wm(i,t.options.enablePasteRules)&&f&&r.push(...f());const h=H(i,"addProseMirrorPlugins",o);if(h){const p=h();a.push(...p)}return a}).flat();return[aT({editor:t,rules:n}),...pT({editor:t,rules:r}),...s]}get attributes(){return dm(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=zr(this.extensions);return Object.fromEntries(e.filter(n=>!!H(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=H(n,"addNodeView",s);if(!i)return[];const o=(a,l,c,u,d)=>{const f=ci(a,r);return i()({node:a,view:l,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=zr(this.extensions);return Object.fromEntries(e.filter(n=>!!H(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:yt(n.name,this.schema)},i=H(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=ci(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{PE(a,t,d)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const 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=ee(H(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=H(e,"onBeforeCreate",r),i=H(e,"onCreate",r),o=H(e,"onUpdate",r),a=H(e,"onSelectionUpdate",r),l=H(e,"onTransaction",r),c=H(e,"onFocus",r),u=H(e,"onBlur",r),d=H(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};bi.resolve=pm,bi.sort=Il,bi.flatten=Nl;var mT={};am(mT,{ClipboardTextSerializer:()=>Am,Commands:()=>Im,Delete:()=>Rm,Drop:()=>Lm,Editable:()=>$m,FocusEvents:()=>Fm,Keymap:()=>Bm,Paste:()=>zm,Tabindex:()=>_m,focusEventsPluginKey:()=>Vm});var ge=class Ng extends Bl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Ng(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Am=ge.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new le({key:new xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=gm(n);return mm(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Om={};am(Om,{blur:()=>gT,clearContent:()=>yT,clearNodes:()=>bT,command:()=>vT,createParagraphNear:()=>kT,cut:()=>xT,deleteCurrentNode:()=>wT,deleteNode:()=>ST,deleteRange:()=>TT,deleteSelection:()=>ET,enter:()=>CT,exitCode:()=>MT,extendMarkRange:()=>AT,first:()=>OT,focus:()=>NT,forEach:()=>DT,insertContent:()=>IT,insertContentAt:()=>LT,joinBackward:()=>FT,joinDown:()=>VT,joinForward:()=>BT,joinItemBackward:()=>zT,joinItemForward:()=>_T,joinTextblockBackward:()=>HT,joinTextblockForward:()=>jT,joinUp:()=>$T,keyboardShortcut:()=>WT,lift:()=>UT,liftEmptyBlock:()=>GT,liftListItem:()=>qT,newlineInCode:()=>JT,resetAttributes:()=>YT,scrollIntoView:()=>XT,selectAll:()=>ZT,selectNodeBackward:()=>QT,selectNodeForward:()=>eE,selectParentNode:()=>tE,selectTextblockEnd:()=>nE,selectTextblockStart:()=>rE,setContent:()=>sE,setMark:()=>oE,setMeta:()=>aE,setNode:()=>lE,setNodeSelection:()=>cE,setTextSelection:()=>uE,sinkListItem:()=>dE,splitBlock:()=>fE,splitListItem:()=>hE,toggleList:()=>pE,toggleMark:()=>mE,toggleNode:()=>gE,toggleWrap:()=>yE,undoInputRule:()=>bE,unsetAllMarks:()=>vE,unsetMark:()=>kE,updateAttributes:()=>xE,wrapIn:()=>wE,wrapInList:()=>SE});var gT=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),yT=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),bT=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=jn(h);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},vT=t=>e=>t(e),kT=()=>({state:t,dispatch:e})=>nm(t,e),xT=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new G(r.doc.resolve(Math.max(o-1,0)))),!0},wT=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1},ST=t=>({tr:e,state:n,dispatch:r})=>{const s=me(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},TT=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},ET=()=>({state:t,dispatch:e})=>El(t,e),CT=()=>({commands:t})=>t.keyboardShortcut("Enter"),MT=()=>({state:t,dispatch:e})=>CS(t,e),AT=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const i=yt(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(s){const d=Ll(l,i,e);if(d&&d.from<=c&&d.to>=u){const f=G.create(o,d.from,d.to);n.setSelection(f)}}return!0},OT=t=>e=>{const 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 PT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function zl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var NT=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(zl()||PT())&&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&&!Em(n.state.selection))return o(),!0;const a=Cm(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},DT=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),IT=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),RT=t=>!("type"in t),LT=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const{selection:l}=i.state,c=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Br(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){c(y)}try{a=Br(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,p=!0;if((RT(a)?a:[a]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===f&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof P){let y="";e.forEach(k=>{k.text&&(y+=k.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,f)}else{g=a;const y=l.$from.parentOffset===0,k=l.$from.node().isText||l.$from.node().isTextblock,S=l.$from.node().content.size>0;y&&k&&S&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}n.updateSelection&&iT(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},$T=()=>({state:t,dispatch:e})=>SS(t,e),VT=()=>({state:t,dispatch:e})=>TS(t,e),FT=()=>({state:t,dispatch:e})=>Jp(t,e),BT=()=>({state:t,dispatch:e})=>Qp(t,e),zT=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Us(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},_T=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Us(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},HT=()=>({state:t,dispatch:e})=>xS(t,e),jT=()=>({state:t,dispatch:e})=>wS(t,e);function Pm(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function KT(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))zl()||Pm()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var WT=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=KT(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,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=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0},UT=(t,e={})=>({state:n,dispatch:r})=>{const s=me(t,n.schema);return Ht(n,s,e)?ES(n,r):!1},GT=()=>({state:t,dispatch:e})=>rm(t,e),qT=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return VS(r)(e,n)},JT=()=>({state:t,dispatch:e})=>tm(t,e);function Nm(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var YT=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=ui(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=me(t,r.schema)),a==="mark"&&(o=yt(t,r.schema)),s&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,Nm(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&n.addMark(u,u+c.nodeSize,o.create(Nm(d.attrs,e)))})})}),!0):!1},XT=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),ZT=()=>({tr:t,dispatch:e})=>{if(e){const n=new ze(t.doc);t.setSelection(n)}return!0},QT=()=>({state:t,dispatch:e})=>Xp(t,e),eE=()=>({state:t,dispatch:e})=>em(t,e),tE=()=>({state:t,dispatch:e})=>OS(t,e),nE=()=>({state:t,dispatch:e})=>DS(t,e),rE=()=>({state:t,dispatch:e})=>NS(t,e),sE=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Pl(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function iE(t,e,n){var r;const{selection:s}=e;let i=null;if(Em(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=s;return o.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,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var oE=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=yt(t,r.schema);if(s)if(o){const c=ym(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,m,l.create({...y.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return iE(r,n,l)},aE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),lE=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=me(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>om(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>om(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},cE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=yn(t,0,r.content.size),i=j.create(r,s);e.setSelection(i)}return!0},uE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=G.atStart(r).from,a=G.atEnd(r).to,l=yn(s,o,a),c=yn(i,o,a),u=G.create(r,l,c);e.setSelection(u)}return!0},dE=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return zS(r)(e,n)};function Dm(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e?.includes(s.type.name));t.tr.ensureMarks(r)}}var fE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=fi(c,a.node().type.name,a.node().attrs);if(i instanceof j&&i.node.isBlock)return!a.parentOffset||!ft(o,a.pos)?!1:(r&&(t&&Dm(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:jS(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=ft(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&ft(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof G&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const 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&&Dm(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},hE=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=me(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const 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(s){let y=P.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let x=l.depth-k;x>=l.depth-3;x-=1)y=P.from(l.node(x).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,N={...fi(f,l.node().type.name,l.node().attrs),...e},T=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(N))||void 0;y=y.append(P.from(a.createAndFill(null,T)||void 0));const A=l.before(l.depth-(k-1));n.replace(A,l.after(-S),new $(y,4-k,0));let R=-1;n.doc.nodesBetween(A,n.doc.content.size,(x,_)=>{if(R>-1)return!1;x.isTextblock&&x.content.size===0&&(R=_+1)}),R>-1&&n.setSelection(G.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...fi(f,d.type.name,d.attrs),...e},m={...fi(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const g=h?[{type:a,attrs:p},{type:h,attrs:m}]:[{type:a,attrs:p}];if(!ft(n.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:k}=r,{splittableMarks:S}=i.extensionManager,N=k||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!N||!s)return!0;const T=N.filter(A=>S.includes(A.type.name));n.ensureMarks(T)}return!0},_l=(t,e)=>{const n=li(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===s?.type&&Dt(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=li(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===s?.type&&Dt(t.doc,r)&&t.join(r),!0},pE=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=me(t,o.schema),p=me(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:k}=m,S=y.blockRange(k),N=g||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const T=li(A=>Sm(A.type.name,d))(m);if(S.depth>=1&&T&&S.depth-T.depth<=1){if(T.node.type===h)return c.liftListItem(p);if(Sm(T.node.type.name,d)&&h.validContent(T.node.content)&&a)return l().command(()=>(i.setNodeMarkup(T.pos,h),!0)).command(()=>_l(i,h)).command(()=>Hl(i,h)).run()}return!n||!N||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>_l(i,h)).command(()=>Hl(i,h)).run():l().command(()=>{const A=u().wrapInList(h,r),R=N.filter(x=>f.includes(x.type.name));return i.ensureMarks(R),A?!0:c.clearNodes()}).wrapInList(h,r).command(()=>_l(i,h)).command(()=>Hl(i,h)).run()},mE=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=yt(t,r.schema);return Fl(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},gE=(t,e,n={})=>({state:r,commands:s})=>{const i=me(t,r.schema),o=me(e,r.schema),a=Ht(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},yE=(t,e={})=>({state:n,commands:r})=>{const s=me(t,n.schema);return Ht(n,s,e)?r.lift(s):r.wrapIn(s,e)},bE=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},vE=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},kE=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=yt(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!s)return!0;if(u&&o){let{from:f,to:h}=a;const p=(i=c.marks().find(g=>g.type===l))==null?void 0:i.attrs,m=Ll(c,l,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},xE=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=ui(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=me(t,r.schema)),a==="mark"&&(o=yt(t,r.schema)),s&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{i&&i===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g<c&&i&&i===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(i&&i===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){const k=Math.max(g,c),S=Math.min(g+m.nodeSize,u);n.addMark(k,S,o.create({...y.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(m=>{o===m.type&&n.addMark(h,p,o.create({...m.attrs,...e}))}))}),!0):!1},wE=(t,e={})=>({state:n,dispatch:r})=>{const s=me(t,n.schema);return IS(s,e)(n,r)},SE=(t,e={})=>({state:n,dispatch:r})=>{const s=me(t,n.schema);return RS(s,e)(n,r)},Im=ge.create({name:"commands",addCommands(){return{...Om}}}),Rm=ge.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=lm(t.before,[t,...e]);vm(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,y=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,g;if(h instanceof Xe){const y=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),S=f.invert().map(y,-1),N=f.invert().map(k),T=(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(R=>R.eq(h.mark)),A=(g=u.doc.nodeAt(k))==null?void 0:g.marks.some(R=>R.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:S,to:N},newRange:{from:y,to:k},partial:!!(A||T),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Lm=ge.create({name:"drop",addProseMirrorPlugins(){return[new le({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),$m=ge.create({name:"editable",addProseMirrorPlugins(){return[new le({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Vm=new xe("focusEvents"),Fm=ge.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new le({key:Vm,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Bm=ge.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:J.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.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()},s={...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 zl()||Pm()?i:s},addProseMirrorPlugins(){return[new le({key:new xe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),s=t.some(m=>m.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=J.atStart(e.doc).from,c=J.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!hi(n.doc))return;const f=n.tr,h=ii({state:n,transaction:f}),{commands:p}=new oi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),zm=ge.create({name:"paste",addProseMirrorPlugins(){return[new le({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),_m=ge.create({name:"tabindex",addProseMirrorPlugins(){return[new le({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),TE=class sr{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}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’t 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;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new sr(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 sr(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 sr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=this.pos+r+(i?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!s&&a.depth<=this.depth)return;const l=new sr(a,this.editor,s,s?n:null);s&&(l.actualDepth=this.depth+1),e.push(new sr(a,this.editor,s,s?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},EE=`.ProseMirror {
65
+ position: relative;
66
+ }
67
+
68
+ .ProseMirror {
69
+ word-wrap: break-word;
70
+ white-space: pre-wrap;
71
+ white-space: break-spaces;
72
+ -webkit-font-variant-ligatures: none;
73
+ font-variant-ligatures: none;
74
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
75
+ }
76
+
77
+ .ProseMirror [contenteditable="false"] {
78
+ white-space: normal;
79
+ }
80
+
81
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
82
+ white-space: pre-wrap;
83
+ }
84
+
85
+ .ProseMirror pre {
86
+ white-space: pre-wrap;
87
+ }
88
+
89
+ img.ProseMirror-separator {
90
+ display: inline !important;
91
+ border: none !important;
92
+ margin: 0 !important;
93
+ width: 0 !important;
94
+ height: 0 !important;
95
+ }
96
+
97
+ .ProseMirror-gapcursor {
98
+ display: none;
99
+ pointer-events: none;
100
+ position: absolute;
101
+ margin: 0;
102
+ }
103
+
104
+ .ProseMirror-gapcursor:after {
105
+ content: "";
106
+ display: block;
107
+ position: absolute;
108
+ top: -2px;
109
+ width: 20px;
110
+ border-top: 1px solid black;
111
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
112
+ }
113
+
114
+ @keyframes ProseMirror-cursor-blink {
115
+ to {
116
+ visibility: hidden;
117
+ }
118
+ }
119
+
120
+ .ProseMirror-hideselection *::selection {
121
+ background: transparent;
122
+ }
123
+
124
+ .ProseMirror-hideselection *::-moz-selection {
125
+ background: transparent;
126
+ }
127
+
128
+ .ProseMirror-hideselection * {
129
+ caret-color: transparent;
130
+ }
131
+
132
+ .ProseMirror-focused .ProseMirror-gapcursor {
133
+ display: block;
134
+ }`;function CE(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var ME=class extends HS{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:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Cm(e,this.options.autofocus);this.editorState=Gn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){var t;if(this.editorView){const 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=CE(EE,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){const n=um(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;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[$m,Am.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Im,Fm,Bm,_m,Lm,zm,Rm].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new bi(r,this)}createCommandManager(){this.commandManager=new oi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Pl(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=Pl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new _p(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.injectCSS();const 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;const 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 u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(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 bm(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return nT(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Dl(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
135
+
136
+ `,textSerializers:n={}}=t||{};return YS(this.state.doc,{blockSeparator:e,textSerializers:{...gm(this.schema),...n}})}get isEmpty(){return hi(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){const e=this.state.doc.resolve(t);return new TE(e,this)}get $doc(){return this.$pos(0)}};function tr(t){return new pi({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ee(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if($l(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const f=n.from+l+o.length;i.addMark(n.from+l,f,t.type.create(s||{})),i.removeStoredMark(t.type)}}})}function AE(t){return new pi({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ee(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()}})}function jl(t){return new pi({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=ee(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function nr(t){return new pi({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=ee(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Ua(l,t.type,i);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Dt(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)}})}function OE(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof j){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function PE(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var _e=class Dg extends Bl{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Dg(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function vn(t){return new uT({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=ee(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if($l(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}var Kl,Hm;function NE(){return Hm||(Hm=1,Kl=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,s,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!t(e[s],n[s]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],n.get(s[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(e[s]!==n[s])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(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),Kl}var DE=NE();const IE=Lg(DE);var vi={exports:{}},Wl={};/**
137
+ * @license React
138
+ * use-sync-external-store-shim/with-selector.production.js
139
+ *
140
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
141
+ *
142
+ * This source code is licensed under the MIT license found in the
143
+ * LICENSE file in the root directory of this source tree.
144
+ */var jm;function RE(){if(jm)return Wl;jm=1;var t=w,e=$a();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Wl.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(A){if(!k){if(k=!0,S=A,A=f(A),h!==void 0&&m.hasValue){var R=m.value;if(h(R,A))return N=R}return N=A}if(R=N,r(S,A))return R;var x=f(A);return h!==void 0&&h(R,x)?(S=A,R):(S=A,N=x)}var k=!1,S,N,T=d===void 0?null:d;return[function(){return y(u())},T===null?void 0:function(){return y(T())}]},[u,d,f,h]);var g=s(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},Wl}var Ul={};/**
145
+ * @license React
146
+ * use-sync-external-store-shim/with-selector.development.js
147
+ *
148
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
149
+ *
150
+ * This source code is licensed under the MIT license found in the
151
+ * LICENSE file in the root directory of this source tree.
152
+ */var Km;function LE(){return Km||(Km=1,process.env.NODE_ENV!=="production"&&function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=w,n=$a(),r=typeof Object.is=="function"?Object.is:t,s=n.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;Ul.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(A){if(!k){if(k=!0,S=A,A=f(A),h!==void 0&&m.hasValue){var R=m.value;if(h(R,A))return N=R}return N=A}if(R=N,r(S,A))return R;var x=f(A);return h!==void 0&&h(R,x)?(S=A,R):(S=A,N=x)}var k=!1,S,N,T=d===void 0?null:d;return[function(){return y(u())},T===null?void 0:function(){return y(T())}]},[u,d,f,h]);var g=s(c,p[0],p[1]);return o(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())}()),Ul}var Wm;function $E(){return Wm||(Wm=1,process.env.NODE_ENV==="production"?vi.exports=RE():vi.exports=LE()),vi.exports}var VE=$E(),FE=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},BE=({contentComponent:t})=>{const e=Lf.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return ne.jsx(ne.Fragment,{children:Object.values(e)})};function zE(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ec.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var _E=class extends w.Component{constructor(t){var e;super(t),this.editorContentRef=w.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.options.element.childNodes),t.setOptions({element:e}),t.contentComponent=zE(),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;const 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;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:t,innerRef:e,...n}=this.props;return ne.jsxs(ne.Fragment,{children:[ne.jsx("div",{ref:FE(e,this.editorContentRef),...n}),t?.contentComponent&&ne.jsx(BE,{contentComponent:t.contentComponent})]})}},HE=w.forwardRef((t,e)=>{const n=w.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return w.createElement(_E,{key:n,innerRef:e,...t})}),jE=w.memo(HE),KE=typeof window<"u"?w.useLayoutEffect:w.useEffect,WE=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){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function UE(t){var e;const[n]=w.useState(()=>new WE(t.editor)),r=VE.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:IE);return KE(()=>n.watch(t.editor),[t.editor,n]),w.useDebugValue(r),r}var Um=process.env.NODE_ENV!=="production",Gl=typeof window>"u",GE=Gl||!!(typeof window<"u"&&window.next),qE=class Ig{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(Gl||GE){if(Um)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&&Gl&&Um)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(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new ME(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((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ig.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,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const 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 JE(t={},e=[]){const n=w.useRef(t);n.current=t;const[r]=w.useState(()=>new qE(n)),s=Lf.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return w.useDebugValue(s),w.useEffect(r.onRender(e)),UE({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var YE=w.createContext({editor:null});YE.Consumer;var XE=w.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),ZE=()=>w.useContext(XE);w.forwardRef((t,e)=>{const{onDragStart:n}=ZE(),r=t.as||"div";return ne.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})}),w.createContext({markViewContentRef:()=>{}});var ki=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{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]},QE=/^\s*>\s$/,eC=_e.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ki("blockquote",{...pe(this.options.HTMLAttributes,t),children:ki("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[nr({find:QE,type:this.type})]}}),tC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,iC=bn.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 ki("strong",{...pe(this.options.HTMLAttributes,t),children:ki("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[tr({find:tC,type:this.type}),tr({find:rC,type:this.type})]},addPasteRules(){return[vn({find:nC,type:this.type}),vn({find:sC,type:this.type})]}}),oC=/(^|[^`])`([^`]+)`(?!`)/,aC=/(^|[^`])`([^`]+)`(?!`)/g,lC=bn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",pe(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[tr({find:oC,type:this.type})]},addPasteRules(){return[vn({find:aC,type:this.type})]}}),cC=/^```([a-z]+)?[\s\n]$/,uC=/^~~~([a-z]+)?[\s\n]$/,dC=_e.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;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",pe(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:()=>{const{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;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
153
+
154
+ `);return!i||!o?!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;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(J.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[jl({find:cC,type:this.type,getAttributes:t=>({language:t[1]})}),jl({find:uC,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new le({key:new xe("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
155
+ `));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(G.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),fC=_e.create({name:"doc",topNode:!0,content:"block+"}),hC=_e.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",pe(this.options.HTMLAttributes,t)]},renderText(){return`
156
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pC=_e.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]}`,pe(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=>jl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),mC=_e.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",pe(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!OE(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return Tm(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:i,dispatch:o})=>{var a;if(o){const{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(G.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(j.create(i.doc,l.pos)):i.setSelection(G.create(i.doc,l.pos));else{const u=(a=l.parent.type.contentMatch.defaultType)==null?void 0:a.create();u&&(i.insert(c,u),i.setSelection(G.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[AE({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),gC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,bC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,vC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,kC=bn.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",pe(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[tr({find:gC,type:this.type}),tr({find:bC,type:this.type})]},addPasteRules(){return[vn({find:yC,type:this.type}),vn({find:vC,type:this.type})]}});const xC="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",wC="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ql="numeric",Jl="ascii",Yl="alpha",_r="asciinumeric",Hr="alphanumeric",Xl="domain",Gm="emoji",SC="scheme",TC="slashscheme",Zl="whitespace";function EC(t,e){return t in e||(e[t]=[]),e[t]}function kn(t,e,n){e[ql]&&(e[_r]=!0,e[Hr]=!0),e[Jl]&&(e[_r]=!0,e[Yl]=!0),e[_r]&&(e[Hr]=!0),e[Yl]&&(e[Hr]=!0),e[Hr]&&(e[Xl]=!0),e[Gm]&&(e[Xl]=!0);for(const r in e){const s=EC(r,n);s.indexOf(t)<0&&s.push(t)}}function CC(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Fe(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Fe.groups={},Fe.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.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 s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Fe.groups;let s;return e&&e.j?s=e:(s=new Fe(e),n&&r&&kn(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Fe.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Fe,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Fe,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(CC(o.t,r),n);kn(i,l,r)}else n&&kn(i,n,r);o.t=i}return s.j[t]=o,o}};const Y=(t,e,n,r,s)=>t.ta(e,n,r,s),ce=(t,e,n,r,s)=>t.tr(e,n,r,s),qm=(t,e,n,r,s)=>t.ts(e,n,r,s),I=(t,e,n,r,s)=>t.tt(e,n,r,s),bt="WORD",Ql="UWORD",Jm="ASCIINUMERICAL",Ym="ALPHANUMERICAL",jr="LOCALHOST",ec="TLD",tc="UTLD",xi="SCHEME",rr="SLASH_SCHEME",nc="NUM",rc="WS",sc="NL",Kr="OPENBRACE",Wr="CLOSEBRACE",wi="OPENBRACKET",Si="CLOSEBRACKET",Ti="OPENPAREN",Ei="CLOSEPAREN",Ci="OPENANGLEBRACKET",Mi="CLOSEANGLEBRACKET",Ai="FULLWIDTHLEFTPAREN",Oi="FULLWIDTHRIGHTPAREN",Pi="LEFTCORNERBRACKET",Ni="RIGHTCORNERBRACKET",Di="LEFTWHITECORNERBRACKET",Ii="RIGHTWHITECORNERBRACKET",Ri="FULLWIDTHLESSTHAN",Li="FULLWIDTHGREATERTHAN",$i="AMPERSAND",Vi="APOSTROPHE",Fi="ASTERISK",jt="AT",Bi="BACKSLASH",zi="BACKTICK",_i="CARET",Kt="COLON",ic="COMMA",Hi="DOLLAR",it="DOT",ji="EQUALS",oc="EXCLAMATION",qe="HYPHEN",Ur="PERCENT",Ki="PIPE",Wi="PLUS",Ui="POUND",Gr="QUERY",ac="QUOTE",Xm="FULLWIDTHMIDDLEDOT",lc="SEMI",ot="SLASH",qr="TILDE",Gi="UNDERSCORE",Zm="EMOJI",qi="SYM";var Qm=Object.freeze({__proto__:null,ALPHANUMERICAL:Ym,AMPERSAND:$i,APOSTROPHE:Vi,ASCIINUMERICAL:Jm,ASTERISK:Fi,AT:jt,BACKSLASH:Bi,BACKTICK:zi,CARET:_i,CLOSEANGLEBRACKET:Mi,CLOSEBRACE:Wr,CLOSEBRACKET:Si,CLOSEPAREN:Ei,COLON:Kt,COMMA:ic,DOLLAR:Hi,DOT:it,EMOJI:Zm,EQUALS:ji,EXCLAMATION:oc,FULLWIDTHGREATERTHAN:Li,FULLWIDTHLEFTPAREN:Ai,FULLWIDTHLESSTHAN:Ri,FULLWIDTHMIDDLEDOT:Xm,FULLWIDTHRIGHTPAREN:Oi,HYPHEN:qe,LEFTCORNERBRACKET:Pi,LEFTWHITECORNERBRACKET:Di,LOCALHOST:jr,NL:sc,NUM:nc,OPENANGLEBRACKET:Ci,OPENBRACE:Kr,OPENBRACKET:wi,OPENPAREN:Ti,PERCENT:Ur,PIPE:Ki,PLUS:Wi,POUND:Ui,QUERY:Gr,QUOTE:ac,RIGHTCORNERBRACKET:Ni,RIGHTWHITECORNERBRACKET:Ii,SCHEME:xi,SEMI:lc,SLASH:ot,SLASH_SCHEME:rr,SYM:qi,TILDE:qr,TLD:ec,UNDERSCORE:Gi,UTLD:tc,UWORD:Ql,WORD:bt,WS:rc});const vt=/[a-z]/,Jr=new RegExp("\\p{L}","u"),cc=new RegExp("\\p{Emoji}","u"),kt=/\d/,uc=/\s/,eg="\r",dc=`
157
+ `,MC="️",AC="‍",fc="";let Ji=null,Yi=null;function OC(t=[]){const e={};Fe.groups=e;const n=new Fe;Ji==null&&(Ji=ng(xC)),Yi==null&&(Yi=ng(wC)),I(n,"'",Vi),I(n,"{",Kr),I(n,"}",Wr),I(n,"[",wi),I(n,"]",Si),I(n,"(",Ti),I(n,")",Ei),I(n,"<",Ci),I(n,">",Mi),I(n,"(",Ai),I(n,")",Oi),I(n,"「",Pi),I(n,"」",Ni),I(n,"『",Di),I(n,"』",Ii),I(n,"<",Ri),I(n,">",Li),I(n,"&",$i),I(n,"*",Fi),I(n,"@",jt),I(n,"`",zi),I(n,"^",_i),I(n,":",Kt),I(n,",",ic),I(n,"$",Hi),I(n,".",it),I(n,"=",ji),I(n,"!",oc),I(n,"-",qe),I(n,"%",Ur),I(n,"|",Ki),I(n,"+",Wi),I(n,"#",Ui),I(n,"?",Gr),I(n,'"',ac),I(n,"/",ot),I(n,";",lc),I(n,"~",qr),I(n,"_",Gi),I(n,"\\",Bi),I(n,"・",Xm);const r=ce(n,kt,nc,{[ql]:!0});ce(r,kt,r);const s=ce(r,vt,Jm,{[_r]:!0}),i=ce(r,Jr,Ym,{[Hr]:!0}),o=ce(n,vt,bt,{[Jl]:!0});ce(o,kt,s),ce(o,vt,o),ce(s,kt,s),ce(s,vt,s);const a=ce(n,Jr,Ql,{[Yl]:!0});ce(a,vt),ce(a,kt,i),ce(a,Jr,a),ce(i,kt,i),ce(i,vt),ce(i,Jr,i);const l=I(n,dc,sc,{[Zl]:!0}),c=I(n,eg,rc,{[Zl]:!0}),u=ce(n,uc,rc,{[Zl]:!0});I(n,fc,u),I(c,dc,l),I(c,fc,u),ce(c,uc,u),I(u,eg),I(u,dc),ce(u,uc,u),I(u,fc,u);const d=ce(n,cc,Zm,{[Gm]:!0});I(d,"#"),ce(d,cc,d),I(d,MC,d);const f=I(d,AC);I(f,"#"),ce(f,cc,d);const h=[[vt,o],[kt,s]],p=[[vt,null],[Jr,a],[kt,i]];for(let m=0;m<Ji.length;m++)Wt(n,Ji[m],ec,bt,h);for(let m=0;m<Yi.length;m++)Wt(n,Yi[m],tc,Ql,p);kn(ec,{tld:!0,ascii:!0},e),kn(tc,{utld:!0,alpha:!0},e),Wt(n,"file",xi,bt,h),Wt(n,"mailto",xi,bt,h),Wt(n,"http",rr,bt,h),Wt(n,"https",rr,bt,h),Wt(n,"ftp",rr,bt,h),Wt(n,"ftps",rr,bt,h),kn(xi,{scheme:!0,ascii:!0},e),kn(rr,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],k=t[m][1]?{[SC]:!0}:{[TC]:!0};g.indexOf("-")>=0?k[Xl]=!0:vt.test(g)?kt.test(g)?k[_r]=!0:k[Jl]=!0:k[ql]=!0,qm(n,g,g,k)}return qm(n,"localhost",jr,{ascii:!0}),n.jd=new Fe(qi),{start:n,tokens:Object.assign({groups:e},Qm)}}function tg(t,e){const n=PC(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[o].length,f++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function PC(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Wt(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Fe(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Fe(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function ng(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Yr={defaultProtocol:"http",events:null,format:rg,formatHref:rg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function hc(t,e=null){let n=Object.assign({},Yr);t&&(n=Object.assign(n,t instanceof hc?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}hc.prototype={o:Yr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Yr[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function rg(t){return t}function sg(t,e){this.t="token",this.v=t,this.tk=e}sg.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":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=Yr.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){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Xi(t,e){class n extends sg{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const ig=Xi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),og=Xi("text"),NC=Xi("nl"),Zi=Xi("url",{isLink:!0,toHref(t=Yr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==jr&&t[1].t===Kt}}),Je=t=>new Fe(t);function DC({groups:t}){const e=t.domain.concat([$i,Fi,jt,Bi,zi,_i,Hi,ji,qe,nc,Ur,Ki,Wi,Ui,ot,qi,qr,Gi]),n=[Vi,Kt,ic,it,oc,Ur,Gr,ac,lc,Ci,Mi,Kr,Wr,Si,wi,Ti,Ei,Ai,Oi,Pi,Ni,Di,Ii,Ri,Li],r=[$i,Vi,Fi,Bi,zi,_i,Hi,ji,qe,Kr,Wr,Ur,Ki,Wi,Ui,Gr,ot,qi,qr,Gi],s=Je(),i=I(s,qr);Y(i,r,i),Y(i,t.domain,i);const o=Je(),a=Je(),l=Je();Y(s,t.domain,o),Y(s,t.scheme,a),Y(s,t.slashscheme,l),Y(o,r,i),Y(o,t.domain,o);const c=I(o,jt);I(i,jt,c),I(a,jt,c),I(l,jt,c);const u=I(i,it);Y(u,r,i),Y(u,t.domain,i);const d=Je();Y(c,t.domain,d),Y(d,t.domain,d);const f=I(d,it);Y(f,t.domain,d);const h=Je(ig);Y(f,t.tld,h),Y(f,t.utld,h),I(c,jr,h);const p=I(d,qe);I(p,qe,p),Y(p,t.domain,d),Y(h,t.domain,d),I(h,it,f),I(h,qe,p);const m=I(h,Kt);Y(m,t.numeric,ig);const g=I(o,qe),y=I(o,it);I(g,qe,g),Y(g,t.domain,o),Y(y,r,i),Y(y,t.domain,o);const k=Je(Zi);Y(y,t.tld,k),Y(y,t.utld,k),Y(k,t.domain,o),Y(k,r,i),I(k,it,y),I(k,qe,g),I(k,jt,c);const S=I(k,Kt),N=Je(Zi);Y(S,t.numeric,N);const T=Je(Zi),A=Je();Y(T,e,T),Y(T,n,A),Y(A,e,T),Y(A,n,A),I(k,ot,T),I(N,ot,T);const R=I(a,Kt),x=I(l,Kt),_=I(x,ot),U=I(_,ot);Y(a,t.domain,o),I(a,it,y),I(a,qe,g),Y(l,t.domain,o),I(l,it,y),I(l,qe,g),Y(R,t.domain,T),I(R,ot,T),I(R,Gr,T),Y(U,t.domain,T),Y(U,e,T),I(U,ot,T);const b=[[Kr,Wr],[wi,Si],[Ti,Ei],[Ci,Mi],[Ai,Oi],[Pi,Ni],[Di,Ii],[Ri,Li]];for(let D=0;D<b.length;D++){const[V,C]=b[D],L=I(T,V);I(A,V,L),I(L,C,T);const v=Je(Zi);Y(L,e,v);const O=Je();Y(L,n),Y(v,e,v),Y(v,n,O),Y(O,e,v),Y(O,n,O),I(v,C,T),I(O,C,T)}return I(s,jr,k),I(s,sc,NC),{start:s,tokens:Qm}}function IC(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=l||a.go(n[s].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(pc(og,e,o)),o=[]),s-=f,u-=f;const h=d.t,p=n.slice(s-u,s);i.push(pc(h,e,p))}}return o.length>0&&i.push(pc(og,e,o)),i}function pc(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const RC=typeof console<"u"&&console&&console.warn||(()=>{}),LC="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $C(){return Fe.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function ag(t,e=!1){if(se.initialized&&RC(`linkifyjs: already initialized - will not register custom scheme "${t}" ${LC}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
158
+ 1. Must only contain digits, lowercase ASCII letters or "-"
159
+ 2. Cannot start or end with "-"
160
+ 3. "-" cannot repeat`);se.customSchemes.push([t,e])}function VC(){se.scanner=OC(se.customSchemes);for(let t=0;t<se.tokenQueue.length;t++)se.tokenQueue[t][1]({scanner:se.scanner});se.parser=DC(se.scanner.tokens);for(let t=0;t<se.pluginQueue.length;t++)se.pluginQueue[t][1]({scanner:se.scanner,parser:se.parser});return se.initialized=!0,se}function mc(t){return se.initialized||VC(),IC(se.parser.start,t,tg(se.scanner.start,t))}mc.scan=tg;function lg(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}const r=new hc(n),s=mc(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var gc="[\0-   ᠎ -\u2029  ]",FC=new RegExp(gc),BC=new RegExp(`${gc}$`),zC=new RegExp(gc,"g");function _C(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function HC(t){return new le({key:new xe("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=lm(n.doc,[...e]);if(vm(a).forEach(({newRange:c})=>{const u=KS(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!BC.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(FC).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=mc(p).map(y=>y.toObject(t.defaultProtocol));if(!_C(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{$l(y.from,y.to,r.doc).some(k=>k.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function jC(t){return new le({key:new xe("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;o=d.find(f=>f.nodeName==="A")}if(!o)return!1;const a=bm(e.state,t.type.name),l=(s=o?.href)!=null?s:a.href,c=(i=o?.target)!=null?i:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),o&&l?(window.open(l,c),!0):!1}}})}function KC(t){return new le({key:new xe("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:s}=e,{selection:i}=s,{empty:o}=i;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=lg(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 xn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(zC,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var WC=bn.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"){ag(t);return}ag(t.scheme,t.optionalSlashes)})},onDestroy(){$C()},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)=>!!xn(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=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!xn(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=>!!xn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",pe(this.options.HTMLAttributes,t),0]:["a",pe(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!xn(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})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!xn(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[vn({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=lg(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!xn(o,n),protocols:n,defaultProtocol:r}));s.length&&s.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(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(HC({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!xn(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(jC({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(KC({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),UC=Object.defineProperty,GC=(t,e)=>{for(var n in e)UC(t,n,{get:e[n],enumerable:!0})},qC="listItem",cg="textStyle",ug=/^\s*([-+*])\s$/,dg=_e.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",pe(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(qC,this.editor.getAttributes(cg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=nr({find:ug,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=nr({find:ug,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(cg),editor:this.editor})),[t]}}),fg=_e.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",pe(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)}}}),JC={};GC(JC,{findListItemPos:()=>Xr,getNextListDepth:()=>yc,handleBackspace:()=>bc,handleDelete:()=>vc,hasListBefore:()=>hg,hasListItemAfter:()=>YC,hasListItemBefore:()=>pg,listItemHasSubList:()=>mg,nextListIsDeeper:()=>gg,nextListIsHigher:()=>yg});var Xr=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},yc=(t,e)=>{const n=Xr(t,e);if(!n)return!1;const[,r]=eT(e,t,n.$pos.pos+4);return r},hg=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},pg=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},mg=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},bc=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ht(t.state,e)&&hg(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Ht(t.state,e)||!sT(t.state))return!1;const r=Xr(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=mg(e,t.state,i);return pg(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},gg=(t,e)=>{const n=yc(t,e),r=Xr(t,e);return!r||!n?!1:n>r.depth},yg=(t,e)=>{const n=yc(t,e),r=Xr(t,e);return!r||!n?!1:n<r.depth},vc=(t,e)=>{if(!Ht(t.state,e)||!rT(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:gg(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():yg(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},YC=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},bg=ge.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&&vc(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&&vc(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&&bc(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&&bc(t,n,r)&&(e=!0)}),e}}}}),XC="listItem",vg="textStyle",kg=/^(\d+)\.\s$/,xg=_e.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}){const{start:e,...n}=t;return e===1?["ol",pe(this.options.HTMLAttributes,n),0]:["ol",pe(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(XC,this.editor.getAttributes(vg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=nr({find:kg,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=nr({find:kg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(vg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),ZC=/^\s*(\[([( |x])?\])\s$/,QC=_e.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=>{const 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",pe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const 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})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:l,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[nr({find:ZC,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),eM=_e.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",pe(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()}}});ge.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(dg.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(fg.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(bg.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(xg.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(QC.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(eM.configure(this.options.taskList)),t}});var tM=_e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",pe(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sM=bn.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",pe(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[tr({find:nM,type:this.type})]},addPasteRules(){return[vn({find:rM,type:this.type})]}}),iM=_e.create({name:"text",group:"inline"}),oM=bn.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",pe(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()}}});function aM(t={}){return new le({view(e){return new lM(e,t)}})}class lM{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(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,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,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.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,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"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),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=kh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends J{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ue.valid(r)?new ue(r):J.near(r)}content(){return $.empty}eq(e){return e instanceof ue&&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 ue(e.resolve(n.pos))}getBookmark(){return new kc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!cM(e)||!uM(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ue.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(ue.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!j.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(ue.valid(a))return a}return null}}}ue.prototype.visible=!1,ue.findFrom=ue.findGapCursorFrom,J.jsonID("gapcursor",ue);class kc{constructor(e){this.pos=e}map(e){return new kc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ue.valid(n)?new ue(n):J.near(n)}}function cM(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 s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function uM(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 s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function dM(){return new le({props:{decorations:mM,createSelectionBetween(t,e,n){return e.pos==n.pos&&ue.valid(n)?new ue(n):null},handleClick:hM,handleKeyDown:fM,handleDOMEvents:{beforeinput:pM}}})}const fM=Gp({ArrowLeft:Qi("horiz",-1),ArrowRight:Qi("horiz",1),ArrowUp:Qi("vert",-1),ArrowDown:Qi("vert",1)});function Qi(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof G){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ue.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new ue(c))),!0):!1}}function hM(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ue.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&j.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ue(r))),!0)}function pM(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ue))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 s=P.empty;for(let o=r.length-1;o>=0;o--)s=P.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new $(s,0,0));return i.setSelection(G.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function mM(t){if(!(t.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",oe.create(t.doc,[Le.widget(t.selection.head,e,{key:"gapcursor"})])}var eo=200,we=function(){};we.prototype.append=function(e){return e.length?(e=we.from(e),!this.length&&e||e.length<eo&&this.leafAppend(e)||this.length<eo&&e.leafPrepend(this)||this.appendInner(e)):this},we.prototype.prepend=function(e){return e.length?we.from(e).append(this):this},we.prototype.appendInner=function(e){return new gM(this,e)},we.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?we.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},we.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},we.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)},we.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s},we.from=function(e){return e instanceof we?e:e&&e.length?new wg(e):we.empty};var wg=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(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=eo)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=eo)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(we);we.empty=new wg([]);var gM=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,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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}(we);const yM=500;class Qe{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 s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new at(d.map));let h=d.step.map(s.slice(i)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new at(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new Qe(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new at(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(o++,n=void 0),s||(l=f)}let c=o-r.depth;return c>vM&&(a=bM(a,c),o-=c),new Qe(a.append(i),o)}remapping(e,n){let r=new Er;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qe(this.items.append(e.map(n=>new at(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=n;this.items.forEach(f=>{let h=i.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(l+1,h));g&&a++,r.push(new at(p,m,g))}else r.push(new at(p))},s);let c=[];for(let f=n;f<o;f++)c.push(new at(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new Qe(u,a);return d.emptyItemCount()>yM&&(d=d.compress(this.items.length-r.length)),d}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,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new at(c.invert(),l,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new Qe(we.from(s.reverse()),i)}}Qe.empty=new Qe(we.empty,0);function bM(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class at{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new at(n.getMap().invert(),n,this.selection)}}}class Ut{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const vM=20;function kM(t,e,n,r){let s=n.getMeta(wn),i;if(s)return s.historyState;n.getMeta(SM)&&(t=new Ut(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(wn))return o.getMeta(wn).redo?new Ut(t.done.addTransform(n,void 0,r,to(e)),t.undone,Sg(n.mapping.maps),t.prevTime,t.prevComposition):new Ut(t.done,t.undone.addTransform(n,void 0,r,to(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!xM(n,t.prevRanges)),c=o?xc(t.prevRanges,n.mapping):Sg(n.mapping.maps);return new Ut(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,to(e)),Qe.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ut(t.done.rebased(n,i),t.undone.rebased(n,i),xc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ut(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),xc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function xM(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Sg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function xc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function wM(t,e,n){let r=to(e),s=wn.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new Ut(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(wn,{redo:n,historyState:l})}let wc=!1,Tg=null;function to(t){let e=t.plugins;if(Tg!=e){wc=!1,Tg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){wc=!0;break}}return wc}const wn=new xe("history"),SM=new xe("closeHistory");function TM(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new le({key:wn,state:{init(){return new Ut(Qe.empty,Qe.empty,null,0,-1)},apply(e,n,r){return kM(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Cg:r=="historyRedo"?Mg:null;return s?(n.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function Eg(t,e){return(n,r)=>{let s=wn.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=wM(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Cg=Eg(!1,!0),Mg=Eg(!0,!0);ge.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=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const 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 le({key:new xe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=i-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var EM=ge.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[aM(this.options)]}});ge.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new le({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return oe.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Le.node(c,c+l.nodeSize,{class:this.options.className}))}),oe.create(t,i)}}})]}});var CM=ge.create({name:"gapCursor",addProseMirrorPlugins(){return[dM()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ee(H(t,"allowGapCursor",n)))!=null?e:null}}});ge.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new le({key:new xe("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&hi(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Le.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),oe.create(t,s)}}})]}}),ge.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new le({key:new xe("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Tm(n.selection)||t.view.dragging?null:oe.create(n.doc,[Le.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Ag({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var MM=ge.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const t=new xe(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 le({key:t,appendTransaction:(n,r,s)=>{const{doc:i,tr:o,schema:a}=s,l=t.getState(s),c=i.content.size,u=a.nodes[this.options.node];if(l)return o.insert(c,u.create())},state:{init:(n,r)=>{const s=r.tr.doc.lastChild;return!Ag({node:s,types:e})},apply:(n,r)=>{if(!n.docChanged)return r;const s=n.doc.lastChild;return!Ag({node:s,types:e})}}})]}}),AM=ge.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Cg(t,e),redo:()=>({state:t,dispatch:e})=>Mg(t,e)}},addProseMirrorPlugins(){return[TM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OM=ge.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(iC.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(eC.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(dg.configure(this.options.bulletList)),this.options.code!==!1&&s.push(lC.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(dC.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(fC.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(EM.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(CM.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(hC.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(pC.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(AM.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(mC.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(kC.configure(this.options.italic)),this.options.listItem!==!1&&s.push(fg.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(bg.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(WC.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(xg.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(tM.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(sM.configure(this.options.strike)),this.options.text!==!1&&s.push(iM.configure(this.options.text)),this.options.underline!==!1&&s.push(oM.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(MM.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),PM=OM;const NM=()=>{const t=JE({extensions:[PM],content:"<p>Hello Tiptop!</p>"});return ne.jsx(Lx,{className:"p-4",children:ne.jsx(jE,{editor:t})})};var DM=ak;const IM=Object.freeze(Object.defineProperty({__proto__:null,default:DM},Symbol.toStringTag,{value:"Module"}));xt.TiptopEditor=NM,Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"})});