PageSourceSearch

https://matters.group/assets/BlogEditor-DmM9-0nx.js

js matters.group collected 2026-10-09 22:42:12 UTC 457,655 bytes, 253 lines download raw bytes

1import{c as te,a1 as ro,r as x,a2 as nr,j as m,a3 as en,a4 as St,a5 as so,a6 as Mf,a7 as _l,a8 as Nf,a9 as zl,aa as Tf,ab as Ef,z as xe,ac as Af,ad as sa,C as Of,ae as Bl,af as Fl,ag as Df,ah as Rf,ai as If,aj as Pf,ak as Lf,al as jf,am as _f,an as zf,ao as Bf,ap as Ff,aq as Hf,q as ws,B as De,X as Hl,s as ye,R as Jt,ar as $f,as as Vf,n as Wf,K as Uf,O as Kf,M as qf,at as Jf,S as Gf,N as Yf,P as Xf,Q as Qf,T as Zf,V as eh,Y as th,Z as nh,_ as rh,$ as sh,a0 as ih,F as oh}from"./index-CISjGKDG.js";import{I as Mn}from"./input-DGwrk3E_.js";import{T as Ws}from"./textarea-yxAZ_PtL.js";import{L as ue}from"./label-BS3NzEI_.js";import{u as ah}from"./index-BqPSmliO.js";import{t as X,c as Vn,s as Or,a as Wn,g as ia,m as lh,b as ch,d as lt,e as dh,h as uh,i as io,j as fh,k as hh,f as At,l as $l}from"./format-BEMO4FpZ.js";import{a as Ce,s as Us,d as ph}from"./index-CwlroEan.js";import{C as mh,T as gh}from"./tag-Cv-2H4Xq.js";import{L as Dn,U as Vl,I as Wl,o as Ul,a as Kl,f as Dr}from"./imageOptimizer-CJI0jx42.js";import{B as yh}from"./badge-CYkC30cE.js";import{P as vh}from"./plus-BiEo2wCc.js";import{S as bh,a as xh,b as kh,c as Sh,d as wh}from"./select-DvsdkMH9.js";import{D as Ch,c as Mh,a as Nh,d as Th,b as Eh}from"./dialog-CJchXsDH.js";import{S as Ah}from"./scroll-area-CaHVrgB0.js";import{I as Ci}from"./image-BoCP9cXw.js";import{T as ql}from"./trash-2-BemfS7GG.js";import{A as Oh}from"./arrow-left-YZnKS9XH.js";import{C as Dh}from"./calendar-DdpC5sp_.js";import{C as Rh}from"./clock-BZuKkNfb.js";import{o as Ih,s as ur,l as Ph}from"./types-BvPt5XnJ.js";import"./index-BdQq_4o_.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Lh=te("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const jh=te("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const _h=te("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const zh=te("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Bh=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Fh=te("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const Hh=te("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const $h=te("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const Vh=te("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const Wh=te("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const Uh=te("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
57 * @license lucide-react v0.462.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const Kh=te("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
62 * @license lucide-react v0.462.0 - ISC
63 *
64 * This source code is licensed under the ISC license.
65 * See the LICENSE file in the root directory of this source tree.
66 */const qh=te("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
67 * @license lucide-react v0.462.0 - ISC
68 *
69 * This source code is licensed under the ISC license.
70 * See the LICENSE file in the root directory of this source tree.
71 */const Jh=te("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
72 * @license lucide-react v0.462.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const Gh=te("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
77 * @license lucide-react v0.462.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */const Yh=te("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
82 * @license lucide-react v0.462.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const Xh=te("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
87 * @license lucide-react v0.462.0 - ISC
88 *
89 * This source code is licensed under the ISC license.
90 * See the LICENSE file in the root directory of this source tree.
91 */const Qh=te("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",ke
vendor: 5,458 bytes, lines 91-96
91y:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
92 * @license lucide-react v0.462.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */const Zh=te("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);function Ue(n,e){const t=X(n);if(isNaN(e))return Vn(n,NaN);if(!e)return t;const r=t.getDate(),s=Vn(n,t.getTime());s.setMonth(t.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(t.setFullYear(s.getFullYear(),s.getMonth(),r),t)}function Mi(n,e){const t=e*7;return Ce(n,t)}function ep(n,e){return Ue(n,e*12)}function tp(n){let e;return n.forEach(function(t){const r=X(t);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function np(n){let e;return n.forEach(t=>{const r=X(t);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function Ne(n,e){const t=Or(n),r=Or(e);return+t==+r}function Un(n,e){const t=X(n),r=X(e),s=t.getFullYear()-r.getFullYear(),i=t.getMonth()-r.getMonth();return s*12+i}function rp(n,e,t){const r=Wn(n,t),s=Wn(e,t),i=+r-ia(r),o=+s-ia(s);return Math.round((i-o)/lh)}function oo(n){const e=X(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function Te(n){const e=X(n);return e.setDate(1),e.setHours(0,0,0,0),e}function ao(n,e){var a,l,c,d;const t=ch(),r=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((d=(c=t.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,s=X(n),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Jl(n){return ao(n,{weekStartsOn:1})}function sp(n){const e=X(n),t=e.getFullYear(),r=e.getMonth(),s=Vn(n,0);return s.setFullYear(t,r+1,0),s.setHours(0,0,0,0),s.getDate()}function ip(n){return Math.trunc(+X(n)/1e3)}function op(n){const e=X(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(0,0,0,0),e}function ap(n,e){return rp(op(n),Te(n),e)+1}function Ni(n,e){const t=X(n),r=X(e);return t.getTime()>r.getTime()}function Gl(n,e){const t=X(n),r=X(e);return+t<+r}function lo(n,e){const t=X(n),r=X(e);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()}function lp(n,e){const t=X(n),r=X(e);return t.getFullYear()===r.getFullYear()}function Ks(n,e){const t=X(n),r=t.getFullYear(),s=t.getDate(),i=Vn(n,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=sp(i);return t.setMonth(e,Math.min(s,o)),t}function oa(n,e){const t=X(n);return isNaN(+t)?Vn(n,NaN):(t.setFullYear(e),t)}var co="Radio",[cp,Yl]=ro(co),[dp,up]=cp(co),Xl=x.forwardRef((n,e)=>{const{__scopeRadio:t,name:r,checked:s=!1,required:i,disabled:o,value:a="on",onCheck:l,form:c,...d}=n,[u,h]=x.useState(null),f=nr(e,y=>h(y)),p=x.useRef(!1),g=u?c||!!u.closest("form"):!0;return m.jsxs(dp,{scope:t,checked:s,disabled:o,children:[m.jsx(en.button,{type:"button",role:"radio","aria-checked":s,"data-state":tc(s),"data-disabled":o?"":void 0,disabled:o,value:a,...d,ref:f,onClick:St(n.onClick,y=>{s||l==null||l(),g&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})}),g&&m.jsx(ec,{control:u,bubbles:!p.current,name:r,value:a,checked:s,required:i,disabled:o,form:c,style:{transform:"translateX(-100%)"}})]})});Xl.displayName=co;var Ql="RadioIndicator",Zl=x.forwardRef((n,e)=>{const{__scopeRadio:t,forceMount:r,...s}=n,i=up(Ql,t);return m.jsx(so,{present:r||i.checked,children:m.jsx(en.span,{"data-state":tc(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})})});Zl.displayName=Ql;var fp="RadioBubbleInput",ec=x.forwardRef(({__scopeRadio:n,control:e,checked:t,bubbles:r=!0,...s},i)=>{const o=x.useRef(null),a=nr(o,i),l=ah(t),c=Mf(e);return x.useEffect(()=>{const d=o.current;if(!d)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==t&&f){const p=new Event("click",{bubbles:r});f.call(d,t),d.dispatchEvent(p)}},[l,t,r]),m.jsx(en.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:a,style:{...s.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ec.displayName=fp;function tc(n){return n?"checked":"unchecked"}var hp=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Cs="RadioGroup",[pp,RS]=ro(Cs,[_l,Yl]),nc=_l(),rc=Yl(),[mp,gp]=pp(Cs),sc=x.forwardRef((n,e)=>{const{__scopeRadioGroup:t,name:r,defaultValue:s,value:i,required:o=!1,disabled:a=!1,orientation:l,dir:c,loop:d=!0,onValueChange:u,...h}=n,f=nc(t),p=Nf(c),[g,y]=zl({prop:i,defaultProp:s??null,onChange:u,caller:Cs});return m.jsx(mp,{scope:t,name:r,required:o,disabled:a,value:g,onValueChange:y,children:m.jsx(Tf,{asChild:!0,...f,orientation:l,dir:p,loop:d,children:m.jsx(en.div,{role:"radiogroup","aria-required":o,"aria-orientation":l,"data-disabled":a?"":void 0,dir:p,...h,ref:e})})})});sc.displayName=Cs;var ic="RadioGroupItem",oc=x.forwardRef((n,e)=>{const{__scopeRadioGroup:t,disabled:r,...s}=n,i=gp(ic,t),o=i.disabled||r,a=nc(t),l=rc(t),c=x.useRef(null),d=nr(e,c),u=i.value===s.value,h=x.useRef(!1);return x.useEffect(()=>{const f=g=>{hp.includes(g.key)&&(h.current=!0)},p=()=>h.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",p)}},[]),m.jsx(Ef,{asChild:!0,...a,focusable:!o,active:u,children:m.jsx(Xl,{disabled:o,required:i.required,
96checked:u,...l,...s,name:i.name,ref:d,onCheck:()=>i.onValueChange(s.value),onKeyDown:St(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:St(s.onFocus,()=>{var f;h.current&&((f=c.current)==null||f.click())})})})});oc.displayName=ic;var yp="RadioGroupIndicator",ac=x.forwardRef((n,e)=>{const{__scopeRadioGroup:t,...r}=n,s=rc(t);return m.jsx(Zl,{...s,...r,ref:e})});ac.displayName=yp;var lc=sc,cc=oc,vp=ac;const dc=x.forwardRef(({className:n,...e},t)=>m.jsx(lc,{className:xe("grid gap-2",n),...e,ref:t}));dc.displayName=lc.displayName;const wr=x.forwardRef(({className:n,...e},t)=>m.jsx(cc,{ref:t,className:xe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:m.jsx(vp,{className:"flex items-center justify-center",children:m.jsx(Af,{className:"h-2.5 w-2.5 fill-current text-current"})})}));wr.displayName=cc.displayName;var P=function(){return P=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},P.apply(this,arguments)};function bp(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function uc(n,e,t){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}function rr(n){return n.mode==="multiple"}function sr(n){return n.mode==="range"}function Ms(n){return n.mode==="single"}var xp={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function kp(n,e){return At(n,"LLLL y",e)}function Sp(n,e){return At(n,"d",e)}function wp(n,e){return At(n,"LLLL",e)}function Cp(n){return"".concat(n)}function Mp(n,e){return At(n,"cccccc",e)}function Np(n,e){return At(n,"yyyy",e)}var Tp=Object.freeze({__proto__:null,formatCaption:kp,formatDay:Sp,formatMonthCaption:wp,formatWeekNumber:Cp,formatWeekdayName:Mp,formatYearCaption:Np}),Ep=function(n,e,t){return At(n,"do MMMM (EEEE)",t)},Ap=function(){return"Month: "},Op=function(){return"Go to next month"},Dp=function(){return"Go to previous month"},Rp=function(n,e){return At(n,"cccc",e)},Ip=function(n){return"Week n. ".concat(n)},Pp=function(){return"Year: "},Lp=Object.freeze({__proto__:null,labelDay:Ep,labelMonthDropdown:Ap,labelNext:Op,labelPrevious:Dp,labelWeekNumber:Ip,labelWeekday:Rp,labelYearDropdown:Pp});function jp(){var n="buttons",e=xp,t=dh,r={},s={},i=1,o={},a=new Date;return{captionLayout:n,classNames:e,formatters:Tp,labels:Lp,locale:t,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:a,mode:"default"}}function _p(n){var e=n.fromYear,t=n.toYear,r=n.fromMonth,s=n.toMonth,i=n.fromDate,o=n.toDate;
96return r?i=Te(r):e&&(i=new Date(e,0,1)),s?o=oo(s):t&&(o=new Date(t,11,31)),{fromDate:i?Or(i):void 0,toDate:o?Or(o):void 0}}var fc=x.createContext(void 0);function zp(n){var e,t=n.initialProps,r=jp(),s=_p(t),i=s.fromDate,o=s.toDate,a=(e=t.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!i||!o)&&(a="buttons");var l;(Ms(t)||rr(t)||sr(t))&&(l=t.onSelect);var c=P(P(P({},r),t),{captionLayout:a,classNames:P(P({},r.classNames),t.classNames),components:P({},t.components),formatters:P(P({},r.formatters),t.formatters),fromDate:i,labels:P(P({},r.labels),t.labels),mode:t.mode||r.mode,modifiers:P(P({},r.modifiers),t.modifiers),modifiersClassNames:P(P({},r.modifiersClassNames),t.modifiersClassNames),onSelect:l,styles:P(P({},r.styles),t.styles),toDate:o});return m.jsx(fc.Provider,{value:c,children:n.children})}function V(){var n=x.useContext(fc);if(!n)throw new Error("useDayPicker must be used within a DayPickerProvider.");return n}function hc(n){var e=V(),t=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return m.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:n.id,children:i(n.displayMonth,{locale:t})})}function Bp(n){return m.jsx("svg",P({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},n,{children:m.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function pc(n){var e,t,r=n.onChange,s=n.value,i=n.children,o=n.caption,a=n.className,l=n.style,c=V(),d=(t=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&t!==void 0?t:Bp;return m.jsxs("div",{className:a,style:l,children:[m.jsx("span",{className:c.classNames.vhidden,children:n["aria-label"]}),m.jsx("select",{name:n.name,"aria-label":n["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:s,onChange:r,children:i}),m.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[o,m.jsx(d,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function Fp(n){var e,t=V(),r=t.fromDate,s=t.toDate,i=t.styles,o=t.locale,a=t.formatters.formatMonthCaption,l=t.classNames,c=t.components,d=t.labels.labelMonthDropdown;if(!r)return m.jsx(m.Fragment,{});if(!s)return m.jsx(m.Fragment,{});var u=[];if(lp(r,s))for(var h=Te(r),f=r.getMonth();f<=s.getMonth();f++)u.push(Ks(h,f));else for(var h=Te(new Date),f=0;f<=11;f++)u.push(Ks(h,f));var p=function(y){var v=Number(y.target.value),b=Ks(Te(n.displayMonth),v);n.onChange(b)},g=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:pc;return m.jsx(g,{name:"months","aria-label":d(),className:l.dropdown_month,style:i.dropdown_month,onChange:p,value:n.displayMonth.getMonth(),caption:a(n.displayMonth,{locale:o}),children:u.map(function(y){return m.jsx("option",{value:y.getMonth(),children:a(y,{locale:o})},y.getMonth())})})}function Hp(n){var e,t=n.displayMonth,r=V(),s=r.fromDate,i=r.toDate,o=r.locale,a=r.styles,l=r.classNames,c=r.components,d=r.formatters.formatYearCaption,u=r.labels.labelYearDropdown,h=[];if(!s)return m.jsx(m.Fragment,{});if(!i)return m.jsx(m.Fragment,{});for(var f=s.getFullYear(),p=i.getFullYear(),g=f;g<=p;g++)h.push(oa(uh(new Date),g));var y=function(b){var C=oa(Te(t),Number(b.target.value));n.onChange(C)},v=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:pc;return m.jsx(v,{name:"years","aria-label":u(),className:l.dropdown_year,style:a.dropdown_year,onChange:y,value:t.getFullYear(),caption:d(t,{locale:o}),children:h.map(function(b){return m.jsx("option",{value:b.getFullYear(),children:d(b,{locale:o})},b.getFullYear())})})}function $p(n,e){var t=x.useState(n),r=t[0],s=t[1],i=e===void 0?r:e;return[i,s]}function Vp(n){var e=n.month,t=n.defaultMonth,r=n.today,s=e||t||r||new Date,i=n.toDate,o=n.fromDate,a=n.numberOfMonths,l=a===void 0?1:a;if(i&&Un(i,s)<0){var c=-1*(l-1);s=Ue(i,c)}return o&&Un(s,o)<0&&(s=o),Te(s)}function Wp(){var n=V(),e=Vp(n),t=$p(e,n.month),r=t[0],s=t[1],i=function(o){var a;if(!n.disableNavigation){var l=Te(o);s(l),(a=n.onMonthChange)===null||a===void 0||a.call(n,l)}};return[r,i]}function Up(n,e){for(var t=e.reverseMonths,r=e.numberOfMonths,s=Te(n),i=Te(Ue(s,r)),o=Un(i,s),a=[],l=0;l<o;l++){var c=Ue(s,l);a.push(c)}return t&&(a=a.reverse()),a}function Kp(n,e){if(!e.disableNavigation){var t=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,a=Te(n);if(!t)return Ue(a,o);var l=Un(t,n);if(!(l<i))return Ue(a,o)}}function qp(n,e){if(!e.disableNavigation){var t=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,a=Te(n);if(!t)return Ue(a,-o);var l=Un(a,t);
96if(!(l<=0))return Ue(a,-o)}}var mc=x.createContext(void 0);function Jp(n){var e=V(),t=Wp(),r=t[0],s=t[1],i=Up(r,e),o=Kp(r,e),a=qp(r,e),l=function(u){return i.some(function(h){return lo(u,h)})},c=function(u,h){l(u)||(h&&Gl(u,h)?s(Ue(u,1+e.numberOfMonths*-1)):s(u))},d={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:c,previousMonth:a,nextMonth:o,isDateDisplayed:l};return m.jsx(mc.Provider,{value:d,children:n.children})}function ir(){var n=x.useContext(mc);if(!n)throw new Error("useNavigation must be used within a NavigationProvider");return n}function aa(n){var e,t=V(),r=t.classNames,s=t.styles,i=t.components,o=ir().goToMonth,a=function(d){o(Ue(d,n.displayIndex?-n.displayIndex:0))},l=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:hc,c=m.jsx(l,{id:n.id,displayMonth:n.displayMonth});return m.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[m.jsx("div",{className:r.vhidden,children:c}),m.jsx(Fp,{onChange:a,displayMonth:n.displayMonth}),m.jsx(Hp,{onChange:a,displayMonth:n.displayMonth})]})}function Gp(n){return m.jsx("svg",P({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:m.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Yp(n){return m.jsx("svg",P({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:m.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Rr=x.forwardRef(function(n,e){var t=V(),r=t.classNames,s=t.styles,i=[r.button_reset,r.button];n.className&&i.push(n.className);var o=i.join(" "),a=P(P({},s.button_reset),s.button);return n.style&&Object.assign(a,n.style),m.jsx("button",P({},n,{ref:e,type:"button",className:o,style:a}))});function Xp(n){var e,t,r=V(),s=r.dir,i=r.locale,o=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,d=l.labelNext,u=r.components;if(!n.nextMonth&&!n.previousMonth)return m.jsx(m.Fragment,{});var h=c(n.previousMonth,{locale:i}),f=[o.nav_button,o.nav_button_previous].join(" "),p=d(n.nextMonth,{locale:i}),g=[o.nav_button,o.nav_button_next].join(" "),y=(e=u==null?void 0:u.IconRight)!==null&&e!==void 0?e:Yp,v=(t=u==null?void 0:u.IconLeft)!==null&&t!==void 0?t:Gp;return m.jsxs("div",{className:o.nav,style:a.nav,children:[!n.hidePrevious&&m.jsx(Rr,{name:"previous-month","aria-label":h,className:f,style:a.nav_button_previous,disabled:!n.previousMonth,onClick:n.onPreviousClick,children:s==="rtl"?m.jsx(y,{className:o.nav_icon,style:a.nav_icon}):m.jsx(v,{className:o.nav_icon,style:a.nav_icon})}),!n.hideNext&&m.jsx(Rr,{name:"next-month","aria-label":p,className:g,style:a.nav_button_next,disabled:!n.nextMonth,onClick:n.onNextClick,children:s==="rtl"?m.jsx(v,{className:o.nav_icon,style:a.nav_icon}):m.jsx(y,{className:o.nav_icon,style:a.nav_icon})})]})}function la(n){var e=V().numberOfMonths,t=ir(),r=t.previousMonth,s=t.nextMonth,i=t.goToMonth,o=t.displayMonths,a=o.findIndex(function(p){return lo(n.displayMonth,p)}),l=a===0,c=a===o.length-1,d=e>1&&(l||!c),u=e>1&&(c||!l),h=function(){r&&i(r)},f=function(){s&&i(s)};return m.jsx(Xp,{displayMonth:n.displayMonth,hideNext:d,hidePrevious:u,nextMonth:s,previousMonth:r,onPreviousClick:h,onNextClick:f})}function Qp(n){var e,t=V(),r=t.classNames,s=t.disableNavigation,i=t.styles,o=t.captionLayout,a=t.components,l=(e=a==null?void 0:a.CaptionLabel)!==null&&e!==void 0?e:hc,c;return s?c=m.jsx(l,{id:n.id,displayMonth:n.displayMonth}):o==="dropdown"?c=m.jsx(aa,{displayMonth:n.displayMonth,id:n.id}):o==="dropdown-buttons"?c=m.jsxs(m.Fragment,{children:[m.jsx(aa,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id}),m.jsx(la,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id})]}):c=m.jsxs(m.Fragment,{children:[m.jsx(l,{id:n.id,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),m.jsx(la,{displayMonth:n.displayMonth,id:n.id})]}),m.jsx("div",{className:r.caption,style:i.caption,children:c})}function Zp(n){var e=V(),t=e.footer,r=e.styles,s=e.classNames.tfoot;return t?m.jsx("tfoot",{className:s,style:r.tfoot,children:m.jsx("tr",{children:m.jsx("td",{colSpan:8,children:t})})}):m.jsx(m.Fragment,{})}function em(n,e,t){for(var r=t?io(new Date):Wn(new Date,{locale:n,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=Ce(r,i);s.push(o)}return s}function tm(){var n=V(),e=n.classNames,t=n.styles,r=n.showWeekNumber,s=n.locale,i=n.weekStartsOn,o=n.ISOWeek,a=n.formatters.formatWeekdayName,l=n.labels.labelWeekday,c=em(s,i,o);return m.jsxs("tr",{style:t.head_row,className:e.head_row,children:[r&&m.jsx("td",{style:t.head_cell,className:e.head_cell}),c.map(function(d,u){return m.jsx("th",{scope:"col",className:e.head_cell,style:t.head_cell,"aria-label":l(d,{locale:s}),children:a(d,{locale:s})},u)})]})}function nm(){var n,e=V(),t=e.classNames,r=e.styles,s=e.components,i=(n=s==null?void 0:s.HeadRow)!==null&&n!==void 0?n:tm;return m.jsx("thead",{style:r.head,className:t.head,children:m.jsx(i,{})})}function rm(n){var e=V(),t=e.locale,r=e.formatters.formatDay;return m.jsx(m.Fragment,{children:r(n.date,{locale:t})})}var uo=x.createContext(void 0);function sm(n){if(!rr(n.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return m.jsx(uo.Provider,{value:e,children:n.children})}return m.jsx(im,{initialProps:n.initialProps,children:n.children})}function im(n){var e=n.initialProps,t=n.children,r=e.selected,s=e.min,i=e.max,o=function(c,d,u){var h,f;(h=e.onDayClick)===null||h===void 0||h.call(e,c,d,u);var p=!!(d.selected&&s&&(r==null?void 0:r.length)===s);if(!p){var g=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!g){var y=r?uc([],r):[];if(d.selected){var v=y.findIndex(function(b){return Ne(c,b)});y.splice(v,1)}else y.push(c);(f=e.onSelect)===null||f===void 0||f.call(e,y,c,d,u)}}},a={disabled:[]};r&&a.disabled.push(function(c){var d=i&&r.length>i-1,u=r.some(function(h){return Ne(h,c)});return!!(d&&!u)});var l={selected:r,onDayClick:o,modifiers:a};return m.jsx(uo.Provider,{value:l,children:t})}function fo(){var n=x.useContext(uo);if(!n)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return n}function om(n,e){var t=e||{},r=t.from,s=t.to;return r&&s?Ne(s,n)&&Ne(r,n)?void 0:Ne(s,n)?{from:s,to:void 0}:Ne(r,n)?void 0:Ni(r,n)?{from:n,to:s}:{from:r,to:n}:s?Ni(n,s)?{from:s,to:n}:{from:n,to:s}:r?Gl(n,r)?{from:n,to:r}:{from:r,to:n}:{from:n,to:void 0}}var ho=x.createContext(void 0);function am(n){if(!sr(n.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return m.jsx(ho.Provider,{value:e,children:n.children})}return m.jsx(lm,{initialProps:n.initialProps,children:n.children})}function lm(n){var e=n.initialProps,t=n.children,r=e.selected,s=r||{},i=s.from,o=s.to,a=e.min,l=e.max,c=function(f,p,g){var y,v;(y=e.onDayClick)===null||y===void 0||y.call(e,f,p,g);var b=om(f,r);(v=e.onSelect)===null||v===void 0||v.call(e,b,f,p,g)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],Ne(i,o)||(d.range_middle=[{after:i,before:o}])):d.range_end=[i]):o&&(d.range_start=[o],d.range_end=[o]),a&&(i&&!o&&d.disabled.push({after:Us(i,a-1),before:Ce(i,a-1)}),i&&o&&d.disabled.push({after:i,before:Ce(i,a-1)}),!i&&o&&d.disabled.push({after:Us(o,a-1),before:Ce(o,a-1)})),l){if(i&&!o&&(d.disabled.push({before:Ce(i,-l+1)}),d.disabled.push({after:Ce(i,l-1)})),i&&o){var u=lt(o,i)+1,h=l-u;d.disabled.push({before:Us(i,h)}),d.disabled.push({after:Ce(o,h)})}!i&&o&&(d.disabled.push({before:Ce(o,-l+1)}),d.disabled.push({after:Ce(o,l-1)}))}return m.jsx(ho.Provider,{value:{selected:r,onDayClick:c,modifiers:d},children:t})}function po(){var n=x.useContext(ho);if(!n)throw new Error("useSelectRange must be used within a SelectRangeProvider");return n}function Cr(n){return Array.isArray(n)?uc([],n):n!==void 0?[n]:[]}function cm(n){var e={};
96return Object.entries(n).forEach(function(t){var r=t[0],s=t[1];e[r]=Cr(s)}),e}var Ke;(function(n){n.Outside="outside",n.Disabled="disabled",n.Selected="selected",n.Hidden="hidden",n.Today="today",n.RangeStart="range_start",n.RangeEnd="range_end",n.RangeMiddle="range_middle"})(Ke||(Ke={}));var dm=Ke.Selected,nt=Ke.Disabled,um=Ke.Hidden,fm=Ke.Today,qs=Ke.RangeEnd,Js=Ke.RangeMiddle,Gs=Ke.RangeStart,hm=Ke.Outside;function pm(n,e,t){var r,s=(r={},r[dm]=Cr(n.selected),r[nt]=Cr(n.disabled),r[um]=Cr(n.hidden),r[fm]=[n.today],r[qs]=[],r[Js]=[],r[Gs]=[],r[hm]=[],r);return n.fromDate&&s[nt].push({before:n.fromDate}),n.toDate&&s[nt].push({after:n.toDate}),rr(n)?s[nt]=s[nt].concat(e.modifiers[nt]):sr(n)&&(s[nt]=s[nt].concat(t.modifiers[nt]),s[Gs]=t.modifiers[Gs],s[Js]=t.modifiers[Js],s[qs]=t.modifiers[qs]),s}var gc=x.createContext(void 0);function mm(n){var e=V(),t=fo(),r=po(),s=pm(e,t,r),i=cm(e.modifiers),o=P(P({},s),i);return m.jsx(gc.Provider,{value:o,children:n.children})}function yc(){var n=x.useContext(gc);if(!n)throw new Error("useModifiers must be used within a ModifiersProvider");return n}function gm(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function ym(n){return!!(n&&typeof n=="object"&&"from"in n)}function vm(n){return!!(n&&typeof n=="object"&&"after"in n)}function bm(n){return!!(n&&typeof n=="object"&&"before"in n)}function xm(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function km(n,e){var t,r=e.from,s=e.to;if(r&&s){var i=lt(s,r)<0;i&&(t=[s,r],r=t[0],s=t[1]);var o=lt(n,r)>=0&&lt(s,n)>=0;return o}return s?Ne(s,n):r?Ne(r,n):!1}
96function Sm(n){return $l(n)}function wm(n){return Array.isArray(n)&&n.every($l)}function Cm(n,e){return e.some(function(t){if(typeof t=="boolean")return t;if(Sm(t))return Ne(n,t);if(wm(t))return t.includes(n);if(ym(t))return km(n,t);if(xm(t))return t.dayOfWeek.includes(n.getDay());if(gm(t)){var r=lt(t.before,n),s=lt(t.after,n),i=r>0,o=s<0,a=Ni(t.before,t.after);return a?o&&i:i||o}return vm(t)?lt(n,t.after)>0:bm(t)?lt(t.before,n)>0:typeof t=="function"?t(n):!1})}function mo(n,e,t){var r=Object.keys(e).reduce(function(i,o){var a=e[o];return Cm(n,a)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),t&&!lo(n,t)&&(s.outside=!0),s}function Mm(n,e){for(var t=Te(n[0]),r=oo(n[n.length-1]),s,i,o=t;o<=r;){var a=mo(o,e),l=!a.disabled&&!a.hidden;if(!l){o=Ce(o,1);continue}if(a.selected)return o;a.today&&!i&&(i=o),s||(s=o),o=Ce(o,1)}return i||s}var Nm=365;function vc(n,e){var t=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,a=o===void 0?{count:0,lastFocused:n}:o,l=s.weekStartsOn,c=s.fromDate,d=s.toDate,u=s.locale,h={day:Ce,week:Mi,month:Ue,year:ep,startOfWeek:function(y){return s.ISOWeek?io(y):Wn(y,{locale:u,weekStartsOn:l})},endOfWeek:function(y){return s.ISOWeek?Jl(y):ao(y,{locale:u,weekStartsOn:l})}},f=h[t](n,r==="after"?1:-1);r==="before"&&c?f=tp([c,f]):r==="after"&&d&&(f=np([d,f]));var p=!0;if(i){var g=mo(f,i);p=!g.disabled&&!g.hidden}return p?f:a.count>Nm?a.lastFocused:vc(f,{moveBy:t,direction:r,context:s,modifiers:i,retry:P(P({},a),{count:a.count+1})})}var bc=x.createContext(void 0);function Tm(n){var e=ir(),t=yc(),r=x.useState(),s=r[0],i=r[1],o=x.useState(),a=o[0],l=o[1],c=Mm(e.displayMonths,t),d=s??(a&&e.isDateDisplayed(a))?a:c,u=function(){l(s),i(void 0)},h=function(y){i(y)},f=V(),p=function(y,v){if(s){var b=vc(s,{moveBy:y,direction:v,context:f,modifiers:t});Ne(s,b)||(e.goToDate(b,s),h(b))}},g={focusedDay:s,focusTarget:d,blur:u,focus:h,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return m.jsx(bc.Provider,{value:g,children:n.children})}function go(){var n=x.useContext(bc);if(!n)throw new Error("useFocusContext must be used within a FocusProvider");return n}function Em(n,e){var t=yc(),r=mo(n,t,e);return r}var yo=x.createContext(void 0);function Am(n){if(!Ms(n.initialProps)){var e={selected:void 0};return m.jsx(yo.Provider,{value:e,children:n.children})}return m.jsx(Om,{initialProps:n.initialProps,children:n.children})}function Om(n){var e=n.initialProps,t=n.children,r=function(i,o,a){var l,c,d;if((l=e.onDayClick)===null||l===void 0||l.call(e,i,o,a),o.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,i,o,a);return}(d=e.onSelect)===null||d===void 0||d.call(e,i,i,o,a)},s={selected:e.selected,onDayClick:r};return m.jsx(yo.Provider,{value:s,children:t})}function xc(){var n=x.useContext(yo);if(!n)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return n}function Dm(n,e){var t=V(),r=xc(),s=fo(),i=po(),o=go(),a=o.focusDayAfter,l=o.focusDayBefore,c=o.focusWeekAfter,d=o.focusWeekBefore,u=o.blur,h=o.focus,f=o.focusMonthBefore,p=o.focusMonthAfter,g=o.focusYearBefore,y=o.focusYearAfter,v=o.focusStartOfWeek,b=o.focusEndOfWeek,C=function(O){var R,Q,He,Pt;Ms(t)?(R=r.onDayClick)===null||R===void 0||R.call(r,n,e,O):rr(t)?(Q=s.onDayClick)===null||Q===void 0||Q.call(s,n,e,O):sr(t)?(He=i.onDayClick)===null||He===void 0||He.call(i,n,e,O):(Pt=t.onDayClick)===null||Pt===void 0||Pt.call(t,n,e,O)},M=function(O){var R;h(n),(R=t.onDayFocus)===null||R===void 0||R.call(t,n,e,O)},w=function(O){var R;u(),(R=t.onDayBlur)===null||R===void 0||R.call(t,n,e,O)},E=function(O){var R;(R=t.onDayMouseEnter)===null||R===void 0||R.call(t,n,e,O)},N=function(O){var R;(R=t.onDayMouseLeave)===null||R===void 0||R.call(t,n,e,O)},A=function(O){var R;(R=t.onDayPointerEnter)===null||R===void 0||R.call(t,n,e,O)},_=function(O){var R;(R=t.onDayPointerLeave)===null||R===void 0||R.call(t,n,e,O)},Y=function(O){var R;(R=t.onDayTouchCancel)===null||R===void 0||R.call(t,n,e,O)},Fe=function(O){var R;(R=t.onDayTouchEnd)===null||R===void 0||R.call(t,n,e,O)},Oe=function(O){var R;(R=t.onDayTouchMove)===null||R===void 0||R.call(t,n,e,O)},me=function(O){var R;(R=t.onDayTouchStart)===null||R===void 0||R.call(t,n,e,O)},ce=function(O){var R;(R=t.onDayKeyUp)===null||R===void 0||R.call(t,n,e,O)},re=function(O){var R;switch(O.key){case"ArrowLeft":O.preventDefault(),O.stopPropagation(),t.dir==="rtl"?a():l();break;case"ArrowRight":O.preventDefault(),O.stopPropagation(),t.dir==="rtl"?l(
96):a();break;case"ArrowDown":O.preventDefault(),O.stopPropagation(),c();break;case"ArrowUp":O.preventDefault(),O.stopPropagation(),d();break;case"PageUp":O.preventDefault(),O.stopPropagation(),O.shiftKey?g():f();break;case"PageDown":O.preventDefault(),O.stopPropagation(),O.shiftKey?y():p();break;case"Home":O.preventDefault(),O.stopPropagation(),v();break;case"End":O.preventDefault(),O.stopPropagation(),b();break}(R=t.onDayKeyDown)===null||R===void 0||R.call(t,n,e,O)},qe={onClick:C,onFocus:M,onBlur:w,onKeyDown:re,onKeyUp:ce,onMouseEnter:E,onMouseLeave:N,onPointerEnter:A,onPointerLeave:_,onTouchCancel:Y,onTouchEnd:Fe,onTouchMove:Oe,onTouchStart:me};return qe}function Rm(){var n=V(),e=xc(),t=fo(),r=po(),s=Ms(n)?e.selected:rr(n)?t.selected:sr(n)?r.selected:void 0;return s}function Im(n){return Object.values(Ke).includes(n)}function Pm(n,e){var t=[n.classNames.day];return Object.keys(e).forEach(function(r){var s=n.modifiersClassNames[r];if(s)t.push(s);else if(Im(r)){var i=n.classNames["day_".concat(r)];i&&t.push(i)}}),t}function Lm(n,e){var t=P({},n.styles.day);return Object.keys(e).forEach(function(r){var s;t=P(P({},t),(s=n.modifiersStyles)===null||s===void 0?void 0:s[r])}),t}function jm(n,e,t){var r,s,i,o=V(),a=go(),l=Em(n,e),c=Dm(n,l),d=Rm(),u=!!(o.onDayCl
96ick||o.mode!=="default");x.useEffect(function(){var E;l.outside||a.focusedDay&&u&&Ne(a.focusedDay,n)&&((E=t.current)===null||E===void 0||E.focus())},[a.focusedDay,n,t,u,l.outside]);var h=Pm(o,l).join(" "),f=Lm(o,l),p=!!(l.outside&&!o.showOutsideDays||l.hidden),g=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:rm,y=m.jsx(g,{date:n,displayMonth:e,activeModifiers:l}),v={style:f,className:h,children:y,role:"gridcell"},b=a.focusTarget&&Ne(a.focusTarget,n)&&!l.outside,C=a.focusedDay&&Ne(a.focusedDay,n),M=P(P(P({},v),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=C||b?0:-1,r)),c),w={isButton:u,isHidden:p,activeModifiers:l,selectedDays:d,buttonProps:M,divProps:v};return w}function _m(n){var e=x.useRef(null),t=jm(n.date,n.displayMonth,e);return t.isHidden?m.jsx("div",{role:"gridcell"}):t.isButton?m.jsx(Rr,P({name:"day",ref:e},t.buttonProps)):m.jsx("div",P({},t.divProps))}function zm(n){var e=n.number,t=n.dates,r=V(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,d=c(Number(e),{locale:a});if(!s)return m.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var u=l(Number(e),{locale:a}),h=function(f){s(e,t,f)};return m.jsx(Rr,{name:"week-number","aria-label":u,className:o.weeknumber,style:i.weeknumber,onClick:h,children:d})}function Bm(n){var e,t,r=V(),s=r.styles,i=r.classNames,o=r.showWeekNumber,a=r.components,l=(e=a==null?void 0:a.Day)!==null&&e!==void 0?e:_m,c=(t=a==null?void 0:a.WeekNumber)!==null&&t!==void 0?t:zm,d;return o&&(d=m.jsx("td",{className:i.cell,style:s.cell,children:m.jsx(c,{number:n.weekNumber,dates:n.dates})})),m.jsxs("tr",{className:i.row,style:s.row,children:[d,n.dates.map(function(u){return m.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:m.jsx(l,{displayMonth:n.displayMonth,date:u})},ip(u))})]})}function ca(n,e,t){for(var r=t!=null&&t.ISOWeek?Jl(e):ao(e,t),s=t!=null&&t.ISOWeek?io(n):Wn(n,t),i=lt(r,s),o=[],a=0;a<=i;a++)o.push(Ce(s,a));var l=o.reduce(function(c,d){var u=t!=null&&t.ISOWeek?fh(d):hh(d,t),h=c.find(function(f){return f.weekNumber===u});return h?(h.dates.push(d),c):(c.push({weekNumber:u,dates:[d]}),c)},[]);return l}function Fm(n,e){var t=ca(Te(n),oo(n),e);if(e!=null&&e.useFixedWeeks){var r=ap(n,e);if(r<6){var s=t[t.length-1],i=s.dates[s.dates.length-1],o=Mi(i,6-r),a=ca(Mi(i,1),o,e);t.push.apply(t,a)}}return t}function Hm(n){var e,t,r,s=V(),i=s.locale,o=s.classNames,a=s.styles,l=s.hideHead,c=s.fixedWeeks,d=s.components,u=s.weekStartsOn,h=s.firstWeekContainsDate,f=s.ISOWeek,p=Fm(n.displayMonth,{useFixedWeeks:!!c,ISOWeek:f,locale:i,weekStartsOn:u,firstWeekContainsDate:h}),g=(e=d==null?void 0:d.Head)!==null&&e!==void 0?e:nm,y=(t=d==null?void 0:d.Row)!==null&&t!==void 0?t:Bm,v=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:Zp;return m.jsxs("table",{id:n.id,className:o.table,style:a.table,role:"grid","aria-labelledby":n["aria-labelledby"],children:[!l&&m.jsx(g,{}),m.jsx("tbody",{className:o.tbody,style:a.tbody,children:p.map(function(b){return m.jsx(y,{displayMonth:n.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),m.jsx(v,{displayMonth:n.displayMonth})]})}function $m(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Vm=$m()?x.useLayoutEffect:x.useEffect,Ys=!1,Wm=0;function da(){return"react-day-picker-".concat(++Wm)}function Um(n){var e,t=n??(Ys?da():null),r=x.useState(t),s=r[0],i=r[1];return Vm(function(){s===null&&i(da())},[]),x.useEffect(function(){Ys===!1&&(Ys=!0)},[]),(e=n??s)!==null&&e!==void 0?e:void 0}function Km(n){var e,t,r=V(),s=r.dir,i=r.classNames,o=r.styles,a=r.components,l=ir().displayMonths,c=Um(r.id?"".concat(r.id,"-").concat(n.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(n.displayIndex):void 0,u=[i.month],h=o.month,f=n.displayIndex===0,p=n.displayIndex===l.length-1,g=!f&&!p;s==="rtl"&&(e=[f,p],p=e[0],f=e[1]),f&&(u.push(i.caption_start),h=P(P({},h),o.caption_start)),p&&(u.push(i.caption_end),h=P(P({},h),o.caption_end)),g&&(u.push(i.caption_between),h=P(P({},h),o.caption_between));var y=(t=a==null?void 0:a.Caption)!==null&&t!==void 0?t:Qp;return m.jsxs("div",{className:u.join(" "),style:h,children:[m.jsx(y,{id:c,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),m.jsx(Hm,{id:d,"aria-labelledby":c,displayMonth:n.displayMonth})]},n.displayIndex)}function qm(n){var e=V(),t=e.classNames,r=e.styles;return m.jsx("div",{className:t.months,style:r.months,children:n.children})}function Jm(n){var e,t,r=n.initialProps,s=V(),i=go(),o=ir(),a=x.use
vendor: 7,935 bytes, line 96
96State(!1),l=a[0],c=a[1];x.useEffect(function(){s.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[s.initialFocus,l,i.focus,i.focusTarget,i]);var d=[s.classNames.root,s.className];s.numberOfMonths>1&&d.push(s.classNames.multiple_months),s.showWeekNumber&&d.push(s.classNames.with_weeknumber);var u=P(P({},s.styles.root),s.style),h=Object.keys(r).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var y;return P(P({},p),(y={},y[g]=r[g],y))},{}),f=(t=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&t!==void 0?t:qm;return m.jsx("div",P({className:d.join(" "),style:u,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:m.jsx(f,{children:o.displayMonths.map(function(p,g){return m.jsx(Km,{displayIndex:g,displayMonth:p},g)})})}))}function Gm(n){var e=n.children,t=bp(n,["children"]);return m.jsx(zp,{initialProps:t,children:m.jsx(Jp,{children:m.jsx(Am,{initialProps:t,children:m.jsx(sm,{initialProps:t,children:m.jsx(am,{initialProps:t,children:m.jsx(mm,{children:m.jsx(Tm,{children:e})})})})})})})}function Ym(n){return m.jsx(Gm,P({},n,{children:m.jsx(Jm,{initialProps:n})}))}function kc({className:n,classNames:e,showOutsideDays:t=!0,...r}){return m.jsx(Ym,{showOutsideDays:t,className:xe("p-3",n),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:xe(sa({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:xe(sa({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...s})=>m.jsx(mh,{className:"h-4 w-4"}),IconRight:({...s})=>m.jsx(Of,{className:"h-4 w-4"})},...r})}kc.displayName="Calendar";var Ns="Popover",[Sc,IS]=ro(Ns,[Bl]),or=Bl(),[Xm,Ot]=Sc(Ns),wc=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=or(e),l=x.useRef(null),[c,d]=x.useState(!1),[u,h]=zl({prop:r,defaultProp:s??!1,onChange:i,caller:Ns});return m.jsx(zf,{...a,children:m.jsx(Xm,{scope:e,contentId:Bf(),triggerRef:l,open:u,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(f=>!f),[h]),hasCustomAnchor:c,onCustomAnchorAdd:x.useCallback(()=>d(!0),[]),onCustomAnchorRemove:x.useCallback(()=>d(!1),[]),modal:o,children:t})})};wc.displayName=Ns;var Cc="PopoverAnchor",Qm=x.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Ot(Cc,t),i=or(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return x.useEffect(()=>(o(),()=>a()),[o,a]),m.jsx(Fl,{...i,...r,ref:e})});Qm.displayName=Cc;var Mc="PopoverTrigger",Nc=x.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Ot(Mc,t),i=or(t),o=nr(e,s.triggerRef),a=m.jsx(en.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dc(s.open),...r,ref:o,onClick:St(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:m.jsx(Fl,{asChild:!0,...i,children:a})});Nc.displayName=Mc;var vo="PopoverPortal",[Zm,eg]=Sc(vo,{forceMount:void 0}),Tc=n=>{const{__scopePopover:e,forceMount:t,children:r,container:s}=n,i=Ot(vo,e);return m.jsx(Zm,{scope:e,forceMount:t,children:m.jsx(so,{present:t||i.open,children:m.jsx(Ff,{asChild:!0,container:s,children:r})})})};Tc.displayName=vo;var fn="PopoverContent",Ec=x.forwardRef((n,e)=>{const t=eg(fn,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=Ot(fn,n.__scopePopover);return m.jsx(so,{present:r||i.open,children:i.modal?m.jsx(ng,{...s,ref:e}):m.jsx(rg,{...s,ref:e})})});Ec.displayName=fn;var tg=Hf("PopoverContent.RemoveScroll"),ng=x.forwardRef((n,e)=>{const t=Ot(fn,n.__scopePopover),r=x.useRef(null),s=nr(e,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return Df(o)},[]),m.jsx(Rf,{as:tg,allowPinchZoom:!0,children:m.jsx(Ac,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:St(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:St(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:St(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),rg=x.forwardRef((n,e)=>{const t=Ot(fn,n.__scopePopover),r=x.useRef(!1),s=x.useRef(!1);return m.jsx(Ac,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Ac=x.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=n,h=Ot(fn,t),f=or(t);return If(),m.jsx(Pf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:m.jsx(Lf,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:m.jsx(jf,{"data-state":Dc(h.open),role:"dialog",id:h.contentId,...f,...u,ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Oc="PopoverClose",sg=x.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Ot(Oc,t);return m.jsx(en.button,{type:"button",...r,ref:e,onClick:St(n.onClick,()=>s.onOpenChange(!1))})});sg.displayName=Oc;var ig="PopoverArrow",og=x.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=or(t);return m.jsx(_f,{...s,...r,ref:e})});og.displayName=ig;function Dc(n){return n?"open":"closed"}var ag=wc,lg=Nc,cg=Tc,Rc=Ec;const dg=ag,ug=lg,Ic=x.forwardRef(({className:n,align:e="center",sideOffset:t=4,...r},s)=>m.jsx(cg,{children:m.jsx(Rc,{ref:s,align:e,sideOffset:t,className:xe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
96de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));Ic.displayName=Rc.displayName;const fg=({value:n,onChange:e,className:t})=>{const[r,s]=x.useState(!1),[i,o]=x.useState(!1),[a,l]=x.useState(!1),c=x.useRef(null),{toast:d}=ws(),u=async b=>{if(!b.type.startsWith("image/")){d({title:"Invalid file type",description:"Please upload an image file",variant:"destructive"});return}if(b.size>20*1024*1024){d({title:"File too large",description:"Please upload an image smaller than 20MB",variant:"destructive"});return}o(!0);try{const C=await Ul(b,Kl.featuredImage);o(!1),s(!0);const M=`uploads/${C.filename}`,{error:w}=await ye.storage.from("blog-images").upload(M,C.blob);if(w){d({title:"Upload failed",description:w.message,variant:"destructive"}),s(!1);return}const{data:{publicUrl:E}}=ye.storage.from("blog-images").getPublicUrl(M);e(E),s(!1),C.savings>0?d({title:"Image optimized & uploaded",description:`${Dr(C.originalSize)} → ${Dr(C.optimizedSize)} (${C.savings}% smaller)`}):d({title:"Image uploaded successfully"})}catch{o(!1),s(!1),d({title:"Optimization failed",description:"Could not process image",variant:"destructive"})}},h=b=>{var M;const C=(M=b.target.files)==null?void 0:M[0];C&&u(C)},f=b=>{var M;b.preventDefault(),l(!1);const C=(M=b.dataTransfer.files)==null?void 0:M[0];C&&u(C)},p=b=>{b.preventDefault(),l(!0)},g=()=>{l(!1)},y=()=>{e(null)},v=r||i;return m.jsxs("div",{className:t,children:[m.jsx("input",{type:"file",ref:c,onChange:h,accept:"image/*",className:"hidden"}),n?m.jsxs("div",{className:"relative group",children:[m.jsx("img",{src:n,alt:"Featured image",className:"w-full h-48 object-cover rounded-lg border border-border"}),m.jsx(De,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:y,children:m.jsx(Hl,{className:"h-4 w-4"})})]}):m.jsx("div",{className:xe("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors",a?"border-accent bg-accent/10":"border-border hover:border-accent/50",v&&"pointer-events-none opacity-50"),onClick:()=>{var b;return(b=c.current)==null?void 0:b.click()},onDrop:f,onDragOver:p,onDragLeave:g,children:i?m.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m.jsx(Dn,{className:"h-8 w-8 animate-spin text-muted-foreground"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Optimizing image..."})]}):r?m.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m.jsx(Dn,{className:"h-8 w-8 animate-spin text-muted-foreground"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}):m.jsxs("div",{className:"flex flex-col items-center gap-2",children:[m.jsx(Vl,{className:"h-8 w-8 text-muted-foreground"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload or drag and drop"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG, GIF up to 20MB"})]})}),m.jsxs("div",{className:"mt-3 flex items-start gap-2 text-xs text-muted-foreground bg-muted/50 rounded-md p-2",children:[m.jsx(Wl,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),m.jsx("p",{children:"Images are automatically optimized to WebP format and resized to 1200×675px (16:9) for fast loading."})]})]})},hg=n=>n.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim(),ua=["#d2397f","#2badc7","#6b7280","#10b981","#f59e0b","#8b5cf6","#ef4444","#06b6d4"],pg=({postId:n,selectedLabels:e,onLabelsChange:t})=>{const[r,s]=x.useState([]),[i,o]=x.useState(""),[a,l]=x.useState(!1),[c,d]=x.useState(!1),{toast:u}=ws();x.useEffect(()=>{h()},[]);const h=async()=>{const{data:v,error:b}=await ye.from("blog_labels").select("*").order("name");!b&&v&&s(v)},f=async()=>{if(!i.trim())return;l(!0);const v=hg(i),b=ua[Math.floor(Math.random()*ua.length)],{data:C,error:M}=await ye.from("blog_labels").insert({name:i.trim(),slug:v,color:b}).select().single();if(l(!1),M){M.message.includes("duplicate")?u({title:"Label already exists",variant:"destructive"}):u({title:"Error creating label",description:M.message,variant:"destructive"});return}C&&(s([...r,C]),t([...e,C]),o(""),u({title:"Label created"}))},p=v=>{e.find(b=>b.id===v.id)||t([...e,v]),d(!1)},g=v=>{t(e.filter(b=>b.id!==v))},y=r.filter(v=>!e.find(b=>b.id===v.id));return m.jsxs("div",{className:"space-y-3",children:[m.jsxs(ue,{className:"text-lg flex items-center gap-2",children:[m.jsx(gh,{className:"h-4 w-4"}),"Labels"]}),m.jsxs("div",{className:"flex flex-wrap gap-2 min-h-[32px]",children:[e.map(v=>m.jsxs(yh,{variant:"secondary",className:"flex items-center gap-1 pr-1",style:{backgroundColor:`${v.color}20`,borderColor:v.color},children:[m.jsx("span",{style:{color:v.color},children:v.name}),m.jsx("button",{onClick:()=>g(v.id),className:"ml-1 rounded-full p-0.5 hover:bg-muted transition-colors",children:m.jsx(Hl,{className:"h-3 w-3"})})]},v.id)),e.length===0&&m.jsx("span",{className:"text-sm text-muted-foreground",children:"No labels selected"})]}),m.jsxs("div",{className:"relative",children:[m.jsxs(De,{type:"button",variant:"outline",size:"sm",onClick:()=>d(!c),className:"w-full justify-start",children:[m.jsx(vh,{className:"h-4 w-4 mr-2"}),"Add Label"]}),c&&m.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg max-h-[200px] overflow-y-auto",children:[y.length>0?m.jsx("div",{className:"p-1",children:y.map(v=>m.jsxs("button",{onClick:()=>p(v),className:"w-full text-left px-3 py-2 text-sm rounded hover:bg-muted transition-colors flex items-center gap-2",children:[m.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:v.color}}),v.name]},v.id))}):m.jsx("div",{className:"p-3 text-sm text-muted-foreground",children:"No more labels available"}),m.jsx("div",{className:"border-t border-border p-2",children:m.jsxs("div",{className:"flex gap-2",children:[m.jsx(Mn,{placeholder:"New label name...",value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())},className:"h-8 text-sm"}),m.jsx(De,{type:"button",size:"sm",onClick:f,disabled:a||!i.trim(),className:"h-8",children:a?"...":"Create"})]})})]})]})]})};var Pc={exports:{}},Lc={};/**
97 * @license React
98 * use-sync-external-store-shim.production.js
99 *
100 * Copyright (c) Meta Platforms, Inc. and affiliates.
101 *
102 * This source code is licensed under the MIT license found in the
103 * LICENSE file in the root directory of this source tree.
104 */var hn=x;function mg(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var gg=typeof Object.is=="function"?Object.is:mg,yg=hn.useState,vg=hn.useEffect,bg=hn.useLayoutEffect,xg=hn.useDebugValue;function kg(n,e){var t=e(),r=yg({inst:{value:t,getSnapshot:e}}),s=r[0].inst,i=r[1];return bg(function(){s.value=t,s.getSnapshot=e,Xs(s)&&i({inst:s})},[n,t,e]),vg(function(){return Xs(s)&&i({inst:s}),n(function(){Xs(s)&&i({inst:s})})},[n]),xg(t),t}function Xs(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!gg(n,t)}catch{return!0}}function Sg(n,e){return e()}var wg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Sg:kg;Lc.useSyncExternalStore=hn.useSyncExternalStore!==void 0?hn.useSyncExternalStore:wg;Pc.exports=Lc;var bo=Pc.exports;function fe(n){this.content=n}fe.prototype={constructor:fe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new fe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new fe(t)},addToStart:function(n,e){return new fe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new fe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new fe(s)}
vendor: 31,872 bytes, lines 104-105
104,forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=fe.from(n),n.size?new fe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=fe.from(n),n.size?new fe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=fe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};fe.from=function(n){if(n instanceof fe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new fe(e)};function jc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=jc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function _c(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=_c(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;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 d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,s+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-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 t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=l}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return jc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return _c(this,e,t,r)}findIndex(e){if(e==0)return fr(0,e);if(e==this.size)return fr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?fr(t+1,i):fr(t,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,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,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)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Qs={index:0,offset:0};function fr(n,e){return Qs.index=n,Qs.offset=e,Qs}function Ir(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Ir(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ir(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let $=class Ti{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,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))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ir(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ti.none;if(e instanceof Ti)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};$.none=[];class Pr extends Error{}class T{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Bc(this.content,e+this.openStart,t);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(zc(this.content,e+this.openStart,t+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,t){if(!t)return T.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new T(e,r,s)}}T.empty=new T(k.empty,0,0);function zc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(zc(i.content,e-s-1,t-s-1)))}function Bc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Bc(o.content,e-i-1,t,o);return a&&n.replaceChild(s,o.copy(a))}function Cg(n,e,t){if(t.openStart>n.depth)throw new Pr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Pr("Inconsistent open depths");return Fc(n,e,t,0)}function Fc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Fc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Wt(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Mg(t,n);return Wt(i,$c(n,o,a,e,r))}else return Wt(i,Lr(n,e,r))}function Hc(n,e){if(!e.type.compatibleContent(n.type))throw new Pr("Cannot join "+e.type.name+" onto "+n.type.name)}function Ei(n,e,t){let r=n.node(t);return Hc(r,e.node(t)),r}function Vt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Rn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Vt(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Vt(s.child(a),r);e&&e.depth==t&&e.textOffset&&Vt(e.nodeBefore,r)}function Wt(n,e){return n.type.checkContent(e),n.copy(e)}function $c(n,e,t,r,s){let i=n.depth>s&&Ei(n,e,s+1),o=r.depth>s&&Ei(t,r,s+1),a=[];return Rn(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(Hc(i,o),Vt(Wt(i,$c(n,e,t,r,s+1)),a)):(i&&Vt(Wt(i,Lr(n,e,s+1)),a),Rn(e,t,s,a),o&&Vt(Wt(o,Lr(t,r,s+1)),a)),Rn(r,null,s,a),new k(a)}function Lr(n,e,t){let r=[];if(Rn(null,n,t,r),n.depth>t){let s=Ei(n,e,t+1);Vt(Wt(s,Lr(n,e,t+1)),r)}return Rn(e,null,t,r),new k(r)}function Mg(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return $.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);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 t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.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 t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new jr(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;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 Kn(t,r,i)}static resolveCached(e,t){let r=fa.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else fa.set(e,r=new Ng);let s=r.elts[r.i]=Kn.resolve(e,t);return r.i=(r.i+1)%Tg,s}}class Ng{constructor(){this.elts=[],this.i=0}}const Tg=12,fa=new WeakMap;class jr{constructor(e,t,r){this.$from=e,this.$to=t,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 Eg=Object.create(null);class We{constructor(e,t,r,s=$.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.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,t,r,s=0){this.content.nodesBetween(e,t,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,t,r,s){return this.content.textBetween(e,t,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,t,r){return this.type==e&&Ir(this.attrs,t||e.defaultAttrs||Eg)&&$.sameSet(this.marks,r||$.none)}copy(e=null){return e==this.content?this:new We(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new We(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return T.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new T(c,s.depth-o,i.depth-o)}replace(e,t,r){return Cg(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Kn.resolveCached(this,e)}resolveNoCache(e){return Kn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,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()+")"),Vc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);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,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);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=$.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}We.prototype.text=void 0;class _r extends We{constructor(e,t,r,s){if(super(e,t,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):Vc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new _r(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _r(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Vc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ag(e,t);if(r.next==null)return Gt.empty;let s=Wc(r);r.next&&r.err("Unexpected trailing text");let i=jg(Lg(s));return _g(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return k.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let h=i(u,a.concat(d));if(h)return h}}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 t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=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 t)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(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(`
105`)}}Gt.empty=new Gt(!0);class Ag{constructor(e,t){this.string=e,this.nodeTypes=t,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 Wc(n){let e=[];do e.push(Og(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Og(n){let e=[];do e.push(Dg(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Dg(n){let e=Pg(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Rg(n,e);else break;return e}function ha(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Rg(n,e){let t=ha(n),r=t;return n.eat(",")&&(n.next!="}"?r=ha(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ig(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Pg(n){if(n.eat("(")){let e=Wc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ig(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Lg(n){let e=[[]];return s(i(n,0),t()),e;function t(){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=t())}else if(o.type=="star"){let l=t();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();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 d=t();s(i(o.expr,l),d),l=d}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),s(i(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Uc(n,e){return e-n}function pa(n,e){let t=[];return r(e),t.sort(Uc);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&t.indexOf(l)==-1&&r(l)}}}function jg(n){let e=Object.create(null);return t(pa(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<s.length;d++)s[d][0]==a&&(c=s[d][1]);pa(n,l).forEach(d=>{c||s.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new Gt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Uc);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function _g(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],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 Kc(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qc(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Jc(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function Gc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Bg(n,r,e[r]);return t}let ma=class Yc{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Gc(e,r.attrs),this.defaultAttrs=Kc(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==Gt.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:qc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new We(this,this.computeAttrs(e),k.from(t),$.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new We(this,this.computeAttrs(e),t,$.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(k.empty,!0);return i?new We(this,e,t.append(i),$.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Jc(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:$.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Yc(i,t,o));let s=t.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 zg(n,e,t){let r=t.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 ${n}, got ${i}`)}}class Bg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?zg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ts{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Gc(e,s.attrs),this.excluded=null;let i=Kc(this.attrs);this.instance=i?new $(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $(this,qc(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ts(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Jc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=fe.from(e.nodes),t.marks=fe.from(e.marks||{}),this.nodes=ma.compile(this.spec.nodes,this),this.marks=Ts.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]=Gt.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?ga(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==""?[]:ga(this,o.split(" "))}this.nodeFromJSON=s=>We.fromJSON(this,s),this.markFromJSON=s=>$.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ma){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(t,r,s)}text(e,t){let r=this.nodes.text;return new _r(r,r.defaultAttrs,e,$.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ga(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let a in n.marks){let l=n.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Fg(n){return n.tag!=null}function Hg(n){return n.style!=null}class wt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Fg(s))this.tags.push(s);else if(Hg(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,t={}){let r=new va(this,t,!1);return r.addAll(e,$.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new va(this,t,!0);return r.addAll(e,$.none,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Wg(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs
vendor: 5,541 bytes, lines 105-107
105){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,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)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ba(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=ba(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wt(e,wt.schemaRules(e)))}}const Qc={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},$g={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zc={ol:!0,ul:!0},qn=1,Ai=2,In=4;function ya(n,e,t){return e!=null?(e?qn:0)|(e==="full"?Ai:0):n&&n.whitespace=="pre"?qn|Ai:t&~In}class hr{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=$.none,this.match=i||(o&In?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&qn)){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 t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Qc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class va{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=ya(null,t.preserveWhitespace,0)|(r?In:0);s?i=new hr(s.type,s.attrs,$.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new hr(null,null,$.none,!0,null,o):i=new hr(e.schema.topNodeType,null,$.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Ai?"full":this.localPreserveWS||(s.options&qn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
106`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,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;Zc.hasOwnProperty(o)&&this.parser.normalizeLists&&Vg(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:$g.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Qc.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,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
107`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){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?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,s){let i,o;
vendor: 4,117 bytes, line 107
107if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,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,t);this.findAtPoint(e,i)}findPlace(e,t,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++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=$.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):xa(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=ya(e,i,o.options);o.options&In&&o.content.length==0&&(a|=In);let l=$.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):xa(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new hr(e,t,l,s,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=qn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=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=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];
vendor: 10,998 bytes, line 107
107if(r.isTextblock&&r.defaultAttrs)return r}}}function Vg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Zc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Wg(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ba(n){let e={};for(let t in n)e[t]=n[t];return e}function xa(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class tn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Zs(t).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++],d=this.serializeMark(c,o.isInline,t);d&&(i.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Mr(Zs(t),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,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Mr(Zs(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Mr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ka(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ka(e.marks)}}function ka(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Zs(n){return n.document||window.document}const Sa=new WeakMap;function Ug(n){let e=Sa.get(n);return e===void 0&&Sa.set(n,e=Kg(n)),e}function Kg(n){let e=null;function t(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++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Mr(n,e,t,r){if(typeof e=="string")return{dom:n.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=Ug(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&&(t=s.slice(0,o),s=s.slice(o+1));let a,l=t?n.createElementNS(t,s):n.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=Mr(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const ed=65535,td=Math.pow(2,16);function qg(n,e){return n+e*td}function wa(n){return n&ed}function Jg(n){return(n-(n&ed))/td}const nd=1,rd=2,Nr=4,sd=8;class Oi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&sd)>0}get deletedBefore(){return(this.delInfo&(nd|Nr))>0}get deletedAfter(){return(this.delInfo&(rd|Nr))>0}get deletedAcross(){return(this.delInfo&Nr)>0}}class Re{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Re.empty)return Re.empty}recover(e){let t=0,r=wa(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Jg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,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],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+s+(h<0?0:d);if(r)return f;let p=e==(t<0?l:u)?null:qg(a/3,e-l),g=e==l?rd:e==u?nd:Nr;return(t<0?e!=l:e!=u)&&(g|=sd),new Oi(f,g,p)}s+=d-c}return r?e+s:new Oi(e+s,0,null)}touches(e,t){let r=0,s=wa(t),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],d=l+c;if(e<=d&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=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+t],d=this.ranges[s+r];e(a,a+c,l,l+d),i+=d-c}}invert(){return new Re(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Re.empty:new Re(e<0?[0,-e,0]:[0,0,e])}}Re.empty=new Re([]);class Jn{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Jn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Jn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,t);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 Oi(e,s,null)}}const ei=Object.create(null);class be{getMap(){return Re.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ei[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ei)throw new RangeError("Duplicate use of step JSON ID "+e);return ei[e]=t,t.prototype.jsonID=e,t}}class Z{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Z(e,null)}static fail(e){return new Z(null,e)}static fromReplace(e,t,r,s){try{return Z.ok(e.replace(t,r,s))}catch(i){if(i instanceof Pr)return Z.fail(i.message);throw i}}}function xo(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(xo(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class bt extends be{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new T(xo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return Z.fromReplace(e,this.from,this.to,i)}invert(){return new Ve(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new bt(t.pos,r.pos,this.mark)}merge(e){return e instanceof bt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bt(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new bt(t.from,t.to,e.markFromJSON(t.mark))}}be.jsonID("addMark",bt);class Ve extends be{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new T(xo(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Z.fromReplace(e,this.from,this.to,r)}invert(){return new bt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ve(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ve&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ve(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ve(t.from,t.to,e.markFromJSON(t.mark))}}be.jsonID("removeMark",Ve);class xt extends be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Z.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Z.fromReplace(e,this.pos,this.pos+1,new T(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new xt(this.pos,t.marks[s]);return new xt(this.pos,this.mark)}}return new Yt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xt(t.pos,e.markFromJSON(t.mark))}}be.jsonID("addNodeMark",xt);class Yt extends be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Z.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Z.fromReplace(e,this.pos,this.pos+1,new T(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yt(t.pos,this.mark)}
vendor: 4,227 bytes, line 107
107toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yt(t.pos,e.markFromJSON(t.mark))}}be.jsonID("removeNodeMark",Yt);class ie extends be{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Di(e,this.from,this.to)?Z.fail("Structure replace would overwrite content"):Z.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Re([this.from,this.to-this.from,this.slice.size])}invert(e){return new ie(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new ie(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ie)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ie(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ie(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ie(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}be.jsonID("replace",ie);class ae extends be{constructor(e,t,r,s,i,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Di(e,this.from,this.gapFrom)||Di(e,this.gapTo,this.to)))return Z.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Z.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Z.fromReplace(e,this.from,this.to,r):Z.fail("Content does not fit in gap")}getMap(){return new Re([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ae(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new ae(t.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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ae(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}be.jsonID("replaceAround",ae);function Di(n,e,t){let r=n.resolve(e),s=t-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 Gg(n,e,t,r){let s=[],i=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[g])?o.to=f:s.push(o=new Ve(h,f,u[g])));a&&a.to==h?a.to=f:i.push(a=new bt(h,f,r))}}
vendor: 7,284 bytes, lines 107-108
107),s.forEach(l=>n.step(l)),i.forEach(l=>n.step(l))}function Yg(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof Ts){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&u.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:u,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ve(o.from,o.to,o.style)))}function ko(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new ie(a,d,T.empty));else{r=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Ve(a,d,c.marks[h]));if(s&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new T(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new ie(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(k.empty,!0);n.replace(a,a,new T(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function Xg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function kn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+s,l=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!Xg(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function Qg(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,d=k.empty,u=0;for(let p=i,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,d=k.from(r.node(p).copy(d)),u++):l--;let h=k.empty,f=0;for(let p=i,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,h=k.from(s.node(p).copy(h)),f++):c++;n.step(new ae(l,c,o,a,new T(d.append(h),u,f),d.size-u,!0))}function So(n,e,t=null,r=n){let s=Zg(n,e),i=s&&ey(r,e);return i?s.map(Ca).concat({type:e,attrs:t}).concat(i.map(Ca)):null}function Ca(n){return{type:n,attrs:null}}function Zg(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function ey(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.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(t.child(c).type);return!l||!l.validEnd?null:o}function ty(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[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=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new ae(s,i,s,i,new T(r,0,0),t.length,!0))}function ny(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&ry(n.doc,n.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&od(n,o,a,i),ko(n,n.mapping.slice(i).map(a,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new ae(u,h,u+1,h-1,new T(k.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&id(n,o,a,i),!1}})}function id(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function od(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
108`))}})}function ry(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function sy(n,e,t,r,s){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let o=t.create(r,null,s||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ae(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new T(k.from(o),0,0),1,!0))}function cn(n,e,t=1,r){let s=n.resolve(e),i=s.depth-t,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,d=t-2;c>i;c--,d--){let u=s.node(c),h=s.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!g.type.validContent(f))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 iy(n,e,t=1,r){let s=n.doc.resolve(e),i=k.empty,o=k.empty;for(let a=s.depth,l=s.depth-t,c=t-1;a>l;a--,c--){i=k.from(s.node(a).copy(i));let d=r&&r[c];o=k.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}n.step(new ie(e,e,new T(i.append(o),t,t),!0))}function Dt(n,e){let t=n.resolve(e),r=t.index();return ad(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function oy(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function ad(n,e){return!!(n&&e&&!n.isLeaf&&oy(n,e))}function Es(n,e,t=-1){let r=n.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):t>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&&ad(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function ay(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,i=n.doc.resolve(e-t),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(s);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);od(n,d.node(),d.before(),a)}o.inlineContent&&ko(n,e+t-1,o,i.node().contentMatchAt(i.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new ie(c,l.map(e+t,-1),T.empty,!0)),r===!0){let d=n.doc.resolve(c);id(n,d.node(),d.before(),n.steps.length)}return n}function ly(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))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,t))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,t))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function ld(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;
vendor: 5,514 bytes, line 108
108i<=(t.openStart==0&&t.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),d=!1;if(i==1)d=c.canReplace(l,l,s);else{let u=c.contentMatchAt(l).findWrapping(s.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function As(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return cd(s,i,r)?new ie(e,t,r):new cy(s,i,r).fit()}function cd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class cy{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=k.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=k.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(),t=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 T(i,o,a);return e>-1?new ae(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new ie(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=ti(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],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(k.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=ti(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new T(e,t+1,Math.max(r,s.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=ti(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new T(Nn(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new T(Nn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(s){for(let g=0;g<s.childCount;g++)d.push(s.child(g));u=u.matchFragment(s)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||l==0||g.content.size)&&(u=y,d.push(dd(g.mark(h.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=Tn(this.placed,t,k.from(d)),this.frontier[t].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<f;g++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=p?e==0?T.empty:new T(Nn(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new T(Nn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ni(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.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 t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ni(e,t,s,r,i);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=ni(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Tn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.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,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Tn(this.placed,this.depth,k.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(k.empty,!0);t.childCount&&(this.placed=Tn(this.placed,this.frontier.length,t))}}function Nn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Nn(n.firstChild.content,e-1,t)))}function Tn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Tn(n.lastChild.content,e-1,t)))}function ti(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function dd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,dd(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.t
vendor: 4,228 bytes, line 108
108ype.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),n.copy(r)}function ni(n,e,t,r,s){let i=n.node(e),o=s?n.indexAfter(e):n.index(e);if(o==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!dy(t,i.content,o)?a:null}function dy(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function uy(n){return n.spec.defining||n.spec.definingForContent}function fy(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(cd(s,i,r))return n.step(new ie(e,t,r));let o=fd(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let p=s.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=uy(f.type);if(p&&!f.sameMarkup(s.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let g=0;g<o.length;g++){let y=o[(g+l)%o.length],v=!0;y<0&&(v=!1,y=-y);let b=s.node(y-1),C=s.index(y-1);if(b.canReplaceWith(C,C,p.type,p.marks))return n.replace(s.before(y),v?i.after(y):t,new T(ud(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let f=o[h];f<0||(e=s.before(f),t=i.after(f))}}function ud(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(ud(i.content,e+1,t,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(n).append(n);n=o.append(i.matchFragment(o).fillBefore(k.empty,!0))}return n}function hy(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=ly(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new T(k.from(r),0,0))}function py(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),i=fd(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 n.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 n.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&&t>r.end(o)&&s.end(o)-t!=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 n.delete(r.before(o),t);n.delete(e,t)}function fd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class dn extends be{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Z.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return Z.fromReplace(e,this.pos,this.pos+1,new T(k.from(s),0,t.isLeaf?0:1))}getMap(){return Re.empty}invert(e){return new dn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new dn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new dn(t.pos,t.attr,t.value)}}be.jsonID("attr",dn);class Gn extends be{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Z.ok(r)}getMap(){return Re.empty}invert(e){return new Gn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gn(t.attr,t.value)}}be.jsonID("docAttr",Gn);
vendor: 3,245 bytes, line 108
108let pn=class extends Error{};pn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};pn.prototype=Object.create(Error.prototype);pn.prototype.constructor=pn;pn.prototype.name="TransformError";class hd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Jn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new pn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=T.empty){let s=As(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new T(k.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return fy(this,e,t,r),this}replaceRangeWith(e,t,r){return hy(this,e,t,r),this}deleteRange(e,t){return py(this,e,t),this}lift(e,t){return Qg(this,e,t),this}join(e,t=1){return ay(this,e,t),this}wrap(e,t){return ty(this,e,t),this}setBlockType(e,t=e,r,s=null){return ny(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return sy(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new dn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Gn(e,t)),this}addNodeMark(e,t){return this.step(new xt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof $)t.isInSet(r.marks)&&this.step(new Yt(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new Yt(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return iy(this,e,t,r),this}addMark(e,t,r){return Gg(this,e,t,r),this}removeMark(e,t,r){return Yg(this,e,t,r),this}clearIncompatible(e,t,r){return ko(this,e,t,r),this}}const ri=Object.create(null);class B{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new my(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let r=t.content.lastChild,s=null;for(let a=0;a<t.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],d=e.mapping.slice(i);e.replaceRange(d.map(l.pos),d.map(c.pos),a?T.empty:t),a==0&&Ta(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){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),d=l.map(a.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Ta(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new L(e):sn(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?sn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):sn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}
vendor: 7,474 bytes, line 108
108static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new _e(e.node(0))}static atStart(e){return sn(e,e,0,0,1)||new _e(e)}static atEnd(e){return sn(e,e,e.content.size,e.childCount,-1)||new _e(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ri[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ri)throw new RangeError("Duplicate use of selection JSON ID "+e);return ri[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class my{constructor(e,t){this.$from=e,this.$to=t}}let Ma=!1;function Na(n){!Ma&&!n.parent.inlineContent&&(Ma=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class L extends B{constructor(e,t=e){Na(e),Na(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return B.near(r);let s=e.resolve(t.map(this.anchor));return new L(s.parent.inlineContent?s:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof L&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Os(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new L(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=B.findFrom(t,r,!0)||B.findFrom(t,-r,!0);if(i)t=i.$head;else return B.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new L(e,t)}}B.jsonID("text",L);class Os{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Os(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class I extends B{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?B.near(i):new I(i)}content(){return new T(k.from(this.node),0,0)}eq(e){return e instanceof I&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new wo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new I(e.resolve(t.anchor))}static create(e,t){return new I(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}I.prototype.visible=!1;B.jsonID("node",I);class wo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Os(r,r):new wo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&I.isSelectable(r)?new I(t):B.near(t)}}class _e extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new _e(e)}map(e){return new _e(e)}eq(e){return e instanceof _e}getBookmark(){return gy}}B.jsonID("all",_e);const gy={map(){return this},resolve(n){return new _e(n)}};function sn(n,e,t,r,s,i=!1){if(e.inlineContent)return L.create(n,t);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&&I.isSelectable(a))return I.create(n,t-(s<0?a.nodeSize:0))}else{let l=sn(n,a,t+s,s<0?a.childCount:0,s,i);if(l)return l}t+=a.nodeSize*s}return null}function Ta(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof ie||s instanceof ae))return;let i=n.mapping.maps[r],o;i.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(B.near(n.doc.resolve(o),t))}const Ea=1,pr=2,Aa=4;class yy extends hd{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|Ea)&~pr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ea)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=pr,this}ensureMarks(e){return $.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&pr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~pr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=Aa,this}get scrolledIntoView(){return(this.updated&Aa)>0}}function Oa(n,e){return!e||!n?n:n.bind(e)}class En{constructor(e,t,r){this.name=e,this.init=Oa(t.init,r),this.apply=Oa(t.apply,r)}}const vy=[new En("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new En("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new En("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new En("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class si{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=vy.slice(),t&&t.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 En(r.key,r.spec.state,r))})}}class ln{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 11,572 bytes, lines 108-109
108apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){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 t=[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,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let u=0;u<this.config.plugins.length;u++)s.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ln(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new yy(this)}static create(e){let t=new si(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ln(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new si(this.schema,e.plugins),r=t.fields,s=new ln(t);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 t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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&&(t[r]=i.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new si(e.schema,e.plugins),i=new ln(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=We.fromJSON(e.schema,t.doc);else if(o.name=="selection")i.selection=B.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.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(t,a)){i[o.name]=c.fromJSON.call(l,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function pd(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=pd(s,e,{})),t[r]=s}return t}class K{constructor(e){this.spec=e,this.props={},e.props&&pd(e.props,this,this.props),this.key=e.key?e.key.key:md("plugin")}getState(e){return e[this.key]}}const ii=Object.create(null);function md(n){return n in ii?n+"$"+ ++ii[n]:(ii[n]=0,n+"$")}class ne{constructor(e="key"){this.key=md(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const by=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function gd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const xy=(n,e,t)=>{let r=gd(n,t);if(!r)return!1;let s=Co(r);if(!s){let o=r.blockRange(),a=o&&kn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(xd(n,s,e,-1))return!0;if(r.parent.content.size==0&&(mn(i,"end")||I.isSelectable(i)))for(let o=r.depth;;o--){let a=As(n.doc,r.before(o),r.after(o),T.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(mn(i,"end")?B.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):I.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(n.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},ky=(n,e,t)=>{let r=gd(n,t);if(!r)return!1;let s=Co(r);return s?yd(n,s,e):!1},Sy=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let s=Mo(r);return s?yd(n,s,e):!1};function yd(n,e,t){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=As(n.doc,i,l,T.empty);if(!c||c.from!=i||c instanceof ie&&c.slice.size>=l-i)return!1;if(t){let d=n.tr.step(c);d.setSelection(L.create(d.doc,i)),t(d.scrollIntoView())}return!0}function mn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const wy=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Co(r)}let o=i&&i.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Co(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function vd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Cy=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let s=Mo(r);if(!s)return!1;let i=s.nodeAfter;if(xd(n,s,e,1))return!0;if(r.parent.content.size==0&&(mn(i,"start")||I.isSelectable(i))){let o=As(n.doc,r.before(),r.after(),T.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(mn(i,"start")?B.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):I.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},My=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=Mo(r)}let o=i&&i.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(n.tr.setSelection(I.create(n.doc,i.pos)).scrollIntoView()),!0)};function Mo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Ny=(n,e)=>{let t=n.selection,r=t instanceof I,s;if(r){if(t.node.isTextblock||!Dt(n.doc,t.from))return!1;s=t.from}else if(s=Es(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(I.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Ty=(n,e)=>{let t=n.selection,r;if(t instanceof I){if(t.node.isTextblock||!Dt(n.doc,t.to))return!1;r=t.to}else if(r=Es(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Ey=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&kn(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},Ay=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
109`).scrollIntoView()),!0)};function bd(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Oy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),i=t.indexAfter(-1),o=bd(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(B.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Dy=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof _e||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=bd(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=n.tr.insert(o,i.createAndFill());a.setSelection(L.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Ry=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(cn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&kn(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)},Iy=(n,e)=>{let{$from:t,to:r}=n.selection,s,i=t.sharedDepth(r);return i==0?!1:(s=t.before(i),e&&e(n.tr.setSelection(I.create(n.doc,s))),!0)};function Py(n,e,t){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)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Dt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function xd(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&Py(n,e,t))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(t){let f=e.pos+i.nodeSize,p=k.empty;for(let v=o.length-1;v>=0;v--)p=k.from(o[v].create(null,p));p=k.from(s.copy(p));let g=n.tr.step(new ae(e.pos-1,f,e.pos,f,new T(p,1,0),o.length,!0)),y=g.doc.resolve(f+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&Dt(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:B.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&kn(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&mn(i,"start",!0)&&mn(s,"end")){let f=s,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(t){let v=k.empty;for(let C=p.length-1;C>=0;C--)v=k.from(p[C].copy(v));let b=n.tr.step(new ae(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new T(v,p.length,0),0,!0));t(b.scrollIntoView())}return!0}}return!1}function kd(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(t&&t(e.tr.setSelection(L.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const Ly=kd(-1),jy=kd(1);function _y(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&So(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Da(n,e=null){return function(t,r){let s=!1;for(let i=0;i<t.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[i];t.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)s=!0;else{let d=t.doc.resolve(c),u=d.index();s=d.parent.canReplaceWith(u,u+1,n)}})}if(!s)return!1;if(r){let i=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];i.setBlockType(a,l,n,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function zy(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i);if(!o)return!1;let a=r?t.tr:null;return By(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function By(n,e,t,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new jr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new jr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=So(i,t,r,e);return a?(n&&Fy(n,e,a,s,t),!0):!1}function Fy(n,e,t,r,s){let i=k.empty;for(let d=t.length-1;d>=0;
vendor: 4,081 bytes, line 109
109d--)i=k.from(t[d].type.create(t[d].attrs,i));n.step(new ae(e.start-(r?2:0),e.end,e.start,e.end,new T(i,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==s&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&cn(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function Hy(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?$y(e,t,n,i):Vy(e,t,i):!0:!1}}function $y(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new ae(i-1,o,i,o,new T(k.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new jr(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=kn(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 Vy(n,e,t){let r=n.tr,s=t.parent;for(let f=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)f-=s.child(p).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(t.start),o=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==s.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?k.empty:k.from(s))))return!1;let u=i.pos,h=u+o.nodeSize;return r.step(new ae(u-(a?1:0),h+(l?1:0),u+1,h-1,new T((a?k.empty:k.from(s.copy(k.empty))).append(l?k.empty:k.from(s.copy(k.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Wy(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==n);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!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=k.from(c?n.create():null),u=new T(k.from(n.create(null,k.from(a.type.create(null,d)))),c?3:1,0),h=i.start,f=i.end;t(e.tr.step(new ae(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const he=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},gn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ri=null;const at=function(n,e,t){let r=Ri||(Ri=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Uy=function(){Ri=null},Xt=function(n,e,t,r){return t&&(Ra(n,e,t,r,-1)||Ra(n,e,t,r,1))},Ky=/^(img|br|input|textarea|hr)$/i;function Ra(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:je(n))){let o=n.parentNode;if(!o||o.nodeType!=1||ar(n)||Ky.test(n.nodeName)||n.contentEditable=="false")return!1;e=he(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.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 n=o,e=s<0?je(n):0}else return!1}}function je(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function qy(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=je(n)}else if(n.parentNode&&!ar(n))e=he(n),n=n.parentNode;else return null}}function Jy(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!ar(n))e=he(n)+1,n=n.parentNode;else return null}}function Gy(n,e,t){for(let r=e==0,s=e==je(n);r||s;){if(n==t)return!0;let i=he(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==je(n)}}function ar(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ds=function(n){return n.focusNode&&Xt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function zt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Yy(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Xy(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);
vendor: 9,404 bytes, line 109
109if(r)return{node:r.offsetNode,offset:Math.min(je(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(je(r.startContainer),r.startOffset)}}}const Ze=typeof navigator<"u"?navigator:null,Ia=typeof document<"u"?document:null,Rt=Ze&&Ze.userAgent||"",Ii=/Edge\/(\d+)/.exec(Rt),Sd=/MSIE \d/.exec(Rt),Pi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rt),Ee=!!(Sd||Pi||Ii),Ct=Sd?document.documentMode:Pi?+Pi[1]:Ii?+Ii[1]:0,ze=!Ee&&/gecko\/(\d+)/i.test(Rt);ze&&+(/Firefox\/(\d+)/.exec(Rt)||[0,0])[1];const Li=!Ee&&/Chrome\/(\d+)/.exec(Rt),oe=!!Li,wd=Li?+Li[1]:0,ve=!Ee&&!!Ze&&/Apple Computer/.test(Ze.vendor),yn=ve&&(/Mobile\/\w+/.test(Rt)||!!Ze&&Ze.maxTouchPoints>2),Le=yn||(Ze?/Mac/.test(Ze.platform):!1),Cd=Ze?/Win/.test(Ze.platform):!1,ct=/Android \d/.test(Rt),lr=!!Ia&&"webkitFontSmoothing"in Ia.documentElement.style,Qy=lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Zy(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function rt(n,e){return typeof n=="number"?n:n[e]}function e0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Pa(n,e,t){let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=gn(o);continue}let a=o,l=a==i.body,c=l?Zy(i):e0(a),d=0,u=0;if(e.top<c.top+rt(r,"top")?u=-(c.top-e.top+rt(s,"top")):e.bottom>c.bottom-rt(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+rt(s,"top")-c.top:e.bottom-c.bottom+rt(s,"bottom")),e.left<c.left+rt(r,"left")?d=-(c.left-e.left+rt(s,"left")):e.right>c.right-rt(r,"right")&&(d=e.right-c.right+rt(s,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let g=a.scrollLeft-f,y=a.scrollTop-p;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:gn(o)}}function t0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(i,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:Md(n.dom)}}function Md(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=gn(r));return e}function n0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Nd(t,r==0?0:r-e)}function Nd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let nn=null;function r0(n){if(n.setActive)return n.setActive();if(nn)return n.focus(nn);let e=Md(n);n.focus(nn==null?{get preventScroll(){return nn={preventScroll:!0},!0}}:void 0),nn||(nn=!1,Nd(e,0))}function Td(n,e){let t,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=at(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=d,r=g,s=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&g&&(i=u+(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=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!t&&l&&(t=l,s=c,r=0),t&&t.nodeType==3?s0(t,s):!t||r&&t.nodeType==1?{node:n,offset:i}:Td(t,s)}function s0(n,e){let t=n.nodeValue.length,r=document.createRange(),s;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=ht(r,1);if(o.top!=o.bottom&&No(e,o)){s={node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:n,offset:0}}function No(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function i0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function o0(n,e,t){let{node:r,offset:s}=Td(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,s,i)}function a0(n,e,t,r){let s=-1;for(let i=e,o=!1;i!=n.dom;){let a=n.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:n.docView.posFromDOM(e,t,-1)}function Ed(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let o=n.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(No(e,c))return Ed(o,e,c)}}if((i=(i+1)%r)==s)break}return n}function l0(n,e){let t=n.dom.ownerDocument,r,s=0,i=Xy(t,e.left,e.top);i&&({node:r,offset:s}=i);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!No(e,c)||(o=Ed(n.dom,e,c),!o))return null}if(ve)for(let c=o;r&&c;c=gn(c))c.draggable&&(r=void 0);if(o=i0(o,e),r){if(ze&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&s++}let c;lr&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=a0(n,r,s,e))}a==null&&(a=o0(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function La(n){return n.top<n.bottom||n.left<n.right}function ht(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(La(r))return r}return Array.prototype.find.call(t,La)||n.getBoundingClientRect()}const c0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ad(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=lr||ze;if(r.nodeType==3)if(o&&(c0.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let l=ht(at(r,s,s),t);if(ze&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=ht(at(r,s-1,s-1),-1);if(c.top==l.top){let d=ht(at(r,s,s+1),-1);if(d.top!=l.top)return Sn(d,d.left<c.left)}}return l}else{let l=s,c=s,d=t<0?1:-1;return t<0&&!s?(c++,d=-1):t>=0&&s==r.nodeValue.length?(l--,d=1):t<0?l--:c++,Sn(ht(at(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==je(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return oi(l.getBoundingClientRect(),!1)}if(i==null&&s<je(r)){let l=r.childNodes[s];if(l.nodeType==1)return oi(l.getBoundingClientRect(),!0)}return oi(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==je(r))){let l=r.childNodes[s-1],c=l.nodeType==3?at(l,je(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Sn(ht(c,1),!1)}if(i==null&&s<je(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?at(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Sn(ht(c,-1),!0)}return Sn(ht(r.nodeType==3?at(r):r,-t),t>=0)}function Sn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function oi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Od(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function d0(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Od(n,e,()=>{let{node:i}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=Ad(n,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=at(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const u0=/[\u0590-\u08ac]/;function f0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=n.domSelection();return a?!u0.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:Od(n,e,()=>
vendor: 5,068 bytes, line 109
109{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),y=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let ja=null,_a=null,za=!1;function h0(n,e,t){return ja==e&&_a==t?za:(ja=e,_a=t,za=t=="up"||t=="down"?d0(n,e,t):f0(n,e,t))}const Be=0,Ba=1,Bt=2,et=3;class cr{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Be,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,r=this.posAtStart;;t++){let s=this.children[t];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,t,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[t-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[t];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=t>he(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(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&t==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,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!t||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 t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],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,t){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 Rd){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Dd&&i.side>=0;r--);if(t<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&t&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?he(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,t):{node:this.contentDOM,offset:i?he(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,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 d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=he(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=he(u.dom);break}t+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);
vendor: 4,411 bytes, lines 109-110
109if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let g=this.children[f],y=p+g.size;if(i>p&&o<y)return g.setSelection(e-p-g.border,t-p-g.border,r,s);p=y}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((ze||ve)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`
110`),u&&p==f.nodeValue.length)for(let g=f,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:he(y)+1});break}let v=g.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let g=f.childNodes[p-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(ze&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(s=!0)}if(!(s||u&&ve)&&Xt(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Xt(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&ze)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){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&&t>=r:e<o&&t>r){let a=r+i.border,l=o-i.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?Bt:Ba,e==a&&t==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=et:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Bt:et}r=o}this.dirty=Bt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Bt:Ba;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Dd extends cr{constructor(e,t,r,s){let i,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.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=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Be&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 p0 extends cr{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Qt extends cr{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],o=i&&i(t,s,r);return(!o||!o.dom)&&(o=tn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Qt(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&et||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=et&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Be){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Be}}slice(e,t,r){let s=Qt.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=_i(i,t,o,r)),e>0&&(i=_i(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 Mt extends cr{constructor(e,t,r,s,i,o,a,l,c){super(e,[],i,o),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}
vendor: 24,318 bytes, line 110
110static create(e,t,r,s,i,o){let a=i.nodeViews[t.type.name],l,c=a&&a(t,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=tn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Ld(d,r,t),c?l=new m0(e,t,r,s,d,u||null,h,c,i,o+1):t.isText?new Rs(e,t,r,s,d,h,i):new Mt(e,t,r,s,d,u||null,h,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>k.empty)}return e}matchesNode(e,t,r){return this.dirty==Be&&e.eq(this.node)&&zr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new y0(this,o&&o.node,e);x0(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?$.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,s)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,s)||l.addNode(c,d,u,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Bt)&&(o&&this.protectLocalComposition(e,o),Id(this.contentDOM,this.children,e),yn&&k0(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof L)||r<t||s>t+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=S0(this.node.content,o,r-t,s-t);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;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 p0(this,i,t,s);e.input.compositionNodes.push(o),this.children=_i(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==et||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Be}updateOuterDeco(e){if(zr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Pd(this.dom,this.nodeDOM,ji(this.outerDeco,this.node,t),ji(e,this.node,t)),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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Fa(n,e,t,r,s){Ld(r,e,n);let i=new Mt(void 0,n,e,t,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Rs extends Mt{constructor(e,t,r,s,i,o,a){super(e,t,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,t,r,s){return this.dirty==et||this.dirty!=Be&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Be||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=Be,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),i=document.createTextNode(s.text);return new Rs(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=et)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Rd extends cr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Be&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class m0 extends Mt{constructor(e,t,r,s,i,o,a,l,c,d){super(e,t,r,s,i,o,a,c,d),this.spec=l}update(e,t,r,s){if(this.dirty==et)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,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 Id(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=Ha(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof Qt){let l=r?r.previousSibling:n.lastChild;Id(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Ha(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Pn=function(n){n&&(this.nodeName=n)};Pn.prototype=Object.create(null);const Ft=[new Pn];function ji(n,e,t){if(n.length==0)return Ft;let r=t?Ft[0]:new Pn,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new Pn(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&s.length==1&&s.push(r=new Pn(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 Pd(n,e,t,r){if(t==Ft&&r==Ft)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=t[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=n&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Ft[0]),s=l}g0(s,a||Ft[0],o)}return s}function g0(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function Ld(n,e,t){return Pd(n,n,Ft,ji(e,t,n.nodeType!=1))}function zr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Ha(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class y0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=v0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,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=Be,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=Qt.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,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,t,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,t,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let o=this.top.children[s];return o.dirty==et&&o.dom==o.contentDOM&&(o.dirty=Bt),o.update(e,t,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==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=t}}updateNextNode(e,t,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Mt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=et&&zr(t,l.outerDeco));if(!h&&l.update(e,t,r,s))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Bt,u.updateChildren(s,o+1),u.dirty=Be),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!zr(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=Mt.create(this.top,t,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,t,r,s,i){let o=Mt.create(this.top,e,t,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,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 Dd(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Qt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Rs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ve||oe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.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 Rd(this.top,[],r,null);t!=this.top?t.children.push(s):t.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 v0(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof Qt)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function b0(n,e){return n.type.side-e.type.side}function x0(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,s,e.forChild(i,d),c),i+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<s.length&&s[o].to==i;){let y=s[o++];y.widget&&(d?(u||(u=[d])).push(y):d=y)}if(d)if(u){u.sort(b0);for(let y=0;y<u.length;y++)t(u[y],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let p=i+h.nodeSize;if(h.isText){let y=p;o<s.length&&s[o].from<y&&(y=s[o].from);for(let v=0;v<a.length;v++)a[v].to<y&&(y=a[v].to);y<p&&(l=h.cut(y-i),h=h.cut(0,y-i),p=y,f=-1)}else for(;o<s.length&&s[o].to<p;)o++;let g=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,g,e.forChild(i,h),f),i=p}}function k0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function S0(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let o=n.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<n.childCount;){let c=n.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=t){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>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function _i(n,e,t,r,s){let i=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),d>t&&i.push(l.slice(t-c,l.size,r)))}return i}function To(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Ds(t)){for(l=o;s&&!s.node;)s=s.parent;let u=s.node;if(s&&u.isAtom&&I.isSelectable(u)&&s.parent&&!(u.isInline&&Gy(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;c=new I(o==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!i?1:-1;c=Eo(n,d,a,u)}return c}function jd(n){return n.editable?n.hasFocus():zd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function dt(n,e=!1){let t=n.state.selection;if(_d(n,t),!!jd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&oe){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Xt(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)C0(n);else{let{anchor:r,head:s}=t,i,o;$a&&!(t instanceof L)&&(t.$from.parent.inlineContent||(i=Va(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Va(n,t.to))),n.docView.setSelection(r,s,n,e),$a&&(i&&Wa(i),o&&Wa(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&w0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $a=ve||oe&&wd<63;function Va(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(ve&&s&&s.contentEditable=="false")return ai(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ai(s);if(i)return ai(i)}}function ai(n){return n.contentEditable="true",ve&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Wa(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function w0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!jd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function C0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,he(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ee&&Ct<=11&&(t.disabled=!0,t.disabled=!1)}function _d(n,e){if(e instanceof I){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ua(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ua(n)}function Ua(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Eo(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||L.between(e,t,r)}function Ka(n){return n.editable&&!n.hasFocus()?!1:zd(n)}function zd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function M0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Xt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function zi(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&B.findFrom(i,e)}function pt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function qa(n,e,t){let r=n.state.selection;if(r instanceof L)if(t.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=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return pt(n,new L(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=zi(n.state,e);return s&&s instanceof I?pt(n,s):!1}else if(!(Le&&t.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=n.docView.descAt(a))&&!o.contentDOM?I.isSelectable(i)?pt(n,new I(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):lr?pt(n,new L(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return pt(n,new L(e>0?r.$to:r.$from));{let s=zi(n.state,e);return s?pt(n,s):!1}}}function Br(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ln(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function rn(n,e){return e<0?N0(n):T0(n)}function N0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(ze&&t.nodeType==1&&r<Br(t)&&Ln(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Ln(a,-1))s=t,i=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Bd(t))break;{let a=t.previousSibling;for(;a&&Ln(a,-1);)s=t.parentNode,i=he(a),a=a.previousSibling;if(a)t=a,r=Br(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Bi(n,t,r):s&&Bi(n,s,i)}function T0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Br(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Ln(a,1))i=t,o=++r;else break}else{if(Bd(t))break;{let a=t.nextSibling;for(;a&&Ln(a,1);)i=a.parentNode,o=he(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=Br(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&Bi(n,i,o)}function Bd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function E0(n,e){for(;n&&e==n.childNodes.length&&!ar(n);)e=he(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function A0(n,e){for(;n&&!e&&!ar(n);)e=he(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Bi(n,e,t){if(e.nodeType!=3){let i,o;(o=E0(e,t))?(e=o,t=0):(i=A0(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ds(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&dt(n)},50)}function Ja(n,e){let t=n.state.doc.resolve(e);if(!(oe||Cd)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.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<t.end()){let i=n.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(n.dom).direction=="rtl"?"rtl":"ltr"}function Ga(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||Le&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=zi(n.state,e);if(o&&o instanceof I)return pt(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof _e?B.near(o,e):B.findFrom(o,e);return a?pt(n,a):!1}return!1}function Ya(n,e){if(!(n.state.selection instanceof L))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function Xa(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function O0(n){if(!ve||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Xa(n,r,"true"),setTimeout(()=>Xa(n,r,"false"),20)}return!1}function D0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function R0(n,e){let t=e.keyCode,r=D0(e);if(t==8||Le&&t==72&&r=="c")return Ya(n,-1)||rn(n,-1);if(t==46&&!e.shiftKey||Le&&t==68&&r=="c")return Ya(n,1)||rn(n,1);if(t==13||t==27)return!0;if(t==37||Le&&t==66&&r=="c"){let s=t==37?Ja(n,n.state.selection.from)=="ltr"?-1:1:-1;return qa(n,s,r)||rn(n,s)}else if(t==39||Le&&t==70&&r=="c"){let s=t==39?Ja(n,n.state.selection.from)=="ltr"?1:-1:1;return qa(n,s,r)||rn(n,s)}else{if(t==38||Le&&t==80&&r=="c")return Ga(n,-1,r)||rn(n,-1);if(t==40||Le&&t==78&&r=="c")return O0(n)||Ga(n,1,r)||rn(n,1);if(r==(Le?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ao(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=n.someProp("clipboardSerializer")||tn.fromSchema(n.state.schema),a=Ud(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));
vendor: 8,877 bytes, lines 110-113
110let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Wd[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
111
112`);return{dom:l,text:h,slice:e}}function Fd(n,e,t,r,s){let i=s.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||i||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,i||r,n)}),i)return a=new T(k.from(n.state.schema.text(e.replace(/\r\n?/g,`
113`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(u)a=u;else{let h=s.marks(),{schema:f}=n.state,p=tn.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(f.text(g,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=j0(t),lr&&_0(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||wt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!I0.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=z0(Qa(a,+d[1],+d[2]),d[4]);else if(a=T.maxOpen(P0(a.content,s),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Qa(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const I0=/^(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 P0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&$d(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Vd(o[o.length-1],i.length));let d=Hd(a,l);o.push(d),s=s.matchType(d.type),i=l}}),o)return k.from(o)}return n}function Hd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,k.from(n));return n}function $d(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=$d(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(k.from(Hd(t,n,s+1))))}}function Vd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Vd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(k.empty,!0);return n.copy(t.append(r))}function Fi(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(i=0),s<r-1&&(a=Fi(a,e,t,r,s+1,i)),s>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Qa(n,e,t){return e<n.openStart&&(n=new T(Fi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(Fi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Wd={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 Za=null;function Ud(){return Za||(Za=document.implementation.createHTMLDocument("title"))}let li=null;function L0(n){let e=window.trustedTypes;return e?(li||(li=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),li.createHTML(n)):n}function j0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ud().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Wd[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=L0(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function _0(n){let e=n.querySelectorAll(oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function z0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=k.from(l.create(r[a+1],s)),i++,o++}return new T(s,i,o)}const Se={},we={},B0={touchstart:!0,touchmove:!0};class F0{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 H0(n){for(let e in Se){let t=Se[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{V0(n,r)&&!Oo(n,r)&&(n.editable||!(r.type in we))&&t(n,r)},B0[e]?{passive:!0}:void 0)}ve&&n.dom.addEventListener("input",()=>null),Hi(n)}function kt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function $0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Hi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Oo(n,r))})}function Oo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function V0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function W0(n,e){!Oo(n,e)&&Se[e.type]&&(n.editable||!(e.type in we))&&Se[e.type](n,e)}we.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!qd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ct&&oe&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),yn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,zt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||R0(n,t)?t.preventDefault():kt(n,"key")};we.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};we.keypress=(n,e)=>{let t=e;if(qd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Le&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Is(n){return{left:n.clientX,top:n.clientY}}function U0(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Do(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,a=>o>i.depth?a(n,t,i.nodeAfter,i.before(o),s,!0):a(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function un(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function K0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(un(n,new I(t)),!0):!1}function q0(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof I&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(I.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(un(n,I.create(n.state.doc,s)),!0):!1}function J0(n,e,t,r,s){return Do(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?q0(n,t):K0(n,t))}function G0(n,e,t,r){return Do(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",
vendor: 23,285 bytes, line 113
113s=>s(n,e,r))}function Y0(n,e,t,r){return Do(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||X0(n,t,r)}function X0(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(un(n,L.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)un(n,L.create(r,a+1,a+1+o.content.size));else if(I.isSelectable(o))un(n,I.create(r,a));else continue;return!0}}function Ro(n){return Fr(n)}const Kd=Le?"metaKey":"ctrlKey";Se.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ro(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&U0(t,n.input.lastClick)&&!t[Kd]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(Is(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Q0(n,o,t,!!r)):(i=="doubleClick"?G0:Y0)(n,o.pos,o.inside,t)?t.preventDefault():kt(n,"pointer"))};class Q0{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Kd],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof I&&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)),kt(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(()=>dt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Is(e))),this.updateAllowDefault(e),this.allowDefault||!t?kt(this.view,"pointer"):J0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ve&&this.mightDrag&&!this.mightDrag.node.isAtom||oe&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(un(this.view,B.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):kt(this.view,"pointer")}move(e){this.updateAllowDefault(e),kt(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)}}Se.touchstart=n=>{n.input.lastTouch=Date.now(),Ro(n),kt(n,"pointer")};Se.touchmove=n=>{n.input.lastTouch=Date.now(),kt(n,"pointer")};Se.contextmenu=n=>Ro(n);function qd(n,e){return n.composing?!0:ve&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Z0=ct?5e3:-1;we.compositionstart=we.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||oe&&Cd&&ev(n)))n.markCursor=n.state.storedMarks||t.marks(),Fr(n,!0),n.markCursor=null;else if(Fr(n,!e.selection.empty),ze&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.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=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Jd(n,Z0)};function ev(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}we.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Jd(n,20))};function Jd(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Fr(n),e))}function Gd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=nv());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function tv(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=qy(e.focusNode,e.focusOffset),r=Jy(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function nv(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Fr(n,e=!1){if(!(ct&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Gd(n),e||n.docView&&n.docView.dirty){let t=To(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function rv(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Yn=Ee&&Ct<15||yn&&Qy<604;Se.copy=we.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Yn?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Ao(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):rv(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function sv(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function iv(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Xn(n,r.value,null,s,e):Xn(n,r.textContent,r.innerHTML,s,e)},50)}function Xn(n,e,t,r,s){let i=Fd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,s,i||T.empty)))return!0;if(!i)return!1;let o=sv(i),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Yd(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}we.paste=(n,e)=>{let t=e;if(n.composing&&!ct)return;let r=Yn?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Xn(n,Yd(r),r.getData("text/html"),s,t)?t.preventDefault():iv(n,t)};class Xd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const ov=Le?"altKey":"ctrlKey";function Qd(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[ov]}Se.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Is(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof I?s.to-1:s.to))){if(r&&r.mightDrag)o=I.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=I.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=Ao(n,a);(!t.dataTransfer.files.length||!oe||wd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Yn?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Yn||t.dataTransfer.setData("text/plain",c),n.dragging=new Xd(d,Qd(n,t),o)};Se.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};we.dragover=we.dragenter=(n,e)=>e.preventDefault();we.drop=(n,e)=>{try{av(n,e,n.dragging)}finally{n.dragging=null}};function av(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Is(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",f=>{i=f(i,n,!1)}):i=Fd(n,Yd(e.dataTransfer),Yn?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Qd(n,e));if(n.someProp("handleDrop",f=>f(n,e,i||T.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?ld(n.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=n.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&I.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new I(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,y,v)=>f=v),l.setSelection(Eo(n,h,l.doc.resolve(f)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Se.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&dt(n)},20))};Se.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Se.beforeinput=(n,e)=>{if(oe&&ct&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,zt(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in we)Se[n]=we[n];function Qn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Hr{constructor(e,t){this.toDOM=e,this.spec=t||Ut,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new ke(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Hr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Qn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Nt{constructor(e,t){this.attrs=e,this.spec=t||Ut}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ke(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Nt&&Qn(this.attrs,e.attrs)&&Qn(this.spec,e.spec)}static is(e){return e.type instanceof Nt}destroy(){}}class Io{constructor(e,t){this.attrs=e,this.spec=t||Ut}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ke(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof Io&&Qn(this.attrs,e.attrs)&&Qn(this.spec,e.spec)}destroy(){}}class ke{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ke(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ke(e,e,new Hr(t,r))}static inline(e,t,r,s){return new ke(e,t,new Nt(r,s))}static node(e,t,r,s){return new ke(e,t,new Io(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Nt}get widget(){return this.type instanceof Hr}}const on=[],Ut={};class U{constructor(e,t){this.local=e.length?e:on,this.children=t.length?t:on}static create(e,t){return t.length?$r(t,e,0,Ut):ge}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&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]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,s+a,i)}}map(e,t,r){return this==ge||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ut)}mapInner(e,t,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(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?lv(this.children,o||[],e,t,r,s,i):o?new U(o.sort(Kt),on):ge}add(e,t){return t.length?this==ge?U.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,d;if(d=eu(t,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,d,c+1):s.splice(i,0,l,l+a.nodeSize,$r(d,a,c+1,Ut)),i+=3}});let o=Zd(i?tu(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new U(o.length?this.local.concat(o).sort(Kt):this.local,s||this.children)}remove(e){return e.length==0||this==ge?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+t,l=r[i+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=ge?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,t)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new U(s,r):ge}forChild(e,t){if(this==ge)return this;if(t.isLeaf)return U.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+t.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 Nt){let c=Math.max(i,l.from)-i,d=Math.min(o,l.to)-i;c<d&&(s||(s=[])).push(l.copy(c,d))}}if(s){let a=new U(s.sort(Kt),on);return r?new yt([a,r]):a}return r||ge}eq(e){if(this==e)return!0;if(!(e instanceof U)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Po(this.localsInner(e))}localsInner(e){if(this==ge)return on;if(e.inlineContent||!this.local.some(Nt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Nt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}U.empty=new U([],[]);U.removeOverlap=Po;const ge=U.empty;class yt{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Ut));return yt.from(r)}forChild(e,t){if(t.isLeaf)return U.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=ge&&(i instanceof yt?r=r.concat(i.members):r.push(i))}return yt.from(r)}eq(e){if(!(e instanceof yt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?Po(r?t:t.sort(Kt)):on}static from(e){switch(e.length){case 0:return ge;case 1:return e[0];default:return new yt(e.every(t=>t instanceof U)?e:e.reduce((t,r)=>t.concat(r instanceof U?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function lv(n,e,t,r,s,i,o){let a=n.slice();for(let c=0,d=i;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,g)=>{let y=g-p-(f-h);for(let v=0;v<a.length;v+=3){let b=a[v+1];if(b<0||h>b+d-u)continue;let C=a[v]+d-u;f>=C?a[v+1]=h<=C?-2:-1:h>=d&&y&&(a[v]+=y,a[v+1]+=y)}u+=y}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+i),u=d-s;if(u<0||u>=r.content.size){l=!0;continue}let h=t.map(n[c+1]+i,-1),f=h-s,{index:p,offset:g}=r.content.findIndex(u),y=r.maybeChild(p);if(y&&g==u&&g+y.nodeSize==f){let v=a[c+2].mapInner(t,y,d+1,n[c]+i+1,o);v!=ge?(a[c]=u,a[c+1]=f,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=cv(a,n,e,t,s,i,o),d=$r(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new U(e.sort(Kt),a)}function Zd(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new ke(s.from+e,s.to+e,s.type))}return t}function cv(n,e,t,r,s,i,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,s,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+i+1);return t}function eu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function tu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function $r(n,e,t,r){let s=[],i=!1;e.forEach((a,l)=>{let c=eu(n,a,l+t);if(c){i=!0;let d=$r(c,a,t+l+1,r);d!=ge&&s.push(l,l+a.nodeSize,d)}});let o=Zd(i?tu(n):n,-t).sort(Kt);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 U(o,s):ge}function Kt(n,e){return n.from-e.from||n.to-e.to}function Po(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),el(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),el(e,s,r.copy(i.from,r.to)));break}}}return e}function el(n,e,t){for(;e<n.length&&Kt(t,n[e])>0;)e++;n.splice(e,0,t)}function ci(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ge&&e.push(r)}),n.cursorWrapper&&e.push(U.create(n.state.doc,[n.cursorWrapper.deco])),yt.from(e)}const dv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},uv=Ee&&Ct<=11;class fv{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 hv{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new fv,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]);Ee&&Ct<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),uv&&(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,dv)),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 t=0;t<e.length;t++)this.queue.push(e[t]);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(Ka(this.view)){if(this.suppressingSelectionUpdates)return dt(this.view);if(Ee&&Ct<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xt(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 t=new Set,r;for(let i=e.focusNode;i;i=gn(i))t.add(i);for(let i=e.anchorNode;i;i=gn(i))if(t.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ka(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];
vendor: 7,366 bytes, line 113
113if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(i=i<0?u.from:Math.min(u.from,i),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(ze&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||gv(e,u)!=f)&&h.remove()}}}else if((oe||ve)&&l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;u&&u.nodeType==1&&u.contentEditable=="false"&&d.parentNode.removeChild(d)}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ds(r)&&(c=To(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,dt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),pv(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||dt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Ee&&Ct<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?he(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?he(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 tl=new WeakMap,nl=!1;function pv(n){if(!tl.has(n)&&(tl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ze,nl)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."),nl=!0}}function rl(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Xt(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function mv(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return rl(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?rl(n,t):null}function gv(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function yv(n,e,t){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Ds(l)||c.push({node:l.focusNode,offset:l.focusOffset})),oe&&n.input.lastKeyCode===8)for(let y=i;y>s;y--){let v=r.childNodes[y-1],b=v.pmViewDesc;if(v.nodeName=="BR"&&!b){i=y;break}if(!b||b.size)break}let u=n.state.doc,h=n.someProp("domParser")||wt.fromSchema(n.state.schema),f=u.resolve(o),p=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:vv,context:f});if(c&&c[0].pos!=null){let y=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=y),p={anchor:y+o,head:v+o}}return{doc:g,sel:p,from:o,to:a}}function vv(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ve&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ve&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const bv=/^(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 xv(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let N=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=To(n,N);if(A&&!n.state.selection.eq(A)){if(oe&&ct&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Y=>Y(n,zt(13,"Enter"))))return;let _=n.state.tr.setSelection(A);N=="pointer"?_.setMeta("pointer",!0):N=="key"&&_.scrollIntoView(),i&&_.setMeta("composition",i),n.dispatch(_)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=yv(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=wv(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(yn&&n.input.lastIOSEnter>Date.now()-225||ct)&&s.some(N=>N.nodeType==1&&!bv.test(N.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",N=>N(n,zt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof L&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let N=sl(n,n.state.doc,c.sel);if(N&&!N.eq(n.state.selection)){let A=n.state.tr.setSelection(N);i&&A.setMeta("composition",i),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof L&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Ee&&Ct<=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 g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),v=d.resolve(p.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=p.endA;if((yn&&n.input.lastIOSEnter>Date.now()-225&&(!b||s.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",N=>
vendor: 13,370 bytes, line 113
113N(n,zt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Sv(d,p.start,p.endA,g,y)&&n.someProp("handleKeyDown",N=>N(n,zt(8,"Backspace")))){ct&&oe&&n.domObserver.suppressSelectionUpdates();return}oe&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),ct&&!b&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(N){return N(n,zt(13,"Enter"))})},20));let C=p.start,M=p.endA,w=N=>{let A=N||n.state.tr.replace(C,M,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let _=sl(n,A.doc,c.sel);_&&!(oe&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==C||_.head==A.mapping.map(M)-1)||Ee&&_.empty&&_.head==C)&&A.setSelection(_)}return i&&A.setMeta("composition",i),A.scrollIntoView()},E;if(b)if(g.pos==y.pos){Ee&&Ct<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>dt(n),20));let N=w(n.state.tr.delete(C,M)),A=d.resolve(p.start).marksAcross(d.resolve(p.endA));A&&N.ensureMarks(A),n.dispatch(N)}else if(p.endA==p.endB&&(E=kv(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let N=w(n.state.tr);E.type=="add"?N.addMark(C,M,E.mark):N.removeMark(C,M,E.mark),n.dispatch(N)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let N=g.parent.textBetween(g.parentOffset,y.parentOffset),A=()=>w(n.state.tr.insertText(N,C,M));n.someProp("handleTextInput",_=>_(n,C,M,N,A))||n.dispatch(A())}else n.dispatch(w());else n.dispatch(w())}function sl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Eo(n,e.resolve(t.anchor),e.resolve(t.head))}function kv(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,a,l;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(k.from(c).eq(n))return{mark:a,type:o}}function Sv(n,e,t,r,s){if(t-e<=s.pos-r.pos||di(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&t==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(di(i,!0,!0));return!o.parent.isTextblock||o.pos>t||di(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function di(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function wv(n,e,t,r,s){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&n.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<e.size&&il(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<n.size&&il(n.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function il(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class nu{constructor(e,t){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 F0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(dl),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=ll(this),al(this),this.nodeViews=cl(this),this.docView=Fa(this.state.doc,ol(this),ci(this),this.dom,this),this.domObserver=new hv(this,(r,s,i,o)=>xv(this,r,s,i,o)),this.domObserver.start(),H0(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Hi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Gd(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=cl(this);Mv(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Hi(this),this.editable=ll(this),al(this);let l=ci(this),c=ol(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(s.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&t0(this);if(o){this.domObserver.stop();let f=u&&(Ee||oe)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Cv(s.selection,e.selection);if(u){let p=oe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=tv(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fa(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&M0(this))?dt(this,f):(_d(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&n0(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof I){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Pa(this,t.getBoundingClientRect(),e)}else Pa(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 t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){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-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new Xd(e.slice,e.move,s<0?void 0:I.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=t?t(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=t?t(a):a))return s}}hasFocus(){if(Ee){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&&r0(this.dom),dt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return l0(this,e)}coordsAtPos(e,t=1){return Ad(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return h0(this,t||this.state,e)}pasteHTML(e,t){return Xn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Xn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ao(this,e)}destroy(){this.docView&&($0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ci(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Uy())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return W0(this,e)}domSelectionRange(){let e=this.domSelection();return e?ve&&this.root.nodeType===11&&Yy(this.dom.ownerDocument)==this.dom&&mv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}nu.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function ol(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ke.node(0,n.state.doc.content.size,e)]}function al(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ke.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ll(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Cv(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function cl(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Mv(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function dl(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Tt={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:"'"},Vr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Nv=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pe=0;pe<10;pe++)Tt[48+pe]=Tt[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Tt[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Tt[pe]=String.fromCharCode(pe+32),Vr[pe]=String.fromCharCode(pe);for(var ui in Tt)Vr.hasOwnProperty(ui)||(Vr[ui]=Tt[ui]);function Ev(n){var e=Nv&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Tv&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Vr:Tt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Av=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ov=typeof navigator<"u"&&/Win/.test(navigator.platform);function Dv(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");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))Av?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Rv(n){let e=Object.create(null);for(let t in n)e[Dv(t)]=n[t];return e}
vendor: 14,405 bytes, line 113
113function fi(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Iv(n){return new K({props:{handleKeyDown:ru(n)}})}function ru(n){let e=Rv(n);return function(t,r){let s=Ev(r),i,o=e[fi(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[fi(s,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ov&&r.ctrlKey&&r.altKey)&&(i=Tt[r.keyCode])&&i!=s){let a=e[fi(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Pv=Object.defineProperty,Lo=(n,e)=>{for(var t in e)Pv(n,t,{get:e[t],enumerable:!0})};function Ps(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=t;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=t.selection,s=t.doc,i=t.storedMarks,t}}}var Ls=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:s}=t,i=this.buildProps(s);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const d=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:i}=r,o=[],a=!!n,l=n||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,h])=>[u,(...p)=>{const g=this.buildProps(l,e),y=h(...p)(g);return o.push(y),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,s=n||t.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(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:i}=r,o={tr:n,editor:r,view:i,state:Ps({state:s,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},su={};Lo(su,{blur:()=>Lv,clearContent:()=>jv,clearNodes:()=>_v,command:()=>zv,createParagraphNear:()=>Bv,cut:()=>Fv,deleteCurrentNode:()=>Hv,deleteNode:()=>$v,deleteRange:()=>Vv,deleteSelection:()=>Wv,enter:()=>Uv,exitCode:()=>Kv,extendMarkRange:()=>qv,first:()=>Jv,focus:()=>Yv,forEach:()=>Xv,insertContent:()=>Qv,insertContentAt:()=>tb,joinBackward:()=>sb,joinDown:()=>rb,joinForward:()=>ib,joinItemBackward:()=>ob,joinItemForward:()=>ab,joinTextblockBackward:()=>lb,joinTextblockForward:()=>cb,joinUp:()=>nb,keyboardShortcut:()=>ub,lift:()=>fb,liftEmptyBlock:()=>hb,liftListItem:()=>pb,newlineInCode:()=>mb,resetAttributes:()=>gb,scrollIntoView:()=>yb,selectAll:()=>vb,selectNodeBackward:()=>bb,selectNodeForward:()=>xb,selectParentNode:()=>kb,selectTextblockEnd:()=>Sb,selectTextblockStart:()=>wb,setContent:()=>Cb,setMark:()=>Ub,setMeta:()=>Kb,setNode:()=>qb,setNodeSelection:()=>Jb,setTextDirection:()=>Gb,setTextSelection:()=>Yb,sinkListItem:()=>Xb,splitBlock:()=>Qb,splitListItem:()=>Zb,toggleList:()=>ex,toggleMark:()=>tx,toggleNode:()=>nx,toggleWrap:()=>rx,undoInputRule:()=>sx,unsetAllMarks:()=>ix,unsetMark:()=>ox,unsetTextDirection:()=>ax,updateAttributes:()=>lx,wrapIn:()=>cx,wrapInList:()=>dx});var Lv=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),jv=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),_v=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=kn(f);if(a.type.isTextblock){const{defaultType:g}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,g)}(p||p===0)&&e.lift(f,p)})}),!0},zv=n=>e=>n(e),Bv=()=>({state:n,dispatch:e})=>Dy(n,e),Fv=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new L(r.doc.resolve(Math.max(o-1,0)))),!0},Hv=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.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);n.delete(a,l).scrollIntoView()}return!0}return!1};function ee(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var $v=n=>({tr:e,state:t,dispatch:r})=>{const s=ee(n,t.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},Vv=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},Wv=()=>({state:n,dispatch:e})=>by(n,e),Uv=()=>({commands:n})=>n.keyboardShortcut("Enter"),Kv=()=>({state:n,dispatch:e})=>Oy(n,e);function jo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Wr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:jo(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function iu(n,e,t={}){return n.find(r=>r.type===e&&Wr(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function ul(n,e,t={}){return!!iu(n,e,t)}function _o(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!t){const c=r.node.marks.find(d=>d.type===e);c&&(t=c.attrs)}if(!iu([...r.node.marks],e,t))return;let i=r.index,o=n.start()+r.offset,a=i+1,l=o+r.node.nodeSize;for(;i>0&&ul([...n.parent.child(i-1).marks],e,t);)i-=1,o-=n.parent.child(i).nodeSize;for(;a<n.parent.childCount&&ul([...n.parent.child(a).marks],e,t);)l+=n.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function ut(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var qv=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=ut(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(s){const u=_o(l,i,e);if(u&&u.from<=c&&u.to>=d){const h=L.create(o,u.from,u.to);t.setSelection(h)}}return!0},Jv=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ou(n){return n instanceof L}function Ht(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function au(n,e=null){if(!e)return null;const t=B.atStart(n),r=B.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?L.create(n,Ht(0,s,i),Ht(n.content.size,s,i)):L.create(n,Ht(e,s,i),Ht(e,s,i))}function fl(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ur(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Gv(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Yv=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ur()||fl())&&r.dom.focus(),Gv()&&!Ur()&&!fl()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!ou(t.state.selection))return o(),!0;const a=au(s.doc,n)||t.state.selection,l=t.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},Xv=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),Qv=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),lu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&lu(r)}return n};function mr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return lu(t)}function Zn(n,e,t){if(n instanceof We||n instanceof k)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return k.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Zn("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Xc({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(t.slice?wt.fromSchema(l).parseSlice(mr(n),t.parseOptions):wt.fromSchema(l).parse(mr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=wt.fromSchema(e);return t.slice?i.parseSlice(mr(n),t.parseOptions).content:i.parse(mr(n),t.parseOptions)}return Zn("",e,t)}function Zv(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof ie||s instanceof ae))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(B.near(n.doc.resolve(o),t))}var eb=n=>!("type"in n),tb=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=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)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Zn(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=Zn(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return l(y),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((eb(a)?a:[a]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,f=f?y.isBlock:!1}),d===u&&f){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,u+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof k){let y="";e.forEach(v=>{v.text&&(y+=v.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,u)}else{g=a;const y=r.doc.resolve(d),v=y.node(),b=y.parentOffset===0,C=v.isText||v.isTextblock,M=v.content.size>0;b&&C&&M&&(d=Math.max(0,d-1)),r.replaceWith(d,u,g)}t.updateSelection&&Zv(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},nb=()=>({state:n,dispatch:e})=>Ny(n,e),rb=()=>({state:n,dispatch:e})=>Ty(n,e),sb=()=>({state:n,dispatch:e})=>xy(n,e),ib=()=>({state:n,dispatch:e})=>Cy(n,e),ob=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Es(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ab=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Es(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},lb=()=>({state:n,dispatch:e})=>ky(n,e),cb=()=>({state:n,dispatch:e})=>Sy(n,e);function cu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function db(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");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))Ur()||cu()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var ub=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=db(n).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(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const d=c.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function Et(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?ee(e,n.schema):null,a=[];n.doc.nodesBetween(r,s,(u,h)=>{if(u.isText)return;const f=Math.max(r,h),p=Math.min(s,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=s-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Wr(u.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var fb=(n,e={})=>({state:t,dispatch:r})=>{const s=ee(n,t.schema);return Et(t,s,e)?Ey(t,r):!1},hb=()=>({state:n,dispatch:e})=>Ry(n,e),pb=n=>({state:e,dispatch:t})=>{const r=ee(n,e.schema);return Hy(r)(e,t)},mb=()=>({state:n,dispatch:e})=>Ay(n,e);function js(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function hl(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}var gb=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=js(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=ee(n,r.schema)),a==="mark"&&(o=ut(n,r.schema));let l=!1;
113return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{i&&i===d.type&&(l=!0,s&&t.setNodeMarkup(u,void 0,hl(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(h=>{o===h.type&&(l=!0,s&&t.addMark(u,u+d.nodeSize,o.create(hl(h.attrs,e))))})})}),l},yb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),vb=()=>({tr:n,dispatch:e})=>{if(e){const t=new _e(n.doc);n.setSelection(t)}return!0},bb=()=>({state:n,dispatch:e})=>wy(n,e),xb=()=>({state:n,dispatch:e})=>My(n,e),kb=()=>({state:n,dispatch:e})=>Iy(n,e),Sb=()=>({state:n,dispatch:e})=>jy(n,e),wb=()=>({state:n,dispatch:e})=>Ly(n,e);function $i(n,e,t={},r={}){return Zn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Cb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=$i(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&i.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function du(n,e){const t=ut(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function uu(n,e){const t=new hd(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Mb(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Nb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function Tb(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function _s(n){return e=>Tb(e.$from,n)}function D(n,e,t){return n.config[e]===void 0&&n.parent?D(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?D(n.parent,e,t):null}):n.config[e]}function zo(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=D(e,"addExtensions",t);return r?[e,...zo(r())]:e}).flat(10)}function Bo(n,e){const t=tn.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function fu(n){return typeof n=="function"}function F(n,e=void 0,...t){return fu(n)?e?n.bind(e)(...t):n(...t):n}function Eb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function vn(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),r=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function hu(n){const e=[],{nodeExtensions:t,markExtensions:r}=vn(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return n.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage,extensions:s},u=D(c,"addGlobalAttributes",d);if(!u)return;u().forEach(f=>{let p;Array.isArray(f.types)?p=f.types:f.types==="*"?p=l:f.types==="nodes"?p=o:f.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(f.attributes).forEach(([y,v])=>{e.push({type:g,name:y,attribute:{...i,...v}})})})})}),s.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage},u=D(c,"addAttributes",d);if(!u)return;const h=u();Object.entries(h).forEach(([f,p])=>{const g={...i,...p};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:c.name,name:f,attribute:g})})}),e}function Ab(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let a=0;a<o;a+=1){const l=n[a];if(l==="'"&&!s){r=!r,t+=l;continue}if(l==='"'&&!r){s=!s,t+=l;continue}if(!r&&!s){if(l==="("){i+=1,t+=l;continue}if(l===")"&&i>0){i-=1,t+=l;continue}if(l===";"&&i===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function pl(n){const e=[],t=Ab(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),l=i.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function G(...n){return n.filter(e=>!!e).reduce((e,t)=>
vendor: 37,559 bytes, lines 113-156
113{const r={...e};return Object.entries(t).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(d=>!l.includes(d));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=new Map([...pl(r[s]),...pl(i)]);r[s]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[s]=i}),r},{})}function Kr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>G(t,r),{})}function Ob(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function ml(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Ob(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function gl(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Eb(t)?!1:t!=null))}function yl(n){var e,t;const r={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(r.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function Db(n,e){var t;const r=hu(n),{nodeExtensions:s,markExtensions:i}=vn(n),o=(t=s.find(c=>D(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(s.map(c=>{const d=r.filter(v=>v.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((v,b)=>{const C=D(b,"extendNodeSchema",u);return{...v,...C?C(c):{}}},{}),f=gl({...h,content:F(D(c,"content",u)),marks:F(D(c,"marks",u)),group:F(D(c,"group",u)),inline:F(D(c,"inline",u)),atom:F(D(c,"atom",u)),selectable:F(D(c,"selectable",u)),draggable:F(D(c,"draggable",u)),code:F(D(c,"code",u)),whitespace:F(D(c,"whitespace",u)),linebreakReplacement:F(D(c,"linebreakReplacement",u)),defining:F(D(c,"defining",u)),isolating:F(D(c,"isolating",u)),attrs:Object.fromEntries(d.map(yl))}),p=F(D(c,"parseHTML",u));p&&(f.parseDOM=p.map(v=>ml(v,d)));const g=D(c,"renderHTML",u);g&&(f.toDOM=v=>g({node:v,HTMLAttributes:Kr(v,d)}));const y=D(c,"renderText",u);return y&&(f.toText=y),[c.name,f]})),l=Object.fromEntries(i.map(c=>{const d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((y,v)=>{const b=D(v,"extendMarkSchema",u);return{...y,...b?b(c):{}}},{}),f=gl({...h,inclusive:F(D(c,"inclusive",u)),excludes:F(D(c,"excludes",u)),group:F(D(c,"group",u)),spanning:F(D(c,"spanning",u)),code:F(D(c,"code",u)),attrs:Object.fromEntries(d.map(yl))}),p=F(D(c,"parseHTML",u));p&&(f.parseDOM=p.map(y=>ml(y,d)));const g=D(c,"renderHTML",u);return g&&(f.toDOM=y=>g({mark:y,HTMLAttributes:Kr(y,d)})),[c.name,f]}));return new Xc({topNode:o,nodes:a,marks:l})}function Rb(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function jn(n){return n.sort((t,r)=>{const s=D(t,"priority")||100,i=D(r,"priority")||100;return s>i?-1:s<i?1:0})}function pu(n){const e=jn(zo(n)),t=Rb(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function mu(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
114
115`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,s,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=i);const f=o==null?void 0:o[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)==null?void 0:h.slice(Math.max(r,c)-c,s-c))}),a}function Ib(n,e){const t={from:0,to:n.content.size};return mu(n,t,e)}function gu(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Pb(n,e){const t=ee(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function yu(n,e){const t=js(typeof e=="string"?e:e.name,n.schema);return t==="node"?Pb(n,e):t==="mark"?du(n,e):{}}function Lb(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function jb(n){const e=Lb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,o)=>o!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function vu(n){const{mapping:e,steps:t}=n,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}=t[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),d=e.slice(i).map(l),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),jb(r)}function Fo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=t.resolve(n),o=_o(i,s.type);o&&r.push({mark:s,...o})}):t.nodesBetween(n,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var _b=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]};function wn(n,e){return e.nodes[n]||e.marks[n]||null}function Tr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var zb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const d=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),t};function Vi(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?ut(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Wr(u.attrs,t,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(g,y)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const v=Math.max(f,y),b=Math.min(p,y+g.nodeSize),C=b-v;o+=C,a.push(...g.marks.map(M=>({mark:M,from:v,to:b})))})}),o===0)return!1;const l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Wr(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function Bb(n,e,t={}){if(!e)return Et(n,null,t)||Vi(n,null,t);const r=js(e,n.schema);return r==="node"?Et(n,e,t):r==="mark"?Vi(n,e,t):!1}var Fb=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=_s(a=>a.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Hb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function vl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function bl(n,e){const{nodeExtensions:t}=vn(e),r=t.find(o=>o.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=F(D(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function zs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return!/\S/.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(zs(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function bu(n){return n instanceof I}var xu=class ku{constructor(e){this.position=e}static fromJSON(e){return new ku(e.position)}toJSON(){return{position:this.position}}};function $b(n,e){const t=e.mapping.mapResult(n.position);return{position:new xu(t.pos),mapResult:t}}function Vb(n){return new xu(n)}function Wb(n,e,t){var r;const{selection:s}=e;let i=null;if(ou(s)&&(i=s.$cursor),i){const a=(r=n.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));c=f&&p}return!c}),c})}var Ub=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,l=ut(n,r.schema);if(s)if(o){const c=du(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),g=Math.min(f+h.nodeSize,u);h.marks.find(v=>v.type===l)?h.marks.forEach(v=>{l===v.type&&t.addMark(p,g,l.create({...v.attrs,...e}))}):t.addMark(p,g,l.create(e))})});return Wb(r,t,l)},Kb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),qb=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=ee(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Da(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Da(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Jb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ht(n,0,r.content.size),i=I.create(r,s);e.setSelection(i)}return!0},Gb=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},Yb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=L.atStart(r).from,a=L.atEnd(r).to,l=Ht(s,o,a),c=Ht(i,o,a),d=L.create(r,l,c);e.setSelection(d)}return!0},Xb=n=>({state:e,dispatch:t})=>{const r=ee(n,e.schema);return Wy(r)(e,t)};function xl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e==null?void 0:e.includes(s.type.name));n.tr.ensureMarks(r)}}var Qb=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,d=Tr(c,a.node().type.name,a.node().attrs);if(i instanceof I&&i.node.isBlock)return!a.parentOffset||!cn(o,a.pos)?!1:(r&&(n&&xl(t,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:Mb(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=cn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&cn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(i instanceof L&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&xl(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},Zb=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{var o;const a=ee(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=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 v=k.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-b;A>=l.depth-3;A-=1)v=k.from(l.node(A).copy(v));const C=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,M={...Tr(h,l.node().type.name,l.node().attrs),...e},w=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(M))||void 0;v=v.append(k.from(a.createAndFill(null,w)||void 0));const E=l.before(l.depth-(b-1));t.replace(E,l.after(-C),new T(v,4-b,0));let N=-1;t.doc.nodesBetween(E,t.doc.content.size,(A,_)=>{if(N>-1)return!1;A.isTextblock&&A.content.size===0&&(N=_+1)}),N>-1&&t.setSelection(L.near(t.doc.resolve(N))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Tr(h,u.type.name,u.attrs),...e},g={...Tr(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const y=f?[{type:a,attrs:p},{type:f,attrs:g}]:[{type:a,attrs:p}];if(!cn(t.doc,l.pos,2))return!1;if(s){const{selection:v,storedMarks:b}=r,{splittableMarks:C}=i.extensionManager,M=b||v.$to.parentOffset&&v.$from.marks();if(t.split(l.pos,2,y).scrollIntoView(),!M||!s)return!0;const w=M.filter(E=>C.includes(E.type.name));t.ensureMarks(w)}return!0},hi=(n,e)=>{const t=_s(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Dt(n.doc,t.pos)&&n.join(t.pos),!0},pi=(n,e)=>{const t=_s(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Dt(n.doc,r)&&n.join(r),!0},ex=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=s.extensionManager,f=ee(n,o.schema),p=ee(e,o.schema),{selection:g,storedMarks:y}=o,{$from:v,$to:b}=g,C=v.blockRange(b),M=y||g.$to.parentOffset&&g.$from.marks();if(!C)return!1;const w=_s(E=>bl(E.type.name,u))(g);if(C.depth>=1&&w&&C.depth-w.depth<=1){if(w.node.type===f)return c.liftListItem(p);if(bl(w.node.type.name,u)&&f.validContent(w.node.content)&&a)return l().command(()=>(i.setNodeMarkup(w.pos,f),!0)).command(()=>hi(i,f)).command(()=>pi(i,f)).run()}return!t||!M||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>hi(i,f)).command(()=>pi(i,f)).run():l().command(()=>{const E=d().wrapInList(f,r),N=M.filter(A=>h.includes(A.type.name));return i.ensureMarks(N),E?!0:c.clearNodes()}).wrapInList(f,r).command(()=>hi(i,f)).command(()=>pi(i,f)).run()},tx=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=ut(n,r.schema);return Vi(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},nx=(n,e,t={})=>({state:r,commands:s})=>{const i=ee(n,r.schema),o=ee(e,r.schema),a=Et(r,i,t);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,...t})},rx=(n,e={})=>({state:t,commands:r})=>{const s=ee(n,t.schema);return Et(t,s,e)?r.lift(s):r.wrapIn(s,e)},sx=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.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,n.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},ix=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:s}=t;return r||e&&s.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},ox=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=ut(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!s)return!0;if(d&&o){let{from:h,to:f}=a;const p=(i=c.marks().find(y=>y.type===l))==null?void 0:i.attrs,g=_o(c,l,p);g&&(h=g.from,f=g.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},ax=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},lx=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=js(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=ee(n,r.schema)),a==="mark"&&(o=ut(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let h,f,p,g;t.selection.empty?r.doc.nodesBetween(d,u,(y,v)=>{i&&i===y.type&&(l=!0,p=Math.max(v,d),g=Math.min(v+y.nodeSize,u),h=v,f=y)}):r.doc.nodesBetween(d,u,(y,v)=>{v<d&&i&&i===y.type&&(l=!0,p=Math.max(v,d),g=Math.min(v+y.nodeSize,u),h=v,f=y),v>=d&&v<=u&&(i&&i===y.type&&(l=!0,s&&t.setNodeMarkup(v,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(b=>{if(o===b.type&&(l=!0,s)){const C=Math.max(v,d),M=Math.min(v+y.nodeSize,u);t.addMark(C,M,o.create({...b.attrs,...e}))}}))}),f&&(h!==void 0&&s&&t.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(y=>{o===y.type&&s&&t.addMark(p,g,o.create({...y.attrs,...e}))}))}),l},cx=(n,e={})=>({state:t,dispatch:r})=>{const s=ee(n,t.schema);return _y(s,e)(t,r)},dx=(n,e={})=>({state:t,dispatch:r})=>{const s=ee(n,t.schema);return zy(s,e)(t,r)},ux=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Bs=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},fx=(n,e)=>{if(jo(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function gr(n){var e;const{editor:t,from:r,to:s,text:i,rules:o,plugin:a}=n,{view:l}=t;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(h=>h.type.spec.code))return!1;let d=!1;const u=zb(c)+i;return o.forEach(h=>{if(d)return;const f=fx(u,h.find);if(!f)return;const p=l.state.tr,g=Ps({state:l.state,transaction:p}),y={from:r-(f[0].length-i.length),to:s},{commands:v,chain:b,can:C}=new Ls({editor:t,state:g});h.handler({state:g,range:y,match:f,commands:v,chain:b,can:C})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:s,text:i}),l.dispatch(p),d=!0)}),d}function hx(n){const{editor:e,rules:t}=n,r=new K({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:d}=l;typeof d=="string"?d=d:d=Bo(k.from(d),o.schema);const{from:u}=l,h=u+d.length;gr({editor:e,from:u,to:h,text:d,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return gr({editor:e,from:i,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&gr({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?gr({editor:e,from:o.pos,to:o.pos,text:`
116`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function px(n){return Object.prototype.toString.call(n).slice(8,-1)}function yr(n){return px(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Su(n,e){const t={...n};return yr(n)&&yr(e)&&Object.keys(e).forEach(r=>{yr(e[r])&&yr(n[r])?t[r]=Su(n[r],e[r]):t[r]=e[r]}),t}var Ho=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...F(D(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...F(D(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Su(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},It=class wu extends Ho{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new wu(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.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 t=typeof e=="function"?e():e;return super.extend(t)}};function mx(n){return typeof n=="number"}var gx=class{constructor(n){this.find=n.find,this.handler=n.handler}},yx=(n,e,t)=>{if(jo(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=n,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 vx(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new Ls({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,s,(f,p)=>{var g,y,v,b,C;if((y=(g=f.type)==null?void 0:g.spec)!=null&&y.code||!(f.isText||f.isTextblock||f.isInline))return;const M=(C=(b=(v=f.content)==null?void 0:v.size)!=null?b:f.nodeSize)!=null?C:0,w=Math.max(r,p),E=Math.min(s,p+M);if(w>=E)return;const N=f.isText?f.text||"":f.textBetween(w-p,E-p,void 0,"");yx(N,i.find,o).forEach(_=>{if(_.index===void 0)return;const Y=w+_.index+1,Fe=Y+_[0].length,Oe={from:t.tr.mapping.map(Y),to:t.tr.mapping.map(Fe)},me=i.handler({state:t,range:Oe,match:_,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(me)})}),u.every(f=>f!==null)}var vr=null,bx=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function xx(n){const{editor:e,rules:t}=n;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:d,from:u,to:h,rule:f,pasteEvt:p})=>{const g=d.tr,y=Ps({state:d,transaction:g});if(!(!vx({editor:e,state:y,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new K({view(u){const h=p=>{var g;r=(g=u.dom.parentElement)!=null&&g.contains(p.target)?u.dom.parentElement:null,r&&(vr=e)},f=()=>{vr&&(vr=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(i=r===u.dom.parentElement,a=h,!i){const f=vr;f!=null&&f.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],g=p.getMeta("uiEvent")==="paste"&&!s,y=p.getMeta("uiEvent")==="drop"&&!i,v=p.getMeta("applyPasteRules"),b=!!v;if(!g&&!y&&!b)return;if(b){let{text:w}=v;typeof w=="string"?w=w:w=Bo(k.from(w),f.schema);const{from:E}=v,N=E+w.length,A=bx(w);return l({rule:d,state:f,from:E,to:{b:N},pasteEvt:A})}const C=h.doc.content.findDiffStart(f.doc.content),M=h.doc.content.findDiffEnd(f.doc.content);if(!(!mx(C)||!M||C===M.b))return l({rule:d,state:f,from:C,to:M,pasteEvt:o})}}))}var Fs=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=pu(n),this.schema=Db(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:wn(e.name,this.schema)},r=D(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return jn([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:wn(r.name,this.schema)},i=[],o=D(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&D(r,"exitable",s)&&(a.ArrowRight=()=>It.handleExit({editor:n,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:n})]));a={...a,...h}}const l=Iv(a);i.push(l);const c=D(r,"addInputRules",s);if(vl(r,n.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=hx({editor:n,rules:h}),p=Array.isArray(f)?f:[f];i.push(...p)}}const d=D(r,"addPasteRules",s);if(vl(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const f=xx({editor:n,rules:h});i.push(...f)}}const u=D(r,"addProseMirrorPlugins",s);if(u){const h=u();i.push(...h)}return i})}get attributes(){return hu(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=vn(this.extensions);return Object.fromEntries(e.filter(t=>!!D(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ee(t.name,this.schema)},i=D(t,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,d,u,h)=>{const f=Kr(l,r);return o({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:n,extension:t,HTMLAttributes:f})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return jn([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:wn(s.name,this.schema)},o=D(s,"dispatchTransaction",i);return o?a=>{o.call(i,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return jn([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:wn(s.name,this.schema)},o=D(s,"transformPastedHTML",i);return o?(a,l)=>{const c=r(a,l);return o.call(i,c)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=vn(this.extensions);return Object.fromEntries(e.filter(t=>!!D(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ut(t.name,this.schema)},i=D(t,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const d=Kr(a,r);return i()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{Lx(a,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:wn(e.name,this.schema)};e.type==="mark"&&((t=F(D(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=D(e,"onBeforeCreate",r),i=D(e,"onCreate",r),o=D(e,"onUpdate",r),a=D(e,"onSelectionUpdate",r),l=D(e,"onTransaction",r),c=D(e,"onFocus",r),d=D(e,"onBlur",r),u=D(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),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};Fs.resolve=pu;Fs.sort=jn;Fs.flatten=zo;var kx={};Lo(kx,{ClipboardTextSerializer:()=>Mu,Commands:()=>Nu,Delete:()=>Tu,Drop:()=>Eu,Editable:()=>Au,FocusEvents:()=>Du,Keymap:()=>Ru,Paste:()=>Iu,Tabindex:()=>Pu,TextDirection:()=>Lu,focusEventsPluginKey:()=>Ou});var H=class Cu extends Ho{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Cu(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Mu=H.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new K({key:new ne("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(d=>d.$from.pos)),a=Math.max(...i.map(d=>d.$to.pos)),l=gu(t);return mu(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Nu=H.create({name:"commands",addCommands(){return{...su}}}),Tu=H.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,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,n))!=null?c:n.getMeta("y-sync$"))return;const d=uu(n.before,[n,...e]);vu(d).forEach(f=>{d.mapping.mapResult(f.oldRange.from).deletedAfter&&d.mapping.mapResult(f.oldRange.to).deletedBefore&&d.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,g)=>{const y=g+p.nodeSize-2,v=f.oldRange.from<=g&&y<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:f.oldRange,newRange:f.newRange,partial:!v,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((f,p)=>{var g,y;if(f instanceof Ve){const v=h.slice(p).map(f.from,-1),b=h.slice(p).map(f.to),C=h.invert().map(v,-1),M=h.invert().map(b),w=v>0?(g=d.doc.nodeAt(v-1))==null?void 0:g.marks.some(N=>N.eq(f.mark)):!1,E=(y=d.doc.nodeAt(b))==null?void 0:y.marks.some(N=>N.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:C,to:M},newRange:{from:v,to:b},partial:!!(E||w),editor:this.editor,transaction:n,combinedTransform:d})}})};(s=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Eu=H.create({name:"drop",addProseMirrorPlugins(){return[new K({key:new ne("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Au=H.create({name:"editable",addProseMirrorPlugins(){return[new K({key:new ne("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ou=new ne("focusEvents"),Du=H.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new K({key:Ou,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ru=H.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,g=p.parent.type.spec.isolating,y=u.pos-u.parentOffset,v=g&&p.parent.childCount===1?y===u.pos:B.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!v||v&&u.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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Ur()||cu()?i:s},addProseMirrorPlugins(){return[new K({key:new ne("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),s=n.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!zs(t.doc))return;const h=t.tr,f=Ps({state:t,transaction:h}),{commands:p}=new Ls({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),Iu=H.create({name:"paste",addProseMirrorPlugins(){return[new K({key:new ne("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Pu=H.create({name:"tabindex",addProseMirrorPlugins(){return[new K({key:new ne("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Lu=H.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=vn(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new K({key:new ne("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Sx=class An{constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,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 t=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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new An(t,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 An(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 An(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const c=new An(l,this.editor,s,s||o?t:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const i=s.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==t[l])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(t);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>t[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},wx=`.ProseMirror {
117  position: relative;
118}
119
120.ProseMirror {
121  word-wrap: break-word;
122  white-space: pre-wrap;
123  white-space: break-spaces;
124  -webkit-font-variant-ligatures: none;
125  font-variant-ligatures: none;
126  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
127}
128
129.ProseMirror [contenteditable="false"] {
130  white-space: normal;
131}
132
133.ProseMirror [contenteditable="false"] [contenteditable="true"] {
134  white-space: pre-wrap;
135}
136
137.ProseMirror pre {
138  white-space: pre-wrap;
139}
140
141img.ProseMirror-separator {
142  display: inline !important;
143  border: none !important;
144  margin: 0 !important;
145  width: 0 !important;
146  height: 0 !important;
147}
148
149.ProseMirror-gapcursor {
150  display: none;
151  pointer-events: none;
152  position: absolute;
153  margin: 0;
154}
155
156.ProseMirror-gapcursor:after {
157  content: "";
158  display: block;
159  position: absolute;
160  top: -2px;
161  width: 20px;
162  border-top: 1px solid black;
163  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
164}
165
166@keyframes ProseMirror-cursor-blink {
167  to {
168    visibility: hidden;
169  }
170}
171
172.ProseMirror-hideselection *::selection {
173  background: transparent;
174}
175
176.ProseMirror-hideselection *::-moz-selection {
177  background: transparent;
178}
179
180.ProseMirror-hideselection * {
181  caret-color: transparent;
182}
183
184.ProseMirror-focused .ProseMirror-gapcursor {
185  display: block;
186}`;function Cx(n,e,t){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=n,document.getElementsByTagName("head")[0].appendChild(s),s}var Mx=class extends ux{constructor(n={}){super(),this.css=null,this.className="tiptap",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,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:$b,createMappablePosition:Vb},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),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(),t=au(e,this.options.autofocus);this.editorState=ln.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){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(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}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=Cx(wx,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}
vendor: 8,518 bytes, lines 186-188
186),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:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,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(n,e){const t=fu(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;t=t.filter(o=>!o.key.startsWith(i))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[Au,Mu.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Nu,Du,Ru,Pu,Eu,Iu,Tu,Lu.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Fs(r,this)}createCommandManager(){this.commandManager=new Ls({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=$i(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(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=$i(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=t?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new nu(n,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0: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}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return yu(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return Bb(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Bo(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
187
188`,textSerializers:t={}}=n||{};return Ib(this.state.doc,{blockSeparator:e,textSerializers:{...gu(this.schema),...t}})}get isEmpty(){return zs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Sx(e,this)}get $doc(){return this.$pos(0)}};function bn(n){return new Bs({find:n.find,handler:({state:e,range:t,match:r})=>{const s=F(n.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=t.from+a.indexOf(o),d=c+o.length;if(Fo(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(g=>g===n.type&&g!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&i.delete(d,t.to),c>t.from&&i.delete(t.from+l,c);const h=t.from+l+o.length;i.addMark(t.from+l,h,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function ju(n){return new Bs({find:n.find,handler:({state:e,range:t,match:r})=>{const s=F(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let a=t.to;const l=n.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,o+r[0].length-1),i.replaceWith(d,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;i.insert(c,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:n.undoable})}function Wi(n){return new Bs({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=F(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function xn(n){return new Bs({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=F(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&So(l,n.type,i);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const g=p.filter(y=>f.includes(y.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,i).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Dt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}var Nx=n=>"touches"in n,Tx=class{constructor(n){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,d=l.clientY-this.startY;this.handleResize(c,d)},this.handleMouseUp=()=>
188{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,r,s,i,o;this.node=n.node,this.editor=n.editor,this.element=n.element,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(r=n==null?void 0:n.options)!=null&&r.directions&&(this.directions=n.options.directions),(s=n.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(i=n.options)!=null&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(o=n.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!=null?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}
188removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Nx(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),a=n.includes("bottom"),l=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+t:l&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(a?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s,i,o;if(!t){let c=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(s=this.maxSize)!=null&&s.height&&(d=Math.min(this.maxSize.height,d)),{width:c,height:d}}let a=n,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}};function Ex(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof I){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}var Ax={};Lo(Ax,{createAtomBlockMarkdownSpec:()=>Ox,createBlockMarkdownSpec:()=>Dx,createInlineMarkdownSpec:()=>Px,parseAttributes:()=>$o,parseIndentedBlocks:()=>Ui,renderNestedMarkdownContent:()=>Wo,serializeAttributes:()=>Vo});function $o(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(d=>d.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,d])=>{var u;const h=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();
vendor: 6,711 bytes, lines 188-205
188return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Vo(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Ox(n){const{nodeName:e,name:t,parseAttributes:r=$o,serializeAttributes:s=Vo,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=d=>{if(!a)return d;const u={};return a.forEach(h=>{h in d&&(u[h]=d[h])}),u};return{parseMarkdown:(d,u)=>{const h={...i,...d.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(u=d.match(h))==null?void 0:u.index;return f!==void 0?f:-1},tokenize(d,u,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=d.match(f);if(!p)return;const g=p[1]||"",y=r(g);if(!o.find(b=>!(b in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:d=>{const u=c(d.attrs||{}),h=s(u),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function Dx(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=$o,serializeAttributes:i=Vo,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const h={};return l.forEach(f=>{f in u&&(h[f]=u[f])}),h};return{parseMarkdown:(u,h)=>{let f;if(r){const g=r(u);f=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?f=h.parseChildren(u.tokens||[]):f=h.parseInline(u.tokens||[]);const p={...o,...u.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(u){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=u.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,f){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=u.match(g);if(!y)return;const[v,b=""]=y,C=s(b);let M=1;const w=v.length;let E="";const N=/^:::([\w-]*)(\s.*)?/gm,A=u.slice(w);for(N.lastIndex=0;;){const _=N.exec(A);if(_===null)break;const Y=_.index,Fe=_[1];if(!((p=_[2])!=null&&p.endsWith(":::"))){if(Fe)M+=1;else if(M-=1,M===0){const Oe=A.slice(0,Y);E=Oe.trim();const me=u.slice(0,w+Y+_[0].length);let ce=[];if(E)if(a==="block")for(ce=f.blockTokens(Oe),ce.forEach(re=>{re.text&&(!re.tokens||re.tokens.length===0)&&(re.tokens=f.inlineTokens(re.text))});ce.length>0;){const re=ce[ce.length-1];if(re.type==="paragraph"&&(!re.text||re.text.trim()===""))ce.pop();else break}else ce=f.inlineTokens(E);return{type:e,raw:me,attributes:C,content:E,tokens:ce}}}}}},renderMarkdown:(u,h)=>{const f=d(u.attrs||{}),p=i(f),g=p?` {${p}}`:"",y=h.renderChildren(u.content||[],`
189
190`);return`:::${c}${g}
191
192${y}
193
194:::`}}}function Rx(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=t.exec(n)}return e}function Ix(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Px(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=Rx,serializeAttributes:i=Ix,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(g in h){const v=h[g];if(y!==void 0&&v===y)return;f[g]=v}}),f},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(a)return f.createNode(e,p);const g=r?r(h):h.content||"";return g?f.createNode(e,p,[f.createTextNode(g)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(f),g=p==null?void 0:p.index;return g!==void 0?g:-1},tokenize(h,f,p){const g=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),y=h.match(g);if(!y)return;let v="",b="";if(a){const[,M]=y;b=M}else{const[,M,w]=y;b=M,v=w||""}const C=s(b.trim());return{type:e,raw:y[0],content:v.trim(),attributes:C}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const p=d(h.attrs||{}),g=i(p),y=g?` ${g}`:"";return a?`[${c}${y}]`:`[${c}${y}]${f}[/${c}]`}}}function Ui(n,e,t){var r,s,i,o;const a=n.split(`
195`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){d+=1,c=`${c}${h}
196`;continue}else return}const p=e.extractItemData(f),{indentLevel:g,mainContent:y}=p;c=`${c}${h}
197`;const v=[y];for(d+=1;d<a.length;){const w=a[d];if(w.trim()===""){const N=a.slice(d+1).findIndex(Y=>Y.trim()!=="");if(N===-1)break;if((((s=(r=a[d+1+N].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){v.push(w),c=`${c}${w}
198`,d+=1;continue}else break}if((((o=(i=w.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)v.push(w),c=`${c}${w}
199`,d+=1;else break}let b;const C=v.slice(1);if(C.length>0){const w=C.map(E=>E.slice(g+u)).join(`
200`);w.trim()&&(e.customNestedParser?b=e.customNestedParser(w):b=t.blockTokens(w))}const M=e.createToken(p,b);l.push(M)}if(l.length!==0)return{items:l,raw:c}}function Wo(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const s=typeof t=="function"?t(r):t,[i,...o]=n.content,a=e.renderChildren([i]);let l=`${s}${a}`;return o&&o.length>0&&o.forEach((c,d)=>{var u,h;const f=(h=(u=e.renderChild)==null?void 0:u.call(e,c,d+1))!=null?h:e.renderChildren([c]);if(f!=null){const p=f.split(`
201`).map(g=>g?e.indent(g):e.indent("")).join(`
202`);l+=c.type==="paragraph"?`
203
204${p}`:`
205${p}`}}),l}function Lx(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,o=n;s.descendants((a,l)=>{const c=i.mapping.map(l),d=i.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==u.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});i.removeMark(c,d,n.type),i.addMark(c,d,f)}}),i.docChanged&&e.view.dispatch(i)}var Ae=class _u extends Ho{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new _u(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Zt(n){return new gx({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=F(n.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=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(Fo(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>
205y===n.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(i||{})),o.removeStoredMark(n.type)}}})}var zu={exports:{}},Bu={};/**
206 * @license React
207 * use-sync-external-store-shim/with-selector.production.js
208 *
209 * Copyright (c) Meta Platforms, Inc. and affiliates.
210 *
211 * This source code is licensed under the MIT license found in the
212 * LICENSE file in the root directory of this source tree.
213 */var Hs=x,jx=bo;function _x(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var zx=typeof Object.is=="function"?Object.is:_x,Bx=jx.useSyncExternalStore,Fx=Hs.useRef,Hx=Hs.useEffect,$x=Hs.useMemo,Vx=Hs.useDebugValue;Bu.useSyncExternalStoreWithSelector=function(n,e,t,r,s){var i=Fx(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=$x(function(){function l(f){if(!c){if(c=!0,d=f,f=r(f),s!==void 0&&o.hasValue){var p=o.value;if(s(p,f))return u=p}return u=f}if(p=u,zx(d,f))return p;var g=r(f);return s!==void 0&&s(p,g)?(d=f,p):(d=f,u=g)}var c=!1,d,u,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,r,s]);var a=Bx(n,i[0],i[1]);return Hx(function(){o.hasValue=!0,o.value=a},[a]),Vx(a),a};zu.exports=Bu;var Wx=zu.exports,Ux=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Kx=({contentComponent:n})=>{const e=bo.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function qx(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:$f.createPortal(r.reactElement,r.element,t)},n.forEach(s=>s())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(s=>s())}}}var Jx=class extends Jt.Component{constructor(n){var e;super(n),this.editorContentRef=Jt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=n.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const n=this.props.editor;if(n&&!n.isDestroyed&&n.options.element){if(n.contentComponent)return;const e=this.editorContentRef.current;e.append(n.view.dom),n.setOptions({element:e}),n.contentComponent=qx(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=n.contentComponent.subscribe(()=>{this.setState(t=>t.hasContentComponentInitialized?t:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),n.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.firstChild))return;const t=document.createElement("div");t.append(e.view.dom),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:Ux(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&m.jsx(Kx,{contentComponent:n.contentComponent})]})}},Gx=x.forwardRef((n,e)=>{const t=Jt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return Jt.createElement(Jx,{key:t,innerRef:e,...n})}),Yx=Jt.memo(Gx),Xx=typeof window<"u"?x.useLayoutEffect:x.useEffect,Qx=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,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(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>
213{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Zx(n){var e;const[t]=x.useState(()=>new Qx(n.editor)),r=Wx.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:ph);return Xx(()=>t.watch(n.editor),[n.editor,t]),x.useDebugValue(r),r}var e1=!1,Ki=typeof window>"u",t1=Ki||!!(typeof window<"u"&&window.next),n1=class Fu{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Ki||t1?null:this.createEditor();if(this.options.current.immediatelyRender&&Ki&&e1)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 Mx(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=t.extensions)==null?void 0:o[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Fu.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,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))}
213,1)}};function r1(n={},e=[]){const t=x.useRef(n);t.current=n;const[r]=x.useState(()=>new n1(t)),s=bo.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(s),x.useEffect(r.onRender(e)),Zx({editor:s,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&i===0?0:i+1}),s}var s1=x.createContext({editor:null});s1.Consumer;var i1=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),o1=()=>x.useContext(i1);Jt.forwardRef((n,e)=>{const{onDragStart:t}=o1(),r=n.as||"div";return m.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});Jt.createContext({markViewContentRef:()=>{}});var qr=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},a1=/^\s*>\s$/,l1=Ae.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return qr("blockquote",{...G(this.options.HTMLAttributes,n),children:qr("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(s=>{const a=e.renderChildren([s]).split(`
214`).map(l=>l.trim()===""?t:`${t} ${l}`);r.push(a.join(`
215`))}),r.join(`
216${t}
217`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}}
vendor: 8,924 bytes, lines 217-238
217,addInputRules(){return[xn({find:a1,type:this.type})]}}),c1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,d1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,u1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,f1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,h1=It.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return qr("strong",{...G(this.options.HTMLAttributes,n),children:qr("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bn({find:c1,type:this.type}),bn({find:u1,type:this.type})]},addPasteRules(){return[Zt({find:d1,type:this.type}),Zt({find:f1,type:this.type})]}}),p1=/(^|[^`])`([^`]+)`(?!`)$/,m1=/(^|[^`])`([^`]+)`(?!`)/g,g1=It.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",G(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bn({find:p1,type:this.type})]},addPasteRules(){return[Zt({find:m1,type:this.type})]}}),mi=4,y1=/^```([a-z]+)?[\s\n]$/,v1=/^~~~([a-z]+)?[\s\n]$/,b1=Ae.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:mi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",G(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(`
218`):r=`\`\`\`${s}
219
220\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:mi,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=s,f=r.doc.textBetween(c,d,`
221`,`
222`).split(`
223`).map(p=>a+p).join(`
224`);return l.replaceWith(c,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:mi,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=i,d=i.start(),u=i.end(),f=r.doc.textBetween(d,u,`
225`,`
226`).split(`
227`);let p=0,g=0;const y=c-d;for(let E=0;E<f.length;E+=1){if(g+f[E].length>=y){p=E;break}g+=f[E].length+1}const b=((l=f[p].match(/^ */))==null?void 0:l[0])||"",C=Math.min(b.length,t);if(C===0)return!0;let M=d;for(let E=0;E<p;E+=1)M+=f[E].length+1;return a.delete(M,M+C),c-M<=C&&a.setSelection(L.create(a.doc,M)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=s,h=r.doc.textBetween(l,c,`
228`,`
229`).split(`
230`).map(f=>{var p;const g=((p=f.match(/^ */))==null?void 0:p[0])||"",y=Math.min(g.length,t);return f.slice(y)}).join(`
231`);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
232
233`);return!i||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;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)?n.commands.command(({tr:c})=>(c.setSelection(B.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[Wi({find:y1,type:this.type,getAttributes:n=>({language:n[1]})}),Wi({find:v1,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new K({key:new ne("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!t||!i)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`
234`));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(L.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),x1=Ae.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
235
236`):""}),k1=Ae.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",G(this.options.HTMLAttributes,n)]},renderText(){return`
237`},renderMarkdown:()=>`  
238`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;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:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),S1=Ae.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,G(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Wi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}}
238)\\s$`),type:this.type,getAttributes:{level:n}}))}}),w1=Ae.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",G(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Ex(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return bu(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(L.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(I.create(o.doc,l.pos)):o.setSelection(L.create(o.doc,l.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d==null?void 0:d.create();u&&(o.insert(c,u),o.setSelection(L.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ju({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,039 bytes, line 238
238ype})]}}),C1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,M1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,N1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,T1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,E1=It.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",G(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bn({find:C1,type:this.type}
238),bn({find:N1,type:this.type})]},addPasteRules(){return[Zt({find:M1,type:this.type}),Zt({find:T1,type:this.type})]}});const A1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
238hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",O1="ελ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",qi="numeric",Ji="ascii",Gi="alpha",_n="asciinumeric",On="alphanumeric",Yi="domain",Hu="emoji",D1="scheme",R1="slashscheme",gi="whitespace";function I1(n,e){return n in e||(e[n]=[]),e[n]}function $t(n,e,t){e[qi]&&(e[_n]=!0,e[On]=!0),e[Ji]&&(e[_n]=!0,e[Gi]=!0),e[_n]&&(e[On]=!0),e[Gi]&&(e[On]=!0),e[On]&&(e[Yi]=!0),e[Hu]&&(e[Yi]=!0);for(const r in e){const s=I1(r,t);s.indexOf(n)<0&&s.push(n)}}function P1(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Me(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Me.groups={};Me.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||Me.groups;let s;return e&&e.j?s=e:(s=new Me(e),t&&r&&$t(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(n[o]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||Me.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const i=e;let o,a=s.go(n);if(a?(o=new Me,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Me,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(P1(o.t,r),t);$t(i,l,r)}else t&&$t(i,t,r);o.t=i}return s.j[n]=o,o}};const z=(n,e,t,r,s)=>n.ta(e,t,r,s),q=(n,e,t,r,s)=>n.tr(e,t,r,s),kl=(n,e,t,r,s)=>n.ts(e,t,r,s),S=(n,e,t,r,s)=>n.tt(e,t,r,s),ot="WORD",Xi="UWORD",$u="ASCIINUMERICAL",Vu="ALPHANUMERICAL",er="LOCALHOST",Qi="TLD",Zi="UTLD",Er="SCHEME",an="SLASH_SCHEME",Uo="NUM",eo="WS",Ko="NL",zn="OPENBRACE",Bn="CLOSEBRACE",Jr="OPENBRACKET",Gr="CLOSEBRACKET",Yr="OPENPAREN",Xr="CLOSEPAREN",Qr="OPENANGLEBRACKET",Zr="CLOSEANGLEBRACKET",es="FULLWIDTHLEFTPAREN",ts="FULLWIDTHRIGHTPAREN",ns="LEFTCORNERBRACKET",rs="RIGHTCORNERBRACKET",ss="LEFTWHITECORNERBRACKET",is="RIGHTWHITECORNERBRACKET",as="FULLWIDTHLESSTHAN",ls="FULLWIDTHGREATERTHAN",cs="AMPERSAND",ds="APOSTROPHE",us="ASTERISK",mt="AT",fs="BACKSLASH",hs="BACKTICK",ps="CARET",vt="COLON",qo="COMMA",ms="DOLLAR",Ye="DOT",gs="EQUALS",Jo="EXCLAMATION",Pe="HYPHEN",Fn="PERCENT",ys="PIPE",vs="PLUS",bs="POUND",Hn="QUERY",Go="QUOTE",Wu="FULLWIDTHMIDDLEDOT",Yo="SEMI",Xe="SLASH",$n="TILDE",xs="UNDERSCORE",Uu="EMOJI",ks="SYM";var Ku=Object.freeze({__proto__:null,ALPHANUMERICAL:Vu,AMPERSAND:cs,APOSTROPHE:ds,ASCIINUMERICAL:$u,ASTERISK:us,AT:mt,BACKSLASH:fs,BACKTICK:hs,CARET:ps,CLOSEANGLEBRACKET:Zr,CLOSEBRACE:Bn,CLOSEBRACKET:Gr,CLOSEPAREN:Xr,COLON:vt,COMMA:qo,DOLLAR:ms,DOT:Ye,EMOJI:Uu,EQUALS:gs,EXCLAMATION:Jo,FULLWIDTHGREATERTHAN:ls,FULLWIDTHLEFTPAREN:es,FULLWIDTHLESSTHAN:as,FULLWIDTHMIDDLEDOT:Wu,FULLWIDTHRIGHTPAREN:ts,HYPHEN:Pe,LEFTCORNERBRACKET:ns,LEFTWHITECORNERBRACKET:ss,LOCALHOST:er,NL:Ko,NUM:Uo,OPENANGLEBRACKET:Qr,OPENBRACE:zn,OPENBRACKET:Jr,OPENPAREN:Yr,PERCENT:Fn,PIPE:ys,PLUS:vs,POUND:bs,QUERY:Hn,QUOTE:Go,RIGHTCORNERBRACKET:rs,RIGHTWHITECORNERBRACKET:is,SCHEME:Er,SEMI:Yo,SLASH:Xe,SLASH_SCHEME:an,SYM:ks,TILDE:$n,TLD:Qi,UNDERSCORE:xs,UTLD:Zi,UWORD:Xi,WORD:ot,WS:eo});const st=/[a-z]/,Cn=new RegExp("\\p{L}","u"),yi=new RegExp("\\p{Emoji}","u"),it=/\d/,vi=/\s/,Sl="\r",bi=`
239`,L1="️",j1="‍",xi="";let br=null,xr=null;function _1(n=[]){const e={};Me.groups=e;const t=new Me;br==null&&(br=wl(A1)),xr==null&&(xr=wl(O1)),S(t,"'",ds),S(t,"{",zn),S(t,"}",Bn),S(t,"[",Jr),S(t,"]",Gr),S(t,"(",Yr),S(t,")",Xr),S(t,"<",Qr),S(t,">",Zr),S(t,"(",es),S(t,")",ts),S(t,"「",ns),S(t,"」",rs),S(t,"『",ss),S(t,"』",is),S(t,"<",as),S(t,">",ls),S(t,"&",cs),S(t,"*",us),S(t,"@",mt),S(t,"`",hs),S(t,"^",ps),S(t,":",vt),S(t,",",qo),S(t,"$",ms),S(t,".",Ye),S(t,"=",gs),S(t,"!",Jo),S(t,"-",Pe),S(t,"%",Fn),S(t,"|",ys),S(t,"+",vs),S(t,"#",bs),S(t,"?",Hn),S(t,'"',Go),S(t,"/",Xe),S(t,";",Yo),S(t,"~",$n),S(t,"_",xs),S(t,"\\",fs),S(t,"・",Wu);const r=q(t,it,Uo,{[qi]:!0});q(r,it,r);const s=q(r,st,$u,{[_n]:!0}),i=q(r,Cn,Vu,{[On]:!0}),o=q(t,st,ot,{[Ji]:!0});q(o,it,s),q(o,st,o),q(s,it,s),q(s,st,s);const a=q(t,Cn,Xi,{[Gi]:!0});q(a,st),q(a,it,i),q(a,Cn,a),q(i,it,i),q(i,st),q(i,Cn,i);const l=S(t,bi,Ko,{[gi]:!0}),c=S(t,Sl,eo,{[gi]:!0}),d=q(t,vi,eo,{[gi]:!0});S(t,xi,d),S(c,bi,l),S(c,xi,d),q(c,vi,d),S(d,Sl),S(d,bi),q(d,vi,d),S(d,xi,d);const u=q(t,yi,Uu,{[Hu]:!0});S(u,"#"),q(u,yi,u),S(u,L1,u);const h=S(u,j1);S(h,"#"),q(h,yi,u);const f=[[st,o],[it,s]],p=[[st,null],[Cn,a],[it,i]];for(let g=0;g<br.length;g++)ft(t,br[g],Qi,ot,f);for(let g=0;g<xr.length;g++)ft(t,xr[g],Zi,Xi,p);$t(Qi,{tld:!0,ascii:!0},e),$t(Zi,{utld:!0,alpha:!0},e),ft(t,"file",Er,ot,f),ft(t,"mailto",Er,ot,f),ft(t,"http",an,ot,f),ft(t,"https",an,ot,f),ft(t,"ftp",an,ot,f),ft(t,"ftps",an,ot,f),$t(Er,{scheme:!0,ascii:!0},e),$t(an,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],b=n[g][1]?{[D1]:!0}:{[R1]:!0};y.indexOf("-")>=0?b[Yi]=!0:st.test(y)?it.test(y)?b[_n]=!0:b[Ji]=!0:b[qi]=!0,kl(t,y,y,b)}return kl(t,"localhost",er,{ascii:!0}),t.jd=new Me(ks),{start:t,tokens:Object.assign({groups:e},Ku)}}function qu(n,e){const t=z1(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=t[o].length,h++),c+=t[o].length,i+=t[o].length,o++;i-=u,o-=h,c-=u,s.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function z1(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function ft(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new Me(r),i.jr=s.slice(),n.j[l]=i),n=i}return i=new Me(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function wl(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const tr={defaultProtocol:"http",events:null,format:Cl,formatHref:Cl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Xo(n,e=null){let t=Object.assign({},tr);n&&(t=Object.assign(t,n instanceof Xo?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Xo.prototype={o:tr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:tr[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Cl(n){return n}function Ju(n,e){this.t="token",this.v=n,this.tk=e}Ju.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=tr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:u}}};function $s(n,e){class t extends Ju{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Ml=$s("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Nl=$s("text"),B1=$s("nl"),kr=$s("url",{isLink:!0,toHref(n=tr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==er&&n[1].t===vt}}),Ie=n=>new Me(n);function F1({groups:n}){const e=n.domain.concat([cs,us,mt,fs,hs,ps,ms,gs,Pe,Uo,Fn,ys,vs,bs,Xe,ks,$n,xs]),t=[ds,vt,qo,Ye,Jo,Fn,Hn,Go,Yo,Qr,Zr,zn,Bn,Gr,Jr,Yr,Xr,es,ts,ns,rs,ss,is,as,ls],r=[cs,ds,us,fs,hs,ps,ms,gs,Pe,zn,Bn,Fn,ys,vs,bs,Hn,Xe,ks,$n,xs],s=Ie(),i=S(s,$n);z(i,r,i),z(i,n.domain,i);const o=Ie(),a=Ie(),l=Ie();z(s,n.domain,o),z(s,n.scheme,a),z(s,n.slashscheme,l),z(o,r,i),z(o,n.domain,o);const c=S(o,mt);S(i,mt,c),S(a,mt,c),S(l,mt,c);const d=S(i,Ye);z(d,r,i),z(d,n.domain,i);const u=Ie();z(c,n.domain,u),z(u,n.domain,u);const h=S(u,Ye);z(h,n.domain,u);const f=Ie(Ml);z(h,n.tld,f),z(h,n.utld,f),S(c,er,f);const p=S(u,Pe);S(p,Pe,p),z(p,n.domain,u),z(f,n.domain,u),S(f,Ye,h),S(f,Pe,p);const g=S(f,vt);z(g,n.numeric,Ml);const y=S(o,Pe),v=S(o,Ye);S(y,Pe,y),z(y,n.domain,o),z(v,r,i),z(v,n.domain,o);const b=Ie(kr);z(v,n.tld,b),z(v,n.utld,b),z(b,n.domain,o),z(b,r,i),S(b,Ye,v),S(b,Pe,y),S(b,mt,c);const C=S(b,vt),M=Ie(kr);z(C,n.numeric,M);const w=Ie(kr),E=Ie();z(w,e,w),z(w,t,E),z(E,e,w),z(E,t,E),S(b,Xe,w),S(M,Xe,w);const N=S(a,vt),A=S(l,vt),_=S(A,Xe),Y=S(_,Xe);z(a,n.domain,o),S(a,Ye,v),S(a,Pe,y),z(l,n.domain,o),S(l,Ye,v),S(l,Pe,y),z(N,n.domain,w),S(N,Xe,w),S(N,Hn,w),z(Y,n.domain,w),z(Y,e,w),S(Y,Xe,w);const Fe=[[zn,Bn],[Jr,Gr],[Yr,Xr],[Qr,Zr],[es,ts],[ns,rs],[ss,is],[as,ls]];for(let Oe=0;Oe<Fe.length;Oe++){const[me,ce]=Fe[Oe],re=S(w,me);S(E,me,re),S(re,ce,w);const qe=Ie(kr);z(re,e,qe);const O=Ie();z(re,t),z(qe,e,qe),z(qe,t,O),z(O,e,qe),z(O,t,O),S(qe,ce,w),S(O,ce,w)}return S(s,er,b),S(s,Ko,B1),{start:s,tokens:Ku}}function H1(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,l=null,c=null,d=0,u=null,h=-1;for(;s<r&&!(l=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(c=l||a.go(t[s].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,s++,d++;if(h<0)s-=d,s<r&&(o.push(t[s]),s++);else{o.length>
vendor: 4,412 bytes, lines 239-242
2390&&(i.push(ki(Nl,e,o)),o=[]),s-=h,d-=h;const f=u.t,p=t.slice(s-d,s);i.push(ki(f,e,p))}}return o.length>0&&i.push(ki(Nl,e,o)),i}function ki(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const $1=typeof console<"u"&&console&&console.warn||(()=>{}),V1="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",W={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function W1(){return Me.groups={},W.scanner=null,W.parser=null,W.tokenQueue=[],W.pluginQueue=[],W.customSchemes=[],W.initialized=!1,W}function Tl(n,e=!1){if(W.initialized&&$1(`linkifyjs: already initialized - will not register custom scheme "${n}" ${V1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
2401. Must only contain digits, lowercase ASCII letters or "-"
2412. Cannot start or end with "-"
2423. "-" cannot repeat`);W.customSchemes.push([n,e])}function U1(){W.scanner=_1(W.customSchemes);for(let n=0;n<W.tokenQueue.length;n++)W.tokenQueue[n][1]({scanner:W.scanner});W.parser=F1(W.scanner.tokens);for(let n=0;n<W.pluginQueue.length;n++)W.pluginQueue[n][1]({scanner:W.scanner,parser:W.parser});return W.initialized=!0,W}function Qo(n){return W.initialized||U1(),H1(W.parser.start,n,qu(W.scanner.start,n))}Qo.scan=qu;function Gu(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Xo(t),s=Qo(n),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 Zo="[\0-   ᠎ -\u2029  ]",K1=new RegExp(Zo),q1=new RegExp(`${Zo}$`),J1=new RegExp(Zo,"g");function G1(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Y1(n){return new K({key:new ne("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=uu(t.doc,[...e]);if(vu(a).forEach(({newRange:c})=>{const d=Nb(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!q1.test(f))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const f=h.split(K1).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],g=u.pos+h.lastIndexOf(p);if(!p)return!1;const y=Qo(p).map(v=>v.toObject(n.defaultProtocol));if(!G1(y))return!1;y.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>n.validate(v.value)).filter(v=>n.shouldAutoLink(v.value)).forEach(v=>{Fo(v.from,v.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(v.from,v.to,n.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function X1(n){return new K({key:new ne("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=!1;if(n.enableClickSelection&&(o=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{let u=r.target;const h=[];for(;u.nodeName!=="DIV";)h.push(u),u=u.parentNode;a=h.find(f=>f.nodeName==="A")}if(!a)return o;const l=yu(e.state,n.type.name),c=(s=a==null?void 0:a.href)!=null?s:l.href,d=(i=a==null?void 0:a.target)!=null?i:l.target;a&&c&&(window.open(c,d),o=!0)}return o}}})}function Q1(n){return new K({key:new ne("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=Gu(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function jt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(J1,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yu=It.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 `val
242idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Tl(n);return}Tl(n.scheme,n.optionalSlashes)})},onDestroy(){W1()},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:(n,e)=>!!jt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.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:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!jt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!jt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",G(this.options.HTMLAttributes,n),0]:["a",G(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!jt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!jt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Zt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=Gu(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!jt(o,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e}
vendor: 16,561 bytes, lines 242-253
242,type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Y1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!jt(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(X1({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Q1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Z1=Yu,ek=Object.defineProperty,tk=(n,e)=>{for(var t in e)ek(n,t,{get:e[t],enumerable:!0})},nk="listItem",El="textStyle",Al=/^\s*([-+*])\s$/,Xu=Ae.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:n}){return["ul",G(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
243`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nk,this.editor.getAttributes(El)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=xn({find:Al,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=xn({find:Al,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(El),editor:this.editor})),[n]}}),Qu=Ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",G(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(s=>s.type==="paragraph"))t=e.parseChildren(n.tokens);else{const s=n.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(s.tokens)}],n.tokens.length>1){const o=n.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Wo(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),rk={};tk(rk,{findListItemPos:()=>dr,getNextListDepth:()=>ea,handleBackspace:()=>to,handleDelete:()=>no,hasListBefore:()=>Zu,hasListItemAfter:()=>sk,hasListItemBefore:()=>ef,listItemHasSubList:()=>tf,nextListIsDeeper:()=>nf,nextListIsHigher:()=>rf});var dr=(n,e)=>{const{$from:t}=e.selection,r=ee(n,e.schema);let s=null,i=t.depth,o=t.pos,a=null;for(;i>0&&a===null;)s=t.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},ea=(n,e)=>{const t=dr(n,e);if(!t)return!1;const[,r]=_b(e,n,t.$pos.pos+4);return r},Zu=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},ef=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},tf=(n,e,t)=>{if(!t)return!1;const r=ee(n,e.schema);let s=!1;return t.descendants(i=>{i.type===r&&(s=!0)}),s},to=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Et(n.state,e)&&Zu(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Et(n.state,e)||!Hb(n.state))return!1;const r=dr(e,n.state);if(!r)return!1;const i=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=tf(e,n.state,i);return ef(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},nf=(n,e)=>{const t=ea(n,e),r=dr(n,e);return!r||!t?!1:t>r.depth},rf=(n,e)=>{const t=ea(n,e),r=dr(n,e);return!r||!t?!1:t<r.depth},no=(n,e)=>{if(!Et(n.state,e)||!Fb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:nf(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():rf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},sk=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},sf=H.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&no(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&no(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&to(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&to(n,t,r)&&(e=!0)}),e}}}}),Ol=/^(\s*)(\d+)\.\s+(.*)$/,ik=/^\s/;function ok(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(Ol);if(!i)break;const[,o,a,l]=i,c=o.length;let d=l,u=t+1;const h=[s];for(;u<n.length;){const f=n[u];if(f.match(Ol))break;if(f.trim()==="")h.push(f),d+=`
244`,u+=1;else if(f.match(ik))h.push(f),d+=`
245${f.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join(`
246`)}),r=u,t=u}return[e,r]}function of(n,e,t){var r;const s=[];let i=0;for(;i<n.length;){const o=n[i];if(o.indent===e){const a=o.content.split(`
247`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.slice(1).join(`
248`).trim();if(d){const f=t.blockTokens(d);c.push(...f)}let u=i+1;const h=[];for(;u<n.length&&n[u].indent>e;)h.push(n[u]),u+=1;if(h.length>0){const f=Math.min(...h.map(g=>g.indent)),p=of(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(g=>g.raw).join(`
249`)})}s.push({type:"list_item",raw:o.raw,tokens:c}),i=u}else i+=1}return s}function ak(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var lk="listItem",Dl="textStyle",Rl=/^(\d+)\.\s$/,af=Ae.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",G(this.options.HTMLAttributes,t),0]:["ol",G(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?ak(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
250`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(`
251`),[i,o]=ok(s);if(i.length===0)return;const a=of(i,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(`
252`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(lk,this.editor.getAttributes(Dl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=xn({find:Rl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=xn({find:Rl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Dl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ck=/^\s*(\[([( |x])?\])\s$/,dk=Ae.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",G(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Wo(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var u,h;a.ariaLabel=((h=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:h.call(u,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const p=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{s.setAttribute(d,u)}),s.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([d,u])=>{s.setAttribute(d,u)}),{dom:s,contentDOM:l,update:d=>d.type!==this.type?!1:(s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[xn({find:ck,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),uk=Ae.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:n}){return["ul",G(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
253`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=Ui(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(i)},s=Ui(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});H.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Xu.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Qu.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(sf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(af.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(dk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(uk.configure(this.options.taskList)),n}});var fk=Ae.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",G(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,pk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,mk=It.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",G(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}}
vendor: 4,693 bytes, line 253
253,addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bn({find:hk,type:this.type})]},addPasteRules(){return[Zt({find:pk,type:this.type})]}}),gk=Ae.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),lf=It.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",G(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),yk=lf;function vk(n={}){return new K({view(e){return new bk(e,n)}})}class bk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.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:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(t){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),g=u?p.bottom:p.top;u&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/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 t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ld(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 J extends B{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return J.valid(r)?new J(r):B.near(r)}content(){return T.empty}eq(e){return e instanceof J&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");
vendor: 16,614 bytes, line 253
253return new J(e.resolve(t.pos))}getBookmark(){return new ta(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!xk(e)||!kk(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&J.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let l=e.doc.resolve(s);if(J.valid(l))return l}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!I.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let a=e.doc.resolve(s);if(J.valid(a))return a}return null}}}J.prototype.visible=!1;J.findFrom=J.findGapCursorFrom;B.jsonID("gapcursor",J);class ta{constructor(e){this.pos=e}map(e){return new ta(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return J.valid(t)?new J(t):B.near(t)}}function cf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function xk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||cf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function kk(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||cf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Sk(){return new K({props:{decorations:Nk,createSelectionBetween(n,e,t){return e.pos==t.pos&&J.valid(t)?new J(t):null},handleClick:Ck,handleKeyDown:wk,handleDOMEvents:{beforeinput:Mk}}})}const wk=ru({ArrowLeft:Sr("horiz",-1),ArrowRight:Sr("horiz",1),ArrowUp:Sr("vert",-1),ArrowDown:Sr("vert",1)});function Sr(n,e){const t=n=="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 L){if(!i.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=J.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new J(c))),!0):!1}}function Ck(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!J.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&I.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new J(r))),!0)}function Mk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof J))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=k.empty;for(let o=r.length-1;o>=0;o--)s=k.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new T(s,0,0));return i.setSelection(L.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function Nk(n){if(!(n.selection instanceof J))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",U.create(n.doc,[ke.widget(n.selection.head,e,{key:"gapcursor"})])}var Ss=200,le=function(){};le.prototype.append=function(e){return e.length?(e=le.from(e),!this.length&&e||e.length<Ss&&this.leafAppend(e)||this.length<Ss&&e.leafPrepend(this)||this.appendInner(e)):this};le.prototype.prepend=function(e){return e.length?le.from(e).append(this):this};le.prototype.appendInner=function(e){return new Tk(this,e)};le.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?le.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};le.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};le.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};le.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};le.from=function(e){return e instanceof le?e:e&&e.length?new df(e):le.empty};var df=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={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<=Ss)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ss)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(le);le.empty=new df([]);var Tk=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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}(le);const Ek=500;class $e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){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;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,d.push(u);return}if(s){d.push(new Qe(u.map));let f=u.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Qe(p,void 0,void 0,c.length+d.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(u.step);if(u.selection)return a=s?u.selection.map(s.slice(i)):u.selection,l=new $e(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Qe(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?i.pop():a=a.slice(0,a.length-1)),i.push(h),t&&(o++,t=void 0),s||(l=h)}let c=o-r.depth;return c>Ok&&(a=Ak(a,c),o-=c),new $e(a.append(i),o)}remapping(e,t){let r=new Jn;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,t),r}addMaps(e){return this.eventCount==0?this:new $e(this.items.append(e.map(t=>new Qe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let l=t;this.items.forEach(h=>{let f=i.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),y=h.selection&&h.selection.map(i.slice(l+1,f));y&&a++,r.push(new Qe(p,g,y))}else r.push(new Qe(p))},s);let c=[];for(let h=t;h<o;h++)c.push(new Qe(i.maps[h]));let d=this.items.slice(0,s).append(c).append(r),u=new $e(d,a);return u.emptyItemCount()>Ek&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.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(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let d=o.selection&&o.selection.map(t.slice(r));d&&i++;let u=new Qe(c.invert(),l,d),h,f=s.length-1;(h=s.length&&s[f].merge(u))?s[f]=h:s.push(u)}}else o.map&&r--},this.items.length,0),new $e(le.from(s.reverse()),i)}}$e.empty=new $e(le.empty,0);function Ak(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Qe{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Qe(t.getMap().invert(),t,this.selection)}}}class gt{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Ok=20;function Dk(n,e,t,r){let s=t.getMeta(qt),i;if(s)return s.historyState;t.getMeta(Pk)&&(n=new gt(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(qt))return o.getMeta(qt).redo?new gt(n.done.addTransform(t,void 0,r,Ar(e)),n.undone,Il(t.mapping.maps),n.prevTime,n.prevComposition):new gt(n.done,n.undone.addTransform(t,void 0,r,Ar(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Rk(t,n.prevRanges)),c=o?Si(n.prevRanges,t.mapping):Il(t.mapping.maps);return new gt(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,Ar(e)),$e.empty,c,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new gt(n.done.rebased(t,i),n.undone.rebased(t,i),Si(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new gt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Si(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Rk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function Il(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Si(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function Ik(n,e,t){let r=Ar(e),s=qt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new gt(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(qt,{redo:t,historyState:l})}let wi=!1,Pl=null;function Ar(n){let e=n.plugins;if(Pl!=e){wi=!1,Pl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){wi=!0;break}}return wi}const qt=new ne("history"),Pk=new ne("closeHistory");function Lk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new K({key:qt,state:{init(){return new gt($e.empty,$e.empty,null,0,-1)},apply(e,t,r){return Dk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?ff:r=="historyRedo"?hf:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function uf(n,e){return(t,r)=>{let s=qt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=Ik(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const ff=uf(!1,!0),hf=uf(!0,!0);H.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.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=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new K({key:new ne("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!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 n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.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,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var jk=H.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[vk(this.options)]}});H.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new K({key:new ne("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return U.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.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(ke.node(c,c+l.nodeSize,{class:this.options.className}))}),U.create(n,i)}}})]}});var _k=H.create({name:"gapCursor",addProseMirrorPlugins(){return[Sk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=F(D(n,"allowGapCursor",t)))!=null?e:null}}}),zk=H.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new K({key:new ne("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const i=this.editor.isEmpty;return n.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&zs(o);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const u=ke.node(a,a+o.nodeSize,{class:d.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(u)}return this.options.includeChildren}),U.create(n,s)}}})]}});H.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new K({key:new ne("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||bu(t.selection)||n.view.dragging?null:U.create(t.doc,[ke.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ll({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var Bk=H.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ne(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));
253return[new K({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),u=a.content.size,h=c.nodes[t];if(d)return l.insert(u,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Ll({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Ll({node:o,types:r})}}})]}}),Fk=H.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ff(n,e),redo:()=>({state:n,dispatch:e})=>hf(n,e)}},addProseMirrorPlugins(){return[Lk(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()}}}),Hk=H.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(h1.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(l1.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Xu.configure(this.options.bulletList)),this.options.code!==!1&&s.push(g1.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(b1.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(x1.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(jk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(_k.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(k1.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(S1.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(Fk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(w1.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(E1.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Qu.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(sf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Yu.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(af.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(fk.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(mk.configure(this.options.strike)),this.options.text!==!1&&s.push(gk.configure(this.options.text)),this.options.underline!==!1&&s.push(lf.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(Bk.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),$k=Hk,Vk=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Wk=Ae.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",G(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,s,i,o;const a=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",l=(s=(r=n.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=n.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:a})=>{const l=document.createElement("img");Object.entries(o).forEach(([u,h])=>{if(h!=null)switch(u){case"width":case"height":break;default:l.setAttribute(u,h);break}}),l.src=o.src;const c=new Tx({element:l,editor:a,node:s,getPos:i,onResize:(u,h)=>{l.style.width=`${u}px`,l.style.height=`${h}px`},onCommit:(u,h)=>{const f=i();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:u,height:h}).run()},onUpdate:(u,h,f)=>u.type===s.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),d=c.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},c}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}
vendor: 5,640 bytes, line 253
253,addInputRules(){return[ju({find:Vk,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Uk=Wk,Kk=zk,qk=H.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Jk=qk,Gk=20,pf=(n,e=0)=>{const t=[];return!n.children.length||e>Gk||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...pf(r,e+1))}),t},Yk=n=>{if(!n.children.length)return;const e=pf(n);e&&e.forEach(t=>{var r,s;const i=t.getAttribute("style"),o=(s=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:s.getAttribute("style");t.setAttribute("style",`${o};${i}`)})},mf=It.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Yk(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",G(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),Xk=H.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const i=r[s].split(":");if(i.length>=2){const o=i[0].trim().toLowerCase(),a=i.slice(1).join(":").trim();if(o==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Qk=H.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const i=r[s].split(":");if(i.length>=2){const o=i[0].trim().toLowerCase(),a=i.slice(1).join(":").trim();if(o==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Zk=H.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),eS=H.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),tS=H.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});H.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(Xk.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(Qk.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Zk.
253configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(eS.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(tS.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(mf.configure(this.options.textStyle)),n}});var nS="Separator",jl="horizontal",rS=["horizontal","vertical"],gf=x.forwardRef((n,e)=>{const{decorative:t,orientation:r=jl,...s}=n,i=sS(r)?r:jl,a=t?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return m.jsx(en.div,{"data-orientation":i,...a,...s,ref:e})});gf.displayName=nS;function sS(n){return rS.includes(n)}var yf=gf;const _t=x.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},s)=>m.jsx(yf,{ref:s,decorative:t,orientation:e,className:xe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));_t.displayName=yf.displayName;const iS=({onSelect:n,triggerText:e="Insert Image",triggerIcon:t})=>{const[r,s]=x.useState(!1),[i,o]=x.useState([]),[a,l]=x.useState(!1),[c,d]=x.useState(!1),[u,h]=x.useState(!1),[f,p]=x.useState(null),{toast:g}=ws();x.useEffect(()=>{r&&y()},[r]);const y=async()=>{l(!0);const{data:w,error:E}=await ye.storage.from("blog-images").list("uploads",{limit:100,offset:0,sortBy:{column:"created_at",order:"desc"}});if(E){g({title:"Error loading images",description:E.message,variant:"destructive"}),l(!1);return}const N=(w||[]).filter(A=>A.name!==".emptyFolderPlaceholder").map(A=>{const{data:{publicUrl:_}}=ye.storage.from("blog-images").getPublicUrl(`uploads/${A.name}`);return{name:A.name,url:_,path:`uploads/${A.name}`}});o(N),l(!1)},v=async w=>{var N;const E=(N=w.target.files)==null?void 0:N[0];if(E){if(!E.type.startsWith("image/")){g({title:"Invalid file type",description:"Please upload an image file",variant:"destructive"});return}if(E.size>20*1024*1024){g({title:"File too large",description:"Please upload an image smaller than 20MB",variant:"destructive"});return}h(!0);try{const A=await Ul(E,Kl.inlineImage);h(!1),d(!0);const _=`uploads/${A.filename}`,{error:Y}=await ye.storage.from("blog-images").upload(_,A.blob);if(Y){g({title:"Upload failed",description:Y.message,variant:"destructive"}),d(!1);return}A.savings>0?g({title:"Image optimized & uploaded",description:`${Dr(A.originalSize)} → ${Dr(A.optimizedSize)} (${A.savings}% smaller)`}):g({title:"Image uploaded successfully"}),d(!1),y()}catch{h(!1),d(!1),g({title:"Optimization failed",description:"Could not process image",variant:"destructive"})}}},b=()=>{f&&(n(f),s(!1),p(null))},C=async(w,E)=>{var A;E.stopPropagation();const{error:N}=await ye.storage.from("blog-images").remove([w]);if(N){g({title:"Delete failed",description:N.message,variant:"destructive"});return}g({title:"Image deleted"}),y(),f===((A=i.find(_=>_.path===w))==null?void 0:A.url)&&p(null)},M=c||u;return m.jsxs(Ch,{open:r,onOpenChange:s,children:[m.jsx(Mh,{asChild:!0,children:m.jsx(De,{type:"button",variant:"ghost",size:"sm",className:t?"h-8 w-8 p-0":"",children:t||m.jsxs(m.Fragment,{children:[m.jsx(Ci,{className:"mr-2 h-4 w-4"}),e]})})}),m.jsxs(Nh,{className:"max-w-4xl max-h-[80vh]",children:[m.jsx(Th,{children:m.jsx(Eh,{children:"Image Library"})}),m.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[m.jsxs("label",{className:"cursor-pointer",children:[m.jsx("input",{type:"file",accept:"image/*",onChange:v,className:"hidden",disabled:M}),m.jsx(De,{type:"button",variant:"outline",disabled:M,asChild:!0,children:m.jsx("span",{children:u?m.jsxs(m.Fragment,{children:[m.jsx(Dn,{className:"mr-2 h-4 w-4 animate-spin"}),"Optimizing..."]}):c?m.jsxs(m.Fragment,{children:[m.jsx(Dn,{className:"mr-2 h-4 w-4 animate-spin"}),"Uploading..."]}):m.jsxs(m.Fragment,{children:[m.jsx(Vl,{className:"mr-2 h-4 w-4"}),"Upload New Image"]})})})]}),m.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[m.jsx(Wl,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Images auto-optimized to WebP (max 1200px)"})]})]}),m.jsx(Ah,{className:"h-[400px] rounded-md border p-4",children:a?m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx(Dn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[m.jsx(Ci,{className:"h-12 w-12 mb-4 opacity-50"}),m.jsx("p",{children:"No images uploaded yet"})]}):m.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-4",children:i.map(w=>m.jsxs("div",{className:xe("relative group cursor-pointer rounded-lg overflow-hidden border-2 transition-all",f===w.url?"border-accent ring-2 ring-accent/50":"border-transparent hover:border-muted-foreground
253/30"),onClick:()=>p(w.url),children:[m.jsx("img",{src:w.url,alt:w.name,className:"w-full aspect-square object-cover"}),f===w.url&&m.jsx("div",{className:"absolute inset-0 bg-accent/20 flex items-center justify-center",children:m.jsx(Vf,{className:"h-8 w-8 text-accent"})}),m.jsx(De,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:E=>C(w.path,E),children:m.jsx(ql,{className:"h-3 w-3"})})]},w.path))})}),m.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[m.jsx(De,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),m.jsx(De,{type:"button",onClick:b,disabled:!f,children:"Insert Image"})]})]})]})},oS=[{value:"default",label:"Default"},{value:"12px",label:"12px"},{value:"14px",label:"14px"},{value:"16px",label:"16px"},{value:"18px",label:"18px"},{value:"20px",label:"20px"},{value:"24px",label:"24px"},{value:"28px",label:"28px"},{value:"32px",label:"32px"}],se=({onClick:n,isActive:e=!1,disabled:t=!1,children:r,title:s})=>m.jsx(De,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:t,title:s,className:xe("h-8 w-8 p-0",e&&"bg-muted text-foreground"),children:r}),aS=({content:n,onChange:e,placeholder:t="Start writing...",className:r,error:s})=>{const i=x.useRef(n),o=x.useRef(!1),a=r1({extensions:[$k.configure({heading:{levels:[1,2,3]}}),Uk.configure({HTMLAttributes:{class:"max-w-full h-auto rounded-lg"},allowBase64:!0}),Z1.configure({openOnClick:!1,HTMLAttributes:{class:"text-accent underline"}}),Kk.configure({placeholder:t}),yk,mf,Jk.configure({types:["heading","paragraph"]})],content:n,onUpdate:({editor:d})=>{o.current=!0;const u=d.getHTML();e(u),queueMicrotask(()=>{o.current=!1})},editorProps:{attributes:{class:"prose prose-sm sm:prose-base max-w-none focus:outline-none min-h-[400px] p-4"},handleDrop:(d,u,h,f)=>{var p,g;return!f&&((g=(p=u.dataTransfer)==null?void 0:p.files)!=null&&g.length),!1}}});x.useEffect(()=>{a&&(o.current||n!==i.current&&(i.current=n,a.commands.setContent(n,{emitUpdate:!1})))},[n,a]);const l=x.useCallback(d=>{a&&a.chain().focus().setImage({src:d}).run()},[a]),c=x.useCallback(()=>{if(!a)return;const d=a.getAttributes("link").href,u=window.prompt("Enter URL:",d);if(u!==null){if(u===""){a.chain().focus().extendMarkRange("link").unsetLink().run();return}a.chain().focus().extendMarkRange("link").setLink({href:u}).run()}},[a]);return a?m.jsxs("div",{className:xe("border rounded-md overflow-hidden bg-background",s&&"border-destructive",r),children:[m.jsxs("div",{className:"border-b bg-muted/30 p-2 flex flex-wrap gap-1 items-center",children:[m.jsx(se,{onClick:()=>a.chain().focus().undo().run(),disabled:!a.can().undo(),title:"Undo",children:m.jsx(Zh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().redo().run(),disabled:!a.can().redo(),title:"Redo",children:m.jsx(Gh,{className:"h-4 w-4"})}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsxs(bh,{value:a.getAttributes("textStyle").fontSize||"default",onValueChange:d=>{d==="default"?a.chain().focus().unsetMark("textStyle").run():a.chain().focus().setMark("textStyle",{fontSize:d}).run()},children:[m.jsx(xh,{className:"h-8 w-[90px] text-xs",children:m.jsx(kh,{placeholder:"Size"})}),m.jsx(Sh,{className:"bg-background",children:oS.map(d=>m.jsx(wh,{value:d.value,children:d.label},d.value))})]}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsx(se,{onClick:()=>a.chain().focus().toggleBold().run(),isActive:a.isActive("bold"),title:"Bold",children:m.jsx(zh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleItalic().run(),isActive:a.isActive("italic"),title:"Italic",children:m.jsx(Vh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleUnderline().run(),isActive:a.isActive("underline"),title:"Underline",children:m.jsx(Qh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleStrike().run(),isActive:a.isActive("strike"),title:"Strikethrough",children:m.jsx(Xh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleCode().run(),isActive:a.isActive("code"),title:"Inline C
253ode",children:m.jsx(Bh,{className:"h-4 w-4"})}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsx(se,{onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),isActive:a.isActive("heading",{level:1}),title:"Heading 1",children:m.jsx(Fh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),isActive:a.isActive("heading",{level:2}),title:"Heading 2",children:m.jsx(Hh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleHeading({level:3}).run(),isActive:a.isActive("heading",{level:3}),title:"Heading 3",children:m.jsx($h,{className:"h-4 w-4"})}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsx(se,{onClick:()=>a.chain().focus().setTextAlign("left").run(),isActive:a.isActive({textAlign:"left"}),title:"Align Left",children:m.jsx(jh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().setTextAlign("center").run(),isActive:a.isActive({textAlign:"center"}),title:"Align Center",children:m.jsx(Lh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().setTextAlign("right").run(),isActive:a.isActive({textAlign:"right"}),title:"Align Right",children:m.jsx(_h,{className:"h-4 w-4"})}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsx(se,{onClick:()=>a.chain().focus().toggleBulletList().run(),isActive:a.isActive("bulletList"),title:"Bullet List",children:m.jsx(Kh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleOrderedList().run(),isActive:a.isActive("orderedList"),title:"Numbered List",children:m.jsx(Uh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().toggleBlockquote().run(),isActive:a.isActive("blockquote"),title:"Quote",children:m.jsx(Jh,{className:"h-4 w-4"})}),m.jsx(se,{onClick:()=>a.chain().focus().setHorizontalRule().run(),title:"Horizontal Rule",children:m.jsx(qh,{className:"h-4 w-4"})}),m.jsx(_t,{orientation:"vertical",className:"h-6 mx-1"}),m.jsx(se,{onClick:c,isActive:a.isActive("link"),title:"Add Link",children:m.jsx(Wh,{className:"h-4 w-4"})}),m.jsx(iS,{onSelect:l,triggerText:"",triggerIcon:m.jsx(Ci,{className:"h-4 w-4"})})]}),m.jsx(Yx,{editor:a})]}):m.jsx("div",{className:"border rounded-md p-4 min-h-[400px] animate-pulse bg-muted/50"})},lS=Ih({title:ur().trim().min(1,"Title is required").max(200,"Title must be less than 200 characters"),slug:ur().trim().min(1,"Slug is required").max(200,"Slug must be less than 200 characters").regex(/^[a-z0-9-]+$/,"Slug can only contain lowercase letters, numbers, and hyphens"),content:ur().trim().min(1,"Content is required").max(5e4,"Content must be less than 50,000 characters"),excerpt:ur().trim().max(500,"Excerpt must be less than 500 characters").optional().or(Ph(""))}),cS=n=>n.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim(),dS=n=>{const t=n.trim().split(/\s+/).filter(r=>r.length>0).length;return Math.max(1,Math.ceil(t/200))},PS=()=>{const{id:n}=Wf(),e=!!n,{user:t,loading:r}=Uf(),{isAdmin:s,loading:i}=Kf(),o=qf(),a=Jf(),{toast:l}=ws(),[c,d]=x.useState(""),[u,h]=x.useState(""),[f,p]=x.useState(""),[g,y]=x.useState(""),[v,b]=x.useState(""),[C,M]=x.useState(""),[w,E]=x.useState(null),[N,A]=x.useState(""),[_,Y]=x.useState(""),[Fe,Oe]=x.useState("draft"),[me,ce]=x.use
253State(),[re,qe]=x.useState(e),[O,R]=x.useState(!1),[Q,He]=x.useState({}),[Pt,na]=x.useState([]);x.useEffect(()=>{!r&&!t&&o("/auth")},[t,r,o]),x.useEffect(()=>{!i&&!s&&t&&(l({title:"Access Denied",description:"You don't have permission to access this page.",variant:"destructive"}),o("/"))},[s,i,t,o,l]),x.useEffect(()=>{e&&s&&vf()},[n,s]);const vf=async()=>{const{data:j,error:de}=await ye.from("blog_posts").select("*").eq("id",n).maybeSingle();if(de){l({title:"Error fetching post",description:de.message,variant:"destructive"}),o("/admin/blog");return}if(!j){l({title:"Post not found",variant:"destructive"}),o("/admin/blog");return}d(j.title),h(j.slug),p(j.content),y(j.excerpt||""),b(j.meta_title||""),M(j.meta_description||""),E(j.featured_image||null),A(j.featured_image_alt||""),Y(j.featured_image_caption||""),Oe(j.status),j.published_date&&ce(new Date(j.published_date));const{data:tt}=await ye.from("blog_post_labels").select("label_id").eq("post_id",n);if(tt&&tt.length>0){const Je=tt.map(Ge=>Ge.label_id),{data:Lt}=await ye.from("blog_labels").select("*").in("id",Je);Lt&&na(Lt)}qe(!1)},bf=j=>{d(j),Q.title&&He(de=>({...de,title:void 0})),(!e||!u)&&h(cS(j))},xf=j=>{h(j),Q.slug&&He(de=>({...de,slug:void 0}))},kf=j=>{p(j),Q.content&&He(de=>({...de,content:void 0}))},Sf=j=>{y(j),Q.excerpt&&He(de=>({...de,excerpt:void 0}))},wf=()=>{const j=lS.safeParse({title:c,slug:u,content:f,excerpt:g||void 0});if(!j.success){const de={};return j.error.errors.forEach(tt=>{const Je=tt.path[0];de[Je]||(de[Je]=tt.message)}),He(de),!1}return He({}),!0},ra=async(j=!1)=>{if(!wf()){l({title:"Please fix validation errors",variant:"destructive"});return}R(!0);const de=j?"published":Fe,tt={title:c.trim(),slug:u.trim(),content:f.trim(),excerpt:g.trim()||null,meta_title:v.trim()||null,meta_description:C.trim()||null,featured_image:w,featured_image_alt:N.trim()||null,featured_image_caption:_.trim()||null,status:de,published_date:de==="published"&&!me?new Date().toISOString().split("T")[0]:me?me.toISOString().split("T")[0]:null};let Je,Lt=n;if(e){const{error:Ge}=await ye.from("blog_posts").update(tt).eq("id",n);Je=Ge}else{const{data:Ge,error:Vs}=await ye.from("blog_posts").insert({...tt,author_id:t.id}).select("id").single();Je=Vs,Ge&&(Lt=Ge.id)}if(Je){R(!1),Je.message.includes("duplicate key")?(He(Ge=>({...Ge,slug:"This slug is already in use"})),l({title:"Slug already exists",description:"Please choose a different slug",variant:"destructive"})):l({title:"Error saving post",description:Je.message,variant:"destructive"});return}if(Lt&&(await ye.from("blog_post_labels").delete().eq("post_id",Lt),Pt.length>0)){const Ge=Pt.map(Vs=>({post_id:Lt,label_id:Vs.id}));await ye.from("blog_post_labels").insert(Ge)}R(!1),a.invalidateQueries({queryKey:["blog-posts"]}),a.invalidateQueries({queryKey:["blog-labels"]}),l({title:e?"Post updated":"Post created"}),o("/admin/blog")},Cf=async()=>{const{error:j}=await ye.from("blog_posts").delete().eq("id",n);j?l({title:"Error deleting post",description:j.message,variant:"destructive"}):(a.invalidateQueries({queryKey:["blog-posts"]}),l({title:"Post deleted"}),o("/admin/blog"))};return r||re?m.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:m.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading..."})}):m.jsxs("div",{className:"min-h-screen flex flex-col",children:[m.jsx(Gf,{title:e?"Edit Post":"New Post",description:"Blog post editor"}),m.jsx(Yf,{}),m.jsx("main",{className:"flex-1 py-12",children:m.jsxs("div",{className:"container mx-auto px-4 lg:px-8",children:[m.jsxs("button",{onClick:()=>o("/admin/blog"),className:"flex items-center text-muted-foreground hover:text-accent mb-6 transition-colors",children:[m.jsx(Oh,{className:"mr-2 h-4 w-4"}),"Back to Blog Management"]}),m.jsx("h1",{className:"text-3xl font-bold mb-8",children:e?"Edit Post":"New Post"}),m.jsxs("div",{className:"grid lg:grid-cols-[1fr_350px] gap-8",children:[m.jsxs("div",{className:"space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"title",className:"text-lg",children:"Title"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length,"/200"]})]}),m.jsx(Mn,{id:"title",value:c,onChange:j=>bf(j.target.value),placeholder:"Enter post title...",className:xe("text-xl h-14",Q.title&&"border-destructive"),maxLength:200}),Q.title&&m.jsx("p",{className:"text-sm text-destructive",children:Q.title})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"slug",children:"Slug"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.length,"/200"]})]}),m.jsx(Mn,{id:"slug",value:u,onChange:j=>xf(j.target.value),placeholder:"post-url-slug",className:xe("font-mono text-sm",Q.slug&&"border-destructive"),maxLength:200}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:["URL: /blog/",u||"your-slug-here"]}),Q.slug&&m.jsx("p",{className:"text-sm text-destructive",children:Q.slug})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"content",className:"text-lg",children:"Content"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[f.length.toLocaleStr
253ing(),"/50,000"]})]}),m.jsx(aS,{content:f,onChange:kf,placeholder:"Start writing your blog post...",error:!!Q.content}),Q.content&&m.jsx("p",{className:"text-sm text-destructive",children:Q.content})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"excerpt",children:"Excerpt"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[g.length,"/500"]})]}),m.jsx(Ws,{id:"excerpt",value:g,onChange:j=>Sf(j.target.value),placeholder:"Brief summary of the post (optional)...",className:xe("min-h-[100px]",Q.excerpt&&"border-destructive"),maxLength:500}),Q.excerpt&&m.jsx("p",{className:"text-sm text-destructive",children:Q.excerpt})]})]}),m.jsxs("div",{className:"lg:border-l lg:pl-8 space-y-6",children:[m.jsxs("div",{className:"space-y-4",children:[m.jsx(ue,{className:"text-lg",children:"Featured Image"}),m.jsx(fg,{value:w,onChange:E}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs(ue,{htmlFor:"featuredImageAlt",className:"text-sm",children:["Alt Text ",m.jsx("span",{className:"text-muted-foreground",children:"(for accessibility)"})]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.length,"/150"]})]}),m.jsx(Mn,{id:"featuredImageAlt",value:N,onChange:j=>A(j.target.value),placeholder:"Describe the image content...",maxLength:150,className:"text-sm"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Describe what the image shows for screen readers. Keep it concise and descriptive."})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs(ue,{htmlFor:"featuredImageCaption",className:"text-sm",children:["Caption ",m.jsx("span",{className:"text-muted-foreground",children:"(visible below image)"})]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.length,"/300"]})]}),m.jsx(Ws,{id:"featuredImageCaption",value:_,onChange:j=>Y(j.target.value),placeholder:"Optional: Add context or credit for the image...",maxLength:300,className:"text-sm min-h-[60px]"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"This text appears below the image and provides additional context to readers."})]})]})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsx(pg,{postId:n,selectedLabels:Pt,onLabelsChange:na})}),m.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[m.jsx(ue,{className:"text-lg",children:"SEO Settings"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Customize how this post appears in search engines. Leave blank to use defaults."}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"metaTitle",className:"text-sm",children:"Title Tag"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[v.length,"/60"]})]}),m.jsx(Mn,{id:"metaTitle",value:v,onChange:j=>b(j.target.value),placeholder:c||"Uses post title if blank",maxLength:60,className:"text-sm"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended: under 60 characters for full display in search results."})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(ue,{htmlFor:"metaDescription",className:"text-sm",children:"Meta Description"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[C.length,"/160"]})]}),m.jsx(Ws,{id:"metaDescription",value:C,onChange:j=>M(j.target.value),placeholder:g||"Uses excerpt if blank",maxLength:160,className:"text-sm min-h-[80px]"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended: under 160 characters. This appears below the title in search results."})]})]}),m.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[m.jsx(ue,{className:"text-lg",children:"Status"}),m.jsxs(dc,{value:Fe,onValueChange:Oe,children:[m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx(wr,{value:"draft",id:"draft"}),m.jsx(ue,{htmlFor:"draft",className:"cursor-pointer",children:"Draft"})]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx(wr,{value:"published",id:"published"}),m.jsx(ue,{htmlFor:"published",className:"cursor-pointer",children:"Published"})]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx(wr,{value:"archived",id:"archived"}),m.jsx(ue,{htmlFor:"archived",className:"cursor-pointer",children:"Archived"})]})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(ue,{children:"Published Date"}),m.jsxs(dg,{children:[m.jsx(ug,{asChild:!0,children:m.jsxs(De,{variant:"outline",className:xe("w-full justify-start text-left font-normal",!me&&"text-muted-foreground"),children:[m.jsx(Dh,{className:"mr-2 h-4 w-4"}),me?At(me,"PPP"):"Pick a date"]})}),m.jsx(Ic,{className:"w-auto p-0",align:"start",children:m.jsx(kc,{mode:"single",selected:me,onSelect:ce,initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave blank to use current date when publishing"})]}),m.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[m.jsx(ue,{children:"Estimated Reading Time"}),m.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[m.jsx(Rh,{className:"h-4 w-4"}),m.jsxs("span",{children:[dS(f)," min read"]})]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Based on ~200 words per minute"})]}),m.jsxs("div",{className:"pt-4 border-t space-y-3",children:[m.jsxs(De,{onClick:()=>ra(!1),variant:"outline",className:"w-full",disabled:O,children:[m.jsx(Yh,{className:"mr-2 h-4 w-4"}),O?"Saving...":"Save Changes"]}),m.jsx(De,{onClick:()=>ra(!0),variant:"hero",className:"w-full",disabled:O,children:O?"Publishing...":"Publish"})]}),e&&m.jsx("div",{className:"pt-4 border-t",children:m.jsxs(Xf,{children:[m.jsx(Qf,{asChild:!0,children:m.jsxs(De,{variant:"destructive",className:"w-full",children:[m.jsx(ql,{className:"mr-2 h-4 w-4"}),"Delete Post"]})}),m.jsxs(Zf,{children:[m.jsxs(eh,{children:[m.jsx(th,{children:"Delete this post?"}),m.jsx(nh,{children:"This action cannot be undone. This post will be permanently deleted."})]}),m.jsxs(rh,{children:[m.jsx(sh,{children:"Cancel"}),m.jsx(ih,{onClick:Cf,children:"Delete"})]})]})]})})]})]})]})}),m.jsx(oh,{})]})};export{PS as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.