PageSourceSearch

https://futuresummit.ai/assets/AdminIntelligenceBriefs-D-B3Kzzo.js

js futuresummit.ai collected 2026-10-05 12:00:08 UTC 549,668 bytes, 209 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mammoth.browser-DZmhpPFj.js","assets/index-Cb0uFkxi.js","assets/index-BBFbRtrb.css"])))=>i.map(i=>d[i]);
2import{c as cn,j as h,r as M,f as Ci,R as Pt,a5 as np,u as Cr,_ as rp,X as Go}from"./index-Cb0uFkxi.js";import{s as me}from"./client-3Rgyq3FX.js";import{b as ia,B as O}from"./button-BXT4L8KI.js";import{T as ad,a as cd,b as mt,c as qe,d as dd,e as we}from"./table-DG9zpLGi.js";import{I as $}from"./input-CyLPhXcX.js";import{T as _e}from"./textarea-C91MKZy6.js";import{t as pe,c as Cn,a as oa,b as sp,g as ip,e as op}from"./en-US-wfBU2YNu.js";import{e as Qo,d as lr,f as ar}from"./formatDistanceToNow-Cy40Bq4Y.js";import{s as cs,a as cr,d as gt,b as lp,c as Xo,g as ap,e as cp,f as Pe,i as ud}from"./format-DNwwlEmA.js";import{C as dp}from"./chevron-right-1Co9RUio.js";import{C as hd}from"./chevron-left-BtEncjtN.js";import{P as up,a as hp,b as fp}from"./popover-JNC2f1BN.js";import{d as pp,L as mp}from"./index-B18KBFdi.js";import{F as gp}from"./mail-D84mECxx.js";import{I as yp}from"./image-C_21Tekv.js";import{Q as bp}from"./quote-DyFqgzaF.js";import{M as xp}from"./minus-BRReW79O.js";import{s as vp,a as Zo,e as kp,f as wp,g as Cp,K as Sp,h as Mp,i as Np,W as Tp,v as Kn,j as Ep,k as fd,p as Ap,S as Dp,M as Op,R as jp,A as Rp,b as _p,E as la,D as Ip,m as Lp,c as Bn}from"./BriefPage-liILpsk0.js";import{R as ds}from"./refresh-cw-D_fuxE1r.js";import{P as pd}from"./plus-DKLdpJ5T.js";import{P as Pp}from"./pencil-ZcfsXu3C.js";import{T as zp}from"./trash-2-NpQIgcu7.js";import{S as md,a as gd,b as yd,c as bd,d as $n}from"./select-xTt2WSiW.js";import{C as Bp}from"./check-C07f7c7n.js";import{T as $p,a as Fp}from"./toggle-right-wb-fHqlj.js";import"./tslib.es6-CmEaCU22.js";import"./index-DSefd6az.js";import"./loader-circle-DoSMiK1s.js";import"./schemas-D0a2kBDL.js";import"./copy-Dg_f-Qpj.js";import"./index-BHD-fViZ.js";import"./chevron-down-CNHxCdIc.js";import"./chevron-up-Co9HabI0.js";/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const Hp=cn("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"}]]);/**
8 * @license lucide-react v0.462.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const aa=cn("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
13 * @license lucide-react v0.462.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const Wp=cn("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"}]]);/**
18 * @license lucide-react v0.462.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const Vp=cn("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"}]]);/**
23 * @license lucide-react v0.462.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const qp=cn("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"}]]);/**
28 * @license lucide-react v0.462.0 - ISC
29 *
30 * This source code is licensed under the ISC license.
31 * See the LICENSE file in the root directory of this source tree.
32 */const Up=cn("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"}]]);/**
33 * @license lucide-react v0.462.0 - ISC
34 *
35 * This source code is licensed under the ISC license.
36 * See the LICENSE file in the root directory of this source tree.
37 */const Kp=cn("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"}]]);function Ae(t,e){const n=pe(t);return isNaN(e)?Cn(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function et(t,e){const n=pe(t);if(isNaN(e))return Cn(t,NaN);if(!e)return n;const r=n.getDate(),s=Cn(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}function co(t,e){const n=e*7;return Ae(t,n)}function Jp(t,e){return et(t,e*12)}function Yp(t){let e;return t.forEach(function(n){const r=pe(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function Gp(t){let e;return t.forEach(n=>{const r=pe(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function Re(t,e){const n=cs(t),r=cs(e);return+n==+r}function Qp(t,e,n){const r=cr(t,n),s=cr(e,n),i=+r-oa(r),o=+s-oa(s);return Math.round((i-o)/sp)}function Ie(t){const e=pe(t);return e.setDate(1),e.setHours(0,0,0,0),e}function el(t,e){var l,a,c,d;const n=ip(),r=(e==null?void 0:e.weekStartsOn)??((a=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:a.weekStartsOn)??n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,s=pe(t),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 xd(t){return el(t,{weekStartsOn:1}
37)}function Xp(t){const e=pe(t),n=e.getFullYear(),r=e.getMonth(),s=Cn(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function Zp(t){return Math.trunc(+pe(t)/1e3)}function em(t){const e=pe(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function tm(t,e){return Qp(em(t),Ie(t),e)+1}function uo(t,e){const n=pe(t),r=pe(e);return n.getTime()>r.getTime()}function vd(t,e){const n=pe(t),r=pe(e);return+n<+r}function tl(t,e){const n=pe(t),r=pe(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function nm(t,e){const n=pe(t),r=pe(e);return n.getFullYear()===r.getFullYear()}function Si(t,e){return Ae(t,-e)}function Mi(t,e){const n=pe(t),r=n.getFullYear(),s=n.getDate(),i=Cn(t,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=Xp(i);return n.setMonth(e,Math.min(s,o)),n}function ca(t,e){const n=pe(t);return isNaN(+n)?Cn(t,NaN):(n.setFullYear(e),n)}var B=function(){return B=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},B.apply(this,arguments)};function rm(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function kd(t,e,n){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 t.concat(i||Array.prototype.slice.call(e))}function Sr(t){return t.mode==="multiple"}function Mr(t){return t.mode==="range"}function ti(t){return t.mode==="single"}var sm={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 im(t,e){return Pe(t,"LLLL y",e)}function om(t,e){return Pe(t,"d",e)}function lm(t,e){return Pe(t,"LLLL",e)}function am(t){return"".concat(t)}function cm(t,e){return Pe(t,"cccccc",e)}function dm(t,e){return Pe(t,"yyyy",e)}var um=Object.freeze({__proto__:null,formatCaption:im,formatDay:om,formatMonthCaption:lm,formatWeekNumber:am,formatWeekdayName:cm,formatYearCaption:dm}),hm=function(t,e,n){return Pe(t,"do MMMM (EEEE)",n)},fm=function(){return"Month: "},pm=function(){return"Go to next month"},mm=function(){return"Go to previous month"},gm=function(t,e){return Pe(t,"cccc",e)},ym=function(t){return"Week n. ".concat(t)},bm=function(){return"Year: "},xm=Object.freeze({__proto__:null,labelDay:hm,labelMonthDropdown:fm,labelNext:pm,labelPrevious:mm,labelWeekNumber:ym,labelWeekday:gm,labelYearDropdown:bm});function vm(){var t="buttons",e=sm,n=op,r={},s={},i=1,o={},l=new Date;return{captionLayout:t,classNames:e,formatters:um,labels:xm,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:l,mode:"default"}}function km(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,i=t.fromDate,o=t.toDate;return r?i=Ie(r):e&&(i=new Date(e,0,1)),s?o=Qo(s):n&&(o=new Date(n,11,31)),{fromDate:i?cs(i):void 0,toDate:o?cs(o):void 0}}var wd=M.createContext(void 0);
37function wm(t){var e,n=t.initialProps,r=vm(),s=km(n),i=s.fromDate,o=s.toDate,l=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var a;(ti(n)||Sr(n)||Mr(n))&&(a=n.onSelect);var c=B(B(B({},r),n),{captionLayout:l,classNames:B(B({},r.classNames),n.classNames),components:B({},n.components),formatters:B(B({},r.formatters),n.formatters),fromDate:i,labels:B(B({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:B(B({},r.modifiers),n.modifiers),modifiersClassNames:B(B({},r.modifiersClassNames),n.modifiersClassNames),onSelect:a,styles:B(B({},r.styles),n.styles),toDate:o});return h.jsx(wd.Provider,{value:c,children:t.children})}function X(){var t=M.useContext(wd);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function Cd(t){var e=X(),n=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return h.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:i(t.displayMonth,{locale:n})})}function Cm(t){return h.jsx("svg",B({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:h.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 Sd(t){var e,n,r=t.onChange,s=t.value,i=t.children,o=t.caption,l=t.className,a=t.style,c=X(),d=(n=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:Cm;return h.jsxs("div",{className:l,style:a,children:[h.jsx("span",{className:c.classNames.vhidden,children:t["aria-label"]}),h.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:s,onChange:r,children:i}),h.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[o,h.jsx(d,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function Sm(t){var e,n=X(),r=n.fromDate,s=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,a=n.classNames,c=n.components,d=n.labels.labelMonthDropdown;if(!r)return h.jsx(h.Fragment,{});if(!s)return h.jsx(h.Fragment,{});var u=[];if(nm(r,s))for(var f=Ie(r),p=r.getMonth();p<=s.getMonth();p++)u.push(Mi(f,p));else for(var f=Ie(new Date),p=0;p<=11;p++)u.push(Mi(f,p));var m=function(y){var b=Number(y.target.value),x=Mi(Ie(t.displayMonth),b);t.onChange(x)},g=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:Sd;return h.jsx(g,{name:"months","aria-label":d(),className:a.dropdown_month,style:i.dropdown_month,onChange:m,value:t.displayMonth.getMonth(),caption:l(t.displayMonth,{locale:o}),children:u.map(function(y){return h.jsx("option",{value:y.getMonth(),children:l(y,{locale:o})},y.getMonth())})})}function Mm(t){var e,n=t.displayMonth,r=X(),s=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,a=r.classNames,c=r.components,d=r.formatters.formatYearCaption,u=r.labels.labelYearDropdown,f=[];if(!s)return h.jsx(h.Fragment,{});if(!i)return h.jsx(h.Fragment,{});for(var p=s.getFullYear(),m=i.getFullYear(),g=p;g<=m;g++)f.push(ca(lp(new Date),g));var y=function(x){var k=ca(Ie(n),Number(x.target.value));t.onChange(k)},b=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:Sd;return h.jsx(b,{name:"years","aria-label":u(),className:a.dropdown_year,style:l.dropdown_year,onChange:y,value:n.getFullYear(),caption:d(n,{locale:o}),children:f.map(function(x){return h.jsx("option",{value:x.getFullYear(),children:d(x,{locale:o})},x.getFullYear())})})}function Nm(t,e){var n=M.useState(t),r=n[0],s=n[1],i=e===void 0?r:e;return[i,s]}function Tm(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,i=t.toDate,o=t.fromDate,l=t.numberOfMonths,a=l===void 0?1:l;if(i&&lr(i,s)<0){var c=-1*(a-1);s=et(i,c)}return o&&lr(s,o)<0&&(s=o),Ie(s)}function Em(){var t=X(),e=Tm(t),n=Nm(e,t.month),r=n[0],s=n[1],i=function(o){var l;if(!t.disableNavigation){var a=Ie(o);s(a),(l=t.onMonthChange)===null||l===void 0||l.call(t,a)}};return[r,i]}function Am(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=Ie(t),i=Ie(et(s,r)),o=lr(i,s),l=[],a=0;a<o;a++){var c=et(s,a);l.push(c)}return n&&(l=l.reverse()),l}function Dm(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Ie(t);if(!n)return et(l,o);var a=lr(n,t);if(!(a<i))return et(l,o)}}
37function Om(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Ie(t);if(!n)return et(l,-o);var a=lr(l,n);if(!(a<=0))return et(l,-o)}}var Md=M.createContext(void 0);function jm(t){var e=X(),n=Em(),r=n[0],s=n[1],i=Am(r,e),o=Dm(r,e),l=Om(r,e),a=function(u){return i.some(function(f){return tl(u,f)})},c=function(u,f){a(u)||(f&&vd(u,f)?s(et(u,1+e.numberOfMonths*-1)):s(u))},d={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:c,previousMonth:l,nextMonth:o,isDateDisplayed:a};return h.jsx(Md.Provider,{value:d,children:t.children})}function Nr(){var t=M.useContext(Md);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function da(t){var e,n=X(),r=n.classNames,s=n.styles,i=n.components,o=Nr().goToMonth,l=function(d){o(et(d,t.displayIndex?-t.displayIndex:0))},a=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:Cd,c=h.jsx(a,{id:t.id,displayMonth:t.displayMonth});return h.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[h.jsx("div",{className:r.vhidden,children:c}),h.jsx(Sm,{onChange:l,displayMonth:t.displayMonth}),h.jsx(Mm,{onChange:l,displayMonth:t.displayMonth})]})}function Rm(t){return h.jsx("svg",B({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:h.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 _m(t){return h.jsx("svg",B({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:h.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 us=M.forwardRef(function(t,e){var n=X(),r=n.classNames,s=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),l=B(B({},s.button_reset),s.button);return t.style&&Object.assign(l,t.style),h.jsx("button",B({},t,{ref:e,type:"button",className:o,style:l}))});function Im(t){var e,n,r=X(),s=r.dir,i=r.locale,o=r.classNames,l=r.styles,a=r.labels,c=a.labelPrevious,d=a.labelNext,u=r.components;if(!t.nextMonth&&!t.previousMonth)return h.jsx(h.Fragment,{});var f=c(t.previousMonth,{locale:i}),p=[o.nav_button,o.nav_button_previous].join(" "),m=d(t.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:_m,b=(n=u==null?void 0:u.IconLeft)!==null&&n!==void 0?n:Rm;return h.jsxs("div",{className:o.nav,style:l.nav,children:[!t.hidePrevious&&h.jsx(us,{name:"previous-month","aria-label":f,className:p,style:l.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?h.jsx(y,{className:o.nav_icon,style:l.nav_icon}):h.jsx(b,{className:o.nav_icon,style:l.nav_icon})}),!t.hideNext&&h.jsx(us,{name:"next-month","aria-label":m,className:g,style:l.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?h.jsx(b,{className:o.nav_icon,style:l.nav_icon}):h.jsx(y,{className:o.nav_icon,style:l.nav_icon})})]})}function ua(t){var e=X().numberOfMonths,n=Nr(),r=n.previousMonth,s=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(m){return tl(t.displayMonth,m)}),a=l===0,c=l===o.length-1,d=e>1&&(a||!c),u=e>1&&(c||!a),f=function(){r&&i(r)},p=function(){s&&i(s)};return h.jsx(Im,{displayMonth:t.displayMonth,hideNext:d,hidePrevious:u,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:p})}function Lm(t){var e,n=X(),r=n.classNames,s=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,a=(e=l==null?void 0:l.CaptionLabel)!==null&&e!==void 0?e:Cd,c;return s?c=h.jsx(a,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?c=h.jsx(da,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?c=h.jsxs(h.Fragment,{children:[h.jsx(da,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),h.jsx(ua,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):c=h.jsxs(h.Fragment,{children:[h.jsx(a,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),h.jsx(ua,{displayMonth:t.displayMonth,id:t.id})]}),h.jsx("div",{className:r.caption,style:i.caption,children:c})}function Pm(t){var e=X(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?h.jsx("tfoot",{className:s,style:r.tfoot,children:h.jsx("tr",{children:h.jsx("td",{colSpan:8,children:n})})}):h.jsx(h.Fragment,{})}function zm(t,e,n){for(var r=n?Xo(new Date):cr(new Date,{locale:t,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=Ae(r,i);s.push(o)}return s}function Bm(){var t=X(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,i=t.weekStartsOn,o=t.ISOWeek,l=t.formatters.formatWeekdayName,a=t.labels.labelWeekday,c=zm(s,i,o);return h.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&h.jsx("td",{style:n.head_cell,className:e.head_cell}),c.map(function(d,u){return h.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":a(d,{locale:s}),children:l(d,{locale:s})},u)})]})}function $m(){var t,e=X(),n=e.classNames,r=e.styles,s=e.components,i=(t=s==null?void 0:s.HeadRow)!==null&&t!==void 0?t:Bm;return h.jsx("thead",{style:r.head,className:n.head,children:h.jsx(i,{})})}function Fm(t){var e=X(),n=e.locale,r=e.formatters.formatDay;return h.jsx(h.Fragment,{children:r(t.date,{locale:n})})}var nl=M.createContext(void 0);function Hm(t){if(!Sr(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return h.jsx(nl.Provider,{value:e,children:t.children})}return h.jsx(Wm,{initialProps:t.initialProps,children:t.children})}function Wm(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,i=e.max,o=function(c,d,u){var f,p;(f=e.onDayClick)===null||f===void 0||f.call(e,c,d,u);var m=!!(d.selected&&s&&(r==null?void 0:r.length)===s);if(!m){var g=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!g){var y=r?kd([],r):[];if(d.selected){var b=y.findIndex(function(x){return Re(c,x)});y.splice(b,1)}else y.push(c);(p=e.onSelect)===null||p===void 0||p.call(e,y,c,d,u)}}},l={disabled:[]};r&&l.disabled.push(function(c){var d=i&&r.length>i-1,u=r.some(function(f){return Re(f,c)});return!!(d&&!u)});var a={selected:r,onDayClick:o,modifiers:l};return h.jsx(nl.Provider,{value:a,children:n})}function rl(){var t=M.useContext(nl);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function Vm(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?Re(s,t)&&Re(r,t)?void 0:Re(s,t)?{from:s,to:void 0}:Re(r,t)?void 0:uo(r,t)?{from:t,to:s}:{from:r,to:t}:s?uo(t,s)?{from:s,to:t}:{from:t,to:s}:r?vd(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var sl=M.createContext(void 0);function qm(t){if(!Mr(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return h.jsx(sl.Provider,{value:e,children:t.children})}return h.jsx(Um,{initialProps:t.initialProps,children:t.children})}function Um(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},i=s.from,o=s.to,l=e.min,a=e.max,c=function(p,m,g){var y,b;(y=e.onDayClick)===null||y===void 0||y.call(e,p,m,g);var x=Vm(p,r);(b=e.onSelect)===null||b===void 0||b.call(e,x,p,m,g)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],Re(i,o)||(d.range_middle=[{after:i,before:o}])):d.range_end=[i]):o&&(d.range_start=[o],d.range_end=[o]),l&&(i&&!o&&d.disabled.push({after:Si(i,l-1),before:Ae(i,l-1)}),i&&o&&d.disabled.push({after:i,before:Ae(i,l-1)}),!i&&o&&d.disabled.push({after:Si(o,l-1),before:Ae(o,l-1)})),a){if(i&&!o&&(d.disabled.push({before:Ae(i,-a+1)}),d.disabled.push({after:Ae(i,a-1)})),i&&o){var u=gt(o,i)+1,f=a-u;d.disabled.push({before:Si(i,f)}),d.disabled.push({after:Ae(o,f)})}!i&&o&&(d.disabled.push({before:Ae(o,-a+1)}),d.disabled.push({after:Ae(o,a-1)}))}return h.jsx(sl.Provider,{value:{selected:r,onDayClick:c,modifiers:d},children:n})}function il(){var t=M.useContext(sl);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function es(t){return Array.isArray(t)?kd([],t):t!==void 0?[t]:[]}function Km(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=es(s)}),e}var tt;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(tt||(tt={}));var Jm=tt.Selected,at=tt.Disabled,Ym=tt.Hidden,Gm=tt.Today,Ni=tt.RangeEnd,Ti=tt.RangeMiddle,Ei=tt.RangeStart,Qm
37=tt.Outside;function Xm(t,e,n){var r,s=(r={},r[Jm]=es(t.selected),r[at]=es(t.disabled),r[Ym]=es(t.hidden),r[Gm]=[t.today],r[Ni]=[],r[Ti]=[],r[Ei]=[],r[Qm]=[],r);return t.fromDate&&s[at].push({before:t.fromDate}),t.toDate&&s[at].push({after:t.toDate}),Sr(t)?s[at]=s[at].concat(e.modifiers[at]):Mr(t)&&(s[at]=s[at].concat(n.modifiers[at]),s[Ei]=n.modifiers[Ei],s[Ti]=n.modifiers[Ti],s[Ni]=n.modifiers[Ni]),s}var Nd=M.createContext(void 0);function Zm(t){var e=X(),n=rl(),r=il(),s=Xm(e,n,r),i=Km(e.modifiers),o=B(B({},s),i);return h.jsx(Nd.Provider,{value:o,children:t.children})}function Td(){var t=M.useContext(Nd);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function eg(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function tg(t){return!!(t&&typeof t=="object"&&"from"in t)}function ng(t){return!!(t&&typeof t=="object"&&"after"in t)}function rg(t){return!!(t&&typeof t=="object"&&"before"in t)}function sg(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function ig(t,e){var n,r=e.from,s=e.to;if(r&&s){var i=gt(s,r)<0;i&&(n=[s,r],r=n[0],s=n[1]);var o=gt(t,r)>=0&&gt(s,t)>=0;return o}return s?Re(s,t):r?Re(r,t):!1}function og(t){return ud(t)}function lg(t){return Array.isArray(t)&&t.every(ud)}function ag(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(og(n))return Re(t,n);if(lg(n))return n.includes(t);if(tg(n))return ig(t,n);if(sg(n))return n.dayOfWeek.includes(t.getDay());if(eg(n)){var r=gt(n.before,t),s=gt(n.after,t),i=r>0,o=s<0,l=uo(n.before,n.after);return l?o&&i:i||o}return ng(n)?gt(t,n.after)>0:rg(n)?gt(n.before,t)>0:typeof n=="function"?n(t):!1})}function ol(t,e,n){var r=Object.keys(e).reduce(function(i,o){var l=e[o];return ag(t,l)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),n&&!tl(t,n)&&(s.outside=!0),s}function cg(t,e){for(var n=Ie(t[0]),r=Qo(t[t.length-1]),s,i,o=n;o<=r;){var l=ol(o,e),a=!l.disabled&&!l.hidden;if(!a){o=Ae(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),s||(s=o),o=Ae(o,1)}return i||s}var dg=365;function Ed(t,e){var n=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,l=o===void 0?{count:0,lastFocused:t}:o,a=s.weekStartsOn,c=s.fromDate,d=s.toDate,u=s.locale,f={day:Ae,week:co,month:et,year:Jp,startOfWeek:function(y){return s.ISOWeek?Xo(y):cr(y,{locale:u,weekStartsOn:a})},endOfWeek:function(y){return s.ISOWeek?xd(y):el(y,{locale:u,weekStartsOn:a})}},p=f[n](t,r==="after"?1:-1);r==="before"&&c?p=Yp([c,p]):r==="after"&&d&&(p=Gp([d,p]));var m=!0;if(i){var g=ol(p,i);m=!g.disabled&&!g.hidden}return m?p:l.count>dg?l.lastFocused:Ed(p,{moveBy:n,direction:r,context:s,modifiers:i,retry:B(B({},l),{count:l.count+1})})}var Ad=M.createContext(void 0);function ug(t){var e=Nr(),n=Td(),r=M.useState(),s=r[0],i=r[1],o=M.useState(),l=o[0],a=o[1],c=cg(e.displayMonths,n),d=s??(l&&e.isDateDisplayed(l))?l:c,u=function(){a(s),i(void 0)},f=function(y){i(y)},p=X(),m=function(y,b){if(s){var x=Ed(s,{moveBy:y,direction:b,context:p,modifiers:n});Re(s,x)||(e.goToDate(x,s),f(x))}},g={focusedDay:s,focusTarget:d,blur:u,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return h.jsx(Ad.Provider,{value:g,children:t.children})}function ll(){var t=M.useContext(Ad);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function hg(t,e){var n=Td(),r=ol(t,n,e);return r}var al=M.createContext(void 0);function fg(t){if(!ti(t.initialProps)){var e={selected:void 0};return h.jsx(al.Provider,{value:e,children:t.children})}return h.jsx(pg,{initialProps:t.initialProps,children:t.children})}function pg(t){var e=t.initialProps,n=t.children,r=function(i,o,l){var a,c,d;if((a=e.onDayClick)===null||a===void 0||a.call(e,i,o,l),o.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.c
37all(e,void 0,i,o,l);return}(d=e.onSelect)===null||d===void 0||d.call(e,i,i,o,l)},s={selected:e.selected,onDayClick:r};return h.jsx(al.Provider,{value:s,children:n})}function Dd(){var t=M.useContext(al);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function mg(t,e){var n=X(),r=Dd(),s=rl(),i=il(),o=ll(),l=o.focusDayAfter,a=o.focusDayBefore,c=o.focusWeekAfter,d=o.focusWeekBefore,u=o.blur,f=o.focus,p=o.focusMonthBefore,m=o.focusMonthAfter,g=o.focusYearBefore,y=o.focusYearAfter,b=o.focusStartOfWeek,x=o.focusEndOfWeek,k=function(P){var L,Ht,Rn,hn;ti(n)?(L=r.onDayClick)===null||L===void 0||L.call(r,t,e,P):Sr(n)?(Ht=s.onDayClick)===null||Ht===void 0||Ht.call(s,t,e,P):Mr(n)?(Rn=i.onDayClick)===null||Rn===void 0||Rn.call(i,t,e,P):(hn=n.onDayClick)===null||hn===void 0||hn.call(n,t,e,P)},v=function(P){var L;f(t),(L=n.onDayFocus)===null||L===void 0||L.call(n,t,e,P)},S=function(P){var L;u(),(L=n.onDayBlur)===null||L===void 0||L.call(n,t,e,P)},N=function(P){var L;(L=n.onDayMouseEnter)===null||L===void 0||L.call(n,t,e,P)},T=function(P){var L;(L=n.onDayMouseLeave)===null||L===void 0||L.call(n,t,e,P)},w=function(P){var L;(L=n.onDayPointerEnter)===null||L===void 0||L.call(n,t,e,P)},j=function(P){var L;(L=n.onDayPointerLeave)===null||L===void 0||L.call(n,t,e,P)},q=function(P){var L;(L=n.onDayTouchCancel)===null||L===void 0||L.call(n,t,e,P)},F=function(P){var L;(L=n.onDayTouchEnd)===null||L===void 0||L.call(n,t,e,P)},U=function(P){var L;(L=n.onDayTouchMove)===null||L===void 0||L.call(n,t,e,P)},te=function(P){var L;(L=n.onDayTouchStart)===null||L===void 0||L.call(n,t,e,P)},se=function(P){var L;(L=n.onDayKeyUp)===null||L===void 0||L.call(n,t,e,P)},J=function(P){var L;switch(P.key){case"ArrowLeft":P.preventDefault(),P.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowRight":P.preventDefault(),P.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowDown":P.preventDefault(),P.stopPropagation(),c();break;case"ArrowUp":P.preventDefault(),P.stopPropagation(),d();break;case"PageUp":P.preventDefault(),P.stopPropagation(),P.shiftKey?g():p();break;case"PageDown":P.preventDefault(),P.stopPropagation(),P.shiftKey?y():m();break;case"Home":P.preventDefault(),P.stopPropagation(),b();break;case"End":P.preventDefault(),P.stopPropagation(),x();break}(L=n.onDayKeyDown)===null||L===void 0||L.call(n,t,e,P)},Fe={onClick:k,onFocus:v,onBlur:S,onKeyDown:J,onKeyUp:se,onMouseEnter:N,onMouseLeave:T,onPointerEnter:w,onPointerLeave:j,onTouchCancel:q,onTouchEnd:F,onTouchMove:U,onTouchStart:te};return Fe}function gg(){var t=X(),e=Dd(),n=rl(),r=il(),s=ti(t)?e.selected:Sr(t)?n.selected:Mr(t)?r.selected:void 0;return s}function yg(t){return Object.values(tt).includes(t)}function bg(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(yg(r)){var i=t.classNames["day_".concat(r)];i&&n.push(i)}}),n}function xg(t,e){var n=B({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=B(B({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function vg(t,e,n){var r,s,i,o=X(),l=ll(),a=hg(t,e),c=mg(t,a),d=gg(),u=!!(o.onDayCl
37ick||o.mode!=="default");M.useEffect(function(){var N;a.outside||l.focusedDay&&u&&Re(l.focusedDay,t)&&((N=n.current)===null||N===void 0||N.focus())},[l.focusedDay,t,n,u,a.outside]);var f=bg(o,a).join(" "),p=xg(o,a),m=!!(a.outside&&!o.showOutsideDays||a.hidden),g=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:Fm,y=h.jsx(g,{date:t,displayMonth:e,activeModifiers:a}),b={style:p,className:f,children:y,role:"gridcell"},x=l.focusTarget&&Re(l.focusTarget,t)&&!a.outside,k=l.focusedDay&&Re(l.focusedDay,t),v=B(B(B({},b),(r={disabled:a.disabled,role:"gridcell"},r["aria-selected"]=a.selected,r.tabIndex=k||x?0:-1,r)),c),S={isButton:u,isHidden:m,activeModifiers:a,selectedDays:d,buttonProps:v,divProps:b};return S}function kg(t){var e=M.useRef(null),n=vg(t.date,t.displayMonth,e);return n.isHidden?h.jsx("div",{role:"gridcell"}):n.isButton?h.jsx(us,B({name:"day",ref:e},n.buttonProps)):h.jsx("div",B({},n.divProps))}function wg(t){var e=t.number,n=t.dates,r=X(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,a=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,d=c(Number(e),{locale:l});if(!s)return h.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var u=a(Number(e),{locale:l}),f=function(p){s(e,n,p)};return h.jsx(us,{name:"week-number","aria-label":u,className:o.weeknumber,style:i.weeknumber,onClick:f,children:d})}function Cg(t){var e,n,r=X(),s=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,a=(e=l==null?void 0:l.Day)!==null&&e!==void 0?e:kg,c=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:wg,d;return o&&(d=h.jsx("td",{className:i.cell,style:s.cell,children:h.jsx(c,{number:t.weekNumber,dates:t.dates})})),h.jsxs("tr",{className:i.row,style:s.row,children:[d,t.dates.map(function(u){return h.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:h.jsx(a,{displayMonth:t.displayMonth,date:u})},Zp(u))})]})}function ha(t,e,n){for(var r=n!=null&&n.ISOWeek?xd(e):el(e,n),s=n!=null&&n.ISOWeek?Xo(t):cr(t,n),i=gt(r,s),o=[],l=0;l<=i;l++)o.push(Ae(s,l));var a=o.reduce(function(c,d){var u=n!=null&&n.ISOWeek?ap(d):cp(d,n),f=c.find(function(p){return p.weekNumber===u});return f?(f.dates.push(d),c):(c.push({weekNumber:u,dates:[d]}),c)},[]);return a}function Sg(t,e){var n=ha(Ie(t),Qo(t),e);if(e!=null&&e.useFixedWeeks){var r=tm(t,e);if(r<6){var s=n[n.length-1],i=s.dates[s.dates.length-1],o=co(i,6-r),l=ha(co(i,1),o,e);n.push.apply(n,l)}}return n}function Mg(t){var e,n,r,s=X(),i=s.locale,o=s.classNames,l=s.styles,a=s.hideHead,c=s.fixedWeeks,d=s.components,u=s.weekStartsOn,f=s.firstWeekContainsDate,p=s.ISOWeek,m=Sg(t.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:i,weekStartsOn:u,firstWeekContainsDate:f}),g=(e=d==null?void 0:d.Head)!==null&&e!==void 0?e:$m,y=(n=d==null?void 0:d.Row)!==null&&n!==void 0?n:Cg,b=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:Pm;return h.jsxs("table",{id:t.id,className:o.table,style:l.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!a&&h.jsx(g,{}),h.jsx("tbody",{className:o.tbody,style:l.tbody,children:m.map(function(x){return h.jsx(y,{displayMonth:t.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),h.jsx(b,{displayMonth:t.displayMonth})]})}function Ng(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Tg=Ng()?M.useLayoutEffect:M.useEffect,Ai=!1,Eg=0;function fa(){return"react-day-picker-".concat(++Eg)}function Ag(t){var e,n=t??(Ai?fa():null),r=M.useState(n),s=r[0],i=r[1];return Tg(function(){s===null&&i(fa())},[]),M.useEffect(function(){Ai===!1&&(Ai=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function Dg(t){var e,n,r=X(),s=r.dir,i=r.classNames,o=r.styles,l=r.components,a=Nr().displayMonths,c=Ag(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,u=[i.month],f=o.month,p=t.displayIndex===0,m=t.displayIndex===a.length-1,g=!p&&!m;s==="rtl"&&(e=[p,m],m=e[0],p=e[1]),p&&(u.push(i.caption_start),f=B(B({},f),o.caption_start)),m&&(u.push(i.caption_end),f=B(B({},f),o.caption_end)),g&&(u.push(i.caption_between),f=B(B({},f),o.caption_between));var y=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:Lm;return h.jsxs("div",{className:u.join(" "),style:f,children:[h.jsx(y,{id:c,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),h.jsx(Mg,{id:d,"aria-labelledby":c,displayMonth:t.displayMonth})]},t.displayIndex)}function Og(t){var e=X(),n=e.classNames,r=e.styles;return h.jsx("div",{className:n.months,style:r.months,children:t.children})}function jg(t){var e,n,r=t.initialProps,s=X(),i=ll(),o=Nr(),l=M.useState(!1),a=l[0],c=l[1];M.useEffect(function(){s.initialFocus&&i.focusTarget&&(a||(i.focus(i.focusTarget),c(!0)))},[s.initialFocus,a,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=B(B({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,g){var y;return B(B({},m),(y={},y[g]=r[g],y))},{}),p=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:Og;return h.jsx("div",B({className:d.join(" "),style:u,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:h.jsx(p,{children:o.displayMonths.map(function(m,g){return h.jsx(Dg,{displayIndex:g,displayMonth:m},g)})})}))}function Rg(t){var e=t.children,n=rm(t,["children"]);return h.jsx(wm,{initialProps:n,children:h.jsx(jm,{children:h.jsx(fg,{initialProps:n,children:h.jsx(Hm,{initialProps:n,children:h.jsx(qm,{initialProps:n,children:h.jsx(Zm,{children:h.jsx(ug,{children:e})})})})})})})}function _g(t){return h.jsx(Rg,B({},t,{children:h.jsx(jg,{initialProps:t})}))}function Od({className:t,classNames:e,showOutsideDays:n=!0,...r}){return h.jsx(_g,{showOutsideDays:n,className:Ci("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
37ace-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:Ci(ia({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-xs",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:Ci(ia({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})=>h.jsx(hd,{className:"h-4 w-4"}),IconRight:({...s})=>h.jsx(dp,{className:"h-4 w-4"})},...r})}Od.displayName="Calendar";var jd={exports:{}},Rd={};/**
38 * @license React
39 * use-sync-external-store-shim.production.js
40 *
41 * Copyright (c) Meta Platforms, Inc. and affiliates.
42 *
43 * This source code is licensed under the MIT license found in the
44 * LICENSE file in the root directory of this source tree.
45 */var Sn=M;function Ig(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Lg=typeof Object.is=="function"?Object.is:Ig,Pg=Sn.useState,zg=Sn.useEffect,Bg=Sn.useLayoutEffect,$g=Sn.useDebugValue;function Fg(t,e){var n=e(),r=Pg({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return Bg(function(){s.value=n,s.getSnapshot=e,Di(s)&&i({inst:s})},[t,n,e]),zg(function(){return Di(s)&&i({inst:s}),t(function(){Di(s)&&i({inst:s})})},[t]),$g(n),n}function Di(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Lg(t,n)}catch{return!0}}function Hg(t,e){return e()}var Wg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Hg:Fg;Rd.useSyncExternalStore=Sn.useSyncExternalStore!==void 0?Sn.useSyncExternalStore:Wg;jd.exports=Rd;var cl=jd.exports;function ke(t){this.content=t}ke.prototype={constructor:ke,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new ke(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ke(n)},addToStart:function(t,e){return new ke([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ke(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new ke(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ke.from(t),t.size?new ke(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ke.from(t),t.size?new ke(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ke.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};ke.from=function(t){if(t instanceof ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ke(e)};function _d(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,l=i.text,a=0;for(;o[a]==l[a];a++)n++;
vendor: 8,566 bytes, line 45
45return a&&a<o.length&&a<l.length&&Pd(o.charCodeAt(a-1))&&Ld(o.charCodeAt(a))&&n--,n}if(s.content.size||i.content.size){let o=_d(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Id(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=o.text,d=l.text,u=c.length,f=d.length;for(;u>0&&f>0&&c[u-1]==d[f-1];)u--,f--,n--,r--;return u&&f&&u<c.length&&Pd(c.charCodeAt(u-1))&&Ld(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let c=Id(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function Ld(t){return t>=56320&&t<57344}function Pd(t){return t>=55296&&t<56320}class C{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new C(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new C(r,s)}cutByIndex(e,n){return e==n?C.empty:e==0&&n==this.content.length?this:new C(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new C(s,i)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return _d(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Id(this,e,n,r)}findIndex(e){if(e==0)return Lr(0,e);if(e==this.size)return Lr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?Lr(n+1,i):Lr(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return C.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return C.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new C(n||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const Oi={index:0,offset:0};function Lr(t,e){return Oi.index=t,Oi.offset=e,Oi}function hs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!hs(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!hs(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Y=class ho{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ho.none;if(e instanceof ho)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Y.none=[];class dr extends Error{}class A{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Bd(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new A(r,this.openStart,this.openEnd)}removeBetween(e,n){return new A(zd(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return A.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new A(C.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new A(e,r,s)}}A.empty=new A(C.empty,0,0);function zd(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(zd(i.content,e-s-1,n-s-1)))}function Bd(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Bd(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,a);return c&&t.replaceChild(o,a.copy(c))}function Vg(t,e,n){if(n.openStart>t.depth)throw new dr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new dr("Inconsistent open depths");return $d(t,e,n,0)}function $d(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=$d(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Xt(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=qg(n,t);return Xt(i,Hd(t,o,l,e,r))}else return Xt(i,fs(t,e,r))}function Fd(t,e){if(!e.type.compatibleContent(t.type))throw new dr("Cannot join "+e.type.n
vendor: 15,020 bytes, lines 45-46
45ame+" onto "+t.type.name)}function fo(t,e,n){let r=t.node(n);return Fd(r,e.node(n)),r}function Qt(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Jn(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Qt(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==n&&e.textOffset&&Qt(e.nodeBefore,r)}function Xt(t,e){if(!t.type.validContent(e))throw new dr("Invalid content for node "+t.type.name);return t.copy(e)}function Hd(t,e,n,r,s){let i=t.depth>s&&fo(t,e,s+1),o=r.depth>s&&fo(n,r,s+1),l=[];return Jn(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(Fd(i,o),Qt(Xt(i,Hd(t,e,n,r,s+1)),l)):(i&&Qt(Xt(i,fs(t,e,s+1)),l),Jn(e,n,s,l),o&&Qt(Xt(o,fs(n,r,s+1)),l)),Jn(r,null,s,l),new C(l)}function fs(t,e,n){let r=[];if(Jn(null,t,n,r),t.depth>n){let s=fo(t,e,n+1);Qt(Xt(s,fs(t,e,n+1)),r)}return Jn(e,null,n,r),new C(r)}function qg(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(C.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class ur{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Y.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ps(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ur(n,r,i)}static resolveCached(e,n){let r=pa.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else pa.set(e,r=new Ug);let s=r.elts[r.i]=ur.resolve(e,n);return r.i=(r.i+1)%Kg,s}}class Ug{constructor(){this.elts=[],this.i=0}}const Kg=12,pa=new WeakMap;class ps{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Jg=Object.create(null);class Xe{constructor(e,n,r,s=Y.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&hs(this.attrs,n||e.defaultAttrs||Jg)&&Y.sameSet(this.marks,r||Y.none)}copy(e=null){return e==this.content?this:new Xe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xe(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return A.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new A(c,s.depth-o,i.depth-o)}replace(e,n,r){return Vg(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return ur.resolveCached(this,e)}resolveNoCache(e){return ur.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Wd(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=C.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Y.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=C.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Xe.prototype.text=void 0;class ms extends Xe{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Wd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ms(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ms(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class nn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Yg(e,n);if(r.next==null)return nn.empty;let s=Vd(r);r.next&&r.err("Unexpected trailing text");let i=ny(ty(s));return ry(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return C.from(l.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 f=i(u,l.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
46`)}}nn.empty=new nn(!0);class Yg{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Vd(t){let e=[];do e.push(Gg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gg(t){let e=[];do e.push(Qg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Qg(t){let e=ey(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Xg(t,e);else break;return e}function ma(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Xg(t,e){let n=ma(t),r=n;return t.eat(",")&&(t.next!="}"?r=ma(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Zg(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function ey(t){if(t.eat("(")){let e=Vd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Zg(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ty(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=n();s(i(o.expr,a),d),a=d}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=n();r(a,d),s(i(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function qd(t,e){return e-t}function ga(t,e){let n=[];return r(e),n.sort(qd);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function ny(t){let e=Object.create(null);return n(ga(t,0));function n(r){let s=[];r.forEach(o=>
vendor: 13,246 bytes, lines 46-48
46{t[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<s.length;d++)s[d][0]==l&&(c=s[d][1]);ga(t,a).forEach(d=>{c||s.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new nn(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(qd);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function ry(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.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 Ud(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Kd(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function Jd(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}function Yd(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new iy(t,r,e[r]);return n}let ya=class Gd{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Yd(e,r.attrs),this.defaultAttrs=Ud(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==nn.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:Kd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Xe(this,this.computeAttrs(e),C.from(n),Y.setFrom(r))}createChecked(e=null,n,r){return n=C.from(n),this.checkContent(n),new Xe(this,this.computeAttrs(e),n,Y.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=C.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(C.empty,!0);return i?new Xe(this,e,n.append(i),Y.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Jd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Y.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Gd(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sy(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class iy{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ni{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Yd(e,s.attrs),this.excluded=null;let i=Ud(this.attrs);this.instance=i?new Y(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Kd(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new ni(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Jd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=ke.from(e.nodes),n.marks=ke.from(e.marks||{}),this.nodes=ya.compile(this.spec.nodes,this),this.marks=ni.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||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=nn.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=l=="_"?null:l?ba(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ba(this,o.split(" "))}this.nodeFromJSON=s=>Xe.fromJSON(this,s),this.markFromJSON=s=>Y.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ya){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new ms(r,r.defaultAttrs,e,Y.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function ba(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function oy(t){return t.tag!=null}function ly(t){return t.style!=null}class jt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(oy(s))this.tags.push(s);else if(ly(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new va(this,n,!1);return r.addAll(e,Y.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new va(this,n,!0);return r.addAll(e,Y.none,n.from,n.to),A.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(dy(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ka(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=ka(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new jt(e,jt.schemaRules(e)))}}const Xd={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},ay={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zd={ol:!0,ul:!0},hr=1,po=2,Yn=4;function xa(t,e,n){return e!=null?(e?hr:0)|(e==="full"?po:0):t&&t.whitespace=="pre"?hr|po:n&~Yn}class Pr{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Y.none,this.match=i||(o&Yn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(C.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&hr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=C.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Xd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class va{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=xa(null,n.preserveWhitespace,0)|(r?Yn:0);s?i=new Pr(s.type,s.attrs,Y.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Pr(null,null,Y.none,!0,null,o):i=new Pr(e.schema.topNodeType,null,Y.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&po?"full":this.localPreserveWS||(s.options&hr)>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,`
47`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));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 l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Zd.hasOwnProperty(o)&&this.parser.normalizeLists&&cy(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ay.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Xd.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=a&&a.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
48`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;
vendor: 4,117 bytes, line 48
48if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Y.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):wa(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=xa(e,i,o.options);o.options&Yn&&o.content.length==0&&(l|=Yn);let a=Y.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):wa(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Pr(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=hr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];
vendor: 4,471 bytes, line 48
48if(r.isTextblock&&r.defaultAttrs)return r}}}function cy(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Zd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function dy(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ka(t){let e={};for(let n in t)e[n]=t[n];return e}function wa(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class dn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=zr(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,n);d&&(i.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return zr(n).createTextNode(e.text);let{dom:r,contentDOM:s}=ts(zr(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&ts(zr(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:ts(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new dn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Ca(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Ca(e.marks)}}function Ca(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zr(t){return t.document||window.document}const Sa=new WeakMap;function uy(t){let e=Sa.get(t);return e===void 0&&Sa.set(t,e=hy(t)),e}function hy(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function ts(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=uy(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.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 f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:p,contentDOM:m}=ts(t,f,n,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const eu=65535,tu=Math.pow(2,16);function fy(t,e){return t+e*tu}function Ma(t){return t&eu}function py(t){return(t-(t&eu))/tu}const nu=1,ru=2,ns=4,su=8;class mo{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&su)>0}get deletedBefore(){return(this.delInfo&(nu|ns))>0}get deletedAfter(){return(this.delInfo&(ru|ns))>0}get deletedAcross(){return(this.delInfo&ns)>0}}class ze{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ze.empty)return ze.empty}recover(e){let n=0,r=Ma(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+py(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;
vendor: 4,305 bytes, line 48
48for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+o],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:n:n,p=a+s+(f<0?0:d);if(r)return p;let m=e==(n<0?a:u)?null:fy(l/3,e-a),g=e==a?ru:e==u?nu:ns;return(n<0?e!=a:e!=u)&&(g|=su),new mo(p,g,m)}s+=d-c}return r?e+s:new mo(e+s,0,null)}touches(e,n){let r=0,s=Ma(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],d=this.ranges[s+r];e(l,l+c,a,a+d),i+=d-c}}invert(){return new ze(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ze.empty:new ze(e<0?[0,-e,0]:[0,0,e])}}ze.empty=new ze([]);class fr{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new fr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new fr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new mo(e,s,null)}}const ji=Object.create(null);class Ee{getMap(){return ze.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ji[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ji)throw new RangeError("Duplicate use of step JSON ID "+e);return ji[e]=n,n.prototype.jsonID=e,n}}class he{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new he(e,null)}static fail(e){return new he(null,e)}static fromReplace(e,n,r,s){try{return he.ok(e.replace(n,r,s))}catch(i){if(i instanceof dr)return he.fail(i.message);throw i}}}function dl(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(dl(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return C.fromArray(r)}class Dt extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new A(dl(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return he.fromReplace(e,this.from,this.to,i)}invert(){return new Qe(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Dt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Dt(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("addMark",Dt);
vendor: 8,799 bytes, line 48
48class Qe extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new A(dl(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return he.fromReplace(e,this.from,this.to,r)}invert(){return new Dt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Qe(n.pos,r.pos,this.mark)}merge(e){return e instanceof Qe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qe(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Qe(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("removeMark",Qe);class Ot extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return he.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return he.fromReplace(e,this.pos,this.pos+1,new A(C.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Ot(this.pos,n.marks[s]);return new Ot(this.pos,this.mark)}}return new rn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ot(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ot(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("addNodeMark",Ot);class rn extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return he.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return he.fromReplace(e,this.pos,this.pos+1,new A(C.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ot(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rn(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("removeNodeMark",rn);class de extends Ee{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&go(e,this.from,this.to)?he.fail("Structure replace would overwrite content"):he.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ze([this.from,this.to-this.from,this.slice.size])}invert(e){return new de(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&de.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new de(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof de)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new de(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new de(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new de(n.from,n.to,A.fromJSON(e,n.slice),!!n.structure)}}de.MAP_BIAS=1;Ee.jsonID("replace",de);class be extends Ee{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(go(e,this.from,this.gapFrom)||go(e,this.gapTo,this.to)))return he.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return he.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?he.fromReplace(e,this.from,this.to,r):he.fail("Content does not fit in gap")}getMap(){return new ze([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new be(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new be(n.from,n.to,n.gapFrom,n.gapTo,A.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ee.jsonID("replaceAround",be);function go(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function my(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+a.nodeSize,n),m=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(u[g])?o.to=p:s.push(o=new Qe(f,p,u[g])));l&&l.to==f?l.to=p:i.push(l=new Dt(f,p,r))}}),s.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function gy(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof ni){let c=o.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let d=0;d<a.length;d++){let u=a[d],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&u.eq(s[p].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:u,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Qe(o.from,o.to,o.style)))}function ul(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new de(l,d,A.empty));else{r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Qe(l,d,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(c.text);)m||(m=new A(C.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new de(l+f.index,l+f.index+f[0].length,m))}}l=d}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);t.replace(l,l,new A(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function yy(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function jn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,a=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!yy(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function by(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,d=C.empty,u=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=C.from(r.node(m).copy(d)),u++):a--;let f=C.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=C.from(s.node(m).copy(f)),p++):c++;t.step(new be(a,c,o,l,new A(d.append(f),u,p),d.size-u,!0))}function hl(t,e,n=null,r=t){let s=xy(t,e),i=s&&vy(r,e);return i?s.map(Na).concat({type:e,attrs:n}).concat(i.map(Na)):null}function Na(t){return{type:t,attrs:null}}function xy(t,e){let{parent:n,startIndex:r,endIndex:s}
vendor: 5,450 bytes, lines 48-49
48=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function vy(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function ky(t,e,n){let r=C.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new be(s,i,s,i,new A(r,0,0),n.length,!0))}function wy(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&Cy(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&ou(t,o,l,i),ul(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let d=t.mapping.slice(i),u=d.map(l,1),f=d.map(l+o.nodeSize,1);return t.step(new be(u,f,u+1,f-1,new A(C.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&iu(t,o,l,i),!1}})}function iu(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ou(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
49`))}})}function Cy(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function Sy(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new be(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new A(C.from(o),0,0),1,!0))}function xt(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,d=n-2;c>i;c--,d--){let u=s.node(c),f=s.index(c);if(u.type.spec.isolating)return!1;let p=u.content.cutByIndex(f,u.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!g.type.validContent(p))return!1}let l=s.indexAfter(i),a=r&&r[0];return s.node(i).canReplaceWith(l,l,a?a.type:s.node(i+1).type)}function My(t,e,n=1,r){let s=t.doc.resolve(e),i=C.empty,o=C.empty;for(let l=s.depth,a=s.depth-n,c=n-1;l>a;l--,c--){i=C.from(s.node(l).copy(i));let d=r&&r[c];o=C.from(d?d.type.create(d.attrs,o):s.node(l).copy(o))}t.step(new de(e,e,new A(i.append(o),n,n),!0))}function $t(t,e){let n=t.resolve(e),r=n.index();return lu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ny(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function lu(t,e){return!!(t&&e&&!t.isLeaf&&Ny(t,e))}function ri(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&lu(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function Ty(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(s);d&&!u?r=!1:!d&&u&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);ou(t,d.node(),d.before(),l)}o.inlineContent&&ul(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new de(c,a.map(e+n,-1),A.empty,!0)),r===!0){let d=t.doc.resolve(c);iu(t,d.node(),d.before(),t.steps.length)}return t}function Ey(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function au(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),d=!1;if(i==1)d=c.canReplace(a,a,s);else{let u=c.contentMatchAt(a).findWrapping(s.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}
vendor: 8,409 bytes, line 49
49function si(t,e,n=e,r=A.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return cu(s,i,r)?new de(e,n,r):new Ay(s,i,r).fit()}function cu(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ay{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=C.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=C.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let a=new A(i,o,l);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new de(r.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Ri(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(n==1&&(o?c.matchType(o.type)||(u=c.fillBefore(C.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:u};if(n==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Ri(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new A(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Ri(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new A(Fn(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new A(Fn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)d.push(s.child(g));u=u.matchFragment(s)}let p=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let g=l.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(u=y,d.push(du(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=Hn(this.placed,n,C.from(d)),this.frontier[n].match=u,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?A.empty:new A(Fn(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new A(Fn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_i(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=_i(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=_i(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Hn(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Hn(this.placed,this.depth,C.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(C.empty,!0);n.childCount&&(this.placed=Hn(this.placed,this.frontier.length,n))}}function Fn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fn(t.firstChild.content,e-1,n)))}function Hn(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Hn(t.lastChild.content,e-1,n)))}function Ri(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function du(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,du(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),t.copy(r)}function _i(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!Dy(n,i.content,o)?l:null}function Dy(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Oy(t){return t.spec.defining||t.spec.definingForContent}function jy(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(cu(s,i,r))return t.step(new de(e,n,r));let o=hu(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?l=f:s.before(f)==p&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],d=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(c.push(m),p==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let p=c[f],m=Oy(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(l)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<o.length;g++){let y=o[(g+a)%o.length],b=!0;y<0&&(b=!1,y=-y);let x=s.node(y-1),k=s.index(y-1);if(x.canReplaceWith(k,k,m.type,m.marks))return t.replace(s.before(y),b?i.after(y):n,new A(uu(r.content,0,r.openStart,p),p,r.openEnd))}}let u=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>u));f--){let p=o[f];p<0||(e=s.before(p),n=i.after(p))}}function uu(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(uu(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(C.empty,!0))}return t}function Ry(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Ey(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new A(C.from(r),0,0))}function _y(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=s.depth;a>o;a--)s.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=s.depth;a>0&&n==s.start(a);a--)n=s.before(a);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=hu(r,s);for(let o=0;o<i.length;o++){let l=i[o],a=o==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function hu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}
vendor: 4,650 bytes, line 49
49class wn extends Ee{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return he.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return he.fromReplace(e,this.pos,this.pos+1,new A(C.from(s),0,n.isLeaf?0:1))}getMap(){return ze.empty}invert(e){return new wn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new wn(n.pos,n.attr,n.value)}}Ee.jsonID("attr",wn);class pr extends Ee{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return he.ok(r)}getMap(){return ze.empty}invert(e){return new pr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new pr(n.attr,n.value)}}Ee.jsonID("docAttr",pr);let Mn=class extends Error{};Mn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mn.prototype=Object.create(Error.prototype);Mn.prototype.constructor=Mn;Mn.prototype.name="TransformError";class fl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Mn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=A.empty){let s=si(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new A(C.from(r),0,0))}delete(e,n){return this.replace(e,n,A.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jy(this,e,n,r),this}replaceRangeWith(e,n,r){return Ry(this,e,n,r),this}deleteRange(e,n){return _y(this,e,n),this}lift(e,n){return by(this,e,n),this}join(e,n=1){return Ty(this,e,n),this}wrap(e,n){return ky(this,e,n),this}setBlockType(e,n=e,r,s=null){return wy(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return Sy(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new wn(e,n,r)),this}setDocAttribute(e,n){return this.step(new pr(e,n)),this}addNodeMark(e,n){return this.step(new Ot(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Y)n.isInSet(r.marks)&&this.step(new rn(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new rn(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return My(this,e,n,r),this}addMark(e,n,r){return my(this,e,n,r),this}removeMark(e,n,r){return gy(this,e,n,r),this}clearIncompatible(e,n,r){return ul(this,e,n,r),this}}const Ii=Object.create(null);class z{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new fu(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=A.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?A.empty:n),l==0&&Aa(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),d=a.map(l.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),Aa(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new _(e):bn(e.n
vendor: 4,286 bytes, line 49
49ode(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?bn(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):bn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new $e(e.node(0))}static atStart(e){return bn(e,e,0,0,1)||new $e(e)}static atEnd(e){return bn(e,e,e.content.size,e.childCount,-1)||new $e(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ii[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ii)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ii[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class fu{constructor(e,n){this.$from=e,this.$to=n}}let Ta=!1;function Ea(t){!Ta&&!t.parent.inlineContent&&(Ta=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _ extends z{constructor(e,n=e){Ea(e),Ea(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return z.near(r);let s=e.resolve(n.map(this.anchor));return new _(s.parent.inlineContent?s:r,r)}replace(e,n=A.empty){if(super.replace(e,n),n==A.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ii(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=z.findFrom(n,r,!0)||z.findFrom(n,-r,!0);if(i)n=i.$head;else return z.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(z.findFrom(e,-r,!0)||z.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new _(e,n)}}z.jsonID("text",_);class ii{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ii(e.map(this.anchor),e.map(this.head))}resolve(e){return _.between(e.resolve(this.anchor),e.resolve(this.head))}}class I extends z{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?z.near(i):new I(i)}content(){return new A(C.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 pl(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new I(e.resolve(n.anchor))}static create(e,n){return new I(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}I.prototype.visible=!1;z.jsonID("node",I);class pl{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ii(r,r):new pl(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&I.isSelectable(r)?new I(n):z.near(n)}}class $e extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=A.empty){if(n==A.empty){e.delete(0,e.doc.content.size);let r=z.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new $e(e)}map(e){return new $e(e)}eq(e){return e instanceof $e}getBookmark(){return Iy}}z.jsonID("all",$e);const Iy={map(){return this},resolve(t){return new $e(t)}};function bn(t,e,n,r,s,i=!1){if(e.inlineContent)return _.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&I.isSelectable(l))return I.create(t,n-(s<0?l.nodeSize:0))}else{let a=bn(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function Aa(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof de||s instanceof be))return;let i=t.mapping.maps[r],o;
vendor: 6,813 bytes, line 49
49i.forEach((l,a,c,d)=>{o==null&&(o=d)}),t.setSelection(z.near(t.doc.resolve(o),n))}const Da=1,Br=2,Oa=4;class Ly extends fl{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|Da)&~Br,this.storedMarks=null,this}get selectionSet(){return(this.updated&Da)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Br,this}ensureMarks(e){return Y.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&Br)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Br,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Y.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(z.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Oa,this}get scrolledIntoView(){return(this.updated&Oa)>0}}function ja(t,e){return!e||!t?t:t.bind(e)}class Wn{constructor(e,n,r){this.name=e,this.init=ja(n.init,r),this.apply=ja(n.apply,r)}}const Py=[new Wn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Wn("selection",{init(t,e){return t.selection||z.atStart(e.doc)},apply(t){return t.selection}}),new Wn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Wn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Li{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Py.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Wn(r.key,r.spec.state,r))})}}class kn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=s?s[o].n:0,c=s?s[o].state:this,d=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,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:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new kn(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Ly(this)}static create(e){let n=new Li(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new kn(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Li(this.schema,e.plugins),r=n.fields,s=new kn(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Li(e.schema,e.plugins),i=new kn(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Xe.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=z.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=c.fromJSON.call(a,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function pu(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=pu(s,e,{})),n[r]=s}return n}class Z{constructor(e){this.spec=e,this.props={},e.props&&pu(e.props,this,this.props),this.key=e.key?e.key.key:mu("plugin")}getState(e){return e[this.key]}}const Pi=Object.create(null);function mu(t){return t in Pi?t+"$"+ ++Pi[t]:(Pi[t]=0,t+"$")}class ae{constructor(e="key"){this.key=mu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const gu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function yu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const bu=(t,e,n)=>{let r=yu(t,n);if(!r)return!1;let s=ml(r);if(!s){let o=r.blockRange(),l=o&&jn(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;
vendor: 5,199 bytes, lines 49-50
49if(Tu(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Nn(i,"end")||I.isSelectable(i)))for(let o=r.depth;;o--){let l=si(t.doc,r.before(o),r.after(o),A.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Nn(i,"end")?z.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):I.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},zy=(t,e,n)=>{let r=yu(t,n);if(!r)return!1;let s=ml(r);return s?xu(t,s,e):!1},By=(t,e,n)=>{let r=ku(t,n);if(!r)return!1;let s=gl(r);return s?xu(t,s,e):!1};function xu(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=si(t.doc,i,a,A.empty);if(!c||c.from!=i||c instanceof de&&c.slice.size>=a-i)return!1;if(n){let d=t.tr.step(c);d.setSelection(_.create(d.doc,i)),n(d.scrollIntoView())}return!0}function Nn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const vu=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ml(r)}let o=i&&i.nodeBefore;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function ml(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function ku(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const wu=(t,e,n)=>{let r=ku(t,n);if(!r)return!1;let s=gl(r);if(!s)return!1;let i=s.nodeAfter;if(Tu(t,s,e,1))return!0;if(r.parent.content.size==0&&(Nn(i,"start")||I.isSelectable(i))){let o=si(t.doc,r.before(),r.after(),A.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Nn(i,"start")?z.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):I.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},Cu=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=gl(r)}let o=i&&i.nodeAfter;return!o||!I.isSelectable(o)?!1:(e&&e(t.tr.setSelection(I.create(t.doc,i.pos)).scrollIntoView()),!0)};function gl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const $y=(t,e)=>{let n=t.selection,r=n instanceof I,s;if(r){if(n.node.isTextblock||!$t(t.doc,n.from))return!1;s=n.from}else if(s=ri(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(I.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Fy=(t,e)=>{let n=t.selection,r;if(n instanceof I){if(n.node.isTextblock||!$t(t.doc,n.to))return!1;r=n.to}else if(r=ri(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Hy=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&jn(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},Su=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
50`).scrollIntoView()),!0)};function yl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Wy=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=yl(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(z.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Mu=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof $e||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=yl(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,l=t.tr.insert(o,i.createAndFill());l.setSelection(_.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Nu=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(xt(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&jn(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function Vy(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof I&&e.selection.node.isBlock)return!r.parentOffset||!xt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,l,a=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),l=yl(r.node(p-1).c
vendor: 6,558 bytes, line 50
50ontentMatchAt(r.indexAfter(p-1))),i.unshift(a&&l?{type:l}:null),o=p;break}else{if(p==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof _||e.selection instanceof $e)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=xt(d.doc,u,i.length,i);if(f||(i[0]=l?{type:l}:null,f=xt(d.doc,u,i.length,i)),!f)return!1;if(d.split(u,i.length,i),!a&&c&&r.node(o).type!=l){let p=d.mapping.map(r.before(o)),m=d.doc.resolve(p);l&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(o)),l)}return n&&n(d.scrollIntoView()),!0}}const qy=Vy(),Uy=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(I.create(t.doc,s))),!0)};function Ky(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||$t(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Tu(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&Ky(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=C.empty;for(let b=o.length-1;b>=0;b--)m=C.from(o[b].create(null,m));m=C.from(s.copy(m));let g=t.tr.step(new be(e.pos-1,p,e.pos,p,new A(m,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&$t(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&a?null:z.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&jn(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&Nn(i,"start",!0)&&Nn(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let b=C.empty;for(let k=m.length-1;k>=0;k--)b=C.from(m[k].copy(b));let x=t.tr.step(new be(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new A(b,m.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function Eu(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(_.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const Jy=Eu(-1),Yy=Eu(1);function Gy(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&hl(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Ra(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)s=!0;else{let d=n.doc.resolve(c),u=d.index();s=d.parent.canReplaceWith(u,u+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function bl(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}bl(gu,bu,vu);bl(gu,wu,Cu);bl(Su,Mu,Nu,qy);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Qy(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return Xy(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Xy(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);i=new ps(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new ps(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=hl(i,n,r,e);return l?(t&&Zy(t,e,l,s,n),!0):!1}function Zy(t,e,n,r,s){let i=C.empty;for(let d=n.length-1;d>=0;d--)i=C.from(n[d].type.create(n[d].attrs,i));t.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new A(i,0,0),n.length,!0));let o=0;for(let d=0;d<n.length;d++)n[d].type==s&&(o=d+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,f=!0;d<u;d++,f=!1)!f&&xt(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return t}function e0(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?t0(e,n,t,i):n0(e,n,i):!0:!1}}function t0(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new be(i-1,o,i,o,new A(C.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ps(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=jn(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(i,-1)-1);return $t(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function n0(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,o.content.append(a?C.empty:C.from(s))))return!1;let u=i.pos,f=u+o.nodeSize;return r.step(new be(u-(l?1:0),f+(a?1:0),u+1,f-1,new A((l?C.empty:C.from(s.copy(C.empty))).append(a?C.empty:C.from(s.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function r0(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,d=C.from(c?t.create():null),u=new A(C.from(t.create(null,C.from(l.type.create(null,d)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new be(f-(c?3:1),p,f,p,u,1,!0)).scrollIntoView())}return!0}}const Ce=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Tn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let yo=null;const pt=function(t,e,n){let r=yo||(yo=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},s0=function(){yo=null},sn=function(t,e,n,r){return n&&(_a(t,e,n,r,-1)||_a(t,e,n,r,1))},i0=/^(img|br|input|textarea|hr)$/i;function _a(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;
vendor: 18,107 bytes, lines 50-51
50if(e==(s<0?0:Ue(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Tr(t)||i0.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ce(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Ue(t):0}else return!1}}function Ue(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function o0(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ue(t)}else if(t.parentNode&&!Tr(t))e=Ce(t),t=t.parentNode;else return null}}function l0(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Tr(t))e=Ce(t)+1,t=t.parentNode;else return null}}function a0(t,e,n){for(let r=e==0,s=e==Ue(t);r||s;){if(t==n)return!0;let i=Ce(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Ue(t)}}function Tr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const oi=function(t){return t.focusNode&&sn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function qt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function c0(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function d0(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ue(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ue(r.startContainer),r.startOffset)}}}const ot=typeof navigator<"u"?navigator:null,Ia=typeof document<"u"?document:null,Ft=ot&&ot.userAgent||"",bo=/Edge\/(\d+)/.exec(Ft),Au=/MSIE \d/.exec(Ft),xo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ft),Le=!!(Au||xo||bo),Rt=Au?document.documentMode:xo?+xo[1]:bo?+bo[1]:0,Ke=!Le&&/gecko\/(\d+)/i.test(Ft);Ke&&+(/Firefox\/(\d+)/.exec(Ft)||[0,0])[1];const vo=!Le&&/Chrome\/(\d+)/.exec(Ft),ge=!!vo,Du=vo?+vo[1]:0,Ne=!Le&&!!ot&&/Apple Computer/.test(ot.vendor),En=Ne&&(/Mobile\/\w+/.test(Ft)||!!ot&&ot.maxTouchPoints>2),Ve=En||(ot?/Mac/.test(ot.platform):!1),Ou=ot?/Win/.test(ot.platform):!1,yt=/Android \d/.test(Ft),Er=!!Ia&&"webkitFontSmoothing"in Ia.documentElement.style,u0=Er?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function h0(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ct(t,e){return typeof t=="number"?t:t[e]}function f0(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function La(t,e,n){if(!ko(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Tn(o);continue}let l=o,a=l==i.body,c=a?h0(i):f0(l),d=0,u=0;if(e.top<c.top+ct(r,"top")?u=-(c.top-e.top+ct(s,"top")):e.bottom>c.bottom-ct(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ct(s,"top")-c.top:e.bottom-c.bottom+ct(s,"bottom")),e.left<c.left+ct(r,"left")?d=-(c.left-e.left+ct(s,"left")):e.right>c.right-ct(r,"right")&&(d=e.right-c.right+ct(s,"right")),d||u)if(a)i.defaultView.scrollBy(d,u);else{let p=l.scrollLeft,m=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Tn(o)}}function p0(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:ju(t.dom)}}function ju(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Tn(r));return e}function m0({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ru(n,r==0?0:r-e)}function Ru(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let mn=null;function g0(t){if(t.setActive)return t.setActive();if(mn)return t.focus(mn);let e=ju(t);t.focus(mn==null?{get preventScroll(){return mn={preventScroll:!0},!0}}:void 0),mn||(mn=!1,Ru(e,0))}function _u(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,a,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=pt(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=l){o=Math.max(m.bottom,o),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=d,r=g,s=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=u+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=u+1)}}return!n&&a&&(n=a,s=c,r=0),n&&n.nodeType==3?y0(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:_u(n,s)}function y0(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=St(r,1);if(o.top!=o.bottom&&xl(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function xl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function b0(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function x0(t,e,n){let{node:r,offset:s}=_u(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function v0(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?s=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function Iu(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(xl(e,c))return Iu(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function k0(t,e){let n=t.dom.ownerDocument,r,s=0,i=d0(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!xl(e,c)||(o=Iu(t.dom,e,c),!o))return null}if(Ne)for(let c=o;r&&c;c=Tn(c))c.draggable&&(r=void 0);if(o=b0(o,e),r){if(Ke&&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;Er&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=v0(t,r,s,e))}l==null&&(l=x0(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ko(t){return t.top<t.bottom||t.left<t.right}function St(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ko(r))return r}return Array.prototype.find.call(n,ko)||t.getBoundingClientRect()}const w0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Lu(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Er||Ke;if(r.nodeType==3)if(o&&(w0.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=St(pt(r,s,s),n);if(Ke&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=St(pt(r,s-1,s-1),-1);if(c.top==a.top){let d=St(pt(r,s,s+1),-1);if(d.top!=a.top)return Ln(d,d.left<c.left)}}return a}else{let a=s,c=s,d=n<0?1:-1;return n<0&&!s?(c++,d=-1):n>=0&&s==r.nodeValue.length?(a--,d=1):n<0?a--:c++,Ln(St(pt(r,a,c),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Ue(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return zi(a.getBoundingClientRect(),!1)}if(i==null&&s<Ue(r)){let a=r.childNodes[s];if(a.nodeType==1)return zi(a.getBoundingClientRect(),!0)}return zi(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Ue(r))){let a=r.childNodes[s-1],c=a.nodeType==3?pt(a,Ue(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Ln(St(c,1),!1)}if(i==null&&s<Ue(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?pt(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Ln(St(c,-1),!0)}return Ln(St(r.nodeType==3?pt(r):r,-n),n>=0)}function Ln(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function zi(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Pu(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function C0(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return Pu(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=Lu(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=pt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const S0=/[\u0590-\u08ac]/;function M0(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!S0.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:Pu(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==g;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Pa=null,za=null,Ba=!1;function N0(t,e,n){return Pa==e&&za==n?Ba:(Pa=e,za=n,Ba=n=="up"||n=="down"?C0(t,e,n):M0(t,e,n))}const Je=0,$a=1,Ut=2,Ze=3;class Ar{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Je,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>Ce(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof Bu){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof zu&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ce(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ce(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(s==-1&&e<=c){let d=o+a.border;if(e>=d&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,d);e=o;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=Ce(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(c>n||l==this.children.length-1)){n=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=Ce(u.dom);break}n+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(i>m&&o<y)return g.setSelection(e-m-g.border,n-m-g.border,r,s);m=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((Ke||Ne)&&e==n){let{node:p,offset:m}=l;if(p.nodeType==3){if(u=!!(m&&p.nodeValue[m-1]==`
51`),u&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Ce(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ke&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||u&&Ne)&&sn(l.node,l.offset,d.anchorNode,d.anchorOffset)&&sn(a.node,a.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(u&&Ke)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,a=o-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Ut:$a,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ze:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ut:Ze}r=o}this.dirty=Ut}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ut:$a;n.dirty<r&&(n.dirty=r)}
vendor: 3,719 bytes, line 51
51}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class zu extends Ar{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Je&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class T0 extends Ar{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class _t extends Ar{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=dn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new _t(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ze||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ze&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Je){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Je}}slice(e,n,r){let s=_t.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Co(i,n,o,r)),e>0&&(i=Co(i,0,e,r));for(let l=0;l<i.length;l++)i[l].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 It extends Ar{constructor(e,n,r,s,i,o,l){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=dn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Hu(d,r,n),c?a=new E0(e,n,r,s,d,u||null,f,c):n.isText?new li(e,n,r,s,d,f):new It(e,n,r,s,d,u||null,f)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>C.empty)}return e}matchesNode(e,n,r){return this.dirty==Je&&e.eq(this.node)&&gs(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}
vendor: 45,480 bytes, lines 51-54
51updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new D0(this,o&&o.node,e);R0(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?Y.none:this.node.child(d).marks,r,e,d),a.placeWidget(c,e,s)},(c,d,u,f)=>{a.syncToMarks(c.marks,r,e,f);let p;a.findNodeMatch(c,d,u,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(p=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,d,u,p,e)||a.updateNextNode(c,d,u,e,f,s)||a.addNode(c,d,u,e,s),s+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ut)&&(o&&this.protectLocalComposition(e,o),$u(this.contentDOM,this.children,e),En&&_0(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof _)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=I0(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new T0(this,i,n,s);e.input.compositionNodes.push(o),this.children=Co(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Ze||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Je}updateOuterDeco(e){if(gs(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Fu(this.dom,this.nodeDOM,wo(this.outerDeco,this.node,n),wo(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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(t,e,n,r,s){Hu(r,e,t);let i=new It(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class li extends It{constructor(e,n,r,s,i,o){super(e,n,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Ze||this.dirty!=Je&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Je||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=Je,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new li(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ze)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Bu extends Ar{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Je&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class E0 extends It{constructor(e,n,r,s,i,o,l,a){super(e,n,r,s,i,o,l),this.spec=a}update(e,n,r,s){if(this.dirty==Ze)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function $u(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Ha(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof _t){let a=r?r.previousSibling:t.lastChild;$u(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Ha(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Gn=function(t){t&&(this.nodeName=t)};Gn.prototype=Object.create(null);const Kt=[new Gn];function wo(t,e,n){if(t.length==0)return Kt;let r=n?Kt[0]:new Gn,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Gn(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new Gn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return s}function Fu(t,e,n,r){if(n==Kt&&r==Kt)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=t&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=Kt[0]),s=a}A0(s,l||Kt[0],o)}return s}function A0(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function Hu(t,e,n){return Fu(t,t,Kt,wo(e,n,t.nodeType!=1))}function gs(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ha(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class D0{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=O0(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Je,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){a=d;break}}if(a<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof _t&&d.dirty!=Ze&&d.mark.type==e[o].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[o])&&(d.mark=e[o],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let d=_t.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==Ze&&o.dom==o.contentDOM&&(o.dirty=Ut),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof It){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let d=a.dom,u,f=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ze&&gs(n,a.outerDeco));if(!f&&a.update(e,n,r,s))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(a,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ut,u.updateChildren(s,o+1),u.dirty=Je),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!gs(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=It.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,s,i){let o=It.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new zu(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof _t;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof li)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ne||ge)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new Bu(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function O0(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof _t)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function j0(t,e){return t.type.side-e.type.side}function R0(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,s,e.forChild(i,d),c),i+=d.nodeSize}return}let o=0,l=[],a=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(j0);for(let y=0;y<u.length;y++)n(u[y],c,!!a)}else n(d,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let y=m;o<s.length&&s[o].from<y&&(y=s[o].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=f.cut(y-i),f=f.cut(0,y-i),m=y,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,g,e.forChild(i,f),p),i=m}}function _0(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function I0(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Co(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,d=l+=a.size;c>=n||d<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),s&&(i.push(s),s=void 0),d>n&&i.push(a.slice(n-c,a.size,r)))}return i}function vl(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(oi(n)){for(a=o;s&&!s.node;)s=s.parent;let u=s.node;if(s&&u.isAtom&&I.isSelectable(u)&&s.parent&&!(u.isInline&&a0(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new I(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=o,f=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);u=Math.min(u,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(u<0)return null;[a,o]=f==t.state.selection.anchor?[f,u]:[u,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let u=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=kl(t,d,l,u)}return c}function Wu(t){return t.editable?t.hasFocus():qu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function vt(t,e=!1){let n=t.state.selection;if(Vu(t,n),!Wu(t))return;let r=t.input.mouseDown;if(!e&&ge&&r){let s=t.domSelectionRange(),i=t.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&sn(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)P0(t);else{let{anchor:s,head:i}=n,o,l;Wa&&!(n instanceof _)&&(n.$from.parent.inlineContent||(o=Va(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=Va(t,n.to))),t.docView.setSelection(s,i,t,e),Wa&&(o&&qa(o),l&&qa(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&L0(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const Wa=Ne||ge&&Du<63;function Va(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ne&&s&&s.contentEditable=="false")return Bi(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Bi(s);if(i)return Bi(i)}}function Bi(t){return t.contentEditable="true",Ne&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function qa(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function L0(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Wu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function P0(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ce(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Le&&Rt<=11&&(n.disabled=!0,n.disabled=!1)}function Vu(t,e){if(e instanceof I){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ua(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ua(t)}function Ua(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function kl(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||_.between(e,n,r)}function Ka(t){return t.editable&&!t.hasFocus()?!1:qu(t)}function qu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function z0(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return sn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function So(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&z.findFrom(i,e)}function Mt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ja(t,e,n){let r=t.state.selection;if(r instanceof _)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Mt(t,new _(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=So(t.state,e);return s&&s instanceof I?Mt(t,s):!1}else if(!(Ve&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?I.isSelectable(i)?Mt(t,new I(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Er?Mt(t,new _(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof I&&r.node.isInline)return Mt(t,new _(e>0?r.$to:r.$from));{let s=So(t.state,e);return s?Mt(t,s):!1}}}function ys(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function gn(t,e){return e<0?B0(t):$0(t)}function B0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Ke&&n.nodeType==1&&r<ys(n)&&Qn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Qn(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Uu(n))break;{let l=n.previousSibling;for(;l&&Qn(l,-1);)s=n.parentNode,i=Ce(l),l=l.previousSibling;if(l)n=l,r=ys(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Mo(t,n,r):s&&Mo(t,s,i)}function $0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=ys(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Qn(l,1))i=n,o=++r;else break}else{if(Uu(n))break;{let l=n.nextSibling;for(;l&&Qn(l,1);)i=l.parentNode,o=Ce(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=ys(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Mo(t,i,o)}function Uu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function F0(t,e){for(;t&&e==t.childNodes.length&&!Tr(t);)e=Ce(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function H0(t,e){for(;t&&!e&&!Tr(t);)e=Ce(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Mo(t,e,n){if(e.nodeType!=3){let i,o;(o=F0(e,n))?(e=o,n=0):(i=H0(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(oi(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&vt(t)},50)}function Ya(t,e){let n=t.state.doc.resolve(e);if(!(ge||Ou)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Ga(t,e,n){let r=t.state.selection;if(r instanceof _&&!r.empty||n.indexOf("s")>-1||Ve&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=So(t.state,e);if(o&&o instanceof I)return Mt(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof $e?z.near(o,e):z.findFrom(o,e);return l?Mt(t,l):!1}return!1}function Qa(t,e){if(!(t.state.selection instanceof _))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Xa(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function W0(t){if(!Ne||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Xa(t,r,"true"),setTimeout(()=>Xa(t,r,"false"),20)}return!1}function V0(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function q0(t,e){let n=e.keyCode,r=V0(e);if(n==8||Ve&&n==72&&r=="c")return Qa(t,-1)||gn(t,-1);if(n==46&&!e.shiftKey||Ve&&n==68&&r=="c")return Qa(t,1)||gn(t,1);if(n==13||n==27)return!0;if(n==37||Ve&&n==66&&r=="c"){let s=n==37?Ya(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ja(t,s,r)||gn(t,s)}else if(n==39||Ve&&n==70&&r=="c"){let s=n==39?Ya(t,t.state.selection.from)=="ltr"?1:-1:1;return Ja(t,s,r)||gn(t,s)}else{if(n==38||Ve&&n==80&&r=="c")return Ga(t,-1,r)||gn(t,-1);if(n==40||Ve&&n==78&&r=="c")return W0(t)||Ga(t,1,r)||gn(t,1);if(r==(Ve?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function wl(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||dn.fromSchema(t.state.schema),l=Xu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Qu[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
52
53`);return{dom:a,text:f,slice:e}}function Ku(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new A(C.from(t.state.schema.text(e.replace(/\r\n?/g,`
54`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let u=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(u)l=u;else{let f=s.marks(),{schema:p}=t.state,m=dn.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,f)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),o=Y0(n),Er&&G0(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 f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||jt.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!U0.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Q0(Za(l,+d[1],+d[2]),d[4]);else if(l=A.maxOpen(K0(l.content,s),!0),l.openStart||l.openEnd){let u=0,f=0;for(let p=l.content.firstChild;u<l.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=Za(l,u,f)}return t.someProp("transformPasted",u=>{l=u(l,t,a)}),l}const U0=/^(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 K0(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&Yu(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Gu(o[o.length-1],i.length));let d=Ju(l,a);o.push(d),s=s.matchType(d.type),i=a}}),o)return C.from(o)}return t}function Ju(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,C.from(t));return t}function Yu(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=Yu(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(C.from(Ju(n,t,s+1))))}}function Gu(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Gu(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(C.empty,!0);return t.copy(n.append(r))}function No(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=No(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(C.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Za(t,e,n){return e<t.openStart&&(t=new A(No(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new A(No(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Qu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Xu(){return document.implementation.createHTMLDocument("title")}let $i=null;function J0(t){let e=window.trustedTypes;return e?($i||($i=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$i.createHTML(t)):t}function Y0(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Xu(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&Qu[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=J0(t),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let d=r.querySelectorAll(c.selectorText);for(let u=0;u<d.length;u++)d[u].style.cssText+=c.style.cssText}}}return r}function G0(t){let e=t.querySelectorAll(ge?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Q0(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=C.from(a.create(r[l+1],s)),i++,o++}return new A(s,i,o)}const De={},Oe={},X0={touchstart:!0,touchmove:!0};class Z0{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function eb(t){for(let e in De){let n=De[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{nb(t,r)&&!Cl(t,r)&&(t.editable||!(r.type in Oe))&&n(t,r)},X0[e]?{passive:!0}:void 0)}Ne&&t.dom.addEventListener("input",()=>null),To(t)}function bt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function tb(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function To(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Cl(t,r))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function nb(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function rb(t,e){!Cl(t,e)&&De[e.type]&&(t.editable||!(e.type in Oe))&&De[e.type](t,e)}Oe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!nh(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(yt&&ge&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),En&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,qt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||q0(t,n)?n.preventDefault():bt(t,"key")};Oe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Oe.keypress=(t,e)=>{let n=e;if(nh(t)||!n.charCode||n.ctrlKey&&!n.altKey||Ve&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Dr(t){return{left:t.clientX,top:t.clientY}}function sb(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sl(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Or(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function ib(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&I.isSelectable(r)?(Or(t,new I(n)),!0):!1}function ob(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof I&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(I.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Or(t,I.create(t.state.doc,s)),!0):!1}function lb(t,e,n,r,s){return Sl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?ob(t,n):ib(t,n))}function ab(t,e,n,r){return Sl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function cb(t,e,n,r){return Sl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||db(t,n,r)}function db(t,e,n){if(n.button!=0)return!1;let r=Zu(t,e,!0),s=t.state.doc;return r?(Or(t,r),r instanceof _&&s.eq(t.state.doc)&&(t.input.mouseDown=new hb(t,r)),!0):!1}function Zu(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?_.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)return _.create(r,l+1,l+1+o.content.size);if(n&&I.isSelectable(o))return I.create(r,l)}return null}function Ml(t){return bs(t)}const eh=Ve?"metaKey":"ctrlKey";De.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ml(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&sb(n,t.input.lastClick)&&!n[eh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(Dr(n));o&&(i=="singleClick"?t.input.mouseDown=new ub(t,o,n,!!r):(i=="doubleClick"?ab:cb)(t,o.pos,o.inside,n)?n.preventDefault():bt(t,"pointer"))};class th{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class ub extends th{constructor(e,n,r,s){super(e),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[eh],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.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&&Ke&&!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()),bt(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||vt(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Dr(e))),this.updateAllowDefault(e),this.allowDefault||!n?bt(this.view,"pointer"):lb(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ne&&this.mightDrag&&!this.mightDrag.node.isAtom||ge&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Or(this.view,z.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):bt(this.view,"pointer")}move(e){this.updateAllowDefault(e),bt(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class hb extends th{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),bt(this.view,"pointer");let n=this.view.posAtCoords(Dr(e)),r=n&&Zu(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Or(this.view,_.create(s,o,l))}}De.touchstart=t=>{t.input.lastTouch=Date.now(),Ml(t),bt(t,"pointer")};De.touchmove=t=>{t.input.lastTouch=Date.now(),bt(t,"pointer")};De.contextmenu=t=>Ml(t);function nh(t,e){return t.composing?!0:Ne&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fb=yt?5e3:-1;Oe.compositionstart=Oe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ge&&Ou&&pb(t)))t.markCursor=t.state.storedMarks||n.marks(),bs(t,!0),t.markCursor=null;else if(bs(t,!e.selection.empty),Ke&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}rh(t,fb)};function pb(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Oe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,rh(t,20))};function rh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>bs(t),e))}function sh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function mb(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=o0(e.focusNode,e.focusOffset),r=l0(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function bs(t,e=!1){if(!(yt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),sh(t),e||t.docView&&t.docView.dirty){let n=vl(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function gb(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const mr=Le&&Rt<15||En&&u0<604;De.copy=Oe.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=mr?null:n.clipboardData,o=r.content(),{dom:l,text:a}=wl(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):gb(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yb(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bb(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gr(t,r.value,null,s,e):gr(t,r.textContent,r.innerHTML,s,e)},50)}function gr(t,e,n,r,s){let i=Ku(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||A.empty)))return!0;if(!i)return!1;let o=yb(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ih(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Oe.paste=(t,e)=>{let n=e;if(t.composing&&!yt)return;let r=mr?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&gr(t,ih(r),r.getData("text/html"),s,n)?n.preventDefault():bb(t,n)};class oh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const xb=Ve?"altKey":"ctrlKey";function lh(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[xb]}De.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Dr(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof I?s.to-1:s.to))){if(r&&r.mightDrag)o=I.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(o=I.create(t.state.doc,u.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:d}=wl(t,l);(!n.dataTransfer.files.length||!ge||Du>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(mr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",mr||n.dataTransfer.setData("text/plain",c),t.dragging=new oh(d,lh(t,n),o)};De.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Oe.dragover=Oe.dragenter=(t,e)=>e.preventDefault();Oe.drop=(t,e)=>{try{vb(t,e,t.dragging)}finally{t.dragging=null}};function vb(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Dr(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=Ku(t,ih(e.dataTransfer),mr?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&lh(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||A.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?au(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:p}=n;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=a.doc;if(d?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(u))return;let f=a.doc.resolve(c);if(d&&I.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new I(f));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>p=b),a.setSelection(kl(t,f,a.doc.resolve(p)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}De.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&vt(t)},20))};De.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};De.beforeinput=(t,e)=>{if(ge&&yt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,qt(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Oe)De[t]=Oe[t];function yr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class xs{constructor(e,n){this.toDOM=e,this.spec=n||Zt,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new ye(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof xs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&yr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Lt{constructor(e,n){this.attrs=e,this.spec=n||Zt}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ye(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Lt&&yr(this.attrs,e.attrs)&&yr(this.spec,e.spec)}static is(e){return e.type instanceof Lt}destroy(){}}class Nl{constructor(e,n){this.attrs=e,this.spec=n||Zt}
vendor: 4,928 bytes, line 54
54map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ye(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Nl&&yr(this.attrs,e.attrs)&&yr(this.spec,e.spec)}destroy(){}}class ye{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ye(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ye(e,e,new xs(n,r))}static inline(e,n,r,s){return new ye(e,n,new Lt(r,s))}static node(e,n,r,s){return new ye(e,n,new Nl(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Lt}get widget(){return this.type instanceof xs}}const xn=[],Zt={};class K{constructor(e,n){this.local=e.length?e:xn,this.children=n.length?n:xn}static create(e,n){return n.length?vs(n,e,0,Zt):Me}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==Me||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Zt)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?kb(this.children,o||[],e,n,r,s,i):o?new K(o.sort(en),xn):Me}add(e,n){return n.length?this==Me?K.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,d;if(d=ch(n,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,d,c+1):s.splice(i,0,a,a+l.nodeSize,vs(d,l,c+1,Zt)),i+=3}});let o=ah(i?dh(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new K(o.length?this.local.concat(o).sort(en):this.local,s||this.children)}remove(e){return e.length==0||this==Me?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=Me?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 l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new K(s,r):Me}forChild(e,n){if(this==Me)return this;if(n.isLeaf)return K.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Lt){let c=Math.max(i,a.from)-i,d=Math.min(o,a.to)-i;c<d&&(s||(s=[])).push(a.copy(c,d))}}if(s){let l=new K(s.sort(en),xn);return r?new Et([l,r]):l}return r||Me}eq(e){if(this==e)return!0;if(!(e instanceof K)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Tl(this.localsInner(e))}localsInner(e){if(this==Me)return xn;if(e.inlineContent||!this.local.some(Lt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Lt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}K.empty=new K([],[]);K.removeOverlap=Tl;const Me=K.empty;class Et{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,Zt));return Et.from(r)}forChild(e,n){if(n.isLeaf)return K.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=Me&&(i instanceof Et?r=r.concat(i.members):r.push(i))}return Et.from(r)}eq(e){if(!(e instanceof Et)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Tl(r?n:n.sort(en)):xn}static from(e){switch(e.length){case 0:return Me;case 1:return e[0];default:return new Et(e.every(n=>n instanceof K)?e:e.reduce((n,r)=>n.concat(r instanceof K?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;
vendor: 27,088 bytes, line 54
54n++)this.members[n].forEachSet(e)}}function kb(t,e,n,r,s,i,o){let l=t.slice();for(let c=0,d=i;c<n.maps.length;c++){let u=0;n.maps[c].forEach((f,p,m,g)=>{let y=g-m-(p-f);for(let b=0;b<l.length;b+=3){let x=l[b+1];if(x<0||f>x+d-u)continue;let k=l[b]+d-u;p>=k?l[b+1]=f<=k?-2:-1:f>=d&&y&&(l[b]+=y,l[b+1]+=y)}u+=y}),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=n.map(t[c]+i),u=d-s;if(u<0||u>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-s,{index:m,offset:g}=r.content.findIndex(u),y=r.maybeChild(m);if(y&&g==u&&g+y.nodeSize==p){let b=l[c+2].mapInner(n,y,d+1,t[c]+i+1,o);b!=Me?(l[c]=u,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=wb(l,t,e,n,s,i,o),d=vs(c,r,0,o);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let p=d.children[u];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,d.children[u],d.children[u+1],d.children[u+2])}}return new K(e.sort(en),l)}function ah(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new ye(s.from+e,s.to+e,s.type))}return n}function wb(t,e,n,r,s,i,o){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(r,s,c);u?n.push(u):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function ch(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function dh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function vs(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let c=ch(t,l,a+n);if(c){i=!0;let d=vs(c,l,n+a+1,r);d!=Me&&s.push(a,a+l.nodeSize,d)}});let o=ah(i?dh(t):t,-n).sort(en);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new K(o,s):Me}function en(t,e){return t.from-e.from||t.to-e.to}function Tl(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),ec(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),ec(e,s,r.copy(i.from,r.to)));break}}}return e}function ec(t,e,n){for(;e<t.length&&en(n,t[e])>0;)e++;t.splice(e,0,n)}function Fi(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Me&&e.push(r)}),t.cursorWrapper&&e.push(K.create(t.state.doc,[t.cursorWrapper.deco])),Et.from(e)}const Cb={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Sb=Le&&Rt<=11;class Mb{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 Nb{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Mb,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]);Le&&Rt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Ne&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Sb&&(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,Cb)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ka(this.view)){if(this.suppressingSelectionUpdates)return vt(this.view);if(Le&&Rt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&sn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Tn(i))n.add(i);for(let i=e.anchorNode;i;i=Tn(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ka(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],a);u&&(i=i<0?u.from:Math.min(u.from,i),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(l=!0))}if(a.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ge&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of a)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&u.nodeType==1;){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(Ke&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!u||Ab(e,u)!=p)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&oi(r)&&(c=vl(e))&&c.eq(z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),Tb(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Db(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||vt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Le&&Rt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?Ce(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?Ce(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,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 tc=new WeakMap,nc=!1;function Tb(t){if(!tc.has(t)&&(tc.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ke,nc)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."),nc=!0}}function rc(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return sn(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Eb(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return rc(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?rc(t,n):null}function Ab(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Db(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function Ob(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,d=a.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],oi(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ge&&t.input.lastKeyCode===8)for(let y=i;y>s;y--){let b=r.childNodes[y-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){i=y;break}if(!x||x.size)break}let u=t.state.doc,f=t.someProp("domParser")||jt.fromSchema(t.state.schema),p=u.resolve(o),m=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jb,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),m={anchor:y+o,head:b+o}}return{doc:g,sel:m,from:o,to:l}}function jb(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ne&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ne&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Rb=/^(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 _b(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=vl(t,T);if(w&&!t.state.selection.eq(w)){if(ge&&yt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",q=>q(t,qt(13,"Enter"))))return;let j=t.state.tr.setSelection(w);T=="pointer"?j.setMeta("pointer",!0):T=="key"&&j.scrollIntoView(),i&&j.setMeta("composition",i),t.dispatch(j)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Ob(t,e,n),d=t.state.doc,u=d.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=Pb(u.content,c.doc.content,c.from,f,p);if(m&&t.input.domChangeCount++,(En&&t.input.lastIOSEnter>Date.now()-225||yt)&&s.some(T=>T.nodeType==1&&!Rb.test(T.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",T=>T(t,qt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof _&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=sc(t,t.state.doc,c.sel);if(T&&!T.eq(t.state.selection)){let w=t.state.tr.setSelection(T);i&&w.setMeta("composition",i),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof _&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Le&&Rt<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),y=c.doc.resolveNoCache(m.endB-c.from),b=d.resolve(m.start),x=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((En&&t.input.lastIOSEnter>Date.now()-225&&(!x||s.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!x&&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,"","")))&&t.someProp("handleKeyDown",T=>T(t,qt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Lb(d,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",T=>T(t,qt(8,"Backspace")))){yt&&ge&&t.domObserver.suppressSelectionUpdates();return}ge&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),yt&&!x&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,y=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,qt(13,"Enter"))})},20));let k=m.start,v=m.endA,S=T=>{let w=T||t.state.tr.replace(k,v,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let j=sc(t,w.doc,c.sel);j&&!(ge&&t.composing&&j.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(j.head==k||j.head==w.mapping.map(v)-1)||Le&&j.empty&&j.head==k)&&w.setSelection(j)}return i&&w.setMeta("composition",i),w.scrollIntoView()},N;if(x)if(g.pos==y.pos){Le&&Rt<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>vt(t),20));let T=S(t.state.tr.delete(k,v)),w=d.resolve(m.start).marksAcross(d.resolve(m.endA));w&&T.ensureMarks(w),t.dispatch(T)}else if(m.endA==m.endB&&(N=Ib(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let T=S(t.state.tr);N.type=="add"?T.addMark(k,v,N.mark):T.removeMark(k,v,N.mark),t.dispatch(T)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let T=g.parent.textBetween(g.parentOffset,y.parentOffset),w=()=>S(t.state.tr.insertText(T,k,v));t.someProp("handleTextInput",j=>j(t,k,v,T,w))||t.dispatch(w())}else t.dispatch(S());else t.dispatch(S())}function sc(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:kl(t,e.resolve(n.anchor),e.resolve(n.head))}function Ib(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,a;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=d=>d.mark(l.addToSet(d.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(C.from(c).eq(t))return{mark:l,type:o}}function Lb(t,e,n,r,s){if(n-e<=s.pos-r.pos||Hi(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Hi(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Hi(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Hi(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Pb(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(i==null)return null;let{a,b:c}=t.findDiffEnd(e,o,l);if(s=="end"){let d=Math.max(0,i-Math.min(a,c));r-=a+d-i}if(a<i&&o<l){let d=r<=i&&r>=a?i-r:0;i-=d,c=i+(c-a),a=i}else if(c<i){let d=r<=i&&r>=c?i-r:0;i-=d,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}class uh{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Z0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(cc),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=lc(this),oc(this),this.nodeViews=ac(this),this.docView=Fa(this.state.doc,ic(this),Fi(this),this.dom,this),this.domObserver=new Nb(this,(r,s,i,o)=>_b(this,r,s,i,o)),this.domObserver.start(),eb(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&To(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cc),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(sh(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=ac(this);Bb(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&To(this),this.editable=lc(this),oc(this);let a=Fi(this),c=ic(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,a);(u||!e.selection.eq(s.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&p0(this);if(o){this.domObserver.stop();let p=u&&(Le||ge)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&zb(s.selection,e.selection);if(u){let g=ge?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=mb(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fa(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&z0(this)&&m.delaySelUpdate())?vt(this,p):(Vu(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():f&&m0(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof I){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&La(this,n.getBoundingClientRect(),e)}else La(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new oh(e.slice,e.move,s<0?void 0:I.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(Le){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&&g0(this.dom),vt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return k0(this,e)}coordsAtPos(e,n=1){return Lu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return N0(this,n||this.state,e)}pasteHTML(e,n){return gr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return gr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return wl(this,e)}destroy(){this.docView&&(tb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,s0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rb(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ne&&this.root.nodeType===11&&c0(this.dom.ownerDocument)==this.dom&&Eb(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}uh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ic(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ye.node(0,t.state.doc.content.size,e)]}function oc(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ye.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function lc(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zb(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function ac(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Bb(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function cc(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var zt={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:"'"},ks={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$b=typeof navigator<"u"&&/Mac/.test(navigator.platform),Fb=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Se=0;Se<10;Se++)zt[48+Se]=zt[96+Se]=String(Se);for(var Se=1;Se<=24;Se++)zt[Se+111]="F"+Se;for(var Se=65;Se<=90;Se++)zt[Se]=String.fromCharCode(Se+32),ks[Se]=String.fromCharCode(Se);for(var Wi in zt)ks.hasOwnProperty(Wi)||(ks[Wi]=zt[Wi]);function Hb(t){var e=$b&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Fb&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ks:zt)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Wb=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Vb=typeof navigator<"u"&&/Win/.test(navigator.platform);function qb(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];
vendor: 3,183 bytes, line 54
54if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Wb?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Ub(t){let e=Object.create(null);for(let n in t)e[qb(n)]=t[n];return e}function Vi(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Kb(t){return new Z({props:{handleKeyDown:El(t)}})}function El(t){let e=Ub(t);return function(n,r){let s=Hb(r),i,o=e[Vi(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Vi(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Vb&&r.ctrlKey&&r.altKey)&&(i=zt[r.keyCode])&&i!=s){let l=e[Vi(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Jb=Object.defineProperty,Al=(t,e)=>{for(var n in e)Jb(t,n,{get:e[n],enumerable:!0})};function ai(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var ci=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...c)=>{const d=l(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,a=t||s.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...m)=>{const g=this.buildProps(a,e),y=f(...m)(g);return o.push(y),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:ai({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},hh={};Al(hh,{blur:()=>Yb,clearContent:()=>Gb,clearNodes:()=>Qb,command:()=>Xb,createParagraphNear:()=>Zb,cut:()=>ex,deleteCurrentNode:()=>tx,deleteNode:()=>nx,deleteRange:()=>rx,deleteSelection:()=>ox,enter:()=>lx,exitCode:()=>ax,extendMarkRange:()=>cx,first:()=>dx,focus:()=>
54hx,forEach:()=>fx,insertContent:()=>px,insertContentAt:()=>yx,joinBackward:()=>vx,joinDown:()=>xx,joinForward:()=>kx,joinItemBackward:()=>wx,joinItemForward:()=>Cx,joinTextblockBackward:()=>Sx,joinTextblockForward:()=>Mx,joinUp:()=>bx,keyboardShortcut:()=>Tx,lift:()=>Ex,liftEmptyBlock:()=>Ax,liftListItem:()=>Dx,newlineInCode:()=>Ox,resetAttributes:()=>jx,scrollIntoView:()=>Rx,selectAll:()=>_x,selectNodeBackward:()=>Ix,selectNodeForward:()=>Lx,selectParentNode:()=>Px,selectTextblockEnd:()=>zx,selectTextblockStart:()=>Bx,setContent:()=>$x,setMark:()=>ov,setMeta:()=>lv,setNode:()=>av,setNodeSelection:()=>cv,setTextDirection:()=>dv,setTextSelection:()=>uv,sinkListItem:()=>hv,splitBlock:()=>fv,splitListItem:()=>pv,toggleList:()=>gv,toggleMark:()=>yv,toggleNode:()=>bv,toggleWrap:()=>xv,undoInputRule:()=>vv,unsetAllMarks:()=>kv,unsetMark:()=>wv,unsetTextDirection:()=>Cv,updateAttributes:()=>Sv,wrapIn:()=>Mv,wrapInList:()=>Nv});var Yb=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),Gb=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Qb=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),f=c.resolve(d.map(a+l.nodeSize)),p=u.blockRange(f);if(!p)return;const m=jn(p);if(l.type.isTextblock){const{defaultType:g}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},Xb=t=>e=>t(e),Zb=()=>({state:t,dispatch:e})=>Mu(t,e),ex=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new _(r.doc.resolve(Math.max(o-1,0)))),!0},tx=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),a=s.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function fe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var nx=t=>({tr:e,state:n,dispatch:r})=>{const s=fe(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),c=i.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},rx=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},sx=t=>t.content?/^text(\*|\+)/.test(t.content):!1,dc=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return sx(r)?n==="left"?t.start()-1:t.end()+1:t.pos},ix=(t,e,n)=>{const r=dc(t,n,"left"),s=dc(e,n,"right");return{from:r,to:s}},ox=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),l=n.doc.resolve(o.map(i.$from.pos)),a=n.doc.resolve(o.map(i.$to.pos)),{from:c,to:d}=ix(l,a,t.schema);n.deleteRange(c,d)}),n.scrollIntoView(),e(n)}return!0},lx=()=>({commands:t})=>t.keyboardShortcut("Enter"),ax=()=>({state:t,dispatch:e})=>Wy(t,e);function Dl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ws(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Dl(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function fh(t,e,n={}){return t.find(r=>r.type===e&&ws(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function uc(t,e,n={}){return!!fh(t,e,n)}function Ol(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(d=>d.type===e);c&&(n=c.attrs)}if(!fh([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,l=i+1,a=o+r.node.nodeSize;
vendor: 9,673 bytes, line 54
54for(;i>0&&uc([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&uc([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function kt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var cx=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=kt(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:d}=l;if(s){const u=Ol(a,i,e);if(u&&u.from<=c&&u.to>=d){const f=_.create(o,u.from,u.to);n.setSelection(f)}}return!0},dx=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function ph(t){return t instanceof _}function Jt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function mh(t,e=null){if(!e)return null;const n=z.atStart(t),r=z.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?_.create(t,Jt(0,s,i),Jt(t.content.size,s,i)):_.create(t,Jt(e,s,i),Jt(e,s,i))}function hc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Cs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function ux(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var hx=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Cs()||hc())&&r.dom.focus(),ux()&&!Cs()&&!hc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!ph(n.state.selection))return o(),!0;const l=mh(s.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},fx=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),px=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),gh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&gh(r)}return t};function $r(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return gh(n)}function br(t,e,n){if(t instanceof Xe||t instanceof C)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return C.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),br("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new Qd({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,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?jt.fromSchema(a).parseSlice($r(t),n.parseOptions):jt.fromSchema(a).parse($r(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=jt.fromSchema(e);return n.slice?i.parseSlice($r(t),n.parseOptions).content:i.parse($r(t),n.parseOptions)}return br("",e,n)}function mx(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof de||s instanceof be))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,a,c,d)=>{o===0&&(o=d)}),t.setSelection(z.near(t.doc.resolve(o),n))}var gx=t=>!("type"in t),yx=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=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",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{br(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=br(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((gx(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===u&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,u+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof C){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,u)}else{g=l;const y=r.doc.resolve(d),b=y.node(),x=y.parentOffset===0,k=b.isText||b.isTextblock,v=b.content.size>0;x&&k&&v&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,u,g)}n.updateSelection&&mx(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},bx=()=>({state:t,dispatch:e})=>$y(t,e),xx=()=>({state:t,dispatch:e})=>Fy(t,e),vx=()=>({state:t,dispatch:e})=>bu(t,e),kx=()=>({state:t,dispatch:e})=>wu(t,e),wx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ri(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Cx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ri(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Sx=()=>({state:t,dispatch:e})=>zy(t,e),Mx=()=>({state:t,dispatch:e})=>By(t,e);function yh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Nx(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Cs()||yh()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Tx=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=Nx(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=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}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a==null||a.steps.forEach(c=>{const d=c.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function Bt(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?fe(e,t.schema):null,l=[];t.doc.nodesBetween(r,s,(u,f)=>{if(u.isText)return;const p=Math.max(r,f),m=Math.min(s,f+u.nodeSize);l.push({node:u,from:p,to:m})});const a=s-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>ws(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=a}var Ex=(t,e={})=>({state:n,dispatch:r})=>{const s=fe(t,n.schema);return Bt(n,s,e)?Hy(n,r):!1},Ax=()=>({state:t,dispatch:e})=>Nu(t,e),Dx=t=>({state:e,dispatch:n})=>{const r=fe(t,e.schema);return e0(r)(e,n)},Ox=()=>({state:t,dispatch:e})=>Su(t,e);function di(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function fc(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var jx=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=di(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=fe(t,r.schema)),l==="mark"&&(o=kt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{i&&i===d.type&&(a=!0,s&&n.setNodeMarkup(u,void 0,fc(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&(a=!0,s&&n.addMark(u,u+d.nodeSize,o.create(fc(f.attrs,e))))})})}),a},Rx=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),_x=()=>({tr:t,dispatch:e})=>{if(e){const n=new $e(t.doc);t.setSelection(n)}return!0},Ix=()=>({state:t,dispatch:e})=>vu(t,e),Lx=()=>({state:t,dispatch:e})=>Cu(t,e),Px=()=>({state:t,dispatch:e})=>Uy(t,e),zx=()=>({state:t,dispatch:e})=>Yy(t,e),Bx=()=>({state:t,dispatch:e})=>Jy(t,e);function Eo(t,e,n={},r={}){return br(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $x=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Eo(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function bh(t,e){const n=kt(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function xh(t,e){const n=new fl(t);return e.forEach(r=>{r.steps.forEach(s=>
54{n.step(s)})}),n}function Fx(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Hx(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function vh(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ui(t){return e=>vh(e.$from,t)}function R(t,e,n){return t.config[e]===void 0&&t.parent?R(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?R(t.parent,e,n):null}):t.config[e]}function jl(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=R(e,"addExtensions",n);return r?[e,...jl(r())]:e}).flat(10)}function Rl(t,e){const n=dn.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function kh(t){return typeof t=="function"}function W(t,e=void 0,...n){return kh(t)?e?t.bind(e)(...n):t(...n):t}function Wx(t={}){return Object.keys(t).length===0&&t.constructor===Object}function An(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function wh(t){const e=[],{nodeExtensions:n,markExtensions:r}=An(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return t.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage,extensions:s},u=R(c,"addGlobalAttributes",d);if(!u)return;u().forEach(p=>{let m;Array.isArray(p.types)?m=p.types:p.types==="*"?m=a:p.types==="nodes"?m=o:p.types==="marks"?m=l:m=[],m.forEach(g=>{Object.entries(p.attributes).forEach(([y,b])=>{e.push({type:g,name:y,attribute:{...i,...b}})})})})}),s.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage},u=R(c,"addAttributes",d);if(!u)return;const f=u();Object.entries(f).forEach(([p,m])=>{const g={...i,...m};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:p,attribute:g})})}),e}function Vx(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let l=0;l<o;l+=1){const a=t[l];if(a==="'"&&!s){r=!r,n+=a;continue}if(a==='"'&&!r){s=!s,n+=a;continue}if(!r&&!s){if(a==="("){i+=1,n+=a;continue}if(a===")"&&i>0){i-=1,n+=a;continue}if(a===";"&&i===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function pc(t){const e=[],n=Vx(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),a=i.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function Q(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],c=l.filter(d=>!a.includes(d));r[s]=[...a,...c].join(" ")}else if(s==="style"){const l=new Map([...pc(r[s]),...pc(i)]);r[s]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function xr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Q(n,r),{})}function qx(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function mc(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):qx(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function gc(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Wx(n)?!1:n!=null))}function yc(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Ux(t,e){var n;const r=wh(t),{nodeExtensions:s,markExtensions:i}=An(t),o=(n=s.find(c=>R(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,x)=>{const k=R(x,"extendNodeSchema",u);return{...b,...k?k(c):{}}
vendor: 9,064 bytes, lines 54-56
54},{}),p=gc({...f,content:W(R(c,"content",u)),marks:W(R(c,"marks",u)),group:W(R(c,"group",u)),inline:W(R(c,"inline",u)),atom:W(R(c,"atom",u)),selectable:W(R(c,"selectable",u)),draggable:W(R(c,"draggable",u)),code:W(R(c,"code",u)),whitespace:W(R(c,"whitespace",u)),linebreakReplacement:W(R(c,"linebreakReplacement",u)),defining:W(R(c,"defining",u)),isolating:W(R(c,"isolating",u)),attrs:Object.fromEntries(d.map(yc))}),m=W(R(c,"parseHTML",u));m&&(p.parseDOM=m.map(b=>mc(b,d)));const g=R(c,"renderHTML",u);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:xr(b,d)}));const y=R(c,"renderText",u);return y&&(p.toText=y),[c.name,p]})),a=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},f=t.reduce((y,b)=>{const x=R(b,"extendMarkSchema",u);return{...y,...x?x(c):{}}},{}),p=gc({...f,inclusive:W(R(c,"inclusive",u)),excludes:W(R(c,"excludes",u)),group:W(R(c,"group",u)),spanning:W(R(c,"spanning",u)),code:W(R(c,"code",u)),attrs:Object.fromEntries(d.map(yc))}),m=W(R(c,"parseHTML",u));m&&(p.parseDOM=m.map(y=>mc(y,d)));const g=R(c,"renderHTML",u);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:xr(y,d)})),[c.name,p]}));return new Qd({topNode:o,nodes:l,marks:a})}function Kx(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Xn(t){return t.sort((n,r)=>{const s=R(n,"priority")||100,i=R(r,"priority")||100;return s>i?-1:s<i?1:0})}function Ch(t){const e=Xn(jl(t)),n=Kx(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Sh(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
55
56`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(a,c,d,u)=>{var f;a.isBlock&&c>r&&(l+=i);const p=o==null?void 0:o[a.type.name];if(p)return d&&(l+=p({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),l}function Jx(t,e){const n={from:0,to:t.content.size};return Sh(t,n,e)}function Mh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Yx(t,e){const n=fe(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Nh(t,e){const n=di(typeof e=="string"?e:e.name,t.schema);return n==="node"?Yx(t,e):n==="mark"?bh(t,e):{}}function Gx(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function Qx(t){const e=Gx(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function _l(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),d=e.slice(i).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),Qx(r)}function Il(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Ol(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,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 Xx=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===e?o=l:i-=1}return[o,i]};function Pn(t,e){return e.nodes[t]||e.marks[t]||null}function rs(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var Zx=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,c;const d=((c=(a=s.type.spec).toText)==null?void 0:c.call(a,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),n};function Ao(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?kt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>ws(u.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:u,$to:f})=>{const p=u.pos,m=f.pos;t.doc.nodesBetween(p,m,(g,y)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const b=Math.max(p,y),x=Math.min(m,y+g.nodeSize),k=x-b;o+=k,l.push(...g.marks.map(v=>({mark:v,from:b,to:x})))})}),o===0)return!1;const a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>ws(u.mark.attrs,n,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=o}function ev(t,e,n={}){if(!e)return Bt(t,null,n)||Ao(t,null,n);const r=di(e,t.schema);return r==="node"?Bt(t,e,n):r==="mark"?Ao(t,e,n):!1}var tv=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=ui(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},nv=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function bc(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function qi(t,e){const{nodeExtensions:n}=An(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=W(R(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function jr(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(jr(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Th(t){return t instanceof I}var Eh=class Ah{constructor(e){this.position=e}static fromJSON(e){return new Ah(e.position)}toJSON(){return{position:this.position}}};function rv(t,e){const n=e.mapping.mapResult(t.position);return{position:new Eh(n.pos),mapResult:n}}function sv(t){return new Eh(t)}function iv(t,e,n){var r;const{selection:s}=e;let i=null;if(ph(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));c=p&&m}return!c}),c})}var ov=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=kt(t,r.schema);if(s)if(o){const c=bh(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,p)=>{const m=Math.max(p,d),g=Math.min(p+f.nodeSize,u);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(m,g,a.create({...b.attrs,...e}))}):n.addMark(m,g,a.create(e))})});return iv(r,n,a)},lv=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),av=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=fe(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Ra(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Ra(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},cv=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Jt(t,0,r.content.size),i=I.create(r,s);e.setSelection(i)}return!0},dv=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},uv=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=_.atStart(r).from,l=_.atEnd(r).to,a=Jt(s,o,l),c=Jt(i,o,l),d=_.create(r,a,c);e.setSelection(d)}return!0},hv=t=>({state:e,dispatch:n})=>{const r=fe(t,e.schema);return r0(r)(e,n)};function xc(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var fv=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,c=s.extensionManager.attributes,d=rs(c,l.node().type.name,l.node().attrs);if(i instanceof I&&i.node.isBlock)return!l.parentOffset||!xt(o,l.pos)?!1:(r&&(t&&xc(n,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;
56const u=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Fx(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=u&&f?[{type:f,attrs:d}]:void 0,m=xt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&xt(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(i instanceof _&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),f&&!u&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&xc(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},pv=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=fe(t,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let b=C.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let w=a.depth-x;w>=a.depth-3;w-=1)b=C.from(a.node(w).copy(b));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,v={...rs(f,a.node().type.name,a.node().attrs),...e},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(v))||void 0;b=b.append(C.from(l.createAndFill(null,S)||void 0));const N=a.before(a.depth-(x-1));n.replace(N,a.after(-k),new A(b,4-x,0));let T=-1;n.doc.nodesBetween(N,n.doc.content.size,(w,j)=>{if(T>-1)return!1;w.isTextblock&&w.content.size===0&&(T=j+1)}),T>-1&&n.setSelection(_.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const p=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,m={...rs(f,u.type.name,u.attrs),...e},g={...rs(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!xt(n.doc,a.pos,2))return!1;if(s){const{selection:b,storedMarks:x}=r,{splittableMarks:k}=i.extensionManager,v=x||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!v||!s)return!0;const S=v.filter(N=>k.includes(N.type.name));n.ensureMarks(S)}return!0};function vc(t){return!t||t==="1"?null:t}function Dh(t,e){return vc(t)===vc(e)}var Ui=(t,e)=>{const n=ui(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&$t(t.doc,n.pos))||!Dh(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},Ki=(t,e)=>{const n=ui(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&$t(t.doc,r))||!Dh(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function mv(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return _.between(r,s)}var gv=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:u,splittableMarks:f}=s.extensionManager,p=fe(t,o.schema),m=fe(e,o.schema),{selection:g,storedMarks:y}=o,{$from:b,$to:x}=g,k=b.blockRange(x),v=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const S=ui(te=>qi(te.type.name,u))(g),N=g.from===0&&g.to===o.doc.content.size,T=o.doc.content.content,w=T.length===1?T[0]:null,j=N&&w&&qi(w.type.name,u)?{node:w,pos:0}:null,q=S??j,F=!!S&&k.depth>=1&&k.depth-S.depth<=1,U=!!j;if((F||U)&&q){if(q.node.type===p)return N&&U?a().command(({tr:te,dispatch:se})=>{const J=mv(te);return J?(te.setSelection(J),se&&se(te),!0):!1}).liftListItem(m).run():c.liftListItem(m);if(qi(q.node.type.name,u)&&p.validContent(q.node.content))return a().command(()=>(i.setNodeMarkup(q.pos,p),!0)).command(()=>Ui(i,p)).command(()=>Ki(i,p)).run()}return!n||!v||!l?a().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Ui(i,p)).command(()=>Ki(i,p)).run():a().command(()=>{const te=d().wrapInList(p,r),se=v.filter(J=>
vendor: 39,587 bytes, lines 56-146
56f.includes(J.type.name));return i.ensureMarks(se),te?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Ui(i,p)).command(()=>Ki(i,p)).run()},yv=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=kt(t,r.schema);return Ao(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},bv=(t,e,n={})=>({state:r,commands:s})=>{const i=fe(t,r.schema),o=fe(e,r.schema),l=Bt(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...n})},xv=(t,e={})=>({state:n,commands:r})=>{const s=fe(t,n.schema);return Bt(n,s,e)?r.lift(s):r.wrapIn(s,e)},vv=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},kv=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(d=>s||!a.includes(d.name));l.forEach(d=>{for(const u of c)e.removeMark(d.$from.pos,d.$to.pos,u)})}return!0},wv=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=kt(t,r.schema),{$from:c,empty:d,ranges:u}=l;if(!s)return!0;if(d&&o){let{from:f,to:p}=l;const m=(i=c.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=Ol(c,a,m);g&&(f=g.from,p=g.to),n.removeMark(f,p,a)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},Cv=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},Sv=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=di(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=fe(t,r.schema)),l==="mark"&&(o=kt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let f,p,m,g;n.selection.empty?r.doc.nodesBetween(d,u,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,u),f=b,p=y)}):r.doc.nodesBetween(d,u,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,u),f=b,p=y),b>=d&&b<=u&&(i&&i===y.type&&(a=!0,s&&n.setNodeMarkup(b,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(x=>{if(o===x.type&&(a=!0,s)){const k=Math.max(b,d),v=Math.min(b+y.nodeSize,u);n.addMark(k,v,o.create({...x.attrs,...e}))}}))}),p&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(y=>{o===y.type&&s&&n.addMark(m,g,o.create({...y.attrs,...e}))}))}),a},Mv=(t,e={})=>({state:n,dispatch:r})=>{const s=fe(t,n.schema);return Gy(s,e)(n,r)},Nv=(t,e={})=>({state:n,dispatch:r})=>{const s=fe(t,n.schema);return Qy(s,e)(n,r)},Tv=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function Ev(t,e){const{selection:n}=t,{$from:r}=n;if(n 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}function Av(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function Dv(t){return typeof t=="number"}function Ov(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fr(t){return Ov(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var jv={};Al(jv,{createAtomBlockMarkdownSpec:()=>Rv,createBlockMarkdownSpec:()=>_v,createInlineMarkdownSpec:()=>Pv,parseAttributes:()=>Ll,parseIndentedBlocks:()=>Do,renderNestedMarkdownContent:()=>zl,serializeAttributes:()=>Pl});function Ll(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([\w-]+)/g);if(s){const c=s.map(d=>d.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([\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 f=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),p=n[f];p&&(e[c]=p.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Pl(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function Rv(t){const{nodeName:e,name:n,parseAttributes:r=Ll,serializeAttributes:s=Pl,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,a=n||e,c=d=>{if(!l)return d;const u={};return l.forEach(f=>{f in d&&(u[f]=d[f])}),u};return{parseMarkdown:(d,u)=>{const f={...i,...d.attributes};return u.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),p=(u=d.match(f))==null?void 0:u.index;return p!==void 0?p:-1},tokenize(d,u,f){const p=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!o.find(x=>!(x in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const u=c(d.attrs||{}),f=s(u),p=f?` {${f}}`:"";return`:::${a}${p} :::`}}}function _v(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Ll,serializeAttributes:i=Pl,defaultAttributes:o={},content:l="block",allowedAttributes:a}=t,c=n||e,d=u=>{if(!a)return u;const f={};return a.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{let p;if(r){const g=r(u);p=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?p=f.parseChildren(u.tokens||[]):p=f.parseInline(u.tokens||[]);const m={...o,...u.attributes};return f.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}`,"m"),m=(f=u.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(u,f,p){var m;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=u.match(g);if(!y)return;const[b,x=""]=y,k=s(x);let v=1;const S=b.length;let N="";const T=/^:::([\w-]*)(\s.*)?/gm,w=u.slice(S);for(T.lastIndex=0;;){const j=T.exec(w);if(j===null)break;const q=j.index,F=j[1];if(!((m=j[2])!=null&&m.endsWith(":::"))){if(F)v+=1;else if(v-=1,v===0){const U=w.slice(0,q);N=U.trim();const te=u.slice(0,S+q+j[0].length);let se=[];if(N)if(l==="block")for(se=p.blockTokens(U),se.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=p.inlineTokens(J.text))});se.length>0;){const J=se[se.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))se.pop();else break}else se=p.inlineTokens(N);return{type:e,raw:te,attributes:k,content:N,tokens:se}}}}}},renderMarkdown:(u,f)=>{const p=d(u.attrs||{}),m=i(p),g=m?` {${m}}`:"",y=f.renderChildren(u.content||[],`
57
58`);return`:::${c}${g}
59
60${y}
61
62:::`}}}function Iv(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function Lv(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Pv(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Iv,serializeAttributes:i=Lv,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,d=f=>{if(!a)return f;const p={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in f){const b=f[g];if(y!==void 0&&b===y)return;p[g]=b}}),p},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...o,...f.attributes};if(l)return p.createNode(e,m);const g=r?r(f):f.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=l?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),m=f.match(p),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(f,p,m){const g=l?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),y=f.match(g);if(!y)return;let b="",x="";if(l){const[,v]=y;x=v}else{const[,v,S]=y;x=v,b=S||""}const k=s(x.trim());return{type:e,raw:y[0],content:b.trim(),attributes:k}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(f.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${c}${y}]`:`[${c}${y}]${p}[/${c}]`}}}function Do(t,e,n){var r,s,i,o;const l=t.split(`
63`),a=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<l.length;){const f=l[d],p=f.match(e.itemPattern);if(!p){if(a.length>0)break;if(f.trim()===""){d+=1,c=`${c}${f}
64`;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;c=`${c}${f}
65`;const b=[y];for(d+=1;d<l.length;){const S=l[d];if(S.trim()===""){const T=l.slice(d+1).findIndex(q=>q.trim()!=="");if(T===-1)break;if((((s=(r=l[d+1+T].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){b.push(S),c=`${c}${S}
66`,d+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)b.push(S),c=`${c}${S}
67`,d+=1;else break}let x;const k=b.slice(1);if(k.length>0){const S=k.map(N=>N.slice(g+u)).join(`
68`);S.trim()&&(e.customNestedParser?x=e.customNestedParser(S):x=n.blockTokens(S))}const v=e.createToken(m,x);a.push(v)}if(a.length!==0)return{items:a,raw:c}}function zl(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]);let a=`${s}${l}`;return o&&o.length>0&&o.forEach((c,d)=>{var u,f;const p=(f=(u=e.renderChild)==null?void 0:u.call(e,c,d+1))!=null?f:e.renderChildren([c]);if(p!=null){const m=p.split(`
69`).map(g=>g?e.indent(g):e.indent("")).join(`
70`);a+=c.type==="paragraph"?`
71
72${m}`:`
73${m}`}}),a}function Oh(t,e){const n={...t};return Fr(t)&&Fr(e)&&Object.keys(e).forEach(r=>{Fr(e[r])&&Fr(t[r])?n[r]=Oh(t[r],e[r]):n[r]=e[r]}),n}function zv(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const c=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize;let u=null;if(l.marks.forEach(p=>{if(p!==o)return!1;u=p}),!u)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==u.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});i.removeMark(c,d,t.type),i.addMark(c,d,p)}}),i.docChanged&&e.view.dispatch(i)}var Rr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Bv=(t,e)=>{if(Dl(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Hr(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const u=Zx(c)+i;return o.forEach(f=>{if(d)return;const p=Bv(u,f.find);if(!p)return;const m=a.state.tr,g=ai({state:a.state,transaction:m}),y={from:r-(p[0].length-i.length),to:s},{commands:b,chain:x,can:k}=new ci({editor:n,state:g});f.handler({state:g,range:y,match:p,commands:b,chain:x,can:k})===null||!m.steps.length||(f.undoable&&m.setMeta(l,{transform:m,from:r,to:s,text:i}),a.dispatch(m),d=!0)}),d}function $v(t){const{editor:e,rules:n}=t,r=new Z({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=Rl(C.from(d),o.schema);const{from:u}=a,f=u+d.length;Hr({editor:e,from:u,to:f,text:d,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return Hr({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Hr({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Hr({editor:e,from:o.pos,to:o.pos,text:`
74`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Bl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...W(R(this,"addOptions",{name:this.name}))}}get storage(){return{...W(R(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Oh(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},un=class jh extends Bl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jh(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Fv=class{constructor(t){this.find=t.find,this.handler=t.handler}},Hv=(t,e,n)=>{if(Dl(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function Wv(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:d}=new ci({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,s,(p,m)=>{var g,y,b,x,k;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const v=(k=(x=(b=p.content)==null?void 0:b.size)!=null?x:p.nodeSize)!=null?k:0,S=Math.max(r,m),N=Math.min(s,m+v);if(S>=N)return;const T=p.isText?p.text||"":p.textBetween(S-m,N-m,void 0,"");Hv(T,i.find,o).forEach(j=>{if(j.index===void 0)return;const q=S+j.index+1,F=q+j[0].length,U={from:n.tr.mapping.map(q),to:n.tr.mapping.map(F)},te=i.handler({state:n,range:U,match:j,commands:a,chain:c,can:d,pasteEvent:o,dropEvent:l});u.push(te)})}),u.every(p=>p!==null)}var Wr=null,Vv=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function qv(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:d,from:u,to:f,rule:p,pasteEvt:m})=>{const g=d.tr,y=ai({state:d,transaction:g});if(!(!Wv({editor:e,state:y,from:Math.max(u-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(d=>new Z({view(u){const f=m=>{var g;r=(g=u.dom.parentElement)!=null&&g.contains(m.target)?u.dom.parentElement:null,r&&(Wr=e)},p=()=>{Wr&&(Wr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(u,f)=>{if(i=r===u.dom.parentElement,l=f,!i){const p=Wr;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(u,f)=>{var p;const m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return o=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,p)=>{const m=u[0],g=m.getMeta("uiEvent")==="paste"&&!s,y=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),x=!!b;if(!g&&!y&&!x)return;if(x){let{text:S}=b;typeof S=="string"?S=S:S=Rl(C.from(S),p.schema);const{from:N}=b,T=N+S.length,w=Vv(S);return a({rule:d,state:p,from:N,to:{b:T},pasteEvt:w})}const k=f.doc.content.findDiffStart(p.doc.content),v=f.doc.content.findDiffEnd(p.doc.content);if(!(!Dv(k)||!v||k===v.b))return a({rule:d,state:p,from:k,to:v,pasteEvt:o})}}))}var hi=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ch(t),this.schema=Ux(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Pn(e.name,this.schema)},r=R(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Xn([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Pn(r.name,this.schema)},i=[],o=R(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&R(r,"exitable",s)&&(l.ArrowRight=()=>un.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));l={...l,...f}}const a=Kb(l);i.push(a);const c=R(r,"addInputRules",s);if(bc(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const p=$v({editor:t,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const d=R(r,"addPasteRules",s);if(bc(r,t.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=qv({editor:t,rules:f});i.push(...p)}}const u=R(r,"addProseMirrorPlugins",s);if(u){const f=u();i.push(...f)}return i})}get attributes(){return wh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=An(this.extensions);return Object.fromEntries(e.filter(n=>!!R(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:fe(n.name,this.schema)},i=R(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,c,d,u,f)=>{const p=xr(a,r);return o({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return Xn([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Pn(s.name,this.schema)},o=R(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Xn([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Pn(s.name,this.schema)},o=R(s,"transformPastedHTML",i);return o?(l,a)=>{const c=r(l,a);return o.call(i,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=An(this.extensions);return Object.fromEntries(e.filter(n=>!!R(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kt(n.name,this.schema)},i=R(n,"addMarkView",s);if(!i)return[];const o=(l,a,c)=>{const d=xr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:u=>{zv(l,t,u)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Pn(e.name,this.schema)};e.type==="mark"&&(((n=W(R(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=W(R(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=R(e,"onBeforeCreate",s),o=R(e,"onCreate",s),l=R(e,"onUpdate",s),a=R(e,"onSelectionUpdate",s),c=R(e,"onTransaction",s),d=R(e,"onFocus",s),u=R(e,"onBlur",s),f=R(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};hi.resolve=Ch;hi.sort=Xn;hi.flatten=jl;var Uv={};Al(Uv,{ClipboardTextSerializer:()=>_h,Commands:()=>Ih,Delete:()=>Lh,Drop:()=>Ph,Editable:()=>zh,FocusEvents:()=>$h,Keymap:()=>Fh,Paste:()=>Hh,Tabindex:()=>Wh,TextDirection:()=>Vh,focusEventsPluginKey:()=>Bh});var ne=class Rh extends Bl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Rh(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},_h=ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Z({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=Mh(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((c,d)=>c.$from.pos-d.$from.pos).map(({$from:c,$to:d})=>Sh(r,{from:c.pos,to:d.pos},l)).join(o??`
75
76`)}}})]}}),Ih=ne.create({name:"commands",addCommands(){return{...hh}}}),Lh=ne.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const d=xh(t.before,[t,...e]);_l(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof Qe){const b=f.slice(m).map(p.from,-1),x=f.slice(m).map(p.to),k=f.invert().map(b,-1),v=f.invert().map(x),S=b>0?(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(T=>T.eq(p.mark)):!1,N=(y=d.doc.nodeAt(x))==null?void 0:y.marks.some(T=>T.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:k,to:v},newRange:{from:b,to:x},partial:!!(N||S),editor:this.editor,transaction:t,combinedTransform:d})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Ph=ne.create({name:"drop",addProseMirrorPlugins(){return[new Z({key:new ae("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),zh=ne.create({name:"editable",addProseMirrorPlugins(){return[new Z({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Bh=new ae("focusEvents"),$h=ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Z({key:Bh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Fh=ne.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:p}=u,m=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,g=m.parent.type.spec.isolating,y=u.pos-u.parentOffset,b=g&&m.parent.childCount===1?y===u.pos:z.atStart(c).from===f;return!d||!p.type.isTextblock||p.textContent.length||!b||b&&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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Cs()||yh()?i:s},addProseMirrorPlugins(){return[new Z({key:new ae("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),s=t.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,a=z.atStart(e.doc).from,c=z.atEnd(e.doc).to;if(i||!(o===a&&l===c)||!jr(n.doc))return;const f=n.tr,p=ai({state:n,transaction:f}),{commands:m}=new ci({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),Hh=ne.create({name:"paste",addProseMirrorPlugins(){return[new Z({key:new ae("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Wh=ne.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Z({key:new ae("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),Vh=ne.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=An(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Z({key:new ae("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Kv=class Vn{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Vn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Vn(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 Vn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const c=new Vn(a,this.editor,s,s||o?n: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,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Jv=`.ProseMirror {
77  position: relative;
78}
79
80.ProseMirror {
81  word-wrap: break-word;
82  white-space: pre-wrap;
83  white-space: break-spaces;
84  -webkit-font-variant-ligatures: none;
85  font-variant-ligatures: none;
86  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
87}
88
89.ProseMirror [contenteditable="false"] {
90  white-space: normal;
91}
92
93.ProseMirror [contenteditable="false"] [contenteditable="true"] {
94  white-space: pre-wrap;
95}
96
97.ProseMirror pre {
98  white-space: pre-wrap;
99}
100
101img.ProseMirror-separator {
102  display: inline !important;
103  border: none !important;
104  margin: 0 !important;
105  width: 0 !important;
106  height: 0 !important;
107}
108
109.ProseMirror-gapcursor {
110  display: none;
111  pointer-events: none;
112  position: absolute;
113  margin: 0;
114}
115
116.ProseMirror-gapcursor:after {
117  content: "";
118  display: block;
119  position: absolute;
120  top: -2px;
121  width: 20px;
122  border-top: 1px solid black;
123  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
124}
125
126@keyframes ProseMirror-cursor-blink {
127  to {
128    visibility: hidden;
129  }
130}
131
132.ProseMirror-hideselection *::selection {
133  background: transparent;
134}
135
136.ProseMirror-hideselection *::-moz-selection {
137  background: transparent;
138}
139
140.ProseMirror-hideselection * {
141  caret-color: transparent;
142}
143
144.ProseMirror-focused .ProseMirror-gapcursor {
145  display: block;
146}`,Yv=class extends Tv{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!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:rv,createMappablePosition:sv},this.setOptions(t),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(),n=mh(e,this.options.autofocus);this.editorState=kn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),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 t=this.editorView.dom;t!=null&&t.editor&&delete t.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(t){console.warn("Failed to remove CSS element:",t)}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=Av(Jv,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=kh(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[zh,_h.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ih,$h,Fh,Wh.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),Ph,Hh,Lh,Vh.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new hi(i,this)}createCommandManager(){this.commandManager=new ci({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Eo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Eo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new uh(t,{...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 l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;
146if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o==null?void 0:o.getMeta("focus"),a=o==null?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Nh(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return ev(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Rl(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
147
148`,textSerializers:n={}}=t||{};return Jx(this.state.doc,{blockSeparator:e,textSerializers:{...Mh(this.schema),...n}})}get isEmpty(){return jr(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new Kv(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Dn(t){return new Rr({find:t.find,handler:({state:e,range:n,match:r})=>{const s=W(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),d=c+o.length;if(Il(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;d<n.to&&i.delete(d,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+o.length;i.addMark(n.from+a,f,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function qh(t){return new Rr({find:t.find,handler:({state:e,range:n,match:r})=>{const s=W(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const a=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>l?d=l:l=d+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,o+r[0].length-1),i.replaceWith(d,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Oo(t){return new Rr({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=W(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function ce(t){return new Rr({find:t.find,handler:({state:e,range:n,match:r})=>{let s=t.replace,i=n.from;const o=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);s+=r[0].slice(l+r[1].length),i+=l;const a=i-o;a>0&&(s=r[0].slice(l-a,l)+s,i=o)}e.tr.insertText(s,i,o)},undoable:t.undoable})}function On(t){return new Rr({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=W(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),c=a&&hl(a,t.type,i);if(!c)return null;if(o.wrap(a,c),t.keepMarks&&t.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,m=f||u.$to.parentOffset&&u.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,i).run()}const d=o.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&$t(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&o.join(n.from-1)},undoable:t.undoable})}var Gv=t=>"touches"in t,Qv=class{constructor(t){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=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,d=a.clientY-this.startY;this.handleResize(c,d)},this.handleMouseUp=()=>
148{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),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=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.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 t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!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 t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}
148removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):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(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Gv(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.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(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+n:a&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let c=Math.max(this.minSize.width,t),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 l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},ve=class Uh extends Bl{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Uh(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function on(t){return new Fv({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=W(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const d=a.search(/\S/),u=n.from+a.indexOf(l),f=u+l.length;if(Il(n.from,n.to,e.doc).filter(g=>g.mark.type.excluded.find(b=>b===t.type&&b!==g.mark.type)).filter(g=>g.to>u).length)return null;f<n.to&&o.delete(f,n.to),u>n.from&&o.delete(n.from+d,u),c=n.from+d+l.length,o.addMark(n.from+d,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}var Kh={exports:{}},Jh={};/**
149 * @license React
150 * use-sync-external-store-shim/with-selector.production.js
151 *
152 * Copyright (c) Meta Platforms, Inc. and affiliates.
153 *
154 * This source code is licensed under the MIT license found in the
155 * LICENSE file in the root directory of this source tree.
156 */var fi=M,Xv=cl;function Zv(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var e1=typeof Object.is=="function"?Object.is:Zv,t1=Xv.useSyncExternalStore,n1=fi.useRef,r1=fi.useEffect,s1=fi.useMemo,i1=fi.useDebugValue;Jh.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=n1(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=s1(function(){function a(p){if(!c){if(c=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return u=m}return u=p}if(m=u,e1(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,u=g)}var c=!1,d,u,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,r,s]);
156var l=t1(t,i[0],i[1]);return r1(function(){o.hasValue=!0,o.value=l},[l]),i1(l),l};Kh.exports=Jh;var o1=Kh.exports,l1=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},a1=({contentComponent:t})=>{const e=cl.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return h.jsx(h.Fragment,{children:Object.values(e)})};function c1(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:np.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var d1=class extends Pt.Component{constructor(t){super(t),this.editorContentRef=Pt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=c1(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:l1(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&h.jsx(a1,{contentComponent:t.contentComponent})]})}},u1=M.forwardRef((t,e)=>{const n=Pt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Pt.createElement(d1,{key:n,innerRef:e,...t})}),Yh=Pt.memo(u1),h1=typeof window<"u"?M.useLayoutEffect:M.useEffect,f1=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function p1(t){var e;const[n]=M.useState(()=>new f1(t.editor)),r=o1.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:pp);return h1(()=>n.watch(t.editor),[t.editor,n]),M.useDebugValue(r),r}var m1=!1,Gh=typeof window>"u",g1=Gh||!!(typeof window<"u"&&window.next),y1=class Qh{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return Gh?(n&&m1&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):g1&&e===void 0&&(n=!1),n?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)}
156,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)},onMount:(...r)=>{var s,i;return(i=(s=this.options.current).onMount)==null?void 0:i.call(s,...r)},onUnmount:(...r)=>{var s,i;return(i=(s=this.options.current).onUnmount)==null?void 0:i.call(s,...r)}};return new Yv(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Qh.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function b1(t={},e=[]){const n=M.useRef(t);n.current=t;const[r]=M.useState(()=>new y1(n)),s=cl.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return M.useDebugValue(s),M.useEffect(r.onRender(e)),p1({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var Xh=M.createContext({editor:null});Xh.Consumer;var x1=M.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),v1=()=>M.useContext(x1);Pt.forwardRef((t,e)=>{const{onDragStart:n}=v1(),r=t.as||"div";return h.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Pt.createContext({markViewContentRef:()=>{}});var $l=M.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});$l.displayName="TiptapContext";var k1=()=>M.useContext($l);function Zh({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=M.useMemo(()=>({editor:n}),[n]),s=M.useMemo(()=>({editor:n}),[n]);return h.jsx(Xh.Provider,{value:s,children:h.jsx($l.Provider,{value:r,children:t})})}Zh.displayName="Tiptap";function ef({...t}){const{editor:e}=k1();return h.jsx(Yh,{editor:e,...t})}ef.displayName="Tiptap.Content";Object.assign(Zh,{Content:ef});var Ss=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},w1=(t,e)=>{var n;const{state:r,view:s}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0)return!1;const l=o.depth-1;if(l<0)return!1;const a=o.node(l),c=o.index(l);if(c===0)return!1;if(a.type===e)return t.commands.lift(e.name);const d=a.child(c-1);if(d.type!==e||!((n=d.lastChild)!=null&&n.isTextblock))return!1;const u=o.before(),p=u-1-1,{tr:m}=r;return m.delete(u,o.after()).insert(p,o.parent.content),m.setSelection(_.create(m.doc,p)),s.dispatch(m.scrollIntoView()),!0},C1=/^\s*>\s$/,S1=ve.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ss("blockquote",{...Q(this.options.HTMLAttributes,t),children:Ss("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,l;const d=((l=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?l:e.renderChildren([s])).split(`
157`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(d.join(`
158`))}),r.join(`
159${n}
160`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}}
vendor: 2,438 bytes, line 160
160,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>w1(this.editor,this.type)}},addInputRules(){return[On({find:C1,type:this.type})]}}),M1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,N1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,T1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,E1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,A1=un.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Ss("strong",{...Q(this.options.HTMLAttributes,t),children:Ss("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Dn({find:M1,type:this.type}),Dn({find:T1,type:this.type})]},addPasteRules(){return[on({find:N1,type:this.type}),on({find:E1,type:this.type})]}}),D1=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},O1=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},j1=un.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}}
vendor: 6,969 bytes, lines 160-181
160,addInputRules(){return[Dn({find:D1,type:this.type})]},addPasteRules(){return[on({find:O1,type:this.type})]}}),Ji=4,R1=/^```([a-z]+)?[\s\n]$/,_1=/^~~~([a-z]+)?[\s\n]$/,I1=ve.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ji,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Q(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
161`):r=`\`\`\`${s}
162
163\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ji,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:d}=s,p=r.doc.textBetween(c,d,`
164`,`
165`).split(`
166`).map(m=>l+m).join(`
167`);return a.replaceWith(c,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ji,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=i,d=i.start(),u=i.end(),p=r.doc.textBetween(d,u,`
168`,`
169`).split(`
170`);let m=0,g=0;const y=c-d;for(let N=0;N<p.length;N+=1){if(g+p[N].length>=y){m=N;break}g+=p[N].length+1}const x=((a=p[m].match(/^ */))==null?void 0:a[0])||"",k=Math.min(x.length,n);if(k===0)return!0;let v=d;for(let N=0;N<m;N+=1)v+=p[N].length+1;return l.delete(v,v+k),c-v<=k&&l.setSelection(_.create(l.doc,v)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=s,f=r.doc.textBetween(a,c,`
171`,`
172`).split(`
173`).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,n);return p.slice(y)}).join(`
174`);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
175
176`);return!i||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(z.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Oo({find:R1,type:this.type,getAttributes:t=>({language:t[1]})}),Oo({find:_1,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Z({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
177`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(_.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),L1=ve.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
178
179`):""}),P1=ve.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Q(this.options.HTMLAttributes,t)]},renderText(){return`
180`},renderMarkdown:()=>`  
181`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),z1=ve.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Q(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Oo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
181)\\s$`),type:this.type,getAttributes:{level:t}}))}}),B1=ve.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Q(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Ev(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return Th(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(_.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(I.create(o.doc,a.pos)):o.setSelection(_.create(o.doc,a.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,u=d==null?void 0:d.create();u&&(o.insert(c,u),o.setSelection(_.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[qh({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,045 bytes, line 181
181ype})]}}),$1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,F1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,H1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,W1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,V1=un.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
181,addInputRules(){return[Dn({find:$1,type:this.type}),Dn({find:H1,type:this.type})]},addPasteRules(){return[on({find:F1,type:this.type}),on({find:W1,type:this.type})]}});const q1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
181hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",U1="ελ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",jo="numeric",Ro="ascii",_o="alpha",Zn="asciinumeric",qn="alphanumeric",Io="domain",tf="emoji",K1="scheme",J1="slashscheme",Yi="whitespace";function Y1(t,e){return t in e||(e[t]=[]),e[t]}function Yt(t,e,n){e[jo]&&(e[Zn]=!0,e[qn]=!0),e[Ro]&&(e[Zn]=!0,e[_o]=!0),e[Zn]&&(e[qn]=!0),e[_o]&&(e[qn]=!0),e[qn]&&(e[Io]=!0),e[tf]&&(e[Io]=!0);for(const r in e){const s=Y1(r,n);s.indexOf(t)<0&&s.push(t)}}function G1(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function je(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}je.groups={};je.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||je.groups;let s;return e&&e.j?s=e:(s=new je(e),n&&r&&Yt(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||je.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new je,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new je,i){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(G1(o.t,r),n);Yt(i,a,r)}else n&&Yt(i,n,r);o.t=i}return s.j[t]=o,o}};const H=(t,e,n,r,s)=>t.ta(e,n,r,s),ie=(t,e,n,r,s)=>t.tr(e,n,r,s),kc=(t,e,n,r,s)=>t.ts(e,n,r,s),E=(t,e,n,r,s)=>t.tt(e,n,r,s),ht="WORD",Lo="UWORD",nf="ASCIINUMERICAL",rf="ALPHANUMERICAL",vr="LOCALHOST",Po="TLD",zo="UTLD",ss="SCHEME",vn="SLASH_SCHEME",Fl="NUM",Bo="WS",Hl="NL",er="OPENBRACE",tr="CLOSEBRACE",Ms="OPENBRACKET",Ns="CLOSEBRACKET",Ts="OPENPAREN",Es="CLOSEPAREN",As="OPENANGLEBRACKET",Ds="CLOSEANGLEBRACKET",Os="FULLWIDTHLEFTPAREN",js="FULLWIDTHRIGHTPAREN",Rs="LEFTCORNERBRACKET",_s="RIGHTCORNERBRACKET",Is="LEFTWHITECORNERBRACKET",Ls="RIGHTWHITECORNERBRACKET",Ps="FULLWIDTHLESSTHAN",zs="FULLWIDTHGREATERTHAN",Bs="AMPERSAND",$s="APOSTROPHE",Fs="ASTERISK",Nt="AT",Hs="BACKSLASH",Ws="BACKTICK",Vs="CARET",Gt="COLON",Wl="COMMA",qs="DOLLAR",rt="DOT",Us="EQUALS",Vl="EXCLAMATION",We="HYPHEN",nr="PERCENT",Ks="PIPE",Js="PLUS",Ys="POUND",rr="QUERY",ql="QUOTE",sf="FULLWIDTHMIDDLEDOT",Ul="SEMI",st="SLASH",sr="TILDE",Gs="UNDERSCORE",of="EMOJI",Qs="SYM";var lf=Object.freeze({__proto__:null,ALPHANUMERICAL:rf,AMPERSAND:Bs,APOSTROPHE:$s,ASCIINUMERICAL:nf,ASTERISK:Fs,AT:Nt,BACKSLASH:Hs,BACKTICK:Ws,CARET:Vs,CLOSEANGLEBRACKET:Ds,CLOSEBRACE:tr,CLOSEBRACKET:Ns,CLOSEPAREN:Es,COLON:Gt,COMMA:Wl,DOLLAR:qs,DOT:rt,EMOJI:of,EQUALS:Us,EXCLAMATION:Vl,FULLWIDTHGREATERTHAN:zs,FULLWIDTHLEFTPAREN:Os,FULLWIDTHLESSTHAN:Ps,FULLWIDTHMIDDLEDOT:sf,FULLWIDTHRIGHTPAREN:js,HYPHEN:We,LEFTCORNERBRACKET:Rs,LEFTWHITECORNERBRACKET:Is,LOCALHOST:vr,NL:Hl,NUM:Fl,OPENANGLEBRACKET:As,OPENBRACE:er,OPENBRACKET:Ms,OP
vendor: 9,444 bytes, lines 181-185
181ENPAREN:Ts,PERCENT:nr,PIPE:Ks,PLUS:Js,POUND:Ys,QUERY:rr,QUOTE:ql,RIGHTCORNERBRACKET:_s,RIGHTWHITECORNERBRACKET:Ls,SCHEME:ss,SEMI:Ul,SLASH:st,SLASH_SCHEME:vn,SYM:Qs,TILDE:sr,TLD:Po,UNDERSCORE:Gs,UTLD:zo,UWORD:Lo,WORD:ht,WS:Bo});const dt=/[a-z]/,zn=new RegExp("\\p{L}","u"),Gi=new RegExp("\\p{Emoji}","u"),ut=/\d/,Qi=/\s/,wc="\r",Xi=`
182`,Q1="️",X1="‍",Zi="";let Vr=null,qr=null;function Z1(t=[]){const e={};je.groups=e;const n=new je;Vr==null&&(Vr=Cc(q1)),qr==null&&(qr=Cc(U1)),E(n,"'",$s),E(n,"{",er),E(n,"}",tr),E(n,"[",Ms),E(n,"]",Ns),E(n,"(",Ts),E(n,")",Es),E(n,"<",As),E(n,">",Ds),E(n,"(",Os),E(n,")",js),E(n,"「",Rs),E(n,"」",_s),E(n,"『",Is),E(n,"』",Ls),E(n,"<",Ps),E(n,">",zs),E(n,"&",Bs),E(n,"*",Fs),E(n,"@",Nt),E(n,"`",Ws),E(n,"^",Vs),E(n,":",Gt),E(n,",",Wl),E(n,"$",qs),E(n,".",rt),E(n,"=",Us),E(n,"!",Vl),E(n,"-",We),E(n,"%",nr),E(n,"|",Ks),E(n,"+",Js),E(n,"#",Ys),E(n,"?",rr),E(n,'"',ql),E(n,"/",st),E(n,";",Ul),E(n,"~",sr),E(n,"_",Gs),E(n,"\\",Hs),E(n,"・",sf);const r=ie(n,ut,Fl,{[jo]:!0});ie(r,ut,r);const s=ie(r,dt,nf,{[Zn]:!0}),i=ie(r,zn,rf,{[qn]:!0}),o=ie(n,dt,ht,{[Ro]:!0});ie(o,ut,s),ie(o,dt,o),ie(s,ut,s),ie(s,dt,s);const l=ie(n,zn,Lo,{[_o]:!0});ie(l,dt),ie(l,ut,i),ie(l,zn,l),ie(i,ut,i),ie(i,dt),ie(i,zn,i);const a=E(n,Xi,Hl,{[Yi]:!0}),c=E(n,wc,Bo,{[Yi]:!0}),d=ie(n,Qi,Bo,{[Yi]:!0});E(n,Zi,d),E(c,Xi,a),E(c,Zi,d),ie(c,Qi,d),E(d,wc),E(d,Xi),ie(d,Qi,d),E(d,Zi,d);const u=ie(n,Gi,of,{[tf]:!0});E(u,"#"),ie(u,Gi,u),E(u,Q1,u);const f=E(u,X1);E(f,"#"),ie(f,Gi,u);const p=[[dt,o],[ut,s]],m=[[dt,null],[zn,l],[ut,i]];for(let g=0;g<Vr.length;g++)Ct(n,Vr[g],Po,ht,p);for(let g=0;g<qr.length;g++)Ct(n,qr[g],zo,Lo,m);Yt(Po,{tld:!0,ascii:!0},e),Yt(zo,{utld:!0,alpha:!0},e),Ct(n,"file",ss,ht,p),Ct(n,"mailto",ss,ht,p),Ct(n,"http",vn,ht,p),Ct(n,"https",vn,ht,p),Ct(n,"ftp",vn,ht,p),Ct(n,"ftps",vn,ht,p),Yt(ss,{scheme:!0,ascii:!0},e),Yt(vn,{slashscheme:!0,ascii:!0},e),t=t.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<t.length;g++){const y=t[g][0],x=t[g][1]?{[K1]:!0}:{[J1]:!0};y.indexOf("-")>=0?x[Io]=!0:dt.test(y)?ut.test(y)?x[Zn]=!0:x[Ro]=!0:x[jo]=!0,kc(n,y,y,x)}return kc(n,"localhost",vr,{ascii:!0}),n.jd=new je(Qs),{start:n,tokens:Object.assign({groups:e},lf)}}function af(t,e){const n=ek(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,a=null,c=0,d=null,u=-1,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(u=0,f=0,d=l):u>=0&&(u+=n[o].length,f++),c+=n[o].length,i+=n[o].length,o++;i-=u,o-=f,c-=u,s.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function ek(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Ct(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new je(r),i.jr=s.slice(),t.j[a]=i),t=i}return i=new je(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function Cc(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const kr={defaultProtocol:"http",events:null,format:Sc,formatHref:Sc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Kl(t,e=null){let n=Object.assign({},kr);t&&(n=Object.assign(n,t instanceof Kl?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}Kl.prototype={o:kr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:kr[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Sc(t){return t}function cf(t,e){this.t="token",this.v=t,this.tk=e}cf.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=kr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:u}}};function pi(t,e){class n extends cf{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const tk=pi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Mc=pi("text"),nk=pi("nl"),Ur=pi("url",{isLink:!0,toHref(t=kr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==vr&&t[1].t===Gt}}),He=t=>new je(t);function rk({groups:t}){const e=t.domain.concat([Bs,Fs,Nt,Hs,Ws,Vs,qs,Us,We,Fl,nr,Ks,Js,Ys,st,Qs,sr,Gs]),n=[$s,Gt,Wl,rt,Vl,nr,rr,ql,Ul,As,Ds,er,tr,Ns,Ms,Ts,Es,Os,js,Rs,_s,Is,Ls,Ps,zs],r=[Bs,$s,Fs,Hs,Ws,Vs,qs,Us,We,er,tr,nr,Ks,Js,Ys,rr,st,Qs,sr,Gs],s=He(),i=E(s,sr);H(i,r,i),H(i,t.domain,i);const o=He(),l=He(),a=He();H(s,t.domain,o),H(s,t.scheme,l),H(s,t.slashscheme,a),H(o,r,i),H(o,t.domain,o);const c=E(o,Nt);E(i,Nt,c),E(l,Nt,c),E(a,Nt,c);const d=E(i,rt);H(d,r,i),H(d,t.domain,i);const u=He();H(c,t.domain,u),H(u,t.domain,u);const f=E(u,rt);H(f,t.domain,u);const p=He(tk);H(f,t.tld,p),H(f,t.utld,p),E(c,vr,p);const m=E(u,We);E(m,We,m),H(m,t.domain,u),H(p,t.domain,u),E(p,rt,f),E(p,We,m);const g=E(o,We),y=E(o,rt);E(g,We,g),H(g,t.domain,o),H(y,r,i),H(y,t.domain,o);const b=He(Ur);H(y,t.tld,b),H(y,t.utld,b),H(b,t.domain,o),H(b,r,i),E(b,rt,y),E(b,We,g),E(b,Nt,c);const x=E(b,Gt),k=He(Ur);H(x,t.numeric,k);const v=He(Ur),S=He();H(v,e,v),H(v,n,S),H(S,e,v),H(S,n,S),E(b,st,v),E(k,st,v);const N=E(l,Gt),T=E(a,Gt),w=E(T,st),j=E(w,st);H(l,t.domain,o),E(l,rt,y),E(l,We,g),H(a,t.domain,o),E(a,rt,y),E(a,We,g),H(N,t.domain,v),E(N,st,v),E(N,rr,v),H(j,t.domain,v),H(j,e,v),E(j,st,v);const q=[[er,tr],[Ms,Ns],[Ts,Es],[As,Ds],[Os,js],[Rs,_s],[Is,Ls],[Ps,zs]];for(let F=0;F<q.length;F++){const[U,te]=q[F],se=E(v,U);E(S,U,se);const J=He(Ur);H(se,e,J);const Fe=He();H(se,n,Fe),E(se,te,v),H(J,e,J),H(J,n,Fe),H(Fe,e,J),H(Fe,n,Fe),E(J,te,v),E(Fe,te,v)}return E(s,vr,b),E(s,Hl,nk),{start:s,tokens:lf}}function sk(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,a=null,c=null,d=0,u=null,f=-1;for(;s<r&&!(a=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=a||l.go(n[s].t));)a=null,l=c,l.accepts()?(f=0,u=l):f>=0&&f++,s++,d++;if(f<0)s-=d,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(eo(Mc,e,o)),o=[]),s-=f,d-=f;const p=u.t,m=n.slice(s-d,s);i.push(eo(p,e,m))}}return o.length>0&&i.push(eo(Mc,e,o)),i}function eo(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const ik=typeof console<"u"&&console&&console.warn||(()=>{}),ok="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ee={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function lk(){return je.groups={},ee.scanner=null,ee.parser=null,ee.tokenQueue=[],ee.pluginQueue=[],ee.customSchemes=[],ee.initialized=!1,ee}function Nc(t,e=!1){if(ee.initialized&&ik(`linkifyjs: already initialized - will not register custom scheme "${t}" ${ok}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1831. Must only contain digits, lowercase ASCII letters or "-"
1842. Cannot start or end with "-"
1853. "-" cannot repeat`);ee.customSchemes.push([t,e])}function ak(){ee.scanner=Z1(ee.customSchemes);for(let t=0;t<ee.tokenQueue.length;t++)ee.tokenQueue[t][1]({scanner:ee.scanner});ee.parser=rk(ee.scanner.tokens);for(let t=0;t<ee.pluginQueue.length;t++)ee.pluginQueue[t][1]({scanner:ee.scanner,parser:ee.parser});return ee.initialized=!0,ee}function Jl(t){return ee.initialized||ak(),sk(ee.parser.start,t,af(ee.scanner.start,t))}Jl.scan=af;function df(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Kl(n),s=Jl(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Yl="[\0-   ᠎ -\u2029  ]",ck=new RegExp(Yl),dk=new RegExp(`${Yl}$`),uk=new RegExp(Yl,"g");function hk(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function fk(t){return new Z({key:new ae("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>
185c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=xh(n.doc,[...e]);if(_l(l).forEach(({newRange:c})=>{const d=Hx(r.doc,c,p=>p.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!dk.test(p))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const p=f.split(ck).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=u.pos+f.lastIndexOf(m);if(!m)return!1;const y=Jl(m).map(b=>b.toObject(t.defaultProtocol));if(!hk(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Il(b.from,b.to,r.doc).some(x=>x.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function pk(t){return new Z({key:new ae("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=Nh(e.state,t.type.name),c=(s=o.href)!=null?s:a.href,d=(i=o.target)!=null?i:a.target;c&&(window.open(c,d),l=!0)}return l}}})}function mk(t){return new Z({key:new ae("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=df(a,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Wt(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(uk,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var uf=un.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Nc(t);return}Nc(t.scheme,t.optionalSlashes)})},onDestroy(){lk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Wt(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Wt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Wt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Q(this.options.HTMLAttributes,t),0]:["a",Q(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>
vendor: 3,222 bytes, lines 185-186
185e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Wt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Wt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[on({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=df(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Wt(o,n),protocols:n,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},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(fk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Wt(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(pk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(mk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),gk=uf,yk=Object.defineProperty,bk=(t,e)=>{for(var n in e)yk(t,n,{get:e[n],enumerable:!0})},xk="listItem",Tc="textStyle",Ec=/^\s*([-+*])\s$/,hf=ve.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
186`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xk,this.editor.getAttributes(Tc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
186,addInputRules(){let t=On({find:Ec,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=On({find:Ec,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Tc),editor:this.editor})),[t]}}),vk=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!n.includes(a.type.name))return null;const c=t.schema.nodes[e];let d=!1;if(a.forEach(p=>{p.type===c&&p.childCount>1&&(d=!0)}),!d)return null;const u=t.doc.resolve(s.after()).nodeAfter;if(!u||!n.includes(u.type.name))return null;const f=[];return u.forEach(p=>{f.push(p)}),f.length===0?null:{listItemDepth:i,nestedList:u,nestedListPos:s.after(),insertPos:s.after(i),items:f}},kk=(t,e,n,r)=>{const s=vk(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=s,d=t.tr;d.delete(l,l+o.nodeSize);const u=d.mapping.map(a);return d.insert(u,C.from(c)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},wk=(t,e,n)=>kk(t.state,t.view.dispatch,e,n),ff=(t,e)=>ne.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>wk(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),pf=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Kr="abcdefghijklmnopqrstuvwxyz",Ck="[a-zA-Z]{1,2}",mf=String.raw`\d+|[ivxlcdmIVXLCDM]+|${Ck}`;function mi(t){let e=t,n="";for(const[r,s]of pf)for(;e>=r;)n+=s,e-=r;return n}function Gl(t){return mi(t).toUpperCase()}function gf(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let s=!1;for(const[i,o]of pf)if(e.startsWith(o,n)){r+=i,n+=o.length,s=!0;break}if(!s)return 0}return r}function Sk(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=gf(t);return e<=0?!1:(t===t.toLowerCase()?mi(e):Gl(e))===t}function Mk(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function Xs(t){if(t<=26)return Kr[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Kr[n]:Kr[e]+Kr[n]}function gi(t){if(!(!t||/^\d+$/.test(t))){if(Sk(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function Ql(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=gi(t);if(e==="i"||e==="I")return gf(t);if(e==="a"||e==="A"){const r=Mk(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function Nk(t,e){if(t==="numeric")return String(e);switch(t){case"a":return Xs(e);case"A":return Xs(e).toUpperCase();case"i":return mi(e);case"I":return Gl(e);default:return String(e)}}function Tk(t){var e;if(t.length===0)return!1;const n=(e=gi(t[0]))!=null?e:"numeric",r=Ql(t[0]);if(r<1)return!1;for(let s=0;s<t.length;s++){const i=Nk(n,r+s);if(t[s]!==i)return!1}return!0}function Ek(t){return{type:gi(t),start:Ql(t)}}function Ak(t){const{type:e,start:n}=Ek(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function Dk(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${Xs(r)}${n}`;case"A":return`${Xs(r).toUpperCase()}${n}`;case"i":return`${mi(r)}${n}`;case"I":return`${Gl(r)}${n}`;default:return`${r}${n}`}}function Ok(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function jk(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var yf=ve.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(Ok(t))return{type:"listItem",content:[{type:"paragraph",content:jk(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const a=t.tokens.slice(1),c=r(a);s.push(...c)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>zl(t,e,r=>{var s,i,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const a=((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1,c=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,d=a-1+(r.index||0);return Dk(c,d,". ")}return"- "},n),addExtensions(){return[ff(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},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={};bk(Rk,{findListItemPos:()=>yi,getNextListDepth:()=>Xl,handleBackspace:()=>$o,handleDelete:()=>Fo,hasListBefore:()=>bf,hasListItemAfter:()=>_k,hasListItemBefore:()=>Ik,listItemHasSubList:()=>Lk,nextListIsDeeper:()=>xf,nextListIsHigher:()=>vf});var yi=(t,e)=>{const{$from:n}=e.selection,r=fe(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Xl=(t,e)=>{const n=yi(t,e);if(!n)return!1;const[,r]=Xx(e,t,n.$pos.pos+4);return r},bf=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},$o=(t,e,n)=>{if(t.commands.undoInputRule())return!0;
186if(t.state.selection.from!==t.state.selection.to)return!1;if(!Bt(t.state,e)&&bf(t.state,e,n)){const{$anchor:r}=t.state.selection,s=t.state.doc.resolve(r.before()-1),i=[];s.node().descendants((a,c)=>{a.type.name===e&&i.push({node:a,pos:c})});const o=i.at(-1);if(!o)return!1;const l=t.state.doc.resolve(s.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!Bt(t.state,e)||!nv(t.state)?!1:t.chain().liftListItem(e).run()},xf=(t,e)=>{const n=Xl(t,e),r=yi(t,e);return!r||!n?!1:n>r.depth},vf=(t,e)=>{const n=Xl(t,e),r=yi(t,e);return!r||!n?!1:n<r.depth},Fo=(t,e)=>{if(!Bt(t.state,e)||!tv(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:xf(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():vf(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},_k=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},Ik=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},Lk=(t,e,n)=>{if(!n)return!1;const r=fe(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},kf=ne.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fo(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fo(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&$o(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&$o(t,n,r)&&(e=!0)}),e}}}}),Ho=new RegExp(`^(\\s*)(${mf})([.)])\\s+(.*)$`),Pk=/^\s/,Un={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function zk(t){return Ho.test(t.trimStart())}function Bk(t){const e=t.trimStart();return Un.bulletItem.test(e)||zk(e)||Un.heading.test(e)||Un.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Un.codeFence.test(e)}function $k(t){return Object.values(Un).some(e=>e.test(t))}function Fk(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&Bk(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function Hk(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(Ho);if(!i)break;const[,o,l,a,c]=i,d=o.length,u=parseInt(l,10),f=isNaN(u)?gi(l):void 0,p=isNaN(u)?Ql(l):u,m=[c];let g=n+1;const y=[s];let b=!1;for(;g<t.length;){const x=t[g];if(x.match(Ho))break;if(x.trim()==="")y.push(x),m.push(""),b=!0,g+=1;else if(x.match(Pk)){const v=x.length-x.trimStart().length,S=d+l.length+1;y.push(x),m.push(x.slice(Math.min(v,S))),g+=1}else{if(b||$k(x))break;y.push(x),m.push(x),g+=1}}e.push({indent:d,number:p,type:f,content:m.join(`
187`).trim(),contentLines:m,raw:y.join(`
188`)}),r=g,n=g}return[e,r]}var Wk=new RegExp(`^(${mf})([.)])\\s+(.+)$`);function Vk(t){const e=t.split(`
189`).filter(i=>i.trim().length>0);if(e.length===0)return null;const n=[];for(const i of e){const o=i.trim().match(Wk);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(i=>i.marker);return Tk(r)?{type:"orderedList",attrs:Ak(n[0].marker),content:n.map(i=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:i.content}]}]}))}:null}function wf(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:l}=Fk(i.contentLines),a=o.join(`
190`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const d=l.join(`
191`).trim();if(d){const p=n.blockTokens(d);c.push(...p)}let u=s+1;const f=[];for(;u<t.length&&t[u].indent>e;)f.push(t[u]),u+=1;if(f.length>0){const p=Math.min(...f.map(g=>g.indent)),m=wf(f,p,n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:m,raw:f.map(g=>g.raw).join(`
192`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=u}else s+=1}return r}function qk(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.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 Uk="listItem",Ac="textStyle",Dc=/^(\d+)\.\s$/;function Oc(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var Cf=ve.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const s=Oc(n);if(s)return s}const r=t.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Oc(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,s=Q(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),n&&n!=="1"&&(s.type=n),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,s=t.items?qk(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
193`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;const i=t.split(`
194`),[o,l]=Hk(i);if(o.length===0)return;
194const a=wf(o,o[0].indent,n);if(a.length===0)return;const c=((r=o[0])==null?void 0:r.number)||1,d=(s=o[0])==null?void 0:s.type;return{type:"list",ordered:!0,start:c,typeMarker:d,items:a,raw:i.slice(0,l).join(`
195`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Uk,this.editor.getAttributes(Ac)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Z({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(s!=null&&s.trim())return!1;const i=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!i)return!1;const o=Vk(i);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];
vendor: 3,603 bytes, line 195
195let e=On({find:Dc,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=On({find:Dc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Ac)}),joinPredicate:t,editor:this.editor})),[e]}}),Kk=/^\s*(\[([( |x])?\])\s$/,Jk=ve.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Q(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return zl(t,e,s)},addExtensions(){return this.options.nested?[ff(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var f,p;l.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{s.setAttribute(u,f)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(e).forEach(([u,f])=>{s.setAttribute(u,f)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:u=>{if(u.type!==this.type)return!1;s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u);const f=r.extensionManager.attributes,p=xr(u,f),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?s.setAttribute(y,g[y]):s.removeAttribute(y))}),Object.entries(p).forEach(([y,b])=>{b==null?y in g?s.setAttribute(y,g[y]):s.removeAttribute(y):s.setAttribute(y,b)}
195),d=m,!0}}}},addInputRules(){return[On({find:Kk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Yk=ve.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
196`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=Do(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(o){const l={type:"taskList",raw:o.raw,items:o.items},a=i.slice(o.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(i)},s=Do(t,{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:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ne.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(hf.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(yf.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(kf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Cf.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Jk.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Yk.configure(this.options.taskList)),t}});var Jr="&nbsp;",to=" ",Gk=ve.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Q(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Jr||n[0].text===Jr||n[0].raw===to||n[0].text===to)&&r.length===1&&r[0].type==="text"&&(r[0].text===Jr||r[0].text===to)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?Jr:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Qk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Xk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Zk=un.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Q(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}}
vendor: 5,288 bytes, line 196
196,addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Dn({find:Qk,type:this.type})]},addPasteRules(){return[on({find:Xk,type:this.type})]}}),ew=ve.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),tw=un.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Q(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function nw(t={}){return new Z({view(e){return new rw(e,t)}})}class rw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=u?m.bottom:m.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,p=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=au(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class oe extends z{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return oe.valid(r)?new oe(r):z.near(r)}content(){return A.empty}eq(e){return e instanceof oe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new oe(e.resolve(n.pos))}getBookmark(){return new Zl(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!sw(e)||!iw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&oe.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>
vendor: 14,813 bytes, line 196
1960?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(oe.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!I.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(oe.valid(l))return l}return null}}}oe.prototype.visible=!1;oe.findFrom=oe.findGapCursorFrom;z.jsonID("gapcursor",oe);class Zl{constructor(e){this.pos=e}map(e){return new Zl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return oe.valid(n)?new oe(n):z.near(n)}}function Sf(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function sw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Sf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function iw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Sf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ow(){return new Z({props:{decorations:dw,createSelectionBetween(t,e,n){return e.pos==n.pos&&oe.valid(n)?new oe(n):null},handleClick:aw,handleKeyDown:lw,handleDOMEvents:{beforeinput:cw}}})}const lw=El({ArrowLeft:Yr("horiz",-1),ArrowRight:Yr("horiz",1),ArrowUp:Yr("vert",-1),ArrowDown:Yr("vert",1)});function Yr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof _){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=oe.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new oe(c))),!0):!1}}function aw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!oe.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&I.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new oe(r))),!0)}function cw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof oe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=C.empty;for(let o=r.length-1;o>=0;o--)s=C.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new A(s,0,0));return i.setSelection(_.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function dw(t){if(!(t.selection instanceof oe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",K.create(t.doc,[ye.widget(t.selection.head,e,{key:"gapcursor"})])}var Zs=200,xe=function(){};xe.prototype.append=function(e){return e.length?(e=xe.from(e),!this.length&&e||e.length<Zs&&this.leafAppend(e)||this.length<Zs&&e.leafPrepend(this)||this.appendInner(e)):this};xe.prototype.prepend=function(e){return e.length?xe.from(e).append(this):this};xe.prototype.appendInner=function(e){return new uw(this,e)};xe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};xe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};xe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};xe.from=function(e){return e instanceof xe?e:e&&e.length?new Mf(e):xe.empty};var Mf=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Zs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Zs)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(xe);xe.empty=new Mf([]);var uw=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),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}(xe);const hw=500;class Ge{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,d.push(u);return}if(s){d.push(new it(u.map));let p=u.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new it(m,void 0,void 0,c.length+d.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(u.step);if(u.selection)return l=s?u.selection.map(s.slice(i)):u.selection,a=new Ge(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new it(e.mapping.maps[d],u,n),p;(p=a&&a.merge(f))&&(f=p,d?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(o++,n=void 0),s||(a=f)}let c=o-r.depth;return c>pw&&(l=fw(l,c),o-=c),new Ge(l.append(i),o)}remapping(e,n){let r=new fr;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Ge(this.items.append(e.map(n=>new it(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(i.slice(a+1,p));y&&l++,r.push(new it(m,g,y))}else r.push(new it(m))},s);let c=[];for(let f=n;f<o;f++)c.push(new it(i.maps[f]));let d=this.items.slice(0,s).append(c).append(r),u=new Ge(d,l);return u.emptyItemCount()>hw&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let d=o.selection&&o.selection.map(n.slice(r));d&&i++;let u=new it(c.invert(),a,d),f,p=s.length-1;(f=s.length&&s[p].merge(u))?s[p]=f:s.push(u)}}else o.map&&r--},this.items.length,0),new Ge(xe.from(s.reverse()),i)}}Ge.empty=new Ge(xe.empty,0);function fw(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class it{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new it(n.getMap().invert(),n,this.selection)}}}class Tt{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const pw=20;function mw(t,e,n,r){let s=n.getMeta(tn),i;if(s)return s.historyState;n.getMeta(bw)&&(t=new Tt(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(tn))return o.getMeta(tn).redo?new Tt(t.done.addTransform(n,void 0,r,is(e)),t.undone,jc(n.mapping.maps),t.prevTime,t.prevComposition):new Tt(t.done,t.undone.addTransform(n,void 0,r,is(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!gw(n,t.prevRanges)),c=o?no(t.prevRanges,n.mapping):jc(n.mapping.maps);return new Tt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,is(e)),Ge.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Tt(t.done.rebased(n,i),t.undone.rebased(n,i),no(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Tt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),no(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function gw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function jc(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function no(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function yw(t,e,n){let r=is(e),s=tn.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new Tt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(tn,{redo:n,historyState:a})}let ro=!1,Rc=null;function is(t){let e=t.plugins;if(Rc!=e){ro=!1,Rc=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ro=!0;break}}return ro}const tn=new ae("history"),bw=new ae("closeHistory");function xw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Z({key:tn,state:{init(){return new Tt(Ge.empty,Ge.empty,null,0,-1)},apply(e,n,r){return mw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Tf:r=="historyRedo"?Ef:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Nf(t,e){return(n,r)=>{let s=tn.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=yw(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Tf=Nf(!1,!0),Ef=Nf(!0,!0);ne.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Z({key:new ae("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,c);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var vw=ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nw(this.options)]}});ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new ae("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return K.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(ye.node(c,c+a.nodeSize,{class:this.options.className}))}),K.create(t,i)}}})]}});var kw=ne.create({name:"gapCursor",addProseMirrorPlugins(){return[ow()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=W(R(t,"allowGapCursor",n)))!=null?e:null}}}),Af="placeholder",_c=new ae("tiptap__placeholder");function Df(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,d=[a];return o&&d.push(c),ye.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:l}):n}
196)}function Of(t,e){return typeof t=="function"?t(e):t}function jf({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){const{anchor:l}=s,a=[],c=t.isEmpty;return r.nodesBetween(i,o,(d,u)=>{const f=l>=u&&l<=u+d.nodeSize,p=!d.isLeaf&&jr(d);return d.type.isTextblock&&(f||!e.showOnlyCurrent)&&p&&a.push(Df({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Of(e.emptyNodeClass,{editor:t,node:d,pos:u,hasAnchor:f})},node:d,pos:u})),e.includeChildren}),a}function Rf({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=s,l=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const d=r.resolve(o),u=d.depth>0?d.node(1):d.nodeAfter,f=d.depth>0?d.before(1):o;if(u&&u.type.isTextblock&&jr(u)){const p=o>=f&&o<=f+u.nodeSize;l.push(Df({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:p,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Of(e.emptyNodeClass,{editor:t,node:u,pos:f,hasAnchor:p})},node:u,pos:f}))}}else l.push(...jf({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return K.create(r,l)}function ir(t,e){var n;const r=t.resolve(e);if(r.depth===0){const o=(n=r.nodeAfter)!=null?n:r.nodeBefore;if(!o)return{from:e,to:e};const l=r.nodeAfter?e:e-o.nodeSize;return{from:l,to:l+o.nodeSize}}const s=r.before(1),i=r.node(1);return{from:s,to:s+i.nodeSize}}function or(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function ww(t,e,n){const r=[];return t.forEach((s,i)=>{const o=i,l=o+s.nodeSize,a=o+1,c=l+1;a<n&&c>e&&r.push({from:o,to:l})}),r}function Cw(t){if(t.length===0)return[];const e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function Sw(t,e){const n=ww(t,e.from,e.to);return n.push(or(t,ir(t,e.from))),e.to>e.from?n.push(or(t,ir(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(or(t,ir(t,Math.min(e.from+1,t.content.size)))),n}function Mw(t,e,n){const r=[];if(t.docChanged){const s=_l(t);for(const i of s)r.push(...Sw(n.doc,i.newRange))}return t.selectionSet&&(r.push(or(n.doc,ir(n.doc,t.mapping.map(e.selection.anchor)))),r.push(or(n.doc,ir(n.doc,n.selection.anchor)))),Cw(r)}function Nw(t,e,n){const r=Math.max(0,Math.min(t,n.content.size)),s=Math.max(r,Math.min(e,n.content.size));return{from:r,to:s}}function Tw({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let l=t;for(const a of e){const{from:c,to:d}=Nw(a.from,a.to,i),u=l.find(c,d).filter(p=>p.from>=c&&p.to<=d);u.length&&(l=l.remove(u));const f=jf({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:d});f.length&&(l=l.add(i,f))}return l}function Ew({editor:t,options:e,dataAttribute:n}){return{init(r,s){const i=Rf({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??K.empty},apply(r,s,i,o){if(!r.docChanged&&!r.selectionSet)return s;const l=s.map(r.mapping,r.doc),a=Mw(r,i,o);return Tw({decorations:l,ranges:a,editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Aw(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Dw({editor:t,options:e}){const n=e.dataAttribute?`data-${Aw(e.dataAttribute)}`:`data-${Af}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Z({key:_c,...r?{}:{state:Ew({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>Rf({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?K.empty:(i=_c.getState(s))!=null?i:K.empty}}})}var Ow=ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Af,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Dw({editor:this.editor,options:this.options})]}});function Wo(t,e){return!t.selection.empty&&!Th(t.selection)&&e.isEditable}function jw(t,e){return Wo(t,e)&&!e.isFocused&&!e.view.dragging}function Rw(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function _w(t){t.focus()}ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Z({key:new ae("selection"),props:{decorations(n){return jw(n,t)?K.create(n.doc,[ye.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Wo(n.state,t)&&Rw(),!1},focus(n){return Wo(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&_w(n)}),!1}}}})]}});var Iw="skipTrailingNode";function Ic({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Lw=ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ae(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Z({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}
196=o,d=e.getState(o),u=l.content.size,f=c.nodes[n];if(!s.some(p=>p.getMeta(Iw))&&d)return a.insert(u,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Ic({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Ic({node:o,types:r})}}})]}}),Pw=ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Tf(t,e),redo:()=>({state:t,dispatch:e})=>Ef(t,e)}},addProseMirrorPlugins(){return[xw(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()}}}),zw=ne.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(A1.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(S1.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(hf.configure(this.options.bulletList)),this.options.code!==!1&&s.push(j1.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(I1.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(L1.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(vw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(kw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(P1.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(z1.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(Pw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(B1.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(V1.configure(this.options.italic)),this.options.listItem!==!1&&s.push(yf.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(kf.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(uf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Cf.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Gk.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Zk.configure(this.options.strike)),this.options.text!==!1&&s.push(ew.configure(this.options.text)),this.options.underline!==!1&&s.push(tw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(Lw.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),Bw=zw,$w=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Fw=ve.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:t}){return["img",Q(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",a=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:l})=>{const a=document.createElement("img");a.draggable=!1;const c=Q(this.options.HTMLAttributes,o);Object.entries(c).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),c.src!==null&&(a.src=c.src);const d=new Qv({element:a,editor:l,node:s,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const m=i();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,m)=>f.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",a.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}
196,addInputRules(){return[qh({find:$w,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Hw=Fw,Ww=t=>ce({find:/--$/,replace:t??"—"}),Vw=t=>ce({find:/\.\.\.$/,replace:t??"…"}),so=t=>ce({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),io=t=>ce({find:/"$/,replace:t??"”"}),oo=t=>ce({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),lo=t=>ce({find:/'$/,replace:t??"’"}),qw=t=>ce({find:/<-$/,replace:t??"←"}),Uw=t=>ce({find:/->$/,replace:t??"→"}),Kw=t=>ce({find:/\(c\)$/,replace:t??"©"}),Jw=t=>ce({find:/\(tm\)$/,replace:t??"™"}),Yw=t=>ce({find:/\(sm\)$/,replace:t??"℠"}),Gw=t=>ce({find:/\(r\)$/,replace:t??"®"}),Qw=t=>ce({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Xw=t=>ce({find:/\+\/-$/,replace:t??"±"}),Zw=t=>ce({find:/!=$/,replace:t??"≠"}),eC=t=>ce({find:/<<$/,replace:t??"«"}),tC=t=>ce({find:/>>$/,replace:t??"»"}),nC=t=>ce({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),rC=t=>ce({find:/\^2$/,replace:t??"²"}),sC=t=>ce({find:/\^3$/,replace:t??"³"}),iC=t=>ce({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),oC=t=>ce({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),lC=ne.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){var t,e;const n=[];this.options.emDash!==!1&&n.push(Ww(this.options.emDash)),this.options.ellipsis!==!1&&n.push(Vw(this.options.ellipsis));const r=this.editor.options.textDirection==="rtl";if((t=this.options.doubleQuotes)!=null&&t.rtl){const{open:s,close:i}=this.options.doubleQuotes.rtl;n.push(so(s)),n.push(io(i))}else r?(n.push(so("”")),n.push(io("“"))):(this.options.openDoubleQuote!==!1&&n.push(so(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(io(this.options.closeDoubleQuote)));if((e=this.options.singleQuotes)!=null&&e.rtl){const{open:s,close:i}=this.options.singleQuotes.rtl;n.push(oo(s)),n.push(lo(i))}else r?(n.push(oo("’")),n.push(lo("‘"))):(this.options.openSingleQuote!==!1&&n.push(oo(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(lo(this.options.closeSingleQuote)));return this.options.leftArrow!==!1&&n.push(qw(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(Uw(this.options.rightArrow)),this.options.copyright!==!1&&n.push(Kw(this.options.copyright)),this.options.trademark!==!1&&n.push(Jw(this.options.trademark)),this.options.servicemark!==!1&&n.push(Yw(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(Gw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(Qw(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(Xw(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(Zw(this.options.notEqual)),this.options.laquo!==!1&&n.push(eC(this.options.laquo)),this.options.raquo!==!1&&n.push(tC(this.options.raquo)),this.options.multiplication!==!1&&n.push(nC(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(rC(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(sC(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(iC(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(oC(this.options.threeQuarters)),n}}),aC=lC,cC=Ow;let Vo,qo;if(typeof WeakMap<"u"){let t=new WeakMap;Vo=e=>t.get(e),qo=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Vo=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},qo=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var le=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,s=e/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;
196return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(t){return Vo(t)||qo(t,dC(t))}};function dC(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=uC(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const u=t.child(c);d++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==u.childCount)break;const g=u.child(m),{colspan:y,rowspan:b,colwidth:x}=g.attrs;for(let k=0;k<b;k++){if(k+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-k});break}const v=s+k*e;for(let S=0;S<y;S++){r[v+S]==0?r[v+S]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:y-S});const N=x&&x[S];if(N){const T=(v+S)%e*2,w=o[T];w==null||w!=N&&o[T+1]==1?(o[T]=N,o[T+1]=1):w==N&&o[T+1]++}}}s+=y,d+=g.nodeSize}const f=(c+1)*e;let p=0;for(;s<f;)r[s++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),d++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new le(e,n,r,i);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(a=!0);return a&&hC(l,o,t),l}function uC(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function hC(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const d=e[(s+c)%t.width*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=fC(a)))[c]=d)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function fC(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Te(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const At=new ae("selectingCells");function ln(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function pC(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function nt(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function bi(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=ln(e.$head)||mC(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function mC(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Uo(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function gC(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ea(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}
vendor: 5,400 bytes, line 196
196function _f(t,e,n){const r=t.node(-1),s=le.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function an(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function If(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function yC(t,e,n){const r=Te(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var G=class ft extends z{constructor(e,n=e){const r=e.node(-1),s=le.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=s.cellsInRect(o).filter(d=>d!=n.pos-i);a.unshift(n.pos-i);const c=a.map(d=>{const u=r.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=i+d+1;return new fu(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(Uo(r)&&Uo(s)&&ea(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ft.rowSelection(r,s):i&&this.isColSelection()?ft.colSelection(r,s):new ft(r,s)}return _.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=le.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let a=s.top;a<s.bottom;a++){const c=[];for(let d=a*n.width+s.left,u=s.left;u<s.right;u++,d++){const f=n.map[d];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=s.left-p.left,y=p.right-s.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=an(b,0,g)),y>0&&(b=an(b,b.colspan-y,y)),p.left<s.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<s.top||p.bottom>s.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}c.push(m)}o.push(e.child(a).copy(C.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new A(C.from(l),1,1)}replace(e,n=A.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:a}=s[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?A.empty:n)}const i=z.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new A(C.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=le.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=le.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=a.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+s.map[l.left])),o.bottom<s.height&&(e=a.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new ft(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=le.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof ft&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=le.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=a.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(e=a.resolve(i+s.map[s.width*(o.top+1)-1]))),new ft(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ft(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ft(e.resolve(n),e.resolve(r))}getBookmark(){return new bC(this.$anchorCell.pos,this.$headCell.pos)}};G.prototype.visible=!1;z.jsonID("cell",G);var bC=class Lf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Lf(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&ea(n,r)?new G(n,r):z.near(r,1)}};function xC(t){if(!(t.selection instanceof G))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ye.node(r,r+n.nodeSize,{class:"selectedCell"}))}),K.create(t.doc,e)}function vC({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);
196return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function kC({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function wC(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof I&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=G.create(s,r.from);else if(o=="row"){const l=s.resolve(r.from+1);i=G.rowSelection(l,l)}else if(!n){const l=le.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=G.create(s,a+1,c)}}else r instanceof _&&vC(r)?i=_.create(s,r.from):r instanceof _&&kC(r)&&(i=_.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const CC=new ae("fix-tables");function Pf(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,l=0;o<i;o++){const a=e.child(o);for(let c=l,d=Math.min(s,o+3);c<d;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<s&&t.child(l).sameMarkup(a)?Pf(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function zf(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=SC(t,s,i,n))};return e?e.doc!=t.doc&&Pf(e.doc,t.doc,0,r):t.doc.descendants(r),n}function SC(t,e,n,r){const s=le.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let a=0;a<s.height;a++)i.push(0);for(let a=0;a<s.problems.length;a++){const c=s.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,an(u,u.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let o,l;for(let a=0;a<i.length;a++)i[a]&&(o==null&&(o=a),l=a);for(let a=0,c=n+1;a<s.height;a++){const d=e.child(a),u=c+d.nodeSize,f=i[a];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<f;y++){const b=Te(t.schema)[p].createAndFill();b&&m.push(b)}const g=(a==0||o==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(g),m)}c=u}return r.setMeta(CC,{fixTables:!0})}function lt(t){const e=t.selection,n=bi(t),r=n.node(-1),s=n.start(-1),i=le.get(r);return{...e instanceof G?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function Bf(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;yC(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+s;if(s>0&&s<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,If(c.attrs,s-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=i==null?Te(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(o,s,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function MC(t,e){if(!nt(t))return!1;if(e){const n=lt(t);e(Bf(t.tr,n,n.left))}return!0}function NC(t,e){if(!nt(t))return!1;if(e){const n=lt(t);e(Bf(t.tr,n,n.right))}return!0}function TC(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+s,a=e.map[l],c=n.nodeAt(a),d=c.attrs;if(s>0&&e.map[l-1]==a||s<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(i).map(r+a),null,an(d,s-e.colCount(a)));else{const u=t.mapping.slice(i).map(r+a);t.delete(u,u+c.nodeSize)}o+=d.rowspan}}function EC(t,e){if(!nt(t))return!1;if(e){const n=lt(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;TC(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=le.get(i)}e(r)}return!0}function AC(t,e,n){var r;const s=Te(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=s)return!1;return!0}function $f(t,{map:e,tableStart:n,table:r},s){let i=n;for(let c=0;c<s;c++)i+=r.child(c).nodeSize;const o=[];let l=s>0?-1:0;AC(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let c=0,d=e.width*s;c<e.width;c++,d++)if(s>0&&s<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],f=r.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;const u=l==null?Te(r.type.schema).cell:(a=r.nodeAt(e.map[d+l*e.width]))===null||a===void 0?void 0:a.type,f=u==null?void 0:u.createAndFill();f&&o.push(f)}return t.insert(i,Te(r.type.schema).row.create(null,o)),t}function DC(t,e){if(!nt(t))return!1;if(e){const n=lt(t);e($f(t.tr,n,n.top))}return!0}function OC(t,e){if(!nt(t))return!1;if(e){const n=lt(t);e($f(t.tr,n,n.bottom))}return!0}function jC(t,{map:e,table:n,tableStart:r},s){let i=0;for(let c=0;c<s;c++)i+=n.child(c).nodeSize;const o=i+n.child(s).nodeSize,l=t.mapping.maps.length;t.delete(i+r,o+r);const a=new Set;for(let c=0,d=s*e.width;c<e.width;c++,d++){const u=e.map[d];if(!a.has(u)){if(a.add(u),s>0&&u==e.map[d-e.width]){const f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(l).map(u+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(s<e.height&&u==e.map[d+e.width]){const f=n.nodeAt(u),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(s+1,c,n);t.insert(t.mapping.slice(l).map(r+g),m),c+=p.colspan-1}}}}function RC(t,e){if(!nt(t))return!1;if(e){const n=lt(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;jC(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=le.get(n.table)}e(r)}return!0}function Lc(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function _C({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,l=s+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;
vendor: 4,586 bytes, line 196
196i+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function Pc(t,e){const n=t.selection;if(!(n instanceof G)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=lt(t),{map:s}=r;if(_C(s,r))return!1;if(e){const i=t.tr,o={};let l=C.empty,a,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){const f=s.map[d*s.width+u],p=r.table.nodeAt(f);if(!(o[f]||!p))if(o[f]=!0,a==null)a=f,c=p;else{Lc(p)||(l=l.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...If(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const d=a+1+c.content.size,u=Lc(c)?a+1:d;i.replaceWith(u+r.tableStart,d+r.tableStart,l)}i.setSelection(new G(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function zc(t,e){const n=Te(t.schema);return IC(({node:r})=>n[r.type.spec.tableRole])(t,e)}function IC(t){return(e,n)=>{const r=e.selection;let s,i;if(r instanceof G){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(s=pC(r.$from),!s)return!1;i=(o=ln(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=lt(e),u=e.tr;for(let p=0;p<d.right-d.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let f;for(let p=d.top;p<d.bottom;p++){let m=d.map.positionAt(p,d.left,d.table);p==d.top&&(m+=s.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&p==d.top||u.insert(f=u.mapping.map(m+d.tableStart,1),t({node:s,row:p,col:g}).createAndFill(a[y]))}u.setNodeMarkup(i,t({node:s,row:d.top,col:d.left}),a[0]),r instanceof G&&u.setSelection(new G(u.doc.resolve(r.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function LC(t,e){return function(n,r){if(!nt(n))return!1;const s=bi(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof G?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&i.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function PC(t){return function(e,n){if(!nt(e))return!1;if(n){const r=Te(e.schema),s=lt(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(a=>s.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<o.length;a++)i.setNodeMarkup(s.tableStart+o[a],r.header_cell,l[a].attrs);n(i)}return!0}}function Bc(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function wr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?PC(t):function(n,r){if(!nt(n))return!1;if(r){const s=Te(n.schema),i=lt(n),o=n.tr,l=Bc("row",i,s),a=Bc("column",i,s),c=(t==="column"?l:t==="row"&&a)?1:0,d=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,u=t=="column"?a?s.cell:s.header_cell:t=="row"?l?s.cell:s.header_cell:s.cell;i.map.cellsInRect(d).forEach(f=>{const p=f+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,u,m.attrs)}),r(o)}return!0}}wr("row",{useDeprecatedLogic:!0});wr("column",{useDeprecatedLogic:!0});const zC=wr("cell",{useDeprecatedLogic:!0});function BC(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function $c(t){return function(e,n){if(!nt(e))return!1;const r=BC(bi(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(_.between(s,gC(s))).scrollIntoView())}return!0}}function $C(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Gr(t,e){const n=t.selection;if(!(n instanceof G))return!1;if(e){const r=t.tr,s=Te(t.schema).cell.createAndFill().content;
196n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new A(s,0,0))}),r.docChanged&&e(r)}return!0}function FC(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,n-1),u=a<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=Ko(Te(o).row,new A(c,d,u)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(n||r?Ko(Te(o).row,new A(e,n,r)).content:e);else return null;return HC(o,l)}function HC(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=i.child(o).attrs;for(let c=s;c<s+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(C.empty),n[s]<r){const i=Te(t).cell.createAndFill(),o=[];for(let l=n[s];l<r;l++)o.push(i);e[s]=e[s].append(C.from(o))}return{height:e.length,width:r,rows:e}}function Ko(t,e){const n=t.createAndFill();return new fl(n).replace(0,n.content.size,e).doc}function WC({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let d=i[l]||0,u=0;d<r;u++){let f=a.child(u%a.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(an(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[l+p]=(i[l+p]||0)+f.attrs.colspan}o.push(C.from(c))}n=o,t=r}if(e!=s){const i=[];for(let o=0,l=0;o<s;o++,l++){const a=[],c=n[l%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);o+u.attrs.rowspan>s&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,s-u.attrs.rowspan)},u.content)),a.push(u)}i.push(C.from(a))}n=i,e=s}return{width:t,height:e,rows:n}}function VC(t,e,n,r,s,i,o){const l=t.doc.type.schema,a=Te(l);let c,d;if(s>e.width)for(let u=0,f=0;u<e.height;u++){const p=n.child(u);f+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<s;y++)m.push(g);t.insert(t.mapping.slice(o).map(f-1+r),m)}if(i>e.height){const u=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,s);m++){const y=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==a.header_cell;u.push(y?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,C.from(u)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),p)}return!!(c||d)}function Fc(t,e,n,r,s,i,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=s;c<i;c++){const d=o*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){a=!0;const f=n.nodeAt(u),{top:p,left:m}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(l).map(u+r),null,{...f.attrs,rowspan:o-p}),t.insert(t.mapping.slice(l).map(e.positionAt(o,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function Hc(t,e,n,r,s,i,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=s;c<i;c++){const d=c*e.width+o,u=e.map[d];if(e.map[d-1]==u){a=!0;const f=n.nodeAt(u),p=e.colCount(u),m=t.mapping.slice(l).map(u+r);t.setNodeMarkup(m,null,an(f.attrs,o-p,f.attrs.colspan-(o-p))),t.insert(m+f.nodeSize,f.type.createAndFill(an(f.attrs,0,o-p))),c+=f.attrs.rowspan-1}}return a}function Wc(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=le.get(i);const{top:l,left:a}=r,c=a+s.width,d=l+s.height,u=t.tr;let f=0;function p(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");o=le.get(i),f=u.mapping.maps.length}VC(u,o,i,n,c,d,f)&&p(),Fc(u,o,i,n,a,c,l,f)&&p(),Fc(u,o,i,n,a,c,d,f)&&p(),Hc(u,o,i,n,l,d,a,f)&&p(),Hc(u,o,i,n,l,d,c,f)&&p();for(let m=l;m<d;m++){const g=o.positionAt(m,a,i),y=o.positionAt(m,c,i);u.replace(u.mapping.slice(f).map(g+n),u.mapping.slice(f).map(y+n),new A(s.rows[m-l],0,0))}p(),u.setSelection(new G(u.doc.resolve(n+o.positionAt(l,a,i)),u.doc.resolve(n+o.positionAt(d-1,c-1,i)))),e(u)}const qC=El({ArrowLeft:Qr("horiz",-1),ArrowRight:Qr("horiz",1),ArrowUp:Qr("vert",
196-1),ArrowDown:Qr("vert",1),"Shift-ArrowLeft":Xr("horiz",-1),"Shift-ArrowRight":Xr("horiz",1),"Shift-ArrowUp":Xr("vert",-1),"Shift-ArrowDown":Xr("vert",1),Backspace:Gr,"Mod-Backspace":Gr,Delete:Gr,"Mod-Delete":Gr});function ls(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Qr(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof G)return ls(n,r,z.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=Ff(s,t,e);if(o==null)return!1;if(t=="horiz")return ls(n,r,z.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(o),a=_f(l,t,e);let c;return a?c=z.near(a,1):e<0?c=z.near(n.doc.resolve(l.before(-1)),-1):c=z.near(n.doc.resolve(l.after(-1)),1),ls(n,r,c)}}}function Xr(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof G)o=i;else{const a=Ff(s,t,e);if(a==null)return!1;o=new G(n.doc.resolve(a))}const l=_f(o.$headCell,t,e);return l?ls(n,r,new G(o.$anchorCell,l)):!1}}function UC(t,e){const n=t.state.doc,r=ln(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new G(r))),!0):!1}function KC(t,e,n){if(!nt(t.state))return!1;let r=FC(n);const s=t.state.selection;if(s instanceof G){r||(r={width:1,height:1,rows:[C.from(Ko(Te(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),l=le.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=WC(r,l.right-l.left,l.bottom-l.top),Wc(t.state,t.dispatch,o,l,r),!0}else if(r){const i=bi(t.state),o=i.start(-1);return Wc(t.state,t.dispatch,o,le.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function JC(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Vc(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof G)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=ln(t.state.selection.$anchor))!=null&&((n=ao(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(a,c){let d=ao(t,c);const u=At.getState(t.state)==null;
196if(!d||!ea(a,d))if(u)d=a;else return;const f=new G(a,d);if(u||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);u&&p.setMeta(At,a.pos),t.dispatch(p)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),At.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(At,-1))}function l(a){const c=a,d=At.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(Vc(t,c.target)!=r&&(u=ao(t,e),!u))return o();u&&i(u,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function Ff(t,e,n){if(!(t.state.selection instanceof _))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function Vc(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ao(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&ln(t.state.doc.resolve(r))||ln(t.state.doc.resolve(s))}var YC=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jo(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Jo(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Jo(t,e,n,r,s,i){let o=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c){for(let u=0,f=0;u<c.childCount;u++){const{colspan:p,colwidth:m}=c.child(u).attrs;for(let g=0;g<p;g++,f++){const y=s==f?i:m&&m[g],b=y?y+"px":"";if(o+=y||r,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const x=document.createElement("col");x.style.width=b,e.appendChild(x)}}}for(;a;){var d;const u=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=u}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Be=new ae("tableColumnResizing");function GC({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=YC,lastColumnResizable:s=!0}={}){const i=new Z({key:Be,state:{init(o,l){var a;const c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=Te(l.schema).table.name;return r&&c&&(c[d]=(u,f)=>new r(u,n,f)),new QC(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Be.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{XC(o,l,t,s)},mouseleave:o=>{ZC(o)},mousedown:(o,l)=>{eS(o,l,e,n)}},decorations:o=>{const l=Be.getState(o);if(l&&l.activeHandle>-1)return iS(o,l.activeHandle)},nodeViews:{}}});return i}var QC=class as{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Be);if(r&&r.setHandle!=null)return new as(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new as(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return Uo(e.doc.resolve(s))||(s=-1),new as(s,n.dragging)}return n}};function XC(t,e,n,r){if(!t.editable)return;const s=Be.getState(t.state);if(s&&!s.dragging){const i=nS(e.target);let o=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=n?o=qc(t,e,"left",n):a-e.clientX<=n&&(o=qc(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),a=l.node(-1),c=le.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Hf(t,o)}}}function ZC(t){if(!t.editable)return;const e=Be.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Hf(t,-1)}function eS(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=Be.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),a=tS(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Be,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const f=Be.getState(t.state);f!=null&&f.dragging&&(rS(t,f.activeHandle,Uc(f.dragging,u,n)),t.dis
196patch(t.state.tr.setMeta(Be,{setDragging:null})))}function d(u){if(!u.which)return c(u);const f=Be.getState(t.state);if(f&&f.dragging){const p=Uc(f.dragging,u,n);Kc(t,f.activeHandle,p,r)}}return Kc(t,o.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function tS(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(o-=r[a],l--);return o/l}function nS(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function qc(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,l=ln(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const a=le.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function Uc(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Hf(t,e){t.dispatch(t.state.tr.setMeta(Be,{setHandle:e}))}function rS(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=le.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){const d=c*i.width+l;if(c&&i.map[d]==i.map[d-i.width])continue;const u=i.map[d],f=s.nodeAt(u).attrs,p=f.colspan==1?0:l-i.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():sS(f.colspan);m[p]=n,a.setNodeMarkup(o+u,null,{...f,colwidth:m})}a.docChanged&&t.dispatch(a)}function Kc(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),l=le.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let a=t.domAtPos(s.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Jo(i,a.firstChild,a,r,l,n)}function sS(t){return Array(t).fill(0)}function iS(t,e){const n=[],r=t.doc.resolve(e),s=r.node(-1);if(!s)return K.empty;const i=le.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const d=l+c*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(c==0||i.map[d]!=i.map[d-i.width])){var a;const u=i.map[d],f=o+u+s.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((a=Be.getState(t))===null||a===void 0)&&a.dragging&&n.push(ye.node(o+u,o+u+s.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(ye.widget(f,p))}}return K.create(t.doc,n)}function oS({allowTableNodeSelection:t=!1}={}){return new Z({key:At,state:{init(){return null},apply(e,n){const r=e.getMeta(At);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:xC,handleDOMEvents:{mousedown:JC},createSelectionBetween(e){return At.getState(e.state)!=null?e.state.selection:null},handleTripleClick:UC,handleKeyDown:qC,handlePaste:KC},appendTransaction(e,n,r){return wC(r,zf(r,n),t)}})}function ei(t){return t==="left"||t==="right"||t==="center"?t:null}function lS(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return ei(e||n)}function aS(t){return ei(t==null?void 0:t.align)}function Wf(){return{default:null,parseHTML:t=>lS(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function cS(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])==null?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function Vf(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):cS(t)}var qf=ve.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:Vf},align:Wf()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Q(this.options.HTMLAttributes,t),0]}}),Uf=ve.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:Vf},align:Wf()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Q(this.options.HTMLAttributes,t),0]}}),Kf=ve.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Q(this.options.HTMLAttributes,t),0]}});function Yo(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}
196function Jc(t,e,n,r,s,i){var o;let l=0,a=!0,c=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,p=0;f<d.childCount;f+=1){const{colspan:m,colwidth:g}=d.child(f).attrs;for(let y=0;y<m;y+=1,p+=1){const b=s===p?i:g&&g[y],x=b?`${b}px`:"";if(l+=b||r,b||(a=!1),c){if(c.style.width!==x){const[k,v]=Yo(r,b);c.style.setProperty(k,v)}c=c.nextSibling}else{const k=document.createElement("col"),[v,S]=Yo(r,b);k.style.setProperty(v,S),e.appendChild(k)}}}for(;c;){const f=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=f}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);a&&!u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var dS=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jc(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Jc(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function uS(t,e,n,r){let s=0,i=!0;const o=[],l=t.firstChild;if(!l)return{};for(let u=0,f=0;u<l.childCount;u+=1){const{colspan:p,colwidth:m}=l.child(u).attrs;for(let g=0;g<p;g+=1,f+=1){const y=n===f?r:m&&m[g];s+=y||e,y||(i=!1);const[b,x]=Yo(e,y);o.push(["col",{style:`${b}: ${x}`}])}}const a=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:a,tableMinWidth:c}}function Yc(t,e){return t.createAndFill()}function hS(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function fS(t,e,n,r,s){const i=hS(t),o=[],l=[];for(let c=0;c<n;c+=1){const d=Yc(i.cell);if(d&&l.push(d),r){const u=Yc(i.header_cell);u&&o.push(u)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?o:l));return i.table.createChecked(null,a)}function pS(t){return t instanceof G}var Zr=({editor:t})=>{const{selection:e}=t.state;if(!pS(e))return!1;let n=0;const r=vh(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},mS="�";function gS(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let o=0;for(;s+o<t.length&&t[s+o]==="`";)o+=1;if(o===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(new RegExp("(?<!\\\\)\\|","g"),"\\|")+t.slice(s,s+r),n=s+r,i=!0;break}s+=o}i||(e+=t.slice(n,n+r),n+=r)}return e}function yS(t){return t.split(`
197`).map(e=>!e.includes("|")||!e.includes("`")?e:gS(e)).join(`
198`)}function bS(t){return(t||"").replace(/\s+/g," ").trim()}function xS(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:mS;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(g=>{const y=[];g.content&&g.content.forEach(b=>{let x="";b.content&&Array.isArray(b.content)&&b.content.length>1?x=b.content.map(T=>e.renderChildren(T)).join(s):x=b.content?e.renderChildren(b.content):"";const k=bS(x),v=b.type==="tableHeader",S=aS(b.attrs);y.push({text:k,isHeader:v,align:S})}),i.push(y)});const o=i.reduce((g,y)=>Math.max(g,y.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);i.forEach(g=>{var y;for(let b=0;b<o;b+=1){const k=(((y=g[b])==null?void 0:y.text)||"").length;k>l[b]&&(l[b]=k),l[b]<3&&(l[b]=3)}});const a=(g,y)=>g+" ".repeat(Math.max(0,y-g.length)),c=i[0],d=c.some(g=>g.isHeader),u=Array.from({length:o}).fill(null);
198i.forEach(g=>{var y;for(let b=0;b<o;b+=1)!u[b]&&((y=g[b])!=null&&y.align)&&(u[b]=g[b].align)});let f=`
199`;const p=Array.from({length:o}).map((g,y)=>d&&c[y]&&c[y].text||"");return f+=`| ${p.map((g,y)=>a(g,l[y])).join(" | ")} |
200`,f+=`| ${l.map((g,y)=>{const b=Math.max(3,g),x=u[y];return x==="left"?`:${"-".repeat(b)}`:x==="right"?`${"-".repeat(b)}:`:x==="center"?`:${"-".repeat(b)}:`:"-".repeat(b)}).join(" | ")} |
201`,(d?i.slice(1):i).forEach(g=>{f+=`| ${Array.from({length:o}).fill(0).map((y,b)=>a(g[b]&&g[b].text||"",l[b])).join(" | ")} |
202`}),f}var vS=xS,Jf=ve.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:dS,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=uS(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",Q(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((i,o)=>{var l;const a=ei((l=r[o])!=null?l:i.align),c=a?{align:a}:{};s.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((o,l)=>{var a;const c=ei((a=r[l])!=null?a:o.align),d=c?{align:c}:{};i.push(e.createNode("tableCell",d,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>vS(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
203`);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
204
205`),s=r>=0?t.slice(0,r):t,i=s.split(`
206`);if(i.length<2)return;const o=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes("|"))return;const l=yS(s);if(l===s)return;const c=n.blockTokens(l)[0];if((c==null?void 0:c.type)!=="table"||!c.raw)return;const d=c.raw.split(`
207`).length,u=t.split(`
208`).slice(0,d).join(`
209`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=fS(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(_.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>MC(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>NC(t,e),deleteColumn:()=>({state:t,dispatch:e})=>EC(t,e),addRowBefore:()=>({state:t,dispatch:e})=>DC(t,e),addRowAfter:()=>({state:t,dispatch:e})=>OC(t,e),deleteRow:()=>({state:t,dispatch:e})=>RC(t,e),deleteTable:()=>({state:t,dispatch:e})=>$C(t,e),mergeCells:()=>({state:t,dispatch:e})=>Pc(t,e),splitCell:()=>({state:t,dispatch:e})=>zc(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>wr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>wr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>zC(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Pc(t,e)?!0:zc(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>LC(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>$c(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>$c(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&zf(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=G.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Zr,"Mod-Backspace":Zr,Delete:Zr,"Mod-Delete":Zr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[GC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],oS({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=Q(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:W(R(t,"tableRole",e))}}});ne.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(Jf.configure(this.options.table)),this.options.tableCell!==!1&&t.push(qf.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Uf.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(Kf.configure(this.options.tableRow)),t}});const kS=t=>t.replace(/[^a-zA-Z0-9._-]/g,"_").slice(0,80),Gc=({content:t,onChange:e,placeholder:n="Start writing…"})=>{const{toast:r}=Cr(),s=M.useRef(null),i=M.useRef(null),o=b1({extensions:[Bw,Hw.configure({inline:!1,allowBase64:!1}),gk.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer"}}),aC,cC.configure({placeholder:n}),Jf.configure({resizable:!1}),Kf,qf,Uf],content:t,onUpdate:({editor:p})=>e(p.getHTML()),editorProps:{attributes:{class:"tiptap-editor",spellcheck:"true"}}}),l=M.useCallback(async p=>{if(p.size>10485760)return r({title:"Image too large",description:"Maximum file size is 10 MB. Please compress or resize the image first.",variant:"destructive"}),null;const g=`${Date.now()}_${kS(p.name)}`,{data:y,error:b}=await me.storage.from("brief-images").upload(g,p,{upsert:!1});if(b)return r({title:"Image upload failed",description:b.message,variant:"destructive"}),null;const{data:{publicUrl:x}}=me.storage.from("brief-images").getPublicUrl(y.path);return x},[r]),a=M.useCallback(async p=>{var y;const m=(y=p.target.files)==null?void 0:y[0];if(!m||!o)return;const g=await l(m);g&&o.chain().focus().setImage({src:g}).run(),p.target.value=""},[o,l]),c=M.useCallback(()=>
209{if(!o)return;const p=o.getAttributes("link").href??"",m=window.prompt("Enter URL",p);if(m!==null){if(m===""){o.chain().focus().unsetLink().run();return}o.chain().focus().setLink({href:m}).run()}},[o]),d=M.useCallback(async p=>{var k;const m=(k=p.target.files)==null?void 0:k[0];if(!m||!o)return;p.target.value="";const g=await rp(()=>import("./mammoth.browser-DZmhpPFj.js").then(v=>v.m),__vite__mapDeps([0,1,2])),y=await m.arrayBuffer();let b="",x=[];try{const v=await g.convertToHtml({arrayBuffer:y},{convertImage:g.images.imgElement(async S=>{const N=await S.read("base64"),T=atob(N),w=new Uint8Array(T.length);for(let F=0;F<T.length;F++)w[F]=T.charCodeAt(F);const j=new File([w],`docx_image_${Date.now()}.${S.contentType.split("/")[1]??"png"}`,{type:S.contentType});return{src:await l(j)??""}})});b=v.value.replace(/^[\s\S]{0,4000}?<hr\b[^>]*>\s*/i,""),x=v.messages.filter(S=>S.type==="warning").map(S=>S.message)}catch{r({title:"DOCX import failed",description:"Could not parse the file.",variant:"destructive"});return}o.commands.setContent(b),e(o.getHTML()),x.length>0?r({title:`Imported with ${x.length} note${x.length>1?"s":""}`,description:"Complex chart objects may need to be re-inserted as images from Word."}):r({title:"DOCX imported",description:"Content loaded into editor."})},[o,e,l,r]);if(!o)return null;const u=(p,m,g,y)=>h.jsx("button",{type:"button",title:g,onClick:m,className:`tiptap-toolbar-btn ${p?"active":""}`,children:y}),f=()=>h.jsx("div",{className:"tiptap-toolbar-divider"});return h.jsxs("div",{className:"tiptap-wrapper",children:[h.jsxs("div",{className:"tiptap-toolbar",children:[h.jsxs("button",{type:"button",title:"Import DOCX",className:"tiptap-toolbar-btn tiptap-docx-btn",onClick:()=>{var p;return(p=i.current)==null?void 0:p.click()},children:[h.jsx(gp,{size:14}),h.jsx("span",{children:"Import DOCX"})]}),h.jsx("input",{ref:i,type:"file",accept:".docx",className:"hidden",onChange:d}),f(),u(o.isActive("bold"),()=>o.chain().focus().toggleBold().run(),"Bold",h.jsx(Hp,{size:14})),u(o.isActive("italic"),()=>o.chain().focus().toggleItalic().run(),"Italic",h.jsx(qp,{size:14})),f(),u(o.isActive("heading",{level:2}),()=>o.chain().focus().toggleHeading({level:2}).run(),"Heading 2",h.jsx(Wp,{size:14})),u(o.isActive("heading",{level:3}),()=>o.chain().focus().toggleHeading({level:3}).run(),"Heading 3",h.jsx(Vp,{size:14})),f(),u(o.isActive("bulletList"),()=>o.chain().focus().toggleBulletList().run(),"Bullet list",h.jsx(Kp,{size:14})),u(o.isActive("orderedList"),()=>o.chain().focus().toggleOrderedList().run(),"Numbered list",h.jsx(Up,{size:14})),u(o.isActive("blockquote"),()=>o.chain().focus().toggleBlockquote().run(),"Blockquote",h.jsx(bp,{size:14})),f(),u(o.isActive("link"),c,"Insert link",h.jsx(mp,{size:14})),h.jsx("button",{type:"button",title:"Insert image",className:"tiptap-toolbar-btn",onClick:()=>{var p;return(p=s.current)==null?void 0:p.click()},children:h.jsx(yp,{size:14})}),h.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:a}),f(),u(!1,()=>o.chain().focus().setHorizontalRule().run(),"Divider",h.jsx(xp,{size:14}))]}),h.jsx(Yh,{editor:o})]})},wS=["Observer","Participant","Contributor","Councillor","Solo Observer","Solo Participant","Solo Contributor","Solo Councillor","Nonprofit"],CS=["Policy","Energy","Compute","Capital"],SS=t=>t.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim().slice(0,80),MS=t=>vp(Zo.sanitize(t)).filter(e=>e.heading),NS=t=>Zo.sanitize(t,{ALLOWED_TAGS:[]}).replace(/\s+/g," ").trim(),Yf=()=>({label:"",style:"marker",value:0,display:""}),Qc=()=>({section:"",type:"range_bar",title:"",scale:{min:0,max:100,unit:""},rows:[Yf()]}),Xc=()=>({label:"",value:""}),Zc=()=>({section:"",text:""}),ed=()=>({section:"",label:""}),TS=()=>({label:"",value:""});function ta({value:t,onChange:e,sections:n}){return h.jsxs("select",{value:t,onChange:r=>e(r.target.value),className:"w-full rounded border border-white/20 bg-background px-3 py-2 text-sm text-white",children:[h.jsx("option",{value:"",children:"Select article section…"}),n.map(r=>
209h.jsx("option",{value:r.id,children:r.heading},r.id))]})}function V({label:t,children:e,hint:n}){return h.jsxs("label",{className:"block space-y-1.5 text-xs font-semibold uppercase tracking-widest text-gray-500",children:[h.jsx("span",{children:t}),e,n&&h.jsx("span",{className:"block normal-case font-normal tracking-normal text-gray-600",children:n})]})}function ES({value:t,onChange:e,title:n,tags:r,excerpt:s,sections:i,publicText:o,errors:l}){var g,y,b,x,k;const[a,c]=M.useState("visitor"),d=M.useMemo(()=>(t.pull_quotes??[]).flatMap((v,S)=>{const N=[];return i.some(T=>T.id===v.section)||N.push(`Quote ${S+1}: selected section anchor no longer exists in public content.`),v.text.trim()&&!o.includes(v.text.trim())&&N.push(`Quote ${S+1}: text was not found verbatim in public content.`),N}),[t.pull_quotes,i,o]),u=v=>e(v),f=v=>{v?u({...t,deck:v}):p()},p=()=>{const{deck:v,...S}=t;u(S)},m=t.key_findings;return h.jsxs("section",{className:"mt-8 border-t border-white/10 pt-6 space-y-6",children:[h.jsxs("div",{children:[h.jsx("h4",{className:"text-base font-semibold text-white",children:"Presentation (V2)"}),h.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Optional public presentation modules. Empty modules are omitted from the article."})]}),l.length>0&&h.jsxs("div",{className:"rounded border border-red-800 bg-red-950/30 p-3 text-sm text-red-200",role:"alert",children:[h.jsx("b",{children:"Presentation cannot be saved"}),h.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:l.map(v=>h.jsx("li",{children:v},v))})]}),d.length>0&&h.jsxs("div",{className:"rounded border border-amber-800/70 bg-amber-950/20 p-3 text-sm text-amber-200",children:[h.jsx("b",{children:"Review warnings"}),h.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:d.map(v=>h.jsx("li",{children:v},v))})]}),h.jsxs("div",{className:"grid gap-3 rounded border border-white/10 p-4",children:[h.jsx(V,{label:"Article Deck",hint:"One or two sentences; 400 characters maximum.",children:h.jsx(_e,{value:t.deck??"",rows:3,onChange:v=>f(v.target.value)})}),t.deck&&h.jsx(O,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:p,children:"Remove deck"})]}),h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Key Findings"}),!m&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>u({...t,key_findings:{items:[Xc()]}}),children:"Add findings"})]}),m&&h.jsxs(h.Fragment,{children:[h.jsx(V,{label:"Eyebrow",children:h.jsx($,{value:m.eyebrow??"",onChange:v=>u({...t,key_findings:{...m,eyebrow:v.target.value||void 0}})})}),m.items.map((v,S)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-2",children:[h.jsx(V,{label:`Finding ${S+1} label`,children:h.jsx($,{value:v.label,onChange:N=>{const T=m.items.map((w,j)=>j===S?{...w,label:N.target.value}:w);u({...t,key_findings:{...m,items:T}})}})}),h.jsx(V,{label:"Value",children:h.jsx($,{value:v.value,onChange:N=>{const T=m.items.map((w,j)=>j===S?{...w,value:N.target.value}:w);u({...t,key_findings:{...m,items:T}})}})}),h.jsx(V,{label:"Unit",children:h.jsx($,{value:v.unit??"",onChange:N=>{const T=m.items.map((w,j)=>j===S?{...w,unit:N.target.value||void 0}:w);u({...t,key_findings:{...m,items:T}})}})}),h.jsx(V,{label:"Description",children:h.jsx(_e,{rows:2,value:v.description??"",onChange:N=>{const T=m.items.map((w,j)=>j===S?{...w,description:N.target.value||void 0}:w);u({...t,key_findings:{...m,items:T}})}})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const N=m.items.filter((T,w)=>w!==S);if(N.length)u({...t,key_findings:{...m,items:N}});else{const{key_findings:T,...w}=t;u(w)}},children:"Remove finding"})]},S)),h.jsx(V,{label:"Footer",children:h.jsx(_e,{rows:2,value:m.footer??"",onChange:v=>u({...t,key_findings:{...m,footer:v.target.value||void 0}})})}),m.items.length<3&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>u({...t,key_findings:{...m,items:[...m.items,Xc()]}}
209),children:["Add finding (",m.items.length,"/3)"]})]})]}),h.jsx(AS,{value:t,update:u,sections:i}),h.jsx(DS,{value:t,update:u,sections:i}),h.jsx(OS,{value:t,update:u,sections:i}),h.jsx(_S,{value:t,update:u}),h.jsxs("div",{className:"grid gap-3 rounded border border-white/10 p-4 md:grid-cols-3",children:[h.jsx(V,{label:"Author name",children:h.jsx($,{value:((g=t.author)==null?void 0:g.name)??"",onChange:v=>u({...t,author:{...t.author??{name:""},name:v.target.value}})})}),h.jsx(V,{label:"Author role",children:h.jsx($,{value:((y=t.author)==null?void 0:y.role)??"",onChange:v=>u({...t,author:{...t.author??{name:""},role:v.target.value||void 0}})})}),h.jsx(V,{label:"Edition",children:h.jsx($,{value:((b=t.author)==null?void 0:b.edition)??"",onChange:v=>u({...t,author:{...t.author??{name:""},edition:v.target.value||void 0}})})}),t.author&&h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const{author:v,...S}=t;u(S)},children:"Remove author"}),h.jsx(V,{label:"What’s Next event ID",hint:"Known event IDs render a public event card.",children:h.jsx($,{value:((x=t.whats_next)==null?void 0:x.event_id)??"",onChange:v=>{if(v.target.value)u({...t,whats_next:{event_id:v.target.value}});else{const{whats_next:S,...N}=t;u(N)}}})})]}),h.jsxs("div",{className:"rounded border border-white/10 p-4",children:[h.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("h5",{className:"font-medium text-white",children:"Preview"}),h.jsx("p",{className:"text-sm text-gray-500",children:"Uses the public article components with safe visitor/member preview states."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(O,{type:"button",size:"sm",variant:a==="visitor"?"default":"outline",onClick:()=>c("visitor"),children:"Visitor"}),h.jsx(O,{type:"button",size:"sm",variant:a==="member"?"default":"outline",onClick:()=>c("member"),children:"Verified member"})]})]}),h.jsxs("div",{className:"brief-page rounded border border-white/10",children:[h.jsxs("div",{className:"brief-hero !px-5 !pt-10",children:[h.jsx(kp,{tags:r,hasMemberContent:!0}),h.jsx(wp,{title:n||"Untitled brief",deck:t.deck||s}),h.jsx(Cp,{title:n||"Untitled brief",publishedAt:null,readTime:1})]}),t.key_findings&&h.jsx("div",{className:"brief-featured-module !px-5",children:h.jsx(Sp,{findings:t.key_findings})}),h.jsx("div",{className:"brief-reading-layout !mt-10 !block !px-5",children:h.jsxs("article",{className:"brief-article",children:[h.jsx(Mp,{chunks:i,presentation:t}),h.jsx(Np,{briefId:"admin-preview",onRequestSeat:()=>{},presentation:t.member_gate,previewState:a}),h.jsx(Tp,{eventId:(k=t.whats_next)==null?void 0:k.event_id})]})})]})]})]})}function AS({value:t,update:e,sections:n}){const r=t.pull_quotes;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Pull Quotes"}),!r&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,pull_quotes:[Zc()]}),children:"Add quote"})]}),r==null?void 0:r.map((s,i)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3",children:[h.jsx(V,{label:"Article section",children:h.jsx(ta,{value:s.section,onChange:o=>e({...t,pull_quotes:r.map((l,a)=>a===i?{...l,section:o}:l)}),sections:n})}),h.jsx(V,{label:"Verbatim quote",children:h.jsx(_e,{rows:3,value:s.text,onChange:o=>e({...t,pull_quotes:r.map((l,a)=>a===i?{...l,text:o.target.value}:l)})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const o=r.filter((l,a)=>a!==i);if(o.length)e({...t,pull_quotes:o});else{const{pull_quotes:l,...a}=t;e(a)}},children:"Remove quote"})]},i)),r&&r.length<4&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,pull_quotes:[...r,Zc()]}),children:["Add quote (",r.length,"/4)"]})]})}function DS({value:t,update:e,sections:n}){const r=t.section_labels;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Section labels"}),!r&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,section_labels:[ed()]}),children:"Add section label"})]}),r==null?void 0:r.map((s,i)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-2",children:[h.jsx(V,{label:"Article section",children:h.jsx(ta,{value:s.section,onChange:o=>e({...t,section_labels:r.map((l,a)=>a===i?{...l,section:o}:l)}),sections:n})}),h.jsx(V,{label:"Short label",children:h.jsx($,{required:!0,maxLength:40,value:s.label,onChange:o=>e({...t,section_labels:r.map((l,a)=>a===i?{...l,label:o.target.value}:l)})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const o=r.filter((l,a)=>a!==i);if(o.length)e({...t,section_labels:o});else{const{section_labels:l,...a}=t;e(a)}},children:"Remove section label"})]},i)),r&&r.length<12&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,section_labels:[...r,ed()]}),children:["Add section label (",r.length,"/12)"]})]})}function OS({value:t,update:e,sections:n}){const r=t.data_panels;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Data Panels"}),!r&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,data_panels:[Qc()]}),children:"Add range bar panel"})]}),r==null?void 0:r.map((s,i)=>h.jsxs("div",{className:"space-y-3 rounded bg-white/5 p-3",children:[h.jsxs("div",{className:"grid gap-2 md:grid-cols-3",children:[h.jsx(V,{label:"Article section",children:h.jsx(ta,{value:s.section,onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,section:o}:l)}),sections:n})}),h.jsx(V,{label:"Panel title",children:h.jsx($,{value:s.title,onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,title:o.target.value}:l)})})}),h.jsx(V,{label:"Scale unit",children:h.jsx($,{value:s.scale.unit,onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,scale:{...l.scale,unit:o.target.value}}:l)})})}),h.jsx(V,{label:"Scale minimum",children:h.jsx($,{type:"number",value:s.scale.min,onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,scale:{...l.scale,min:Number(o.target.value)}}:l)})})}),h.jsx(V,{label:"Scale maximum",children:h.jsx($,{type:"number",value:s.scale.max,onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,scale:{...l.scale,max:Number(o.target.value)}}:l)})})})]}),s.rows.map((o,l)=>h.jsxs("div",{className:"grid gap-2 rounded border border-white/10 p-3 md:grid-cols-3",children:[h.jsx(V,{label:"Row label",children:h.jsx($,{value:o.label,onChange:a=>Vt(t,e,i,l,c=>yn(c,{label:a.target.value}))})}),h.jsx(V,{label:"Style",children:h.jsxs("select",{value:o.style,onChange:a=>Vt(t,e,i,l,c=>jS(a.target.value,c)),className:"w-full rounded border border-white/20 bg-background px-3 py-2 text-sm text-white",children:[h.jsx("option",{value:"marker",children:"Marker"}),h.jsx("option",{value:"solid",children:"Solid range"}),h.jsx("option",{value:"dashed",children:"Dashed range"}),h.jsx("option",{value:"muted",children:"Muted range"})]})}),h.jsx(V,{label:"Display",children:h.jsx($,{value:o.display,onChange:a=>Vt(t,e,i,l,c=>yn(c,{display:a.target.value}))})}),o.style==="marker"?h.jsx(V,{label:"Marker value",children:h.jsx($,{type:"number",value:o.value,onChange:a=>Vt(t,e,i,l,c=>yn(c,{value:Number(a.target.value)}))})}):h.jsxs(h.Fragment,{children:[h.jsx(V,{label:"Range minimum",children:h.jsx($,{type:"number",value:o.min,onChange:a=>Vt(t,e,i,l,c=>yn(c,{min:Number(a.target.value)}))})}),h.jsx(V,{label:"Range maximum",children:h.jsx($,{type:"number",value:o.max,onChange:a=>Vt(t,e,i,l,c=>yn(c,{max:Number(a.target.value)}))})})]}),h.jsx(V,{label:"Note",children:h.jsx($,{value:o.note??"",onChange:a=>Vt(t,e,i,l,c=>yn(c,{note:a.target.value}))})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>RS(t,e,i,l),children:"Remove row"})]},l)),s.rows.length<8&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,data_panels:r.map((o,l)=>l===i?{...o,rows:[...o.rows,Yf()]}:o)}),children:["Add row (",s.rows.length,"/8)"]}),h.jsx(V,{label:"Caption",children:h.jsx(_e,{rows:2,value:s.caption??"",onChange:o=>e({...t,data_panels:r.map((l,a)=>a===i?{...l,caption:o.target.value||void 0}:l)})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"text-red-300",onClick:()=>{const o=r.filter((l,a)=>a!==i);if(o.length)e({...t,data_panels:o});else{const{data_panels:l,...a}=t;e(a)}},children:"Remove panel"})]},i)),r&&r.length<3&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,data_panels:[...r,Qc()]}),children:["Add panel (",r.length,"/3)"]})]})}function td(t){return t?{note:t}:{}}function yn(t,e){const n=Object.hasOwn(e,"note")?e.note:t.note;return t.style==="marker"?{label:e.label??t.label,style:"marker",value:e.value??t.value,display:e.display??t.display,...td(n)}:{label:e.label??t.label,style:t.style,min:e.min??t.min,max:e.max??t.max,display:e.display??t.display,...td(n)}}function jS(t,e){const n={label:e.label,display:e.display,...e.note?{note:e.note}:{}};return t==="marker"?{...n,style:t,value:e.style==="marker"?e.value:e.min}:{...n,style:t,min:e.style==="marker"?e.value:e.min,max:e.style==="marker"?e.value:e.max}}function Vt(t,e,n,r,s){const i=t.data_panels??[],o=i[n].rows.map((l,a)=>a===r?s(l):l);e({...t,data_panels:i.map((l,a)=>a===n?{...l,rows:o}:l)})}function RS(t,e,n,r){const s=t.data_panels??[],i=s[n].rows.filter((o,l)=>l!==r);i.length&&e({...t,data_panels:s.map((o,l)=>l===n?{...o,rows:i}:o)})}function _S({value:t,update:e}){const n=t.member_gate,r=(n==null?void 0:n.benefits)??[],s=n==null?void 0:n.preview,i=o=>e({...t,member_gate:o});return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Member Gate"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>i({benefits:[],preview:{type:"risk_scores",visible_rows:[],hidden_row_count:0}}),children:"Add member gate"})]}),n&&h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-sm text-gray-500",children:"Benefits are public copy; preview rows are deliberately authored public data only."}),r.map((o,l)=>h.jsxs("div",{className:"flex gap-2",children:[h.jsx($,{value:o,onChange:a=>
209i({...n,benefits:r.map((c,d)=>d===l?a.target.value:c)})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"text-red-300",onClick:()=>i({...n,benefits:r.filter((a,c)=>c!==l)}),children:"Remove"})]},l)),r.length<6&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>i({...n,benefits:[...r,""]}),children:["Add benefit (",r.length,"/6)"]}),s?h.jsxs("div",{className:"space-y-2 rounded bg-white/5 p-3",children:[h.jsx(V,{label:"Preview title",children:h.jsx($,{value:s.title??"",onChange:o=>i({...n,preview:{...s,title:o.target.value||void 0}})})}),s.visible_rows.map((o,l)=>h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx($,{"aria-label":`Preview row ${l+1} label`,value:o.label,onChange:a=>i({...n,preview:{...s,visible_rows:s.visible_rows.map((c,d)=>d===l?{...c,label:a.target.value}:c)}})}),h.jsx($,{"aria-label":`Preview row ${l+1} value`,value:o.value,onChange:a=>i({...n,preview:{...s,visible_rows:s.visible_rows.map((c,d)=>d===l?{...c,value:a.target.value}:c)}})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>i({...n,preview:{...s,visible_rows:s.visible_rows.filter((a,c)=>c!==l)}}),children:"Remove row"})]},l)),s.visible_rows.length<2&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>i({...n,preview:{...s,visible_rows:[...s.visible_rows,TS()]}}),children:["Add visible row (",s.visible_rows.length,"/2)"]}),h.jsx(V,{label:"Hidden row count",children:h.jsx($,{type:"number",min:0,max:12,value:s.hidden_row_count,onChange:o=>i({...n,preview:{...s,hidden_row_count:Number(o.target.value)}})})})]}):h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>i({...n,preview:{type:"risk_scores",visible_rows:[],hidden_row_count:0}}),children:"Add public preview"}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"text-red-300",onClick:()=>{const{member_gate:o,...l}=t;e(l)},children:"Remove member gate"})]})]})}const nd=()=>({label:"",value:"",reference:void 0}),rd=()=>({dimension:"",score:3,rationale:""}),sd=()=>({period:"",items:[""]}),id=()=>({label:"",ids:[]}),od=()=>({section:fd[0],heading:""});function IS(t){return t.split(",").map(e=>e.trim()).filter(Boolean)}function LS(t){return t.join(", ")}function PS(t,e){if(!(e||Object.keys(t).length>0))return{ok:!0,patch:{}};const r=Kn(t);return r.ok?{ok:!0,patch:{member_presentation:JSON.parse(JSON.stringify(r.value)),member_presentation_version:Ep}}:{ok:!1,errors:r.errors}}function zS({section:t,presentation:e}){var s;const n=t.html.trim(),r=n?h.jsx("div",{className:"member-prose",dangerouslySetInnerHTML:{__html:n}}):null;switch(t.canonical){case"executive-read":return h.jsxs(h.Fragment,{children:[h.jsx(Ip,{data:e.decision_summary}),r]});case"derivations":case"assumptions":case"benchmark":return h.jsxs(h.Fragment,{children:[r,h.jsx(la,{table:t.table,caption:t.heading})]});case"risk-framework":return e.risk_framework?h.jsxs(h.Fragment,{children:[r,h.jsx(_p,{data:e.risk_framework})]}):h.jsxs(h.Fragment,{children:[r,h.jsx(la,{table:t.table,caption:"Risk framework"})]});case"member-actions":return(s=e.actions)!=null&&s.length?h.jsx(Rp,{periods:e.actions}):r;case"requested-inputs":return e.requested_inputs?h.jsx(jp,{data:e.requested_inputs}):r;default:return r}}function BS({title:t,memberContentHtml:e,publicText:n,presentation:r}){const s=Zo.sanitize(e),i=Ap(s,{publicText:n,anchors:r.section_anchors}),o=i.sources,l=i.sections.filter(a=>a.canonical!=="sources"||o.length===0);return h.jsxs("div",{className:"brief-page",children:[h.jsxs("div",{className:"member-transition","data-testid":"member-preview-transition",children:[h.jsxs("div",{className:"member-transition-copy",children:[h.jsxs("small",{className:"member-verified",children:[h.jsx("i",{"aria-hidden":!0}),"Member access verified (preview)"]}),h.jsxs("h2",{children:["Member analysis ",h.jsx("span",{children:"preview"})]})]}),h.jsxs("dl",{className:"member-transition-stats",children:[h.jsxs("div",{children:[h.jsx("dt",{children:"Sections"}),h.jsx("dd",{children:i.sectionCount})]}),i.derivationRange&&h.jsxs("div",{children:[h.jsx("dt",{children:"Derivations"}),h.jsx("dd",{children:i.derivationRange})]}),i.sourceCount>0&&h.jsxs("div",{children:[h.jsx("dt",{children:"Sources"}),h.jsx("dd",{children:i.sourceCount})]}),h.jsxs("div",{children:[h.jsx("dt",{children:"Depth"}),h.jsxs("dd",{children:["≈ ",i.readMinutes," min"]})]})]})]}),h.jsxs("div",{className:"member-column",children:[l.map(a=>h.jsxs("section",{id:a.id,className:"member-section","data-section":a.key,children:[a.canonical==="executive-read"?h.jsx("small",{className:"member-eyebrow",children:"Executive read"}):h.jsx("h2",{children:a.heading}),h.jsx(zS,{section:a,presentation:r})]},a.id)),o.length>0&&h.jsxs("section",{id:"member-sources",className:"member-section","data-section":"sources",children:[h.jsx("h2",{children:"Sources"}),h.jsx(Dp,{sources:o,groups:r.source_groups})]}),h.jsx(Op,{email:"preview@member"})]})]})}function $S({previewState:t,title:e,memberContentHtml:n,publicText:r,presentation:s}){return t==="visitor"?h.jsx("div",{className:"brief-page",children:h.jsx("div",{className:"brief-member-loading","data-testid":"member-preview-visitor",children:h.jsx("p",{children:"Visitors never see Member Edition content. This state intentionally renders no member data."})})}):n.trim()?h.jsx(BS,{title:e,memberContentHtml:n,publicText:r,presentation:s}):h.jsx("div",{className:"brief-page",children:h.jsx("div",{className:"brief-member-loading","data-testid":"member-preview-empty",children:h.jsx("p",{children:"Write Member Content in the editor above to preview the verified member view."})})})}function ue({label:t,children:e,hint:n}){return h.jsxs("label",{className:"block space-y-1.5 text-xs font-semibold uppercase tracking-widest text-gray-500",children:[h.jsx("span",{children:t}),e,n&&h.jsx("span",{className:"block normal-case font-normal tracking-normal text-gray-600",children:n})]})}function FS({ids:t,onChange:e}
209){const[n,r]=M.useState(()=>LS(t));return h.jsx($,{value:n,placeholder:"S1, S2, S3",onChange:s=>{r(s.target.value),e(IS(s.target.value))}})}function HS({value:t,update:e}){const n=t.decision_summary;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Decision summary"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,decision_summary:{verdict:"",metrics:[nd()]}}),children:"Add decision summary"})]}),n&&h.jsxs(h.Fragment,{children:[h.jsx(ue,{label:"Verdict",children:h.jsx(_e,{rows:3,maxLength:300,value:n.verdict,onChange:r=>e({...t,decision_summary:{...n,verdict:r.target.value}})})}),n.metrics.map((r,s)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-3",children:[h.jsx(ue,{label:"Label",children:h.jsx($,{maxLength:60,value:r.label,onChange:i=>e({...t,decision_summary:{...n,metrics:n.metrics.map((o,l)=>l===s?{...o,label:i.target.value}:o)}})})}),h.jsx(ue,{label:"Value",children:h.jsx($,{maxLength:80,value:r.value,onChange:i=>e({...t,decision_summary:{...n,metrics:n.metrics.map((o,l)=>l===s?{...o,value:i.target.value}:o)}})})}),h.jsx(ue,{label:"Reference",hint:"e.g. (D2)",children:h.jsx($,{maxLength:40,value:r.reference??"",onChange:i=>e({...t,decision_summary:{...n,metrics:n.metrics.map((o,l)=>l===s?{...o,reference:i.target.value||void 0}:o)}})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const i=n.metrics.filter((o,l)=>l!==s);if(i.length)e({...t,decision_summary:{...n,metrics:i}});else{const{decision_summary:o,...l}=t;e(l)}},children:"Remove metric"})]},s)),n.metrics.length<4&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,decision_summary:{...n,metrics:[...n.metrics,nd()]}}),children:["Add metric (",n.metrics.length,"/4)"]}),h.jsx(ue,{label:"Footer",children:h.jsx(_e,{rows:2,maxLength:400,value:n.footer??"",onChange:r=>e({...t,decision_summary:{...n,footer:r.target.value||void 0}})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const{decision_summary:r,...s}=t;e(s)},children:"Remove decision summary"})]})]})}function WS({value:t,update:e}){const n=t.risk_framework;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Risk framework"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,risk_framework:{rows:[rd()]}}),children:"Add risk framework"})]}),n&&h.jsxs(h.Fragment,{children:[h.jsx(ue,{label:"Intro",children:h.jsx(_e,{rows:2,maxLength:300,value:n.intro??"",onChange:r=>e({...t,risk_framework:{...n,intro:r.target.value||void 0}})})}),n.rows.map((r,s)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-[1fr_120px]",children:[h.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[h.jsx(ue,{label:"Dimension",children:h.jsx($,{maxLength:40,value:r.dimension,onChange:i=>e({...t,risk_framework:{...n,rows:n.rows.map((o,l)=>l===s?{...o,dimension:i.target.value}:o)}})})}),h.jsx(ue,{label:"Score (1–5)",children:h.jsx($,{type:"number",min:1,max:5,step:1,value:r.score,onChange:i=>e({...t,risk_framework:{...n,rows:n.rows.map((o,l)=>l===s?{...o,score:Math.round(Number(i.target.value))}:o)}})})})]}),h.jsx(ue,{label:"Rationale",children:h.jsx(_e,{rows:3,maxLength:900,value:r.rationale,onChange:i=>e({...t,risk_framework:{...n,rows:n.rows.map((o,l)=>l===s?{...o,rationale:i.target.value}:o)}})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const i=n.rows.filter((o,l)=>l!==s);if(i.length)e({...t,risk_framework:{...n,rows:i}});else{const{risk_framework:o,...l}=t;e(l)}},children:"Remove row"})]},s)),n.rows.length<8&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,risk_framework:{...n,rows:[...n.rows,rd()]}}),children:["Add row (",n.rows.length,"/8)"]}),h.jsx(ue,{label:"Footnote",children:h.jsx(_e,{rows:2,maxLength:300,value:n.footnote??"",onChange:r=>e({...t,risk_framework:{...n,footnote:r.target.value||void 0}})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const{risk_framework:r,...s}=t;e(s)},children:"Remove risk framework"})]})]})}function VS({value:t,update:e}){const n=t.actions;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Actions"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,actions:[sd()]}),children:"Add actions"})]}),n==null?void 0:n.map((r,s)=>h.jsxs("div",{className:"space-y-2 rounded bg-white/5 p-3",children:[h.jsx(ue,{label:"Period label",hint:"e.g. Next 30 days",children:h.jsx($,{maxLength:40,value:r.period,onChange:i=>e({...t,actions:n.map((o,l)=>l===s?{...o,period:i.target.value}:o)})})}),r.items.map((i,o)=>h.jsxs("div",{className:"flex gap-2",children:[h.jsx(_e,{rows:2,maxLength:700,value:i,onChange:l=>e({...t,actions:n.map((a,c)=>c===s?{...a,items:a.items.map((d,u)=>u===o?l.target.value:d)}:a)})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit shrink-0 text-red-300",onClick:()=>{const l=r.items.filter((c,d)=>d!==o),a=l.length?n.map((c,d)=>d===s?{...c,items:l}:c):n.filter((c,d)=>d!==s);if(a.length)e({...t,actions:a});else{const{actions:c,...d}=t;e(d)}},children:"Remove"})]},o)),r.items.length<4&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,actions:n.map((i,o)=>o===s?{...i,items:[...i.items,""]}:i)}),children:["Add item (",r.items.length,"/4)"]}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const i=n.filter((o,l)=>l!==s);if(i.length)e({...t,actions:i});else{const{actions:o,...l}=t;e(l)}},children:"Remove period"})]},s)),n&&n.length<3&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,actions:[...n,sd()]}),children:["Add period (",n.length,"/3)"]})]})}function qS({value:t,update:e}){const n=t.requested_inputs;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Requested inputs"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,requested_inputs:{questions:[""]}}),children:"Add requested inputs"})]}),n&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[h.jsx(ue,{label:"Headline",children:h.jsx($,{maxLength:120,value:n.headline??"",onChange:r=>e({...t,requested_inputs:{...n,headline:r.target.value||void 0}})})}),h.jsx(ue,{label:"Respond email",children:h.jsx($,{maxLength:120,value:n.respond_email??"",onChange:r=>e({...t,requested_inputs:{...n,respond_email:r.target.value||void 0}})})})]}),h.jsx(ue,{label:"Intro",children:h.jsx(_e,{rows:2,maxLength:300,value:n.intro??"",onChange:r=>e({...t,requested_inputs:{...n,intro:r.target.value||void 0}})})}),n.questions.map((r,s)=>h.jsxs("div",{className:"flex gap-2",children:[h.jsx(_e,{rows:2,maxLength:500,value:r,onChange:i=>e({...t,requested_inputs:{...n,questions:n.questions.map((o,l)=>l===s?i.target.value:o)}})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit shrink-0 text-red-300",onClick:()=>{const i=n.questions.filter((o,l)=>l!==s);if(i.length)e({...t,requested_inputs:{...n,questions:i}});else{const{requested_inputs:o,...l}=t;e(l)}},children:"Remove"})]},s)),n.questions.length<5&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,requested_inputs:{...n,questions:[...n.questions,""]}
209}),children:["Add question (",n.questions.length,"/5)"]}),h.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[h.jsx(ue,{label:"Deadline note",children:h.jsx($,{maxLength:160,value:n.deadline_note??"",onChange:r=>e({...t,requested_inputs:{...n,deadline_note:r.target.value||void 0}})})}),h.jsx(ue,{label:"Consent note",children:h.jsx($,{maxLength:200,value:n.consent_note??"",onChange:r=>e({...t,requested_inputs:{...n,consent_note:r.target.value||void 0}})})})]}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const{requested_inputs:r,...s}=t;e(s)},children:"Remove requested inputs"})]})]})}function US({value:t,update:e}){const n=t.source_groups;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Source groups"}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,source_groups:[id()]}),children:"Add source groups"})]}),n==null?void 0:n.map((r,s)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-[1fr_2fr_auto] md:items-end",children:[h.jsx(ue,{label:"Label",children:h.jsx($,{maxLength:80,value:r.label,onChange:i=>e({...t,source_groups:n.map((o,l)=>l===s?{...o,label:i.target.value}:o)})})}),h.jsx(ue,{label:"Source ids",hint:"Comma-separated, e.g. S1, S2, S3",children:h.jsx(FS,{ids:r.ids,onChange:i=>e({...t,source_groups:n.map((o,l)=>l===s?{...o,ids:i}:o)})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const i=n.filter((o,l)=>l!==s);if(i.length)e({...t,source_groups:i});else{const{source_groups:o,...l}=t;e(l)}},children:"Remove group"})]},s)),n&&n.length<8&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,source_groups:[...n,id()]}),children:["Add group (",n.length,"/8)"]})]})}function KS({value:t,update:e}){const n=t.section_anchors;return h.jsxs("div",{className:"rounded border border-white/10 p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h5",{className:"font-medium text-white",children:"Section anchors"}),h.jsx("p",{className:"text-sm text-gray-500",children:"Maps a nonstandard member heading onto a canonical section."}),!n&&h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,section_anchors:[od()]}),children:"Add section anchors"})]}),n==null?void 0:n.map((r,s)=>h.jsxs("div",{className:"grid gap-2 rounded bg-white/5 p-3 md:grid-cols-[1fr_2fr_auto] md:items-end",children:[h.jsx(ue,{label:"Canonical section",children:h.jsx("select",{value:r.section,onChange:i=>e({...t,section_anchors:n.map((o,l)=>l===s?{...o,section:i.target.value}:o)}),className:"w-full rounded border border-white/20 bg-background px-3 py-2 text-sm text-white",children:fd.map(i=>h.jsx("option",{value:i,children:Lp[i]},i))})}),h.jsx(ue,{label:"Heading text in member content",children:h.jsx($,{maxLength:160,value:r.heading,onChange:i=>e({...t,section_anchors:n.map((o,l)=>l===s?{...o,heading:i.target.value}:o)})})}),h.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-fit text-red-300",onClick:()=>{const i=n.filter((o,l)=>l!==s);if(i.length)e({...t,section_anchors:i});else{const{section_anchors:o,...l}=t;e(l)}},children:"Remove anchor"})]},s)),n&&n.length<12&&h.jsxs(O,{type:"button",variant:"outline",size:"sm",onClick:()=>e({...t,section_anchors:[...n,od()]}),children:["Add anchor (",n.length,"/12)"]})]})}function JS({value:t,onChange:e,errors:n,title:r,memberContentHtml:s,publicText:i}){const[o,l]=M.useState("visitor"),a=c=>e(c);return h.jsxs("section",{className:"mt-8 border-t border-white/10 pt-6 space-y-6",children:[h.jsxs("div",{children:[h.jsx("h4",{className:"text-base font-semibold text-white",children:"Member Edition presentation (private)"}),h.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Optional structured modules for the verified Member Edition. Empty modules are omitted from the saved record."}),h.jsx("p",{className:"mt-2 rounded border border-red-800/70 bg-red-950/30 px-3 py-2 text-sm font-medium text-red-300",children:"Member-only data. Never shown to visitors; served only after member verification."})]}),n.length>0&&h.jsxs("div",{className:"rounded border border-red-800 bg-red-950/30 p-3 text-sm text-red-200",role:"alert",children:[h.jsx("b",{children:"Member Edition presentation cannot be saved"}),h.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:n.map(c=>h.jsx("li",{children:c},c))})]}),h.jsx(HS,{value:t,update:a}),h.jsx(WS,{value:t,update:a}),h.jsx(VS,{value:t,update:a}),h.jsx(qS,{value:t,update:a}),h.jsx(US,{value:t,update:a}),h.jsx(KS,{value:t,update:a}),h.jsxs("div",{className:"rounded border border-white/10 p-4",children:[h.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("h5",{className:"font-medium text-white",children:"Preview"}),h.jsx("p",{className:"text-sm text-gray-500",children:"Visitor state never renders member data. Verified member state parses the draft Member Content tab."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(O,{type:"button",size:"sm",variant:o==="visitor"?"default":"outline",onClick:()=>l("visitor"),children:"Visitor"}),h.jsx(O,{type:"button",size:"sm",variant:o==="member"?"default":"outline",onClick:()=>l("member"),children:"Verified member"})]})]}),h.jsx("div",{className:"rounded border border-white/10",children:h.jsx($S,{previewState:o,title:r,memberContentHtml:s,publicText:i,presentation:t})})]})]})}function YS(t){if((t==null?void 0:t.content_schema_version)!==2)return{};const e=Bn(t.web_presentation);return e.ok?e.value:{}}function GS(t){return JSON.parse(JSON.stringify(t))}function Gf(t){return!!t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0}function QS(t){if(!Gf(t==null?void 0:t.member_presentation))return{};const e=Kn(t.member_presentation);return e.ok?e.value:{}}function XS({brief:t,onSaved:e,onCancel:n}){var ra,sa;const{toast:r}
209=Cr(),[s,i]=M.useState(!1),[o,l]=M.useState((t==null?void 0:t.title)??""),[a,c]=M.useState((t==null?void 0:t.slug)??""),[d,u]=M.useState((t==null?void 0:t.excerpt)??""),[f,p]=M.useState((t==null?void 0:t.cover_image)??""),[m,g]=M.useState((t==null?void 0:t.tags)??[]),[y,b]=M.useState(""),[x,k]=M.useState((t==null?void 0:t.public_content)??""),[v,S]=M.useState((t==null?void 0:t.member_content)??""),[N,T]=M.useState(t!=null&&t.published_at?Pe(new Date(t.published_at),"yyyy-MM-dd'T'HH:mm"):""),[w,j]=M.useState(!!t),[q,F]=M.useState("public"),[U,te]=M.useState(()=>YS(t)),[se,J]=M.useState([]),[Fe,P]=M.useState(()=>QS(t)),[L,Ht]=M.useState([]),Rn=M.useMemo(()=>MS(x),[x]),hn=M.useMemo(()=>NS(x),[x]),Qf=M.useMemo(()=>(t==null?void 0:t.content_schema_version)===2&&Bn(t.web_presentation).ok,[t]),Xf=M.useMemo(()=>Gf(t==null?void 0:t.member_presentation)&&Kn(t.member_presentation).ok,[t]),Zf=N?new Date(N):void 0,xi=N.includes("T")?((ra=N.split("T")[1])==null?void 0:ra.split(":")[0])??"09":"09",vi=N.includes("T")?((sa=N.split("T")[1])==null?void 0:sa.split(":")[1])??"00":"00",ep=D=>{if(!D){T("");return}const re=xi.padStart(2,"0"),wt=vi.padStart(2,"0");
209T(Pe(D,"yyyy-MM-dd")+"T"+re+":"+wt)},na=(D,re)=>{const wt=N.includes("T")?N.split("T")[0]:Pe(new Date,"yyyy-MM-dd"),fn=D==="hour"?re.padStart(2,"0"):xi.padStart(2,"0"),_r=D==="minute"?re.padStart(2,"0"):vi.padStart(2,"0");T(wt+"T"+fn+":"+_r)};M.useEffect(()=>{!w&&o&&c(SS(o))},[o,w]);const ki=D=>{const re=D.trim();re&&!m.includes(re)&&g([...m,re]),b("")},tp=D=>g(m.filter(re=>re!==D)),wi=async D=>{if(!o.trim()){r({title:"Title required",variant:"destructive"});return}if(!a.trim()){r({title:"Slug required",variant:"destructive"});return}let re=null,wt="draft";if(D==="draft")(t==null?void 0:t.status)==="published"&&(wt="published",re=t.published_at);else if(D==="now"){wt="published";const Ye=t!=null&&t.published_at?new Date(t.published_at):null;re=Ye&&Ye<=new Date?t.published_at:new Date().toISOString()}else if(D==="schedule"){if(!N){r({title:"Pick a date/time to schedule",variant:"destructive"});return}wt="published",re=new Date(N).toISOString()}const fn=Bn(U),_r=Qf||Object.keys(U).length>0;if(_r&&!fn.ok){J(fn.errors),r({title:"Fix presentation errors before saving",variant:"destructive"});return}const _n=PS(Fe,Xf);if(!_n.ok){Ht(_n.errors),r({title:"Fix Member Edition presentation errors before saving",variant:"destructive"});return}i(!0);try{const Ye={title:o,slug:a,excerpt:d,cover_image:f||null,public_content:x,member_content:v,tags:m,status:wt,published_at:re};_r&&fn.ok&&(Ye.content_schema_version=2,Ye.web_presentation=GS(fn.value)),_n.patch.member_presentation!==void 0&&(Ye.member_presentation=_n.patch.member_presentation,Ye.member_presentation_version=_n.patch.member_presentation_version);let In;
209if(t?{error:In}=await me.from("intelligence_briefs").update(Ye).eq("id",t.id):{error:In}=await me.from("intelligence_briefs").insert(Ye),In){if(In.code==="23505"){r({title:"Slug already taken",description:"Choose a different slug.",variant:"destructive"});return}throw In}if(D==="draft")r({title:"Saved as draft"});else if(D==="schedule")r({title:"Scheduled",description:N?`Goes live ${Pe(new Date(N),"MMM d 'at' h:mm a")} — notifications send automatically.`:void 0});else if(D==="now"){let Ir=t==null?void 0:t.id;if(!Ir){const{data:pn}=await me.from("intelligence_briefs").select("id").eq("slug",a).single();Ir=pn==null?void 0:pn.id}if(Ir){const{error:pn}=await me.functions.invoke("notify-brief-published",{body:{brief_id:Ir,source:"admin"}});r(pn?{title:"Published — notification failed",description:pn.message,variant:"destructive"}:{title:"Published — member notifications sent."})}else r({title:"Published!"})}e()}catch(Ye){r({title:"Save failed",description:Ye.message,variant:"destructive"})}finally{i(!1)}};return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[h.jsxs(O,{variant:"ghost",size:"sm",onClick:n,children:[h.jsx(hd,{className:"h-4 w-4 mr-1"})," Back"]}),h.jsx("h3",{className:"text-lg font-semibold text-white",children:t?"Edit Brief":"New Brief"})]}),h.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[340px_1fr] gap-6",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs font-semibold uppercase tracking-widest text-gray-500 mb-1.5",children:"Title"}),h.jsx($,{value:o,onChange:D=>l(D.target.value),placeholder:"Brief title",className:"text-base"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs font-semibold uppercase tracking-widest text-gray-500 mb-1.5",children:"Slug"}),h.jsx($,{value:a,onChange:D=>{c(D.target.value),j(!0)},placeholder:"auto-generated-from-title",className:"font-mono text-sm"}),h.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["futuresummit.ai/intelligence/",a||"…"]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs font-semibold uppercase tracking-widest text-gray-500 mb-1.5",children:"Cover Image URL"}),h.jsx($,{value:f,onChange:D=>p(D.target.value),placeholder:"https://…"}),f&&h.jsx("img",{src:f,alt:"cover preview",className:"mt-2 rounded w-full h-28 object-cover border border-white/10"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs font-semibold uppercase tracking-widest text-gray-500 mb-1.5",children:"Card / SEO Excerpt"}),h.jsx(_e,{value:d,onChange:D=>u(D.target.value),placeholder:"Short summary shown on index cards and in search",rows:3}),h.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"Aim for roughly 160 characters for search results."})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs font-semibold uppercase tracking-widest text-gray-500 mb-1.5",children:"Tags"}),h.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:m.map(D=>h.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-yellow-900/30 text-yellow-400 border border-yellow-800",children:[D,h.jsx("button",{onClick:()=>tp(D),className:"hover:text-red-400",children:h.jsx(Go,{size:10})})]},D))}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx($,{value:y,onChange:D=>b(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),ki(y))},placeholder:"Add tag…",className:"text-sm"}),h.jsx(O,{variant:"outline",size:"sm",onClick:()=>ki(y),children:"Add"})]}),h.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:CS.filter(D=>!m.includes(D)).map(D=>h.jsx("button",{onClick:()=>ki(D),className:"px-2 py-0.5 rounded text-xs bg-white/5 text-gray-400 border border-white/10 hover:border-yellow-700 hover:text-yellow-400 transition-colors",children:D},D))})]}),h.jsxs("div",{className:"border border-white/10 rounded-lg p-4 space-y-3",children:[h.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-gray-500",children:"Publish"}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx(O,{variant:"outline",size:"sm",onClick:()=>wi("draft"),disabled:s,className:"col-span-2",children:(t==null?void 0:t.status)==="published"?"Save Changes":"Save Draft"}),h.jsx(O,{size:"sm",onClick:()=>wi("now"),disabled:s,className:"bg-green-700 hover:bg-green-600 text-white font-semibold",children:"Publish Now"}),h.jsxs(O,{variant:"outline",size:"sm",onClick:()=>wi("schedule"),disabled:s,children:[h.jsx(aa,{size:13,className:"mr-1"})," Schedule"]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:"Schedule date & time"}),h.jsxs(up,{children:[h.jsx(hp,{asChild:!0,children:h.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 bg-background border border-white/20 rounded px-3 py-1.5 text-sm text-left hover:border-white/40 focus:outline-none focus:border-yellow-600 transition-colors",children:[h.jsx(aa,{size:13,className:"text-gray-500 shrink-0"}),h.jsx("span",{className:N?"text-white":"text-gray-500",children:N?Pe(new Date(N),"MMM d, yyyy · h:mm a"):"Pick a date & time"})]})}),h.jsxs(fp,{className:"w-auto p-0 bg-[#1a1a1a] border-white/20",align:"start",children:[h.jsx(Od,{mode:"single",selected:Zf,onSelect:ep,disabled:D=>D<new Date(new Date().setHours(0,0,0,0)),initialFocus:!0}),h.jsxs("div",{className:"border-t border-white/10 p-3 flex items-center gap-2",children:[h.jsx("span",{className:"text-xs text-gray-500 shrink-0",children:"Time (MT)"}),h.jsx("select",{value:xi,onChange:D=>na("hour",D.target.value),className:"bg-[#0f0f0f] border border-white/20 rounded px-2 py-1 text-sm text-white flex-1",children:Array.from({length:24},(D,re)=>String(re).padStart(2,"0")).map(D=>h.jsx("option",{value:D,children:D},D))}),h.jsx("span",{className:"text-gray-500 font-mono",children:":"}),h.jsx("select",{value:vi,onChange:D=>na("minute",D.target.value),className:"bg-[#0f0f0f] border border-white/20 rounded px-2 py-1 text-sm text-white flex-1",children:["00","15","30","45"].map(D=>h.jsx("option",{value:D,children:D},D))})]})]})]})]})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"flex gap-0 mb-0 border-b border-white/10",children:["public","member"].map(D=>h.jsx("button",{onClick:()=>F(D),className:`px-5 py-2.5 text-sm font-medium capitalize border-b-2 transition-colors ${q===D?"border-yellow-500 text-yellow-400":"border-transparent text-gray-400 hover:text-white"}`,children:D==="public"?"Public Content":"Member Content"},D))}),h.jsx("div",{className:"mt-4",children:q==="public"?h.jsx(Gc,{
209content:x,onChange:k,placeholder:"Write the public commentary — visible to all readers…"},"public-editor"):h.jsx(Gc,{content:v,onChange:S,placeholder:"Write the member analysis — methodology, models, action framework. Only verified members will see this…"},"member-editor")}),h.jsx(ES,{value:U,onChange:D=>{te(D);const re=Bn(D);J(re.ok?[]:re.errors)},title:o,tags:m,excerpt:d,sections:Rn,publicText:hn,errors:se}),h.jsx("div",{className:"mt-3 flex justify-end",children:h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>{const D=Bn(U);J(D.ok?[]:D.errors),r({title:D.ok?"Presentation is valid":"Presentation needs changes",variant:D.ok?"default":"destructive"})},children:"Validate presentation"})}),h.jsx(JS,{value:Fe,onChange:D=>{P(D);const re=Kn(D);Ht(re.ok?[]:re.errors)},errors:L,title:o,memberContentHtml:v,publicText:hn}),h.jsx("div",{className:"mt-3 flex justify-end",children:h.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:()=>{const D=Kn(Fe);Ht(D.ok?[]:D.errors),r({title:D.ok?"Member Edition presentation is valid":"Member Edition presentation needs changes",variant:D.ok?"default":"destructive"})},children:"Validate Member Edition presentation"})})]})]})]})}const ZS=({status:t,publishedAt:e})=>{const n=t==="published"&&e&&new Date(e)>new Date;return t==="published"&&e&&new Date(e)<=new Date?h.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-green-900/40 text-green-400 border border-green-800",children:"Live"}):n?h.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-yellow-900/40 text-yellow-400 border border-yellow-800",children:"Scheduled"}):h.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-white/5 text-gray-400 border border-white/10",children:"Draft"})};function eM(){const[t,e]=M.useState([]),[n,r]=M.useState(!0),[s,i]=M.useState(null),[o,l]=M.useState(!1),[a,c]=M.useState(null),[d,u]=M.useState(!1),[f,p]=M.useState(null),{toast:m}=Cr(),g=M.useCallback(async()=>{r(!0);const{data:k,error:v}=await me.from("intelligence_briefs").select("*").order("created_at",{ascending:!1});v&&m({title:"Error loading briefs",description:v.message,variant:"destructive"}),e(k??[]),r(!1)},[m]);M.useEffect(()=>{g()},[g]);const y=async(k,v)=>{if(!confirm(`Delete "${v}"? This cannot be undone.`))return;const{error:S}=await me.from("intelligence_briefs").delete().eq("id",k);if(S){m({title:"Delete failed",description:S.message,variant:"destructive"});return}m({title:"Brief deleted"}),g()},b=async k=>{c(k.id);const{data:v,error:S}=await me.functions.invoke("notify-brief-published",{body:{brief_id:k.id,source:"admin",force:!0}});m(S?{title:"Notification failed",description:S.message,variant:"destructive"}:{title:"Notifications sent",description:`${(v==null?void 0:v.sent)??0} member${(v==null?void 0:v.sent)===1?"":"s"} notified.`}),g(),c(null)},x=async()=>{var S;u(!0),p(null);const{data:k,error:v}=await me.functions.invoke("health-notify-brief",{body:{}});if(v){const N=(S=v==null?void 0:v.context)==null?void 0:S.body;let T=null;try{typeof N=="string"?T=JSON.parse(N):N&&typeof N=="object"&&(T=N)}catch{}T&&Array.isArray(T.results)?(p({...T,ranAt:new Date().toISOString()}),m({title:"Health check failed",description:`Failing probes: ${T.failing??"unknown"}`,variant:"destructive"})):m({title:"Health check error",description:v.message,variant:"destructive"})}else k&&(p({...k,ranAt:new Date().toISOString()}),m({title:k.healthy?"Health check passed":"Health check failed",description:k.healthy?"All auth probes returned expected status.":`Failing probes: ${
209k.failing??"unknown"}`,variant:k.healthy?"default":"destructive"}));u(!1)};return s||o?h.jsx(XS,{brief:o?null:s,onSaved:()=>{i(null),l(!1),g()},onCancel:()=>{i(null),l(!1)}}):h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h3",{className:"text-lg font-semibold text-white",children:"Intelligence Briefs"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(O,{variant:"outline",size:"sm",onClick:x,disabled:d,title:"Probe notify-brief-published auth gate",children:[h.jsx(ds,{className:`h-4 w-4 mr-1 ${d?"animate-spin":""}`}),d?"Checking…":"Run health check"]}),h.jsx(O,{variant:"outline",size:"sm",onClick:g,disabled:n,children:h.jsx(ds,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),h.jsxs(O,{size:"sm",onClick:()=>l(!0),className:"bg-yellow-600 hover:bg-yellow-500 text-black font-semibold",children:[h.jsx(pd,{className:"h-4 w-4 mr-1"})," New Brief"]})]})]}),f&&h.jsxs("div",{className:`mb-4 rounded-md border p-3 text-xs ${f.healthy?"border-green-800/60 bg-green-900/10":"border-red-800/60 bg-red-900/10"}`,children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("div",{className:`font-semibold ${f.healthy?"text-green-400":"text-red-400"}`,children:f.healthy?"✓ Auth gate healthy":"✗ Auth gate regression detected"}),h.jsxs("div",{className:"flex items-center gap-3 text-gray-500",children:[h.jsxs("span",{children:["ran ",ar(new Date(f.ranAt))," ago"]}),h.jsx("button",{onClick:()=>p(null),className:"text-gray-500 hover:text-white","aria-label":"Dismiss health result",children:h.jsx(Go,{className:"h-3 w-3"})})]})]}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-left",children:[h.jsx("thead",{className:"text-gray-500",children:h.jsxs("tr",{children:[h.jsx("th",{className:"py-1 pr-3 font-medium",children:"Caller"}),h.jsx("th",{className:"py-1 pr-3 font-medium",children:"Auth"}),h.jsx("th",{className:"py-1 pr-3 font-medium",children:"Status"}),h.jsx("th",{className:"py-1 pr-3 font-medium",children:"Latency"}),h.jsx("th",{className:"py-1 font-medium",children:"Body"})]})}),h.jsx("tbody",{children:f.results.map(k=>h.jsxs("tr",{className:"border-t border-white/5 align-top",children:[h.jsxs("td",{className:"py-1.5 pr-3",children:[h.jsxs("div",{className:k.ok?"text-gray-300":"text-red-400 font-semibold",children:[k.ok?"✓":"✗"," ",k.label]}),h.jsx("div",{className:"text-gray-500",children:k.caller})]}),h.jsx("td",{className:"py-1.5 pr-3 font-mono text-gray-400",children:k.authHeader}),h.jsxs("td",{className:"py-1.5 pr-3 font-mono text-gray-300",children:[k.status||"—"," / ",k.expected]}),h.jsxs("td",{className:"py-1.5 pr-3 font-mono text-gray-400",children:[k.durationMs,"ms"]}),h.jsxs("td",{className:"py-1.5",children:[k.error&&h.jsxs("div",{className:"text-red-400 mb-1",children:["error: ",k.error]}),h.jsx("code",{className:"block text-gray-400 break-all whitespace-pre-wrap max-w-md",children:k.body||"(empty)"})]})]},k.label))})]})})]}),h.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:h.jsxs(ad,{children:[h.jsx(cd,{children:h.jsxs(mt,{className:"border-white/10 hover:bg-transparent",children:[h.jsx(qe,{className:"text-gray-400",children:"Title"}),h.jsx(qe,{className:"text-gray-400",children:"Tags"}),h.jsx(qe,{className:"text-gray-400",children:"Status"}),h.jsx(qe,{className:"text-gray-400",children:"Published"}),h.jsx(qe,{className:"text-gray-400",children:"Notified"}),h.jsx(qe,{className:"text-gray-400 text-right",children:"Actions"})]})}),h.jsxs(dd,{children:[n&&h.jsx(mt,{children:h.jsx(we,{colSpan:6,className:"text-center text-gray-500 py-8",children:"Loading…"})}),!n&&t.length===0&&h.jsx(mt,{children:h.jsx(we,{colSpan:6,className:"text-center text-gray-500 py-8",children:"No briefs yet. Create your first one."})}),t.map(k=>h.jsxs(mt,{className:"border-white/10 hover:bg-white/[0.02]",children:[h.jsxs(we,{className:"font-medium text-white max-w-xs",children:[h.jsx("div",{className:"truncate",children:k.title}),h.jsxs("div",{className:"text-xs text-gray-500 truncate",children:["/",k.slug]})]}),h.jsx(we,{children:h.jsx("div",{className:"flex flex-wrap gap-1",children:k.tags.map(v=>h.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-white/5 text-gray-400 border border-white/10",children:v},v))})}),h.jsx(we,{children:h.jsx(ZS,{status:k.status,publishedAt:k.published_at})}),h.jsx(we,{className:"text-gray-400 text-sm",children:k.published_at?Pe(new Date(k.published_at),"MMM d, yyyy"):"—"}),h.jsx(we,{className:"text-sm",children:k.status==="published"&&k.published_at&&new Date(k.published_at)>new Date?h.jsx("span",{className:"text-yellow-600",children:"Pending"}):k.notified_at?h.jsx("span",{className:"text-gray-500",children:ar(new Date(k.notified_at),{addSuffix:!0})}):h.jsx("span",{className:"text-gray-600",children:"—"})}),h.jsx(we,{className:"text-right",children:h.jsxs("div",{className:"flex justify-end gap-1",children:[k.status==="published"&&k.published_at&&new Date(k.published_at)<=new Date&&h.jsx(O,{variant:"ghost",size:"sm",className:"text-yellow-600 hover:text-yellow-500 text-xs px-2",disabled:a===k.id,onClick:()=>b(k),title:"Send member notifications",children:a===k.id?"Sending…":"Notify"}),h.jsx(O,{variant:"ghost",size:"sm",onClick:()=>i(k),children:h.jsx(Pp,{className:"h-4 w-4"})}),h.jsx(O,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300",onClick:()=>y(k.id,k.title),children:h.jsx(zp,{className:"h-4 w-4"})})]})})]},k.id))]})]})})]})}
209function tM(){const[t,e]=M.useState([]),[n,r]=M.useState(!0),[s,i]=M.useState("pending"),[o,l]=M.useState(null),{toast:a}=Cr(),c=M.useCallback(async()=>{r(!0);let u=me.from("brief_comments").select("*, intelligence_briefs(title)").order("created_at",{ascending:!1});s!=="all"&&(u=u.eq("status",s));const{data:f,error:p}=await u;p&&a({title:"Error",description:p.message,variant:"destructive"}),e(f??[]),r(!1)},[s,a]);M.useEffect(()=>{c()},[c]);const d=async(u,f)=>{l(u);const{error:p}=await me.from("brief_comments").update({status:f}).eq("id",u);p?a({title:"Error",description:p.message,variant:"destructive"}):(a({title:f==="approved"?"Comment approved":"Comment rejected"}),c()),l(null)};return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h3",{className:"text-lg font-semibold text-white",children:"Comments"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(md,{value:s,onValueChange:u=>i(u),children:[h.jsx(gd,{className:"w-36 text-sm",children:h.jsx(yd,{})}),h.jsxs(bd,{children:[h.jsx($n,{value:"all",children:"All"}),h.jsx($n,{value:"pending",children:"Pending"}),h.jsx($n,{value:"approved",children:"Approved"}),h.jsx($n,{value:"rejected",children:"Rejected"})]})]}),h.jsx(O,{variant:"outline",size:"sm",onClick:c,disabled:n,children:h.jsx(ds,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]})]}),h.jsxs("div",{className:"space-y-3",children:[n&&h.jsx("p",{className:"text-gray-500 text-sm text-center py-8",children:"Loading…"}),!n&&t.length===0&&h.jsxs("p",{className:"text-gray-500 text-sm text-center py-8",children:["No ",s!=="all"?s:""," comments."]}),t.map(u=>h.jsx("div",{className:"border border-white/10 rounded-lg p-4 bg-white/[0.02]",children:h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[h.jsx("span",{className:"font-medium text-white text-sm",children:u.author_name}),h.jsx("span",{className:"text-gray-500 text-xs",children:u.author_email}),h.jsx("span",{className:"text-gray-600 text-xs",children:ar(new Date(u.created_at),{addSuffix:!0})}),u.intelligence_briefs&&h.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-white/5 text-gray-400 border border-white/10 truncate max-w-xs",children:u.intelligence_briefs.title})]}),h.jsx("p",{className:"text-gray-300 text-sm leading-relaxed",children:u.body})]}),u.status==="pending"&&h.jsxs("div",{className:"flex gap-1 shrink-0",children:[h.jsx(O,{size:"sm",className:"bg-green-800 hover:bg-green-700 text-white",disabled:o===u.id,onClick:()=>d(u.id,"approved"),children:h.jsx(Bp,{size:13})}),h.jsx(O,{size:"sm",variant:"outline",className:"text-red-400 border-red-900 hover:bg-red-900/20",disabled:o===u.id,onClick:()=>d(u.id,"rejected"),children:h.jsx(Go,{size:13})})]}),u.status!=="pending"&&h.jsx("span",{className:`text-xs px-2 py-0.5 rounded border shrink-0 ${u.status==="approved"?"text-green-400 border-green-800 bg-green-900/30":"text-red-400 border-red-900 bg-red-900/20"}`,children:u.status})]})},u.id))]})]})}const ld={not_sent:{label:"Not Sent",className:"bg-gray-800 text-gray-400 border border-gray-700"},sent:{label:"Sent",className:"bg-yellow-900/30 text-yellow-400 border border-yellow-800"},complete:{label:"Complete",className:"bg-green-900/30 text-green-400 border border-green-800"}};function nM(){const[t,e]=M.useState([]),[n,r]=M.useState(!0),[s,i]=M.useState(!1),[o,l]=M.useState(null),[a,c]=M.useState(null),[d,u]=M.useState(null),[f,p]=M.useState({}),[m,g]=M.useState({email:"",full_name:"",company:"",tier:""}),[y,b]=M.useState(!1),{toast:x}=Cr(),k=M.useCallback(async()=>{r(!0);const{data:w,error:j}=await me.from("members").select("*").order("created_at",{ascending:!1});j&&x({title:"Error",description:j.message,variant:"destructive"}),e(w??[]),r(!1)},[x]);M.useEffect(()=>{k()},[k]);const v=async()=>{if(!m.email.trim()){x({title:"Email required",variant:"destructive"});return}b(!0);const{error:w}=await me.from("members").insert({email:m.email.trim().toLowerCase(),full_name:m.full_name||null,company:m.company||null,tier:m.tier||null});if(w){w.code==="23505"?x({title:"Email already exists",variant:"destructive"}):x({title:"Error",description:w.message,variant:"destructive"}),b(!1);return}const{error:j}=await me.functions.invoke("send-member-welcome",{body:{email:m.email.trim().toLowerCase(),full_name:m.full_name||null,tier:m.tier||null,company:m.company||null}});x(j?{title:"Member added — welcome email failed",description:j.message,variant:"destructive"}:{title:"Member added",description:"Welcome email sent."}),g({email:"",full_name:"",company:"",tier:""}),i(!1),k(),b(!1)},S=async w=>
209{c(w.id);const{error:j}=await me.functions.invoke("send-member-welcome",{body:{email:w.email,full_name:w.full_name,tier:w.tier,company:w.company}});j?x({title:"Resend failed",description:j.message,variant:"destructive"}):(x({title:"Welcome email resent"}),k()),c(null)},N=async(w,j)=>{l(w),await me.from("members").update({is_active:!j}).eq("id",w),l(null),k()},T=async w=>{if(d===w){u(null);return}if(!f[w]){const{data:j}=await me.from("member_intake").select("*").eq("member_id",w).maybeSingle();j&&p(q=>({...q,[w]:j}))}u(w)};return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h3",{className:"text-lg font-semibold text-white",children:"Members"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(O,{variant:"outline",size:"sm",onClick:k,disabled:n,children:h.jsx(ds,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),h.jsxs(O,{size:"sm",onClick:()=>i(!s),className:"bg-yellow-600 hover:bg-yellow-500 text-black font-semibold",children:[h.jsx(pd,{className:"h-4 w-4 mr-1"})," Add Member"]})]})]}),s&&h.jsxs("div",{className:"border border-white/10 rounded-lg p-4 mb-4 bg-white/[0.02] space-y-3",children:[h.jsx("p",{className:"text-sm font-semibold text-white",children:"Add Member"}),h.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs uppercase tracking-widest text-gray-500 mb-1",children:"Email *"}),h.jsx($,{value:m.email,onChange:w=>g({...m,email:w.target.value}),placeholder:"[email protected]"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs uppercase tracking-widest text-gray-500 mb-1",children:"Full Name"}),h.jsx($,{value:m.full_name,onChange:w=>g({...m,full_name:w.target.value}),placeholder:"First Last"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs uppercase tracking-widest text-gray-500 mb-1",children:"Company"}),h.jsx($,{value:m.company,onChange:w=>g({...m,company:w.target.value}),placeholder:"Organization"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs uppercase tracking-widest text-gray-500 mb-1",children:"Tier"}),h.jsxs(md,{value:m.tier,onValueChange:w=>g({...m,tier:w}),children:[h.jsx(gd,{children:h.jsx(yd,{placeholder:"Select tier"})}),h.jsx(bd,{children:wS.map(w=>h.jsx($n,{value:w,children:w},w))})]})]})]}),h.jsx("p",{className:"text-xs text-gray-500",children:"Welcome email sends automatically on add."}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(O,{size:"sm",onClick:v,disabled:y,className:"bg-yellow-600 hover:bg-yellow-500 text-black font-semibold",children:y?"Saving…":"Add Member"}),h.jsx(O,{variant:"outline",size:"sm",onClick:()=>i(!1),children:"Cancel"})]})]}),h.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:h.jsxs(ad,{children:[h.jsx(cd,{children:h.jsxs(mt,{className:"border-white/10 hover:bg-transparent",children:[h.jsx(qe,{className:"text-gray-400",children:"Email"}),h.jsx(qe,{className:"text-gray-400",children:"Name / Company"}),h.jsx(qe,{className:"text-gray-400",children:"Tier"}),h.jsx(qe,{className:"text-gray-400",children:"Intake"}),h.jsx(qe,{className:"text-gray-400",children:"Welcome Sent"}),h.jsx(qe,{className:"text-gray-400 text-right",children:"Active"})]})}),h.jsxs(dd,{children:[n&&h.jsx(mt,{children:h.jsx(we,{colSpan:6,className:"text-center text-gray-500 py-8",children:"Loading…"})}),!n&&t.length===0&&h.jsx(mt,{children:h.jsx(we,{colSpan:6,className:"text-center text-gray-500 py-8",children:"No members yet."})}),t.map(w=>{const j=ld[w.intake_status??"not_sent"]??ld.not_sent,q=d===w.id,F=f[w.id];return h.jsxs(Pt.Fragment,{children:[h.jsxs(mt,{className:"border-white/10 hover:bg-white/[0.02]",children:[h.jsx(we,{className:"text-white text-sm",children:w.email}),h.jsxs(we,{className:"text-gray-400 text-sm",children:[h.jsx("div",{children:w.full_name??"—"}),w.company&&h.jsx("div",{className:"text-xs text-gray-600",children:w.company})]}),h.jsx(we,{children:w.tier?h.jsx("span",{className:"px-2 py-0.5 rounded text-xs bg-yellow-900/30 text-yellow-400 border border-yellow-800",children:w.tier}):h.jsx("span",{className:"text-gray-600 text-xs",children:"—"})}),h.jsx(we,{children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`px-2 py-0.5 rounded text-xs ${j.className}`,children:j.label}),w.intake_status==="complete"&&h.jsx("button",{onClick:()=>T(w.id),className:"text-xs text-[#d9be81] hover:underline",children:q?"Hide":"View"}),h.jsx("button",{onClick:()=>S(w),disabled:a===w.id,className:"text-xs text-gray-500 hover:text-white transition-colors",title:"Resend welcome email",children:a===w.id?"…":"Resend"})]})}),h.jsx(we,{className:"text-gray-500 text-xs",children:w.welcome_email_sent_at?ar(new Date(w.welcome_email_sent_at),{addSuffix:!0}):"—"}),h.jsx(we,{className:"text-right",children:h.jsx("button",{onClick:()=>N(w.id,w.is_active),disabled:o===w.id,className:"text-gray-400 hover:text-white transition-colors",title:w.is_active?"Revoke access":"Restore access",children:w.is_active?h.jsx($p,{className:"h-5 w-5 text-green-400"}):h.jsx(Fp,{className:"h-5 w-5"})})})]}),q&&F&&h.jsx(mt,{className:"border-white/10 bg-white/[0.01]",children:h.jsx(we,{c
209olSpan:6,className:"px-4 py-4",children:h.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm",children:[[["Company Positioning",F.company_positioning],["Sector Focus",Array.isArray(F.sector_focus)?F.sector_focus.join(", "):null],["Introduction Targets",F.introduction_targets],["Current Mandate",F.current_mandate],["Working Group",F.working_group_preference],["Roundtables",Array.isArray(F.roundtable_preferences)?F.roundtable_preferences.join(", "):null],["Policy Interests",F.policy_interests],["Capital Readiness",F.capital_readiness],["Summit Interest",F.summit_interest],["Agenda Shaping",F.agenda_shaping],["Council Format",F.council_format_preference],["Dietary",F.dietary_restrictions],["Referral",F.referral_source]].filter(([,U])=>U&&String(U).trim()).map(([U,te])=>h.jsxs("div",{children:[h.jsx("p",{className:"text-xs uppercase tracking-widest text-gray-600 mb-0.5",children:String(U)}),h.jsx("p",{className:"text-gray-300 text-xs leading-relaxed",children:String(te)})]},String(U))),Array.isArray(F.additional_seats)&&F.additional_seats.length>0&&h.jsxs("div",{className:"sm:col-span-2",children:[h.jsx("p",{className:"text-xs uppercase tracking-widest text-gray-600 mb-1",children:"Seat Holders"}),F.additional_seats.map((U,te)=>h.jsxs("p",{className:"text-gray-300 text-xs leading-relaxed",children:[U.name," · ",U.title," · ",U.email,U.linkedin?` · ${U.linkedin}`:""]},te))]}),F.submitted_at&&h.jsx("div",{className:"sm:col-span-2",children:h.jsxs("p",{className:"text-xs text-gray-600",children:["Submitted ",ar(new Date(String(F.submitted_at)),{addSuffix:!0})]})})]})})})]},w.id)})]})]})})]})}function PM({subtab:t,onSubtabChange:e}={}){const[n,r]=M.useState("briefs"),s=t==="comments"||t==="members"||t==="briefs"?t:n,i=o=>{r(o),e==null||e(o)};return h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex gap-2 border-b border-white/10 pb-0",children:["briefs","comments","members"].map(o=>h.jsx("button",{onClick:()=>i(o),className:`px-4 py-2 text-sm font-medium capitalize border-b-2 transition-colors ${s===o?"border-yellow-500 text-yellow-400":"border-transparent text-gray-400 hover:text-white"}`,children:o},o))}),s==="briefs"&&h.jsx(eM,{}),s==="comments"&&h.jsx(tM,{}),s==="members"&&h.jsx(nM,{})]})}export{PM 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.