uEdition-Editor 2.0.0b9__py3-none-any.whl → 2.0.0b10__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/frontend/dist/assets/{CodeMirrorEditor-B5Rlo82N.js → CodeMirrorEditor-DaVvZ_iF.js} +1 -1
- uedition_editor/frontend/dist/assets/{FolderEditor-CKMB6ngt.js → FolderEditor-BRCtr0pK.js} +1 -1
- uedition_editor/frontend/dist/assets/{ImageEditor-TAWAZQYx.js → ImageEditor-Bi68IyPx.js} +1 -1
- uedition_editor/frontend/dist/assets/TeiEditor-Cl1q8UQU.js +192 -0
- uedition_editor/frontend/dist/assets/index-BcAJnzER.js +18 -0
- uedition_editor/frontend/dist/index.html +1 -1
- {uedition_editor-2.0.0b9.dist-info → uedition_editor-2.0.0b10.dist-info}/METADATA +1 -1
- {uedition_editor-2.0.0b9.dist-info → uedition_editor-2.0.0b10.dist-info}/RECORD +12 -12
- uedition_editor/frontend/dist/assets/TeiEditor-B18T9sYP.js +0 -192
- uedition_editor/frontend/dist/assets/index-CS7Yn65-.js +0 -18
- {uedition_editor-2.0.0b9.dist-info → uedition_editor-2.0.0b10.dist-info}/WHEEL +0 -0
- {uedition_editor-2.0.0b9.dist-info → uedition_editor-2.0.0b10.dist-info}/entry_points.txt +0 -0
- {uedition_editor-2.0.0b9.dist-info → uedition_editor-2.0.0b10.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import{T as Ge,U as jc,V as ql,W as Jc,X as Ke,Y as lt,Z as Cs,_ as Vt,$ as Si,a0 as St,a1 as Ci,a2 as pr,a3 as $i,a4 as Kc,a5 as $c,a6 as Uc,a7 as Mn,a8 as Hc,a9 as Gc,aa as mr,ab as an,ac as Y,ad as Ms,ae as lr,af as ar,ag as Yc,ah as ws,ai as Xc,aj as Zc,ak as jl,al as Jl,am as Kl,an as Ts,ao as Tn,ap as Qc,aq as eu,ar as tu,as as nu,at as ru,au as iu,av as su,aw as An,ax as ou,ay as lu,az as au,aA as Mi,aB as cr,aC as cu,aD as uu,aE as Es,aF as fu,aG as Ui,aH as Hi,aI as Dr,aJ as Gi,aK as pn,aL as du,S as qe,i as je,s as Ae,aM as ge,aN as be,aO as ye,aP as ke,k,h as S,m as oe,J as de,c as N,g as re,j as ie,l as A,aQ as ve,aR as xr,aS as se,aT as vt,aU as mt,v as Re,e as B,aV as le,aW as Je,C as te,aX as Ve,F as ft,aY as $l,aZ as Yi,a_ as Ul,a$ as Os,w as ne,t as he,f as Ie,b0 as hu,b1 as fe,b2 as it,a as K,b as J,d as R,A as V,B as L,E as W,I as we,b3 as pu,b4 as vr,K as Xi,b5 as mu,b6 as Sn,b7 as et,b8 as Zi,b9 as Qi,ba as es,bb as gu,bc as Hl,bd as bu,p as yu,be as xt,bf as gr,bg as br,bh as ku,P as wi,bi as _u,Q as Ti,bj as Su,bk as Cu,bl as Mu,bm as wu,bn as Tu,bo as Eu,bp as Ou,L as Yn,n as Ns,o as Nu,u as Au,O as tn,N as As,q as Du,R as xu}from"./index-BcAJnzER.js";import{k as vu,b as Iu}from"./index-Vcq4gwWv.js";function Qr(r){return Array.from(r.querySelectorAll('[role="option"]:not([data-disabled])')).filter(e=>Ge(e))}function Pu(r){return window.getComputedStyle(r).getPropertyValue("direction")}function Ru(r){return e=>{const t=e.target,n=jc(r);if(!n||!ql(t))return!1;const i=n.id;return!!(Jc(t)&&i===t.htmlFor||t.closest(`label[for="${i}"]`))}}function Bu(){return{elements:{root:Ke("label",{action:e=>({destroy:lt(e,"mousedown",n=>{!n.defaultPrevented&&n.detail>1&&n.preventDefault()})})})}}}const zu=[Y.ARROW_LEFT,Y.ESCAPE,Y.ARROW_RIGHT,Y.SHIFT,Y.CAPS_LOCK,Y.CONTROL,Y.ALT,Y.META,Y.ENTER,Y.F1,Y.F2,Y.F3,Y.F4,Y.F5,Y.F6,Y.F7,Y.F8,Y.F9,Y.F10,Y.F11,Y.F12],Fu={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},Vu=["trigger","menu","label"];function Lu(r){const e={...Fu,...r},t=Cs(Vt(null)),n=Cs(Vt(null)),i=e.selected??Vt(e.defaultSelected),s=Si(i,e==null?void 0:e.onSelectedChange),o=St(n,P=>P?I(P):void 0),a=e.open??Vt(e.defaultOpen),l=Si(a,e==null?void 0:e.onOpenChange),c=Ci({...pr(e,"open","defaultOpen","builder","ids"),multiple:e.multiple??!1}),{scrollAlignment:u,loop:f,closeOnOutsideClick:d,closeOnEscape:p,preventScroll:h,portal:m,forceVisible:g,positioning:b,multiple:y,arrowSize:C,disabled:w,required:_,typeahead:T,name:j,highlightOnHover:v,onOutsideClick:D}=c,{name:M,selector:x}=$i(e.builder),U=Ci({...Kc(Vu),...e.ids}),{handleTypeaheadSearch:Q}=$c({onMatch:P=>{n.set(P),P.scrollIntoView({block:u.get()})},getCurrentItem(){return n.get()}});function I(P){const $=P.getAttribute("data-value"),ae=P.getAttribute("data-label"),He=P.hasAttribute("data-disabled");return{value:$&&JSON.parse($),label:ae??P.textContent??void 0,disabled:!!He}}const G=P=>{s.update($=>{if(y.get()){const He=Array.isArray($)?[...$]:[];return cu(P,He,(en,ue)=>Mn(en.value,ue.value))}return P})};function O(P){const $=I(P);G($)}async function pe(){l.set(!0);const P=document.getElementById(U.trigger.get());if(!P)return;P!==t.get()&&t.set(P),await lr();const $=document.getElementById(U.menu.get());if(!Ge($))return;const ae=$.querySelector("[aria-selected=true]");Ge(ae)&&n.set(ae)}function Ue(){l.set(!1),n.set(null)}const $n=Uc({open:l,forceVisible:g,activeTrigger:t}),Un=St([s],([P])=>$=>Array.isArray(P)?P.some(ae=>Mn(ae.value,$)):Hc($)?Mn(P==null?void 0:P.value,Gc($,void 0)):Mn(P==null?void 0:P.value,$)),Ur=St([o],([P])=>$=>Mn(P==null?void 0:P.value,$)),Hr=Ke(M("trigger"),{stores:[l,n,w,U.menu,U.trigger,U.label],returned:([P,$,ae,He,en,ue])=>({"aria-activedescendant":$==null?void 0:$.id,"aria-autocomplete":"list","aria-controls":He,"aria-expanded":P,"aria-labelledby":ue,id:en,role:"combobox",disabled:mr(ae),type:e.builder==="select"?"button":void 0}),action:P=>{const $=Mi(P),ae=an(lt(P,"click",()=>{P.focus(),l.get()?Ue():pe()}),lt(P,"keydown",ue=>{if(!l.get()){if(zu.includes(ue.key)||ue.key===Y.TAB||ue.key===Y.BACKSPACE&&$&&P.value===""||ue.key===Y.SPACE&&Ms(P))return;pe(),lr().then(()=>{if(s.get())return;const Rt=document.getElementById(U.menu.get());if(!Ge(Rt))return;const _e=Array.from(Rt.querySelectorAll(`${x("item")}:not([data-disabled]):not([data-hidden])`)).filter(yt=>Ge(yt));_e.length&&(ue.key===Y.ARROW_DOWN?(n.set(_e[0]),_e[0].scrollIntoView({block:u.get()})):ue.key===Y.ARROW_UP&&(n.set(ar(_e)),ar(_e).scrollIntoView({block:u.get()})))})}if(ue.key===Y.TAB){Ue();return}if(ue.key===Y.ENTER&&!ue.isComposing||ue.key===Y.SPACE&&Ms(P)){ue.preventDefault();const Le=n.get();Le&&O(Le),y.get()||Ue()}if(ue.key===Y.ARROW_UP&&ue.altKey&&Ue(),Yc.includes(ue.key)){ue.preventDefault();const Le=document.getElementById(U.menu.get());if(!Ge(Le))return;const Rt=Qr(Le);if(!Rt.length)return;const _e=Rt.filter(Ss=>!ws(Ss)&&Ss.dataset.hidden===void 0),yt=n.get(),Bt=yt?_e.indexOf(yt):-1,Gn=f.get(),qc=u.get();let st;switch(ue.key){case Y.ARROW_DOWN:st=Jl(_e,Bt,Gn);break;case Y.ARROW_UP:st=jl(_e,Bt,Gn);break;case Y.PAGE_DOWN:st=Zc(_e,Bt,10,Gn);break;case Y.PAGE_UP:st=Xc(_e,Bt,10,Gn);break;case Y.HOME:st=_e[0];break;case Y.END:st=ar(_e);break;default:return}n.set(st),st==null||st.scrollIntoView({block:qc})}else if(T.get()){const Le=document.getElementById(U.menu.get());if(!Ge(Le))return;Q(ue.key,Qr(Le))}}));let He=cr;return He=Kl(P,{handler:Ue,enabled:St([l,p],([ue,Hn])=>ue&&Hn)}).destroy,{destroy(){ae(),He()}}}}),Gr=Ke(M("menu"),{stores:[$n,U.menu],returned:([P,$])=>({hidden:P?void 0:!0,id:$,role:"listbox",style:Ts({display:P?void 0:"none"})}),action:P=>{let $=cr;const ae=an(Tn([$n,m,d,b,t],([He,en,ue,Hn,Le])=>{$(),!(!He||!Le)&&lr().then(()=>{$();const Rt=Ru(U.trigger.get());$=Qc(P,{anchorElement:Le,open:l,options:{floating:Hn,focusTrap:null,modal:{closeOnInteractOutside:ue,onClose:Ue,open:He,shouldCloseOnInteractOutside:_e=>{var Bt;if((Bt=D.get())==null||Bt(_e),_e.defaultPrevented)return!1;const yt=_e.target;return!(!ql(yt)||yt===Le||Le.contains(yt)||Rt(_e))}},escapeKeydown:null,portal:eu(P,en)}}).destroy})}));return{destroy:()=>{ae(),$()}}}}),{elements:{root:Yr}}=Bu(),{action:Xr}=tu(Yr),Zr=Ke(M("label"),{stores:[U.label,U.trigger],returned:([P,$])=>({id:P,for:$}),action:Xr}),F=Ke(M("option"),{stores:[Un],returned:([P])=>$=>{const ae=P($.value);return{"data-value":JSON.stringify($.value),"data-label":$.label,"data-disabled":mr($.disabled),"aria-disabled":$.disabled?!0:void 0,"aria-selected":ae,"data-selected":ae?"":void 0,id:nu(),role:"option"}},action:P=>({destroy:an(lt(P,"click",ae=>{if(ws(P)){ae.preventDefault();return}O(P),y.get()||Ue()}),Tn(v,ae=>ae?an(lt(P,"mouseover",()=>{n.set(P)}),lt(P,"mouseleave",()=>{n.set(null)})):void 0))})}),Fc=Ke(M("group"),{returned:()=>P=>({role:"group","aria-labelledby":P})}),Vc=Ke(M("group-label"),{returned:()=>P=>({id:P})}),Lc=ru({value:St([s],([P])=>{const $=Array.isArray(P)?P.map(ae=>ae.value):P==null?void 0:P.value;return typeof $=="string"?$:JSON.stringify($)}),name:iu(j),required:_,prefix:e.builder}),Wc=Ke(M("arrow"),{stores:C,returned:P=>({"data-arrow":!0,style:Ts({position:"absolute",width:`var(--arrow-size, ${P}px)`,height:`var(--arrow-size, ${P}px)`})})});return su(()=>{if(!An)return;const P=document.getElementById(U.menu.get()),$=document.getElementById(U.trigger.get());if($&&t.set($),!P)return;const ae=P.querySelector("[data-selected]");Ge(ae)}),Tn([n],([P])=>{if(!An)return;const $=document.getElementById(U.menu.get());Ge($)&&Qr($).forEach(ae=>{ae===P?ou(ae):lu(ae)})}),Tn([l],([P])=>{if(!An)return;let $=cr;return h.get()&&P&&($=au()),()=>{$()}}),{ids:U,elements:{trigger:Hr,group:Fc,option:F,menu:Gr,groupLabel:Vc,label:Zr,hiddenInput:Lc,arrow:Wc},states:{open:l,selected:s,highlighted:o,highlightedItem:n},helpers:{isSelected:Un,isHighlighted:Ur,closeMenu:Ue},options:c}}const{name:Wu}=$i("combobox");function qu(r){const e=Lu({...r,builder:"combobox",typeahead:!1}),t=Vt(""),n=Vt(!1),i=Ke(Wu("input"),{stores:[e.elements.trigger,t],returned:([s,o])=>({...pr(s,"action"),role:"combobox",value:o,autocomplete:"off"}),action:s=>{const o=an(lt(s,"input",u=>{!Mi(u.target)&&!Es(u.target)||n.set(!0)}),uu(s,"input",u=>{Mi(u.target)&&t.set(u.target.value),Es(u.target)&&t.set(u.target.innerText)}));let a=cr;a=Kl(s,{handler:()=>{e.helpers.closeMenu()}}).destroy;const{destroy:c}=e.elements.trigger(s);return{destroy(){c==null||c(),o(),a()}}}});return Tn(e.states.open,s=>{s||n.set(!1)}),{...e,elements:{...pr(e.elements,"trigger"),input:i},states:{...e.states,touchedInput:n,inputValue:t}}}const ju={orientation:"horizontal",activateOnFocus:!0,loop:!0,autoSet:!0},{name:Xn,selector:Ju}=$i("tabs");function Ku(r){const e={...ju,...r},t=Ci(pr(e,"defaultValue","value","onValueChange","autoSet")),{orientation:n,activateOnFocus:i,loop:s}=t,o=e.value??Vt(e.defaultValue),a=Si(o,e==null?void 0:e.onValueChange);let l=e.defaultValue??a.get();const c=Ke(Xn(),{stores:n,returned:h=>({"data-orientation":h})}),u=Ke(Xn("list"),{stores:n,returned:h=>({role:"tablist","aria-orientation":h,"data-orientation":h})}),f=h=>typeof h=="string"?{value:h}:h,d=Ke(Xn("trigger"),{stores:[a,n],returned:([h,m])=>g=>{const{value:b,disabled:y}=f(g);!h&&!l&&e.autoSet&&(l=b,h=b,a.set(b));const w=(An?h:l)===b;return{type:"button",role:"tab","data-state":w?"active":"inactive",tabindex:w?0:-1,"data-value":b,"data-orientation":m,"data-disabled":mr(y),disabled:mr(y)}},action:h=>({destroy:an(lt(h,"focus",()=>{const g=h.dataset.disabled==="true",b=h.dataset.value;i.get()&&!g&&b!==void 0&&a.set(b)}),lt(h,"click",g=>{if(h.focus(),g.preventDefault(),h.dataset.disabled==="true")return;const y=h.dataset.value;h.focus(),y!==void 0&&a.set(y)}),lt(h,"keydown",g=>{const b=h.dataset.value;if(!b)return;const y=g.currentTarget;if(!Ge(y))return;const C=y.closest(Ju());if(!Ge(C))return;const w=s.get(),T=Array.from(C.querySelectorAll('[role="tab"]')).filter(x=>Ge(x)).filter(x=>!x.hasAttribute("data-disabled")),j=T.findIndex(x=>x===g.target),v=Pu(C),{nextKey:D,prevKey:M}=fu(v,n.get());g.key===D?(g.preventDefault(),Jl(T,j,w).focus()):g.key===M?(g.preventDefault(),jl(T,j,w).focus()):g.key===Y.ENTER||g.key===Y.SPACE?(g.preventDefault(),a.set(b)):g.key===Y.HOME?(g.preventDefault(),T[0].focus()):g.key===Y.END&&(g.preventDefault(),ar(T).focus())}))})}),p=Ke(Xn("content"),{stores:a,returned:h=>m=>({role:"tabpanel","aria-labelledby":m,hidden:An?h===m?void 0:!0:l===m?void 0:!0,tabindex:0})});return{elements:{root:c,list:u,trigger:d,content:p},states:{value:a},options:t}}function $u(r,e){return r.length!==e.length?!1:r.every((t,n)=>t===e[n])}function ts(){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 Ir(){const{NAME:r}=ts();return pn(r)}function Uu(r){const{NAME:e,PARTS:t}=ts(),n=Ui(e,t),i={...qu({...Hi(r),forceVisible:!0}),getAttrs:n};return Dr(e,i),{...i,updateOption:Gi(i.options)}}function Hu(r){const{ITEM_NAME:e}=ts(),t=Ir();return Dr(e,r),t}function Gu(r){const t={...{side:"bottom",align:"center",sameWidth:!0},...r},{options:{positioning:n}}=Ir();du(n)(t)}const Yu=r=>({ids:r&1}),Ds=r=>({ids:r[0]});function Xu(r){let e;const t=r[24].default,n=ge(t,r,r[23],Ds);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&8388609)&&be(n,t,i,i[23],e?ke(t,i[23],s,Yu):ye(i[23]),Ds)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function Zu(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:p=void 0}=e,{portal:h=void 0}=e,{name:m=void 0}=e,{multiple:g=!1}=e,{selected:b=void 0}=e,{onSelectedChange:y=void 0}=e,{open:C=void 0}=e,{onOpenChange:w=void 0}=e,{items:_=[]}=e,{onOutsideClick:T=void 0}=e,{inputValue:j=""}=e,{touchedInput:v=!1}=e;const{states:{open:D,selected:M,inputValue:x,touchedInput:U},updateOption:Q,ids:I}=Uu({required:l,disabled:c,preventScroll:u,loop:f,closeOnEscape:d,closeOnOutsideClick:p,portal:h,name:m,onOutsideClick:T,multiple:g,forceVisible:!0,defaultSelected:Array.isArray(b)?[...b]:b,defaultOpen:C,onSelectedChange:({next:O})=>Array.isArray(O)?((!Array.isArray(b)||!$u(b,O))&&(y==null||y(O),t(4,b=O)),O):(b!==O&&(y==null||y(O),t(4,b=O)),t(6,j=(O==null?void 0:O.label)??(typeof(O==null?void 0:O.value)=="string"?O==null?void 0:O.value:"")),x.set(j),O),onOpenChange:({next:O})=>(C!==O&&(w==null||w(O),t(5,C=O)),O),items:_});oe(r,x,O=>t(21,n=O)),oe(r,U,O=>t(22,i=O));const G=St([I.menu,I.trigger,I.label],([O,pe,Ue])=>({menu:O,trigger:pe,label:Ue}));return oe(r,G,O=>t(0,s=O)),r.$$set=O=>{"required"in O&&t(8,l=O.required),"disabled"in O&&t(9,c=O.disabled),"preventScroll"in O&&t(10,u=O.preventScroll),"loop"in O&&t(11,f=O.loop),"closeOnEscape"in O&&t(12,d=O.closeOnEscape),"closeOnOutsideClick"in O&&t(13,p=O.closeOnOutsideClick),"portal"in O&&t(14,h=O.portal),"name"in O&&t(15,m=O.name),"multiple"in O&&t(16,g=O.multiple),"selected"in O&&t(4,b=O.selected),"onSelectedChange"in O&&t(17,y=O.onSelectedChange),"open"in O&&t(5,C=O.open),"onOpenChange"in O&&t(18,w=O.onOpenChange),"items"in O&&t(19,_=O.items),"onOutsideClick"in O&&t(20,T=O.onOutsideClick),"inputValue"in O&&t(6,j=O.inputValue),"touchedInput"in O&&t(7,v=O.touchedInput),"$$scope"in O&&t(23,a=O.$$scope)},r.$$.update=()=>{r.$$.dirty&4194304&&t(7,v=i),r.$$.dirty&6291456&&i&&t(6,j=n),r.$$.dirty&64&&j!==void 0&&x.set(j),r.$$.dirty&32&&C!==void 0&&D.set(C),r.$$.dirty&16&&b!==void 0&&M.set(Array.isArray(b)?[...b]:b),r.$$.dirty&256&&Q("required",l),r.$$.dirty&512&&Q("disabled",c),r.$$.dirty&1024&&Q("preventScroll",u),r.$$.dirty&2048&&Q("loop",f),r.$$.dirty&4096&&Q("closeOnEscape",d),r.$$.dirty&8192&&Q("closeOnOutsideClick",p),r.$$.dirty&16384&&Q("portal",h),r.$$.dirty&32768&&Q("name",m),r.$$.dirty&65536&&Q("multiple",g),r.$$.dirty&1048576&&Q("onOutsideClick",T)},[s,x,U,G,b,C,j,v,l,c,u,f,d,p,h,m,g,y,w,_,T,n,i,a,o]}class Gl extends qe{constructor(e){super(),je(this,e,Zu,Xu,Ae,{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 Qu=r=>({builder:r[0]&256}),xs=r=>({builder:r[8]}),ef=r=>({builder:r[0]&256}),vs=r=>({builder:r[8]}),tf=r=>({builder:r[0]&256}),Is=r=>({builder:r[8]}),nf=r=>({builder:r[0]&256}),Ps=r=>({builder:r[8]}),rf=r=>({builder:r[0]&256}),Rs=r=>({builder:r[8]}),sf=r=>({builder:r[0]&256}),Bs=r=>({builder:r[8]});function of(r){let e,t,n,i;const s=r[26].default,o=ge(s,r,r[25],xs);let a=[r[8],r[13]],l={};for(let c=0;c<a.length;c+=1)l=se(l,a[c]);return{c(){e=B("div"),o&&o.c(),le(e,l)},m(c,u){N(c,e,u),o&&o.m(e,null),r[35](e),t=!0,n||(i=[Je(r[8].action(e)),te(e,"m-pointerleave",r[12]),te(e,"keydown",r[31])],n=!0)},p(c,u){o&&o.p&&(!t||u[0]&33554688)&&be(o,s,c,c[25],t?ke(s,c[25],u,Qu):ye(c[25]),xs),le(e,l=Ve(a,[u[0]&256&&c[8],u[0]&8192&&c[13]]))},i(c){t||(k(o,c),t=!0)},o(c){S(o,c),t=!1},d(c){c&&A(e),o&&o.d(c),r[35](null),n=!1,ft(i)}}}function lf(r){let e,t,n,i,s;const o=r[26].default,a=ge(o,r,r[25],vs);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=se(c,l[u]);return{c(){e=B("div"),a&&a.c(),le(e,c)},m(u,f){N(u,e,f),a&&a.m(e,null),r[34](e),n=!0,i||(s=[Je(r[8].action(e)),te(e,"m-pointerleave",r[12]),te(e,"keydown",r[30])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&be(a,o,r,r[25],n?ke(o,r[25],f,ef):ye(r[25]),vs),le(e,c=Ve(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(k(a,u),t&&t.end(1),n=!0)},o(u){S(a,u),u&&(t=$l(e,r[5],r[6])),n=!1},d(u){u&&A(e),a&&a.d(u),r[34](null),u&&t&&t.end(),i=!1,ft(s)}}}function af(r){let e,t,n,i,s;const o=r[26].default,a=ge(o,r,r[25],Is);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=se(c,l[u]);return{c(){e=B("div"),a&&a.c(),le(e,c)},m(u,f){N(u,e,f),a&&a.m(e,null),n=!0,i||(s=[Je(r[8].action(e)),te(e,"m-pointerleave",r[12]),te(e,"keydown",r[29])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&be(a,o,r,r[25],n?ke(o,r[25],f,tf):ye(r[25]),Is),le(e,c=Ve(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(k(a,u),u&&(t||Yi(()=>{t=Ul(e,r[3],r[4]),t.start()})),n=!0)},o(u){S(a,u),n=!1},d(u){u&&A(e),a&&a.d(u),i=!1,ft(s)}}}function cf(r){let e,t,n,i,s,o;const a=r[26].default,l=ge(a,r,r[25],Ps);let c=[r[8],r[13]],u={};for(let f=0;f<c.length;f+=1)u=se(u,c[f]);return{c(){e=B("div"),l&&l.c(),le(e,u)},m(f,d){N(f,e,d),l&&l.m(e,null),r[33](e),i=!0,s||(o=[Je(r[8].action(e)),te(e,"m-pointerleave",r[12]),te(e,"keydown",r[28])],s=!0)},p(f,d){r=f,l&&l.p&&(!i||d[0]&33554688)&&be(l,a,r,r[25],i?ke(a,r[25],d,nf):ye(r[25]),Ps),le(e,u=Ve(c,[d[0]&256&&r[8],d[0]&8192&&r[13]]))},i(f){i||(k(l,f),f&&Yi(()=>{i&&(n&&n.end(1),t=Ul(e,r[3],r[4]),t.start())}),i=!0)},o(f){S(l,f),t&&t.invalidate(),f&&(n=$l(e,r[5],r[6])),i=!1},d(f){f&&A(e),l&&l.d(f),r[33](null),f&&n&&n.end(),s=!1,ft(o)}}}function uf(r){let e,t,n,i,s;const o=r[26].default,a=ge(o,r,r[25],Rs);let l=[r[8],r[13]],c={};for(let u=0;u<l.length;u+=1)c=se(c,l[u]);return{c(){e=B("div"),a&&a.c(),le(e,c)},m(u,f){N(u,e,f),a&&a.m(e,null),r[32](e),n=!0,i||(s=[Je(r[8].action(e)),te(e,"m-pointerleave",r[12]),te(e,"keydown",r[27])],i=!0)},p(u,f){r=u,a&&a.p&&(!n||f[0]&33554688)&&be(a,o,r,r[25],n?ke(o,r[25],f,rf):ye(r[25]),Rs),le(e,c=Ve(l,[f[0]&256&&r[8],f[0]&8192&&r[13]]))},i(u){n||(k(a,u),u&&Yi(()=>{n&&(t||(t=Os(e,r[1],r[2],!0)),t.run(1))}),n=!0)},o(u){S(a,u),u&&(t||(t=Os(e,r[1],r[2],!1)),t.run(0)),n=!1},d(u){u&&A(e),a&&a.d(u),r[32](null),u&&t&&t.end(),i=!1,ft(s)}}}function ff(r){let e;const t=r[26].default,n=ge(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)&&be(n,t,i,i[25],e?ke(t,i[25],s,sf):ye(i[25]),Bs)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function df(r){let e,t,n,i;const s=[ff,uf,cf,af,lf,of],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=de()},m(l,c){~e&&o[e].m(l,c),N(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(re(),S(o[u],1,1,()=>{o[u]=null}),ie()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),~e&&o[e].d(l)}}}function hf(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=ve(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:p=void 0}=e,{outTransition:h=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{side:y="bottom"}=e,{align:C="center"}=e,{sideOffset:w=0}=e,{alignOffset:_=0}=e,{collisionPadding:T=8}=e,{avoidCollisions:j=!0}=e,{collisionBoundary:v=void 0}=e,{sameWidth:D=!0}=e,{fitViewport:M=!1}=e,{el:x=void 0}=e;const{elements:{menu:U},states:{open:Q},ids:I,getAttrs:G}=Ir();oe(r,U,F=>t(24,a=F)),oe(r,Q,F=>t(9,o=F));const O=xr(),pe=G("content");function Ue(F){mt.call(this,r,F)}function $n(F){mt.call(this,r,F)}function Un(F){mt.call(this,r,F)}function Ur(F){mt.call(this,r,F)}function Hr(F){mt.call(this,r,F)}function Gr(F){Re[F?"unshift":"push"](()=>{x=F,t(0,x)})}function Yr(F){Re[F?"unshift":"push"](()=>{x=F,t(0,x)})}function Xr(F){Re[F?"unshift":"push"](()=>{x=F,t(0,x)})}function Zr(F){Re[F?"unshift":"push"](()=>{x=F,t(0,x)})}return r.$$set=F=>{e=se(se({},e),vt(F)),t(13,s=ve(e,i)),"transition"in F&&t(1,u=F.transition),"transitionConfig"in F&&t(2,f=F.transitionConfig),"inTransition"in F&&t(3,d=F.inTransition),"inTransitionConfig"in F&&t(4,p=F.inTransitionConfig),"outTransition"in F&&t(5,h=F.outTransition),"outTransitionConfig"in F&&t(6,m=F.outTransitionConfig),"asChild"in F&&t(7,g=F.asChild),"id"in F&&t(14,b=F.id),"side"in F&&t(15,y=F.side),"align"in F&&t(16,C=F.align),"sideOffset"in F&&t(17,w=F.sideOffset),"alignOffset"in F&&t(18,_=F.alignOffset),"collisionPadding"in F&&t(19,T=F.collisionPadding),"avoidCollisions"in F&&t(20,j=F.avoidCollisions),"collisionBoundary"in F&&t(21,v=F.collisionBoundary),"sameWidth"in F&&t(22,D=F.sameWidth),"fitViewport"in F&&t(23,M=F.fitViewport),"el"in F&&t(0,x=F.el),"$$scope"in F&&t(25,c=F.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&16384&&b&&I.menu.set(b),r.$$.dirty[0]&16777216&&t(8,n=a),r.$$.dirty[0]&256&&Object.assign(n,pe),r.$$.dirty[0]&16744960&&o&&Gu({side:y,align:C,sideOffset:w,alignOffset:_,collisionPadding:T,avoidCollisions:j,collisionBoundary:v,sameWidth:D,fitViewport:M})},[x,u,f,d,p,h,m,g,n,o,U,Q,O,s,b,y,C,w,_,T,j,v,D,M,a,c,l,Ue,$n,Un,Ur,Hr,Gr,Yr,Xr,Zr]}class Yl extends qe{constructor(e){super(),je(this,e,hf,df,Ae,{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 pf=r=>({builder:r&8,placeholder:r&4}),zs=r=>({builder:r[3],placeholder:r[2]});function mf(r){let e,t,n,i=[r[3],r[6],{placeholder:r[2]}],s={};for(let o=0;o<i.length;o+=1)s=se(s,i[o]);return{c(){e=B("input"),le(e,s)},m(o,a){N(o,e,a),e.autofocus&&e.focus(),r[11](e),t||(n=[Je(r[3].action(e)),te(e,"m-click",r[5]),te(e,"m-keydown",r[5]),te(e,"m-input",r[5])],t=!0)},p(o,a){le(e,s=Ve(i,[a&8&&o[3],a&64&&o[6],a&4&&{placeholder:o[2]}]))},i:ne,o:ne,d(o){o&&A(e),r[11](null),t=!1,ft(n)}}}function gf(r){let e;const t=r[10].default,n=ge(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)&&be(n,t,i,i[9],e?ke(t,i[9],s,pf):ye(i[9]),zs)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function bf(r){let e,t,n,i;const s=[gf,mf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function yf(r,e,t){let n;const i=["asChild","placeholder","el","id"];let s=ve(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:p},ids:h,getAttrs:m}=Ir();oe(r,p,C=>t(8,o=C));const g=xr(),b=m("input");function y(C){Re[C?"unshift":"push"](()=>{f=C,t(0,f)})}return r.$$set=C=>{e=se(se({},e),vt(C)),t(6,s=ve(e,i)),"asChild"in C&&t(1,c=C.asChild),"placeholder"in C&&t(2,u=C.placeholder),"el"in C&&t(0,f=C.el),"id"in C&&t(7,d=C.id),"$$scope"in C&&t(9,l=C.$$scope)},r.$$.update=()=>{r.$$.dirty&128&&d&&h.trigger.set(d),r.$$.dirty&256&&t(3,n=o),r.$$.dirty&8&&Object.assign(n,b)},[f,c,u,n,p,g,s,d,o,l,a,y]}class Xl extends qe{constructor(e){super(),je(this,e,yf,bf,Ae,{asChild:1,placeholder:2,el:0,id:7})}}const kf=r=>({builder:r&16,isSelected:r&32}),Fs=r=>({builder:r[4],isSelected:r[5]}),_f=r=>({builder:r&16,isSelected:r&32}),Vs=r=>({builder:r[4],isSelected:r[5]});function Sf(r){let e,t,n,i;const s=r[14].default,o=ge(s,r,r[13],Fs),a=o||Mf(r);let l=[r[4],r[9]],c={};for(let u=0;u<l.length;u+=1)c=se(c,l[u]);return{c(){e=B("div"),a.c(),le(e,c)},m(u,f){N(u,e,f),a.m(e,null),r[19](e),t=!0,n||(i=[Je(r[4].action(e)),te(e,"m-click",r[8]),te(e,"m-pointermove",r[8]),te(e,"focusin",r[15]),te(e,"keydown",r[16]),te(e,"focusout",r[17]),te(e,"pointerleave",r[18])],n=!0)},p(u,f){o?o.p&&(!t||f&8240)&&be(o,s,u,u[13],t?ke(s,u[13],f,kf):ye(u[13]),Fs):a.p&&(!t||f&5)&&a.p(u,t?f:-1),le(e,c=Ve(l,[f&16&&u[4],f&512&&u[9]]))},i(u){t||(k(a,u),t=!0)},o(u){S(a,u),t=!1},d(u){u&&A(e),a.d(u),r[19](null),n=!1,ft(i)}}}function Cf(r){let e;const t=r[14].default,n=ge(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)&&be(n,t,i,i[13],e?ke(t,i[13],s,_f):ye(i[13]),Vs)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function Mf(r){let e=(r[0]||r[2])+"",t;return{c(){t=he(e)},m(n,i){N(n,t,i)},p(n,i){i&5&&e!==(e=(n[0]||n[2])+"")&&Ie(t,e)},d(n){n&&A(t)}}}function wf(r){let e,t,n,i;const s=[Cf,Sf],o=[];function a(l,c){return l[3]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function Tf(r,e,t){let n,i;const s=["value","disabled","label","asChild","el"];let o=ve(e,s),a,l,{$$slots:c={},$$scope:u}=e,{value:f}=e,{disabled:d=void 0}=e,{label:p=void 0}=e,{asChild:h=!1}=e,{el:m=void 0}=e;const{elements:{option:g},helpers:{isSelected:b},getAttrs:y}=Hu(f);oe(r,g,M=>t(12,l=M)),oe(r,b,M=>t(11,a=M));const C=xr(),w=y("item");function _(M){mt.call(this,r,M)}function T(M){mt.call(this,r,M)}function j(M){mt.call(this,r,M)}function v(M){mt.call(this,r,M)}function D(M){Re[M?"unshift":"push"](()=>{m=M,t(1,m)})}return r.$$set=M=>{e=se(se({},e),vt(M)),t(9,o=ve(e,s)),"value"in M&&t(2,f=M.value),"disabled"in M&&t(10,d=M.disabled),"label"in M&&t(0,p=M.label),"asChild"in M&&t(3,h=M.asChild),"el"in M&&t(1,m=M.el),"$$scope"in M&&t(13,u=M.$$scope)},r.$$.update=()=>{r.$$.dirty&5&&!p&&typeof f=="string"&&t(0,p=f),r.$$.dirty&5125&&t(4,n=l({value:f,disabled:d,label:p})),r.$$.dirty&16&&Object.assign(n,w),r.$$.dirty&2052&&t(5,i=a(f))},[p,m,f,h,n,i,g,b,C,o,d,a,l,u,c,_,T,j,v,D]}class Zl extends qe{constructor(e){super(),je(this,e,Tf,wf,Ae,{value:2,disabled:10,label:0,asChild:3,el:1})}}function Ef(){return{NAME:"separator",PARTS:["root"]}}function Of(r){const{NAME:e,PARTS:t}=Ef(),n=Ui(e,t),i={...hu(Hi(r)),getAttrs:n};return{...i,updateOption:Gi(i.options)}}const Nf=r=>({builder:r&4}),Ls=r=>({builder:r[2]});function Af(r){let e,t,n,i=[r[2],r[4]],s={};for(let o=0;o<i.length;o+=1)s=se(s,i[o]);return{c(){e=B("div"),le(e,s)},m(o,a){N(o,e,a),r[10](e),t||(n=Je(r[2].action(e)),t=!0)},p(o,a){le(e,s=Ve(i,[a&4&&o[2],a&16&&o[4]]))},i:ne,o:ne,d(o){o&&A(e),r[10](null),t=!1,n()}}}function Df(r){let e;const t=r[9].default,n=ge(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)&&be(n,t,i,i[8],e?ke(t,i[8],s,Nf):ye(i[8]),Ls)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function xf(r){let e,t,n,i;const s=[Df,Af],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function vf(r,e,t){let n;const i=["orientation","decorative","asChild","el"];let s=ve(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:p},updateOption:h,getAttrs:m}=Of({orientation:c,decorative:u});oe(r,p,y=>t(7,o=y));const g=m("root");function b(y){Re[y?"unshift":"push"](()=>{d=y,t(0,d)})}return r.$$set=y=>{e=se(se({},e),vt(y)),t(4,s=ve(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&&h("orientation",c),r.$$.dirty&64&&h("decorative",u),r.$$.dirty&128&&t(2,n=o),r.$$.dirty&4&&Object.assign(n,g)},[d,f,n,p,s,c,u,o,l,a,b]}class Ql extends qe{constructor(e){super(),je(this,e,vf,xf,Ae,{orientation:5,decorative:6,asChild:1,el:0})}}function ea(){return{NAME:"tabs",PARTS:["root","content","list","trigger"]}}function If(r){const{NAME:e,PARTS:t}=ea(),n=Ui(e,t),i={...Ku(Hi(r)),getAttrs:n};return Dr(e,i),{...i,updateOption:Gi(i.options)}}function ns(){const{NAME:r}=ea();return pn(r)}const Pf=r=>({builder:r&4,value:r&8}),Ws=r=>({builder:r[2],value:r[3]}),Rf=r=>({builder:r&4,value:r&8}),qs=r=>({builder:r[2],value:r[3]});function Bf(r){let e,t,n,i;const s=r[15].default,o=ge(s,r,r[14],Ws);let a=[r[2],r[6]],l={};for(let c=0;c<a.length;c+=1)l=se(l,a[c]);return{c(){e=B("div"),o&&o.c(),le(e,l)},m(c,u){N(c,e,u),o&&o.m(e,null),r[16](e),t=!0,n||(i=Je(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&16396)&&be(o,s,c,c[14],t?ke(s,c[14],u,Pf):ye(c[14]),Ws),le(e,l=Ve(a,[u&4&&c[2],u&64&&c[6]]))},i(c){t||(k(o,c),t=!0)},o(c){S(o,c),t=!1},d(c){c&&A(e),o&&o.d(c),r[16](null),n=!1,i()}}}function zf(r){let e;const t=r[15].default,n=ge(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)&&be(n,t,i,i[14],e?ke(t,i[14],s,Rf):ye(i[14]),qs)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function Ff(r){let e,t,n,i;const s=[zf,Bf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function Vf(r,e,t){let n;const i=["orientation","activateOnFocus","loop","autoSet","value","onValueChange","asChild","el"];let s=ve(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:p=void 0}=e,{value:h=void 0}=e,{onValueChange:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{root:y},states:{value:C},updateOption:w,getAttrs:_}=If({orientation:u,activateOnFocus:f,loop:d,autoSet:p,defaultValue:h,onValueChange:({next:v})=>(h!==v&&(m==null||m(v),t(7,h=v)),v)});oe(r,y,v=>t(13,o=v)),oe(r,C,v=>t(3,a=v));const T=_("root");function j(v){Re[v?"unshift":"push"](()=>{b=v,t(0,b)})}return r.$$set=v=>{e=se(se({},e),vt(v)),t(6,s=ve(e,i)),"orientation"in v&&t(8,u=v.orientation),"activateOnFocus"in v&&t(9,f=v.activateOnFocus),"loop"in v&&t(10,d=v.loop),"autoSet"in v&&t(11,p=v.autoSet),"value"in v&&t(7,h=v.value),"onValueChange"in v&&t(12,m=v.onValueChange),"asChild"in v&&t(1,g=v.asChild),"el"in v&&t(0,b=v.el),"$$scope"in v&&t(14,c=v.$$scope)},r.$$.update=()=>{r.$$.dirty&128&&h!==void 0&&C.set(h),r.$$.dirty&256&&w("orientation",u),r.$$.dirty&512&&w("activateOnFocus",f),r.$$.dirty&1024&&w("loop",d),r.$$.dirty&2048&&w("autoSet",p),r.$$.dirty&8192&&t(2,n=o),r.$$.dirty&4&&Object.assign(n,T)},[b,g,n,a,y,C,s,h,u,f,d,p,m,o,c,l,j]}class Lf extends qe{constructor(e){super(),je(this,e,Vf,Ff,Ae,{orientation:8,activateOnFocus:9,loop:10,autoSet:11,value:7,onValueChange:12,asChild:1,el:0})}}const Wf=r=>({builder:r&4}),js=r=>({builder:r[2]}),qf=r=>({builder:r&4}),Js=r=>({builder:r[2]});function jf(r){let e,t,n,i;const s=r[8].default,o=ge(s,r,r[7],js);let a=[r[2],r[4]],l={};for(let c=0;c<a.length;c+=1)l=se(l,a[c]);return{c(){e=B("div"),o&&o.c(),le(e,l)},m(c,u){N(c,e,u),o&&o.m(e,null),r[9](e),t=!0,n||(i=Je(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&132)&&be(o,s,c,c[7],t?ke(s,c[7],u,Wf):ye(c[7]),js),le(e,l=Ve(a,[u&4&&c[2],u&16&&c[4]]))},i(c){t||(k(o,c),t=!0)},o(c){S(o,c),t=!1},d(c){c&&A(e),o&&o.d(c),r[9](null),n=!1,i()}}}function Jf(r){let e;const t=r[8].default,n=ge(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)&&be(n,t,i,i[7],e?ke(t,i[7],s,qf):ye(i[7]),Js)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function Kf(r){let e,t,n,i;const s=[Jf,jf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function $f(r,e,t){let n;const i=["value","asChild","el"];let s=ve(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:p}=ns();oe(r,d,g=>t(6,o=g));const h=p("content");function m(g){Re[g?"unshift":"push"](()=>{f=g,t(0,f)})}return r.$$set=g=>{e=se(se({},e),vt(g)),t(4,s=ve(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,h)},[f,u,n,d,s,c,o,l,a,m]}class Uf extends qe{constructor(e){super(),je(this,e,$f,Kf,Ae,{value:5,asChild:1,el:0})}}const Hf=r=>({builder:r&4}),Ks=r=>({builder:r[2]}),Gf=r=>({builder:r&4}),$s=r=>({builder:r[2]});function Yf(r){let e,t,n,i;const s=r[7].default,o=ge(s,r,r[6],Ks);let a=[r[2],r[4]],l={};for(let c=0;c<a.length;c+=1)l=se(l,a[c]);return{c(){e=B("div"),o&&o.c(),le(e,l)},m(c,u){N(c,e,u),o&&o.m(e,null),r[8](e),t=!0,n||(i=Je(r[2].action(e)),n=!0)},p(c,u){o&&o.p&&(!t||u&68)&&be(o,s,c,c[6],t?ke(s,c[6],u,Hf):ye(c[6]),Ks),le(e,l=Ve(a,[u&4&&c[2],u&16&&c[4]]))},i(c){t||(k(o,c),t=!0)},o(c){S(o,c),t=!1},d(c){c&&A(e),o&&o.d(c),r[8](null),n=!1,i()}}}function Xf(r){let e;const t=r[7].default,n=ge(t,r,r[6],$s);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&68)&&be(n,t,i,i[6],e?ke(t,i[6],s,Gf):ye(i[6]),$s)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function Zf(r){let e,t,n,i;const s=[Xf,Yf],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function Qf(r,e,t){let n;const i=["asChild","el"];let s=ve(e,i),o,{$$slots:a={},$$scope:l}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{list:f},getAttrs:d}=ns();oe(r,f,m=>t(5,o=m));const p=d("list");function h(m){Re[m?"unshift":"push"](()=>{u=m,t(0,u)})}return r.$$set=m=>{e=se(se({},e),vt(m)),t(4,s=ve(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,p)},[u,c,n,f,s,o,l,a,h]}class ed extends qe{constructor(e){super(),je(this,e,Qf,Zf,Ae,{asChild:1,el:0})}}const td=r=>({builder:r&4}),Us=r=>({builder:r[2]}),nd=r=>({builder:r&4}),Hs=r=>({builder:r[2]});function rd(r){let e,t,n,i;const s=r[10].default,o=ge(s,r,r[9],Us);let a=[r[2],{type:"button"},r[5]],l={};for(let c=0;c<a.length;c+=1)l=se(l,a[c]);return{c(){e=B("button"),o&&o.c(),le(e,l)},m(c,u){N(c,e,u),o&&o.m(e,null),e.autofocus&&e.focus(),r[11](e),t=!0,n||(i=[Je(r[2].action(e)),te(e,"m-click",r[4]),te(e,"m-focus",r[4]),te(e,"m-keydown",r[4])],n=!0)},p(c,u){o&&o.p&&(!t||u&516)&&be(o,s,c,c[9],t?ke(s,c[9],u,td):ye(c[9]),Us),le(e,l=Ve(a,[u&4&&c[2],{type:"button"},u&32&&c[5]]))},i(c){t||(k(o,c),t=!0)},o(c){S(o,c),t=!1},d(c){c&&A(e),o&&o.d(c),r[11](null),n=!1,ft(i)}}}function id(r){let e;const t=r[10].default,n=ge(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)&&be(n,t,i,i[9],e?ke(t,i[9],s,nd):ye(i[9]),Hs)},i(i){e||(k(n,i),e=!0)},o(i){S(n,i),e=!1},d(i){n&&n.d(i)}}}function sd(r){let e,t,n,i;const s=[id,rd],o=[];function a(l,c){return l[1]?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=de()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,[c]){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function od(r,e,t){let n;const i=["value","disabled","asChild","el"];let s=ve(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:p},getAttrs:h}=ns();oe(r,p,y=>t(8,o=y));const m=xr(),g=h("trigger");function b(y){Re[y?"unshift":"push"](()=>{d=y,t(0,d)})}return r.$$set=y=>{e=se(se({},e),vt(y)),t(5,s=ve(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,p,m,s,c,u,o,l,a,b]}class ld extends qe{constructor(e){super(),je(this,e,od,sd,Ae,{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 ta(){this._key="chai/deep-eql__"+Math.random()+Date.now()}ta.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 na=typeof WeakMap=="function"?WeakMap:ta;/*!
|
|
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||mn(r)||mn(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||mn(r)||mn(e))){var i=t.get(r);i?i.set(e,n):(i=new na,i.set(e,n),t.set(r,i))}}function Pr(r,e,t){if(t&&t.comparator)return Xs(r,e,t);var n=ra(r,e);return n!==null?n:Xs(r,e,t)}function ra(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e?!0:mn(r)||mn(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 na;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=ra(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=ad(r,e,l,t);return Zn(r,e,t.memoize,c),c}function ad(r,e,t,n){switch(t){case"String":case"Number":case"Boolean":case"Date":return Pr(r.valueOf(),e.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return r===e;case"Error":return ia(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 jt(r,e,n);case"RegExp":return cd(r,e);case"Generator":return ud(r,e,n);case"DataView":return jt(new Uint8Array(r.buffer),new Uint8Array(e.buffer),n);case"ArrayBuffer":return jt(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 dd(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 cd(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])}),jt(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 jt(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(Pr(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 ud(r,e,t){return jt(Ei(r),Ei(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 fd(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(fd(r))try{return Ei(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 Ei(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 ia(r,e,t,n){var i=t.length;if(i===0)return!0;for(var s=0;s<i;s+=1)if(Pr(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 dd(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 jt(no(n).sort(),no(i).sort())===!1?!1:ia(r,e,n,t);var a=Qs(r),l=Qs(e);return a.length&&a.length===l.length?(a.sort(),l.sort(),jt(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 mn(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 hd(r){let e,t;return e=new we({}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function pd(r){let e,t;return e=new we({props:{path:pu}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function md(r){let e,t;return e=new we({props:{path:vr}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function io(r){let e,t,n,i,s;t=new sa({props:{treeItems:r[10],parent:r[11]}});let o=[r[13]],a={};for(let l=0;l<o.length;l+=1)a=se(a,o[l]);return{c(){e=B("ol"),V(t.$$.fragment),le(e,a)},m(l,c){N(l,e,c),L(t,e,null),n=!0,i||(s=Je(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),le(e,a=Ve(o,[c&6&&l[13]]))},i(l){n||(k(t.$$.fragment,l),n=!0)},o(l){S(t.$$.fragment,l),n=!1},d(l){l&&A(e),W(t),i=!1,s()}}}function so(r){let e,t,n,i,s,o,a,l=r[9]+"",c,u,f,d,p,h;const m=[md,pd,hd],g=[];function b(_,T){return T&19&&(n=null),n==null&&(n=!!(_[12]&&_[4](_[11]))),n?0:_[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]],C={};for(let _=0;_<y.length;_+=1)C=se(C,y[_]);let w=r[10]&&io(r);return{c(){e=B("li"),t=B("button"),s.c(),o=K(),a=B("span"),c=he(l),u=K(),w&&w.c(),f=K(),J(a,"class","select-none"),le(t,C),J(e,"role","none")},m(_,T){N(_,e,T),R(e,t),g[i].m(t,null),R(t,o),R(t,a),R(a,c),t.autofocus&&t.focus(),R(e,u),w&&w.m(e,null),R(e,f),d=!0,p||(h=Je(r[14].action(t)),p=!0)},p(_,T){let j=i;i=b(_,T),i!==j&&(re(),S(g[j],1,1,()=>{g[j]=null}),ie(),s=g[i],s||(s=g[i]=m[i](_),s.c()),k(s,1),s.m(t,o)),(!d||T&1)&&l!==(l=_[9]+"")&&Ie(c,l),le(t,C=Ve(y,[{class:"flex items-center gap-1 p-1"},T&11&&_[14]])),_[10]?w?(w.p(_,T),T&1&&k(w,1)):(w=io(_),w.c(),k(w,1),w.m(e,f)):w&&(re(),S(w,1,1,()=>{w=null}),ie())},i(_){d||(k(s),k(w),d=!0)},o(_){S(s),S(w),d=!1},d(_){_&&A(e),g[i].d(),w&&w.d(),p=!1,h()}}}function gd(r){let e,t,n=fe(r[0]),i=[];for(let o=0;o<n.length;o+=1)i[o]=so(ro(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,[a]){if(a&31){n=fe(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),k(i[l],1)):(i[l]=so(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function bd(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}}=pn("tree");return oe(r,l,d=>t(3,i=d)),oe(r,c,d=>t(2,n=d)),oe(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 sa extends qe{constructor(e){super(),je(this,e,bd,gd,Ae,{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 Sn({props:{class:"border-b border-gray-300",$$slots:{default:[Md]},$$scope:{ctx:r}}}),i=new sa({props:{treeItems:r[0].content}});let o=[r[2]],a={};for(let l=0;l<o.length;l+=1)a=se(a,o[l]);return{c(){V(e.$$.fragment),t=K(),n=B("ol"),V(i.$$.fragment),le(n,a)},m(l,c){L(e,l,c),N(l,t,c),N(l,n,c),L(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),le(n,a=Ve(o,[c&4&&l[2]]))},i(l){s||(k(e.$$.fragment,l),k(i.$$.fragment,l),s=!0)},o(l){S(e.$$.fragment,l),S(i.$$.fragment,l),s=!1},d(l){l&&(A(t),A(n)),W(e,l),W(i)}}}function yd(r){let e,t;return e=new we({props:{path:Zi}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function kd(r){let e,t;return e=new we({props:{path:Qi}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function _d(r){let e,t;return e=new we({props:{path:vr}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Sd(r){let e,t;return e=new we({props:{path:es}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Cd(r){let e,t;return e=new we({props:{path:gu}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Md(r){let e,t,n,i,s,o,a,l,c,u,f,d,p,h;return e=new et({props:{title:"Add a metadata node",$$slots:{default:[yd]},$$scope:{ctx:r}}}),e.$on("click",r[8]),n=new Ql({props:{class:"border-r border-gray-300 mx-2"}}),s=new et({props:{title:"Move the selected metadata node up","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[kd]},$$scope:{ctx:r}}}),s.$on("click",r[10]),a=new et({props:{title:"Move the selected metadata node down","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[_d]},$$scope:{ctx:r}}}),a.$on("click",r[11]),c=new et({props:{title:"Remove the selected metadata node","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[Sd]},$$scope:{ctx:r}}}),c.$on("click",r[9]),p=new et({props:{title:"Clear the selection","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[Cd]},$$scope:{ctx:r}}}),p.$on("click",r[15]),{c(){V(e.$$.fragment),t=K(),V(n.$$.fragment),i=K(),V(s.$$.fragment),o=K(),V(a.$$.fragment),l=K(),V(c.$$.fragment),u=K(),f=B("div"),d=K(),V(p.$$.fragment),J(f,"class","flex-1")},m(m,g){L(e,m,g),N(m,t,g),L(n,m,g),N(m,i,g),L(s,m,g),N(m,o,g),L(a,m,g),N(m,l,g),L(c,m,g),N(m,u,g),N(m,f,g),N(m,d,g),L(p,m,g),h=!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 C={};g&2&&(C["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(C.$$scope={dirty:g,ctx:m}),a.$set(C);const w={};g&2&&(w["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(w.$$scope={dirty:g,ctx:m}),c.$set(w);const _={};g&2&&(_["aria-disabled"]=m[1]!==null?null:"true"),g&33554432&&(_.$$scope={dirty:g,ctx:m}),p.$set(_)},i(m){h||(k(e.$$.fragment,m),k(n.$$.fragment,m),k(s.$$.fragment,m),k(a.$$.fragment,m),k(c.$$.fragment,m),k(p.$$.fragment,m),h=!0)},o(m){S(e.$$.fragment,m),S(n.$$.fragment,m),S(s.$$.fragment,m),S(a.$$.fragment,m),S(c.$$.fragment,m),S(p.$$.fragment,m),h=!1},d(m){m&&(A(t),A(i),A(o),A(l),A(u),A(f),A(d)),W(e,m),W(n,m),W(s,m),W(a,m),W(c,m),W(p,m)}}}function wd(r){let e;return{c(){e=B("p"),e.textContent="Please select a metadata node on the left"},m(t,n){N(t,e,n)},p:ne,i:ne,o:ne,d(t){t&&A(e)}}}function Td(r){let e,t,n,i,s,o,a,l,c,u,f,d,p,h,m,g,b,y=fe(r[1].attrs),C=[];for(let _=0;_<y.length;_+=1)C[_]=ao(oo(r,y,_));const w=_=>S(C[_],1,1,()=>{C[_]=null});return h=new Sn({props:{$$slots:{default:[Ad]},$$scope:{ctx:r}}}),{c(){e=B("label"),t=B("span"),t.textContent="Tag",n=K(),i=B("input"),o=K(),a=B("label"),l=B("span"),l.textContent="Text",c=K(),u=B("input"),d=K();for(let _=0;_<C.length;_+=1)C[_].c();p=K(),V(h.$$.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(_,T){N(_,e,T),R(e,t),R(e,n),R(e,i),N(_,o,T),N(_,a,T),R(a,l),R(a,c),R(a,u),N(_,d,T);for(let j=0;j<C.length;j+=1)C[j]&&C[j].m(_,T);N(_,p,T),L(h,_,T),m=!0,g||(b=[te(i,"change",r[6]),te(u,"change",r[7])],g=!0)},p(_,T){if((!m||T&2&&s!==(s=_[1].type)&&i.value!==s)&&(i.value=s),(!m||T&2&&f!==(f=_[1].text)&&u.value!==f)&&(u.value=f),T&24578){y=fe(_[1].attrs);let v;for(v=0;v<y.length;v+=1){const D=oo(_,y,v);C[v]?(C[v].p(D,T),k(C[v],1)):(C[v]=ao(D),C[v].c(),k(C[v],1),C[v].m(p.parentNode,p))}for(re(),v=y.length;v<C.length;v+=1)w(v);ie()}const j={};T&33554432&&(j.$$scope={dirty:T,ctx:_}),h.$set(j)},i(_){if(!m){for(let T=0;T<y.length;T+=1)k(C[T]);k(h.$$.fragment,_),m=!0}},o(_){C=C.filter(Boolean);for(let T=0;T<C.length;T+=1)S(C[T]);S(h.$$.fragment,_),m=!1},d(_){_&&(A(e),A(o),A(a),A(d),A(p)),it(C,_),W(h,_),g=!1,ft(b)}}}function Ed(r){let e,t;return e=new we({props:{path:es}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Od(r){let e,t;function n(...i){return r[18](r[24],...i)}return e=new et({props:{title:"Move the selected metadata node up","aria-disabled":r[1]!==null?null:"true",$$slots:{default:[Ed]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){V(e.$$.fragment)},m(i,s){L(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||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function ao(r){let e,t,n,i,s,o,a,l,c,u,f,d,p,h,m,g,b;function y(...w){return r[16](r[24],...w)}function C(...w){return r[17](r[24],...w)}return h=new Sn({props:{class:"border-b border-gray-300",$$slots:{default:[Od]},$$scope:{ctx:r}}}),{c(){e=B("div"),t=B("label"),n=B("span"),n.textContent="Name",i=K(),s=B("input"),a=K(),l=B("label"),c=B("span"),c.textContent="Value",u=K(),f=B("input"),p=K(),V(h.$$.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(w,_){N(w,e,_),R(e,t),R(t,n),R(t,i),R(t,s),R(e,a),R(e,l),R(l,c),R(l,u),R(l,f),R(e,p),L(h,e,null),m=!0,g||(b=[te(s,"change",y),te(f,"change",C)],g=!0)},p(w,_){r=w,(!m||_&2&&o!==(o=r[22].type)&&s.value!==o)&&(s.value=o),(!m||_&2&&d!==(d=r[22].value)&&f.value!==d)&&(f.value=d);const T={};_&33554434&&(T.$$scope={dirty:_,ctx:r}),h.$set(T)},i(w){m||(k(h.$$.fragment,w),m=!0)},o(w){S(h.$$.fragment,w),m=!1},d(w){w&&A(e),W(h),g=!1,ft(b)}}}function Nd(r){let e,t;return e=new we({props:{path:Zi}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Ad(r){let e,t,n,i;return n=new et({props:{title:"Add a metadata node",$$slots:{default:[Nd]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{c(){e=B("div"),t=K(),V(n.$$.fragment),J(e,"class","flex-1")},m(s,o){N(s,e,o),N(s,t,o),L(n,s,o),i=!0},p(s,o){const a={};o&33554432&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(k(n.$$.fragment,s),i=!0)},o(s){S(n.$$.fragment,s),i=!1},d(s){s&&(A(e),A(t)),W(n,s)}}}function Dd(r){let e,t,n,i,s,o,a,l=r[0]&&lo(r);const c=[Td,wd],u=[];function f(d,p){return d[1]?0:1}return s=f(r),o=u[s]=c[s](r),{c(){e=B("div"),t=B("div"),l&&l.c(),n=K(),i=B("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,p){N(d,e,p),R(e,t),l&&l.m(t,null),R(e,n),R(e,i),u[s].m(i,null),a=!0},p(d,[p]){d[0]?l?(l.p(d,p),p&1&&k(l,1)):(l=lo(d),l.c(),k(l,1),l.m(t,null)):l&&(re(),S(l,1,1,()=>{l=null}),ie());let h=s;s=f(d),s===h?u[s].p(d,p):(re(),S(u[h],1,1,()=>{u[h]=null}),ie(),o=u[s],o?o.p(d,p):(o=u[s]=c[s](d),o.c()),k(o,1),o.m(i,null))},i(d){a||(k(l),k(o),a=!0)},o(d){S(l),S(o),a=!1},d(d){d&&A(e),l&&l.d(),u[s].d()}}}function ot(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 xd(r,e){r.preventDefault()}function vd(r,e,t){let n,i,s,{section:o=null}=e;const a=Xi(),l=mu({defaultExpanded:["file-tree--1-0"]});Dr("tree",l);const{elements:{tree:c},states:{selectedItem:u}}=l;oe(r,c,D=>t(2,s=D)),oe(r,u,D=>t(19,n=D));const f=St(u,D=>{if(D!==null&&o){const M=D.getAttribute("data-id");if(M){const x=ot(o,M);if(x)return x}}return null});oe(r,f,D=>t(1,i=D));function d(D){if(D.preventDefault(),n!==null&&o){const M=n.getAttribute("data-id");if(M){const x=ot(o,M);x&&(x.type=D.target.value,a("update",o),t(0,o))}}}function p(D){if(D.preventDefault(),n!==null&&o){const M=n.getAttribute("data-id");if(M){const x=ot(o,M);x&&(x.text=D.target.value,a("update",o))}}}function h(D){if(D.preventDefault(),o){const M={type:"newNode",text:"",attrs:[],content:[]};if(n){const x=n.getAttribute("data-id");if(x){const U=ot(o,x);U&&U.content.push(M)}}else o.content.push(M);a("update",o),t(0,o)}}function m(D){if(D.preventDefault(),o&&n){const M=n.getAttribute("data-id");if(M){const x=M.split("-"),U=x.slice(0,x.length-1),Q=ot(o,U.join("-"));Q?(Q.content.splice(Number.parseInt(x[x.length-1]),1),a("update",o),t(0,o)):(o.content.splice(Number.parseInt(x[x.length-1]),1),a("update",o),t(0,o))}}}function g(D){if(D.preventDefault(),o&&n){const M=n.getAttribute("data-id");if(M){const x=M.split("-"),U=x.slice(0,x.length-1),Q=ot(o,U.join("-")),I=Number.parseInt(x[x.length-1]);if(Q&&I>0){const G=Q.content.splice(I,1);Q.content.splice(I-1,0,...G),u.set(null),a("update",o),t(0,o)}else if(I>0){const G=o.content.splice(I,1);o.content.splice(I-1,0,...G),u.set(null),a("update",o),t(0,o)}}}}function b(D){if(D.preventDefault(),o&&n){const M=n.getAttribute("data-id");if(M){const x=M.split("-"),U=x.slice(0,x.length-1),Q=ot(o,U.join("-")),I=Number.parseInt(x[x.length-1]);if(Q&&I<Q.content.length-1){const G=Q.content.splice(I,1);Q.content.splice(I+1,0,...G),u.set(null),a("update",o),t(0,o)}else if(I<o.content.length-1){const G=o.content.splice(I,1);o.content.splice(I+1,0,...G),u.set(null),a("update",o),t(0,o)}}}}function y(D){if(D.preventDefault(),n!==null&&o){const M=n.getAttribute("data-id");if(M){const x=ot(o,M);x&&(x.attrs.push({type:"",value:""}),a("update",o),t(0,o),u.set(n))}}}function C(D,M){if(D.preventDefault(),n!==null&&o){const x=n.getAttribute("data-id");if(x){const U=ot(o,x);U&&M>=0&&M<U.attrs.length&&(U.attrs[M].type=D.target.value,a("update",o),t(0,o),u.set(n))}}}function w(D,M){if(D.preventDefault(),n!==null&&o){const x=n.getAttribute("data-id");if(x){const U=ot(o,x);U&&M>=0&&M<U.attrs.length&&(U.attrs[M].value=D.target.value,a("update",o),t(0,o),u.set(n))}}}const _=()=>{u.set(null)},T=(D,M)=>{C(M,D)},j=(D,M)=>{w(M,D)},v=(D,M)=>{xd(M)};return r.$$set=D=>{"section"in D&&t(0,o=D.section)},[o,i,s,c,u,f,d,p,h,m,g,b,y,C,w,_,T,j,v]}class Id extends qe{constructor(e){super(),je(this,e,vd,Dd,Ae,{section:0})}}function Oe(r){this.content=r}Oe.prototype={constructor:Oe,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 Oe(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 Oe(t)},addToStart:function(r,e){return new Oe([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Oe(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 Oe(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=Oe.from(r),r.size?new Oe(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Oe.from(r),r.size?new Oe(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Oe.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}};Oe.from=function(r){if(r instanceof Oe)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Oe(e)};function oa(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=oa(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function la(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=la(o.content,a.content,t-1,n-1);if(c)return c}t-=l,n-=l}}class E{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 E(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 E(n,i)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(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 E(i,s)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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 oa(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return la(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 E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.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 E(t||e,n)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const ei={index:0,offset:0};function Qn(r,e){return ei.index=r,ei.offset=e,ei}function yr(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(!yr(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!yr(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let ce=class Oi{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&&yr(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 Oi.none;if(e instanceof Oi)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};ce.none=[];class kr extends Error{}class z{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=ca(this.content,e+this.openStart,t);return n&&new z(n,this.openStart,this.openEnd)}removeBetween(e,t){return new z(aa(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 z.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 z(E.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 z(e,n,i)}}z.empty=new z(E.empty,0,0);function aa(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(aa(s.content,e-i-1,t-i-1)))}function ca(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=ca(o.content,e-s-1,t);return a&&r.replaceChild(i,o.copy(a))}function Pd(r,e,t){if(t.openStart>r.depth)throw new kr("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new kr("Inconsistent open depths");return ua(r,e,t,0)}function ua(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=ua(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 Kt(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Rd(t,r);return Kt(s,da(r,o,a,e,n))}else return Kt(s,_r(r,e,n))}function fa(r,e){if(!e.type.compatibleContent(r.type))throw new kr("Cannot join "+e.type.name+" onto "+r.type.name)}function Ni(r,e,t){let n=r.node(t);return fa(n,e.node(t)),n}function Jt(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 Dn(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&&(Jt(r.nodeAfter,n),s++));for(let a=s;a<o;a++)Jt(i.child(a),n);e&&e.depth==t&&e.textOffset&&Jt(e.nodeBefore,n)}function Kt(r,e){return r.type.checkContent(e),r.copy(e)}function da(r,e,t,n,i){let s=r.depth>i&&Ni(r,e,i+1),o=n.depth>i&&Ni(t,n,i+1),a=[];return Dn(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(fa(s,o),Jt(Kt(s,da(r,e,t,n,i+1)),a)):(s&&Jt(Kt(s,_r(r,e,i+1)),a),Dn(e,t,i,a),o&&Jt(Kt(o,_r(t,n,i+1)),a)),Dn(n,null,i,a),new E(a)}function _r(r,e,t){let n=[];if(Dn(null,r,t,n),r.depth>t){let i=Ni(r,e,t+1);Jt(Kt(i,_r(r,e,t+1)),n)}return Dn(e,null,t,n),new E(n)}function Rd(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(E.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Pn{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 ce.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 Sr(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 Pn(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 Bd);let i=n.elts[n.i]=Pn.resolve(e,t);return n.i=(n.i+1)%zd,i}}class Bd{constructor(){this.elts=[],this.i=0}}const zd=12,co=new WeakMap;class Sr{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 Fd=Object.create(null);let Et=class Ai{constructor(e,t,n,i=ce.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||E.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&&yr(this.attrs,t||e.defaultAttrs||Fd)&&ce.sameSet(this.marks,n||ce.none)}copy(e=null){return e==this.content?this:new Ai(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ai(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 z.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 z(c,i.depth-o,s.depth-o)}replace(e,t,n){return Pd(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 Pn.resolveCached(this,e)}resolveNoCache(e){return Pn.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()+")"),ha(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=E.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=ce.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(!ce.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=E.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Et.prototype.text=void 0;class Cr extends Et{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):ha(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 Cr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cr(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 ha(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ht{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Vd(e,t);if(n.next==null)return Ht.empty;let i=pa(n);n.next&&n.err("Unexpected trailing text");let s=$d(Kd(i));return Ud(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 E.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
|
+
`)}}Ht.empty=new Ht(!0);class Vd{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 pa(r){let e=[];do e.push(Ld(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ld(r){let e=[];do e.push(Wd(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wd(r){let e=Jd(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=qd(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 qd(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 jd(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 Jd(r){if(r.eat("(")){let e=pa(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=jd(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 Kd(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 ma(r,e){return e-r}function fo(r,e){let t=[];return n(e),t.sort(ma);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 $d(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 Ht(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(ma);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Ud(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 ga(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 ba(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 ya(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 ka(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Gd(r,n,e[n]);return t}let ho=class _a{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=ka(e,n.attrs),this.defaultAttrs=ga(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==Ht.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:ba(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Et(this,this.computeAttrs(e),E.from(t),ce.setFrom(n))}createChecked(e=null,t,n){return t=E.from(t),this.checkContent(t),new Et(this,this.computeAttrs(e),t,ce.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=E.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(E.empty,!0);return s?new Et(this,e,t.append(s),ce.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){ya(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:ce.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new _a(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 Hd(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 Gd{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Hd(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Rr{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=ka(e,i.attrs),this.excluded=null;let s=ga(this.attrs);this.instance=s?new ce(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ce(this,ba(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new Rr(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){ya(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Sa{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=Oe.from(e.nodes),t.marks=Oe.from(e.marks||{}),this.nodes=ho.compile(this.spec.nodes,this),this.marks=Rr.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]=Ht.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 Cr(n,n.defaultAttrs,e,ce.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Et.fromJSON(this,e)}markFromJSON(e){return ce.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 Yd(r){return r.tag!=null}function Xd(r){return r.style!=null}class Ot{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Yd(i))this.tags.push(i);else if(Xd(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,ce.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new go(this,t,!0);return n.addAll(e,ce.none,t.from,t.to),z.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(eh(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 Ot(e,Ot.schemaRules(e)))}}const Ca={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},Zd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ma={ol:!0,ul:!0},Rn=1,Di=2,ur=4;function mo(r,e,t){return e!=null?(e?Rn:0)|(e==="full"?Di:0):r&&r.whitespace=="pre"?Rn|Di: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=ce.none,this.match=s||(o&ur?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.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&Rn)){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=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.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&&!Ca.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?ur:0);i?s=new er(i.type,i.attrs,ce.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new er(null,null,ce.none,!0,null,o):s=new er(e.schema.topNodeType,null,ce.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&Di?"full":this.localPreserveWS||(i.options&Rn)>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;Ma.hasOwnProperty(o)&&this.parser.normalizeLists&&Qd(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Zd.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(Ca.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=ce.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&ur&&o.content.length==0&&(a|=ur);let l=ce.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|=Rn)}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 Qd(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Ma.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function eh(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 Xt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ti(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}=fr(ti(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&&fr(ti(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return fr(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Xt(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 ti(r){return r.document||window.document}const _o=new WeakMap;function th(r){let e=_o.get(r);return e===void 0&&_o.set(r,e=nh(r)),e}function nh(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 fr(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=th(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:p,contentDOM:h}=fr(r,d,t,n);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const wa=65535,Ta=Math.pow(2,16);function rh(r,e){return r+e*Ta}function So(r){return r&wa}function ih(r){return(r-(r&wa))/Ta}const Ea=1,Oa=2,dr=4,Na=8;class xi{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Na)>0}get deletedBefore(){return(this.delInfo&(Ea|dr))>0}get deletedAfter(){return(this.delInfo&(Oa|dr))>0}get deletedAcross(){return(this.delInfo&dr)>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+ih(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,p=l+i+(d<0?0:u);if(n)return p;let h=e==(t<0?l:f)?null:rh(a/3,e-l),m=e==l?Oa:e==f?Ea:dr;return(t<0?e!=l:e!=f)&&(m|=Na),new xi(p,m,h)}i+=u-c}return n?e+i:new xi(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 xi(e,i,null)}}const ni=Object.create(null);class Pe{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=ni[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 ni)throw new RangeError("Duplicate use of step JSON ID "+e);return ni[e]=t,t.prototype.jsonID=e,t}}class me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,t,n,i){try{return me.ok(e.replace(t,n,i))}catch(s){if(s instanceof kr)return me.fail(s.message);throw s}}}function rs(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(rs(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return E.fromArray(n)}class Mt extends Pe{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 z(rs(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 me.fromReplace(e,this.from,this.to,s)}invert(){return new at(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 Mt(t.pos,n.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(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 Mt(t.from,t.to,e.markFromJSON(t.mark))}}Pe.jsonID("addMark",Mt);class at extends Pe{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 z(rs(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,n)}invert(){return new Mt(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 at(t.pos,n.pos,this.mark)}merge(e){return e instanceof at&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new at(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 at(t.from,t.to,e.markFromJSON(t.mark))}}Pe.jsonID("removeMark",at);class wt extends Pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new z(E.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 wt(this.pos,t.marks[i]);return new wt(this.pos,this.mark)}}return new gn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wt(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 wt(t.pos,e.markFromJSON(t.mark))}}Pe.jsonID("addNodeMark",wt);class gn extends Pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new z(E.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new gn(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 gn(t.pos,e.markFromJSON(t.mark))}}Pe.jsonID("removeNodeMark",gn);class Ce extends Pe{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&vi(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.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 Ce(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 Ce(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof Ce)||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?z.empty:new z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ce(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?z.empty:new z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ce(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 Ce(t.from,t.to,z.fromJSON(e,t.slice),!!t.structure)}}Pe.jsonID("replace",Ce);class Me extends Pe{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&&(vi(e,this.from,this.gapFrom)||vi(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?me.fromReplace(e,this.from,this.to,n):me.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 Me(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 Me(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 Me(t.from,t.to,t.gapFrom,t.gapTo,z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Pe.jsonID("replaceAround",Me);function vi(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 sh(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),p=Math.min(c+l.nodeSize,t),h=n.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(h)||(o&&o.to==d&&o.mark.eq(f[m])?o.to=p:i.push(o=new at(d,p,f[m])));a&&a.to==d?a.to=p:s.push(a=new Mt(d,p,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function oh(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 Rr){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 p=0;p<i.length;p++){let h=i[p];h.step==s-1&&f.eq(i[p].style)&&(d=h)}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 at(o.from,o.to,o.style)))}function is(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 Ce(a,u,z.empty));else{n=f;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||r.step(new at(a,u,c.marks[d]));if(i&&c.isText&&t.whitespace!="pre"){let d,p=/\r?\n|\r/g,h;for(;d=p.exec(c.text);)h||(h=new z(E.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Ce(a+d.index,a+d.index+d[0].length,h))}}a=u}if(!n.validEnd){let l=n.fillBefore(E.empty,!0);r.replace(a,a,new z(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function lh(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Cn(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||!lh(i,s,o))break}return null}function ah(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=E.empty,f=0;for(let h=s,m=!1;h>t;h--)m||n.index(h)>0?(m=!0,u=E.from(n.node(h).copy(u)),f++):l--;let d=E.empty,p=0;for(let h=s,m=!1;h>t;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=E.from(i.node(h).copy(d)),p++):c++;r.step(new Me(l,c,o,a,new z(u.append(d),f,p),u.size-f,!0))}function Aa(r,e,t=null,n=r){let i=ch(r,e),s=i&&uh(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 ch(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 uh(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 fh(r,e,t){let n=E.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=E.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new Me(i,s,i,s,new z(n,0,0),t.length,!0))}function dh(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)&&hh(r.doc,r.mapping.slice(s).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",h=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&xa(r,o,a,s),is(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 Me(f,d,f+1,d-1,new z(E.from(n.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Da(r,o,a,s),!1}})}function Da(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 xa(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 hh(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function ph(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 Me(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new z(E.from(o),0,0),1,!0))}function fn(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 p=f.content.cutByIndex(d,f.childCount),h=n&&n[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=n&&n[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(p))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 mh(r,e,t=1,n){let i=r.doc.resolve(e),s=E.empty,o=E.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=E.from(i.node(a).copy(s));let u=n&&n[c];o=E.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}r.step(new Ce(e,e,new z(s.append(o),t,t),!0))}function Zt(r,e){let t=r.resolve(e),n=t.index();return va(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function gh(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 va(r,e){return!!(r&&e&&!r.isLeaf&&gh(r,e))}function Br(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&&va(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 bh(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);xa(r,u.node(),u.before(),a)}o.inlineContent&&is(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 Ce(c,l.map(e+t,-1),z.empty,!0)),n===!0){let u=r.doc.resolve(c);Da(r,u.node(),u.before(),r.steps.length)}return r}function yh(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 kh(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 zr(r,e,t=e,n=z.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return Ia(i,s,n)?new Ce(e,t,n):new _h(i,s,n).fit()}function Ia(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class _h{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=E.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=E.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 z(s,o,a);return e>-1?new Me(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Ce(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=ri(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(E.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=ri(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new z(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=ri(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new z(En(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new z(En(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 p=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(Pa(m.mark(d.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=On(this.placed,t,E.from(u)),this.frontier[t].match=f,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=h?e==0?z.empty:new z(En(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new z(En(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||!ii(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=ii(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ii(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=On(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=On(this.placed,this.depth,E.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(E.empty,!0);t.childCount&&(this.placed=On(this.placed,this.frontier.length,t))}}function En(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(En(r.firstChild.content,e-1,t)))}function On(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(On(r.lastChild.content,e-1,t)))}function ri(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function Pa(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,Pa(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(E.empty,!0)))),r.copy(n)}function ii(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&&!Sh(t,s.content,o)?a:null}function Sh(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Ch(r){return r.spec.defining||r.spec.definingForContent}function Mh(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(Ia(i,s,n))return r.step(new Ce(e,t,n));let o=Ba(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,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(d)>-1?a=d:i.before(d)==p&&o.splice(1,0,-d)}let l=o.indexOf(a),c=[],u=n.openStart;for(let d=n.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==n.openStart)break;d=h.content}for(let d=u-1;d>=0;d--){let p=c[d],h=Ch(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=d;else if(h||!p.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let p=(d+u+1)%(n.openStart+1),h=c[p];if(h)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),C=i.index(g-1);if(y.canReplaceWith(C,C,h.type,h.marks))return r.replace(i.before(g),b?s.after(g):t,new z(Ra(n.content,0,n.openStart,p),p,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 p=o[d];p<0||(e=i.before(p),t=s.after(p))}}function Ra(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(Ra(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(E.empty,!0))}return r}function wh(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=yh(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new z(E.from(n),0,0))}function Th(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=Ba(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 Ba(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 dn extends Pe{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 me.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 me.fromReplace(e,this.pos,this.pos+1,new z(E.from(i),0,t.isLeaf?0:1))}getMap(){return $e.empty}invert(e){return new dn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new dn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new dn(t.pos,t.attr,t.value)}}Pe.jsonID("attr",dn);class Bn extends Pe{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 me.ok(n)}getMap(){return $e.empty}invert(e){return new Bn(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 Bn(t.attr,t.value)}}Pe.jsonID("docAttr",Bn);let bn=class extends Error{};bn=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};bn.prototype=Object.create(Error.prototype);bn.prototype.constructor=bn;bn.prototype.name="TransformError";class Eh{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 bn(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=z.empty){let i=zr(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new z(E.from(n),0,0))}delete(e,t){return this.replace(e,t,z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Mh(this,e,t,n),this}replaceRangeWith(e,t,n){return wh(this,e,t,n),this}deleteRange(e,t){return Th(this,e,t),this}lift(e,t){return ah(this,e,t),this}join(e,t=1){return bh(this,e,t),this}wrap(e,t){return fh(this,e,t),this}setBlockType(e,t=e,n,i=null){return dh(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return ph(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new dn(e,t,n)),this}setDocAttribute(e,t){return this.step(new Bn(e,t)),this}addNodeMark(e,t){return this.step(new wt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof ce)){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 gn(e,t)),this}split(e,t=1,n){return mh(this,e,t,n),this}addMark(e,t,n){return sh(this,e,t,n),this}removeMark(e,t,n){return oh(this,e,t,n),this}clearIncompatible(e,t,n){return is(this,e,t,n),this}}const si=Object.create(null);class Z{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Oh(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=z.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?z.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 X(e):on(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?on(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):on(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 Ze(e.node(0))}static atStart(e){return on(e,e,0,0,1)||new Ze(e)}static atEnd(e){return on(e,e,e.content.size,e.childCount,-1)||new Ze(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=si[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 si)throw new RangeError("Duplicate use of selection JSON ID "+e);return si[e]=t,t.prototype.jsonID=e,t}getBookmark(){return X.between(this.$anchor,this.$head).getBookmark()}}Z.prototype.visible=!0;class Oh{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 X extends Z{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 Z.near(n);let i=e.resolve(t.map(this.anchor));return new X(i.parent.inlineContent?i:n,n)}replace(e,t=z.empty){if(super.replace(e,t),t==z.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof X&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Fr(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 X(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=Z.findFrom(t,n,!0)||Z.findFrom(t,-n,!0);if(s)t=s.$head;else return Z.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(Z.findFrom(e,-n,!0)||Z.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new X(e,t)}}Z.jsonID("text",X);class Fr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Fr(e.map(this.anchor),e.map(this.head))}resolve(e){return X.between(e.resolve(this.anchor),e.resolve(this.head))}}class H extends Z{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?Z.near(s):new H(s)}content(){return new z(E.from(this.node),0,0)}eq(e){return e instanceof H&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ss(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new H(e.resolve(t.anchor))}static create(e,t){return new H(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}H.prototype.visible=!1;Z.jsonID("node",H);class ss{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Fr(n,n):new ss(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&H.isSelectable(n)?new H(t):Z.near(t)}}class Ze extends Z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=z.empty){if(t==z.empty){e.delete(0,e.doc.content.size);let n=Z.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ze(e)}map(e){return new Ze(e)}eq(e){return e instanceof Ze}getBookmark(){return Nh}}Z.jsonID("all",Ze);const Nh={map(){return this},resolve(r){return new Ze(r)}};function on(r,e,t,n,i,s=!1){if(e.inlineContent)return X.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&&H.isSelectable(a))return H.create(r,t-(i<0?a.nodeSize:0))}else{let l=on(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 Ce||i instanceof Me))return;let s=r.mapping.maps[n],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),r.setSelection(Z.near(r.doc.resolve(o),t))}const Eo=1,Oo=2,No=4;class Ah extends Eh{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|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 ce.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)||ce.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(Z.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 Nn{constructor(e,t,n){this.name=e,this.init=Ao(t.init,n),this.apply=Ao(t.apply,n)}}const Dh=[new Nn("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Nn("selection",{init(r,e){return r.selection||Z.atStart(e.doc)},apply(r){return r.selection}}),new Nn("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Nn("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class oi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Dh.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 Nn(n.key,n.spec.state,n))})}}class cn{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 cn(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 Ah(this)}static create(e){let t=new oi(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new cn(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 oi(this.schema,e.plugins),n=t.fields,i=new cn(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 oi(e.schema,e.plugins),s=new cn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Et.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Z.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 za(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=za(i,e,{})),t[n]=i}return t}class dt{constructor(e){this.spec=e,this.props={},e.props&&za(e.props,this,this.props),this.key=e.key?e.key.key:Fa("plugin")}getState(e){return e[this.key]}}const li=Object.create(null);function Fa(r){return r in li?r+"$"+ ++li[r]:(li[r]=0,r+"$")}class Qt{constructor(e="key"){this.key=Fa(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ne=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},zn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let Ii=null;const pt=function(r,e,t){let n=Ii||(Ii=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},xh=function(){Ii=null},Gt=function(r,e,t,n){return t&&(Do(r,e,t,n,-1)||Do(r,e,t,n,1))},vh=/^(img|br|input|textarea|hr)$/i;function Do(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Xe(r))){let s=r.parentNode;if(!s||s.nodeType!=1||jn(r)||vh.test(r.nodeName)||r.contentEditable=="false")return!1;e=Ne(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?Xe(r):0}else return!1}}function Xe(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ih(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=Xe(r)}else if(r.parentNode&&!jn(r))e=Ne(r),r=r.parentNode;else return null}}function Ph(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=Ne(r)+1,r=r.parentNode;else return null}}function Rh(r,e,t){for(let n=e==0,i=e==Xe(r);n||i;){if(r==t)return!0;let s=Ne(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Xe(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 Vr=function(r){return r.focusNode&&Gt(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function zt(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function Bh(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function zh(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Xe(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Xe(n.startContainer),n.startOffset)}}}const ct=typeof navigator<"u"?navigator:null,xo=typeof document<"u"?document:null,It=ct&&ct.userAgent||"",Pi=/Edge\/(\d+)/.exec(It),Va=/MSIE \d/.exec(It),Ri=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(It),We=!!(Va||Ri||Pi),Nt=Va?document.documentMode:Ri?+Ri[1]:Pi?+Pi[1]:0,nt=!We&&/gecko\/(\d+)/i.test(It);nt&&+(/Firefox\/(\d+)/.exec(It)||[0,0])[1];const Bi=!We&&/Chrome\/(\d+)/.exec(It),xe=!!Bi,La=Bi?+Bi[1]:0,Be=!We&&!!ct&&/Apple Computer/.test(ct.vendor),yn=Be&&(/Mobile\/\w+/.test(It)||!!ct&&ct.maxTouchPoints>2),Ye=yn||(ct?/Mac/.test(ct.platform):!1),Fh=ct?/Win/.test(ct.platform):!1,gt=/Android \d/.test(It),Jn=!!xo&&"webkitFontSmoothing"in xo.documentElement.style,Vh=Jn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lh(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 ht(r,e){return typeof r=="number"?r:r[e]}function Wh(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=zn(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?Lh(s):Wh(a),u=0,f=0;if(e.top<c.top+ht(n,"top")?f=-(c.top-e.top+ht(i,"top")):e.bottom>c.bottom-ht(n,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+ht(i,"top")-c.top:e.bottom-c.bottom+ht(i,"bottom")),e.left<c.left+ht(n,"left")?u=-(c.left-e.left+ht(i,"left")):e.right>c.right-ht(n,"right")&&(u=e.right-c.right+ht(i,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let d=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let h=a.scrollLeft-d,m=a.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function qh(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:Wa(r.dom)}}function Wa(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=zn(n));return e}function jh({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;qa(t,n==0?0:n-e)}function qa(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 Jh(r){if(r.setActive)return r.setActive();if(nn)return r.focus(nn);let e=Wa(r);r.focus(nn==null?{get preventScroll(){return nn={preventScroll:!0},!0}}:void 0),nn||(nn=!1,qa(e,0))}function ja(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=pt(u).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=o&&h.bottom>=a){o=Math.max(h.bottom,o),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<n){t=u,n=m,i=m&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(s=f+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=f+1)}}return!t&&l&&(t=l,i=c,n=0),t&&t.nodeType==3?Kh(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:ja(t,i)}function Kh(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=kt(n,1);if(s.top!=s.bottom&&ls(e,s))return{node:r,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:r,offset:0}}function ls(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function $h(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function Uh(r,e,t){let{node:n,offset:i}=ja(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 Hh(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 Ja(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(ls(e,c))return Ja(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function Gh(r,e){let t=r.dom.ownerDocument,n,i=0,s=zh(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(!ls(e,c)||(o=Ja(r.dom,e,c),!o))return null}if(Be)for(let c=o;n&&c;c=zn(c))c.draggable&&(n=void 0);if(o=$h(o,e),n){if(nt&&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=Hh(r,n,i,e))}a==null&&(a=Uh(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 kt(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 Yh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ka(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=Jn||nt;if(n.nodeType==3)if(o&&(Yh.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=kt(pt(n,i,i),t);if(nt&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=kt(pt(n,i-1,i-1),-1);if(c.top==l.top){let u=kt(pt(n,i,i+1),-1);if(u.top!=l.top)return wn(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++,wn(kt(pt(n,l,c),u),u<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Xe(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return ai(l.getBoundingClientRect(),!1)}if(s==null&&i<Xe(n)){let l=n.childNodes[i];if(l.nodeType==1)return ai(l.getBoundingClientRect(),!0)}return ai(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Xe(n))){let l=n.childNodes[i-1],c=l.nodeType==3?pt(l,Xe(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return wn(kt(c,1),!1)}if(s==null&&i<Xe(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?pt(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return wn(kt(c,-1),!0)}return wn(kt(n.nodeType==3?pt(n):n,-t),t>=0)}function wn(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 ai(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 $a(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 Xh(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return $a(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=Ka(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=pt(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 Zh=/[\u0590-\u08ac]/;function Qh(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?!Zh.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:$a(r,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=r.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",t,"character");let p=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:h,focusOffset:m}=r.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&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 ep(r,e,t){return Po==e&&Ro==t?Bo:(Po=e,Ro=t,Bo=t=="up"||t=="down"?Xh(r,e,t):Qh(r,e,t))}const Qe=0,zo=1,Lt=2,ut=3;class Kn{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Qe,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>Ne(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 Ha){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 Ua&&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?Ne(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?Ne(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=Ne(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=Ne(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 p=0,h=0;p<this.children.length;p++){let m=this.children[p],g=h+m.size;if(s>h&&o<g)return m.setSelection(e-h-m.border,t-h-m.border,n,i);h=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((nt||Be)&&e==t){let{node:p,offset:h}=a;if(p.nodeType==3){if(f=!!(h&&p.nodeValue[h-1]==`
|
|
108
|
+
`),f&&h==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ne(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=p.childNodes[h-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nt&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&Be)&&Gt(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Gt(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 h=a;a=l,l=h}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,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?Lt:zo,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ut:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Lt:ut}n=o}this.dirty=Lt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Lt:zo;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Ua extends Kn{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==Qe&&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 tp extends Kn{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 Yt extends Kn{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=Xt.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Yt(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ut||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ut&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Qe){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Qe}}slice(e,t,n){let i=Yt.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=Fi(s,t,o,n)),e>0&&(s=Fi(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 At extends Kn{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}=Xt.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=Xa(u,n,t),c?l=new np(e,t,n,i,u,f||null,d,c,s,o+1):t.isText?new Lr(e,t,n,i,u,d,s):new At(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=()=>E.empty)}return e}matchesNode(e,t,n){return this.dirty==Qe&&e.eq(this.node)&&Mr(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 ip(this,o&&o.node,e);lp(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?ce.none:this.node.child(u).marks,n,e),l.placeWidget(c,e,i)},(c,u,f,d)=>{l.syncToMarks(c.marks,n,e);let p;l.findNodeMatch(c,u,f,d)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,f,p,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==Lt)&&(o&&this.protectLocalComposition(e,o),Ga(this.contentDOM,this.children,e),yn&&ap(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof X)||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=cp(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 tp(this,s,t,i);e.input.compositionNodes.push(o),this.children=Fi(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==ut||!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=Qe}updateOuterDeco(e){if(Mr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Ya(this.dom,this.nodeDOM,zi(this.outerDeco,this.node,t),zi(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){Xa(n,e,r);let s=new At(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Lr extends At{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==ut||this.dirty!=Qe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Qe||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=Qe,!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 Lr(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=ut)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ha extends Kn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Qe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class np extends At{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==ut)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 Ga(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 Yt){let l=n?n.previousSibling:r.lastChild;Ga(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 vn=function(r){r&&(this.nodeName=r)};vn.prototype=Object.create(null);const Wt=[new vn];function zi(r,e,t){if(r.length==0)return Wt;let n=t?Wt[0]:new vn,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new vn(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(n=new vn(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 Ya(r,e,t,n){if(t==Wt&&n==Wt)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=Wt[0]),i=l}rp(i,a||Wt[0],o)}return i}function rp(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 Xa(r,e,t){return Ya(r,r,Wt,zi(e,t,r.nodeType!=1))}function Mr(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 ip{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=sp(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=Qe,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=Yt.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==ut&&o.dom==o.contentDOM&&(o.dirty=Lt),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 At){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!=ut&&Mr(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=Lt,f.updateChildren(i,o+1),f.dirty=Qe),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)||!Mr(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=At.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=At.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 Ua(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 Yt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Lr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Be||xe)&&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 Ha(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 sp(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 Yt)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 op(r,e){return r.type.side-e.type.side}function lp(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(op);for(let g=0;g<f.length;g++)t(f[g],c,!!l)}else t(u,c,!!l);let d,p;if(l)p=-1,d=l,l=null;else if(c<r.childCount)p=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 h=s+d.nodeSize;if(d.isText){let g=h;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<h&&(l=d.cut(g-s),d=d.cut(0,g-s),h=g,p=-1)}else for(;o<i.length&&i[o].to<h;)o++;let m=d.isInline&&!d.isLeaf?a.filter(g=>!g.inline):a.slice();n(d,m,e.forChild(s,d),p),s=h}}function ap(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 cp(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 Fi(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 as(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(Vr(t)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&H.isSelectable(f)&&i.parent&&!(f.isInline&&Rh(t.focusNode,t.focusOffset,i.dom))){let d=i.posBefore;c=new H(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 p=0;p<t.rangeCount;p++){let h=t.getRangeAt(p);f=Math.min(f,r.docView.posFromDOM(h.startContainer,h.startOffset,1)),d=Math.max(d,r.docView.posFromDOM(h.endContainer,h.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=cs(r,u,a,f)}return c}function Za(r){return r.editable?r.hasFocus():ec(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function bt(r,e=!1){let t=r.state.selection;if(Qa(r,t),!!Za(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&xe){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&Gt(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)fp(r);else{let{anchor:n,head:i}=t,s,o;Lo&&!(t instanceof X)&&(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&&up(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const Lo=Be||xe&&La<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(Be&&i&&i.contentEditable=="false")return ci(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ci(i);if(s)return ci(s)}}function ci(r){return r.contentEditable="true",Be&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function qo(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function up(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(()=>{(!Za(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function fp(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,Ne(n)+1):t.setStart(n,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!r.state.selection.visible&&We&&Nt<=11&&(n.disabled=!0,n.disabled=!1)}function Qa(r,e){if(e instanceof H){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 cs(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||X.between(e,t,n)}function Jo(r){return r.editable&&!r.hasFocus()?!1:ec(r)}function ec(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 dp(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return Gt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Vi(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&&Z.findFrom(s,e)}function _t(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function Ko(r,e,t){let n=r.state.selection;if(n instanceof X)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 _t(r,new X(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Vi(r.state,e);return i&&i instanceof H?_t(r,i):!1}else if(!(Ye&&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?H.isSelectable(s)?_t(r,new H(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):Jn?_t(r,new X(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof H&&n.node.isInline)return _t(r,new X(e>0?n.$to:n.$from));{let i=Vi(r.state,e);return i?_t(r,i):!1}}}function wr(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function In(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?hp(r):pp(r)}function hp(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(nt&&t.nodeType==1&&n<wr(t)&&In(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(In(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(tc(t))break;{let a=t.previousSibling;for(;a&&In(a,-1);)i=t.parentNode,s=Ne(a),a=a.previousSibling;if(a)t=a,n=wr(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Li(r,t,n):i&&Li(r,i,s)}function pp(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=wr(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(In(a,1))s=t,o=++n;else break}else{if(tc(t))break;{let a=t.nextSibling;for(;a&&In(a,1);)s=a.parentNode,o=Ne(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=wr(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Li(r,s,o)}function tc(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function mp(r,e){for(;r&&e==r.childNodes.length&&!jn(r);)e=Ne(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 gp(r,e){for(;r&&!e&&!jn(r);)e=Ne(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 Li(r,e,t){if(e.nodeType!=3){let s,o;(o=mp(e,t))?(e=o,t=0):(s=gp(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(Vr(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&&bt(r)},50)}function $o(r,e){let t=r.state.doc.resolve(e);if(!(xe||Fh)&&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 X&&!n.empty||t.indexOf("s")>-1||Ye&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Vi(r.state,e);if(o&&o instanceof H)return _t(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof Ze?Z.near(o,e):Z.findFrom(o,e);return a?_t(r,a):!1}return!1}function Ho(r,e){if(!(r.state.selection instanceof X))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 bp(r){if(!Be||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 yp(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function kp(r,e){let t=e.keyCode,n=yp(e);if(t==8||Ye&&t==72&&n=="c")return Ho(r,-1)||rn(r,-1);if(t==46&&!e.shiftKey||Ye&&t==68&&n=="c")return Ho(r,1)||rn(r,1);if(t==13||t==27)return!0;if(t==37||Ye&&t==66&&n=="c"){let i=t==37?$o(r,r.state.selection.from)=="ltr"?-1:1:-1;return Ko(r,i,n)||rn(r,i)}else if(t==39||Ye&&t==70&&n=="c"){let i=t==39?$o(r,r.state.selection.from)=="ltr"?1:-1:1;return Ko(r,i,n)||rn(r,i)}else{if(t==38||Ye&&t==80&&n=="c")return Uo(r,-1,n)||rn(r,-1);if(t==40||Ye&&t==78&&n=="c")return bp(r)||Uo(r,1,n)||rn(r,1);if(n==(Ye?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function nc(r,e){r.someProp("transformCopied",p=>{e=p(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 p=n.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let o=r.someProp("clipboardSerializer")||Xt.fromSchema(r.state.schema),a=ac(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=lc[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),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",p=>p(e,r))||e.content.textBetween(0,e.content.size,`
|
|
109
|
+
|
|
110
|
+
`);return{dom:l,text:d,slice:e}}function rc(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 z(E.from(r.state.schema.text(e.replace(/\r\n?/g,`
|
|
111
|
+
`))),0,0):z.empty;let f=r.someProp("clipboardTextParser",d=>d(e,i,n,r));if(f)a=f;else{let d=i.marks(),{schema:p}=r.state,h=Xt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else r.someProp("transformPastedHTML",f=>{t=f(t,r)}),o=Mp(t),Jn&&wp(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")||Ot.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!_p.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Tp(Yo(a,+u[1],+u[2]),u[4]);else if(a=z.maxOpen(Sp(a.content,i),!0),a.openStart||a.openEnd){let f=0,d=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;d<a.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);a=Yo(a,f,d)}return r.someProp("transformPasted",f=>{a=f(a,r)}),a}const _p=/^(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 Sp(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&&sc(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=oc(o[o.length-1],s.length));let u=ic(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return E.from(o)}return r}function ic(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,E.from(r));return r}function sc(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=sc(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(E.from(ic(t,r,i+1))))}}function oc(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,oc(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(E.empty,!0);return r.copy(t.append(n))}function Wi(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=Wi(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(E.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Yo(r,e,t){return e<r.openStart&&(r=new z(Wi(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new z(Wi(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const lc={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 ac(){return Xo||(Xo=document.implementation.createHTMLDocument("title"))}let ui=null;function Cp(r){let e=window.trustedTypes;return e?(ui||(ui=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ui.createHTML(r)):r}function Mp(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=ac().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&lc[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Cp(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function wp(r){let e=r.querySelectorAll(xe?"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 Tp(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=E.from(l.create(n[a+1],i)),s++,o++}return new z(i,s,o)}const ze={},Fe={},Ep={touchstart:!0,touchmove:!0};class Op{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 Np(r){for(let e in ze){let t=ze[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Dp(r,n)&&!us(r,n)&&(r.editable||!(n.type in Fe))&&t(r,n)},Ep[e]?{passive:!0}:void 0)}Be&&r.dom.addEventListener("input",()=>null),qi(r)}function Tt(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Ap(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 qi(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>us(r,n))})}function us(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Dp(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 xp(r,e){!us(r,e)&&ze[e.type]&&(r.editable||!(e.type in Fe))&&ze[e.type](r,e)}Fe.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!uc(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(gt&&xe&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),yn&&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,zt(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||kp(r,t)?t.preventDefault():Tt(r,"key")};Fe.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Fe.keypress=(r,e)=>{let t=e;if(uc(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ye&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof X)||!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 Wr(r){return{left:r.clientX,top:r.clientY}}function vp(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function fs(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 hn(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 Ip(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&H.isSelectable(n)?(hn(r,new H(t)),!0):!1}function Pp(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof H&&(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(H.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?(hn(r,H.create(r.state.doc,i)),!0):!1}function Rp(r,e,t,n,i){return fs(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Pp(r,t):Ip(r,t))}function Bp(r,e,t,n){return fs(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function zp(r,e,t,n){return fs(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||Fp(r,t,n)}function Fp(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(hn(r,X.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)hn(r,X.create(n,a+1,a+1+o.content.size));else if(H.isSelectable(o))hn(r,H.create(n,a));else continue;return!0}}function ds(r){return Tr(r)}const cc=Ye?"metaKey":"ctrlKey";ze.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=ds(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&vp(t,r.input.lastClick)&&!t[cc]&&(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(Wr(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new Vp(r,o,t,!!n)):(s=="doubleClick"?Bp:zp)(r,o.pos,o.inside,t)?t.preventDefault():Tt(r,"pointer"))};class Vp{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[cc],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 H&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nt&&!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)),Tt(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(()=>bt(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(Wr(e))),this.updateAllowDefault(e),this.allowDefault||!t?Tt(this.view,"pointer"):Rp(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Be&&this.mightDrag&&!this.mightDrag.node.isAtom||xe&&!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)?(hn(this.view,Z.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Tt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tt(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)}}ze.touchstart=r=>{r.input.lastTouch=Date.now(),ds(r),Tt(r,"pointer")};ze.touchmove=r=>{r.input.lastTouch=Date.now(),Tt(r,"pointer")};ze.contextmenu=r=>ds(r);function uc(r,e){return r.composing?!0:Be&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const Lp=gt?5e3:-1;Fe.compositionstart=Fe.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof X&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),Tr(r,!0),r.markCursor=null;else if(Tr(r,!e.selection.empty),nt&&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}fc(r,Lp)};Fe.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++,fc(r,20))};function fc(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Tr(r),e))}function dc(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=qp());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function Wp(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Ih(e.focusNode,e.focusOffset),n=Ph(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 qp(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Tr(r,e=!1){if(!(gt&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),dc(r),e||r.docView&&r.docView.dirty){let t=as(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 jp(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 Fn=We&&Nt<15||yn&&Vh<604;ze.copy=Fe.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Fn?null:t.clipboardData,o=n.content(),{dom:a,text:l}=nc(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):jp(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Jp(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function Kp(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?Vn(r,n.value,null,i,e):Vn(r,n.textContent,n.innerHTML,i,e)},50)}function Vn(r,e,t,n,i){let s=rc(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||z.empty)))return!0;if(!s)return!1;let o=Jp(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 hc(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," "):""}Fe.paste=(r,e)=>{let t=e;if(r.composing&&!gt)return;let n=Fn?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Vn(r,hc(n),n.getData("text/html"),i,t)?t.preventDefault():Kp(r,t)};class pc{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const mc=Ye?"altKey":"ctrlKey";ze.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(Wr(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof H?i.to-1:i.to))){if(n&&n.mightDrag)o=H.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=H.create(r.state.doc,f.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=nc(r,a);(!t.dataTransfer.files.length||!xe||La>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Fn?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Fn||t.dataTransfer.setData("text/plain",c),r.dragging=new pc(u,!t[mc],o)};ze.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Fe.dragover=Fe.dragenter=(r,e)=>e.preventDefault();Fe.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(Wr(t));if(!i)return;let s=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",h=>{o=h(o,r)}):o=rc(r,hc(t.dataTransfer),Fn?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(n&&!t[mc]);if(r.someProp("handleDrop",h=>h(r,t,o||z.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?kh(r.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=r.state.tr;if(a){let{node:h}=n;h?h.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 p=c.doc.resolve(u);if(f&&H.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new H(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,y)=>h=y),c.setSelection(cs(r,p,c.doc.resolve(h)))}r.focus(),r.dispatch(c.setMeta("uiEvent","drop"))};ze.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())&&bt(r)},20))};ze.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)};ze.beforeinput=(r,e)=>{if(xe&>&&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,zt(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 Fe)ze[r]=Fe[r];function Ln(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 Er{constructor(e,t){this.toDOM=e,this.spec=t||$t,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 tt(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Er&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ln(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dt{constructor(e,t){this.attrs=e,this.spec=t||$t}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 tt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dt&&Ln(this.attrs,e.attrs)&&Ln(this.spec,e.spec)}static is(e){return e.type instanceof Dt}destroy(){}}class hs{constructor(e,t){this.attrs=e,this.spec=t||$t}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 tt(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 hs&&Ln(this.attrs,e.attrs)&&Ln(this.spec,e.spec)}destroy(){}}class tt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new tt(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 tt(e,e,new Er(t,n))}static inline(e,t,n,i){return new tt(e,t,new Dt(n,i))}static node(e,t,n,i){return new tt(e,t,new hs(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dt}get widget(){return this.type instanceof Er}}const ln=[],$t={};class Se{constructor(e,t){this.local=e.length?e:ln,this.children=t.length?t:ln}static create(e,t){return t.length?Or(t,e,0,$t):De}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==De||e.maps.length==0?this:this.mapInner(e,t,0,0,n||$t)}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?$p(this.children,o||[],e,t,n,i,s):o?new Se(o.sort(Ut),ln):De}add(e,t){return t.length?this==De?Se.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=bc(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,Or(u,a,c+1,$t)),s+=3}});let o=gc(s?yc(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Se(o.length?this.local.concat(o).sort(Ut):this.local,i||this.children)}remove(e){return e.length==0||this==De?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!=De?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 Se(i,n):De}forChild(e,t){if(this==De)return this;if(t.isLeaf)return Se.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 Dt){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 Se(i.sort(Ut),ln);return n?new Ct([a,n]):a}return n||De}eq(e){if(this==e)return!0;if(!(e instanceof Se)||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 ps(this.localsInner(e))}localsInner(e){if(this==De)return ln;if(e.inlineContent||!this.local.some(Dt.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Dt||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]);Se.removeOverlap=ps;const De=Se.empty;class Ct{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,$t));return Ct.from(n)}forChild(e,t){if(t.isLeaf)return Se.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=De&&(s instanceof Ct?n=n.concat(s.members):n.push(s))}return Ct.from(n)}eq(e){if(!(e instanceof Ct)||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?ps(n?t:t.sort(Ut)):ln}static from(e){switch(e.length){case 0:return De;case 1:return e[0];default:return new Ct(e.every(t=>t instanceof Se)?e:e.reduce((t,n)=>t.concat(n instanceof Se?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function $p(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,p,h,m)=>{let g=m-h-(p-d);for(let b=0;b<a.length;b+=3){let y=a[b+1];if(y<0||d>y+u-f)continue;let C=a[b]+u-f;p>=C?a[b+1]=d<=C?-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),p=d-i,{index:h,offset:m}=n.content.findIndex(f),g=n.maybeChild(h);if(g&&m==f&&m+g.nodeSize==p){let b=a[c+2].mapInner(t,g,u+1,r[c]+s+1,o);b!=De?(a[c]=f,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Up(a,r,e,t,i,s,o),u=Or(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 p=u.children[f];for(;d<a.length&&a[d]<p;)d+=3;a.splice(d,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Se(e.sort(Ut),a)}function gc(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 tt(i.from+e,i.to+e,i.type))}return t}function Up(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 bc(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 yc(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Or(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=bc(r,a,l+t);if(c){s=!0;let u=Or(c,a,t+l+1,n);u!=De&&i.push(l,l+a.nodeSize,u)}});let o=gc(s?yc(r):r,-t).sort(Ut);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 Se(o,i):De}function Ut(r,e){return r.from-e.from||r.to-e.to}function ps(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&&Ut(t,r[e])>0;)e++;r.splice(e,0,t)}function fi(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=De&&e.push(n)}),r.cursorWrapper&&e.push(Se.create(r.state.doc,[r.cursorWrapper.deco])),Ct.from(e)}const Hp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gp=We&&Nt<=11;class Yp{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 Xp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Yp,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]);We&&Nt<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Gp&&(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,Hp)),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 bt(this.view);if(We&&Nt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gt(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=zn(s))t.add(s);for(let s=e.anchorNode;s;s=zn(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(nt&&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 p=d.parentNode;p&&p.nodeName=="LI"&&(!f||em(e,f)!=p)&&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&&Vr(n)&&(c=as(e))&&c.eq(Z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bt(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Zp(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||bt(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(We&&Nt<=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?Ne(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Ne(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 Zp(r){if(!Qo.has(r)&&(Qo.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=nt,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 Gt(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function Qp(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 em(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 tm(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}],Vr(l)||c.push({node:l.focusNode,offset:l.focusOffset})),xe&&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")||Ot.fromSchema(r.state.schema),p=f.resolve(o),h=null,m=d.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:nm,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),h={anchor:g+o,head:b+o}}return{doc:m,sel:h,from:o,to:a}}function nm(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(Be&&/^(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||Be&&/^(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 rm=/^(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 im(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let D=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,M=as(r,D);if(M&&!r.state.selection.eq(M)){if(xe&>&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",U=>U(r,zt(13,"Enter"))))return;let x=r.state.tr.setSelection(M);D=="pointer"?x.setMeta("pointer",!0):D=="key"&&x.scrollIntoView(),s&&x.setMeta("composition",s),r.dispatch(x)}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=tm(r,e,t),u=r.state.doc,f=u.slice(c.from,c.to),d,p;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(d=r.state.selection.to,p="end"):(d=r.state.selection.from,p="start"),r.input.lastKeyCode=null;let h=lm(f.content,c.doc.content,c.from,d,p);if(h&&r.input.domChangeCount++,(yn&&r.input.lastIOSEnter>Date.now()-225||gt)&&i.some(D=>D.nodeType==1&&!rm.test(D.nodeName))&&(!h||h.endA>=h.endB)&&r.someProp("handleKeyDown",D=>D(r,zt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!h)if(n&&l instanceof X&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let D=nl(r,r.state.doc,c.sel);if(D&&!D.eq(r.state.selection)){let M=r.state.tr.setSelection(D);s&&M.setMeta("composition",s),r.dispatch(M)}}return}r.state.selection.from<r.state.selection.to&&h.start==h.endB&&r.state.selection instanceof X&&(h.start>r.state.selection.from&&h.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?h.start=r.state.selection.from:h.endA<r.state.selection.to&&h.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(h.endB+=r.state.selection.to-h.endA,h.endA=r.state.selection.to)),We&&Nt<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),b=u.resolve(h.start),y=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA,C;if((yn&&r.input.lastIOSEnter>Date.now()-225&&(!y||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!y&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(C=Z.findFrom(c.doc.resolve(m.pos+1),1,!0))&&C.head==g.pos)&&r.someProp("handleKeyDown",D=>D(r,zt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>h.start&&om(u,h.start,h.endA,m,g)&&r.someProp("handleKeyDown",D=>D(r,zt(8,"Backspace")))){gt&&xe&&r.domObserver.suppressSelectionUpdates();return}xe&&h.endB==h.start&&(r.input.lastChromeDelete=Date.now()),gt&&!y&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(D){return D(r,zt(13,"Enter"))})},20));let w=h.start,_=h.endA,T,j,v;if(y){if(m.pos==g.pos)We&&Nt<=11&&m.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>bt(r),20)),T=r.state.tr.delete(w,_),j=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(v=sm(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start()))))T=r.state.tr,v.type=="add"?T.addMark(w,_,v.mark):T.removeMark(w,_,v.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let D=m.parent.textBetween(m.parentOffset,g.parentOffset);if(r.someProp("handleTextInput",M=>M(r,w,_,D)))return;T=r.state.tr.insertText(D,w,_)}}if(T||(T=r.state.tr.replace(w,_,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let D=nl(r,T.doc,c.sel);D&&!(xe&&r.composing&&D.empty&&(h.start!=h.endB||r.input.lastChromeDelete<Date.now()-100)&&(D.head==w||D.head==T.mapping.map(_)-1)||We&&D.empty&&D.head==w)&&T.setSelection(D)}j&&T.ensureMarks(j),s&&T.setMeta("composition",s),r.dispatch(T.scrollIntoView())}function nl(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:cs(r,e.resolve(t.anchor),e.resolve(t.head))}function sm(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(E.from(c).eq(r))return{mark:a,type:o}}function om(r,e,t,n,i){if(t-e<=i.pos-n.pos||di(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(di(s,!0,!0));return!o.parent.isTextblock||o.pos>t||di(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function di(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 lm(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 am{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 Op,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),fi(this),this.dom,this),this.domObserver=new Xp(this,(n,i,s,o)=>im(this,n,i,s,o)),this.domObserver.start(),Np(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&&qi(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&&(dc(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 p=ll(this);um(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&qi(this),this.editable=ol(this),sl(this);let l=fi(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&&qh(this);if(o){this.domObserver.stop();let p=f&&(We||xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&cm(i.selection,e.selection);if(f){let h=xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wp(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)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&dp(this))?bt(this,p):(Qa(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&&jh(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof H){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 pc(e.slice,e.move,i<0?void 0:H.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(We){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&&Jh(this.dom),bt(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 Gh(this,e)}coordsAtPos(e,t=1){return Ka(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 ep(this,t||this.state,e)}pasteHTML(e,t){return Vn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Vn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Ap(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xh())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xp(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?Be&&this.root.nodeType===11&&Bh(this.dom.ownerDocument)==this.dom&&Qp(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"),[tt.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:tt.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 cm(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 um(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 fm=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function dm(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))fm?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 hm(r){let e=Object.create(null);for(let t in r)e[dm(t)]=r[t];return e}function hi(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 pm(r){return new dt({props:{handleKeyDown:mm(r)}})}function mm(r){let e=hm(r);return function(t,n){let i=vu(n),s,o=e[hi(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[hi(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=Iu[n.keyCode])&&s!=i){let a=e[hi(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const gm=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function kc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const bm=(r,e,t)=>{let n=kc(r,t);if(!n)return!1;let i=ms(n);if(!i){let o=n.blockRange(),a=o&&Cn(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Mc(r,i,e,-1))return!0;if(n.parent.content.size==0&&(kn(s,"end")||H.isSelectable(s)))for(let o=n.depth;;o--){let a=zr(r.doc,n.before(o),n.after(o),z.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(kn(s,"end")?Z.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):H.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},ym=(r,e,t)=>{let n=kc(r,t);if(!n)return!1;let i=ms(n);return i?_c(r,i,e):!1},km=(r,e,t)=>{let n=Sc(r,t);if(!n)return!1;let i=gs(n);return i?_c(r,i,e):!1};function _c(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=zr(r.doc,s,l,z.empty);if(!c||c.from!=s||c instanceof Ce&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(X.create(u.doc,s)),t(u.scrollIntoView())}return!0}function kn(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 _m=(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=ms(n)}let o=s&&s.nodeBefore;return!o||!H.isSelectable(o)?!1:(e&&e(r.tr.setSelection(H.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ms(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 Sc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Sm=(r,e,t)=>{let n=Sc(r,t);if(!n)return!1;let i=gs(n);if(!i)return!1;let s=i.nodeAfter;if(Mc(r,i,e,1))return!0;if(n.parent.content.size==0&&(kn(s,"start")||H.isSelectable(s))){let o=zr(r.doc,n.before(),n.after(),z.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(kn(s,"start")?Z.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):H.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},Cm=(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=gs(n)}let o=s&&s.nodeAfter;return!o||!H.isSelectable(o)?!1:(e&&e(r.tr.setSelection(H.create(r.doc,s.pos)).scrollIntoView()),!0)};function gs(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 Mm=(r,e)=>{let t=r.selection,n=t instanceof H,i;if(n){if(t.node.isTextblock||!Zt(r.doc,t.from))return!1;i=t.from}else if(i=Br(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(H.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},wm=(r,e)=>{let t=r.selection,n;if(t instanceof H){if(t.node.isTextblock||!Zt(r.doc,t.to))return!1;n=t.to}else if(n=Br(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},Tm=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&Cn(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},Em=(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 Cc(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 Om=(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=Cc(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(Z.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Nm=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Ze||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=Cc(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(X.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Am=(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(fn(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&Cn(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)},Dm=(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(H.create(r.doc,i))),!0)};function xm(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||Zt(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function Mc(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&xm(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 p=e.pos+s.nodeSize,h=E.empty;for(let b=o.length-1;b>=0;b--)h=E.from(o[b].create(null,h));h=E.from(i.copy(h));let m=r.tr.step(new Me(e.pos-1,p,e.pos,p,new z(h,1,0),o.length,!0)),g=m.doc.resolve(p+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Zt(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:Z.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),d=f&&Cn(f);if(d!=null&&d>=e.depth)return t&&t(r.tr.lift(f,d).scrollIntoView()),!0;if(c&&kn(s,"start",!0)&&kn(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let b=E.empty;for(let C=h.length-1;C>=0;C--)b=E.from(h[C].copy(b));let y=r.tr.step(new Me(e.pos-h.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new z(b,h.length,0),0,!0));t(y.scrollIntoView())}return!0}}return!1}function wc(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(X.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const vm=wc(-1),Im=wc(1);function Pm(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Aa(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 Rm(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 Bm(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function Bm(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 Sr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Sr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Aa(s,t,n,e);return a?(r&&zm(r,e,a,i,t),!0):!1}function zm(r,e,t,n,i){let s=E.empty;for(let u=t.length-1;u>=0;u--)s=E.from(t[u].type.create(t[u].attrs,s));r.step(new Me(e.start-(n?2:0),e.end,e.start,e.end,new z(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&&fn(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return r}function Fm(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?Vm(e,t,r,s):Lm(e,t,s):!0:!1}}function Vm(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new Me(s-1,o,s,o,new z(E.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new Sr(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=Cn(n);if(a==null)return!1;i.lift(n,a);let l=i.mapping.map(s,-1)-1;return Zt(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function Lm(r,e,t){let n=r.tr,i=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=i.child(h).nodeSize,n.delete(p-1,p+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?E.empty:E.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return n.step(new Me(f-(a?1:0),d+(l?1:0),f+1,d-1,new z((a?E.empty:E.from(i.copy(E.empty))).append(l?E.empty:E.from(i.copy(E.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function Wm(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=E.from(c?r.create():null),f=new z(E.from(r.create(null,E.from(a.type.create(null,u)))),c?3:1,0),d=s.start,p=s.end;t(e.tr.step(new Me(d-(c?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function qr(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 jr{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,p])=>[d,(...m)=>{const g=this.buildProps(c,t),b=p(...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:qr({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 qm{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 q(r,e,t){return r.config[e]===void 0&&r.parent?q(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?q(r.parent,e,t):null}):r.config[e]}function Jr(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 Tc(r){const e=[],{nodeExtensions:t,markExtensions:n}=Jr(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=q(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([d,p])=>{e.push({type:f,name:d,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=q(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 Te(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 jm(...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(p=>p.trim());c.set(f,d)}),a.forEach(u=>{const[f,d]=u.split(":").map(p=>p.trim());c.set(f,d)}),n[i]=Array.from(c.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else n[i]=s}),n},{})}function ji(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)=>jm(t,n),{})}function Ec(r){return typeof r=="function"}function ee(r,e=void 0,...t){return Ec(r)?e?r.bind(e)(...t):r(...t):r}function Jm(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Km(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):Km(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"&&Jm(t)?!1:t!=null))}function $m(r,e){var t;const n=Tc(r),{nodeExtensions:i,markExtensions:s}=Jr(r),o=(t=i.find(c=>q(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 C=q(y,"extendNodeSchema",f);return{...b,...C?C(c):{}}},{}),p=fl({...d,content:ee(q(c,"content",f)),marks:ee(q(c,"marks",f)),group:ee(q(c,"group",f)),inline:ee(q(c,"inline",f)),atom:ee(q(c,"atom",f)),selectable:ee(q(c,"selectable",f)),draggable:ee(q(c,"draggable",f)),code:ee(q(c,"code",f)),whitespace:ee(q(c,"whitespace",f)),linebreakReplacement:ee(q(c,"linebreakReplacement",f)),defining:ee(q(c,"defining",f)),isolating:ee(q(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}]}))}),h=ee(q(c,"parseHTML",f));h&&(p.parseDOM=h.map(b=>ul(b,u)));const m=q(c,"renderHTML",f);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:ji(b,u)}));const g=q(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),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=q(b,"extendMarkSchema",f);return{...g,...y?y(c):{}}},{}),p=fl({...d,inclusive:ee(q(c,"inclusive",f)),excludes:ee(q(c,"excludes",f)),group:ee(q(c,"group",f)),spanning:ee(q(c,"spanning",f)),code:ee(q(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}]}))}),h=ee(q(c,"parseHTML",f));h&&(p.parseDOM=h.map(g=>ul(g,u)));const m=q(c,"renderHTML",f);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:ji(g,u)})),[c.name,p]}));return new Sa({topNode:o,nodes:a,marks:l})}function pi(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 bs(r,e){const t=Xt.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Um=(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 ys(r){return Object.prototype.toString.call(r)==="[object RegExp]"}const Hm=(r,e)=>{if(ys(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=Um(c)+s;return o.forEach(d=>{if(u)return;const p=Hm(f,d.find);if(!p)return;const h=l.state.tr,m=qr({state:l.state,transaction:h}),g={from:n-(p[0].length-s.length),to:i},{commands:b,chain:y,can:C}=new jr({editor:t,state:m});d.handler({state:m,range:g,match:p,commands:b,chain:y,can:C})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:n,to:i,text:s}),l.dispatch(h),u=!0)}),u}function Gm(r){const{editor:e,rules:t}=r,n=new dt({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=bs(E.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 Ym(r){return Object.prototype.toString.call(r).slice(8,-1)}function nr(r){return Ym(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Kr(r,e){const t={...r};return nr(r)&&nr(e)&&Object.keys(e).forEach(n=>{nr(e[n])&&nr(r[n])?t[n]=Kr(r[n],e[n]):t[n]=e[n]}),t}class Wn{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=ee(q(this,"addOptions",{name:this.name}))),this.storage=ee(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Kr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Wn(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=ee(q(t,"addOptions",{name:t.name})),t.storage=ee(q(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 Xm(r){return typeof r=="number"}const Zm=(r,e,t)=>{if(ys(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 Qm(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:c,can:u}=new jr({editor:e,state:t}),f=[];return t.doc.nodesBetween(n,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const m=Math.max(n,h),g=Math.min(i,h+p.content.size),b=p.textBetween(m-h,g-h,void 0,"");Zm(b,s.find,o).forEach(C=>{if(C.index===void 0)return;const w=m+C.index+1,_=w+C[0].length,T={from:t.tr.mapping.map(w),to:t.tr.mapping.map(_)},j=s.handler({state:t,range:T,match:C,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(j)})}),f.every(p=>p!==null)}let rr=null;const eg=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 tg(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:p,pasteEvt:h})=>{const m=u.tr,g=qr({state:u,transaction:m});if(!(!Qm({editor:e,state:g,from:Math.max(f-1,0),to:d.b-1,rule:p,pasteEvent:h,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 dt({view(f){const d=h=>{var m;n=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(h.target)?f.dom.parentElement:null,n&&(rr=e)},p=()=>{rr&&(rr=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(s=n===f.dom.parentElement,a=d,!s){const p=rr;p&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(f,d)=>{var p;const h=(p=d.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=d,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(f,d,p)=>{const h=f[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,b=h.getMeta("applyPasteRules"),y=!!b;if(!m&&!g&&!y)return;if(y){let{text:_}=b;typeof _=="string"?_=_:_=bs(E.from(_),p.schema);const{from:T}=b,j=T+_.length,v=eg(_);return l({rule:u,state:p,from:T,to:{b:j},pasteEvt:v})}const C=d.doc.content.findDiffStart(p.doc.content),w=d.doc.content.findDiffEnd(p.doc.content);if(!(!Xm(C)||!w||C===w.b))return l({rule:u,state:p,from:C,to:w,pasteEvt:o})}}))}function ng(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}class un{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=un.resolve(e),this.schema=$m(this.extensions,t),this.setupExtensions()}static resolve(e){const t=un.sort(un.flatten(e)),n=ng(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=q(t,"addExtensions",n);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((n,i)=>{const s=q(n,"priority")||100,o=q(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:pi(t.name,this.schema)},i=q(t,"addCommands",n);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=un.sort([...this.extensions].reverse()),n=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:pi(o.name,this.schema)},l=[],c=q(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&q(o,"exitable",a)&&(u.ArrowRight=()=>Wn.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=pm(u);l.push(f);const d=q(o,"addInputRules",a);dl(o,e.options.enableInputRules)&&d&&n.push(...d());const p=q(o,"addPasteRules",a);dl(o,e.options.enablePasteRules)&&p&&i.push(...p());const h=q(o,"addProseMirrorPlugins",a);if(h){const m=h();l.push(...m)}return l}).flat();return[Gm({editor:e,rules:n}),...tg({editor:e,rules:i}),...s]}get attributes(){return Tc(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Jr(this.extensions);return Object.fromEntries(t.filter(n=>!!q(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:Te(n.name,this.schema)},o=q(n,"addNodeView",s);if(!o)return[];const a=(l,c,u,f,d)=>{const p=ji(l,i);return o()({node:l,view:c,getPos:u,decorations:f,innerDecorations:d,editor:e,extension:n,HTMLAttributes:p})};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:pi(e.name,this.schema)};e.type==="mark"&&(!((t=ee(q(e,"keepOnSplit",n)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=q(e,"onBeforeCreate",n),s=q(e,"onCreate",n),o=q(e,"onUpdate",n),a=q(e,"onSelectionUpdate",n),l=q(e,"onTransaction",n),c=q(e,"onFocus",n),u=q(e,"onBlur",n),f=q(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 rt{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=ee(q(this,"addOptions",{name:this.name}))),this.storage=ee(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new rt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Kr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new rt({...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=ee(q(t,"addOptions",{name:t.name})),t.storage=ee(q(t,"addStorage",{name:t.name,options:t.options})),t}}function Oc(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 p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({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 Nc(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const rg=rt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new dt({key:new Qt("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=Nc(t);return Oc(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),ig=()=>({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),sg=(r=!1)=>({commands:e})=>e.setContent("",r),og=()=>({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)),p=f.blockRange(d);if(!p)return;const h=Cn(p);if(a.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},lg=r=>e=>r(e),ag=()=>({state:r,dispatch:e})=>Nm(r,e),cg=(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 X(n.doc.resolve(o-1))),!0},ug=()=>({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},fg=r=>({tr:e,state:t,dispatch:n})=>{const i=Te(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},dg=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},hg=()=>({state:r,dispatch:e})=>gm(r,e),pg=()=>({commands:r})=>r.keyboardShortcut("Enter"),mg=()=>({state:r,dispatch:e})=>Om(r,e);function Nr(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:ys(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function Ac(r,e,t={}){return r.find(n=>n.type===e&&Nr(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function hl(r,e,t={}){return!!Ac(r,e,t)}function Dc(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),!Ac([...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 Pt(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 gg=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=Pt(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const f=Dc(l,s,e);if(f&&f.from<=c&&f.to>=u){const d=X.create(o,f.from,f.to);t.setSelection(d)}}return!0},bg=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 xc(r){return r instanceof X}function qt(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function vc(r,e=null){if(!e)return null;const t=Z.atStart(r),n=Z.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?X.create(r,qt(0,i,s),qt(r.content.size,i,s)):X.create(r,qt(e,i,s),qt(e,i,s))}const yg=(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&&!xc(t.state.selection))return o(),!0;const a=vc(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},kg=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),_g=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),Ic=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&&Ic(n)}return r};function ir(r){const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Ic(t)}function Ar(r,e,t){if(r instanceof Et||r instanceof E)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 E.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),Ar("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Sa({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?Ot.fromSchema(l).parseSlice(ir(r),t.parseOptions):Ot.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=Ot.fromSchema(e);return t.slice?s.parseSlice(ir(r),t.parseOptions).content:s.parse(ir(r),t.parseOptions)}return Ar("",e,t)}function Sg(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof Ce||i instanceof Me))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),r.setSelection(Z.near(r.doc.resolve(o),t))}const Cg=r=>!("type"in r),Mg=(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=Ar(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(h){return s.emit("contentError",{editor:s,error:h,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((Cg(a)?a:[a]).forEach(h=>{h.check(),u=u?h.isText&&h.marks.length===0:!1,f=f?h.isBlock:!1}),l===c&&f){const{parent:h}=n.doc.resolve(l);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(l-=1,c+=1)}let p;if(u){if(Array.isArray(e))p=e.map(h=>h.text||"").join("");else if(e instanceof E){let h="";e.forEach(m=>{m.text&&(h+=m.text)}),p=h}else typeof e=="object"&&e&&e.text?p=e.text:p=e;n.insertText(p,l,c)}else p=a,n.replaceWith(l,c,p);t.updateSelection&&Sg(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:l,text:p}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:l,text:p})}return!0},wg=()=>({state:r,dispatch:e})=>Mm(r,e),Tg=()=>({state:r,dispatch:e})=>wm(r,e),Eg=()=>({state:r,dispatch:e})=>bm(r,e),Og=()=>({state:r,dispatch:e})=>Sm(r,e),Ng=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Br(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},Ag=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Br(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},Dg=()=>({state:r,dispatch:e})=>ym(r,e),xg=()=>({state:r,dispatch:e})=>km(r,e);function Pc(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Rc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vg(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))Pc()||Rc()?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 Ig=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=vg(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 qn(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?Te(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(f,d)=>{if(f.isText)return;const p=Math.max(n,d),h=Math.min(i,d+f.nodeSize);a.push({node:f,from:p,to:h})});const l=i-n,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Nr(f.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=l}const Pg=(r,e={})=>({state:t,dispatch:n})=>{const i=Te(r,t.schema);return qn(t,i,e)?Tm(t,n):!1},Rg=()=>({state:r,dispatch:e})=>Am(r,e),Bg=r=>({state:e,dispatch:t})=>{const n=Te(r,e.schema);return Fm(n)(e,t)},zg=()=>({state:r,dispatch:e})=>Em(r,e);function $r(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 Fg=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=$r(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=Te(r,n.schema)),a==="mark"&&(o=Pt(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},Vg=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),Lg=()=>({tr:r,dispatch:e})=>{if(e){const t=new Ze(r.doc);r.setSelection(t)}return!0},Wg=()=>({state:r,dispatch:e})=>_m(r,e),qg=()=>({state:r,dispatch:e})=>Cm(r,e),jg=()=>({state:r,dispatch:e})=>Dm(r,e),Jg=()=>({state:r,dispatch:e})=>Im(r,e),Kg=()=>({state:r,dispatch:e})=>vm(r,e);function Ji(r,e,t={},n={}){return Ar(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}const $g=(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=Ji(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 Bc(r,e){const t=Pt(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 Ug(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 Hg(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 ks(r){return e=>Hg(e.$from,r)}function Gg(r,e){const t={from:0,to:r.content.size};return Oc(r,t,e)}function Yg(r,e){const t=Te(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 Xg(r,e){const t=$r(typeof e=="string"?e:e.name,r.schema);return t==="node"?Yg(r,e):t==="mark"?Bc(r,e):{}}function hr(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 Ki(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?Pt(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>Nr(f.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:d})=>{const p=f.pos,h=d.pos;r.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(p,g),y=Math.min(h,g+m.nodeSize),C=y-b;o+=C,a.push(...m.marks.map(w=>({mark:w,from:b,to:y})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>Nr(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 Zg(r,e,t={}){if(!e)return qn(r,null,t)||Ki(r,null,t);const n=$r(e,r.schema);return n==="node"?qn(r,e,t):n==="mark"?Ki(r,e,t):!1}function ml(r,e){const{nodeExtensions:t}=Jr(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=ee(q(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function _s(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&&(_s(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Qg(r,e,t){var n;const{selection:i}=e;let s=null;if(xc(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 p=!d||d.type.allowsMarkType(t),h=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=p&&h}return!c}),c})}const eb=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=Pt(r,n.schema);if(i)if(o){const c=Bc(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,p)=>{const h=Math.max(p,u),m=Math.min(p+d.nodeSize,f);d.marks.find(b=>b.type===l)?d.marks.forEach(b=>{l===b.type&&t.addMark(h,m,l.create({...b.attrs,...e}))}):t.addMark(h,m,l.create(e))})});return Qg(n,t,l)},tb=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),nb=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=Te(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)},rb=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=qt(r,0,n.content.size),s=H.create(n,i);e.setSelection(s)}return!0},ib=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=X.atStart(n).from,a=X.atEnd(n).to,l=qt(i,o,a),c=qt(s,o,a),u=X.create(n,l,c);e.setSelection(u)}return!0},sb=r=>({state:e,dispatch:t})=>{const n=Te(r,e.schema);return Wm(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 ob=({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=hr(c,a.node().type.name,a.node().attrs);if(s instanceof H&&s.node.isBlock)return!a.parentOffset||!fn(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:Ug(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&d?[{type:d,attrs:u}]:void 0,h=fn(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&fn(e.doc,e.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(h=!0,p=d?[{type:d,attrs:u}]:void 0),n){if(h&&(s instanceof X&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),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 h},lb=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=Te(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=E.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let v=l.depth-y;v>=l.depth-3;v-=1)b=E.from(l.node(v).copy(b));const C=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w={...hr(d,l.node().type.name,l.node().attrs),...e},_=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(w))||void 0;b=b.append(E.from(a.createAndFill(null,_)||void 0));const T=l.before(l.depth-(y-1));t.replace(T,l.after(-C),new z(b,4-y,0));let j=-1;t.doc.nodesBetween(T,t.doc.content.size,(v,D)=>{if(j>-1)return!1;v.isTextblock&&v.content.size===0&&(j=D+1)}),j>-1&&t.setSelection(X.near(t.doc.resolve(j))),t.scrollIntoView()}return!0}const p=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,h={...hr(d,f.type.name,f.attrs),...e},m={...hr(d,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!fn(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:y}=n,{splittableMarks:C}=s.extensionManager,w=y||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!w||!i)return!0;const _=w.filter(T=>C.includes(T.type.name));t.ensureMarks(_)}return!0},mi=(r,e)=>{const t=ks(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)&&Zt(r.doc,t.pos)&&r.join(t.pos),!0},gi=(r,e)=>{const t=ks(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)&&Zt(r.doc,n)&&r.join(n),!0},ab=(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,p=Te(r,o.schema),h=Te(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:y}=m,C=b.blockRange(y),w=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;const _=ks(T=>ml(T.type.name,f))(m);if(C.depth>=1&&_&&C.depth-_.depth<=1){if(_.node.type===p)return c.liftListItem(h);if(ml(_.node.type.name,f)&&p.validContent(_.node.content)&&a)return l().command(()=>(s.setNodeMarkup(_.pos,p),!0)).command(()=>mi(s,p)).command(()=>gi(s,p)).run()}return!t||!w||!a?l().command(()=>u().wrapInList(p,n)?!0:c.clearNodes()).wrapInList(p,n).command(()=>mi(s,p)).command(()=>gi(s,p)).run():l().command(()=>{const T=u().wrapInList(p,n),j=w.filter(v=>d.includes(v.type.name));return s.ensureMarks(j),T?!0:c.clearNodes()}).wrapInList(p,n).command(()=>mi(s,p)).command(()=>gi(s,p)).run()},cb=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Pt(r,n.schema);return Ki(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},ub=(r,e,t={})=>({state:n,commands:i})=>{const s=Te(r,n.schema),o=Te(e,n.schema),a=qn(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})},fb=(r,e={})=>({state:t,commands:n})=>{const i=Te(r,t.schema);return qn(t,i,e)?n.lift(i):n.wrapIn(i,e)},db=()=>({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},hb=()=>({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},pb=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=Pt(r,n.schema),{$from:c,empty:u,ranges:f}=a;if(!i)return!0;if(u&&o){let{from:d,to:p}=a;const h=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,m=Dc(c,l,h);m&&(d=m.from,p=m.to),t.removeMark(d,p,l)}else f.forEach(d=>{t.removeMark(d.$from.pos,d.$to.pos,l)});return t.removeStoredMark(l),!0},mb=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=$r(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=Te(r,n.schema)),a==="mark"&&(o=Pt(r,n.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let f,d,p,h;t.selection.empty?n.doc.nodesBetween(c,u,(m,g)=>{s&&s===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,u),f=g,d=m)}):n.doc.nodesBetween(c,u,(m,g)=>{g<c&&s&&s===m.type&&(p=Math.max(g,c),h=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),C=Math.min(g+m.nodeSize,u);t.addMark(y,C,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(p,h,o.create({...m.attrs,...e}))}))}),!0):!1},gb=(r,e={})=>({state:t,dispatch:n})=>{const i=Te(r,t.schema);return Pm(i,e)(t,n)},bb=(r,e={})=>({state:t,dispatch:n})=>{const i=Te(r,t.schema);return Rm(i,e)(t,n)};var yb=Object.freeze({__proto__:null,blur:ig,clearContent:sg,clearNodes:og,command:lg,createParagraphNear:ag,cut:cg,deleteCurrentNode:ug,deleteNode:fg,deleteRange:dg,deleteSelection:hg,enter:pg,exitCode:mg,extendMarkRange:gg,first:bg,focus:yg,forEach:kg,insertContent:_g,insertContentAt:Mg,joinBackward:Eg,joinDown:Tg,joinForward:Og,joinItemBackward:Ng,joinItemForward:Ag,joinTextblockBackward:Dg,joinTextblockForward:xg,joinUp:wg,keyboardShortcut:Ig,lift:Pg,liftEmptyBlock:Rg,liftListItem:Bg,newlineInCode:zg,resetAttributes:Fg,scrollIntoView:Vg,selectAll:Lg,selectNodeBackward:Wg,selectNodeForward:qg,selectParentNode:jg,selectTextblockEnd:Jg,selectTextblockStart:Kg,setContent:$g,setMark:eb,setMeta:tb,setNode:nb,setNodeSelection:rb,setTextSelection:ib,sinkListItem:sb,splitBlock:ob,splitListItem:lb,toggleList:ab,toggleMark:cb,toggleNode:ub,toggleWrap:fb,undoInputRule:db,unsetAllMarks:hb,unsetMark:pb,updateAttributes:mb,wrapIn:gb,wrapInList:bb});const kb=rt.create({name:"commands",addCommands(){return{...yb}}}),_b=rt.create({name:"drop",addProseMirrorPlugins(){return[new dt({key:new Qt("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),Sb=rt.create({name:"editable",addProseMirrorPlugins(){return[new dt({key:new Qt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Cb=rt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new dt({key:new Qt("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}}}})]}}),Mb=rt.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:p}=f,h=f.parent.isTextblock&&d>0?a.doc.resolve(d-1):f,m=h.parent.type.spec.isolating,g=f.pos-f.parentOffset,b=m&&h.parent.childCount===1?g===f.pos:Z.atStart(c).from===d;return!u||!p.type.isTextblock||p.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 Pc()||Rc()?s:i},addProseMirrorPlugins(){return[new dt({key:new Qt("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=Z.atStart(e.doc).from,c=Z.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!_s(t.doc))return;const d=t.tr,p=qr({state:t,transaction:d}),{commands:h}=new jr({editor:this.editor,state:p});if(h.clearNodes(),!!d.steps.length)return d}})]}}),wb=rt.create({name:"paste",addProseMirrorPlugins(){return[new dt({key:new Qt("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Tb=rt.create({name:"tabindex",addProseMirrorPlugins(){return[new dt({key:new Qt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ft{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 Ft(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 Ft(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 Ft(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 Ft(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Ft(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 Eb=`.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 Ob(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 Nb extends qm{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=Ob(Eb,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=Ec(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?[Sb,rg.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),kb,Cb,Mb,Tb,_b,wb].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 un(i,this)}createCommandManager(){this.commandManager=new jr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Ji(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=Ji(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=vc(t,this.options.autofocus);this.view=new am(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:cn.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 Xg(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Zg(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bs(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
190
|
+
|
|
191
|
+
`,textSerializers:n={}}=e||{};return Gg(this.state.doc,{blockSeparator:t,textSerializers:{...Nc(this.schema),...n}})}get isEmpty(){return _s(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 Ft(t,this)}get $doc(){return this.$pos(0)}}class _n{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=ee(q(this,"addOptions",{name:this.name}))),this.storage=ee(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new _n(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Kr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new _n(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=ee(q(t,"addOptions",{name:t.name})),t.storage=ee(q(t,"addStorage",{name:t.name,options:t.options})),t}}const Ab=_n.create({name:"doc",topNode:!0,content:"block+"}),Db=_n.create({name:"text",group:"inline"});function bl(r,e,t){const n=r.slice();return n[27]=e[t],n}function yl(r,e,t){const n=r.slice();return n[30]=e[t],n}function kl(r,e,t){const n=r.slice();return n[35]=e[t],n[37]=t,n}function _l(r,e,t){const n=r.slice();return n[38]=e[t],n}function Sl(r,e,t){const n=r.slice();return n[35]=e[t],n[37]=t,n}function Cl(r,e,t){const n=r.slice();return n[30]=e[t],n}function Ml(r){let e,t,n=fe(r[1].type.sidebar),i=[];for(let o=0;o<n.length;o+=1)i[o]=Pl(bl(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,a){if(a[0]&1559){n=fe(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),k(i[l],1)):(i[l]=Pl(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function wl(r){let e,t,n=r[27].title+"",i,s,o,a,l,c;const u=[vb,xb],f=[];function d(p,h){return p[27].type==="toolbar"?0:p[27].type==="form"?1:-1}return~(o=d(r))&&(a=f[o]=u[o](r)),{c(){e=B("section"),t=B("h2"),i=he(n),s=K(),a&&a.c(),l=K(),J(t,"class","font-bold mb-2"),J(e,"class","mb-4")},m(p,h){N(p,e,h),R(e,t),R(t,i),R(e,s),~o&&f[o].m(e,null),R(e,l),c=!0},p(p,h){(!c||h[0]&2)&&n!==(n=p[27].title+"")&&Ie(i,n);let m=o;o=d(p),o===m?~o&&f[o].p(p,h):(a&&(re(),S(f[m],1,1,()=>{f[m]=null}),ie()),~o?(a=f[o],a?a.p(p,h):(a=f[o]=u[o](p),a.c()),k(a,1),a.m(e,l)):a=null)},i(p){c||(k(a),c=!0)},o(p){S(a),c=!1},d(p){p&&A(e),~o&&f[o].d()}}}function xb(r){let e,t,n=fe(r[27].items),i=[];for(let o=0;o<n.length;o+=1)i[o]=vl(yl(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){e=B("div");for(let o=0;o<i.length;o+=1)i[o].c();J(e,"class","flex flex-row flex-wrap")},m(o,a){N(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]&1559){n=fe(o[27].items);let l;for(l=0;l<n.length;l+=1){const c=yl(o,n,l);i[l]?(i[l].p(c,a),k(i[l],1)):(i[l]=vl(c),i[l].c(),k(i[l],1),i[l].m(e,null))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function vb(r){let e,t;return e=new Sn({props:{class:"flex-wrap",$$slots:{default:[Hb]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i[0]&18|i[1]&2048&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Ib(r){let e=r[4],t,n=El(r);return{c(){n.c(),t=de()},m(i,s){n.m(i,s),N(i,t,s)},p(i,s){s[0]&16&&Ae(e,e=i[4])?(n.d(1),n=El(i),n.c(),n.m(t.parentNode,t)):n.p(i,s)},i:ne,o:ne,d(i){i&&A(t),n.d(i)}}}function Pb(r){let e,t,n=r[30].title+"",i,s,o,a,l,c,u;function f(...d){return r[18](r[30],...d)}return{c(){e=B("label"),t=B("span"),i=he(n),s=K(),o=B("input"),l=K(),J(t,"data-form-field-label",""),J(o,"type","text"),o.value=a=r[4].getAttributes(r[30].mark)[r[30].name],J(o,"data-form-field-text","")},m(d,p){N(d,e,p),R(e,t),R(t,i),R(e,s),R(e,o),R(e,l),c||(u=te(o,"change",f),c=!0)},p(d,p){r=d,p[0]&2&&n!==(n=r[30].title+"")&&Ie(i,n),p[0]&18&&a!==(a=r[4].getAttributes(r[30].mark)[r[30].name])&&o.value!==a&&(o.value=a)},i:ne,o:ne,d(d){d&&A(e),c=!1,u()}}}function Rb(r){let e,t=r[4],n,i,s,o,a=Al(r);return i=new Sn({props:{class:"flex-wrap",$$slots:{default:[qb]},$$scope:{ctx:r}}}),{c(){e=B("div"),a.c(),n=K(),V(i.$$.fragment),s=K(),J(e,"class","flex flex-row flex-wrap")},m(l,c){N(l,e,c),a.m(e,null),R(e,n),L(i,e,null),R(e,s),o=!0},p(l,c){c[0]&16&&Ae(t,t=l[4])?(re(),S(a,1,1,ne),ie(),a=Al(l),a.c(),k(a,1),a.m(e,n)):a.p(l,c);const u={};c[0]&22|c[1]&2048&&(u.$$scope={dirty:c,ctx:l}),i.$set(u)},i(l){o||(k(a),k(i.$$.fragment,l),o=!0)},o(l){S(a),S(i.$$.fragment,l),o=!1},d(l){l&&A(e),a.d(l),W(i)}}}function Bb(r){let e,t,n=r[30].title+"",i,s,o,a,l,c,u;function f(...d){return r[15](r[30],...d)}return{c(){e=B("label"),t=B("span"),i=he(n),s=K(),o=B("input"),l=K(),J(t,"data-form-field-label",""),J(o,"type","text"),o.value=a=r[4].getAttributes(r[30].block)[r[30].name],J(o,"data-form-field-text","")},m(d,p){N(d,e,p),R(e,t),R(t,i),R(e,s),R(e,o),R(e,l),c||(u=te(o,"change",f),c=!0)},p(d,p){r=d,p[0]&2&&n!==(n=r[30].title+"")&&Ie(i,n),p[0]&18&&a!==(a=r[4].getAttributes(r[30].block)[r[30].name])&&o.value!==a&&(o.value=a)},i:ne,o:ne,d(d){d&&A(e),c=!1,u()}}}function zb(r){let e=r[4],t,n=xl(r);return{c(){n.c(),t=de()},m(i,s){n.m(i,s),N(i,t,s)},p(i,s){s[0]&16&&Ae(e,e=i[4])?(n.d(1),n=xl(i),n.c(),n.m(t.parentNode,t)):n.p(i,s)},i:ne,o:ne,d(i){i&&A(t),n.d(i)}}}function Tl(r){let e,t=r[35].title+"",n,i;return{c(){e=B("option"),n=he(t),e.__value=i=r[35].value,br(e,e.__value)},m(s,o){N(s,e,o),R(e,n)},p(s,o){o[0]&2&&t!==(t=s[35].title+"")&&Ie(n,t),o[0]&2&&i!==(i=s[35].value)&&(e.__value=i,br(e,e.__value))},d(s){s&&A(e)}}}function El(r){let e,t,n=r[30].title+"",i,s,o,a,l,c,u,f=fe(r[30].values),d=[];for(let h=0;h<f.length;h+=1)d[h]=Tl(kl(r,f,h));function p(...h){return r[19](r[30],...h)}return{c(){e=B("label"),t=B("span"),i=he(n),s=K(),o=B("select");for(let h=0;h<d.length;h+=1)d[h].c();l=K(),J(t,"class","sr-only"),J(o,"data-combobox-input",""),J(o,"class","bg-white")},m(h,m){N(h,e,m),R(e,t),R(t,i),R(e,s),R(e,o);for(let g=0;g<d.length;g+=1)d[g]&&d[g].m(o,null);gr(o,r[4].getAttributes(r[30].mark)[r[30].name]),R(e,l),c||(u=te(o,"change",p),c=!0)},p(h,m){if(r=h,m[0]&2&&n!==(n=r[30].title+"")&&Ie(i,n),m[0]&2){f=fe(r[30].values);let g;for(g=0;g<f.length;g+=1){const b=kl(r,f,g);d[g]?d[g].p(b,m):(d[g]=Tl(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]&18&&a!==(a=r[4].getAttributes(r[30].mark)[r[30].name])&&gr(o,r[4].getAttributes(r[30].mark)[r[30].name])},d(h){h&&A(e),it(d,h),c=!1,u()}}}function Ol(r){let e,t,n=fe(r[9](r[30])),i=[];for(let o=0;o<n.length;o+=1)i[o]=Nl(_l(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,a){if(a[0]&514){n=fe(o[9](o[30]));let l;for(l=0;l<n.length;l+=1){const c=_l(o,n,l);i[l]?(i[l].p(c,a),k(i[l],1)):(i[l]=Nl(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function Fb(r){let e=r[38].label+"",t;return{c(){t=he(e)},m(n,i){N(n,t,i)},p(n,i){i[0]&2&&e!==(e=n[38].label+"")&&Ie(t,e)},d(n){n&&A(t)}}}function Nl(r){let e,t;return e=new Zl({props:{value:r[38].value,label:r[38].label,$$slots:{default:[Fb]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i[0]&2&&(s.value=n[38].value),i[0]&2&&(s.label=n[38].label),i[0]&2|i[1]&2048&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Vb(r){let e,t,n=r[0][r[30].section].type.type==="textlist"&&Ol(r);return{c(){n&&n.c(),e=de()},m(i,s){n&&n.m(i,s),N(i,e,s),t=!0},p(i,s){i[0][i[30].section].type.type==="textlist"?n?(n.p(i,s),s[0]&3&&k(n,1)):(n=Ol(i),n.c(),k(n,1),n.m(e.parentNode,e)):n&&(re(),S(n,1,1,()=>{n=null}),ie())},i(i){t||(k(n),t=!0)},o(i){S(n),t=!1},d(i){i&&A(e),n&&n.d(i)}}}function Lb(r){let e,t,n,i,s,o,a,l,c,u;return t=new Xl({props:{placeholder:"Select the text to edit","aria-label":"Select the text to edit",class:"relative pr-6 z-10 bg-transparent"}}),s=new we({props:{path:vr,class:"w-6 h-6 combobox-expand"}}),a=new we({props:{path:Qi,class:"w-6 h-6 combobox-collapse"}}),c=new Yl({props:{$$slots:{default:[Vb]},$$scope:{ctx:r}}}),{c(){e=B("div"),V(t.$$.fragment),n=K(),i=B("div"),V(s.$$.fragment),o=K(),V(a.$$.fragment),l=K(),V(c.$$.fragment),J(i,"class","absolute top-1/2 right-0 -translate-y-1/2"),J(e,"class","relative")},m(f,d){N(f,e,d),L(t,e,null),R(e,n),R(e,i),L(s,i,null),R(i,o),L(a,i,null),N(f,l,d),L(c,f,d),u=!0},p(f,d){const p={};d[0]&3|d[1]&2048&&(p.$$scope={dirty:d,ctx:f}),c.$set(p)},i(f){u||(k(t.$$.fragment,f),k(s.$$.fragment,f),k(a.$$.fragment,f),k(c.$$.fragment,f),u=!0)},o(f){S(t.$$.fragment,f),S(s.$$.fragment,f),S(a.$$.fragment,f),S(c.$$.fragment,f),u=!1},d(f){f&&(A(e),A(l)),W(t),W(s),W(a),W(c,f)}}}function Al(r){let e,t;function n(...i){return r[16](r[30],...i)}return e=new Gl({props:{selected:r[10](r[30]),items:r[9](r[30]),onSelectedChange:n,$$slots:{default:[Lb]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s[0]&2&&(o.selected=r[10](r[30])),s[0]&2&&(o.items=r[9](r[30])),s[0]&18&&(o.onSelectedChange=n),s[0]&3|s[1]&2048&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function Wb(r){let e,t;return e=new we({props:{path:ku,label:"Edit the selected entry"}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function qb(r){let e,t;function n(){return r[17](r[30])}return e=new et({props:{title:"Edit the selected entry",$$slots:{default:[Wb]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s[1]&2048&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function Dl(r){let e,t=r[35].title+"",n,i;return{c(){e=B("option"),n=he(t),e.__value=i=r[35].value,br(e,e.__value)},m(s,o){N(s,e,o),R(e,n)},p(s,o){o[0]&2&&t!==(t=s[35].title+"")&&Ie(n,t),o[0]&2&&i!==(i=s[35].value)&&(e.__value=i,br(e,e.__value))},d(s){s&&A(e)}}}function xl(r){let e,t,n=r[30].title+"",i,s,o,a,l,c,u,f=fe(r[30].values),d=[];for(let h=0;h<f.length;h+=1)d[h]=Dl(Sl(r,f,h));function p(...h){return r[14](r[30],...h)}return{c(){e=B("label"),t=B("span"),i=he(n),s=K(),o=B("select");for(let h=0;h<d.length;h+=1)d[h].c();l=K(),J(t,"class","sr-only"),J(o,"data-combobox-input",""),J(o,"class","bg-white")},m(h,m){N(h,e,m),R(e,t),R(t,i),R(e,s),R(e,o);for(let g=0;g<d.length;g+=1)d[g]&&d[g].m(o,null);gr(o,r[4].getAttributes(r[30].block)[r[30].name]),R(e,l),c||(u=te(o,"change",p),c=!0)},p(h,m){if(r=h,m[0]&2&&n!==(n=r[30].title+"")&&Ie(i,n),m[0]&2){f=fe(r[30].values);let g;for(g=0;g<f.length;g+=1){const b=Sl(r,f,g);d[g]?d[g].p(b,m):(d[g]=Dl(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]&18&&a!==(a=r[4].getAttributes(r[30].block)[r[30].name])&&gr(o,r[4].getAttributes(r[30].block)[r[30].name])},d(h){h&&A(e),it(d,h),c=!1,u()}}}function vl(r){let e,t,n,i;const s=[zb,Bb,Rb,Pb,Ib],o=[];function a(l,c){return l[30].type==="select-block-attribute"?0:l[30].type==="input-block-attribute"?1:l[30].type==="select-cross-reference-attribute"?2:l[30].type==="input-mark-attribute"?3:l[30].type==="select-mark-attribute"?4:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=de()},m(l,c){~e&&o[e].m(l,c),N(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(re(),S(o[u],1,1,()=>{o[u]=null}),ie()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),~e&&o[e].d(l)}}}function jb(r){let e,t;return e=new Ql({props:{class:"mx-2 border-r border-gray-300"}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function Jb(r){let e,t;function n(...i){return r[13](r[30],...i)}return e=new et({props:{"aria-pressed":(r[30].type==="set-block"||r[30].type==="toggle-wrap-block")&&r[4].isActive(r[30].block)||r[30].type==="set-block-attribute"&&r[4].isActive(r[30].block,{[r[30].name]:r[30].value})||r[30].type==="toggle-mark"&&r[4].isActive(r[30].mark),title:r[30].title,$$slots:{default:[Ub]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s[0]&18&&(o["aria-pressed"]=(r[30].type==="set-block"||r[30].type==="toggle-wrap-block")&&r[4].isActive(r[30].block)||r[30].type==="set-block-attribute"&&r[4].isActive(r[30].block,{[r[30].name]:r[30].value})||r[30].type==="toggle-mark"&&r[4].isActive(r[30].mark)),s[0]&2&&(o.title=r[30].title),s[0]&2|s[1]&2048&&(o.$$scope={dirty:s,ctx:r}),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function Kb(r){let e=r[30].title+"",t;return{c(){t=he(e)},m(n,i){N(n,t,i)},p(n,i){i[0]&2&&e!==(e=n[30].title+"")&&Ie(t,e)},i:ne,o:ne,d(n){n&&A(t)}}}function $b(r){let e,t,n,i=r[30].title+"",s,o;return e=new we({props:{path:r[30].icon}}),{c(){V(e.$$.fragment),t=K(),n=B("span"),s=he(i),J(n,"class","sr-only")},m(a,l){L(e,a,l),N(a,t,l),N(a,n,l),R(n,s),o=!0},p(a,l){const c={};l[0]&2&&(c.path=a[30].icon),e.$set(c),(!o||l[0]&2)&&i!==(i=a[30].title+"")&&Ie(s,i)},i(a){o||(k(e.$$.fragment,a),o=!0)},o(a){S(e.$$.fragment,a),o=!1},d(a){a&&(A(t),A(n)),W(e,a)}}}function Ub(r){let e,t,n,i;const s=[$b,Kb],o=[];function a(l,c){return l[30].icon?0:1}return e=a(r),t=o[e]=s[e](r),{c(){t.c(),n=K()},m(l,c){o[e].m(l,c),N(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?o[e].p(l,c):(re(),S(o[u],1,1,()=>{o[u]=null}),ie(),t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n))},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),o[e].d(l)}}}function Il(r){let e,t,n,i;const s=[Jb,jb],o=[];function a(l,c){return l[30].type==="set-block"||l[30].type==="toggle-wrap-block"||l[30].type==="set-block-attribute"||l[30].type==="toggle-mark"?0:l[30].type==="separator"?1:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=de()},m(l,c){~e&&o[e].m(l,c),N(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(re(),S(o[u],1,1,()=>{o[u]=null}),ie()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),~e&&o[e].d(l)}}}function Hb(r){let e,t,n=fe(r[27].items),i=[];for(let o=0;o<n.length;o+=1)i[o]=Il(Cl(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,a){if(a[0]&18){n=fe(o[27].items);let l;for(l=0;l<n.length;l+=1){const c=Cl(o,n,l);i[l]?(i[l].p(c,a),k(i[l],1)):(i[l]=Il(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function Pl(r){let e=!r[27].condition||r[4].isActive(r[27].condition.node),t,n,i=e&&wl(r);return{c(){i&&i.c(),t=de()},m(s,o){i&&i.m(s,o),N(s,t,o),n=!0},p(s,o){o[0]&18&&(e=!s[27].condition||s[4].isActive(s[27].condition.node)),e?i?(i.p(s,o),o[0]&18&&k(i,1)):(i=wl(s),i.c(),k(i,1),i.m(t.parentNode,t)):i&&(re(),S(i,1,1,()=>{i=null}),ie())},i(s){n||(k(i),n=!0)},o(s){S(i),n=!1},d(s){s&&A(t),i&&i.d(s)}}}function Gb(r){let e,t,n,i,s,o=r[1]&&r[1].type.sidebar&&r[4]&&Ml(r);return{c(){e=B("div"),t=B("div"),n=K(),i=B("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){N(a,e,l),R(e,t),r[12](t),R(e,n),R(e,i),o&&o.m(i,null),s=!0},p(a,l){a[1]&&a[1].type.sidebar&&a[4]?o?(o.p(a,l),l[0]&18&&k(o,1)):(o=Ml(a),o.c(),k(o,1),o.m(i,null)):o&&(re(),S(o,1,1,()=>{o=null}),ie())},i(a){s||(k(o),s=!0)},o(a){S(o),s=!1},d(a){a&&A(e),r[12](null),o&&o.d()}}}function sn(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"||e.type==="select-mark-attribute")&&r.chain().focus().extendMarkRange(e.mark).updateAttributes(e.mark,{[e.name]:t.target.value}).run())}function Yb(r,e,t){let n,i,s,o,{section:a=null}=e,{sections:l}=e,{sectionsDict:c={}}=e,{editTextListEntry:u}=e;const f=Xi(),d=pn("uEditorConfig");oe(r,d,I=>t(24,o=I));const p=pn("uEditionConfig");oe(r,p,I=>t(23,s=I));const h=Hl();oe(r,h,I=>t(22,i=I));const m=bu();oe(r,m,I=>t(21,n=I));let g=null,b=null,y=-1;yu(()=>{if(g!==null&&o.isSuccess&&s.isSuccess){const I=[Ab,Db];for(let G of i)I.push(_n.create({name:G.name,group:"block",content:G.content?G.content:"inline*",addAttributes(){return Object.fromEntries(G.attributes.map(O=>[O.name,{default:O.default,renderHTML(pe){return{["data-tei-attribute-"+O.name]:pe[O.name]}}}]))},renderHTML({node:O,HTMLAttributes:pe}){return pe["data-tei-block-"+O.type.name]="",[G.tag||"div",pe,0]}}));for(let G of n)I.push(Wn.create({name:G.name,addAttributes(){return Object.fromEntries(G.attributes.map(O=>[O.name,{default:O.default,renderHTML(pe){return{["data-tei-attribute-"+O.name]:pe[O.name]}}}]))},renderHTML({mark:O,HTMLAttributes:pe}){return pe["data-tei-mark-"+O.type.name]="",[G.tag||"span",pe,0]}}));t(4,b=new Nb({element:g,extensions:I,content:a==null?void 0:a.content,onTransaction:({transaction:G})=>{t(4,b),G.docChanged&&(window.clearTimeout(y),y=window.setTimeout(()=>{b&&f("update",b.getJSON())},100))}}))}});function C(){a!==null&&b!==null&&b.commands.setContent(a.content)}function w(I){return c[I.section].type.type==="textlist"?c[I.section].content.map(G=>({value:G.attrs.id,label:xt(G.content)})):[]}function _(I){if(c[I.section].type.type==="textlist"&&b){const G=c[I.section].content.filter(O=>O.attrs.id===(b==null?void 0:b.getAttributes(I.mark)[I.name])||O.attrs.id===(b==null?void 0:b.getAttributes(I.mark)[I.name].substring(1)));if(G.length===1)return{value:b.getAttributes(I.mark)[I.name],label:xt(G[0].content)}}}function T(I){Re[I?"unshift":"push"](()=>{g=I,t(3,g)})}const j=(I,G)=>{sn(b,I,G)},v=(I,G)=>{sn(b,I,G)},D=(I,G)=>{sn(b,I,G)},M=(I,G)=>{sn(b,I,G)},x=I=>{u(I.section,b==null?void 0:b.getAttributes(I.mark)[I.name])},U=(I,G)=>{sn(b,I,G)},Q=(I,G)=>{sn(b,I,G)};return r.$$set=I=>{"section"in I&&t(1,a=I.section),"sections"in I&&t(11,l=I.sections),"sectionsDict"in I&&t(0,c=I.sectionsDict),"editTextListEntry"in I&&t(2,u=I.editTextListEntry)},r.$$.update=()=>{r.$$.dirty[0]&2&&a&&C(),r.$$.dirty[0]&2048&&l&&t(0,c=Object.fromEntries(l.map(I=>[I.name,I])))},[c,a,u,g,b,d,p,h,m,w,_,l,T,j,v,D,M,x,U,Q]}class zc extends qe{constructor(e){super(),je(this,e,Yb,Gb,Ae,{section:1,sections:11,sectionsDict:0,editTextListEntry:2},null,[-1,-1])}}var Ee=[];for(var bi=0;bi<256;++bi)Ee.push((bi+256).toString(16).slice(1));function Xb(r,e=0){return(Ee[r[e+0]]+Ee[r[e+1]]+Ee[r[e+2]]+Ee[r[e+3]]+"-"+Ee[r[e+4]]+Ee[r[e+5]]+"-"+Ee[r[e+6]]+Ee[r[e+7]]+"-"+Ee[r[e+8]]+Ee[r[e+9]]+"-"+Ee[r[e+10]]+Ee[r[e+11]]+Ee[r[e+12]]+Ee[r[e+13]]+Ee[r[e+14]]+Ee[r[e+15]]).toLowerCase()}var sr,Zb=new Uint8Array(16);function Qb(){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(Zb)}var yi,or,ki=0,_i=0;function e1(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=yi),o==null&&(o=or)),s==null||o==null){var a=r.random||(r.rng||Qb)();s==null&&(s=[a[0],a[1],a[2],a[3],a[4],a[5]],!yi&&!r._v6&&(s[0]|=1,yi=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:_i+1,u=l-ki+(c-_i)/1e4;if(u<0&&r.clockseq===void 0&&(o=o+1&16383),(u<0||l>ki)&&r.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ki=l,_i=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 p=0;p<6;++p)i[n+p]=s[p];return e||Xb(i)}function Rl(r,e,t){const n=r.slice();return n[19]=e[t],n}function t1(r){let e=xt(r[19].content)+"",t;return{c(){t=he(e)},m(n,i){N(n,t,i)},p(n,i){i&8&&e!==(e=xt(n[19].content)+"")&&Ie(t,e)},d(n){n&&A(t)}}}function Bl(r){let e,t;return e=new Zl({props:{value:r[19].attrs.id,label:xt(r[19].content),$$slots:{default:[t1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i&8&&(s.value=n[19].attrs.id),i&8&&(s.label=xt(n[19].content)),i&4194312&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function n1(r){let e,t,n=fe(r[3]),i=[];for(let o=0;o<n.length;o+=1)i[o]=Bl(Rl(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,a){if(a&8){n=fe(o[3]);let l;for(l=0;l<n.length;l+=1){const c=Rl(o,n,l);i[l]?(i[l].p(c,a),k(i[l],1)):(i[l]=Bl(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function r1(r){let e,t,n,i,s,o,a,l,c,u;return t=new Xl({props:{placeholder:"Select the text to edit","aria-label":"Select the text to edit",class:"relative pr-6 z-10 bg-transparent"}}),s=new we({props:{path:vr,class:"w-6 h-6 combobox-expand"}}),a=new we({props:{path:Qi,class:"w-6 h-6 combobox-collapse"}}),c=new Yl({props:{$$slots:{default:[n1]},$$scope:{ctx:r}}}),{c(){e=B("div"),V(t.$$.fragment),n=K(),i=B("div"),V(s.$$.fragment),o=K(),V(a.$$.fragment),l=K(),V(c.$$.fragment),J(i,"class","absolute top-1/2 right-0 -translate-y-1/2"),J(e,"class","relative")},m(f,d){N(f,e,d),L(t,e,null),R(e,n),R(e,i),L(s,i,null),R(i,o),L(a,i,null),N(f,l,d),L(c,f,d),u=!0},p(f,d){const p={};d&4194312&&(p.$$scope={dirty:d,ctx:f}),c.$set(p)},i(f){u||(k(t.$$.fragment,f),k(s.$$.fragment,f),k(a.$$.fragment,f),k(c.$$.fragment,f),u=!0)},o(f){S(t.$$.fragment,f),S(s.$$.fragment,f),S(a.$$.fragment,f),S(c.$$.fragment,f),u=!1},d(f){f&&(A(e),A(l)),W(t),W(s),W(a),W(c,f)}}}function i1(r){let e,t;return e=new we({props:{path:Zi}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function s1(r){let e,t;return e=new we({props:{path:es}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p:ne,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function o1(r){let e,t,n,i;return e=new et({props:{"aria-label":"Add a text",title:"Add a text",$$slots:{default:[i1]},$$scope:{ctx:r}}}),e.$on("click",r[8]),n=new et({props:{"aria-label":"Delete the current text",title:"Delete the current text","aria-disabled":r[2].value===null?"true":null,$$slots:{default:[s1]},$$scope:{ctx:r}}}),n.$on("click",r[14]),{c(){V(e.$$.fragment),t=K(),V(n.$$.fragment)},m(s,o){L(e,s,o),N(s,t,o),L(n,s,o),i=!0},p(s,o){const a={};o&4194304&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const l={};o&4&&(l["aria-disabled"]=s[2].value===null?"true":null),o&4194304&&(l.$$scope={dirty:o,ctx:s}),n.$set(l)},i(s){i||(k(e.$$.fragment,s),k(n.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(n.$$.fragment,s),i=!1},d(s){s&&A(t),W(e,s),W(n,s)}}}function zl(r){let e,t;return e=new zc({props:{section:r[4],sections:r[0],editTextListEntry:r[1]}}),e.$on("update",r[7]),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i&16&&(s.section=n[4]),i&1&&(s.sections=n[0]),i&2&&(s.editTextListEntry=n[1]),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function l1(r){let e;return{c(){e=he("Delete Text")},m(t,n){N(t,e,n)},d(t){t&&A(e)}}}function a1(r){let e;return{c(){e=he("Don't delete")},m(t,n){N(t,e,n)},d(t){t&&A(e)}}}function c1(r){let e,t,n,i,s,o=r[2].label+"",a,l,c,u,f,d,p,h,m,g;return e=new Eu({props:{$$slots:{default:[l1]},$$scope:{ctx:r}}}),f=new Ou({props:{"data-button":!0,$$slots:{default:[a1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment),t=K(),n=B("form"),i=B("p"),s=he("Please confirm that you wish to delete the text "),a=he(o),l=he("."),c=K(),u=B("div"),V(f.$$.fragment),d=K(),p=B("button"),p.textContent="Delete",J(p,"type","submit"),J(p,"data-button",""),J(u,"data-dialog-buttons",""),J(n,"data-dialog-content-area","")},m(b,y){L(e,b,y),N(b,t,y),N(b,n,y),R(n,i),R(i,s),R(i,a),R(i,l),R(n,c),R(n,u),L(f,u,null),R(u,d),R(u,p),h=!0,m||(g=te(n,"submit",r[9]),m=!0)},p(b,y){const C={};y&4194304&&(C.$$scope={dirty:y,ctx:b}),e.$set(C),(!h||y&4)&&o!==(o=b[2].label+"")&&Ie(a,o);const w={};y&4194304&&(w.$$scope={dirty:y,ctx:b}),f.$set(w)},i(b){h||(k(e.$$.fragment,b),k(f.$$.fragment,b),h=!0)},o(b){S(e.$$.fragment,b),S(f.$$.fragment,b),h=!1},d(b){b&&(A(t),A(n)),W(e,b),W(f),m=!1,g()}}}function u1(r){let e,t,n,i;return e=new wu({}),n=new Tu({props:{$$slots:{default:[c1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment),t=K(),V(n.$$.fragment)},m(s,o){L(e,s,o),N(s,t,o),L(n,s,o),i=!0},p(s,o){const a={};o&4194308&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(k(e.$$.fragment,s),k(n.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(n.$$.fragment,s),i=!1},d(s){s&&A(t),W(e,s),W(n,s)}}}function f1(r){let e,t,n,i;return e=new Cu({props:{class:"hidden"}}),n=new Mu({props:{$$slots:{default:[u1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment),t=K(),V(n.$$.fragment)},m(s,o){L(e,s,o),N(s,t,o),L(n,s,o),i=!0},p(s,o){const a={};o&4194308&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(k(e.$$.fragment,s),k(n.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(n.$$.fragment,s),i=!1},d(s){s&&A(t),W(e,s),W(n,s)}}}function d1(r){let e,t,n,i,s,o,a,l,c,u,f,d;function p(y){r[13](y)}let h={items:r[3].map(r[12]),$$slots:{default:[r1]},$$scope:{ctx:r}};r[2]!==void 0&&(h.selected=r[2]),n=new Gl({props:h}),Re.push(()=>wi(n,"selected",p)),o=new Sn({props:{$$slots:{default:[o1]},$$scope:{ctx:r}}});let m=r[4]!==null&&zl(r);function g(y){r[15](y)}let b={$$slots:{default:[f1]},$$scope:{ctx:r}};return r[5]!==void 0&&(b.open=r[5]),u=new _u({props:b}),Re.push(()=>wi(u,"open",g)),{c(){e=B("div"),t=B("div"),V(n.$$.fragment),s=K(),V(o.$$.fragment),a=K(),l=B("div"),m&&m.c(),c=K(),V(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,C){N(y,e,C),R(e,t),L(n,t,null),R(t,s),L(o,t,null),R(e,a),R(e,l),m&&m.m(l,null),N(y,c,C),L(u,y,C),d=!0},p(y,[C]){const w={};C&8&&(w.items=y[3].map(y[12])),C&4194312&&(w.$$scope={dirty:C,ctx:y}),!i&&C&4&&(i=!0,w.selected=y[2],Ti(()=>i=!1)),n.$set(w);const _={};C&4194340&&(_.$$scope={dirty:C,ctx:y}),o.$set(_),y[4]!==null?m?(m.p(y,C),C&16&&k(m,1)):(m=zl(y),m.c(),k(m,1),m.m(l,null)):m&&(re(),S(m,1,1,()=>{m=null}),ie());const T={};C&4194308&&(T.$$scope={dirty:C,ctx:y}),!f&&C&32&&(f=!0,T.open=y[5],Ti(()=>f=!1)),u.$set(T)},i(y){d||(k(n.$$.fragment,y),k(o.$$.fragment,y),k(m),k(u.$$.fragment,y),d=!0)},o(y){S(n.$$.fragment,y),S(o.$$.fragment,y),S(m),S(u.$$.fragment,y),d=!1},d(y){y&&(A(e),A(c)),W(n),W(o),m&&m.d(),W(u,y)}}}function h1(r,e,t){let n,{section:i=null}=e,{sections:s}=e,{selectedEntryId:o}=e,{editTextListEntry:a}=e;const l=Xi();Su();const c=Hl();oe(r,c,_=>t(16,n=_));let u={value:null},f=[],d=null,p=!1;function h(_){if(u.value!==null&&i&&i.content){const T=f.filter(j=>j.attrs.id===u.value);T.length===1&&(T[0].content=_.detail),l("update",f)}}function m(){if(n.length>0){const _={attrs:{id:(i==null?void 0:i.name)+"-"+e1()},content:{type:"doc",content:[{type:n[0].name,attrs:{},content:[{type:"text",marks:[],text:"New"}]}]}};f.push(_),l("update",f),lr().then(()=>{t(10,o=_.attrs.id)})}}function g(_){_.preventDefault(),t(5,p=!1);let T=-1;for(let j=0;j<f.length;j++)if(u.value==f[j].attrs.id){T=j;break}T>=0&&(f.splice(T,1),t(2,u={value:null}),t(4,d=null),l("update",f))}const b=_=>({value:_.attrs.id,label:xt(_.content)});function y(_){u=_,t(2,u),t(10,o),t(11,i),t(3,f)}const C=()=>{t(5,p=!0)};function w(_){p=_,t(5,p)}return r.$$set=_=>{"section"in _&&t(11,i=_.section),"sections"in _&&t(0,s=_.sections),"selectedEntryId"in _&&t(10,o=_.selectedEntryId),"editTextListEntry"in _&&t(1,a=_.editTextListEntry)},r.$$.update=()=>{if(r.$$.dirty&2048&&(i!==null&&i.content?t(3,f=i.content):t(3,f=[])),r.$$.dirty&3080&&o&&i){const _=f.filter(T=>T.attrs.id===o||T.attrs.id===o.substring(1));_.length===1&&t(2,u={value:_[0].attrs.id,label:xt(_[0].content)}),t(10,o=null)}if(r.$$.dirty&2060)if(u.value!==null&&i&&i.content){const _=f.filter(T=>T.attrs.id===u.value);_.length===1?t(4,d={name:"",title:"",type:{name:"",title:"",type:"text",selector:"",sidebar:i.type.sidebar},content:_[0].content}):t(4,d=null)}else t(4,d=null)},[s,a,u,f,d,p,c,h,m,g,o,i,b,y,C,w]}class p1 extends qe{constructor(e){super(),je(this,e,h1,d1,Ae,{section:11,sections:0,selectedEntryId:10,editTextListEntry:1})}}function Fl(r,e,t){const n=r.slice();return n[23]=e[t],n[25]=t,n}function Vl(r,e,t){const n=r.slice();return n[23]=e[t],n}function m1(r){let e,t;return e=new xu({props:{$$slots:{default:[y1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i&268435456&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function g1(r){let e;return{c(){e=B("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){N(t,e,n)},p:ne,i:ne,o:ne,d(t){t&&A(e)}}}function b1(r){let e,t,n,i,s,o;function a(c){r[14](c)}let l={class:"flex-1 flex flex-col",$$slots:{default:[T1]},$$scope:{ctx:r}};return r[1]!==void 0&&(l.value=r[1]),t=new Lf({props:l}),Re.push(()=>wi(t,"value",a)),{c(){e=B("div"),V(t.$$.fragment),J(e,"class","flex-1 flex overflow-hidden")},m(c,u){N(c,e,u),L(t,e,null),i=!0,s||(o=te(e,"keydown",r[9]),s=!0)},p(c,u){const f={};u&268435476&&(f.$$scope={dirty:u,ctx:c}),!n&&u&2&&(n=!0,f.value=c[1],Ti(()=>n=!1)),t.$set(f)},i(c){i||(k(t.$$.fragment,c),i=!0)},o(c){S(t.$$.fragment,c),i=!1},d(c){c&&A(e),W(t),s=!1,o()}}}function y1(r){let e;return{c(){e=he("Loading the TEI file. Please wait...")},m(t,n){N(t,e,n)},d(t){t&&A(e)}}}function k1(r){let e=r[23].type.title+"",t;return{c(){t=he(e)},m(n,i){N(n,t,i)},p(n,i){i&16&&e!==(e=n[23].type.title+"")&&Ie(t,e)},d(n){n&&A(t)}}}function Ll(r){let e,t;return e=new ld({props:{value:r[23].type.name,$$slots:{default:[k1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i&16&&(s.value=n[23].type.name),i&268435472&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function _1(r){let e,t,n=fe(r[4]),i=[];for(let o=0;o<n.length;o+=1)i[o]=Ll(Vl(r,n,o));const s=o=>S(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=de()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);N(o,e,a),t=!0},p(o,a){if(a&16){n=fe(o[4]);let l;for(l=0;l<n.length;l+=1){const c=Vl(o,n,l);i[l]?(i[l].p(c,a),k(i[l],1)):(i[l]=Ll(c),i[l].c(),k(i[l],1),i[l].m(e.parentNode,e))}for(re(),l=n.length;l<i.length;l+=1)s(l);ie()}},i(o){if(!t){for(let a=0;a<n.length;a+=1)k(i[a]);t=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)S(i[a]);t=!1},d(o){o&&A(e),it(i,o)}}}function S1(r){let e,t;function n(...i){return r[13](r[25],...i)}return e=new p1({props:{section:r[23],sections:r[4],editTextListEntry:r[10],selectedEntryId:r[2][r[23].name]}}),e.$on("update",n),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s&16&&(o.section=r[23]),s&16&&(o.sections=r[4]),s&20&&(o.selectedEntryId=r[2][r[23].name]),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function C1(r){let e,t;function n(...i){return r[12](r[25],...i)}return e=new zc({props:{section:r[23],sections:r[4],editTextListEntry:r[10]}}),e.$on("update",n),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s&16&&(o.section=r[23]),s&16&&(o.sections=r[4]),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function M1(r){let e,t;function n(...i){return r[11](r[25],...i)}return e=new Id({props:{section:r[23]}}),e.$on("update",n),{c(){V(e.$$.fragment)},m(i,s){L(e,i,s),t=!0},p(i,s){r=i;const o={};s&16&&(o.section=r[23]),e.$set(o)},i(i){t||(k(e.$$.fragment,i),t=!0)},o(i){S(e.$$.fragment,i),t=!1},d(i){W(e,i)}}}function w1(r){let e,t,n,i;const s=[M1,C1,S1],o=[];function a(l,c){return l[23].type.type==="metadata"?0:l[23].type.type==="text"?1:l[23].type.type==="textlist"?2:-1}return~(e=a(r))&&(t=o[e]=s[e](r)),{c(){t&&t.c(),n=K()},m(l,c){~e&&o[e].m(l,c),N(l,n,c),i=!0},p(l,c){let u=e;e=a(l),e===u?~e&&o[e].p(l,c):(t&&(re(),S(o[u],1,1,()=>{o[u]=null}),ie()),~e?(t=o[e],t?t.p(l,c):(t=o[e]=s[e](l),t.c()),k(t,1),t.m(n.parentNode,n)):t=null)},i(l){i||(k(t),i=!0)},o(l){S(t),i=!1},d(l){l&&A(n),~e&&o[e].d(l)}}}function Wl(r){let e,t;return e=new Uf({props:{value:r[23].type.name,class:"flex-1 overflow-hidden",$$slots:{default:[w1]},$$scope:{ctx:r}}}),{c(){V(e.$$.fragment)},m(n,i){L(e,n,i),t=!0},p(n,i){const s={};i&16&&(s.value=n[23].type.name),i&268435476&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){S(e.$$.fragment,n),t=!1},d(n){W(e,n)}}}function T1(r){let e,t,n,i;e=new ed({props:{$$slots:{default:[_1]},$$scope:{ctx:r}}});let s=fe(r[4]),o=[];for(let l=0;l<s.length;l+=1)o[l]=Wl(Fl(r,s,l));const a=l=>S(o[l],1,1,()=>{o[l]=null});return{c(){V(e.$$.fragment),t=K();for(let l=0;l<o.length;l+=1)o[l].c();n=de()},m(l,c){L(e,l,c),N(l,t,c);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(l,c);N(l,n,c),i=!0},p(l,c){const u={};if(c&268435472&&(u.$$scope={dirty:c,ctx:l}),e.$set(u),c&1300){s=fe(l[4]);let f;for(f=0;f<s.length;f+=1){const d=Fl(l,s,f);o[f]?(o[f].p(d,c),k(o[f],1)):(o[f]=Wl(d),o[f].c(),k(o[f],1),o[f].m(n.parentNode,n))}for(re(),f=s.length;f<o.length;f+=1)a(f);ie()}},i(l){if(!i){k(e.$$.fragment,l);for(let c=0;c<s.length;c+=1)k(o[c]);i=!0}},o(l){S(e.$$.fragment,l),o=o.filter(Boolean);for(let c=0;c<o.length;c+=1)S(o[c]);i=!1},d(l){l&&(A(t),A(n)),W(e,l),it(o,l)}}}function E1(r){var d;let e,t=((d=r[3])==null?void 0:d.name)+"",n,i,s,o,a,l;const c=[b1,g1,m1],u=[];function f(p,h){return p[4]?0:p[0]?1:2}return s=f(r),o=u[s]=c[s](r),{c(){e=B("h1"),n=he(t),i=K(),o.c(),a=de(),J(e,"class","sr-only")},m(p,h){N(p,e,h),R(e,n),N(p,i,h),u[s].m(p,h),N(p,a,h),l=!0},p(p,[h]){var g;(!l||h&8)&&t!==(t=((g=p[3])==null?void 0:g.name)+"")&&Ie(n,t);let m=s;s=f(p),s===m?u[s].p(p,h):(re(),S(u[m],1,1,()=>{u[m]=null}),ie(),o=u[s],o?o.p(p,h):(o=u[s]=c[s](p),o.c()),k(o,1),o.m(a.parentNode,a))},i(p){l||(k(o),l=!0)},o(p){S(o),l=!1},d(p){p&&(A(e),A(i),A(a)),u[s].d(p)}}}function O1(r,e,t){let n,i,s,o,a;oe(r,Yn,M=>t(18,n=M)),oe(r,Ns,M=>t(3,i=M));let l=[],c=-1,u=[],f=!1,d="",p={};const h=pn("uEditorConfig"),m=Nu();oe(r,m,M=>t(19,s=M));const g=Au();oe(r,g,M=>t(20,o=M));const b=St([h,Ns],([M,x],U)=>{M.isSuccess&&x&&x.name.endsWith(".tei")&&(t(0,f=!1),u=[],l=[],U(null),Yn.set(null),tn.set(!1),As({action:"LoadTextFile",branch:s,filename:x.fullpath,callback:Q=>{try{l=JSON.parse(Q),u=JSON.parse(Q),Yn.set(Q),tn.set(!1);const I=JSON.parse(Q),G=[];for(let O of M.data.tei.sections)for(let pe of I)if(O.name===pe.name){pe.type=O,G.push(pe);break}U(G),t(1,d="")}catch{t(0,f=!0),U(null)}}}))},null);oe(r,b,M=>t(4,a=M));const y=tn.subscribe(M=>{if(!M&&n)try{u=JSON.parse(n)}catch{}});function C(M,x){l[M].type==="text"||l[M].type==="textlist"?l[M].content=x.detail:l[M].type==="metadata"&&(l[M].content=x.detail.content),window.clearTimeout(c),c=window.setTimeout(()=>{Pr(l,u)?tn.set(!1):(Yn.set(JSON.stringify(l)),tn.set(!0))},100)}function w(M){var x,U;i!==null&&n!==null&&M.key==="s"&&(M.ctrlKey||M.metaKey)&&(M.preventDefault(),(!((x=o.data)!=null&&x.git.protect_default_branch)||((U=o.data)==null?void 0:U.git.default_branch)!==(s==null?void 0:s.id))&&As({action:"SaveCurrentFile",branch:s,filename:i.fullpath,data:n,callback(){tn.set(!1)}}))}function _(M,x){t(1,d=M),t(2,p[M]=x,p),t(2,p)}Du(y);const T=(M,x)=>{C(M,x)},j=(M,x)=>{C(M,x)},v=(M,x)=>{C(M,x)};function D(M){d=M,t(1,d)}return[f,d,p,i,a,m,g,b,C,w,_,T,j,v,D]}class D1 extends qe{constructor(e){super(),je(this,e,O1,E1,Ae,{})}}export{D1 as default};
|