uEdition-Editor 2.0.0b2__py3-none-any.whl → 2.0.0b4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uEdition-Editor might be problematic. Click here for more details.
- uedition_editor/__about__.py +1 -1
- uedition_editor/api/branches.py +40 -2
- uedition_editor/api/configs.py +14 -3
- uedition_editor/api/files.py +158 -85
- uedition_editor/api/util.py +34 -10
- uedition_editor/frontend/dist/assets/{CodeMirrorEditor-BFeD7k_m.js → CodeMirrorEditor-CscxspV6.js} +1 -1
- uedition_editor/frontend/dist/assets/{FolderEditor-DIEGEh84.js → FolderEditor-Bj2w6MKI.js} +1 -1
- uedition_editor/frontend/dist/assets/ImageEditor-BCtwmSpD.js +1 -0
- uedition_editor/frontend/dist/assets/TeiEditor-FqXheBay.js +192 -0
- uedition_editor/frontend/dist/assets/index-CD2zWAAU.js +17 -0
- uedition_editor/frontend/dist/assets/{index-C9d-OSiG.css → index-HmBQiVS_.css} +1 -1
- uedition_editor/frontend/dist/index.html +2 -2
- uedition_editor/settings.py +11 -6
- {uedition_editor-2.0.0b2.dist-info → uedition_editor-2.0.0b4.dist-info}/METADATA +13 -9
- uedition_editor-2.0.0b4.dist-info/RECORD +27 -0
- uedition_editor/frontend/dist/assets/ImageEditor-BRTKiGoH.js +0 -1
- uedition_editor/frontend/dist/assets/TeiEditor-BeHkuEAu.js +0 -192
- uedition_editor/frontend/dist/assets/index-BtIoSLIQ.js +0 -16
- uedition_editor-2.0.0b2.dist-info/RECORD +0 -27
- {uedition_editor-2.0.0b2.dist-info → uedition_editor-2.0.0b4.dist-info}/WHEEL +0 -0
- {uedition_editor-2.0.0b2.dist-info → uedition_editor-2.0.0b4.dist-info}/entry_points.txt +0 -0
- {uedition_editor-2.0.0b2.dist-info → uedition_editor-2.0.0b4.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import{R as He,T as Fc,U as Fl,V as Vc,W as Je,X as it,Y as ys,Z as zt,_ as ki,$ as _t,a0 as _i,a1 as hr,a2 as qi,a3 as Lc,a4 as Wc,a5 as qc,a6 as Sn,a7 as jc,a8 as Jc,a9 as pr,aa as ln,ab as H,ac as ks,ad as Yr,ae as lr,af as $c,ag as _s,ah as Kc,ai as Uc,aj as Vl,ak as Ll,al as Wl,am as Ss,an as wn,ao as Hc,ap as Gc,aq as Yc,ar as Xc,as as Zc,at as Qc,au as eu,av as Nn,aw as tu,ax as nu,ay as ru,az as Si,aA as ar,aB as iu,aC as su,aD as Cs,aE as ou,aF as ji,aG as Ji,aH as Or,aI as $i,aJ as kn,aK as lu,S as Le,i as We,s as Pe,aL as pe,aM as me,aN as ge,aO as be,n as S,p as M,w as ae,F as ue,g as A,o as Q,q as ee,r as x,aP as Ae,aQ as Nr,aR as te,aS as xt,aT as pt,E as Fe,e as F,aU as ne,aV as qe,l as Z,aW as Re,v as ct,aX as ql,aY as Ki,aZ as jl,a_ as Ms,G as ie,t as he,k as je,a$ as au,b0 as de,b1 as ut,c as $,f as j,h as B,d as L,j as W,u as q,I as Ee,b2 as cu,b3 as Ar,H as Ui,b4 as uu,b5 as qn,b6 as st,b7 as Hi,b8 as Gi,b9 as Yi,ba as fu,y as du,bb as Kt,bc as ws,bd as Ts,O as Es,be as hu,P as Os,bf as pu,bg as mu,bh as gu,bi as bu,bj as yu,bk as ku,J as Yn,x as Ns,L as _u,N as tn,M as As,z as Su,Q as Cu}from"./index-BtIoSLIQ.js";import{k as Mu,b as wu}from"./index-Vcq4gwWv.js";function Xr(r){return Array.from(r.querySelectorAll('[role="option"]:not([data-disabled])')).filter(e=>He(e))}function Tu(r){return window.getComputedStyle(r).getPropertyValue("direction")}function Eu(r){return e=>{const t=e.target,n=Fc(r);if(!n||!Fl(t))return!1;const i=n.id;return!!(Vc(t)&&i===t.htmlFor||t.closest(`label[for="${i}"]`))}}function Ou(){return{elements:{root:Je("label",{action:e=>({destroy:it(e,"mousedown",n=>{!n.defaultPrevented&&n.detail>1&&n.preventDefault()})})})}}}const Nu=[H.ARROW_LEFT,H.ESCAPE,H.ARROW_RIGHT,H.SHIFT,H.CAPS_LOCK,H.CONTROL,H.ALT,H.META,H.ENTER,H.F1,H.F2,H.F3,H.F4,H.F5,H.F6,H.F7,H.F8,H.F9,H.F10,H.F11,H.F12],Au={positioning:{placement:"bottom",sameWidth:!0},scrollAlignment:"nearest",loop:!0,defaultOpen:!1,closeOnOutsideClick:!0,preventScroll:!0,closeOnEscape:!0,forceVisible:!1,portal:void 0,builder:"listbox",disabled:!1,required:!1,name:void 0,typeahead:!0,highlightOnHover:!0,onOutsideClick:void 0},xu=["trigger","menu","label"];function Du(r){const e={...Au,...r},t=ys(zt(null)),n=ys(zt(null)),i=e.selected??zt(e.defaultSelected),s=ki(i,e==null?void 0:e.onSelectedChange),o=_t(n,D=>D?ce(D):void 0),a=e.open??zt(e.defaultOpen),l=ki(a,e==null?void 0:e.onOpenChange),c=_i({...hr(e,"open","defaultOpen","builder","ids"),multiple:e.multiple??!1}),{scrollAlignment:u,loop:f,closeOnOutsideClick:d,closeOnEscape:h,preventScroll:p,portal:m,forceVisible:g,positioning:b,multiple:y,arrowSize:_,disabled:C,required:k,typeahead:w,name:P,highlightOnHover:O,onOutsideClick:N}=c,{name:E,selector:v}=qi(e.builder),U=_i({...Lc(xu),...e.ids}),{handleTypeaheadSearch:se}=Wc({onMatch:D=>{n.set(D),D.scrollIntoView({block:u.get()})},getCurrentItem(){return n.get()}});function ce(D){const J=D.getAttribute("data-value"),re=D.getAttribute("data-label"),Ue=D.hasAttribute("data-disabled");return{value:J&&JSON.parse(J),label:re??D.textContent??void 0,disabled:!!Ue}}const Be=D=>{s.update(J=>{if(y.get()){const Ue=Array.isArray(J)?[...J]:[];return iu(D,Ue,(en,le)=>Sn(en.value,le.value))}return D})};function I(D){const J=ce(D);Be(J)}async function Qt(){l.set(!0);const D=document.getElementById(U.trigger.get());if(!D)return;D!==t.get()&&t.set(D),await Yr();const J=document.getElementById(U.menu.get());if(!He(J))return;const re=J.querySelector("[aria-selected=true]");He(re)&&n.set(re)}function Ke(){l.set(!1),n.set(null)}const Kn=qc({open:l,forceVisible:g,activeTrigger:t}),Un=_t([s],([D])=>J=>Array.isArray(D)?D.some(re=>Sn(re.value,J)):jc(J)?Sn(D==null?void 0:D.value,Jc(J,void 0)):Sn(D==null?void 0:D.value,J)),Jr=_t([o],([D])=>J=>Sn(D==null?void 0:D.value,J)),$r=Je(E("trigger"),{stores:[l,n,C,U.menu,U.trigger,U.label],returned:([D,J,re,Ue,en,le])=>({"aria-activedescendant":J==null?void 0:J.id,"aria-autocomplete":"list","aria-controls":Ue,"aria-expanded":D,"aria-labelledby":le,id:en,role:"combobox",disabled:pr(re),type:e.builder==="select"?"button":void 0}),action:D=>{const J=Si(D),re=ln(it(D,"click",()=>{D.focus(),l.get()?Ke():Qt()}),it(D,"keydown",le=>{if(!l.get()){if(Nu.includes(le.key)||le.key===H.TAB||le.key===H.BACKSPACE&&J&&D.value===""||le.key===H.SPACE&&ks(D))return;Qt(),Yr().then(()=>{if(s.get())return;const It=document.getElementById(U.menu.get());if(!He(It))return;const ye=Array.from(It.querySelectorAll(`${v("item")}:not([data-disabled]):not([data-hidden])`)).filter(bt=>He(bt));ye.length&&(le.key===H.ARROW_DOWN?(n.set(ye[0]),ye[0].scrollIntoView({block:u.get()})):le.key===H.ARROW_UP&&(n.set(lr(ye)),lr(ye).scrollIntoView({block:u.get()})))})}if(le.key===H.TAB){Ke();return}if(le.key===H.ENTER&&!le.isComposing||le.key===H.SPACE&&ks(D)){le.preventDefault();const ze=n.get();ze&&I(ze),y.get()||Ke()}if(le.key===H.ARROW_UP&&le.altKey&&Ke(),$c.includes(le.key)){le.preventDefault();const ze=document.getElementById(U.menu.get());if(!He(ze))return;const It=Xr(ze);if(!It.length)return;const ye=It.filter(bs=>!_s(bs)&&bs.dataset.hidden===void 0),bt=n.get(),Pt=bt?ye.indexOf(bt):-1,Gn=f.get(),zc=u.get();let nt;switch(le.key){case H.ARROW_DOWN:nt=Ll(ye,Pt,Gn);break;case H.ARROW_UP:nt=Vl(ye,Pt,Gn);break;case H.PAGE_DOWN:nt=Uc(ye,Pt,10,Gn);break;case H.PAGE_UP:nt=Kc(ye,Pt,10,Gn);break;case H.HOME:nt=ye[0];break;case H.END:nt=lr(ye);break;default:return}n.set(nt),nt==null||nt.scrollIntoView({block:zc})}else if(w.get()){const ze=document.getElementById(U.menu.get());if(!He(ze))return;se(le.key,Xr(ze))}}));let Ue=ar;return Ue=Wl(D,{handler:Ke,enabled:_t([l,h],([le,Hn])=>le&&Hn)}).destroy,{destroy(){re(),Ue()}}}}),Kr=Je(E("menu"),{stores:[Kn,U.menu],returned:([D,J])=>({hidden:D?void 0:!0,id:J,role:"listbox",style:Ss({display:D?void 0:"none"})}),action:D=>{let J=ar;const re=ln(wn([Kn,m,d,b,t],([Ue,en,le,Hn,ze])=>{J(),!(!Ue||!ze)&&Yr().then(()=>{J();const It=Eu(U.trigger.get());J=Hc(D,{anchorElement:ze,open:l,options:{floating:Hn,focusTrap:null,modal:{closeOnInteractOutside:le,onClose:Ke,open:Ue,shouldCloseOnInteractOutside:ye=>{var Pt;if((Pt=N.get())==null||Pt(ye),ye.defaultPrevented)return!1;const bt=ye.target;return!(!Fl(bt)||bt===ze||ze.contains(bt)||It(ye))}},escapeKeydown:null,portal:Gc(D,en)}}).destroy})}));return{destroy:()=>{re(),J()}}}}),{elements:{root:Ur}}=Ou(),{action:Hr}=Yc(Ur),Gr=Je(E("label"),{stores:[U.label,U.trigger],returned:([D,J])=>({id:D,for:J}),action:Hr}),z=Je(E("option"),{stores:[Un],returned:([D])=>J=>{const re=D(J.value);return{"data-value":JSON.stringify(J.value),"data-label":J.label,"data-disabled":pr(J.disabled),"aria-disabled":J.disabled?!0:void 0,"aria-selected":re,"data-selected":re?"":void 0,id:Xc(),role:"option"}},action:D=>({destroy:ln(it(D,"click",re=>{if(_s(D)){re.preventDefault();return}I(D),y.get()||Ke()}),wn(O,re=>re?ln(it(D,"mouseover",()=>{n.set(D)}),it(D,"mouseleave",()=>{n.set(null)})):void 0))})}),Ic=Je(E("group"),{returned:()=>D=>({role:"group","aria-labelledby":D})}),Pc=Je(E("group-label"),{returned:()=>D=>({id:D})}),Rc=Zc({value:_t([s],([D])=>{const J=Array.isArray(D)?D.map(re=>re.value):D==null?void 0:D.value;return typeof J=="string"?J:JSON.stringify(J)}),name:Qc(P),required:k,prefix:e.builder}),Bc=Je(E("arrow"),{stores:_,returned:D=>({"data-arrow":!0,style:Ss({position:"absolute",width:`var(--arrow-size, ${D}px)`,height:`var(--arrow-size, ${D}px)`})})});return eu(()=>{if(!Nn)return;const D=document.getElementById(U.menu.get()),J=document.getElementById(U.trigger.get());if(J&&t.set(J),!D)return;const re=D.querySelector("[data-selected]");He(re)}),wn([n],([D])=>{if(!Nn)return;const J=document.getElementById(U.menu.get());He(J)&&Xr(J).forEach(re=>{re===D?tu(re):nu(re)})}),wn([l],([D])=>{if(!Nn)return;let J=ar;return p.get()&&D&&(J=ru()),()=>{J()}}),{ids:U,elements:{trigger:$r,group:Ic,option:z,menu:Kr,groupLabel:Pc,label:Gr,hiddenInput:Rc,arrow:Bc},states:{open:l,selected:s,highlighted:o,highlightedItem:n},helpers:{isSelected:Un,isHighlighted:Jr,closeMenu:Ke},options:c}}const{name:vu}=qi("combobox");function Iu(r){const e=Du({...r,builder:"combobox",typeahead:!1}),t=zt(""),n=zt(!1),i=Je(vu("input"),{stores:[e.elements.trigger,t],returned:([s,o])=>({...hr(s,"action"),role:"combobox",value:o,autocomplete:"off"}),action:s=>{const o=ln(it(s,"input",u=>{!Si(u.target)&&!Cs(u.target)||n.set(!0)}),su(s,"input",u=>{Si(u.target)&&t.set(u.target.value),Cs(u.target)&&t.set(u.target.innerText)}));let a=ar;a=Wl(s,{handler:()=>{e.helpers.closeMenu()}}).destroy;const{destroy:c}=e.elements.trigger(s);return{destroy(){c==null||c(),o(),a()}}}});return wn(e.states.open,s=>{s||n.set(!1)}),{...e,elements:{...hr(e.elements,"trigger"),input:i},states:{...e.states,touchedInput:n,inputValue:t}}}const Pu={orientation:"horizontal",activateOnFocus:!0,loop:!0,autoSet:!0},{name:Xn,selector:Ru}=qi("tabs");function Bu(r){const e={...Pu,...r},t=_i(hr(e,"defaultValue","value","onValueChange","autoSet")),{orientation:n,activateOnFocus:i,loop:s}=t,o=e.value??zt(e.defaultValue),a=ki(o,e==null?void 0:e.onValueChange);let l=e.defaultValue??a.get();const c=Je(Xn(),{stores:n,returned:p=>({"data-orientation":p})}),u=Je(Xn("list"),{stores:n,returned:p=>({role:"tablist","aria-orientation":p,"data-orientation":p})}),f=p=>typeof p=="string"?{value:p}:p,d=Je(Xn("trigger"),{stores:[a,n],returned:([p,m])=>g=>{const{value:b,disabled:y}=f(g);!p&&!l&&e.autoSet&&(l=b,p=b,a.set(b));const C=(Nn?p:l)===b;return{type:"button",role:"tab","data-state":C?"active":"inactive",tabindex:C?0:-1,"data-value":b,"data-orientation":m,"data-disabled":pr(y),disabled:pr(y)}},action:p=>({destroy:ln(it(p,"focus",()=>{const g=p.dataset.disabled==="true",b=p.dataset.value;i.get()&&!g&&b!==void 0&&a.set(b)}),it(p,"click",g=>{if(p.focus(),g.preventDefault(),p.dataset.disabled==="true")return;const y=p.dataset.value;p.focus(),y!==void 0&&a.set(y)}),it(p,"keydown",g=>{const b=p.dataset.value;if(!b)return;const y=g.currentTarget;if(!He(y))return;const _=y.closest(Ru());if(!He(_))return;const C=s.get(),w=Array.from(_.querySelectorAll('[role="tab"]')).filter(v=>He(v)).filter(v=>!v.hasAttribute("data-disabled")),P=w.findIndex(v=>v===g.target),O=Tu(_),{nextKey:N,prevKey:E}=ou(O,n.get());g.key===N?(g.preventDefault(),Ll(w,P,C).focus()):g.key===E?(g.preventDefault(),Vl(w,P,C).focus()):g.key===H.ENTER||g.key===H.SPACE?(g.preventDefault(),a.set(b)):g.key===H.HOME?(g.preventDefault(),w[0].focus()):g.key===H.END&&(g.preventDefault(),lr(w).focus())}))})}),h=Je(Xn("content"),{stores:a,returned:p=>m=>({role:"tabpanel","aria-labelledby":m,hidden:Nn?p===m?void 0:!0:l===m?void 0:!0,tabindex:0})});return{elements:{root:c,list:u,trigger:d,content:h},states:{value:a},options:t}}function zu(r,e){return r.length!==e.length?!1:r.every((t,n)=>t===e[n])}function Xi(){return{NAME:"combobox",GROUP_NAME:"combobox-group",ITEM_NAME:"combobox-item",PARTS:["content","menu","input","item","label","group","group-label","arrow","hidden-input","indicator"]}}function xr(){const{NAME:r}=Xi();return kn(r)}function Fu(r){const{NAME:e,PARTS:t}=Xi(),n=ji(e,t),i={...Iu({...Ji(r),forceVisible:!0}),getAttrs:n};return Or(e,i),{...i,updateOption:$i(i.options)}}function Vu(r){const{ITEM_NAME:e}=Xi(),t=xr();return Or(e,r),t}function Lu(r){const t={...{side:"bottom",align:"center",sameWidth:!0},...r},{options:{positioning:n}}=xr();lu(n)(t)}const Wu=r=>({ids:r&1}),xs=r=>({ids:r[0]});function qu(r){let e;const t=r[24].default,n=pe(t,r,r[23],xs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&8388609)&&me(n,t,i,i[23],e?be(t,i[23],s,Wu):ge(i[23]),xs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function ju(r,e,t){let n,i,s,{$$slots:o={},$$scope:a}=e,{required:l=void 0}=e,{disabled:c=void 0}=e,{preventScroll:u=void 0}=e,{loop:f=void 0}=e,{closeOnEscape:d=void 0}=e,{closeOnOutsideClick:h=void 0}=e,{portal:p=void 0}=e,{name:m=void 0}=e,{multiple:g=!1}=e,{selected:b=void 0}=e,{onSelectedChange:y=void 0}=e,{open:_=void 0}=e,{onOpenChange:C=void 0}=e,{items:k=[]}=e,{onOutsideClick:w=void 0}=e,{inputValue:P=""}=e,{touchedInput:O=!1}=e;const{states:{open:N,selected:E,inputValue:v,touchedInput:U},updateOption:se,ids:ce}=Fu({required:l,disabled:c,preventScroll:u,loop:f,closeOnEscape:d,closeOnOutsideClick:h,portal:p,name:m,onOutsideClick:w,multiple:g,forceVisible:!0,defaultSelected:Array.isArray(b)?[...b]:b,defaultOpen:_,onSelectedChange:({next:I})=>Array.isArray(I)?((!Array.isArray(b)||!zu(b,I))&&(y==null||y(I),t(4,b=I)),I):(b!==I&&(y==null||y(I),t(4,b=I)),t(6,P=(I==null?void 0:I.label)??(typeof(I==null?void 0:I.value)=="string"?I==null?void 0:I.value:"")),v.set(P),I),onOpenChange:({next:I})=>(_!==I&&(C==null||C(I),t(5,_=I)),I),items:k});ae(r,v,I=>t(21,n=I)),ae(r,U,I=>t(22,i=I));const Be=_t([ce.menu,ce.trigger,ce.label],([I,Qt,Ke])=>({menu:I,trigger:Qt,label:Ke}));return ae(r,Be,I=>t(0,s=I)),r.$$set=I=>{"required"in I&&t(8,l=I.required),"disabled"in I&&t(9,c=I.disabled),"preventScroll"in I&&t(10,u=I.preventScroll),"loop"in I&&t(11,f=I.loop),"closeOnEscape"in I&&t(12,d=I.closeOnEscape),"closeOnOutsideClick"in I&&t(13,h=I.closeOnOutsideClick),"portal"in I&&t(14,p=I.portal),"name"in I&&t(15,m=I.name),"multiple"in I&&t(16,g=I.multiple),"selected"in I&&t(4,b=I.selected),"onSelectedChange"in I&&t(17,y=I.onSelectedChange),"open"in I&&t(5,_=I.open),"onOpenChange"in I&&t(18,C=I.onOpenChange),"items"in I&&t(19,k=I.items),"onOutsideClick"in I&&t(20,w=I.onOutsideClick),"inputValue"in I&&t(6,P=I.inputValue),"touchedInput"in I&&t(7,O=I.touchedInput),"$$scope"in I&&t(23,a=I.$$scope)},r.$$.update=()=>{r.$$.dirty&4194304&&t(7,O=i),r.$$.dirty&6291456&&i&&t(6,P=n),r.$$.dirty&64&&P!==void 0&&v.set(P),r.$$.dirty&32&&_!==void 0&&N.set(_),r.$$.dirty&16&&b!==void 0&&E.set(Array.isArray(b)?[...b]:b),r.$$.dirty&256&&se("required",l),r.$$.dirty&512&&se("disabled",c),r.$$.dirty&1024&&se("preventScroll",u),r.$$.dirty&2048&&se("loop",f),r.$$.dirty&4096&&se("closeOnEscape",d),r.$$.dirty&8192&&se("closeOnOutsideClick",h),r.$$.dirty&16384&&se("portal",p),r.$$.dirty&32768&&se("name",m),r.$$.dirty&65536&&se("multiple",g),r.$$.dirty&1048576&&se("onOutsideClick",w)},[s,v,U,Be,b,_,P,O,l,c,u,f,d,h,p,m,g,y,C,k,w,n,i,a,o]}class Jl extends Le{constructor(e){super(),We(this,e,ju,qu,Pe,{required:8,disabled:9,preventScroll:10,loop:11,closeOnEscape:12,closeOnOutsideClick:13,portal:14,name:15,multiple:16,selected:4,onSelectedChange:17,open:5,onOpenChange:18,items:19,onOutsideClick:20,inputValue:6,touchedInput:7})}}const Ju=r=>({builder:r[0]&256}),Ds=r=>({builder:r[8]}),$u=r=>({builder:r[0]&256}),vs=r=>({builder:r[8]}),Ku=r=>({builder:r[0]&256}),Is=r=>({builder:r[8]}),Uu=r=>({builder:r[0]&256}),Ps=r=>({builder:r[8]}),Hu=r=>({builder:r[0]&256}),Rs=r=>({builder:r[8]}),Gu=r=>({builder:r[0]&256}),Bs=r=>({builder:r[8]});function Yu(r){let e,t,n,i;const s=r[26].default,o=pe(s,r,r[25],Ds);let a=[r[8],r[13]],l={};for(let c=0;c<a.length;c+=1)l=te(l,a[c]);return{c(){e=F("div"),o&&o.c(),ne(e,l)},m(c,u){A(c,e,u),o&&o.m(e,null),r[35](e),t=!0,n||(i=[qe(r[8].action(e)),Z(e,"m-pointerleave",r[12]),Z(e,"keydown",r[31])],n=!0)},p(c,u){o&&o.p&&(!t||u[0]&33554688)&&me(o,s,c,c[25],t?be(s,c[25],u,Ju):ge(c[25]),Ds),ne(e,l=Re(a,[u[0]&256&&c[8],u[0]&8192&&c[13]]))},i(c){t||(S(o,c),t=!0)},o(c){M(o,c),t=!1},d(c){c&&x(e),o&&o.d(c),r[35](null),n=!1,ct(i)}}}function Xu(r){let e,t,n,i,s;const o=r[26].default,a=pe(o,r,r[25],vs);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=te(c,l[u]);return{c(){e=F("div"),a&&a.c(),ne(e,c)},m(u,f){A(u,e,f),a&&a.m(e,null),r[34](e),n=!0,i||(s=[qe(r[8].action(e)),Z(e,"m-pointerleave",r[12]),Z(e,"keydown",r[30])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&me(a,o,r,r[25],n?be(o,r[25],f,$u):ge(r[25]),vs),ne(e,c=Re(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(S(a,u),t&&t.end(1),n=!0)},o(u){M(a,u),u&&(t=ql(e,r[5],r[6])),n=!1},d(u){u&&x(e),a&&a.d(u),r[34](null),u&&t&&t.end(),i=!1,ct(s)}}}function Zu(r){let e,t,n,i,s;const o=r[26].default,a=pe(o,r,r[25],Is);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=te(c,l[u]);return{c(){e=F("div"),a&&a.c(),ne(e,c)},m(u,f){A(u,e,f),a&&a.m(e,null),n=!0,i||(s=[qe(r[8].action(e)),Z(e,"m-pointerleave",r[12]),Z(e,"keydown",r[29])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&me(a,o,r,r[25],n?be(o,r[25],f,Ku):ge(r[25]),Is),ne(e,c=Re(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(S(a,u),u&&(t||Ki(()=>{t=jl(e,r[3],r[4]),t.start()})),n=!0)},o(u){M(a,u),n=!1},d(u){u&&x(e),a&&a.d(u),i=!1,ct(s)}}}function Qu(r){let e,t,n,i,s,o;const a=r[26].default,l=pe(a,r,r[25],Ps);let c=[r[8],r[13]],u={};for(let f=0;f<c.length;f+=1)u=te(u,c[f]);return{c(){e=F("div"),l&&l.c(),ne(e,u)},m(f,d){A(f,e,d),l&&l.m(e,null),r[33](e),i=!0,s||(o=[qe(r[8].action(e)),Z(e,"m-pointerleave",r[12]),Z(e,"keydown",r[28])],s=!0)},p(f,d){r=f,l&&l.p&&(!i||d[0]&33554688)&&me(l,a,r,r[25],i?be(a,r[25],d,Uu):ge(r[25]),Ps),ne(e,u=Re(c,[d[0]&256&&r[8],d[0]&8192&&r[13]]))},i(f){i||(S(l,f),f&&Ki(()=>{i&&(n&&n.end(1),t=jl(e,r[3],r[4]),t.start())}),i=!0)},o(f){M(l,f),t&&t.invalidate(),f&&(n=ql(e,r[5],r[6])),i=!1},d(f){f&&x(e),l&&l.d(f),r[33](null),f&&n&&n.end(),s=!1,ct(o)}}}function ef(r){let e,t,n,i,s;const o=r[26].default,a=pe(o,r,r[25],Rs);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=te(c,l[u]);return{c(){e=F("div"),a&&a.c(),ne(e,c)},m(u,f){A(u,e,f),a&&a.m(e,null),r[32](e),n=!0,i||(s=[qe(r[8].action(e)),Z(e,"m-pointerleave",r[12]),Z(e,"keydown",r[27])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&me(a,o,r,r[25],n?be(o,r[25],f,Hu):ge(r[25]),Rs),ne(e,c=Re(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(S(a,u),u&&Ki(()=>{n&&(t||(t=Ms(e,r[1],r[2],!0)),t.run(1))}),n=!0)},o(u){M(a,u),u&&(t||(t=Ms(e,r[1],r[2],!1)),t.run(0)),n=!1},d(u){u&&x(e),a&&a.d(u),r[32](null),u&&t&&t.end(),i=!1,ct(s)}}}function tf(r){let e;const t=r[26].default,n=pe(t,r,r[25],Bs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s[0]&33554688)&&me(n,t,i,i[25],e?be(t,i[25],s,Gu):ge(i[25]),Bs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function nf(r){let e,t,n,i;const s=[tf,ef,Qu,Zu,Xu,Yu],o=[];function a(l,c){return l[7]&&l[9]?0:l[1]&&l[9]?1:l[3]&&l[5]&&l[9]?2:l[3]&&l[9]?3:l[5]&&l[9]?4:l[9]?5:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=ue()},m(l,c){~e&&o[e].m(l,c),A(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(Q(),M(o[u],1,1,()=>{o[u]=null}),ee()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),~e&&o[e].d(l)}}}function rf(r,e,t){let n;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","id","side","align","sideOffset","alignOffset","collisionPadding","avoidCollisions","collisionBoundary","sameWidth","fitViewport","el"];let s=Ae(e,i),o,a,{$$slots:l={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{side:y="bottom"}=e,{align:_="center"}=e,{sideOffset:C=0}=e,{alignOffset:k=0}=e,{collisionPadding:w=8}=e,{avoidCollisions:P=!0}=e,{collisionBoundary:O=void 0}=e,{sameWidth:N=!0}=e,{fitViewport:E=!1}=e,{el:v=void 0}=e;const{elements:{menu:U},states:{open:se},ids:ce,getAttrs:Be}=xr();ae(r,U,z=>t(24,a=z)),ae(r,se,z=>t(9,o=z));const I=Nr(),Qt=Be("content");function Ke(z){pt.call(this,r,z)}function Kn(z){pt.call(this,r,z)}function Un(z){pt.call(this,r,z)}function Jr(z){pt.call(this,r,z)}function $r(z){pt.call(this,r,z)}function Kr(z){Fe[z?"unshift":"push"](()=>{v=z,t(0,v)})}function Ur(z){Fe[z?"unshift":"push"](()=>{v=z,t(0,v)})}function Hr(z){Fe[z?"unshift":"push"](()=>{v=z,t(0,v)})}function Gr(z){Fe[z?"unshift":"push"](()=>{v=z,t(0,v)})}return r.$$set=z=>{e=te(te({},e),xt(z)),t(13,s=Ae(e,i)),"transition"in z&&t(1,u=z.transition),"transitionConfig"in z&&t(2,f=z.transitionConfig),"inTransition"in z&&t(3,d=z.inTransition),"inTransitionConfig"in z&&t(4,h=z.inTransitionConfig),"outTransition"in z&&t(5,p=z.outTransition),"outTransitionConfig"in z&&t(6,m=z.outTransitionConfig),"asChild"in z&&t(7,g=z.asChild),"id"in z&&t(14,b=z.id),"side"in z&&t(15,y=z.side),"align"in z&&t(16,_=z.align),"sideOffset"in z&&t(17,C=z.sideOffset),"alignOffset"in z&&t(18,k=z.alignOffset),"collisionPadding"in z&&t(19,w=z.collisionPadding),"avoidCollisions"in z&&t(20,P=z.avoidCollisions),"collisionBoundary"in z&&t(21,O=z.collisionBoundary),"sameWidth"in z&&t(22,N=z.sameWidth),"fitViewport"in z&&t(23,E=z.fitViewport),"el"in z&&t(0,v=z.el),"$$scope"in z&&t(25,c=z.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&16384&&b&&ce.menu.set(b),r.$$.dirty[0]&16777216&&t(8,n=a),r.$$.dirty[0]&256&&Object.assign(n,Qt),r.$$.dirty[0]&16744960&&o&&Lu({side:y,align:_,sideOffset:C,alignOffset:k,collisionPadding:w,avoidCollisions:P,collisionBoundary:O,sameWidth:N,fitViewport:E})},[v,u,f,d,h,p,m,g,n,o,U,se,I,s,b,y,_,C,k,w,P,O,N,E,a,c,l,Ke,Kn,Un,Jr,$r,Kr,Ur,Hr,Gr]}class $l extends Le{constructor(e){super(),We(this,e,rf,nf,Pe,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,id:14,side:15,align:16,sideOffset:17,alignOffset:18,collisionPadding:19,avoidCollisions:20,collisionBoundary:21,sameWidth:22,fitViewport:23,el:0},null,[-1,-1])}}const sf=r=>({builder:r&8,placeholder:r&4}),zs=r=>({builder:r[3],placeholder:r[2]});function of(r){let e,t,n,i=[r[3],r[6],{placeholder:r[2]}],s={};for(let o=0;o<i.length;o+=1)s=te(s,i[o]);return{c(){e=F("input"),ne(e,s)},m(o,a){A(o,e,a),e.autofocus&&e.focus(),r[11](e),t||(n=[qe(r[3].action(e)),Z(e,"m-click",r[5]),Z(e,"m-keydown",r[5]),Z(e,"m-input",r[5])],t=!0)},p(o,a){ne(e,s=Re(i,[a&8&&o[3],a&64&&o[6],a&4&&{placeholder:o[2]}]))},i:ie,o:ie,d(o){o&&x(e),r[11](null),t=!1,ct(n)}}}function lf(r){let e;const t=r[10].default,n=pe(t,r,r[9],zs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&524)&&me(n,t,i,i[9],e?be(t,i[9],s,sf):ge(i[9]),zs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function af(r){let e,t,n,i;const s=[lf,of],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function cf(r,e,t){let n;const i=["asChild","placeholder","el","id"];let s=Ae(e,i),o,{$$slots:a={},$$scope:l}=e,{asChild:c=!1}=e,{placeholder:u=void 0}=e,{el:f=void 0}=e,{id:d=void 0}=e;const{elements:{input:h},ids:p,getAttrs:m}=xr();ae(r,h,_=>t(8,o=_));const g=Nr(),b=m("input");function y(_){Fe[_?"unshift":"push"](()=>{f=_,t(0,f)})}return r.$$set=_=>{e=te(te({},e),xt(_)),t(6,s=Ae(e,i)),"asChild"in _&&t(1,c=_.asChild),"placeholder"in _&&t(2,u=_.placeholder),"el"in _&&t(0,f=_.el),"id"in _&&t(7,d=_.id),"$$scope"in _&&t(9,l=_.$$scope)},r.$$.update=()=>{r.$$.dirty&128&&d&&p.trigger.set(d),r.$$.dirty&256&&t(3,n=o),r.$$.dirty&8&&Object.assign(n,b)},[f,c,u,n,h,g,s,d,o,l,a,y]}class Kl extends Le{constructor(e){super(),We(this,e,cf,af,Pe,{asChild:1,placeholder:2,el:0,id:7})}}const uf=r=>({builder:r&16,isSelected:r&32}),Fs=r=>({builder:r[4],isSelected:r[5]}),ff=r=>({builder:r&16,isSelected:r&32}),Vs=r=>({builder:r[4],isSelected:r[5]});function df(r){let e,t,n,i;const s=r[14].default,o=pe(s,r,r[13],Fs),a=o||pf(r);let l=[r[4],r[9]],c={};for(let u=0;u<l.length;u+=1)c=te(c,l[u]);return{c(){e=F("div"),a.c(),ne(e,c)},m(u,f){A(u,e,f),a.m(e,null),r[19](e),t=!0,n||(i=[qe(r[4].action(e)),Z(e,"m-click",r[8]),Z(e,"m-pointermove",r[8]),Z(e,"focusin",r[15]),Z(e,"keydown",r[16]),Z(e,"focusout",r[17]),Z(e,"pointerleave",r[18])],n=!0)},p(u,f){o?o.p&&(!t||f&8240)&&me(o,s,u,u[13],t?be(s,u[13],f,uf):ge(u[13]),Fs):a.p&&(!t||f&5)&&a.p(u,t?f:-1),ne(e,c=Re(l,[f&16&&u[4],f&512&&u[9]]))},i(u){t||(S(a,u),t=!0)},o(u){M(a,u),t=!1},d(u){u&&x(e),a.d(u),r[19](null),n=!1,ct(i)}}}function hf(r){let e;const t=r[14].default,n=pe(t,r,r[13],Vs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&8240)&&me(n,t,i,i[13],e?be(t,i[13],s,ff):ge(i[13]),Vs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function pf(r){let e=(r[0]||r[2])+"",t;return{c(){t=he(e)},m(n,i){A(n,t,i)},p(n,i){i&5&&e!==(e=(n[0]||n[2])+"")&&je(t,e)},d(n){n&&x(t)}}}function mf(r){let e,t,n,i;const s=[hf,df],o=[];function a(l,c){return l[3]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function gf(r,e,t){let n,i;const s=["value","disabled","label","asChild","el"];let o=Ae(e,s),a,l,{$$slots:c={},$$scope:u}=e,{value:f}=e,{disabled:d=void 0}=e,{label:h=void 0}=e,{asChild:p=!1}=e,{el:m=void 0}=e;const{elements:{option:g},helpers:{isSelected:b},getAttrs:y}=Vu(f);ae(r,g,E=>t(12,l=E)),ae(r,b,E=>t(11,a=E));const _=Nr(),C=y("item");function k(E){pt.call(this,r,E)}function w(E){pt.call(this,r,E)}function P(E){pt.call(this,r,E)}function O(E){pt.call(this,r,E)}function N(E){Fe[E?"unshift":"push"](()=>{m=E,t(1,m)})}return r.$$set=E=>{e=te(te({},e),xt(E)),t(9,o=Ae(e,s)),"value"in E&&t(2,f=E.value),"disabled"in E&&t(10,d=E.disabled),"label"in E&&t(0,h=E.label),"asChild"in E&&t(3,p=E.asChild),"el"in E&&t(1,m=E.el),"$$scope"in E&&t(13,u=E.$$scope)},r.$$.update=()=>{r.$$.dirty&5&&!h&&typeof f=="string"&&t(0,h=f),r.$$.dirty&5125&&t(4,n=l({value:f,disabled:d,label:h})),r.$$.dirty&16&&Object.assign(n,C),r.$$.dirty&2052&&t(5,i=a(f))},[h,m,f,p,n,i,g,b,_,o,d,a,l,u,c,k,w,P,O,N]}class Ul extends Le{constructor(e){super(),We(this,e,gf,mf,Pe,{value:2,disabled:10,label:0,asChild:3,el:1})}}function bf(){return{NAME:"separator",PARTS:["root"]}}function yf(r){const{NAME:e,PARTS:t}=bf(),n=ji(e,t),i={...au(Ji(r)),getAttrs:n};return{...i,updateOption:$i(i.options)}}const kf=r=>({builder:r&4}),Ls=r=>({builder:r[2]});function _f(r){let e,t,n,i=[r[2],r[4]],s={};for(let o=0;o<i.length;o+=1)s=te(s,i[o]);return{c(){e=F("div"),ne(e,s)},m(o,a){A(o,e,a),r[10](e),t||(n=qe(r[2].action(e)),t=!0)},p(o,a){ne(e,s=Re(i,[a&4&&o[2],a&16&&o[4]]))},i:ie,o:ie,d(o){o&&x(e),r[10](null),t=!1,n()}}}function Sf(r){let e;const t=r[9].default,n=pe(t,r,r[8],Ls);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&260)&&me(n,t,i,i[8],e?be(t,i[8],s,kf):ge(i[8]),Ls)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function Cf(r){let e,t,n,i;const s=[Sf,_f],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function Mf(r,e,t){let n;const i=["orientation","decorative","asChild","el"];let s=Ae(e,i),o,{$$slots:a={},$$scope:l}=e,{orientation:c="horizontal"}=e,{decorative:u=!0}=e,{asChild:f=!1}=e,{el:d=void 0}=e;const{elements:{root:h},updateOption:p,getAttrs:m}=yf({orientation:c,decorative:u});ae(r,h,y=>t(7,o=y));const g=m("root");function b(y){Fe[y?"unshift":"push"](()=>{d=y,t(0,d)})}return r.$$set=y=>{e=te(te({},e),xt(y)),t(4,s=Ae(e,i)),"orientation"in y&&t(5,c=y.orientation),"decorative"in y&&t(6,u=y.decorative),"asChild"in y&&t(1,f=y.asChild),"el"in y&&t(0,d=y.el),"$$scope"in y&&t(8,l=y.$$scope)},r.$$.update=()=>{r.$$.dirty&32&&p("orientation",c),r.$$.dirty&64&&p("decorative",u),r.$$.dirty&128&&t(2,n=o),r.$$.dirty&4&&Object.assign(n,g)},[d,f,n,h,s,c,u,o,l,a,b]}class Hl extends Le{constructor(e){super(),We(this,e,Mf,Cf,Pe,{orientation:5,decorative:6,asChild:1,el:0})}}function Gl(){return{NAME:"tabs",PARTS:["root","content","list","trigger"]}}function wf(r){const{NAME:e,PARTS:t}=Gl(),n=ji(e,t),i={...Bu(Ji(r)),getAttrs:n};return Or(e,i),{...i,updateOption:$i(i.options)}}function Zi(){const{NAME:r}=Gl();return kn(r)}const Tf=r=>({builder:r&4,value:r&8}),Ws=r=>({builder:r[2],value:r[3]}),Ef=r=>({builder:r&4,value:r&8}),qs=r=>({builder:r[2],value:r[3]});function Of(r){let e,t,n,i;const s=r[15].default,o=pe(s,r,r[14],Ws);let a=[r[2],r[6]],l={};for(let c=0;c<a.length;c+=1)l=te(l,a[c]);return{c(){e=F("div"),o&&o.c(),ne(e,l)},m(c,u){A(c,e,u),o&&o.m(e,null),r[16](e),t=!0,n||(i=qe(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&16396)&&me(o,s,c,c[14],t?be(s,c[14],u,Tf):ge(c[14]),Ws),ne(e,l=Re(a,[u&4&&c[2],u&64&&c[6]]))},i(c){t||(S(o,c),t=!0)},o(c){M(o,c),t=!1},d(c){c&&x(e),o&&o.d(c),r[16](null),n=!1,i()}}}function Nf(r){let e;const t=r[15].default,n=pe(t,r,r[14],qs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16396)&&me(n,t,i,i[14],e?be(t,i[14],s,Ef):ge(i[14]),qs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function Af(r){let e,t,n,i;const s=[Nf,Of],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function xf(r,e,t){let n;const i=["orientation","activateOnFocus","loop","autoSet","value","onValueChange","asChild","el"];let s=Ae(e,i),o,a,{$$slots:l={},$$scope:c}=e,{orientation:u=void 0}=e,{activateOnFocus:f=void 0}=e,{loop:d=void 0}=e,{autoSet:h=void 0}=e,{value:p=void 0}=e,{onValueChange:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{root:y},states:{value:_},updateOption:C,getAttrs:k}=wf({orientation:u,activateOnFocus:f,loop:d,autoSet:h,defaultValue:p,onValueChange:({next:O})=>(p!==O&&(m==null||m(O),t(7,p=O)),O)});ae(r,y,O=>t(13,o=O)),ae(r,_,O=>t(3,a=O));const w=k("root");function P(O){Fe[O?"unshift":"push"](()=>{b=O,t(0,b)})}return r.$$set=O=>{e=te(te({},e),xt(O)),t(6,s=Ae(e,i)),"orientation"in O&&t(8,u=O.orientation),"activateOnFocus"in O&&t(9,f=O.activateOnFocus),"loop"in O&&t(10,d=O.loop),"autoSet"in O&&t(11,h=O.autoSet),"value"in O&&t(7,p=O.value),"onValueChange"in O&&t(12,m=O.onValueChange),"asChild"in O&&t(1,g=O.asChild),"el"in O&&t(0,b=O.el),"$$scope"in O&&t(14,c=O.$$scope)},r.$$.update=()=>{r.$$.dirty&128&&p!==void 0&&_.set(p),r.$$.dirty&256&&C("orientation",u),r.$$.dirty&512&&C("activateOnFocus",f),r.$$.dirty&1024&&C("loop",d),r.$$.dirty&2048&&C("autoSet",h),r.$$.dirty&8192&&t(2,n=o),r.$$.dirty&4&&Object.assign(n,w)},[b,g,n,a,y,_,s,p,u,f,d,h,m,o,c,l,P]}class Df extends Le{constructor(e){super(),We(this,e,xf,Af,Pe,{orientation:8,activateOnFocus:9,loop:10,autoSet:11,value:7,onValueChange:12,asChild:1,el:0})}}const vf=r=>({builder:r&4}),js=r=>({builder:r[2]}),If=r=>({builder:r&4}),Js=r=>({builder:r[2]});function Pf(r){let e,t,n,i;const s=r[8].default,o=pe(s,r,r[7],js);let a=[r[2],r[4]],l={};for(let c=0;c<a.length;c+=1)l=te(l,a[c]);return{c(){e=F("div"),o&&o.c(),ne(e,l)},m(c,u){A(c,e,u),o&&o.m(e,null),r[9](e),t=!0,n||(i=qe(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&132)&&me(o,s,c,c[7],t?be(s,c[7],u,vf):ge(c[7]),js),ne(e,l=Re(a,[u&4&&c[2],u&16&&c[4]]))},i(c){t||(S(o,c),t=!0)},o(c){M(o,c),t=!1},d(c){c&&x(e),o&&o.d(c),r[9](null),n=!1,i()}}}function Rf(r){let e;const t=r[8].default,n=pe(t,r,r[7],Js);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&132)&&me(n,t,i,i[7],e?be(t,i[7],s,If):ge(i[7]),Js)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function Bf(r){let e,t,n,i;const s=[Rf,Pf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function zf(r,e,t){let n;const i=["value","asChild","el"];let s=Ae(e,i),o,{$$slots:a={},$$scope:l}=e,{value:c}=e,{asChild:u=!1}=e,{el:f=void 0}=e;const{elements:{content:d},getAttrs:h}=Zi();ae(r,d,g=>t(6,o=g));const p=h("content");function m(g){Fe[g?"unshift":"push"](()=>{f=g,t(0,f)})}return r.$$set=g=>{e=te(te({},e),xt(g)),t(4,s=Ae(e,i)),"value"in g&&t(5,c=g.value),"asChild"in g&&t(1,u=g.asChild),"el"in g&&t(0,f=g.el),"$$scope"in g&&t(7,l=g.$$scope)},r.$$.update=()=>{r.$$.dirty&96&&t(2,n=o(c)),r.$$.dirty&4&&Object.assign(n,p)},[f,u,n,d,s,c,o,l,a,m]}class Ff extends Le{constructor(e){super(),We(this,e,zf,Bf,Pe,{value:5,asChild:1,el:0})}}const Vf=r=>({builder:r&4}),$s=r=>({builder:r[2]}),Lf=r=>({builder:r&4}),Ks=r=>({builder:r[2]});function Wf(r){let e,t,n,i;const s=r[7].default,o=pe(s,r,r[6],$s);let a=[r[2],r[4]],l={};for(let c=0;c<a.length;c+=1)l=te(l,a[c]);return{c(){e=F("div"),o&&o.c(),ne(e,l)},m(c,u){A(c,e,u),o&&o.m(e,null),r[8](e),t=!0,n||(i=qe(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&68)&&me(o,s,c,c[6],t?be(s,c[6],u,Vf):ge(c[6]),$s),ne(e,l=Re(a,[u&4&&c[2],u&16&&c[4]]))},i(c){t||(S(o,c),t=!0)},o(c){M(o,c),t=!1},d(c){c&&x(e),o&&o.d(c),r[8](null),n=!1,i()}}}function qf(r){let e;const t=r[7].default,n=pe(t,r,r[6],Ks);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&68)&&me(n,t,i,i[6],e?be(t,i[6],s,Lf):ge(i[6]),Ks)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function jf(r){let e,t,n,i;const s=[qf,Wf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function Jf(r,e,t){let n;const i=["asChild","el"];let s=Ae(e,i),o,{$$slots:a={},$$scope:l}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{list:f},getAttrs:d}=Zi();ae(r,f,m=>t(5,o=m));const h=d("list");function p(m){Fe[m?"unshift":"push"](()=>{u=m,t(0,u)})}return r.$$set=m=>{e=te(te({},e),xt(m)),t(4,s=Ae(e,i)),"asChild"in m&&t(1,c=m.asChild),"el"in m&&t(0,u=m.el),"$$scope"in m&&t(6,l=m.$$scope)},r.$$.update=()=>{r.$$.dirty&32&&t(2,n=o),r.$$.dirty&4&&Object.assign(n,h)},[u,c,n,f,s,o,l,a,p]}class $f extends Le{constructor(e){super(),We(this,e,Jf,jf,Pe,{asChild:1,el:0})}}const Kf=r=>({builder:r&4}),Us=r=>({builder:r[2]}),Uf=r=>({builder:r&4}),Hs=r=>({builder:r[2]});function Hf(r){let e,t,n,i;const s=r[10].default,o=pe(s,r,r[9],Us);let a=[r[2],{type:"button"},r[5]],l={};for(let c=0;c<a.length;c+=1)l=te(l,a[c]);return{c(){e=F("button"),o&&o.c(),ne(e,l)},m(c,u){A(c,e,u),o&&o.m(e,null),e.autofocus&&e.focus(),r[11](e),t=!0,n||(i=[qe(r[2].action(e)),Z(e,"m-click",r[4]),Z(e,"m-focus",r[4]),Z(e,"m-keydown",r[4])],n=!0)},p(c,u){o&&o.p&&(!t||u&516)&&me(o,s,c,c[9],t?be(s,c[9],u,Kf):ge(c[9]),Us),ne(e,l=Re(a,[u&4&&c[2],{type:"button"},u&32&&c[5]]))},i(c){t||(S(o,c),t=!0)},o(c){M(o,c),t=!1},d(c){c&&x(e),o&&o.d(c),r[11](null),n=!1,ct(i)}}}function Gf(r){let e;const t=r[10].default,n=pe(t,r,r[9],Hs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&516)&&me(n,t,i,i[9],e?be(t,i[9],s,Uf):ge(i[9]),Hs)},i(i){e||(S(n,i),e=!0)},o(i){M(n,i),e=!1},d(i){n&&n.d(i)}}}function Yf(r){let e,t,n,i;const s=[Gf,Hf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=ue()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function Xf(r,e,t){let n;const i=["value","disabled","asChild","el"];let s=Ae(e,i),o,{$$slots:a={},$$scope:l}=e,{value:c}=e,{disabled:u=void 0}=e,{asChild:f=!1}=e,{el:d=void 0}=e;const{elements:{trigger:h},getAttrs:p}=Zi();ae(r,h,y=>t(8,o=y));const m=Nr(),g=p("trigger");function b(y){Fe[y?"unshift":"push"](()=>{d=y,t(0,d)})}return r.$$set=y=>{e=te(te({},e),xt(y)),t(5,s=Ae(e,i)),"value"in y&&t(6,c=y.value),"disabled"in y&&t(7,u=y.disabled),"asChild"in y&&t(1,f=y.asChild),"el"in y&&t(0,d=y.el),"$$scope"in y&&t(9,l=y.$$scope)},r.$$.update=()=>{r.$$.dirty&448&&t(2,n=o({value:c,disabled:u})),r.$$.dirty&4&&Object.assign(n,g)},[d,f,n,h,m,s,c,u,o,l,a,b]}class Zf extends Le{constructor(e){super(),We(this,e,Xf,Yf,Pe,{value:6,disabled:7,asChild:1,el:0})}}/*!
|
|
2
|
-
* deep-eql
|
|
3
|
-
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/function Gs(r){if(typeof r>"u")return"undefined";if(r===null)return"null";const e=r[Symbol.toStringTag];return typeof e=="string"?e:Object.prototype.toString.call(r).slice(8,-1)}function Yl(){this._key="chai/deep-eql__"+Math.random()+Date.now()}Yl.prototype={get:function(e){return e[this._key]},set:function(e,t){Object.isExtensible(e)&&Object.defineProperty(e,this._key,{value:t,configurable:!0})}};var Xl=typeof WeakMap=="function"?WeakMap:Yl;/*!
|
|
6
|
-
* Check to see if the MemoizeMap has recorded a result of the two operands
|
|
7
|
-
*
|
|
8
|
-
* @param {Mixed} leftHandOperand
|
|
9
|
-
* @param {Mixed} rightHandOperand
|
|
10
|
-
* @param {MemoizeMap} memoizeMap
|
|
11
|
-
* @returns {Boolean|null} result
|
|
12
|
-
*/function Ys(r,e,t){if(!t||hn(r)||hn(e))return null;var n=t.get(r);if(n){var i=n.get(e);if(typeof i=="boolean")return i}return null}/*!
|
|
13
|
-
* Set the result of the equality into the MemoizeMap
|
|
14
|
-
*
|
|
15
|
-
* @param {Mixed} leftHandOperand
|
|
16
|
-
* @param {Mixed} rightHandOperand
|
|
17
|
-
* @param {MemoizeMap} memoizeMap
|
|
18
|
-
* @param {Boolean} result
|
|
19
|
-
*/function Zn(r,e,t,n){if(!(!t||hn(r)||hn(e))){var i=t.get(r);i?i.set(e,n):(i=new Xl,i.set(e,n),t.set(r,i))}}function Dr(r,e,t){if(t&&t.comparator)return Xs(r,e,t);var n=Zl(r,e);return n!==null?n:Xs(r,e,t)}function Zl(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e?!0:hn(r)||hn(e)?!1:null}/*!
|
|
20
|
-
* The main logic of the `deepEqual` function.
|
|
21
|
-
*
|
|
22
|
-
* @param {Mixed} leftHandOperand
|
|
23
|
-
* @param {Mixed} rightHandOperand
|
|
24
|
-
* @param {Object} [options] (optional) Additional options
|
|
25
|
-
* @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
|
|
26
|
-
* @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
|
|
27
|
-
complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
|
|
28
|
-
references to blow the stack.
|
|
29
|
-
* @return {Boolean} equal match
|
|
30
|
-
*/function Xs(r,e,t){t=t||{},t.memoize=t.memoize===!1?!1:t.memoize||new Xl;var n=t&&t.comparator,i=Ys(r,e,t.memoize);if(i!==null)return i;var s=Ys(e,r,t.memoize);if(s!==null)return s;if(n){var o=n(r,e);if(o===!1||o===!0)return Zn(r,e,t.memoize,o),o;var a=Zl(r,e);if(a!==null)return a}var l=Gs(r);if(l!==Gs(e))return Zn(r,e,t.memoize,!1),!1;Zn(r,e,t.memoize,!0);var c=Qf(r,e,l,t);return Zn(r,e,t.memoize,c),c}function Qf(r,e,t,n){switch(t){case"String":case"Number":case"Boolean":case"Date":return Dr(r.valueOf(),e.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return r===e;case"Error":return Ql(r,e,["name","message","code"],n);case"Arguments":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"Array":return Wt(r,e,n);case"RegExp":return ed(r,e);case"Generator":return td(r,e,n);case"DataView":return Wt(new Uint8Array(r.buffer),new Uint8Array(e.buffer),n);case"ArrayBuffer":return Wt(new Uint8Array(r),new Uint8Array(e),n);case"Set":return Zs(r,e,n);case"Map":return Zs(r,e,n);case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.Instant":case"Temporal.ZonedDateTime":case"Temporal.PlainYearMonth":case"Temporal.PlainMonthDay":return r.equals(e);case"Temporal.Duration":return r.total("nanoseconds")===e.total("nanoseconds");case"Temporal.TimeZone":case"Temporal.Calendar":return r.toString()===e.toString();default:return rd(r,e,n)}}/*!
|
|
31
|
-
* Compare two Regular Expressions for equality.
|
|
32
|
-
*
|
|
33
|
-
* @param {RegExp} leftHandOperand
|
|
34
|
-
* @param {RegExp} rightHandOperand
|
|
35
|
-
* @return {Boolean} result
|
|
36
|
-
*/function ed(r,e){return r.toString()===e.toString()}/*!
|
|
37
|
-
* Compare two Sets/Maps for equality. Faster than other equality functions.
|
|
38
|
-
*
|
|
39
|
-
* @param {Set} leftHandOperand
|
|
40
|
-
* @param {Set} rightHandOperand
|
|
41
|
-
* @param {Object} [options] (Optional)
|
|
42
|
-
* @return {Boolean} result
|
|
43
|
-
*/function Zs(r,e,t){try{if(r.size!==e.size)return!1;if(r.size===0)return!0}catch{return!1}var n=[],i=[];return r.forEach(function(o,a){n.push([o,a])}),e.forEach(function(o,a){i.push([o,a])}),Wt(n.sort(),i.sort(),t)}/*!
|
|
44
|
-
* Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
|
|
45
|
-
*
|
|
46
|
-
* @param {Iterable} leftHandOperand
|
|
47
|
-
* @param {Iterable} rightHandOperand
|
|
48
|
-
* @param {Object} [options] (Optional)
|
|
49
|
-
* @return {Boolean} result
|
|
50
|
-
*/function Wt(r,e,t){var n=r.length;if(n!==e.length)return!1;if(n===0)return!0;for(var i=-1;++i<n;)if(Dr(r[i],e[i],t)===!1)return!1;return!0}/*!
|
|
51
|
-
* Simple equality for generator objects such as those returned by generator functions.
|
|
52
|
-
*
|
|
53
|
-
* @param {Iterable} leftHandOperand
|
|
54
|
-
* @param {Iterable} rightHandOperand
|
|
55
|
-
* @param {Object} [options] (Optional)
|
|
56
|
-
* @return {Boolean} result
|
|
57
|
-
*/function td(r,e,t){return Wt(Ci(r),Ci(e),t)}/*!
|
|
58
|
-
* Determine if the given object has an @@iterator function.
|
|
59
|
-
*
|
|
60
|
-
* @param {Object} target
|
|
61
|
-
* @return {Boolean} `true` if the object has an @@iterator function.
|
|
62
|
-
*/function nd(r){return typeof Symbol<"u"&&typeof r=="object"&&typeof Symbol.iterator<"u"&&typeof r[Symbol.iterator]=="function"}/*!
|
|
63
|
-
* Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
|
|
64
|
-
* This will consume the iterator - which could have side effects depending on the @@iterator implementation.
|
|
65
|
-
*
|
|
66
|
-
* @param {Object} target
|
|
67
|
-
* @returns {Array} an array of entries from the @@iterator function
|
|
68
|
-
*/function Qs(r){if(nd(r))try{return Ci(r[Symbol.iterator]())}catch{return[]}return[]}/*!
|
|
69
|
-
* Gets all entries from a Generator. This will consume the generator - which could have side effects.
|
|
70
|
-
*
|
|
71
|
-
* @param {Generator} target
|
|
72
|
-
* @returns {Array} an array of entries from the Generator.
|
|
73
|
-
*/function Ci(r){for(var e=r.next(),t=[e.value];e.done===!1;)e=r.next(),t.push(e.value);return t}/*!
|
|
74
|
-
* Gets all own and inherited enumerable keys from a target.
|
|
75
|
-
*
|
|
76
|
-
* @param {Object} target
|
|
77
|
-
* @returns {Array} an array of own and inherited enumerable keys from the target.
|
|
78
|
-
*/function eo(r){var e=[];for(var t in r)e.push(t);return e}function to(r){for(var e=[],t=Object.getOwnPropertySymbols(r),n=0;n<t.length;n+=1){var i=t[n];Object.getOwnPropertyDescriptor(r,i).enumerable&&e.push(i)}return e}/*!
|
|
79
|
-
* Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
|
|
80
|
-
* each key. If any value of the given key is not equal, the function will return false (early).
|
|
81
|
-
*
|
|
82
|
-
* @param {Mixed} leftHandOperand
|
|
83
|
-
* @param {Mixed} rightHandOperand
|
|
84
|
-
* @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
|
|
85
|
-
* @param {Object} [options] (Optional)
|
|
86
|
-
* @return {Boolean} result
|
|
87
|
-
*/function Ql(r,e,t,n){var i=t.length;if(i===0)return!0;for(var s=0;s<i;s+=1)if(Dr(r[t[s]],e[t[s]],n)===!1)return!1;return!0}/*!
|
|
88
|
-
* Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
|
|
89
|
-
* for each enumerable key in the object.
|
|
90
|
-
*
|
|
91
|
-
* @param {Mixed} leftHandOperand
|
|
92
|
-
* @param {Mixed} rightHandOperand
|
|
93
|
-
* @param {Object} [options] (Optional)
|
|
94
|
-
* @return {Boolean} result
|
|
95
|
-
*/function rd(r,e,t){var n=eo(r),i=eo(e),s=to(r),o=to(e);if(n=n.concat(s),i=i.concat(o),n.length&&n.length===i.length)return Wt(no(n).sort(),no(i).sort())===!1?!1:Ql(r,e,n,t);var a=Qs(r),l=Qs(e);return a.length&&a.length===l.length?(a.sort(),l.sort(),Wt(a,l,t)):n.length===0&&a.length===0&&i.length===0&&l.length===0}/*!
|
|
96
|
-
* Returns true if the argument is a primitive.
|
|
97
|
-
*
|
|
98
|
-
* This intentionally returns true for all objects that can be compared by reference,
|
|
99
|
-
* including functions and symbols.
|
|
100
|
-
*
|
|
101
|
-
* @param {Mixed} value
|
|
102
|
-
* @return {Boolean} result
|
|
103
|
-
*/function hn(r){return r===null||typeof r!="object"}function no(r){return r.map(function(t){return typeof t=="symbol"?t.toString():t})}function ro(r,e,t){var l;const n=r.slice();n[9]=e[t].type,n[10]=e[t].content,n[16]=t;const i=`${n[1]}-${n[16]}`;n[11]=i;const s=!!((l=n[10])!=null&&l.length);n[12]=s;const o=n[2]({id:n[11]});n[13]=o;const a=n[3]({id:n[11],hasChildren:n[12]});return n[14]=a,n}function id(r){let e,t;return e=new Ee({}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function sd(r){let e,t;return e=new Ee({props:{path:cu}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function od(r){let e,t;return e=new Ee({props:{path:Ar}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function io(r){let e,t,n,i,s;t=new ea({props:{treeItems:r[10],parent:r[11]}});let o=[r[13]],a={};for(let l=0;l<o.length;l+=1)a=te(a,o[l]);return{c(){e=F("ol"),L(t.$$.fragment),ne(e,a)},m(l,c){A(l,e,c),W(t,e,null),n=!0,i||(s=qe(r[13].action(e)),i=!0)},p(l,c){const u={};c&1&&(u.treeItems=l[10]),c&2&&(u.parent=l[11]),t.$set(u),ne(e,a=Re(o,[c&6&&l[13]]))},i(l){n||(S(t.$$.fragment,l),n=!0)},o(l){M(t.$$.fragment,l),n=!1},d(l){l&&x(e),q(t),i=!1,s()}}}function so(r){let e,t,n,i,s,o,a,l=r[9]+"",c,u,f,d,h,p;const m=[od,sd,id],g=[];function b(k,w){return w&19&&(n=null),n==null&&(n=!!(k[12]&&k[4](k[11]))),n?0:k[12]?1:2}i=b(r,-1),s=g[i]=m[i](r);let y=[{class:"flex items-center gap-1 p-1"},r[14]],_={};for(let k=0;k<y.length;k+=1)_=te(_,y[k]);let C=r[10]&&io(r);return{c(){e=F("li"),t=F("button"),s.c(),o=$(),a=F("span"),c=he(l),u=$(),C&&C.c(),f=$(),j(a,"class","select-none"),ne(t,_),j(e,"role","none")},m(k,w){A(k,e,w),B(e,t),g[i].m(t,null),B(t,o),B(t,a),B(a,c),t.autofocus&&t.focus(),B(e,u),C&&C.m(e,null),B(e,f),d=!0,h||(p=qe(r[14].action(t)),h=!0)},p(k,w){let P=i;i=b(k,w),i!==P&&(Q(),M(g[P],1,1,()=>{g[P]=null}),ee(),s=g[i],s||(s=g[i]=m[i](k),s.c()),S(s,1),s.m(t,o)),(!d||w&1)&&l!==(l=k[9]+"")&&je(c,l),ne(t,_=Re(y,[{class:"flex items-center gap-1 p-1"},w&11&&k[14]])),k[10]?C?(C.p(k,w),w&1&&S(C,1)):(C=io(k),C.c(),S(C,1),C.m(e,f)):C&&(Q(),M(C,1,1,()=>{C=null}),ee())},i(k){d||(S(s),S(C),d=!0)},o(k){M(s),M(C),d=!1},d(k){k&&x(e),g[i].d(),C&&C.d(),h=!1,p()}}}function ld(r){let e,t,n=de(r[0]),i=[];for(let o=0;o<n.length;o+=1)i[o]=so(ro(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,[a]){if(a&31){n=de(o[0]);let l;for(l=0;l<n.length;l+=1){const c=ro(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=so(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function ad(r,e,t){let n,i,s,{treeItems:o}=e,{parent:a="metadata-tree"}=e;const{elements:{item:l,group:c},helpers:{isExpanded:u,isSelected:f}}=kn("tree");return ae(r,l,d=>t(3,i=d)),ae(r,c,d=>t(2,n=d)),ae(r,u,d=>t(4,s=d)),r.$$set=d=>{"treeItems"in d&&t(0,o=d.treeItems),"parent"in d&&t(1,a=d.parent)},[o,a,n,i,s,l,c,u]}class ea extends Le{constructor(e){super(),We(this,e,ad,ld,Pe,{treeItems:0,parent:1})}}function oo(r,e,t){const n=r.slice();return n[22]=e[t],n[24]=t,n}function lo(r){let e,t,n,i,s;e=new qn({props:{class:"border-b border-gray-300",$$slots:{default:[pd]},$$scope:{ctx:r}}}),i=new ea({props:{treeItems:r[0].content}});let o=[r[2]],a={};for(let l=0;l<o.length;l+=1)a=te(a,o[l]);return{c(){L(e.$$.fragment),t=$(),n=F("ol"),L(i.$$.fragment),ne(n,a)},m(l,c){W(e,l,c),A(l,t,c),A(l,n,c),W(i,n,null),s=!0},p(l,c){const u={};c&33554434&&(u.$$scope={dirty:c,ctx:l}),e.$set(u);const f={};c&1&&(f.treeItems=l[0].content),i.$set(f),ne(n,a=Re(o,[c&4&&l[2]]))},i(l){s||(S(e.$$.fragment,l),S(i.$$.fragment,l),s=!0)},o(l){M(e.$$.fragment,l),M(i.$$.fragment,l),s=!1},d(l){l&&(x(t),x(n)),q(e,l),q(i)}}}function cd(r){let e,t;return e=new Ee({props:{path:Hi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function ud(r){let e,t;return e=new Ee({props:{path:Gi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function fd(r){let e,t;return e=new Ee({props:{path:Ar}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function dd(r){let e,t;return e=new Ee({props:{path:Yi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function hd(r){let e,t;return e=new Ee({props:{path:fu}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function pd(r){let e,t,n,i,s,o,a,l,c,u,f,d,h,p;return e=new st({props:{title:"Add a metadata node",$$slots:{default:[cd]},$$scope:{ctx:r}}}),e.$on("click",r[8]),n=new Hl({props:{class:"border-r border-gray-300 mx-2"}}),s=new st({props:{title:"Move the selected metadata node up","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[ud]},$$scope:{ctx:r}}}),s.$on("click",r[10]),a=new st({props:{title:"Move the selected metadata node down","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[fd]},$$scope:{ctx:r}}}),a.$on("click",r[11]),c=new st({props:{title:"Remove the selected metadata node","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[dd]},$$scope:{ctx:r}}}),c.$on("click",r[9]),h=new st({props:{title:"Clear the selection","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[hd]},$$scope:{ctx:r}}}),h.$on("click",r[15]),{c(){L(e.$$.fragment),t=$(),L(n.$$.fragment),i=$(),L(s.$$.fragment),o=$(),L(a.$$.fragment),l=$(),L(c.$$.fragment),u=$(),f=F("div"),d=$(),L(h.$$.fragment),j(f,"class","flex-1")},m(m,g){W(e,m,g),A(m,t,g),W(n,m,g),A(m,i,g),W(s,m,g),A(m,o,g),W(a,m,g),A(m,l,g),W(c,m,g),A(m,u,g),A(m,f,g),A(m,d,g),W(h,m,g),p=!0},p(m,g){const b={};g&33554432&&(b.$$scope={dirty:g,ctx:m}),e.$set(b);const y={};g&2&&(y["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(y.$$scope={dirty:g,ctx:m}),s.$set(y);const _={};g&2&&(_["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(_.$$scope={dirty:g,ctx:m}),a.$set(_);const C={};g&2&&(C["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(C.$$scope={dirty:g,ctx:m}),c.$set(C);const k={};g&2&&(k["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(k.$$scope={dirty:g,ctx:m}),h.$set(k)},i(m){p||(S(e.$$.fragment,m),S(n.$$.fragment,m),S(s.$$.fragment,m),S(a.$$.fragment,m),S(c.$$.fragment,m),S(h.$$.fragment,m),p=!0)},o(m){M(e.$$.fragment,m),M(n.$$.fragment,m),M(s.$$.fragment,m),M(a.$$.fragment,m),M(c.$$.fragment,m),M(h.$$.fragment,m),p=!1},d(m){m&&(x(t),x(i),x(o),x(l),x(u),x(f),x(d)),q(e,m),q(n,m),q(s,m),q(a,m),q(c,m),q(h,m)}}}function md(r){let e;return{c(){e=F("p"),e.textContent="Please select a metadata node on the left"},m(t,n){A(t,e,n)},p:ie,i:ie,o:ie,d(t){t&&x(e)}}}function gd(r){let e,t,n,i,s,o,a,l,c,u,f,d,h,p,m,g,b,y=de(r[1].attrs),_=[];for(let k=0;k<y.length;k+=1)_[k]=ao(oo(r,y,k));const C=k=>M(_[k],1,1,()=>{_[k]=null});return p=new qn({props:{$$slots:{default:[_d]},$$scope:{ctx:r}}}),{c(){e=F("label"),t=F("span"),t.textContent="Tag",n=$(),i=F("input"),o=$(),a=F("label"),l=F("span"),l.textContent="Text",c=$(),u=F("input"),d=$();for(let k=0;k<_.length;k+=1)_[k].c();h=$(),L(p.$$.fragment),j(t,"data-form-field-label",""),j(i,"type","text"),i.value=s=r[1].type,j(i,"data-form-field-text",""),j(e,"class","block mb-2"),j(l,"data-form-field-label",""),j(u,"type","text"),u.value=f=r[1].text,j(u,"data-form-field-text",""),j(a,"class","block mb-2")},m(k,w){A(k,e,w),B(e,t),B(e,n),B(e,i),A(k,o,w),A(k,a,w),B(a,l),B(a,c),B(a,u),A(k,d,w);for(let P=0;P<_.length;P+=1)_[P]&&_[P].m(k,w);A(k,h,w),W(p,k,w),m=!0,g||(b=[Z(i,"change",r[6]),Z(u,"change",r[7])],g=!0)},p(k,w){if((!m||w&2&&s!==(s=k[1].type)&&i.value!==s)&&(i.value=s),(!m||w&2&&f!==(f=k[1].text)&&u.value!==f)&&(u.value=f),w&24578){y=de(k[1].attrs);let O;for(O=0;O<y.length;O+=1){const N=oo(k,y,O);_[O]?(_[O].p(N,w),S(_[O],1)):(_[O]=ao(N),_[O].c(),S(_[O],1),_[O].m(h.parentNode,h))}for(Q(),O=y.length;O<_.length;O+=1)C(O);ee()}const P={};w&33554432&&(P.$$scope={dirty:w,ctx:k}),p.$set(P)},i(k){if(!m){for(let w=0;w<y.length;w+=1)S(_[w]);S(p.$$.fragment,k),m=!0}},o(k){_=_.filter(Boolean);for(let w=0;w<_.length;w+=1)M(_[w]);M(p.$$.fragment,k),m=!1},d(k){k&&(x(e),x(o),x(a),x(d),x(h)),ut(_,k),q(p,k),g=!1,ct(b)}}}function bd(r){let e,t;return e=new Ee({props:{path:Yi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function yd(r){let e,t;function n(...i){return r[18](r[24],...i)}return e=new st({props:{title:"Move the selected metadata node up","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[bd]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s&2&&(o["aria-disabled"]=r[1]!==null?null:"true"),s&33554432&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function ao(r){let e,t,n,i,s,o,a,l,c,u,f,d,h,p,m,g,b;function y(...C){return r[16](r[24],...C)}function _(...C){return r[17](r[24],...C)}return p=new qn({props:{class:"border-b border-gray-300",$$slots:{default:[yd]},$$scope:{ctx:r}}}),{c(){e=F("div"),t=F("label"),n=F("span"),n.textContent="Name",i=$(),s=F("input"),a=$(),l=F("label"),c=F("span"),c.textContent="Value",u=$(),f=F("input"),h=$(),L(p.$$.fragment),j(n,"data-form-field-label",""),j(s,"type","text"),s.value=o=r[22].type,j(s,"data-form-field-text",""),j(t,"class","flex-1"),j(c,"data-form-field-label",""),j(f,"type","text"),f.value=d=r[22].value,j(f,"data-form-field-text",""),j(l,"class","flex-1"),j(e,"class","flex flex-row mb-2")},m(C,k){A(C,e,k),B(e,t),B(t,n),B(t,i),B(t,s),B(e,a),B(e,l),B(l,c),B(l,u),B(l,f),B(e,h),W(p,e,null),m=!0,g||(b=[Z(s,"change",y),Z(f,"change",_)],g=!0)},p(C,k){r=C,(!m||k&2&&o!==(o=r[22].type)&&s.value!==o)&&(s.value=o),(!m||k&2&&d!==(d=r[22].value)&&f.value!==d)&&(f.value=d);const w={};k&33554434&&(w.$$scope={dirty:k,ctx:r}),p.$set(w)},i(C){m||(S(p.$$.fragment,C),m=!0)},o(C){M(p.$$.fragment,C),m=!1},d(C){C&&x(e),q(p),g=!1,ct(b)}}}function kd(r){let e,t;return e=new Ee({props:{path:Hi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function _d(r){let e,t,n,i;return n=new st({props:{title:"Add a metadata node",$$slots:{default:[kd]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{c(){e=F("div"),t=$(),L(n.$$.fragment),j(e,"class","flex-1")},m(s,o){A(s,e,o),A(s,t,o),W(n,s,o),i=!0},p(s,o){const a={};o&33554432&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(S(n.$$.fragment,s),i=!0)},o(s){M(n.$$.fragment,s),i=!1},d(s){s&&(x(e),x(t)),q(n,s)}}}function Sd(r){let e,t,n,i,s,o,a,l=r[0]&&lo(r);const c=[gd,md],u=[];function f(d,h){return d[1]?0:1}return s=f(r),o=u[s]=c[s](r),{c(){e=F("div"),t=F("div"),l&&l.c(),n=$(),i=F("div"),o.c(),j(t,"class","w-1/4 overflow-auto border-r border-gray-300"),j(i,"class","flex-1 px-2 py-1"),j(e,"class","flex flex-row w-full h-full overflow-auto")},m(d,h){A(d,e,h),B(e,t),l&&l.m(t,null),B(e,n),B(e,i),u[s].m(i,null),a=!0},p(d,[h]){d[0]?l?(l.p(d,h),h&1&&S(l,1)):(l=lo(d),l.c(),S(l,1),l.m(t,null)):l&&(Q(),M(l,1,1,()=>{l=null}),ee());let p=s;s=f(d),s===p?u[s].p(d,h):(Q(),M(u[p],1,1,()=>{u[p]=null}),ee(),o=u[s],o?o.p(d,h):(o=u[s]=c[s](d),o.c()),S(o,1),o.m(i,null))},i(d){a||(S(l),S(o),a=!0)},o(d){M(l),M(o),a=!1},d(d){d&&x(e),l&&l.d(),u[s].d()}}}function rt(r,e){const t=e.substring(14).split("-").map(n=>Number.parseInt(n));for(let n of t)r&&(r=r.content[n]);if(r)return r}function Cd(r,e){r.preventDefault()}function Md(r,e,t){let n,i,s,{section:o=null}=e;const a=Ui(),l=uu({defaultExpanded:["file-tree--1-0"]});Or("tree",l);const{elements:{tree:c},states:{selectedItem:u}}=l;ae(r,c,N=>t(2,s=N)),ae(r,u,N=>t(19,n=N));const f=_t(u,N=>{if(N!==null&&o){const E=N.getAttribute("data-id");if(E){const v=rt(o,E);if(v)return v}}return null});ae(r,f,N=>t(1,i=N));function d(N){if(N.preventDefault(),n!==null&&o){const E=n.getAttribute("data-id");if(E){const v=rt(o,E);v&&(v.type=N.target.value,a("update",o),t(0,o))}}}function h(N){if(N.preventDefault(),n!==null&&o){const E=n.getAttribute("data-id");if(E){const v=rt(o,E);v&&(v.text=N.target.value,a("update",o))}}}function p(N){if(N.preventDefault(),o){const E={type:"newNode",text:"",attrs:[],content:[]};if(n){const v=n.getAttribute("data-id");if(v){const U=rt(o,v);U&&U.content.push(E)}}else o.content.push(E);a("update",o),t(0,o)}}function m(N){if(N.preventDefault(),o&&n){const E=n.getAttribute("data-id");if(E){const v=E.split("-"),U=v.slice(0,v.length-1),se=rt(o,U.join("-"));se?(se.content.splice(Number.parseInt(v[v.length-1]),1),a("update",o),t(0,o)):(o.content.splice(Number.parseInt(v[v.length-1]),1),a("update",o),t(0,o))}}}function g(N){if(N.preventDefault(),o&&n){const E=n.getAttribute("data-id");if(E){const v=E.split("-"),U=v.slice(0,v.length-1),se=rt(o,U.join("-")),ce=Number.parseInt(v[v.length-1]);if(se&&ce>0){const Be=se.content.splice(ce,1);se.content.splice(ce-1,0,...Be),u.set(null),a("update",o),t(0,o)}else if(ce>0){const Be=o.content.splice(ce,1);o.content.splice(ce-1,0,...Be),u.set(null),a("update",o),t(0,o)}}}}function b(N){if(N.preventDefault(),o&&n){const E=n.getAttribute("data-id");if(E){const v=E.split("-"),U=v.slice(0,v.length-1),se=rt(o,U.join("-")),ce=Number.parseInt(v[v.length-1]);if(se&&ce<se.content.length-1){const Be=se.content.splice(ce,1);se.content.splice(ce+1,0,...Be),u.set(null),a("update",o),t(0,o)}else if(ce<o.content.length-1){const Be=o.content.splice(ce,1);o.content.splice(ce+1,0,...Be),u.set(null),a("update",o),t(0,o)}}}}function y(N){if(N.preventDefault(),n!==null&&o){const E=n.getAttribute("data-id");if(E){const v=rt(o,E);v&&(v.attrs.push({type:"",value:""}),a("update",o),t(0,o),u.set(n))}}}function _(N,E){if(N.preventDefault(),n!==null&&o){const v=n.getAttribute("data-id");if(v){const U=rt(o,v);U&&E>=0&&E<U.attrs.length&&(U.attrs[E].type=N.target.value,a("update",o),t(0,o),u.set(n))}}}function C(N,E){if(N.preventDefault(),n!==null&&o){const v=n.getAttribute("data-id");if(v){const U=rt(o,v);U&&E>=0&&E<U.attrs.length&&(U.attrs[E].value=N.target.value,a("update",o),t(0,o),u.set(n))}}}const k=()=>{u.set(null)},w=(N,E)=>{_(E,N)},P=(N,E)=>{C(E,N)},O=(N,E)=>{Cd(E)};return r.$$set=N=>{"section"in N&&t(0,o=N.section)},[o,i,s,c,u,f,d,h,p,m,g,b,y,_,C,k,w,P,O]}class wd extends Le{constructor(e){super(),We(this,e,Md,Sd,Pe,{section:0})}}function we(r){this.content=r}we.prototype={constructor:we,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new we(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new we(t)},addToStart:function(r,e){return new we([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new we(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new we(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=we.from(r),r.size?new we(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=we.from(r),r.size?new we(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=we.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};we.from=function(r){if(r instanceof we)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new we(e)};function ta(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=ta(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function na(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||a.content.size){let c=na(o.content,a.content,t-1,n-1);if(c)return c}t-=l,n-=l}}class T{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),n,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new T(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new T(n,i)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new T(i,s)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return ta(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return na(this,e,t,n)}findIndex(e,t=-1){if(e==0)return Qn(0,e);if(e==this.size)return Qn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let s=this.child(n),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Qn(n+1,o):Qn(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new T(t||e,n)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Zr={index:0,offset:0};function Qn(r,e){return Zr.index=r,Zr.offset=e,Zr}function mr(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!mr(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!mr(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let oe=class Mi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&mr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Mi.none;if(e instanceof Mi)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};oe.none=[];class gr extends Error{}class R{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ia(this.content,e+this.openStart,t);return n&&new R(n,this.openStart,this.openEnd)}removeBetween(e,t){return new R(ra(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return R.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(T.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new R(e,n,i)}}R.empty=new R(T.empty,0,0);function ra(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(ra(s.content,e-i-1,t-i-1)))}function ia(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let a=ia(o.content,e-s-1,t);return a&&r.replaceChild(i,o.copy(a))}function Td(r,e,t){if(t.openStart>r.depth)throw new gr("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new gr("Inconsistent open depths");return sa(r,e,t,0)}function sa(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=sa(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return jt(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Ed(t,r);return jt(s,la(r,o,a,e,n))}else return jt(s,br(r,e,n))}function oa(r,e){if(!e.type.compatibleContent(r.type))throw new gr("Cannot join "+e.type.name+" onto "+r.type.name)}function wi(r,e,t){let n=r.node(t);return oa(n,e.node(t)),n}function qt(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function An(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(qt(r.nodeAfter,n),s++));for(let a=s;a<o;a++)qt(i.child(a),n);e&&e.depth==t&&e.textOffset&&qt(e.nodeBefore,n)}function jt(r,e){return r.type.checkContent(e),r.copy(e)}function la(r,e,t,n,i){let s=r.depth>i&&wi(r,e,i+1),o=n.depth>i&&wi(t,n,i+1),a=[];return An(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(oa(s,o),qt(jt(s,la(r,e,t,n,i+1)),a)):(s&&qt(jt(s,br(r,e,i+1)),a),An(e,t,i,a),o&&qt(jt(o,br(t,n,i+1)),a)),An(n,null,i,a),new T(a)}function br(r,e,t){let n=[];if(An(null,r,t,n),r.depth>t){let i=wi(r,e,t+1);qt(jt(i,br(r,e,t+1)),n)}return An(e,null,t,n),new T(n)}function Ed(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(T.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class In{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return oe.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new yr(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(n.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new In(t,n,s)}static resolveCached(e,t){let n=co.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else co.set(e,n=new Od);let i=n.elts[n.i]=In.resolve(e,t);return n.i=(n.i+1)%Nd,i}}class Od{constructor(){this.elts=[],this.i=0}}const Nd=12,co=new WeakMap;class yr{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 Ad=Object.create(null);let Tt=class Ti{constructor(e,t,n,i=oe.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||T.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&mr(this.attrs,t||e.defaultAttrs||Ad)&&oe.sameSet(this.marks,n||oe.none)}copy(e=null){return e==this.content?this:new Ti(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ti(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return R.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new R(c,i.depth-o,s.depth-o)}replace(e,t,n){return Td(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return In.resolveCached(this,e)}resolveNoCache(e){return In.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),aa(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=T.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=oe.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!oe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=T.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Tt.prototype.text=void 0;class kr extends Tt{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):aa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new kr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new kr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function aa(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new xd(e,t);if(n.next==null)return Ut.empty;let i=ca(n);n.next&&n.err("Unexpected trailing text");let s=zd(Bd(i));return Fd(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return T.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=s(f,a.concat(u));if(d)return d}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
|
|
104
|
-
`)}}Ut.empty=new Ut(!0);class xd{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ca(r){let e=[];do e.push(Dd(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Dd(r){let e=[];do e.push(vd(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function vd(r){let e=Rd(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=Id(r,e);else break;return e}function uo(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function Id(r,e){let t=uo(r),n=t;return r.eat(",")&&(r.next!="}"?n=uo(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function Pd(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function Rd(r){if(r.eat("(")){let e=ca(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=Pd(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Bd(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();n(l,u),i(s(o.expr,l),u),l=u}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ua(r,e){return e-r}function fo(r,e){let t=[];return n(e),t.sort(ua);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function zd(r){let e=Object.create(null);return t(fo(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);fo(r,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[n.join(",")]=new Ut(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(ua);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Fd(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fa(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function da(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function ha(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function pa(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Ld(r,n,e[n]);return t}let ho=class ma{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=pa(e,n.attrs),this.defaultAttrs=fa(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ut.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:da(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tt(this,this.computeAttrs(e),T.from(t),oe.setFrom(n))}createChecked(e=null,t,n){return t=T.from(t),this.checkContent(t),new Tt(this,this.computeAttrs(e),t,oe.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=T.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(T.empty,!0);return s?new Tt(this,e,t.append(s),oe.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).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){ha(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:oe.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new ma(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Vd(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Ld{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Vd(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class vr{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=pa(e,i.attrs),this.excluded=null;let s=fa(this.attrs);this.instance=s?new oe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new oe(this,da(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new vr(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ha(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ga{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=we.from(e.nodes),t.marks=we.from(e.marks||{}),this.nodes=ho.compile(this.spec.nodes,this),this.marks=vr.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=Ut.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?po(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:po(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ho){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new kr(n,n.defaultAttrs,e,oe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Tt.fromJSON(this,e)}markFromJSON(e){return oe.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function po(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Wd(r){return r.tag!=null}function qd(r){return r.style!=null}class Et{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Wd(i))this.tags.push(i);else if(qd(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new go(this,t,!1);return n.addAll(e,oe.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new go(this,t,!0);return n.addAll(e,oe.none,t.from,t.to),R.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if($d(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=bo(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=bo(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Et(e,Et.schemaRules(e)))}}const ba={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},jd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ya={ol:!0,ul:!0},Pn=1,Ei=2,cr=4;function mo(r,e,t){return e!=null?(e?Pn:0)|(e==="full"?Ei:0):r&&r.whitespace=="pre"?Pn|Ei:t&-5}class er{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=oe.none,this.match=s||(o&cr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pn)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ba.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class go{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=mo(null,t.preserveWhitespace,0)|(n?cr:0);i?s=new er(i.type,i.attrs,oe.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new er(null,null,oe.none,!0,null,o):s=new er(e.schema.topNodeType,null,oe.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Ei?"full":this.localPreserveWS||(i.options&Pn)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)s!=="full"?n=n.replace(/\r?\n|\r/g," "):n=n.replace(/\r\n?/g,`
|
|
105
|
-
`);else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],a=e.previousSibling;(!o||a&&a.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;ya.hasOwnProperty(o)&&this.parser.normalizeLists&&Jd(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:jd.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(ba.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=l&&l.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
106
|
-
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n)||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t){let n,i;for(let s=this.open;s>=0;s--){let o=this.nodes[s],a=o.findWrapping(e);if(a&&(!n||n.length>a.length)&&(n=a,i=o,!a.length)||o.solid)break}if(!n)return null;this.sync(i);for(let s=0;s<n.length;s++)t=this.enterInner(n[s],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let n=this.findPlace(e,t);if(n){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=oe.none;for(let o of n.concat(e.marks))(i.type?i.type.allowsMarkType(o.type):yo(o.type,e.type))&&(s=o.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=mo(e,s,o.options);o.options&cr&&o.content.length==0&&(a|=cr);let l=oe.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):yo(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new er(e,t,l,i,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Pn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function Jd(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&ya.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function $d(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function bo(r){let e={};for(let t in r)e[t]=r[t];return e}function yo(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class Yt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Qr(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=ur(Qr(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&ur(Qr(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return ur(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Yt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ko(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return ko(e.marks)}}function ko(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Qr(r){return r.document||window.document}const _o=new WeakMap;function Kd(r){let e=_o.get(r);return e===void 0&&_o.set(r,e=Ud(r)),e}function Ud(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function ur(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Kd(n))&&s.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=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),c[f]):l.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let d=e[f];if(d===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=ur(r,d,t,n);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const ka=65535,_a=Math.pow(2,16);function Hd(r,e){return r+e*_a}function So(r){return r&ka}function Gd(r){return(r-(r&ka))/_a}const Sa=1,Ca=2,fr=4,Ma=8;class Oi{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Ma)>0}get deletedBefore(){return(this.delInfo&(Sa|fr))>0}get deletedAfter(){return(this.delInfo&(Ca|fr))>0}get deletedAcross(){return(this.delInfo&fr)>0}}class $e{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&$e.empty)return $e.empty}recover(e){let t=0,n=So(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Gd(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],f=l+c;if(e<=f){let d=c?e==l?-1:e==f?1:t:t,h=l+i+(d<0?0:u);if(n)return h;let p=e==(t<0?l:f)?null:Hd(a/3,e-l),m=e==l?Ca:e==f?Sa:fr;return(t<0?e!=l:e!=f)&&(m|=Ma),new Oi(h,m,p)}i+=u-c}return n?e+i:new Oi(e+i,0,null)}touches(e,t){let n=0,i=So(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+n];e(a,a+c,l,l+u),s+=u-c}}invert(){return new $e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$e.empty:new $e(e<0?[0,-e,0]:[0,0,e])}}$e.empty=new $e([]);class xn{constructor(e=[],t,n=0,i=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=i}slice(e=0,t=this.maps.length){return new xn(this.maps,this.mirror,e,t)}copy(){return new xn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new xn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new Oi(e,i,null)}}const ei=Object.create(null);class xe{getMap(){return $e.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ei[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ei)throw new RangeError("Duplicate use of step JSON ID "+e);return ei[e]=t,t.prototype.jsonID=e,t}}class fe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new fe(e,null)}static fail(e){return new fe(null,e)}static fromReplace(e,t,n,i){try{return fe.ok(e.replace(t,n,i))}catch(s){if(s instanceof gr)return fe.fail(s.message);throw s}}}function Qi(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Qi(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return T.fromArray(n)}class Ct extends xe{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new R(Qi(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return fe.fromReplace(e,this.from,this.to,s)}invert(){return new ot(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ct(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ct(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ct(t.from,t.to,e.markFromJSON(t.mark))}}xe.jsonID("addMark",Ct);class ot extends xe{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new R(Qi(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return fe.fromReplace(e,this.from,this.to,n)}invert(){return new Ct(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ot(t.pos,n.pos,this.mark)}merge(e){return e instanceof ot&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ot(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ot(t.from,t.to,e.markFromJSON(t.mark))}}xe.jsonID("removeMark",ot);class Mt extends xe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return fe.fromReplace(e,this.pos,this.pos+1,new R(T.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Mt(this.pos,t.marks[i]);return new Mt(this.pos,this.mark)}}return new pn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mt(t.pos,e.markFromJSON(t.mark))}}xe.jsonID("addNodeMark",Mt);class pn extends xe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return fe.fromReplace(e,this.pos,this.pos+1,new R(T.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pn(t.pos,e.markFromJSON(t.mark))}}xe.jsonID("removeNodeMark",pn);class _e extends xe{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Ni(e,this.from,this.to)?fe.fail("Structure replace would overwrite content"):fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $e([this.from,this.to-this.from,this.slice.size])}invert(e){return new _e(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new _e(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof _e)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _e(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _e(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new _e(t.from,t.to,R.fromJSON(e,t.slice),!!t.structure)}}xe.jsonID("replace",_e);class Se extends xe{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ni(e,this.from,this.gapFrom)||Ni(e,this.gapTo,this.to)))return fe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return fe.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?fe.fromReplace(e,this.from,this.to,n):fe.fail("Content does not fit in gap")}getMap(){return new $e([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Se(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new Se(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Se(t.from,t.to,t.gapFrom,t.gapTo,R.fromJSON(e,t.slice),t.insert,!!t.structure)}}xe.jsonID("replaceAround",Se);function Ni(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Yd(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&u.type.allowsMarkType(n.type)){let d=Math.max(c,e),h=Math.min(c+l.nodeSize,t),p=n.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(p)||(o&&o.to==d&&o.mark.eq(f[m])?o.to=h:i.push(o=new ot(d,h,f[m])));a&&a.to==d?a.to=h:s.push(a=new Ct(d,h,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function Xd(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof vr){let c=o.marks,u;for(;u=n.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let f=l[u],d;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&f.eq(i[h].style)&&(d=p)}d?(d.to=c,d.step=s):i.push({style:f,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>r.step(new ot(o.from,o.to,o.style)))}function es(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,f=n.matchType(c.type);if(!f)o.push(new _e(a,u,R.empty));else{n=f;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||r.step(new ot(a,u,c.marks[d]));if(i&&c.isText&&t.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(c.text);)p||(p=new R(T.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new _e(a+d.index,a+d.index+d[0].length,p))}}a=u}if(!n.validEnd){let l=n.fillBefore(T.empty,!0);r.replace(a,a,new R(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function Zd(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function _n(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),s=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(s,o,t))return n;if(n==0||i.type.spec.isolating||!Zd(i,s,o))break}return null}function Qd(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,c=a,u=T.empty,f=0;for(let p=s,m=!1;p>t;p--)m||n.index(p)>0?(m=!0,u=T.from(n.node(p).copy(u)),f++):l--;let d=T.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=T.from(i.node(p).copy(d)),h++):c++;r.step(new Se(l,c,o,a,new R(u.append(d),f,h),u.size-f,!0))}function wa(r,e,t=null,n=r){let i=eh(r,e),s=i&&th(n,e);return s?i.map(Co).concat({type:e,attrs:t}).concat(s.map(Co)):null}function Co(r){return{type:r,attrs:null}}function eh(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function th(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function nh(r,e,t){let n=T.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=T.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new Se(i,s,i,s,new R(n,0,0),t.length,!0))}function rh(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&ih(r.doc,r.mapping.slice(s).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",p=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Ea(r,o,a,s),es(r,r.mapping.slice(s).map(a,1),n,void 0,c===null);let u=r.mapping.slice(s),f=u.map(a,1),d=u.map(a+o.nodeSize,1);return r.step(new Se(f,d,f+1,d-1,new R(T.from(n.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Ta(r,o,a,s),!1}})}function Ta(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ea(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
|
|
107
|
-
`))}})}function ih(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function sh(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new Se(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new R(T.from(o),0,0),1,!0))}function un(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=n&&n[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=n&&n[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function oh(r,e,t=1,n){let i=r.doc.resolve(e),s=T.empty,o=T.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=T.from(i.node(a).copy(s));let u=n&&n[c];o=T.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}r.step(new _e(e,e,new R(s.append(o),t,t),!0))}function Xt(r,e){let t=r.resolve(e),n=t.index();return Oa(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function lh(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function Oa(r,e){return!!(r&&e&&!r.isLeaf&&lh(r,e))}function Ir(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&Oa(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function ah(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);u&&!f?n=!1:!u&&f&&(n=!0)}let a=r.steps.length;if(n===!1){let u=r.doc.resolve(e+t);Ea(r,u.node(),u.before(),a)}o.inlineContent&&es(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),c=l.map(e-t);if(r.step(new _e(c,l.map(e+t,-1),R.empty,!0)),n===!0){let u=r.doc.resolve(c);Ta(r,u.node(),u.before(),r.steps.length)}return r}function ch(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function uh(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),c=n.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let f=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function Pr(r,e,t=e,n=R.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return Na(i,s,n)?new _e(e,t,n):new fh(i,s,n).fit()}function Na(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class fh{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new R(s,o,a);return e>-1?new Se(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new _e(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=ti(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(T.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:f};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=ti(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=ti(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new R(Tn(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new R(Tn(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,c=0,u=[],{match:f,type:d}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));f=f.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=f.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(f=g,u.push(Aa(m.mark(d.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=En(this.placed,t,T.from(u)),this.frontier[t].match=f,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?R.empty:new R(Tn(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new R(Tn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ni(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ni(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ni(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=En(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=En(this.placed,this.depth,T.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=En(this.placed,this.frontier.length,t))}}function Tn(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(Tn(r.firstChild.content,e-1,t)))}function En(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(En(r.lastChild.content,e-1,t)))}function ti(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function Aa(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,Aa(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(T.empty,!0)))),r.copy(n)}function ni(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!dh(t,s.content,o)?a:null}function dh(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function hh(r){return r.spec.defining||r.spec.definingForContent}function ph(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(Na(i,s,n))return r.step(new _e(e,t,n));let o=Da(i,r.doc.resolve(t));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let d=i.depth,h=i.pos-1;d>0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?a=d:i.before(d)==h&&o.splice(1,0,-d)}let l=o.indexOf(a),c=[],u=n.openStart;for(let d=n.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==n.openStart)break;d=p.content}for(let d=u-1;d>=0;d--){let h=c[d],p=hh(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))u=d;else if(p||!h.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let h=(d+u+1)%(n.openStart+1),p=c[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let y=i.node(g-1),_=i.index(g-1);if(y.canReplaceWith(_,_,p.type,p.marks))return r.replace(i.before(g),b?s.after(g):t,new R(xa(n.content,0,n.openStart,h),h,n.openEnd))}}let f=r.steps.length;for(let d=o.length-1;d>=0&&(r.replace(e,t,n),!(r.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),t=s.after(h))}}function xa(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(xa(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(T.empty,!0))}return r}function mh(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=ch(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new R(T.from(n),0,0))}function gh(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=Da(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function Da(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class fn extends xe{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return fe.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return fe.fromReplace(e,this.pos,this.pos+1,new R(T.from(i),0,t.isLeaf?0:1))}getMap(){return $e.empty}invert(e){return new fn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new fn(t.pos,t.attr,t.value)}}xe.jsonID("attr",fn);class Rn extends xe{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return fe.ok(n)}getMap(){return $e.empty}invert(e){return new Rn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Rn(t.attr,t.value)}}xe.jsonID("docAttr",Rn);let mn=class extends Error{};mn=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};mn.prototype=Object.create(Error.prototype);mn.prototype.constructor=mn;mn.prototype.name="TransformError";class bh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new mn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=R.empty){let i=Pr(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new R(T.from(n),0,0))}delete(e,t){return this.replace(e,t,R.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return ph(this,e,t,n),this}replaceRangeWith(e,t,n){return mh(this,e,t,n),this}deleteRange(e,t){return gh(this,e,t),this}lift(e,t){return Qd(this,e,t),this}join(e,t=1){return ah(this,e,t),this}wrap(e,t){return nh(this,e,t),this}setBlockType(e,t=e,n,i=null){return rh(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return sh(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new fn(e,t,n)),this}setDocAttribute(e,t){return this.step(new Rn(e,t)),this}addNodeMark(e,t){return this.step(new Mt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof oe)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t=t.isInSet(n.marks),!t)return this}return this.step(new pn(e,t)),this}split(e,t=1,n){return oh(this,e,t,n),this}addMark(e,t,n){return Yd(this,e,t,n),this}removeMark(e,t,n){return Xd(this,e,t,n),this}clearIncompatible(e,t,n){return es(this,e,t,n),this}}const ri=Object.create(null);class Y{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new yh(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=R.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?R.empty:t),a==0&&To(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),To(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new G(e):sn(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?sn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):sn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xe(e.node(0))}static atStart(e){return sn(e,e,0,0,1)||new Xe(e)}static atEnd(e){return sn(e,e,e.content.size,e.childCount,-1)||new Xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ri[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ri)throw new RangeError("Duplicate use of selection JSON ID "+e);return ri[e]=t,t.prototype.jsonID=e,t}getBookmark(){return G.between(this.$anchor,this.$head).getBookmark()}}Y.prototype.visible=!0;class yh{constructor(e,t){this.$from=e,this.$to=t}}let Mo=!1;function wo(r){!Mo&&!r.parent.inlineContent&&(Mo=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class G extends Y{constructor(e,t=e){wo(e),wo(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Y.near(n);let i=e.resolve(t.map(this.anchor));return new G(i.parent.inlineContent?i:n,n)}replace(e,t=R.empty){if(super.replace(e,t),t==R.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof G&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Rr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new G(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=Y.findFrom(t,n,!0)||Y.findFrom(t,-n,!0);if(s)t=s.$head;else return Y.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(Y.findFrom(e,-n,!0)||Y.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new G(e,t)}}Y.jsonID("text",G);class Rr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Rr(e.map(this.anchor),e.map(this.head))}resolve(e){return G.between(e.resolve(this.anchor),e.resolve(this.head))}}class K extends Y{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?Y.near(s):new K(s)}content(){return new R(T.from(this.node),0,0)}eq(e){return e instanceof K&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ts(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new K(e.resolve(t.anchor))}static create(e,t){return new K(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}K.prototype.visible=!1;Y.jsonID("node",K);class ts{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Rr(n,n):new ts(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&K.isSelectable(n)?new K(t):Y.near(t)}}class Xe extends Y{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=R.empty){if(t==R.empty){e.delete(0,e.doc.content.size);let n=Y.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xe(e)}map(e){return new Xe(e)}eq(e){return e instanceof Xe}getBookmark(){return kh}}Y.jsonID("all",Xe);const kh={map(){return this},resolve(r){return new Xe(r)}};function sn(r,e,t,n,i,s=!1){if(e.inlineContent)return G.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&K.isSelectable(a))return K.create(r,t-(i<0?a.nodeSize:0))}else{let l=sn(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function To(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof _e||i instanceof Se))return;let s=r.mapping.maps[n],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),r.setSelection(Y.near(r.doc.resolve(o),t))}const Eo=1,Oo=2,No=4;class _h extends bh{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|Eo)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Eo)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Oo,this}ensureMarks(e){return oe.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&Oo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||oe.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),n=n??t,!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),this.selection.empty||this.setSelection(Y.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=No,this}get scrolledIntoView(){return(this.updated&No)>0}}function Ao(r,e){return!e||!r?r:r.bind(e)}class On{constructor(e,t,n){this.name=e,this.init=Ao(t.init,n),this.apply=Ao(t.apply,n)}}const Sh=[new On("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new On("selection",{init(r,e){return r.selection||Y.atStart(e.doc)},apply(r){return r.selection}}),new On("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new On("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class ii{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Sh.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new On(n.key,n.spec.state,n))})}}class an{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,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,n);if(u&&n.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:n,n:t.length}:{state:this,n:0})}t.push(u),n=n.applyInner(u),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new an(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new _h(this)}static create(e){let t=new ii(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new an(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new ii(this.schema,e.plugins),n=t.fields,i=new an(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ii(e.schema,e.plugins),s=new an(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Tt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Y.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function va(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=va(i,e,{})),t[n]=i}return t}class ft{constructor(e){this.spec=e,this.props={},e.props&&va(e.props,this,this.props),this.key=e.key?e.key.key:Ia("plugin")}getState(e){return e[this.key]}}const si=Object.create(null);function Ia(r){return r in si?r+"$"+ ++si[r]:(si[r]=0,r+"$")}class Zt{constructor(e="key"){this.key=Ia(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Te=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Bn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let Ai=null;const ht=function(r,e,t){let n=Ai||(Ai=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},Ch=function(){Ai=null},Ht=function(r,e,t,n){return t&&(xo(r,e,t,n,-1)||xo(r,e,t,n,1))},Mh=/^(img|br|input|textarea|hr)$/i;function xo(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Ye(r))){let s=r.parentNode;if(!s||s.nodeType!=1||jn(r)||Mh.test(r.nodeName)||r.contentEditable=="false")return!1;e=Te(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.contentEditable=="false")return!1;e=i<0?Ye(r):0}else return!1}}function Ye(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function wh(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Ye(r)}else if(r.parentNode&&!jn(r))e=Te(r),r=r.parentNode;else return null}}function Th(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!jn(r))e=Te(r)+1,r=r.parentNode;else return null}}function Eh(r,e,t){for(let n=e==0,i=e==Ye(r);n||i;){if(r==t)return!0;let s=Te(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Ye(r)}}function jn(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const Br=function(r){return r.focusNode&&Ht(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function Rt(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function Oh(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Nh(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Ye(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Ye(n.startContainer),n.startOffset)}}}const lt=typeof navigator<"u"?navigator:null,Do=typeof document<"u"?document:null,Dt=lt&<.userAgent||"",xi=/Edge\/(\d+)/.exec(Dt),Pa=/MSIE \d/.exec(Dt),Di=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Ve=!!(Pa||Di||xi),Ot=Pa?document.documentMode:Di?+Di[1]:xi?+xi[1]:0,et=!Ve&&/gecko\/(\d+)/i.test(Dt);et&&+(/Firefox\/(\d+)/.exec(Dt)||[0,0])[1];const vi=!Ve&&/Chrome\/(\d+)/.exec(Dt),Ne=!!vi,Ra=vi?+vi[1]:0,De=!Ve&&!!lt&&/Apple Computer/.test(lt.vendor),gn=De&&(/Mobile\/\w+/.test(Dt)||!!lt&<.maxTouchPoints>2),Ge=gn||(lt?/Mac/.test(lt.platform):!1),Ah=lt?/Win/.test(lt.platform):!1,mt=/Android \d/.test(Dt),Jn=!!Do&&"webkitFontSmoothing"in Do.documentElement.style,xh=Jn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Dh(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function dt(r,e){return typeof r=="number"?r:r[e]}function vh(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function vo(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;o=Bn(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?Dh(s):vh(a),u=0,f=0;if(e.top<c.top+dt(n,"top")?f=-(c.top-e.top+dt(i,"top")):e.bottom>c.bottom-dt(n,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+dt(i,"top")-c.top:e.bottom-c.bottom+dt(i,"bottom")),e.left<c.left+dt(n,"left")?u=-(c.left-e.left+dt(i,"left")):e.right>c.right-dt(n,"right")&&(u=e.right-c.right+dt(i,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let d=a.scrollLeft,h=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let p=a.scrollLeft-d,m=a.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Ih(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=r.root.elementFromPoint(s,o);if(!a||a==r.dom||!r.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){n=a,i=l.top;break}}return{refDOM:n,refTop:i,stack:Ba(r.dom)}}function Ba(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Bn(n));return e}function Ph({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;za(t,n==0?0:n-e)}function za(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let nn=null;function Rh(r){if(r.setActive)return r.setActive();if(nn)return r.focus(nn);let e=Ba(r);r.focus(nn==null?{get preventScroll(){return nn={preventScroll:!0},!0}}:void 0),nn||(nn=!1,za(e,0))}function Fa(r,e){let t,n=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=r.firstChild,f=0;u;u=u.nextSibling,f++){let d;if(u.nodeType==1)d=u.getClientRects();else if(u.nodeType==3)d=ht(u).getClientRects();else continue;for(let h=0;h<d.length;h++){let p=d[h];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<n){t=u,n=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=f+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!t&&l&&(t=l,i=c,n=0),t&&t.nodeType==3?Bh(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:Fa(t,i)}function Bh(r,e){let t=r.nodeValue.length,n=document.createRange();for(let i=0;i<t;i++){n.setEnd(r,i+1),n.setStart(r,i);let s=yt(n,1);if(s.top!=s.bottom&&ns(e,s))return{node:r,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:r,offset:0}}function ns(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function zh(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function Fh(r,e,t){let{node:n,offset:i}=Fa(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function Vh(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let a=r.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!o&&l.left>n.left||l.top>n.top?i=a.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function Va(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ns(e,c))return Va(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function Lh(r,e){let t=r.dom.ownerDocument,n,i=0,s=Nh(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),a;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=r.dom.getBoundingClientRect();if(!ns(e,c)||(o=Va(r.dom,e,c),!o))return null}if(De)for(let c=o;n&&c;c=Bn(c))c.draggable&&(n=void 0);if(o=zh(o,e),n){if(et&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let u=n.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Jn&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=Vh(r,n,i,e))}a==null&&(a=Fh(r,o,e));let l=r.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Io(r){return r.top<r.bottom||r.left<r.right}function yt(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(Io(n))return n}return Array.prototype.find.call(t,Io)||r.getBoundingClientRect()}const Wh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function La(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=Jn||et;if(n.nodeType==3)if(o&&(Wh.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=yt(ht(n,i,i),t);if(et&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=yt(ht(n,i-1,i-1),-1);if(c.top==l.top){let u=yt(ht(n,i,i+1),-1);if(u.top!=l.top)return Cn(u,u.left<c.left)}}return l}else{let l=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==n.nodeValue.length?(l--,u=1):t<0?l--:c++,Cn(yt(ht(n,l,c),u),u<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Ye(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return oi(l.getBoundingClientRect(),!1)}if(s==null&&i<Ye(n)){let l=n.childNodes[i];if(l.nodeType==1)return oi(l.getBoundingClientRect(),!0)}return oi(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Ye(n))){let l=n.childNodes[i-1],c=l.nodeType==3?ht(l,Ye(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Cn(yt(c,1),!1)}if(s==null&&i<Ye(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ht(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Cn(yt(c,-1),!0)}return Cn(yt(n.nodeType==3?ht(n):n,-t),t>=0)}function Cn(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function oi(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function Wa(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function qh(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Wa(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=r.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=La(r,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ht(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const jh=/[\u0590-\u08ac]/;function Jh(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,a=r.domSelection();return a?!jh.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Wa(r,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=r.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",t,"character");let h=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:p,focusOffset:m}=r.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return d!=null&&(a.caretBidiLevel=d),g}):n.pos==n.start()||n.pos==n.end()}let Po=null,Ro=null,Bo=!1;function $h(r,e,t){return Po==e&&Ro==t?Bo:(Po=e,Ro=t,Bo=t=="up"||t=="down"?qh(r,e,t):Jh(r,e,t))}const Ze=0,zo=1,Ft=2,at=3;class $n{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Ze,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let i=this.children[t];if(i==e)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.size;if(a>e||o instanceof ja){i=e-s;break}s=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof qa&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Te(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Te(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=n,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let f=a;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Te(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=Te(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,n,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),u=n.domSelectionRange(),f=!1;if((et||De)&&e==t){let{node:h,offset:p}=a;if(h.nodeType==3){if(f=!!(p&&h.nodeValue[p-1]==`
|
|
108
|
-
`),f&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Te(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(et&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||f&&De)&&Ht(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ht(l.node,l.offset,u.focusNode,u.focusOffset))return;let d=!1;if((c.extend||e==t)&&!f){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(e>t){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,i=0;i<this.children.length;i++){let s=this.children[i],o=n+s.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let a=n+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==n||t==o?Ft:zo,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=at:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ft:at}n=o}this.dirty=Ft}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ft:zo;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class qa extends $n{constructor(e,t,n,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Ze&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Kh extends $n{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Gt extends $n{constructor(e,t,n,i,s){super(e,[],n,i),this.mark=t,this.spec=s}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=Yt.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Gt(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&at||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=at&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ze){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Ze}}slice(e,t,n){let i=Gt.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=Pi(s,t,o,n)),e>0&&(s=Pi(s,0,e,n));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Nt extends $n{constructor(e,t,n,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=a}static create(e,t,n,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Yt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=Ka(u,n,t),c?l=new Uh(e,t,n,i,u,f||null,d,c,s,o+1):t.isText?new zr(e,t,n,i,u,d,s):new Nt(e,t,n,i,u,f||null,d,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,n){return this.dirty==Ze&&e.eq(this.node)&&_r(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Gh(this,o&&o.node,e);Zh(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?oe.none:this.node.child(u).marks,n,e),l.placeWidget(c,e,i)},(c,u,f,d)=>{l.syncToMarks(c.marks,n,e);let h;l.findNodeMatch(c,u,f,d)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,f,h,e)||l.updateNextNode(c,u,f,e,d,i)||l.addNode(c,u,f,e,i),i+=c.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ft)&&(o&&this.protectLocalComposition(e,o),Ja(this.contentDOM,this.children,e),gn&&Qh(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof G)||n<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=ep(this.node.content,o,n-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Kh(this,s,t,i);e.input.compositionNodes.push(o),this.children=Pi(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==at||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ze}updateOuterDeco(e){if(_r(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=$a(this.dom,this.nodeDOM,Ii(this.outerDeco,this.node,t),Ii(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Fo(r,e,t,n,i){Ka(n,e,r);let s=new Nt(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class zr extends Nt{constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==at||this.dirty!=Ze&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ze||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ze,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new zr(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=at)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ja extends $n{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ze&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Uh extends Nt{constructor(e,t,n,i,s,o,a,l,c,u){super(e,t,n,i,s,o,a,c,u),this.spec=l}update(e,t,n,i){if(this.dirty==at)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ja(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==r){for(;a!=n;)n=Vo(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(a,n);if(o instanceof Gt){let l=n?n.previousSibling:r.lastChild;Ja(o.contentDOM,o.children,t),n=l?l.nextSibling:r.firstChild}}for(;n;)n=Vo(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const Dn=function(r){r&&(this.nodeName=r)};Dn.prototype=Object.create(null);const Vt=[new Dn];function Ii(r,e,t){if(r.length==0)return Vt;let n=t?Vt[0]:new Dn,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new Dn(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(n=new Dn(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return i}function $a(r,e,t,n){if(t==Vt&&n==Vt)return e;let i=e;for(let s=0;s<n.length;s++){let o=n[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=r&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Vt[0]),i=l}Hh(i,a||Vt[0],o)}return i}function Hh(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<n.length;s++)i.indexOf(n[s])==-1&&r.classList.remove(n[s]);for(let s=0;s<i.length;s++)n.indexOf(i[s])==-1&&r.classList.add(i[s]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function Ka(r,e,t){return $a(r,r,Vt,Ii(e,t,r.nodeType!=1))}function _r(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function Vo(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Gh{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Yh(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Ze,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Gt.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,n,i,s){let o=this.top.children[i];return o.dirty==at&&o.dom==o.contentDOM&&(o.dirty=Ft),o.update(e,t,n,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Nt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,f,d=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=at&&_r(t,l.outerDeco));if(!d&&l.update(e,t,n,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(l,e,t,n,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Ft,f.updateChildren(i,o+1),f.dirty=Ze),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!_r(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Nt.create(this.top,t,n,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,n,i,s){let o=Nt.create(this.top,e,t,n,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new qa(this.top,e,t,n);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Gt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof zr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((De||Ne)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new ja(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Yh(r,e){let t=e,n=t.children.length,i=r.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(n){let c=t.children[n-1];if(c instanceof Gt)t=c,n=c.children.length;else{a=c,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=r.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Xh(r,e){return r.type.side-e.type.side}function Zh(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let c=0;c<r.childCount;c++){let u=r.child(c);n(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(Xh);for(let g=0;g<f.length;g++)t(f[g],c,!!l)}else t(u,c,!!l);let d,h;if(l)h=-1,d=l,l=null;else if(c<r.childCount)h=c,d=r.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(l=d.cut(g-s),d=d.cut(0,g-s),p=g,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=d.isInline&&!d.isLeaf?a.filter(g=>!g.inline):a.slice();n(d,m,e.forChild(s,d),h),s=p}}function Qh(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function ep(r,e,t,n){for(let i=0,s=0;i<r.childCount&&s<=n;){let o=r.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<r.childCount;){let c=r.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let c=a<n?l.lastIndexOf(e,n-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function Pi(r,e,t,n,i){let s=[];for(let o=0,a=0;o<r.length;o++){let l=r[o],c=a,u=a+=l.size;c>=t||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,n)),i&&(s.push(i),i=void 0),u>t&&s.push(l.slice(t-c,l.size,n)))}return s}function rs(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,c;if(Br(t)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&K.isSelectable(f)&&i.parent&&!(f.isInline&&Eh(t.focusNode,t.focusOffset,i.dom))){let d=i.posBefore;c=new K(o==d?a:n.resolve(d))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,d=o;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);f=Math.min(f,r.docView.posFromDOM(p.startContainer,p.startOffset,1)),d=Math.max(d,r.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(f<0)return null;[l,o]=d==r.state.selection.anchor?[d,f]:[f,d],a=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=n.resolve(l);if(!c){let f=e=="pointer"||r.state.selection.head<a.pos&&!s?1:-1;c=is(r,u,a,f)}return c}function Ua(r){return r.editable?r.hasFocus():Ga(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function gt(r,e=!1){let t=r.state.selection;if(Ha(r,t),!!Ua(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&Ne){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&Ht(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)np(r);else{let{anchor:n,head:i}=t,s,o;Lo&&!(t instanceof G)&&(t.$from.parent.inlineContent||(s=Wo(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Wo(r,t.to))),r.docView.setSelection(n,i,r,e),Lo&&(s&&qo(s),o&&qo(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&tp(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const Lo=De||Ne&&Ra<63;function Wo(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(De&&i&&i.contentEditable=="false")return li(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return li(i);if(s)return li(s)}}function li(r){return r.contentEditable="true",De&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function qo(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function tp(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!Ua(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function np(r){let e=r.domSelection(),t=document.createRange();if(!e)return;let n=r.cursorWrapper.dom,i=n.nodeName=="IMG";i?t.setStart(n.parentNode,Te(n)+1):t.setStart(n,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!r.state.selection.visible&&Ve&&Ot<=11&&(n.disabled=!0,n.disabled=!1)}function Ha(r,e){if(e instanceof K){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(jo(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else jo(r)}function jo(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function is(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||G.between(e,t,n)}function Jo(r){return r.editable&&!r.hasFocus()?!1:Ga(r)}function Ga(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function rp(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return Ht(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ri(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Y.findFrom(s,e)}function kt(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function $o(r,e,t){let n=r.state.selection;if(n instanceof G)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return kt(r,new G(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Ri(r.state,e);return i&&i instanceof K?kt(r,i):!1}else if(!(Ge&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(a))&&!o.contentDOM?K.isSelectable(s)?kt(r,new K(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):Jn?kt(r,new G(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof K&&n.node.isInline)return kt(r,new G(e>0?n.$to:n.$from));{let i=Ri(r.state,e);return i?kt(r,i):!1}}}function Sr(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function vn(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function rn(r,e){return e<0?ip(r):sp(r)}function ip(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(et&&t.nodeType==1&&n<Sr(t)&&vn(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(vn(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(Ya(t))break;{let a=t.previousSibling;for(;a&&vn(a,-1);)i=t.parentNode,s=Te(a),a=a.previousSibling;if(a)t=a,n=Sr(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Bi(r,t,n):i&&Bi(r,i,s)}function sp(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=Sr(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(vn(a,1))s=t,o=++n;else break}else{if(Ya(t))break;{let a=t.nextSibling;for(;a&&vn(a,1);)s=a.parentNode,o=Te(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=Sr(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Bi(r,s,o)}function Ya(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function op(r,e){for(;r&&e==r.childNodes.length&&!jn(r);)e=Te(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function lp(r,e){for(;r&&!e&&!jn(r);)e=Te(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Bi(r,e,t){if(e.nodeType!=3){let s,o;(o=op(e,t))?(e=o,t=0):(s=lp(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(Br(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&>(r)},50)}function Ko(r,e){let t=r.state.doc.resolve(e);if(!(Ne||Ah)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function Uo(r,e,t){let n=r.state.selection;if(n instanceof G&&!n.empty||t.indexOf("s")>-1||Ge&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Ri(r.state,e);if(o&&o instanceof K)return kt(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof Xe?Y.near(o,e):Y.findFrom(o,e);return a?kt(r,a):!1}return!1}function Ho(r,e){if(!(r.state.selection instanceof G))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function Go(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function ap(r){if(!De||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;Go(r,n,"true"),setTimeout(()=>Go(r,n,"false"),20)}return!1}function cp(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function up(r,e){let t=e.keyCode,n=cp(e);if(t==8||Ge&&t==72&&n=="c")return Ho(r,-1)||rn(r,-1);if(t==46&&!e.shiftKey||Ge&&t==68&&n=="c")return Ho(r,1)||rn(r,1);if(t==13||t==27)return!0;if(t==37||Ge&&t==66&&n=="c"){let i=t==37?Ko(r,r.state.selection.from)=="ltr"?-1:1:-1;return $o(r,i,n)||rn(r,i)}else if(t==39||Ge&&t==70&&n=="c"){let i=t==39?Ko(r,r.state.selection.from)=="ltr"?1:-1:1;return $o(r,i,n)||rn(r,i)}else{if(t==38||Ge&&t==80&&n=="c")return Uo(r,-1,n)||rn(r,-1);if(t==40||Ge&&t==78&&n=="c")return ap(r)||Uo(r,1,n)||rn(r,1);if(n==(Ge?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Xa(r,e){r.someProp("transformCopied",h=>{e=h(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let h=n.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),n=h.content}let o=r.someProp("clipboardSerializer")||Yt.fromSchema(r.state.schema),a=rc(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=nc[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let d=r.someProp("clipboardTextSerializer",h=>h(e,r))||e.content.textBetween(0,e.content.size,`
|
|
109
|
-
|
|
110
|
-
`);return{dom:l,text:d,slice:e}}function Za(r,e,t,n,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=e&&(n||s||!t);if(l){if(r.someProp("transformPastedText",d=>{e=d(e,s||n,r)}),s)return e?new R(T.from(r.state.schema.text(e.replace(/\r\n?/g,`
|
|
111
|
-
`))),0,0):R.empty;let f=r.someProp("clipboardTextParser",d=>d(e,i,n,r));if(f)a=f;else{let d=i.marks(),{schema:h}=r.state,p=Yt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else r.someProp("transformPastedHTML",f=>{t=f(t,r)}),o=pp(t),Jn&&mp(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Et.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!fp.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=gp(Yo(a,+u[1],+u[2]),u[4]);else if(a=R.maxOpen(dp(a.content,i),!0),a.openStart||a.openEnd){let f=0,d=0;for(let h=a.content.firstChild;f<a.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=a.content.lastChild;d<a.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);a=Yo(a,f,d)}return r.someProp("transformPasted",f=>{a=f(a,r)}),a}const fp=/^(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 dp(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&ec(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=tc(o[o.length-1],s.length));let u=Qa(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return T.from(o)}return r}function Qa(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,T.from(r));return r}function ec(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=ec(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(T.from(Qa(t,r,i+1))))}}function tc(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,tc(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(T.empty,!0);return r.copy(t.append(n))}function zi(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=zi(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(T.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Yo(r,e,t){return e<r.openStart&&(r=new R(zi(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new R(zi(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const nc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xo=null;function rc(){return Xo||(Xo=document.implementation.createHTMLDocument("title"))}let ai=null;function hp(r){let e=window.trustedTypes;return e?(ai||(ai=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ai.createHTML(r)):r}function pp(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=rc().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&nc[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=hp(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function mp(r){let e=r.querySelectorAll(Ne?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function gp(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=T.from(l.create(n[a+1],i)),s++,o++}return new R(i,s,o)}const ve={},Ie={},bp={touchstart:!0,touchmove:!0};class yp{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function kp(r){for(let e in ve){let t=ve[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Sp(r,n)&&!ss(r,n)&&(r.editable||!(n.type in Ie))&&t(r,n)},bp[e]?{passive:!0}:void 0)}De&&r.dom.addEventListener("input",()=>null),Fi(r)}function wt(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function _p(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Fi(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>ss(r,n))})}function ss(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Sp(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Cp(r,e){!ss(r,e)&&ve[e.type]&&(r.editable||!(e.type in Ie))&&ve[e.type](r,e)}Ie.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!sc(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(mt&&Ne&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),gn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,Rt(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||up(r,t)?t.preventDefault():wt(r,"key")};Ie.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Ie.keypress=(r,e)=>{let t=e;if(sc(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ge&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof G)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",s=>s(r,n.$from.pos,n.$to.pos,i))&&r.dispatch(r.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Fr(r){return{left:r.clientX,top:r.clientY}}function Mp(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function ls(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function dn(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function wp(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&K.isSelectable(n)?(dn(r,new K(t)),!0):!1}function Tp(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof K&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(K.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(dn(r,K.create(r.state.doc,i)),!0):!1}function Ep(r,e,t,n,i){return ls(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Tp(r,t):wp(r,t))}function Op(r,e,t,n){return ls(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function Np(r,e,t,n){return ls(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||Ap(r,t,n)}function Ap(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(dn(r,G.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)dn(r,G.create(n,a+1,a+1+o.content.size));else if(K.isSelectable(o))dn(r,K.create(n,a));else continue;return!0}}function as(r){return Cr(r)}const ic=Ge?"metaKey":"ctrlKey";ve.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=as(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&Mp(t,r.input.lastClick)&&!t[ic]&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=r.posAtCoords(Fr(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new xp(r,o,t,!!n)):(s=="doubleClick"?Op:Np)(r,o.pos,o.inside,t)?t.preventDefault():wt(r,"pointer"))};class xp{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ic],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof K&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&et&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),wt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>gt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Fr(e))),this.updateAllowDefault(e),this.allowDefault||!t?wt(this.view,"pointer"):Ep(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||De&&this.mightDrag&&!this.mightDrag.node.isAtom||Ne&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(dn(this.view,Y.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):wt(this.view,"pointer")}move(e){this.updateAllowDefault(e),wt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ve.touchstart=r=>{r.input.lastTouch=Date.now(),as(r),wt(r,"pointer")};ve.touchmove=r=>{r.input.lastTouch=Date.now(),wt(r,"pointer")};ve.contextmenu=r=>as(r);function sc(r,e){return r.composing?!0:De&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const Dp=mt?5e3:-1;Ie.compositionstart=Ie.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof G&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),Cr(r,!0),r.markCursor=null;else if(Cr(r,!e.selection.empty),et&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}oc(r,Dp)};Ie.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,oc(r,20))};function oc(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Cr(r),e))}function lc(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Ip());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function vp(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=wh(e.focusNode,e.focusOffset),n=Th(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function Ip(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Cr(r,e=!1){if(!(mt&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),lc(r),e||r.docView&&r.docView.dirty){let t=rs(r);return t&&!t.eq(r.state.selection)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!r.state.selection.empty?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function Pp(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const zn=Ve&&Ot<15||gn&&xh<604;ve.copy=Ie.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=zn?null:t.clipboardData,o=n.content(),{dom:a,text:l}=Xa(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Pp(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Rp(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function Bp(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Fn(r,n.value,null,i,e):Fn(r,n.textContent,n.innerHTML,i,e)},50)}function Fn(r,e,t,n,i){let s=Za(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||R.empty)))return!0;if(!s)return!1;let o=Rp(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ac(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ie.paste=(r,e)=>{let t=e;if(r.composing&&!mt)return;let n=zn?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Fn(r,ac(n),n.getData("text/html"),i,t)?t.preventDefault():Bp(r,t)};class cc{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const uc=Ge?"altKey":"ctrlKey";ve.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Fr(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof K?i.to-1:i.to))){if(n&&n.mightDrag)o=K.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=r.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=r.docView&&(o=K.create(r.state.doc,f.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=Xa(r,a);(!t.dataTransfer.files.length||!Ne||Ra>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(zn?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",zn||t.dataTransfer.setData("text/plain",c),r.dragging=new cc(u,!t[uc],o)};ve.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Ie.dragover=Ie.dragenter=(r,e)=>e.preventDefault();Ie.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(Fr(t));if(!i)return;let s=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",p=>{o=p(o,r)}):o=Za(r,ac(t.dataTransfer),zn?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(n&&!t[uc]);if(r.someProp("handleDrop",p=>p(r,t,o||R.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?uh(r.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=r.state.tr;if(a){let{node:p}=n;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(d))return;let h=c.doc.resolve(u);if(f&&K.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new K(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,y)=>p=y),c.setSelection(is(r,h,c.doc.resolve(p)))}r.focus(),r.dispatch(c.setMeta("uiEvent","drop"))};ve.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&>(r)},20))};ve.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};ve.beforeinput=(r,e)=>{if(Ne&&mt&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,Rt(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in Ie)ve[r]=Ie[r];function Vn(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Mr{constructor(e,t){this.toDOM=e,this.spec=t||Jt,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Qe(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Mr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class At{constructor(e,t){this.attrs=e,this.spec=t||Jt}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new Qe(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof At&&Vn(this.attrs,e.attrs)&&Vn(this.spec,e.spec)}static is(e){return e.type instanceof At}destroy(){}}class cs{constructor(e,t){this.attrs=e,this.spec=t||Jt}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Qe(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof cs&&Vn(this.attrs,e.attrs)&&Vn(this.spec,e.spec)}destroy(){}}class Qe{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Qe(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Qe(e,e,new Mr(t,n))}static inline(e,t,n,i){return new Qe(e,t,new At(n,i))}static node(e,t,n,i){return new Qe(e,t,new cs(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof At}get widget(){return this.type instanceof Mr}}const on=[],Jt={};class ke{constructor(e,t){this.local=e.length?e:on,this.children=t.length?t:on}static create(e,t){return t.length?wr(t,e,0,Jt):Oe}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==Oe||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Jt)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?zp(this.children,o||[],e,t,n,i,s):o?new ke(o.sort($t),on):Oe}add(e,t){return t.length?this==Oe?ke.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let c=l+n,u;if(u=dc(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,wr(u,a,c+1,Jt)),s+=3}});let o=fc(s?hc(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ke(o.length?this.local.concat(o).sort($t):this.local,i||this.children)}remove(e){return e.length==0||this==Oe?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,a+1);c!=Oe?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new ke(i,n):Oe}forChild(e,t){if(this==Oe)return this;if(t.isLeaf)return ke.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof At){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new ke(i.sort($t),on);return n?new St([a,n]):a}return n||Oe}eq(e){if(this==e)return!0;if(!(e instanceof ke)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return us(this.localsInner(e))}localsInner(e){if(this==Oe)return on;if(e.inlineContent||!this.local.some(At.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof At||t.push(this.local[n]);return t}forEachSet(e){e(this)}}ke.empty=new ke([],[]);ke.removeOverlap=us;const Oe=ke.empty;class St{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,Jt));return St.from(n)}forChild(e,t){if(t.isLeaf)return ke.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Oe&&(s instanceof St?n=n.concat(s.members):n.push(s))}return St.from(n)}eq(e){if(!(e instanceof St)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?us(n?t:t.sort($t)):on}static from(e){switch(e.length){case 0:return Oe;case 1:return e[0];default:return new St(e.every(t=>t instanceof ke)?e:e.reduce((t,n)=>t.concat(n instanceof ke?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function zp(r,e,t,n,i,s,o){let a=r.slice();for(let c=0,u=s;c<t.maps.length;c++){let f=0;t.maps[c].forEach((d,h,p,m)=>{let g=m-p-(h-d);for(let b=0;b<a.length;b+=3){let y=a[b+1];if(y<0||d>y+u-f)continue;let _=a[b]+u-f;h>=_?a[b+1]=d<=_?-2:-1:d>=u&&g&&(a[b]+=g,a[b+1]+=g)}f+=g}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(r[c]+s),f=u-i;if(f<0||f>=n.content.size){l=!0;continue}let d=t.map(r[c+1]+s,-1),h=d-i,{index:p,offset:m}=n.content.findIndex(f),g=n.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let b=a[c+2].mapInner(t,g,u+1,r[c]+s+1,o);b!=Oe?(a[c]=f,a[c+1]=h,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Fp(a,r,e,t,i,s,o),u=wr(c,n,0,o);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,d=0;f<u.children.length;f+=3){let h=u.children[f];for(;d<a.length&&a[d]<h;)d+=3;a.splice(d,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ke(e.sort($t),a)}function fc(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new Qe(i.from+e,i.to+e,i.type))}return t}function Fp(r,e,t,n,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(n,i,c);f?t.push(f):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function dc(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function hc(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function wr(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=dc(r,a,l+t);if(c){s=!0;let u=wr(c,a,t+l+1,n);u!=Oe&&i.push(l,l+a.nodeSize,u)}});let o=fc(s?hc(r):r,-t).sort($t);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ke(o,i):Oe}function $t(r,e){return r.from-e.from||r.to-e.to}function us(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Zo(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Zo(e,i,n.copy(s.from,n.to)));break}}}return e}function Zo(r,e,t){for(;e<r.length&&$t(t,r[e])>0;)e++;r.splice(e,0,t)}function ci(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=Oe&&e.push(n)}),r.cursorWrapper&&e.push(ke.create(r.state.doc,[r.cursorWrapper.deco])),St.from(e)}const Vp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Lp=Ve&&Ot<=11;class Wp{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 qp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Wp,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);Ve&&Ot<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Lp&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,Vp)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Jo(this.view)){if(this.suppressingSelectionUpdates)return gt(this.view);if(Ve&&Ot<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ht(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Bn(s))t.add(s);for(let s=e.anchorNode;s;s=Bn(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Jo(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(et&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,d]=u;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of u){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||$p(e,f)!=h)&&d.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Br(n)&&(c=rs(e))&&c.eq(Y.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,gt(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),jp(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||gt(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Ve&&Ot<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:d}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d)}let o=i&&i.parentNode==e.target?Te(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Te(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Qo=new WeakMap,el=!1;function jp(r){if(!Qo.has(r)&&(Qo.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=et,el)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."),el=!0}}function tl(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return Ht(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function Jp(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return tl(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?tl(r,t):null}function $p(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function Kp(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:a}=r.docView.parseRange(e,t),l=r.domSelectionRange(),c,u=l.anchorNode;if(u&&r.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Br(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ne&&r.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=n.childNodes[g-1],y=b.pmViewDesc;if(b.nodeName=="BR"&&!y){s=g;break}if(!y||y.size)break}let f=r.state.doc,d=r.someProp("domParser")||Et.fromSchema(r.state.schema),h=f.resolve(o),p=null,m=d.parse(n,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Up,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function Up(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(De&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||De&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Hp=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Gp(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let N=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,E=rs(r,N);if(E&&!r.state.selection.eq(E)){if(Ne&&mt&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",U=>U(r,Rt(13,"Enter"))))return;let v=r.state.tr.setSelection(E);N=="pointer"?v.setMeta("pointer",!0):N=="key"&&v.scrollIntoView(),s&&v.setMeta("composition",s),r.dispatch(v)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,c=Kp(r,e,t),u=r.state.doc,f=u.slice(c.from,c.to),d,h;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(d=r.state.selection.to,h="end"):(d=r.state.selection.from,h="start"),r.input.lastKeyCode=null;let p=Zp(f.content,c.doc.content,c.from,d,h);if(p&&r.input.domChangeCount++,(gn&&r.input.lastIOSEnter>Date.now()-225||mt)&&i.some(N=>N.nodeType==1&&!Hp.test(N.nodeName))&&(!p||p.endA>=p.endB)&&r.someProp("handleKeyDown",N=>N(r,Rt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!p)if(n&&l instanceof G&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let N=nl(r,r.state.doc,c.sel);if(N&&!N.eq(r.state.selection)){let E=r.state.tr.setSelection(N);s&&E.setMeta("composition",s),r.dispatch(E)}}return}r.state.selection.from<r.state.selection.to&&p.start==p.endB&&r.state.selection instanceof G&&(p.start>r.state.selection.from&&p.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?p.start=r.state.selection.from:p.endA<r.state.selection.to&&p.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(p.endB+=r.state.selection.to-p.endA,p.endA=r.state.selection.to)),Ve&&Ot<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),y=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,_;if((gn&&r.input.lastIOSEnter>Date.now()-225&&(!y||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!y&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(_=Y.findFrom(c.doc.resolve(m.pos+1),1,!0))&&_.head==g.pos)&&r.someProp("handleKeyDown",N=>N(r,Rt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>p.start&&Xp(u,p.start,p.endA,m,g)&&r.someProp("handleKeyDown",N=>N(r,Rt(8,"Backspace")))){mt&&Ne&&r.domObserver.suppressSelectionUpdates();return}Ne&&p.endB==p.start&&(r.input.lastChromeDelete=Date.now()),mt&&!y&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(N){return N(r,Rt(13,"Enter"))})},20));let C=p.start,k=p.endA,w,P,O;if(y){if(m.pos==g.pos)Ve&&Ot<=11&&m.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>gt(r),20)),w=r.state.tr.delete(C,k),P=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(O=Yp(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))w=r.state.tr,O.type=="add"?w.addMark(C,k,O.mark):w.removeMark(C,k,O.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let N=m.parent.textBetween(m.parentOffset,g.parentOffset);if(r.someProp("handleTextInput",E=>E(r,C,k,N)))return;w=r.state.tr.insertText(N,C,k)}}if(w||(w=r.state.tr.replace(C,k,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let N=nl(r,w.doc,c.sel);N&&!(Ne&&r.composing&&N.empty&&(p.start!=p.endB||r.input.lastChromeDelete<Date.now()-100)&&(N.head==C||N.head==w.mapping.map(k)-1)||Ve&&N.empty&&N.head==C)&&w.setSelection(N)}P&&w.ensureMarks(P),s&&w.setMeta("composition",s),r.dispatch(w.scrollIntoView())}function nl(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:is(r,e.resolve(t.anchor),e.resolve(t.head))}function Yp(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(T.from(c).eq(r))return{mark:a,type:o}}function Xp(r,e,t,n,i){if(t-e<=i.pos-n.pos||ui(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(ui(s,!0,!0));return!o.parent.isTextblock||o.pos>t||ui(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function ui(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Zp(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&r.size<e.size){let l=n<=s&&n>=o?s-n:0;s-=l,s&&s<e.size&&rl(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,s&&s<r.size&&rl(r.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function rl(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Qp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new yp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(al),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=ol(this),sl(this),this.nodeViews=ll(this),this.docView=Fo(this.state.doc,il(this),ci(this),this.dom,this),this.domObserver=new qp(this,(n,i,s,o)=>Gp(this,n,i,s,o)),this.domObserver.start(),kp(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Fi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(al),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(lc(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=ll(this);tm(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Fi(this),this.editable=ol(this),sl(this);let l=ci(this),c=il(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(i.selection))&&(o=!0);let d=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ih(this);if(o){this.domObserver.stop();let h=f&&(Ve||Ne)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&em(i.selection,e.selection);if(f){let p=Ne?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=vp(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fo(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&rp(this))?gt(this,h):(Ha(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():d&&Ph(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof K){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&vo(this,t.getBoundingClientRect(),e)}else vo(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new cc(e.slice,e.move,i<0?void 0:K.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Ve){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Rh(this.dom),gt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Lh(this,e)}coordsAtPos(e,t=1){return La(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return $h(this,t||this.state,e)}pasteHTML(e,t){return Fn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Fn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(_p(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ci(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ch())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Cp(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?De&&this.root.nodeType===11&&Oh(this.dom.ownerDocument)==this.dom&&Jp(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function il(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[Qe.node(0,r.state.doc.content.size,e)]}function sl(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:Qe.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function ol(r){return!r.someProp("editable",e=>e(r.state)===!1)}function em(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function ll(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function tm(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function al(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const nm=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function rm(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))nm?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function im(r){let e=Object.create(null);for(let t in r)e[rm(t)]=r[t];return e}function fi(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function sm(r){return new ft({props:{handleKeyDown:om(r)}})}function om(r){let e=im(r);return function(t,n){let i=Mu(n),s,o=e[fi(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[fi(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(s=wu[n.keyCode])&&s!=i){let a=e[fi(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const lm=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function pc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const am=(r,e,t)=>{let n=pc(r,t);if(!n)return!1;let i=fs(n);if(!i){let o=n.blockRange(),a=o&&_n(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(yc(r,i,e,-1))return!0;if(n.parent.content.size==0&&(bn(s,"end")||K.isSelectable(s)))for(let o=n.depth;;o--){let a=Pr(r.doc,n.before(o),n.after(o),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(bn(s,"end")?Y.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):K.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},cm=(r,e,t)=>{let n=pc(r,t);if(!n)return!1;let i=fs(n);return i?mc(r,i,e):!1},um=(r,e,t)=>{let n=gc(r,t);if(!n)return!1;let i=ds(n);return i?mc(r,i,e):!1};function mc(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Pr(r.doc,s,l,R.empty);if(!c||c.from!=s||c instanceof _e&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(G.create(u.doc,s)),t(u.scrollIntoView())}return!0}function bn(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const fm=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=fs(n)}let o=s&&s.nodeBefore;return!o||!K.isSelectable(o)?!1:(e&&e(r.tr.setSelection(K.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function fs(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function gc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const dm=(r,e,t)=>{let n=gc(r,t);if(!n)return!1;let i=ds(n);if(!i)return!1;let s=i.nodeAfter;if(yc(r,i,e,1))return!0;if(n.parent.content.size==0&&(bn(s,"start")||K.isSelectable(s))){let o=Pr(r.doc,n.before(),n.after(),R.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(bn(s,"start")?Y.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):K.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},hm=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=ds(n)}let o=s&&s.nodeAfter;return!o||!K.isSelectable(o)?!1:(e&&e(r.tr.setSelection(K.create(r.doc,s.pos)).scrollIntoView()),!0)};function ds(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const pm=(r,e)=>{let t=r.selection,n=t instanceof K,i;if(n){if(t.node.isTextblock||!Xt(r.doc,t.from))return!1;i=t.from}else if(i=Ir(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(K.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},mm=(r,e)=>{let t=r.selection,n;if(t instanceof K){if(t.node.isTextblock||!Xt(r.doc,t.to))return!1;n=t.to}else if(n=Ir(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},gm=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&_n(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},bm=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
|
|
112
|
-
`).scrollIntoView()),!0)};function bc(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const ym=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=bc(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Y.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},km=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Xe||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=bc(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(G.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},_m=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(un(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&_n(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)},Sm=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(K.create(r.doc,i))),!0)};function Cm(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Xt(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function yc(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Cm(r,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=T.empty;for(let b=o.length-1;b>=0;b--)p=T.from(o[b].create(null,p));p=T.from(i.copy(p));let m=r.tr.step(new Se(e.pos-1,h,e.pos,h,new R(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Xt(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:Y.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),d=f&&_n(f);if(d!=null&&d>=e.depth)return t&&t(r.tr.lift(f,d).scrollIntoView()),!0;if(c&&bn(s,"start",!0)&&bn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let b=T.empty;for(let _=p.length-1;_>=0;_--)b=T.from(p[_].copy(b));let y=r.tr.step(new Se(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new R(b,p.length,0),0,!0));t(y.scrollIntoView())}return!0}}return!1}function kc(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(G.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Mm=kc(-1),wm=kc(1);function Tm(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&wa(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function cl(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let u=t.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Em(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return Om(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function Om(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new yr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new yr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=wa(s,t,n,e);return a?(r&&Nm(r,e,a,i,t),!0):!1}function Nm(r,e,t,n,i){let s=T.empty;for(let u=t.length-1;u>=0;u--)s=T.from(t[u].type.create(t[u].attrs,s));r.step(new Se(e.start-(n?2:0),e.end,e.start,e.end,new R(s,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==i&&(o=u+1);let a=t.length-o,l=e.start+t.length-(n?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,d=!0;u<f;u++,d=!1)!d&&un(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return r}function Am(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?xm(e,t,r,s):Dm(e,t,s):!0:!1}}function xm(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new Se(s-1,o,s,o,new R(T.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new yr(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=_n(n);if(a==null)return!1;i.lift(n,a);let l=i.mapping.map(s,-1)-1;return Xt(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function Dm(r,e,t){let n=r.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,n.delete(h-1,h+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?T.empty:T.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return n.step(new Se(f-(a?1:0),d+(l?1:0),f+1,d-1,new R((a?T.empty:T.from(i.copy(T.empty))).append(l?T.empty:T.from(i.copy(T.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function vm(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=T.from(c?r.create():null),f=new R(T.from(r.create(null,T.from(a.type.create(null,u)))),c?3:1,0),d=s.start,h=s.end;t(e.tr.step(new Se(d-(c?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function Vr(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}class Lr{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:i}=t,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const f=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(c,t),b=h(...m)(g);return a.push(b),f}])),run:u};return f}createCan(e){const{rawCommands:t,state:n}=this,i=!1,s=e||n.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Vr({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class Im{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(i=>i.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const n=(...i)=>{this.off(e,n),t.apply(this,i)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}}function V(r,e,t){return r.config[e]===void 0&&r.parent?V(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?V(r.parent,e,t):null}):r.config[e]}function Wr(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function _c(r){const e=[],{nodeExtensions:t,markExtensions:n}=Wr(r),i=[...t,...n],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=V(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=V(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,f])=>{const d={...s,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:o.name,name:u,attribute:d})})}),e}function Ce(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}function Pm(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=n[i]?n[i].split(" "):[],c=a.filter(u=>!l.includes(u));n[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[f,d]=u.split(":").map(h=>h.trim());c.set(f,d)}),a.forEach(u=>{const[f,d]=u.split(":").map(h=>h.trim());c.set(f,d)}),n[i]=Array.from(c.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else n[i]=s}),n},{})}function Vi(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>Pm(t,n),{})}function Sc(r){return typeof r=="function"}function X(r,e=void 0,...t){return Sc(r)?e?r.bind(e)(...t):r(...t):r}function Rm(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Bm(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function ul(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Bm(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function fl(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&Rm(t)?!1:t!=null))}function zm(r,e){var t;const n=_c(r),{nodeExtensions:i,markExtensions:s}=Wr(r),o=(t=i.find(c=>V(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=n.filter(b=>b.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=r.reduce((b,y)=>{const _=V(y,"extendNodeSchema",f);return{...b,..._?_(c):{}}},{}),h=fl({...d,content:X(V(c,"content",f)),marks:X(V(c,"marks",f)),group:X(V(c,"group",f)),inline:X(V(c,"inline",f)),atom:X(V(c,"atom",f)),selectable:X(V(c,"selectable",f)),draggable:X(V(c,"draggable",f)),code:X(V(c,"code",f)),whitespace:X(V(c,"whitespace",f)),linebreakReplacement:X(V(c,"linebreakReplacement",f)),defining:X(V(c,"defining",f)),isolating:X(V(c,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),p=X(V(c,"parseHTML",f));p&&(h.parseDOM=p.map(b=>ul(b,u)));const m=V(c,"renderHTML",f);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Vi(b,u)}));const g=V(c,"renderText",f);return g&&(h.toText=g),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const u=n.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=r.reduce((g,b)=>{const y=V(b,"extendMarkSchema",f);return{...g,...y?y(c):{}}},{}),h=fl({...d,inclusive:X(V(c,"inclusive",f)),excludes:X(V(c,"excludes",f)),group:X(V(c,"group",f)),spanning:X(V(c,"spanning",f)),code:X(V(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=X(V(c,"parseHTML",f));p&&(h.parseDOM=p.map(g=>ul(g,u)));const m=V(c,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Vi(g,u)})),[c.name,h]}));return new ga({topNode:o,nodes:a,marks:l})}function di(r,e){return e.nodes[r]||e.marks[r]||null}function dl(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function hs(r,e){const t=Yt.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Fm=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,n-s))}),t};function ps(r){return Object.prototype.toString.call(r)==="[object RegExp]"}const Vm=(r,e)=>{if(ps(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function tr(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let u=!1;const f=Fm(c)+s;return o.forEach(d=>{if(u)return;const h=Vm(f,d.find);if(!h)return;const p=l.state.tr,m=Vr({state:l.state,transaction:p}),g={from:n-(h[0].length-s.length),to:i},{commands:b,chain:y,can:_}=new Lr({editor:t,state:m});d.handler({state:m,range:g,match:h,commands:b,chain:y,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:n,to:i,text:s}),l.dispatch(p),u=!0)}),u}function Lm(r){const{editor:e,rules:t}=r,n=new ft({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=hs(T.from(u),o.schema);const{from:f}=l,d=f+u.length;tr({editor:e,from:f,to:d,text:u,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return tr({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&tr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?tr({editor:e,from:o.pos,to:o.pos,text:`
|
|
113
|
-
`,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function Wm(r){return Object.prototype.toString.call(r).slice(8,-1)}function nr(r){return Wm(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function qr(r,e){const t={...r};return nr(r)&&nr(e)&&Object.keys(e).forEach(n=>{nr(e[n])&&nr(r[n])?t[n]=qr(r[n],e[n]):t[n]=e[n]}),t}class Ln{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ln(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>qr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ln(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}}function qm(r){return typeof r=="number"}const jm=(r,e,t)=>{if(ps(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Jm(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:c,can:u}=new Lr({editor:e,state:t}),f=[];return t.doc.nodesBetween(n,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(n,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");jm(b,s.find,o).forEach(_=>{if(_.index===void 0)return;const C=m+_.index+1,k=C+_[0].length,w={from:t.tr.mapping.map(C),to:t.tr.mapping.map(k)},P=s.handler({state:t,range:w,match:_,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(P)})}),f.every(h=>h!==null)}let rr=null;const $m=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",r),t};function Km(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:f,to:d,rule:h,pasteEvt:p})=>{const m=u.tr,g=Vr({state:u,transaction:m});if(!(!Jm({editor:e,state:g,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new ft({view(f){const d=p=>{var m;n=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null,n&&(rr=e)},h=()=>{rr&&(rr=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(s=n===f.dom.parentElement,a=d,!s){const h=rr;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(f,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(f,d,h)=>{const p=f[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),y=!!b;if(!m&&!g&&!y)return;if(y){let{text:k}=b;typeof k=="string"?k=k:k=hs(T.from(k),h.schema);const{from:w}=b,P=w+k.length,O=$m(k);return l({rule:u,state:h,from:w,to:{b:P},pasteEvt:O})}const _=d.doc.content.findDiffStart(h.doc.content),C=d.doc.content.findDiffEnd(h.doc.content);if(!(!qm(_)||!C||_===C.b))return l({rule:u,state:h,from:_,to:C,pasteEvt:o})}}))}function Um(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}class cn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=cn.resolve(e),this.schema=zm(this.extensions,t),this.setupExtensions()}static resolve(e){const t=cn.sort(cn.flatten(e)),n=Um(t.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},i=V(t,"addExtensions",n);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((n,i)=>{const s=V(n,"priority")||100,o=V(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:di(t.name,this.schema)},i=V(t,"addCommands",n);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=cn.sort([...this.extensions].reverse()),n=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:di(o.name,this.schema)},l=[],c=V(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&V(o,"exitable",a)&&(u.ArrowRight=()=>Ln.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const f=sm(u);l.push(f);const d=V(o,"addInputRules",a);dl(o,e.options.enableInputRules)&&d&&n.push(...d());const h=V(o,"addPasteRules",a);dl(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=V(o,"addProseMirrorPlugins",a);if(p){const m=p();l.push(...m)}return l}).flat();return[Lm({editor:e,rules:n}),...Km({editor:e,rules:i}),...s]}get attributes(){return _c(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Wr(this.extensions);return Object.fromEntries(t.filter(n=>!!V(n,"addNodeView")).map(n=>{const i=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e,type:Ce(n.name,this.schema)},o=V(n,"addNodeView",s);if(!o)return[];const a=(l,c,u,f,d)=>{const h=Vi(l,i);return o()({node:l,view:c,getPos:u,decorations:f,innerDecorations:d,editor:e,extension:n,HTMLAttributes:h})};return[n.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:di(e.name,this.schema)};e.type==="mark"&&(!((t=X(V(e,"keepOnSplit",n)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=V(e,"onBeforeCreate",n),s=V(e,"onCreate",n),o=V(e,"onUpdate",n),a=V(e,"onSelectionUpdate",n),l=V(e,"onTransaction",n),c=V(e,"onFocus",n),u=V(e,"onBlur",n),f=V(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}class tt{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new tt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>qr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new tt({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}}function Cc(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
|
|
114
|
-
|
|
115
|
-
`,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,c,u,f)=>{var d;l.isBlock&&c>n&&(a+=s);const h=o==null?void 0:o[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:f,range:e})),!1;l.isText&&(a+=(d=l==null?void 0:l.text)===null||d===void 0?void 0:d.slice(Math.max(n,c)-c,i-c))}),a}function Mc(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Hm=tt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ft({key:new Zt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Mc(t);return Cc(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Gm=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Ym=(r=!1)=>({commands:e})=>e.setContent("",r),Xm=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(l)),d=c.resolve(u.map(l+a.nodeSize)),h=f.blockRange(d);if(!h)return;const p=_n(h);if(a.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Zm=r=>e=>r(e),Qm=()=>({state:r,dispatch:e})=>km(r,e),eg=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new G(n.doc.resolve(o-1))),!0},tg=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1},ng=r=>({tr:e,state:t,dispatch:n})=>{const i=Ce(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},rg=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},ig=()=>({state:r,dispatch:e})=>lm(r,e),sg=()=>({commands:r})=>r.keyboardShortcut("Enter"),og=()=>({state:r,dispatch:e})=>ym(r,e);function Tr(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:ps(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function wc(r,e,t={}){return r.find(n=>n.type===e&&Tr(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function hl(r,e,t={}){return!!wc(r,e,t)}function Tc(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((n=i.node.marks[0])===null||n===void 0?void 0:n.attrs),!wc([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&hl([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&hl([...r.parent.child(l).marks],e,t);)c+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function vt(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}const lg=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=vt(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const f=Tc(l,s,e);if(f&&f.from<=c&&f.to>=u){const d=G.create(o,f.from,f.to);t.setSelection(d)}}return!0},ag=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function Ec(r){return r instanceof G}function Lt(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function Oc(r,e=null){if(!e)return null;const t=Y.atStart(r),n=Y.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?G.create(r,Lt(0,i,s),Lt(r.content.size,i,s)):G.create(r,Lt(e,i,s),Lt(e,i,s))}const cg=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!Ec(t.state.selection))return o(),!0;const a=Oc(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ug=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),fg=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),Nc=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&Nc(n)}return r};function ir(r){const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Nc(t)}function Er(r,e,t){if(r instanceof Tt||r instanceof T)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return T.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Er("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new ga({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Et.fromSchema(l).parseSlice(ir(r),t.parseOptions):Et.fromSchema(l).parse(ir(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Et.fromSchema(e);return t.slice?s.parseSlice(ir(r),t.parseOptions).content:s.parse(ir(r),t.parseOptions)}return Er("",e,t)}function dg(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof _e||i instanceof Se))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),r.setSelection(Y.near(r.doc.resolve(o),t))}const hg=r=>!("type"in r),pg=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;try{a=Er(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(p){return s.emit("contentError",{editor:s,error:p,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:c}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},u=!0,f=!0;if((hg(a)?a:[a]).forEach(p=>{p.check(),u=u?p.isText&&p.marks.length===0:!1,f=f?p.isBlock:!1}),l===c&&f){const{parent:p}=n.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,c+=1)}let h;if(u){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof T){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;n.insertText(h,l,c)}else h=a,n.replaceWith(l,c,h);t.updateSelection&&dg(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:l,text:h}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:l,text:h})}return!0},mg=()=>({state:r,dispatch:e})=>pm(r,e),gg=()=>({state:r,dispatch:e})=>mm(r,e),bg=()=>({state:r,dispatch:e})=>am(r,e),yg=()=>({state:r,dispatch:e})=>dm(r,e),kg=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Ir(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},_g=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Ir(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},Sg=()=>({state:r,dispatch:e})=>cm(r,e),Cg=()=>({state:r,dispatch:e})=>um(r,e);function Ac(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function xc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mg(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Ac()||xc()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}const wg=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=Mg(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const u=c.map(n.mapping);u&&i&&n.maybeStep(u)}),!0};function Wn(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?Ce(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(f,d)=>{if(f.isText)return;const h=Math.max(n,d),p=Math.min(i,d+f.nodeSize);a.push({node:f,from:h,to:p})});const l=i-n,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Tr(f.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=l}const Tg=(r,e={})=>({state:t,dispatch:n})=>{const i=Ce(r,t.schema);return Wn(t,i,e)?gm(t,n):!1},Eg=()=>({state:r,dispatch:e})=>_m(r,e),Og=r=>({state:e,dispatch:t})=>{const n=Ce(r,e.schema);return Am(n)(e,t)},Ng=()=>({state:r,dispatch:e})=>bm(r,e);function jr(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function pl(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}const Ag=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=jr(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=Ce(r,n.schema)),a==="mark"&&(o=vt(r,n.schema)),i&&t.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,pl(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&t.addMark(u,u+c.nodeSize,o.create(pl(f.attrs,e)))})})}),!0):!1},xg=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),Dg=()=>({tr:r,dispatch:e})=>{if(e){const t=new Xe(r.doc);r.setSelection(t)}return!0},vg=()=>({state:r,dispatch:e})=>fm(r,e),Ig=()=>({state:r,dispatch:e})=>hm(r,e),Pg=()=>({state:r,dispatch:e})=>Sm(r,e),Rg=()=>({state:r,dispatch:e})=>wm(r,e),Bg=()=>({state:r,dispatch:e})=>Mm(r,e);function Li(r,e,t={},n={}){return Er(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}const zg=(r,e=!1,t={},n={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,c;const{doc:u}=s;if(t.preserveWhitespace!=="full"){const f=Li(r,i.schema,t,{errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},r,{parseOptions:t,errorOnInvalidContent:(c=n.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function Dc(r,e){const t=vt(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Fg(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Vg(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function ms(r){return e=>Vg(e.$from,r)}function Lg(r,e){const t={from:0,to:r.content.size};return Cc(r,t,e)}function Wg(r,e){const t=Ce(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function qg(r,e){const t=jr(typeof e=="string"?e:e.name,r.schema);return t==="node"?Wg(r,e):t==="mark"?Dc(r,e):{}}function dr(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}function Wi(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?vt(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Tr(f.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;r.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),y=Math.min(p,g+m.nodeSize),_=y-b;o+=_,a.push(...m.marks.map(C=>({mark:C,from:b,to:y})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Tr(f.mark.attrs,t,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),c=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+c:l)>=o}function jg(r,e,t={}){if(!e)return Wn(r,null,t)||Wi(r,null,t);const n=jr(e,r.schema);return n==="node"?Wn(r,e,t):n==="mark"?Wi(r,e,t):!1}function ml(r,e){const{nodeExtensions:t}=Wr(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=X(V(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function gs(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!==null&&n!==void 0?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(gs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Jg(r,e,t){var n;const{selection:i}=e;let s=null;if(Ec(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!==null&&n!==void 0?n:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(u,f,d)=>{if(c)return!1;if(u.isInline){const h=!d||d.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const $g=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=vt(r,n.schema);if(i)if(o){const c=Dc(n,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;n.doc.nodesBetween(u,f,(d,h)=>{const p=Math.max(h,u),m=Math.min(h+d.nodeSize,f);d.marks.find(b=>b.type===l)?d.marks.forEach(b=>{l===b.type&&t.addMark(p,m,l.create({...b.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return Jg(n,t,l)},Kg=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),Ug=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=Ce(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>cl(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>cl(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Hg=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=Lt(r,0,n.content.size),s=K.create(n,i);e.setSelection(s)}return!0},Gg=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=G.atStart(n).from,a=G.atEnd(n).to,l=Lt(i,o,a),c=Lt(s,o,a),u=G.create(n,l,c);e.setSelection(u)}return!0},Yg=r=>({state:e,dispatch:t})=>{const n=Ce(r,e.schema);return vm(n)(e,t)};function gl(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e==null?void 0:e.includes(i.type.name));r.tr.ensureMarks(n)}}const Xg=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=dr(c,a.node().type.name,a.node().attrs);if(s instanceof K&&s.node.isBlock)return!a.parentOffset||!un(o,a.pos)?!1:(n&&(r&&gl(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,d=a.depth===0?void 0:Fg(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=f&&d?[{type:d,attrs:u}]:void 0,p=un(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&un(e.doc,e.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:u}]:void 0),n){if(p&&(s instanceof G&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),d&&!f&&!a.parentOffset&&a.parent.type!==d)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(a.before()),d)}r&&gl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Zg=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=Ce(r,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const f=l.node(-1);if(f.type!==a)return!1;const d=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=T.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let O=l.depth-y;O>=l.depth-3;O-=1)b=T.from(l.node(O).copy(b));const _=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...dr(d,l.node().type.name,l.node().attrs),...e},k=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(C))||void 0;b=b.append(T.from(a.createAndFill(null,k)||void 0));const w=l.before(l.depth-(y-1));t.replace(w,l.after(-_),new R(b,4-y,0));let P=-1;t.doc.nodesBetween(w,t.doc.content.size,(O,N)=>{if(P>-1)return!1;O.isTextblock&&O.content.size===0&&(P=N+1)}),P>-1&&t.setSelection(G.near(t.doc.resolve(P))),t.scrollIntoView()}return!0}const h=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,p={...dr(d,f.type.name,f.attrs),...e},m={...dr(d,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=h?[{type:a,attrs:p},{type:h,attrs:m}]:[{type:a,attrs:p}];if(!un(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:y}=n,{splittableMarks:_}=s.extensionManager,C=y||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!C||!i)return!0;const k=C.filter(w=>_.includes(w.type.name));t.ensureMarks(k)}return!0},hi=(r,e)=>{const t=ms(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&Xt(r.doc,t.pos)&&r.join(t.pos),!0},pi=(r,e)=>{const t=ms(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&Xt(r.doc,n)&&r.join(n),!0},Qg=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=Ce(r,o.schema),p=Ce(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:y}=m,_=b.blockRange(y),C=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const k=ms(w=>ml(w.type.name,f))(m);if(_.depth>=1&&k&&_.depth-k.depth<=1){if(k.node.type===h)return c.liftListItem(p);if(ml(k.node.type.name,f)&&h.validContent(k.node.content)&&a)return l().command(()=>(s.setNodeMarkup(k.pos,h),!0)).command(()=>hi(s,h)).command(()=>pi(s,h)).run()}return!t||!C||!a?l().command(()=>u().wrapInList(h,n)?!0:c.clearNodes()).wrapInList(h,n).command(()=>hi(s,h)).command(()=>pi(s,h)).run():l().command(()=>{const w=u().wrapInList(h,n),P=C.filter(O=>d.includes(O.type.name));return s.ensureMarks(P),w?!0:c.clearNodes()}).wrapInList(h,n).command(()=>hi(s,h)).command(()=>pi(s,h)).run()},eb=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=vt(r,n.schema);return Wi(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},tb=(r,e,t={})=>({state:n,commands:i})=>{const s=Ce(r,n.schema),o=Ce(e,n.schema),a=Wn(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},nb=(r,e={})=>({state:t,commands:n})=>{const i=Ce(r,t.schema);return Wn(t,i,e)?n.lift(i):n.wrapIn(i,e)},rb=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},ib=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},sb=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=vt(r,n.schema),{$from:c,empty:u,ranges:f}=a;if(!i)return!0;if(u&&o){let{from:d,to:h}=a;const p=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,m=Tc(c,l,p);m&&(d=m.from,h=m.to),t.removeMark(d,h,l)}else f.forEach(d=>{t.removeMark(d.$from.pos,d.$to.pos,l)});return t.removeStoredMark(l),!0},ob=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=jr(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=Ce(r,n.schema)),a==="mark"&&(o=vt(r,n.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let f,d,h,p;t.selection.empty?n.doc.nodesBetween(c,u,(m,g)=>{s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),f=g,d=m)}):n.doc.nodesBetween(c,u,(m,g)=>{g<c&&s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),f=g,d=m),g>=c&&g<=u&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const y=Math.max(g,c),_=Math.min(g+m.nodeSize,u);t.addMark(y,_,o.create({...b.attrs,...e}))}}))}),d&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(m=>{o===m.type&&t.addMark(h,p,o.create({...m.attrs,...e}))}))}),!0):!1},lb=(r,e={})=>({state:t,dispatch:n})=>{const i=Ce(r,t.schema);return Tm(i,e)(t,n)},ab=(r,e={})=>({state:t,dispatch:n})=>{const i=Ce(r,t.schema);return Em(i,e)(t,n)};var cb=Object.freeze({__proto__:null,blur:Gm,clearContent:Ym,clearNodes:Xm,command:Zm,createParagraphNear:Qm,cut:eg,deleteCurrentNode:tg,deleteNode:ng,deleteRange:rg,deleteSelection:ig,enter:sg,exitCode:og,extendMarkRange:lg,first:ag,focus:cg,forEach:ug,insertContent:fg,insertContentAt:pg,joinBackward:bg,joinDown:gg,joinForward:yg,joinItemBackward:kg,joinItemForward:_g,joinTextblockBackward:Sg,joinTextblockForward:Cg,joinUp:mg,keyboardShortcut:wg,lift:Tg,liftEmptyBlock:Eg,liftListItem:Og,newlineInCode:Ng,resetAttributes:Ag,scrollIntoView:xg,selectAll:Dg,selectNodeBackward:vg,selectNodeForward:Ig,selectParentNode:Pg,selectTextblockEnd:Rg,selectTextblockStart:Bg,setContent:zg,setMark:$g,setMeta:Kg,setNode:Ug,setNodeSelection:Hg,setTextSelection:Gg,sinkListItem:Yg,splitBlock:Xg,splitListItem:Zg,toggleList:Qg,toggleMark:eb,toggleNode:tb,toggleWrap:nb,undoInputRule:rb,unsetAllMarks:ib,unsetMark:sb,updateAttributes:ob,wrapIn:lb,wrapInList:ab});const ub=tt.create({name:"commands",addCommands(){return{...cb}}}),fb=tt.create({name:"drop",addProseMirrorPlugins(){return[new ft({key:new Zt("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),db=tt.create({name:"editable",addProseMirrorPlugins(){return[new ft({key:new Zt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),hb=tt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new ft({key:new Zt("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),pb=tt.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:f}=l,{pos:d,parent:h}=f,p=f.parent.isTextblock&&d>0?a.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,b=m&&p.parent.childCount===1?g===f.pos:Y.atStart(c).from===d;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.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()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"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 Ac()||xc()?s:i},addProseMirrorPlugins(){return[new ft({key:new Zt("clearDocument"),appendTransaction:(r,e,t)=>{const n=r.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=r.some(m=>m.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=Y.atStart(e.doc).from,c=Y.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!gs(t.doc))return;const d=t.tr,h=Vr({state:t,transaction:d}),{commands:p}=new Lr({editor:this.editor,state:h});if(p.clearNodes(),!!d.steps.length)return d}})]}}),mb=tt.create({name:"paste",addProseMirrorPlugins(){return[new ft({key:new Zt("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),gb=tt.create({name:"tabindex",addProseMirrorPlugins(){return[new ft({key:new Zt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Bt{get name(){return this.node.type.name}constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}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!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Bt(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Bt(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 Bt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+n+(s?0:1),a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Bt(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Bt(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else n=i;i=i.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const bb=`.ProseMirror {
|
|
116
|
-
position: relative;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.ProseMirror {
|
|
120
|
-
word-wrap: break-word;
|
|
121
|
-
white-space: pre-wrap;
|
|
122
|
-
white-space: break-spaces;
|
|
123
|
-
-webkit-font-variant-ligatures: none;
|
|
124
|
-
font-variant-ligatures: none;
|
|
125
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ProseMirror [contenteditable="false"] {
|
|
129
|
-
white-space: normal;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
133
|
-
white-space: pre-wrap;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.ProseMirror pre {
|
|
137
|
-
white-space: pre-wrap;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
img.ProseMirror-separator {
|
|
141
|
-
display: inline !important;
|
|
142
|
-
border: none !important;
|
|
143
|
-
margin: 0 !important;
|
|
144
|
-
width: 0 !important;
|
|
145
|
-
height: 0 !important;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.ProseMirror-gapcursor {
|
|
149
|
-
display: none;
|
|
150
|
-
pointer-events: none;
|
|
151
|
-
position: absolute;
|
|
152
|
-
margin: 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.ProseMirror-gapcursor:after {
|
|
156
|
-
content: "";
|
|
157
|
-
display: block;
|
|
158
|
-
position: absolute;
|
|
159
|
-
top: -2px;
|
|
160
|
-
width: 20px;
|
|
161
|
-
border-top: 1px solid black;
|
|
162
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
@keyframes ProseMirror-cursor-blink {
|
|
166
|
-
to {
|
|
167
|
-
visibility: hidden;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.ProseMirror-hideselection *::selection {
|
|
172
|
-
background: transparent;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
176
|
-
background: transparent;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.ProseMirror-hideselection * {
|
|
180
|
-
caret-color: transparent;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
184
|
-
display: block;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
188
|
-
opacity: 0
|
|
189
|
-
}`;function yb(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}class kb extends Im{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:t,slice:n,moved:i})=>this.options.onDrop(t,n,i)),this.on("paste",({event:t,slice:n})=>this.options.onPaste(t,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=yb(bb,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n=Sc(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=t.filter(a=>!a.key.startsWith(o))}),t.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[db,Hm.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),ub,hb,pb,gb,fb,mb].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new cn(i,this)}createCommandManager(){this.commandManager=new Lr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Li(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),t=Li(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=Oc(t,this.options.autofocus);this.view=new Qp(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:an.create({doc:t,selection:n||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return qg(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return jg(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return hs(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
190
|
-
|
|
191
|
-
`,textSerializers:n={}}=e||{};return Lg(this.state.doc,{blockSeparator:t,textSerializers:{...Mc(this.schema),...n}})}get isEmpty(){return gs(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Bt(t,this)}get $doc(){return this.$pos(0)}}class yn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new yn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>qr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new yn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}}const _b=yn.create({name:"doc",topNode:!0,content:"block+"}),Sb=yn.create({name:"text",group:"inline"});function bl(r,e,t){const n=r.slice();return n[18]=e[t],n}function yl(r,e,t){const n=r.slice();return n[21]=e[t],n}function kl(r,e,t){const n=r.slice();return n[29]=e[t],n}function _l(r,e,t){const n=r.slice();return n[26]=e[t],n[28]=t,n}function Sl(r,e,t){const n=r.slice();return n[21]=e[t],n}function Cl(r){let e,t,n=de(r[1].type.sidebar),i=[];for(let o=0;o<n.length;o+=1)i[o]=xl(bl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,a){if(a[0]&107){n=de(o[1].type.sidebar);let l;for(l=0;l<n.length;l+=1){const c=bl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=xl(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function Ml(r){let e,t,n=r[18].title+"",i,s,o,a,l,c;const u=[Mb,Cb],f=[];function d(h,p){return h[18].type==="toolbar"?0:h[18].type==="form"?1:-1}return~(o=d(r))&&(a=f[o]=u[o](r)),{c(){e=F("section"),t=F("h2"),i=he(n),s=$(),a&&a.c(),l=$(),j(t,"class","font-bold mb-2"),j(e,"class","mb-4")},m(h,p){A(h,e,p),B(e,t),B(t,i),B(e,s),~o&&f[o].m(e,null),B(e,l),c=!0},p(h,p){(!c||p[0]&2)&&n!==(n=h[18].title+"")&&je(i,n);let m=o;o=d(h),o===m?~o&&f[o].p(h,p):(a&&(Q(),M(f[m],1,1,()=>{f[m]=null}),ee()),~o?(a=f[o],a?a.p(h,p):(a=f[o]=u[o](h),a.c()),S(a,1),a.m(e,l)):a=null)},i(h){c||(S(a),c=!0)},o(h){M(a),c=!1},d(h){h&&x(e),~o&&f[o].d()}}}function Cb(r){let e,t,n=de(r[18].items),i=[];for(let o=0;o<n.length;o+=1)i[o]=Nl(yl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){e=F("div");for(let o=0;o<i.length;o+=1)i[o].c();j(e,"class","flex flex-row flex-wrap")},m(o,a){A(o,e,a);for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(e,null);t=!0},p(o,a){if(a[0]&107){n=de(o[18].items);let l;for(l=0;l<n.length;l+=1){const c=yl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=Nl(c),i[l].c(),S(i[l],1),i[l].m(e,null))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function Mb(r){let e,t;return e=new qn({props:{class:"flex-wrap",$$slots:{default:[Bb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i[0]&10|i[1]&2&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function wb(r){let e,t,n=r[21].title+"",i,s,o,a,l,c,u;function f(...d){return r[13](r[21],...d)}return{c(){e=F("label"),t=F("span"),i=he(n),s=$(),o=F("input"),l=$(),j(t,"data-form-field-label",""),j(o,"type","text"),o.value=a=r[3].getAttributes(r[21].mark)[r[21].name],j(o,"data-form-field-text","")},m(d,h){A(d,e,h),B(e,t),B(t,i),B(e,s),B(e,o),B(e,l),c||(u=Z(o,"change",f),c=!0)},p(d,h){r=d,h[0]&2&&n!==(n=r[21].title+"")&&je(i,n),h[0]&10&&a!==(a=r[3].getAttributes(r[21].mark)[r[21].name])&&o.value!==a&&(o.value=a)},i:ie,o:ie,d(d){d&&x(e),c=!1,u()}}}function Tb(r){let e,t;function n(...i){return r[12](r[21],...i)}return e=new Jl({props:{selected:r[6](r[21]),items:r[5](r[21]),onSelectedChange:n,$$slots:{default:[xb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s[0]&2&&(o.selected=r[6](r[21])),s[0]&2&&(o.items=r[5](r[21])),s[0]&10&&(o.onSelectedChange=n),s[0]&3|s[1]&2&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function Eb(r){let e,t,n=r[21].title+"",i,s,o,a,l,c,u;function f(...d){return r[11](r[21],...d)}return{c(){e=F("label"),t=F("span"),i=he(n),s=$(),o=F("input"),l=$(),j(t,"data-form-field-label",""),j(o,"type","text"),o.value=a=r[3].getAttributes(r[21].block)[r[21].name],j(o,"data-form-field-text","")},m(d,h){A(d,e,h),B(e,t),B(t,i),B(e,s),B(e,o),B(e,l),c||(u=Z(o,"change",f),c=!0)},p(d,h){r=d,h[0]&2&&n!==(n=r[21].title+"")&&je(i,n),h[0]&10&&a!==(a=r[3].getAttributes(r[21].block)[r[21].name])&&o.value!==a&&(o.value=a)},i:ie,o:ie,d(d){d&&x(e),c=!1,u()}}}function Ob(r){let e=r[3],t,n=Ol(r);return{c(){n.c(),t=ue()},m(i,s){n.m(i,s),A(i,t,s)},p(i,s){s[0]&8&&Pe(e,e=i[3])?(n.d(1),n=Ol(i),n.c(),n.m(t.parentNode,t)):n.p(i,s)},i:ie,o:ie,d(i){i&&x(t),n.d(i)}}}function wl(r){let e,t,n=de(r[5](r[21])),i=[];for(let o=0;o<n.length;o+=1)i[o]=Tl(kl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,a){if(a[0]&34){n=de(o[5](o[21]));let l;for(l=0;l<n.length;l+=1){const c=kl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=Tl(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function Nb(r){let e=r[29].label+"",t;return{c(){t=he(e)},m(n,i){A(n,t,i)},p(n,i){i[0]&2&&e!==(e=n[29].label+"")&&je(t,e)},d(n){n&&x(t)}}}function Tl(r){let e,t;return e=new Ul({props:{value:r[29].value,label:r[29].label,$$slots:{default:[Nb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i[0]&2&&(s.value=n[29].value),i[0]&2&&(s.label=n[29].label),i[0]&2|i[1]&2&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function Ab(r){let e,t,n=r[0][r[21].section].type.type==="textlist"&&wl(r);return{c(){n&&n.c(),e=ue()},m(i,s){n&&n.m(i,s),A(i,e,s),t=!0},p(i,s){i[0][i[21].section].type.type==="textlist"?n?(n.p(i,s),s[0]&3&&S(n,1)):(n=wl(i),n.c(),S(n,1),n.m(e.parentNode,e)):n&&(Q(),M(n,1,1,()=>{n=null}),ee())},i(i){t||(S(n),t=!0)},o(i){M(n),t=!1},d(i){i&&x(e),n&&n.d(i)}}}function xb(r){let e,t,n,i,s,o,a,l,c,u,f;return t=new Kl({props:{placeholder:"Select the text to edit","aria-label":"Select the text to edit",class:"relative pr-6 z-10 bg-transparent"}}),s=new Ee({props:{path:Ar,class:"w-6 h-6 combobox-expand"}}),a=new Ee({props:{path:Gi,class:"w-6 h-6 combobox-collapse"}}),c=new $l({props:{$$slots:{default:[Ab]},$$scope:{ctx:r}}}),{c(){e=F("div"),L(t.$$.fragment),n=$(),i=F("div"),L(s.$$.fragment),o=$(),L(a.$$.fragment),l=$(),L(c.$$.fragment),u=$(),j(i,"class","absolute top-1/2 right-0 -translate-y-1/2"),j(e,"class","relative")},m(d,h){A(d,e,h),W(t,e,null),B(e,n),B(e,i),W(s,i,null),B(i,o),W(a,i,null),A(d,l,h),W(c,d,h),A(d,u,h),f=!0},p(d,h){const p={};h[0]&3|h[1]&2&&(p.$$scope={dirty:h,ctx:d}),c.$set(p)},i(d){f||(S(t.$$.fragment,d),S(s.$$.fragment,d),S(a.$$.fragment,d),S(c.$$.fragment,d),f=!0)},o(d){M(t.$$.fragment,d),M(s.$$.fragment,d),M(a.$$.fragment,d),M(c.$$.fragment,d),f=!1},d(d){d&&(x(e),x(l),x(u)),q(t),q(s),q(a),q(c,d)}}}function El(r){let e,t=r[26].title+"",n,i;return{c(){e=F("option"),n=he(t),e.__value=i=r[26].value,Ts(e,e.__value)},m(s,o){A(s,e,o),B(e,n)},p(s,o){o[0]&2&&t!==(t=s[26].title+"")&&je(n,t),o[0]&2&&i!==(i=s[26].value)&&(e.__value=i,Ts(e,e.__value))},d(s){s&&x(e)}}}function Ol(r){let e,t,n=r[21].title+"",i,s,o,a,l,c,u,f=de(r[21].values),d=[];for(let p=0;p<f.length;p+=1)d[p]=El(_l(r,f,p));function h(...p){return r[10](r[21],...p)}return{c(){e=F("label"),t=F("span"),i=he(n),s=$(),o=F("select");for(let p=0;p<d.length;p+=1)d[p].c();l=$(),j(t,"class","sr-only"),j(o,"data-combobox-input",""),j(o,"class","bg-white")},m(p,m){A(p,e,m),B(e,t),B(t,i),B(e,s),B(e,o);for(let g=0;g<d.length;g+=1)d[g]&&d[g].m(o,null);ws(o,r[3].getAttributes(r[21].block)[r[21].name]),B(e,l),c||(u=Z(o,"change",h),c=!0)},p(p,m){if(r=p,m[0]&2&&n!==(n=r[21].title+"")&&je(i,n),m[0]&2){f=de(r[21].values);let g;for(g=0;g<f.length;g+=1){const b=_l(r,f,g);d[g]?d[g].p(b,m):(d[g]=El(b),d[g].c(),d[g].m(o,null))}for(;g<d.length;g+=1)d[g].d(1);d.length=f.length}m[0]&10&&a!==(a=r[3].getAttributes(r[21].block)[r[21].name])&&ws(o,r[3].getAttributes(r[21].block)[r[21].name])},d(p){p&&x(e),ut(d,p),c=!1,u()}}}function Nl(r){let e,t,n,i;const s=[Ob,Eb,Tb,wb],o=[];function a(l,c){return l[21].type==="select-block-attribute"?0:l[21].type==="input-block-attribute"?1:l[21].type==="select-cross-reference-attribute"?2:l[21].type==="input-mark-attribute"?3:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=ue()},m(l,c){~e&&o[e].m(l,c),A(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(Q(),M(o[u],1,1,()=>{o[u]=null}),ee()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),~e&&o[e].d(l)}}}function Db(r){let e,t;return e=new Hl({props:{class:"mx-2 border-r border-gray-300"}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function vb(r){let e,t;function n(...i){return r[9](r[21],...i)}return e=new st({props:{"aria-pressed":(r[21].type==="set-block"||r[21].type==="toggle-wrap-block")&&r[3].isActive(r[21].block)||r[21].type==="set-block-attribute"&&r[3].isActive(r[21].block,{[r[21].name]:r[21].value})||r[21].type==="toggle-mark"&&r[3].isActive(r[21].mark),title:r[21].title,$$slots:{default:[Rb]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s[0]&10&&(o["aria-pressed"]=(r[21].type==="set-block"||r[21].type==="toggle-wrap-block")&&r[3].isActive(r[21].block)||r[21].type==="set-block-attribute"&&r[3].isActive(r[21].block,{[r[21].name]:r[21].value})||r[21].type==="toggle-mark"&&r[3].isActive(r[21].mark)),s[0]&2&&(o.title=r[21].title),s[0]&2|s[1]&2&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function Ib(r){let e=r[21].title+"",t;return{c(){t=he(e)},m(n,i){A(n,t,i)},p(n,i){i[0]&2&&e!==(e=n[21].title+"")&&je(t,e)},i:ie,o:ie,d(n){n&&x(t)}}}function Pb(r){let e,t,n,i=r[21].title+"",s,o;return e=new Ee({props:{path:r[21].icon}}),{c(){L(e.$$.fragment),t=$(),n=F("span"),s=he(i),j(n,"class","sr-only")},m(a,l){W(e,a,l),A(a,t,l),A(a,n,l),B(n,s),o=!0},p(a,l){const c={};l[0]&2&&(c.path=a[21].icon),e.$set(c),(!o||l[0]&2)&&i!==(i=a[21].title+"")&&je(s,i)},i(a){o||(S(e.$$.fragment,a),o=!0)},o(a){M(e.$$.fragment,a),o=!1},d(a){a&&(x(t),x(n)),q(e,a)}}}function Rb(r){let e,t,n,i;const s=[Pb,Ib],o=[];function a(l,c){return l[21].icon?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=$()},m(l,c){o[e].m(l,c),A(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?o[e].p(l,c):(Q(),M(o[u],1,1,()=>{o[u]=null}),ee(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n))},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),o[e].d(l)}}}function Al(r){let e,t,n,i;const s=[vb,Db],o=[];function a(l,c){return l[21].type==="set-block"||l[21].type==="toggle-wrap-block"||l[21].type==="set-block-attribute"||l[21].type==="toggle-mark"?0:l[21].type==="separator"?1:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=ue()},m(l,c){~e&&o[e].m(l,c),A(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(Q(),M(o[u],1,1,()=>{o[u]=null}),ee()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),~e&&o[e].d(l)}}}function Bb(r){let e,t,n=de(r[18].items),i=[];for(let o=0;o<n.length;o+=1)i[o]=Al(Sl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,a){if(a[0]&10){n=de(o[18].items);let l;for(l=0;l<n.length;l+=1){const c=Sl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=Al(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function xl(r){let e=!r[18].condition||r[3].isActive(r[18].condition.node),t,n,i=e&&Ml(r);return{c(){i&&i.c(),t=ue()},m(s,o){i&&i.m(s,o),A(s,t,o),n=!0},p(s,o){o[0]&10&&(e=!s[18].condition||s[3].isActive(s[18].condition.node)),e?i?(i.p(s,o),o[0]&10&&S(i,1)):(i=Ml(s),i.c(),S(i,1),i.m(t.parentNode,t)):i&&(Q(),M(i,1,1,()=>{i=null}),ee())},i(s){n||(S(i),n=!0)},o(s){M(i),n=!1},d(s){s&&x(t),i&&i.d(s)}}}function zb(r){let e,t,n,i,s,o=r[1]&&r[1].type.sidebar&&r[3]&&Cl(r);return{c(){e=F("div"),t=F("div"),n=$(),i=F("div"),o&&o.c(),j(t,"class","flex-1 overflow-auto px-3 py-2"),j(i,"class","w-3/12 px-3 py-2 border-l border-gray-300 overflow-auto"),j(e,"class","flex flex-row w-full h-full overflow-hidden")},m(a,l){A(a,e,l),B(e,t),r[8](t),B(e,n),B(e,i),o&&o.m(i,null),s=!0},p(a,l){a[1]&&a[1].type.sidebar&&a[3]?o?(o.p(a,l),l[0]&10&&S(o,1)):(o=Cl(a),o.c(),S(o,1),o.m(i,null)):o&&(Q(),M(o,1,1,()=>{o=null}),ee())},i(a){s||(S(o),s=!0)},o(a){M(o),s=!1},d(a){a&&x(e),r[8](null),o&&o.d()}}}function Mn(r,e,t){r&&(e.type==="set-block"?r.chain().focus().setNode(e.block).run():e.type==="toggle-wrap-block"?r.chain().focus().toggleWrap(e.block).run():e.type==="set-block-attribute"?r.chain().focus().updateAttributes(e.block,{[e.name]:e.value}).run():e.type==="toggle-mark"?r.chain().focus().toggleMark(e.mark).run():e.type==="select-block-attribute"||e.type==="input-block-attribute"?r.chain().focus().updateAttributes(e.block,{[e.name]:t.target.value}).run():e.type==="select-cross-reference-attribute"?r.chain().focus().extendMarkRange(e.mark).updateAttributes(e.mark,{[e.name]:t.value}).run():e.type==="input-mark-attribute"&&r.chain().focus().extendMarkRange(e.mark).updateAttributes(e.mark,{[e.name]:t.target.value}).run())}function Fb(r,e,t){let n,{section:i=null}=e,{sections:s}=e,{sectionsDict:o={}}=e;const a=Ui(),l=kn("uEditorConfig");ae(r,l,k=>t(15,n=k));let c=null,u=null,f=-1;du(()=>{if(c!==null&&n.isSuccess){const k=[_b,Sb];for(let w of n.data.tei.blocks)k.push(yn.create({name:w.name,group:"block",content:w.content?w.content:"inline*",addAttributes(){return Object.fromEntries(w.attributes.map(P=>[P.name,{default:P.default,renderHTML(O){return{["data-tei-attribute-"+P.name]:O[P.name]}}}]))},renderHTML({node:P,HTMLAttributes:O}){return O["data-tei-block-"+P.type.name]="",[w.tag||"div",O,0]}}));for(let w of n.data.tei.marks)k.push(Ln.create({name:w.name,addAttributes(){return Object.fromEntries(w.attributes.map(P=>[P.name,{default:P.default,renderHTML(O){return{["data-tei-attribute-"+P.name]:O[P.name]}}}]))},renderHTML({mark:P,HTMLAttributes:O}){return O["data-tei-mark-"+P.type.name]="",[w.tag||"span",O,0]}}));t(3,u=new kb({element:c,extensions:k,content:i==null?void 0:i.content,onTransaction:({transaction:w})=>{t(3,u),w.docChanged&&(window.clearTimeout(f),f=window.setTimeout(()=>{u&&a("update",u.getJSON())},100))}}))}});function d(){i!==null&&u!==null&&u.commands.setContent(i.content)}function h(k){return o[k.section].type.type==="textlist"?o[k.section].content.map(w=>({value:w.attrs.id,label:Kt(w.content)})):[]}function p(k){if(o[k.section].type.type==="textlist"&&u){const w=o[k.section].content.filter(P=>P.attrs.id===(u==null?void 0:u.getAttributes(k.mark)[k.name]));if(w.length===1)return{value:u.getAttributes(k.mark)[k.name],label:Kt(w[0].content)}}}function m(k){Fe[k?"unshift":"push"](()=>{c=k,t(2,c)})}const g=(k,w)=>{Mn(u,k,w)},b=(k,w)=>{Mn(u,k,w)},y=(k,w)=>{Mn(u,k,w)},_=(k,w)=>{Mn(u,k,w)},C=(k,w)=>{Mn(u,k,w)};return r.$$set=k=>{"section"in k&&t(1,i=k.section),"sections"in k&&t(7,s=k.sections),"sectionsDict"in k&&t(0,o=k.sectionsDict)},r.$$.update=()=>{r.$$.dirty[0]&2&&i&&d(),r.$$.dirty[0]&128&&s&&t(0,o=Object.fromEntries(s.map(k=>[k.name,k])))},[o,i,c,u,l,h,p,s,m,g,b,y,_,C]}class vc extends Le{constructor(e){super(),We(this,e,Fb,zb,Pe,{section:1,sections:7,sectionsDict:0},null,[-1,-1])}}var Me=[];for(var mi=0;mi<256;++mi)Me.push((mi+256).toString(16).slice(1));function Vb(r,e=0){return(Me[r[e+0]]+Me[r[e+1]]+Me[r[e+2]]+Me[r[e+3]]+"-"+Me[r[e+4]]+Me[r[e+5]]+"-"+Me[r[e+6]]+Me[r[e+7]]+"-"+Me[r[e+8]]+Me[r[e+9]]+"-"+Me[r[e+10]]+Me[r[e+11]]+Me[r[e+12]]+Me[r[e+13]]+Me[r[e+14]]+Me[r[e+15]]).toLowerCase()}var sr,Lb=new Uint8Array(16);function Wb(){if(!sr&&(sr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!sr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sr(Lb)}var gi,or,bi=0,yi=0;function qb(r,e,t){var n=0,i=e||new Array(16);r=r||{};var s=r.node,o=r.clockseq;if(r._v6||(s||(s=gi),o==null&&(o=or)),s==null||o==null){var a=r.random||(r.rng||Wb)();s==null&&(s=[a[0],a[1],a[2],a[3],a[4],a[5]],!gi&&!r._v6&&(s[0]|=1,gi=s)),o==null&&(o=(a[6]<<8|a[7])&16383,or===void 0&&!r._v6&&(or=o))}var l=r.msecs!==void 0?r.msecs:Date.now(),c=r.nsecs!==void 0?r.nsecs:yi+1,u=l-bi+(c-yi)/1e4;if(u<0&&r.clockseq===void 0&&(o=o+1&16383),(u<0||l>bi)&&r.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");bi=l,yi=c,or=o,l+=122192928e5;var f=((l&268435455)*1e4+c)%4294967296;i[n++]=f>>>24&255,i[n++]=f>>>16&255,i[n++]=f>>>8&255,i[n++]=f&255;var d=l/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=d&255,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var h=0;h<6;++h)i[n+h]=s[h];return e||Vb(i)}function Dl(r,e,t){const n=r.slice();return n[16]=e[t],n}function jb(r){let e=Kt(r[16].content)+"",t;return{c(){t=he(e)},m(n,i){A(n,t,i)},p(n,i){i&4&&e!==(e=Kt(n[16].content)+"")&&je(t,e)},d(n){n&&x(t)}}}function vl(r){let e,t;return e=new Ul({props:{value:r[16].attrs.id,label:Kt(r[16].content),$$slots:{default:[jb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i&4&&(s.value=n[16].attrs.id),i&4&&(s.label=Kt(n[16].content)),i&524292&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function Jb(r){let e,t,n=de(r[2]),i=[];for(let o=0;o<n.length;o+=1)i[o]=vl(Dl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,a){if(a&4){n=de(o[2]);let l;for(l=0;l<n.length;l+=1){const c=Dl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=vl(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function $b(r){let e,t,n,i,s,o,a,l,c,u;return t=new Kl({props:{placeholder:"Select the text to edit","aria-label":"Select the text to edit",class:"relative pr-6 z-10 bg-transparent"}}),s=new Ee({props:{path:Ar,class:"w-6 h-6 combobox-expand"}}),a=new Ee({props:{path:Gi,class:"w-6 h-6 combobox-collapse"}}),c=new $l({props:{$$slots:{default:[Jb]},$$scope:{ctx:r}}}),{c(){e=F("div"),L(t.$$.fragment),n=$(),i=F("div"),L(s.$$.fragment),o=$(),L(a.$$.fragment),l=$(),L(c.$$.fragment),j(i,"class","absolute top-1/2 right-0 -translate-y-1/2"),j(e,"class","relative")},m(f,d){A(f,e,d),W(t,e,null),B(e,n),B(e,i),W(s,i,null),B(i,o),W(a,i,null),A(f,l,d),W(c,f,d),u=!0},p(f,d){const h={};d&524292&&(h.$$scope={dirty:d,ctx:f}),c.$set(h)},i(f){u||(S(t.$$.fragment,f),S(s.$$.fragment,f),S(a.$$.fragment,f),S(c.$$.fragment,f),u=!0)},o(f){M(t.$$.fragment,f),M(s.$$.fragment,f),M(a.$$.fragment,f),M(c.$$.fragment,f),u=!1},d(f){f&&(x(e),x(l)),q(t),q(s),q(a),q(c,f)}}}function Kb(r){let e,t;return e=new Ee({props:{path:Hi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function Ub(r){let e,t;return e=new Ee({props:{path:Yi}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p:ie,i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function Hb(r){let e,t,n,i;return e=new st({props:{"aria-label":"Add a text",title:"Add a text",$$slots:{default:[Kb]},$$scope:{ctx:r}}}),e.$on("click",r[7]),n=new st({props:{"aria-label":"Delete the current text",title:"Delete the current text","aria-disabled":r[1].value===null?"true":null,$$slots:{default:[Ub]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{c(){L(e.$$.fragment),t=$(),L(n.$$.fragment)},m(s,o){W(e,s,o),A(s,t,o),W(n,s,o),i=!0},p(s,o){const a={};o&524288&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const l={};o&2&&(l["aria-disabled"]=s[1].value===null?"true":null),o&524288&&(l.$$scope={dirty:o,ctx:s}),n.$set(l)},i(s){i||(S(e.$$.fragment,s),S(n.$$.fragment,s),i=!0)},o(s){M(e.$$.fragment,s),M(n.$$.fragment,s),i=!1},d(s){s&&x(t),q(e,s),q(n,s)}}}function Il(r){let e,t;return e=new vc({props:{section:r[3],sections:r[0]}}),e.$on("update",r[6]),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i&8&&(s.section=n[3]),i&1&&(s.sections=n[0]),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function Gb(r){let e;return{c(){e=he("Delete Text")},m(t,n){A(t,e,n)},d(t){t&&x(e)}}}function Yb(r){let e;return{c(){e=he("Don't delete")},m(t,n){A(t,e,n)},d(t){t&&x(e)}}}function Xb(r){let e,t,n,i,s,o=r[1].label+"",a,l,c,u,f,d,h,p,m,g;return e=new yu({props:{$$slots:{default:[Gb]},$$scope:{ctx:r}}}),f=new ku({props:{"data-button":!0,$$slots:{default:[Yb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment),t=$(),n=F("form"),i=F("p"),s=he("Please confirm that you wish to delete the text "),a=he(o),l=he("."),c=$(),u=F("div"),L(f.$$.fragment),d=$(),h=F("button"),h.textContent="Delete",j(h,"type","submit"),j(h,"data-button",""),j(u,"data-dialog-buttons",""),j(n,"data-dialog-content-area","")},m(b,y){W(e,b,y),A(b,t,y),A(b,n,y),B(n,i),B(i,s),B(i,a),B(i,l),B(n,c),B(n,u),W(f,u,null),B(u,d),B(u,h),p=!0,m||(g=Z(n,"submit",r[8]),m=!0)},p(b,y){const _={};y&524288&&(_.$$scope={dirty:y,ctx:b}),e.$set(_),(!p||y&2)&&o!==(o=b[1].label+"")&&je(a,o);const C={};y&524288&&(C.$$scope={dirty:y,ctx:b}),f.$set(C)},i(b){p||(S(e.$$.fragment,b),S(f.$$.fragment,b),p=!0)},o(b){M(e.$$.fragment,b),M(f.$$.fragment,b),p=!1},d(b){b&&(x(t),x(n)),q(e,b),q(f),m=!1,g()}}}function Zb(r){let e,t,n,i;return e=new gu({}),n=new bu({props:{$$slots:{default:[Xb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment),t=$(),L(n.$$.fragment)},m(s,o){W(e,s,o),A(s,t,o),W(n,s,o),i=!0},p(s,o){const a={};o&524290&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(S(e.$$.fragment,s),S(n.$$.fragment,s),i=!0)},o(s){M(e.$$.fragment,s),M(n.$$.fragment,s),i=!1},d(s){s&&x(t),q(e,s),q(n,s)}}}function Qb(r){let e,t,n,i;return e=new pu({props:{class:"hidden"}}),n=new mu({props:{$$slots:{default:[Zb]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment),t=$(),L(n.$$.fragment)},m(s,o){W(e,s,o),A(s,t,o),W(n,s,o),i=!0},p(s,o){const a={};o&524290&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(S(e.$$.fragment,s),S(n.$$.fragment,s),i=!0)},o(s){M(e.$$.fragment,s),M(n.$$.fragment,s),i=!1},d(s){s&&x(t),q(e,s),q(n,s)}}}function e1(r){let e,t,n,i,s,o,a,l,c,u,f,d;function h(y){r[11](y)}let p={items:r[2].map(r[10]),$$slots:{default:[$b]},$$scope:{ctx:r}};r[1]!==void 0&&(p.selected=r[1]),n=new Jl({props:p}),Fe.push(()=>Es(n,"selected",h)),o=new qn({props:{$$slots:{default:[Hb]},$$scope:{ctx:r}}});let m=r[3]!==null&&Il(r);function g(y){r[13](y)}let b={$$slots:{default:[Qb]},$$scope:{ctx:r}};return r[4]!==void 0&&(b.open=r[4]),u=new hu({props:b}),Fe.push(()=>Es(u,"open",g)),{c(){e=F("div"),t=F("div"),L(n.$$.fragment),s=$(),L(o.$$.fragment),a=$(),l=F("div"),m&&m.c(),c=$(),L(u.$$.fragment),j(t,"class","flex flex-row items-center space-x-4 border-b border-gray-300 px-2 py-1"),j(l,"class","flex-1 overflow-hidden"),j(e,"class","flex flex-col w-full h-full overflow-hidden")},m(y,_){A(y,e,_),B(e,t),W(n,t,null),B(t,s),W(o,t,null),B(e,a),B(e,l),m&&m.m(l,null),A(y,c,_),W(u,y,_),d=!0},p(y,[_]){const C={};_&4&&(C.items=y[2].map(y[10])),_&524292&&(C.$$scope={dirty:_,ctx:y}),!i&&_&2&&(i=!0,C.selected=y[1],Os(()=>i=!1)),n.$set(C);const k={};_&524306&&(k.$$scope={dirty:_,ctx:y}),o.$set(k),y[3]!==null?m?(m.p(y,_),_&8&&S(m,1)):(m=Il(y),m.c(),S(m,1),m.m(l,null)):m&&(Q(),M(m,1,1,()=>{m=null}),ee());const w={};_&524290&&(w.$$scope={dirty:_,ctx:y}),!f&&_&16&&(f=!0,w.open=y[4],Os(()=>f=!1)),u.$set(w)},i(y){d||(S(n.$$.fragment,y),S(o.$$.fragment,y),S(m),S(u.$$.fragment,y),d=!0)},o(y){M(n.$$.fragment,y),M(o.$$.fragment,y),M(m),M(u.$$.fragment,y),d=!1},d(y){y&&(x(e),x(c)),q(n),q(o),m&&m.d(),q(u,y)}}}function t1(r,e,t){let n,{section:i=null}=e,{sections:s}=e;const o=Ui(),a=kn("uEditorConfig");ae(r,a,_=>t(14,n=_));let l={value:null},c=[],u=null,f=!1;function d(_){if(l.value!==null&&i){const C=c.filter(k=>k.attrs.id===l.value);C.length===1&&(C[0].content=_.detail),o("update",c)}}function h(){var _;n.isSuccess&&((_=n.data)==null?void 0:_.tei.blocks.length)>0&&(c.push({attrs:{id:(i==null?void 0:i.name)+"-"+qb()},content:{type:"doc",content:[{type:n.data.tei.blocks[0].name,attrs:{},content:[{type:"text",marks:[],text:"New"}]}]}}),o("update",c))}function p(_){_.preventDefault(),t(4,f=!1);let C=-1;for(let k=0;k<c.length;k++)if(l.value==c[k].attrs.id){C=k;break}C>=0&&(c.splice(C,1),t(1,l={value:null}),t(3,u=null),o("update",c))}const m=_=>({value:_.attrs.id,label:Kt(_.content)});function g(_){l=_,t(1,l)}const b=()=>{t(4,f=!0)};function y(_){f=_,t(4,f)}return r.$$set=_=>{"section"in _&&t(9,i=_.section),"sections"in _&&t(0,s=_.sections)},r.$$.update=()=>{if(r.$$.dirty&512&&(i!==null?t(2,c=i.content):t(2,c=[])),r.$$.dirty&518)if(l.value!==null&&i){const _=c.filter(C=>C.attrs.id===l.value);_.length===1?t(3,u={name:"",title:"",type:{name:"",title:"",type:"text",selector:"",sidebar:i.type.sidebar},content:_[0].content}):t(3,u=null)}else t(3,u=null)},[s,l,c,u,f,a,d,h,p,i,m,g,b,y]}class n1 extends Le{constructor(e){super(),We(this,e,t1,e1,Pe,{section:9,sections:0})}}function Pl(r,e,t){const n=r.slice();return n[17]=e[t],n[19]=t,n}function Rl(r,e,t){const n=r.slice();return n[17]=e[t],n}function r1(r){let e,t;return e=new Cu({props:{$$slots:{default:[o1]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i&4194304&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function i1(r){let e;return{c(){e=F("p"),e.textContent=`There was an error loading this TEI file. The most likely cause is a TEI tag
|
|
192
|
-
that is not configured. Please check your server logs for details.`,j(e,"class","px-4 py-2 text-red-800")},m(t,n){A(t,e,n)},p:ie,i:ie,o:ie,d(t){t&&x(e)}}}function s1(r){let e,t,n,i,s;return t=new Df({props:{class:"flex-1 flex flex-col",$$slots:{default:[h1]},$$scope:{ctx:r}}}),{c(){e=F("div"),L(t.$$.fragment),j(e,"class","flex-1 flex overflow-hidden")},m(o,a){A(o,e,a),W(t,e,null),n=!0,i||(s=Z(e,"keydown",r[6]),i=!0)},p(o,a){const l={};a&4194308&&(l.$$scope={dirty:a,ctx:o}),t.$set(l)},i(o){n||(S(t.$$.fragment,o),n=!0)},o(o){M(t.$$.fragment,o),n=!1},d(o){o&&x(e),q(t),i=!1,s()}}}function o1(r){let e;return{c(){e=he("Loading the TEI file. Please wait...")},m(t,n){A(t,e,n)},d(t){t&&x(e)}}}function l1(r){let e=r[17].type.title+"",t;return{c(){t=he(e)},m(n,i){A(n,t,i)},p(n,i){i&4&&e!==(e=n[17].type.title+"")&&je(t,e)},d(n){n&&x(t)}}}function Bl(r){let e,t;return e=new Zf({props:{value:r[17].type.name,$$slots:{default:[l1]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i&4&&(s.value=n[17].type.name),i&4194308&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function a1(r){let e,t,n=de(r[2]),i=[];for(let o=0;o<n.length;o+=1)i[o]=Bl(Rl(r,n,o));const s=o=>M(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=ue()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);A(o,e,a),t=!0},p(o,a){if(a&4){n=de(o[2]);let l;for(l=0;l<n.length;l+=1){const c=Rl(o,n,l);i[l]?(i[l].p(c,a),S(i[l],1)):(i[l]=Bl(c),i[l].c(),S(i[l],1),i[l].m(e.parentNode,e))}for(Q(),l=n.length;l<i.length;l+=1)s(l);ee()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)S(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)M(i[a]);t=!1},d(o){o&&x(e),ut(i,o)}}}function c1(r){let e,t;function n(...i){return r[9](r[19],...i)}return e=new n1({props:{section:r[17],sections:r[2]}}),e.$on("update",n),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s&4&&(o.section=r[17]),s&4&&(o.sections=r[2]),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function u1(r){let e,t;function n(...i){return r[8](r[19],...i)}return e=new vc({props:{section:r[17],sections:r[2]}}),e.$on("update",n),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s&4&&(o.section=r[17]),s&4&&(o.sections=r[2]),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function f1(r){let e,t;function n(...i){return r[7](r[19],...i)}return e=new wd({props:{section:r[17]}}),e.$on("update",n),{c(){L(e.$$.fragment)},m(i,s){W(e,i,s),t=!0},p(i,s){r=i;const o={};s&4&&(o.section=r[17]),e.$set(o)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){M(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function d1(r){let e,t,n,i;const s=[f1,u1,c1],o=[];function a(l,c){return l[17].type.type==="metadata"?0:l[17].type.type==="text"?1:l[17].type.type==="textlist"?2:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=$()},m(l,c){~e&&o[e].m(l,c),A(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(Q(),M(o[u],1,1,()=>{o[u]=null}),ee()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),S(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(S(t),i=!0)},o(l){M(t),i=!1},d(l){l&&x(n),~e&&o[e].d(l)}}}function zl(r){let e,t;return e=new Ff({props:{value:r[17].type.name,class:"flex-1 overflow-hidden",$$slots:{default:[d1]},$$scope:{ctx:r}}}),{c(){L(e.$$.fragment)},m(n,i){W(e,n,i),t=!0},p(n,i){const s={};i&4&&(s.value=n[17].type.name),i&4194308&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(S(e.$$.fragment,n),t=!0)},o(n){M(e.$$.fragment,n),t=!1},d(n){q(e,n)}}}function h1(r){let e,t,n,i;e=new $f({props:{$$slots:{default:[a1]},$$scope:{ctx:r}}});let s=de(r[2]),o=[];for(let l=0;l<s.length;l+=1)o[l]=zl(Pl(r,s,l));const a=l=>M(o[l],1,1,()=>{o[l]=null});return{c(){L(e.$$.fragment),t=$();for(let l=0;l<o.length;l+=1)o[l].c();n=ue()},m(l,c){W(e,l,c),A(l,t,c);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(l,c);A(l,n,c),i=!0},p(l,c){const u={};if(c&4194308&&(u.$$scope={dirty:c,ctx:l}),e.$set(u),c&36){s=de(l[2]);let f;for(f=0;f<s.length;f+=1){const d=Pl(l,s,f);o[f]?(o[f].p(d,c),S(o[f],1)):(o[f]=zl(d),o[f].c(),S(o[f],1),o[f].m(n.parentNode,n))}for(Q(),f=s.length;f<o.length;f+=1)a(f);ee()}},i(l){if(!i){S(e.$$.fragment,l);for(let c=0;c<s.length;c+=1)S(o[c]);i=!0}},o(l){M(e.$$.fragment,l),o=o.filter(Boolean);for(let c=0;c<o.length;c+=1)M(o[c]);i=!1},d(l){l&&(x(t),x(n)),q(e,l),ut(o,l)}}}function p1(r){var d;let e,t=((d=r[1])==null?void 0:d.name)+"",n,i,s,o,a,l;const c=[s1,i1,r1],u=[];function f(h,p){return h[2]?0:h[0]?1:2}return s=f(r),o=u[s]=c[s](r),{c(){e=F("h1"),n=he(t),i=$(),o.c(),a=ue(),j(e,"class","sr-only")},m(h,p){A(h,e,p),B(e,n),A(h,i,p),u[s].m(h,p),A(h,a,p),l=!0},p(h,[p]){var g;(!l||p&2)&&t!==(t=((g=h[1])==null?void 0:g.name)+"")&&je(n,t);let m=s;s=f(h),s===m?u[s].p(h,p):(Q(),M(u[m],1,1,()=>{u[m]=null}),ee(),o=u[s],o?o.p(h,p):(o=u[s]=c[s](h),o.c()),S(o,1),o.m(a.parentNode,a))},i(h){l||(S(o),l=!0)},o(h){M(o),l=!1},d(h){h&&(x(e),x(i),x(a)),u[s].d(h)}}}function m1(r,e,t){let n,i,s,o;ae(r,Yn,C=>t(13,n=C)),ae(r,Ns,C=>t(1,i=C));let a=[],l=-1,c=[],u=!1;const f=kn("uEditorConfig"),d=_u();ae(r,d,C=>t(14,s=C));const h=_t([f,Ns],([C,k],w)=>{C.isSuccess&&k&&k.name.endsWith(".tei")&&(t(0,u=!1),c=[],a=[],Yn.set(null),tn.set(!1),As({action:"LoadTextFile",branch:s,filename:k.fullpath,callback:P=>{try{a=JSON.parse(P),c=JSON.parse(P),Yn.set(P),tn.set(!1);const O=JSON.parse(P),N=[];for(let E of C.data.tei.sections)for(let v of O)if(E.name===v.name){v.type=E,N.push(v);break}w(N)}catch{t(0,u=!0),w(null)}}}))},null);ae(r,h,C=>t(2,o=C));const p=tn.subscribe(C=>{if(!C&&n)try{c=JSON.parse(n)}catch{}});function m(C,k){a[C].type==="text"||a[C].type==="textlist"?a[C].content=k.detail:a[C].type==="metadata"&&(a[C].content=k.detail.content),window.clearTimeout(l),l=window.setTimeout(()=>{Dr(a,c)?tn.set(!1):(Yn.set(JSON.stringify(a)),tn.set(!0))},100)}function g(C){i!==null&&n!==null&&C.key==="s"&&(C.ctrlKey||C.metaKey)&&(C.preventDefault(),As({action:"SaveCurrentFile",branch:s,filename:i.fullpath,data:n,callback(){tn.set(!1)}}))}return Su(p),[u,i,o,d,h,m,g,(C,k)=>{m(C,k)},(C,k)=>{m(C,k)},(C,k)=>{m(C,k)}]}class y1 extends Le{constructor(e){super(),We(this,e,m1,p1,Pe,{})}}export{y1 as default};
|