1import{d as me,c as T,e as I,a0 as Ae,p as gr,t as J,D as w,J as ae,n as q,m as Q,ay as Fn,i as v,w as V,an as yr,aG as ti,aU as se,j as Ir,aX as Nu,C as al,h as ne,r as Bo,ad as Xn,b_ as ll,b$ as ws,aw as cl,al as Vo,aV as zo,c0 as Iu,F as fe,E as De,Q as yi,K as te,ap as ul,P as dl,c1 as Pu,aI as Ru,av as jn,az as Ne,I as po,aC as _u,bU as fl,O as lr,L as $u,c2 as Lu,g as Fo,c3 as bi,x as Jr,bZ as pl,c4 as Bu,o as Vu,c5 as hl,a_ as zu,c6 as Fu,bW as Ss,aB as ju,c7 as Cs,c8 as ml,c9 as gl,b0 as Hu,ca as Wu,cb as qu,cc as Ku,cd as Uu,b4 as Ju,f as yl,ce as Ms,cf as Gu,bg as Yu,bF as Xu,W as Qu,l as bl,G as Zu,a1 as ed,ac as td,cg as nd,ch as rd,bV as id,am as Ts,aZ as od,ci as Os,b2 as sd,cj as ad,ck as ld,M as cd,b6 as ud,A as dd,B as fd,X as pd}from"./DREHXjTd.js";import{_ as hd}from"./FTxbCxnw.js";import{e as md,_ as gd}from"./Bq_sSO39.js";import{_ as yd}from"./4jAdUL_M.js";import{a as bd}from"./BNMhYjt1.js";import{_ as vd}from"./Bw0n4hiA.js";import{_ as jo}from"./Dhl8RJdc.js";import{I as Li}from"./YGirYfaB.js";import{s as Bi,b as Vi}from"./DhvdbkJf.js";import{n as xd}from"./CB5mdFk9.js";import{_ as Ho}from"./GctFFk09.js";import{_ as kd}from"./8R9WQNKl.js";import{u as wd}from"./Crde6C7V.js";const Sd={"text-secondary-light":""},Cd=me({__name:"PublishCharacterCounter",props:{max:{},length:{}},setup(n){return(e,t)=>(T(),I("div",{dir:"ltr","pointer-events-none":"","pe-1":"","pt-2":"","text-sm":"","tabular-nums":"","text-secondary":"",flex:"",gap:"0.5",class:Ae({"text-rose-500":n.length>n.max})},[gr(J(n.length??0),1),t[0]||(t[0]=w("span",{"text-secondary-light":""},"/",-1)),w("span",Sd,J(n.max),1)],2))}}),vl=Object.assign(Cd,{__name:"PublishCharacterCounter"}),Md={relative:"",group:""},Td={absolute:"","right-2":"","top-2":""},Od=["aria-label"],Ed={absolute:"","right-2":"","bottom-2":""},Ad={flex:"","flex-col-reverse":"","gap-5":"","md:flex-row":""},Dd={flex:"","flex-col":"","gap-2":"","justify-between":""},Nd={id:"edit-attachment","font-bold":""},Id={flex:"","flex-col":"","gap-2":""},Pd={flex:"","flex-row-reverse":""},Rd=["disabled"],Es=1500,_d=me({__name:"PublishAttachment",props:{attachment:{},alt:{},removable:{type:Boolean,default:!0},dialogLabelledBy:{}},emits:["remove","setDescription"],setup(n,{emit:e}){const t=e,r=ae(!1),i=ae(n.attachment.description??"");function o(){r.value=!1,t("setDescription",i.value)}return(s,a)=>{const l=md,c=vl,u=yd;return T(),I("div",Md,[q(l,{attachment:n.attachment,"w-full":"","is-preview":""},null,8,["attachment"]),w("div",Td,[n.removable?(T(),I("div",{key:0,"aria-label":s.$t("attachment.remove_label"),class:"bg-black/75 hover:bg-red/75","text-white":"",px2:"",py2:"","rounded-full":"","cursor-pointer":"",onClick:a[0]||(a[0]=d=>s.$emit("remove"))},[...a[5]||(a[5]=[w("div",{"i-ri:close-line":"","text-3":"","text-6":"","md:text-3":""},null,-1)])],8,Od)):Q("",!0)]),w("div",Ed,[w("button",{class:"bg-black/75","text-white":"",px2:"",py1:"","rounded-2":"",onClick:a[1]||(a[1]=d=>r.value=!0)},J(s.$t("action.edit")),1)]),q(u,{modelValue:v(r),"onUpdate:modelValue":a[4]||(a[4]=d=>Fn(r)?r.value=d:null),"dialog-labelled-by":n.dialogLabelledBy,"py-6":"","px-6":"","max-w-300":""},{default:V(()=>[w("div",Ad,[w("div",Dd,[w("h1",Nd,J(s.$t("attachment.edit_title")),1),w("div",Id,[yr(w("textarea",{"onUpdate:modelValue":a[2]||(a[2]=d=>Fn(i)?i.value=d:null),"p-3":"","h-50":"","bg-base":"","rounded-2":"","border-strong":"","border-1":"","md:w-100":""},null,512),[[ti,v(i)]]),w("div",Pd,[q(c,{length:v(i).length,max:Es},null,8,["length"])]),w("button",{"btn-outline":"",disabled:v(i).length>Es,onClick:o},J(s.$t("action.apply")),9,Rd)]),w("button",{"btn-outline":"",onClick:a[3]||(a[3]=d=>r.value=!1)},J(s.$t("action.close")),1)]),q(l,{attachment:n.attachment,"w-full":"","is-preview":""},null,8,["attachment"])])]),_:1},8,["modelValue","dialog-labelled-by"])])}}}),$d=Object.assign(_d,{__name:"PublishAttachment"});function Ld(n){switch(n){case"ar":return se(()=>import("./BNKVqaLE.js"),[],import.meta.url).catch(()=>{});case"cs":return se(()=>import("./Cx1pcg6_.js"),[],import.meta.url).catch(()=>{});case"de":return se(()=>import("./CqNKyZ8q.js"),[],import.meta.url).catch(()=>{});case"en":return se(()=>import("./B8YES1q-.js"),[],import.meta.url).catch(()=>{});case"es":return se(()=>import("./N24QZuob.js"),[],import.meta.url).catch(()=>{});case"fa":return se(()=>import("./DIMlnmBE.js"),[],import.meta.url).catch(()=>{});case"fi":return se(()=>import("./DnLbsY2x.js"),[],import.meta.url).catch(()=>{});case"fr":return se(()=>import("./DZT8BvMf.js"),[],import.meta.url).catch(()=>{});case"it":return se(()=>import("./Bi5f5P7y.js"),[],import.meta.url).catch(()=>{});case"ja":return se(()=>import("./Bdpvq46_.js"),[],import.meta.url).catch(()=>{});case"ko":return se(()=>import("./-JacpoLV.js"),[],import.meta.url).catch(()=>{});case"nl":return se(()=>import("./Bz72Z8bp.js"),[],import.meta.url).catch(()=>{});case"pl":return se(()=>import("./Ck12sG4e.js"),[],import.meta.url).catch(()=>{});case"pt":return se(()=>import("./dU1baCKj.js"),[],import.meta.url).catch(()=>{});case"ru":return se(()=>import("./C5C18JJ1.js"),[],import.meta.url).catch(()=>{});case"tr":return se(()=>import("./DK5b6YPT.js"),[],import.meta.url).catch(()=>{});case"uk":return se(()=>import("./0IVUIUr8.js"),[],import.meta.url).catch(()=>{});case"vi":return se(()=>import("./B3neGKlw.js"),[],import.meta.url).catch(()=>{});case"zh":return se(()=>import("./B_NXpyvP.js"),[],import.meta.url).catch(()=>{});default:return se(()=>import("./B8YES1q-.js"),[],import.meta.url).catch(()=>{})}}const Bd=me({__name:"PublishEmojiPicker.client",emits:["select","selectCustom"],setup(n,{emit:e}){const t=e,{locale:r}=Ir(),i=ae(),o=ae(),s=Nu();async function a(){if(await ll(),o.value)o.value.update({theme:s,custom:ws.value});else{const[c,u,d]=await Promise.all([se(async()=>{const{Picker:f}=await import("./DO6MC0yE.js");return{Picker:f}},[],import.meta.url).then(({Picker:f})=>f),se(()=>import("./BUOEiLLB.js"),[],import.meta.url).then(f=>
1f.default).catch(()=>{}),Ld(r.value.split("-")[0])]);o.value=new c({data:()=>u,onEmojiSelect({native:f,src:p,alt:h,name:m}){f?t("select",f):t("selectCustom",{src:p,alt:h,"data-emoji-id":m})},set:"twitter",theme:s,custom:ws.value,i18n:d})}await cl(),i.value?.appendChild(o.value)}function l(){o.value&&i.value?.removeChild(o.value)}return(c,u)=>{const d=al("VDropdown"),f=Xn;return T(),ne(f,{content:c.$t("tooltip.add_emojis")},{default:V(()=>[q(d,{"auto-boundary-max-size":"",onApplyShow:u[0]||(u[0]=p=>a()),onApplyHide:u[1]||(u[1]=p=>l())},{popper:V(()=>[w("div",{ref_key:"el",ref:i,"min-w-10":"","min-h-10":""},null,512)]),default:V(()=>[Bo(c.$slots,"default")]),_:3})]),_:3},8,["content"])}}}),Vd=Object.assign(Bd,{__name:"PublishEmojiPicker"}),zd=["aria-label"],Fd={flex:"","gap-1":""},jd=["aria-label"],Hd=["aria-label"],Wd=["aria-label"],qd=me({__name:"PublishEditorTools",props:{editor:{}},setup(n){return(e,t)=>{const r=Xn,i=al("VDropdown");return T(),ne(r,{placement:"top",content:e.$t("tooltip.open_editor_tools")},{default:V(()=>[n.editor?(T(),ne(i,{key:0,placement:"bottom"},{popper:V(()=>[w("div",Fd,[q(r,{placement:"top",content:e.$t("tooltip.toggle_code_block")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":e.$t("tooltip.toggle_code_block"),class:Ae(n.editor.isActive("codeBlock")?"text-primary":""),onClick:t[0]||(t[0]=o=>n.editor?.chain().focus().toggleCodeBlock().run())},[...t[4]||(t[4]=[w("div",{"i-ri:code-s-slash-line":""},null,-1)])],10,jd)]),_:1},8,["content"]),q(r,{placement:"top",content:e.$t("tooltip.toggle_bold")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":e.$t("tooltip.toggle_bold"),class:Ae(n.editor.isActive("bold")?"text-primary":""),onClick:t[1]||(t[1]=o=>n.editor?.chain().focus().toggleBold().run())},[...t[5]||(t[5]=[w("div",{"i-ri:bold":""},null,-1)])],10,Hd)]),_:1},8,["content"]),q(r,{placement:"top",content:e.$t("tooltip.toggle_italic")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":e.$t("tooltip.toggle_italic"),class:Ae(n.editor.isActive("italic")?"text-primary":""),onClick:t[2]||(t[2]=o=>n.editor?.chain().focus().toggleItalic().run())},[...t[6]||(t[6]=[w("div",{"i-ri:italic":""},null,-1)])],10,Wd)]),_:1},8,["content"])])]),default:V(()=>[w("button",{"btn-action-icon":"","aria-label":e.$t("tooltip.open_editor_tools")},[...t[3]||(t[3]=[w("div",{"i-ri:font-size-2":""},null,-1)])],8,zd)]),_:1})):Q("",!0)]),_:1},8,["content"])}}}),Kd=Object.assign(qd,{__name:"PublishEditorTools"}),Gr=Li.getAllCodes().map(n=>({code:n,nativeName:Li.getNativeName(n),name:Li.getName(n)})),Ud={relative:"","of-x-hidden":""},Jd={p2:""},Gd=["placeholder"],Yd={"max-h-40vh":"","overflow-auto":""},Xd=me({__name:"PublishLanguagePicker",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(n){const e=Vo(n,"modelValue"),{t}=Ir(),r=zo(),i=ae(""),o=new Iu(Gr,{keys:["code","nativeName","name"],shouldSort:!0}),s=te(()=>i.value.trim()?o.search(i.value).map(c=>c.item):[...Gr].filter(c=>!r.value.disabledTranslationLanguages.includes(c.code)).sort(({code:c},{code:u})=>c==="en"||c===e.value?-1:u===e.value?1:c.localeCompare(u))),a=te(()=>{const c=[];for(const u of r.value.disabledTranslationLanguages){const d=Gr.find(f=>f.code===u);d&&c.push(d)}return c});function l(c){e.value=c}return(c,u)=>{const d=yi;return T(),I("div",Ud,[w("div",Jd,[yr(w("input",{"onUpdate:modelValue":u[0]||(u[0]=f=>Fn(i)?i.value=f:null),placeholder:v(t)("language.search"),p2:"","border-rounded":"","w-full":"","bg-transparent":"","outline-none":"",border:"~ base"},null,8,Gd),[[ti,v(i)]])]),w("div",Yd,[v(i).trim()?Q("",!0):(T(),I(fe,{key:0},[(T(!0),I(fe,null,De(v(a),({code:f,nativeName:p,name:h})=>(T(),ne(d,{key:f,text:p,description:h,checked:f===e.value,onClick:m=>l(f)},null,8,["text","description","checked","onClick"]))),128)),u[1]||(u[1]=w("hr",{class:"border-base"},null,-1))],64)),(T(!0),I(fe,null,De(v(s),({code:f,nativeName:p,name:h})=>(T(),ne(d,{key:f,text:p,description:h,checked:f===e.value,onClick:m=>l(f)},null,8,["text","description","checked","onClick"]))),128))])])}}}),Qd=Object.assign(Xd,{__name:"PublishLanguagePicker"}),Zd=me({__name:"PublishVisibilityPicker",props:ul({editing:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=Vo(n,"modelValue"),t=te(()=>Bi.find(i=>i.value===e.value)||Bi[0]);function r(i){e.value=i}return(i,o)=>{const s=yi,a=jo,l=Xn;return T(),ne(l,{placement:"top",content:n.editing?i.$t(`visibility.${v(t).value}`):i.$t("tooltip.change_content_visibility")},{default:V(()=>[q(a,{placement:"bottom"},{popper:V(()=>[(T(!0),I(fe,null,De("statusVisibilities"in i?i.statusVisibilities:v(Bi),c=>(T(),ne(s,{key:c.value,icon:c.icon,text:i.$t(`visibility.${c.value}`),description:i.$t(`visibility.${c.value}_desc`),checked:c.value===e.value,onClick:u=>r(c.value)},null,8,["icon","text","description","checked","onClick"]))),128))]),default:V(()=>[Bo(i.$slots,"default",{visibility:v(t)})]),_:3})]),_:3},8,["content"])}}}),ef=Object.assign(Zd,{__name:"PublishVisibilityPicker"}),tf={flex:"","items-center":""},nf=me({__name:"PublishQuoteApprovalPicker",props:ul({editing:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=Vo(n,"modelValue"),t=te(()=>Vi.find(i=>i.value===e.value)||Vi[0]);function r(i){e.value=i}return(i,o)=>{const s=yi,a=jo,l=Xn;return T(),I("div",tf,[o[0]||(o[0]=w("div",{"i-ri:double-quotes-l":"","me--2":""},null,-1)),q(l,{placement:"top",content:n.editing?i.$t(`quote_approval_policy.${v(t).value}`):i.$t("tooltip.change_quote_approval_policy")},{default:V(()=>[q(a,{placement:"bottom"},{popper:V(()=>[(T(!0),I(fe,null,De(v(Vi),c=>(T(),ne(s,{key:c.value,icon:c.icon,text:i.$t(`quote_approval_policy.${c.value}`),description:i.$t(`quote_approval_policy.${c.value}_desc`),checked:c.value===e.value,onClick:u=>r(c.value)},null,8,["icon","text","description","checked","onClick"]))),128))]),default:V(()=>[Bo(i.$slots,"default",{quoteApprovalPolicy:v(t)})]),_:3})]),_:3},8,["content"])])}}}),rf=Object.assign(nf,{__name:"PublishQuoteApprovalPicker"});function xl(n){const{draftItem:e}=n,t=te(()=>$u([e.value])),{client:r}=dl(),i=zo(),o=te(()=>(lr.value?.account.source.language||i.value?.language||"en").split("-")[0]),s=ae(!1),a=ae(!1),l=ae([]),c=te({get(){return e.value.params.sensitive?e.value.params.spoilerText:""},set(p){e.value.params.sensitive&&(e.value.params.spoilerText=p)}}),u=te(()=>n.expanded.value||a.value||!t.value),d=te(()=>{const{params:p,attachments:h}=e.value,m=p.poll?.options.findIndex(g=>g.trim().length===0);return t.value||n.isUploading.value||s.value||h.length===0&&!p.status||l.value.length>0||h.length>0&&p.poll!==null&&p.poll!==void 0||p.poll!==null&&p.poll!==void 0&&(m!==-1&&m!==p.poll.options.length-1||p.poll.options.findLastIndex(g=>g.trim().length>0)+1<2||new Set(p.poll.options).size!==p.poll.options.length||Ne.value?.configuration?.polls.maxCharactersPerOption!==void 0&&p.poll.options.some(g=>g.length>Ne.value.configuration.polls.maxCharactersPerOption))});jn(e,()=>{l.value.length>0&&(l.value.length=0)},{deep:!0});async function f(){if(d.value)return;let p=po(e.value.params.status||"");e.value.mentions?.length&&(p=`${e.value.mentions.map(b=>`@${b}`).join(" ")} ${p}`);let h;if(e.value.params.poll){let b=e.value.params.poll.options;Ne.value?.configuration!==void 0&&(b.length<Ne.value.configuration.polls.maxOptions||b.at(-1)?.trim().length===0)&&(b=b.slice(0,b.length-1)),h={...e.value.params.poll,options:b}}let m;e.value.params.scheduledAt&&(m=new Date(e.value.params.scheduledAt).toISOString());const g={...e.value.params,spoilerText:c.value,status:p,mediaIds:e.value.attachments.map(b=>b.id),language:e.value.params.language||o.value,poll:h,scheduledAt:m,quotedStatusId:e.value.params.quotedStatusId,quoteApprovalPolicy:e.value.params.quoteApprovalPolicy,..._u.value?{"content-type":"text/markdown"}:{}};try{s.value=!0;let b;return e.value.editingStatus?b=await r.value.v1.statuses.$select(e.value.editingStatus.id).update({...g,mediaAttributes:e.value.attachments.map(A=>({id:A.id,description:A.description}))}):b=await r.value.v1.statuses.create(g),e.value.params.inReplyToId&&!n.isPartOfThread&&fl({status:b}
1),e.value=n.initialDraft(),"scheduled_at"in b?void 0:b}catch(b){l.value.push(b.message)}finally{s.value=!1}}return{isSending:s,isExpanded:a,shouldExpanded:u,isPublishDisabled:d,failedMessages:l,preferredLanguage:o,publishSpoilerText:c,publishDraft:f}}function of(n){const{client:e}=dl(),{t}=Ir(),{formatFileSize:r}=Pu(),i=ae(!1),o=ae(!1),s=ae([]),a=ae(),l=te(()=>Ne.value?.configuration?.mediaAttachments?.imageMatrixLimit??4096**2),c=S=>new Promise((y,D)=>{const C=URL.createObjectURL(S),N=new Image;N.onerror=E=>D(E),N.onload=()=>y(N),N.src=C});function u(S,y="image/png"){const{width:D,height:C}=S,N=D/C,E=document.createElement("canvas"),$=E.width=Math.round(Math.sqrt(l.value*N)),F=E.height=Math.round(Math.sqrt(l.value/N));return E.getContext("2d")?.drawImage(S,0,0,$,F),new Promise(B=>{E.toBlob(B,y)})}async function d(S){try{const y=await c(S);return y.width*y.height>l.value&&(S=await u(y,S.type)),S}catch{return S}}async function f(S){return S.type.startsWith("image/")?await d(S):S}async function p(S){i.value=!0,s.value=[];const y=Ne.value.configuration?.statuses.maxMediaAttachments||4,D=Ne.value.configuration?.mediaAttachments.videoSizeLimit||0,C=Ne.value.configuration?.mediaAttachments.imageSizeLimit||0;for(const N of S.slice(0,y))if(n.value.attachments.length<y){if(N.type.startsWith("image/")){if(C>0&&N.size>C){s.value=[...s.value,[N.name,t("state.attachments_limit_image_error",[r(C)])]];continue}}else if(D>0&&N.size>D){const E=N.type.startsWith("audio/")?"state.attachments_limit_audio_error":N.type.startsWith("video/")?"state.attachments_limit_video_error":"state.attachments_limit_unknown_error",$=t(E,[r(D)]);s.value=[...s.value,[N.name,$]];continue}o.value=!1;try{const E=await e.value.v1.media.create({file:await f(N)});n.value.attachments.push(E)}catch(E){s.value=[...s.value,[N.name,E.message]]}}else o.value=!0,s.value=[...s.value,[N.name,t("state.attachments_limit_error")]];i.value=!1}async function h(){const S=Ne.value.configuration?.mediaAttachments.supportedMimeTypes,y=await xd({description:"Attachments",multiple:!0,mimeTypes:S});await p(y)}async function m(S,y){S.description=y,n.value.editingStatus||await e.value.v1.media.$select(S.id).update({description:S.description})}function g(S){n.value.attachments.splice(S,1)}async function b(S){S&&await p(S)}const{isOverDropZone:A}=Ru(a,b);return{isUploading:i,isExceedingAttachmentLimit:o,isOverDropZone:A,failedAttachments:s,dropZoneRef:a,uploadAttachments:p,pickAttachments:h,setDescription:m,removeAttachment:g}}const sf=99;function Wo(n,e){const{draftItems:t}=Lu(n,e),r=te(()=>t.value.length>1),i=ae(!1);function o(){if(t.value.length>=sf)return;const l=t.value.at(-1);l&&t.value.push(Fo({language:l.params.language,sensitive:l.params.sensitive,spoilerText:l.params.spoilerText,visibility:l.params.visibility}))}function s(l){t.value.splice(l,1)}async function a(){const l=[],c=!!t.value[0].params.inReplyToId;i.value=!0;let u=null,d=0;for(const f of t.value){u&&(f.params.inReplyToId=u.id);const{publishDraft:p,failedMessages:h}=xl({draftItem:ae(f),expanded:te(()=>!0),isUploading:ae(!1),initialDraft:()=>f,isPartOfThread:!0}),m=await p();if(m)u=m,d++;else{l.push(...h.value);break}}return t.value.splice(0,d),i.value=!1,l.length>0?l:(c&&u&&t.value.length===0&&fl({status:u}),u)}return{threadItems:t,threadIsActive:r,addThreadItem:o,removeThreadItem:s,publishThread:a,threadIsSending:i}}const af={key:0,dir:"ltr","pointer-events-none":"","pe-1":"","pt-2":"","pl-2":"","text-sm":"","tabular-nums":"","text-secondary":"",flex:"",gap:"0.5"},lf={"text-secondary-light":""},cf=["aria-label"],uf={key:0,"i-ri:chat-delete-line":""},df={key:1,"i-ri:chat-new-line":""},ff=me({__name:"PublishThreadTools",props:{draftKey:{},draftItemIndex:{}},setup(n){const{threadIsActive:e,addThreadItem:t,threadItems:r,removeThreadItem:i}=Wo(n.draftKey),o=te(()=>e.value&&n.draftItemIndex<r.value.length-1);function s(){o.value?i(n.draftItemIndex):t()}const{t:a}=Ir(),l=te(()=>!o.value&&n.draftItemIndex===0?a("tooltip.start_thread"):o.value?a("tooltip.remove_thread_item"):a("tooltip.add_thread_item"));return(c,u)=>{const d=Xn;return T(),I("div",{flex:"","flex-row":"","rounded-3":"",class:Ae({"bg-border":v(e)})},[v(e)?(T(),I("div",af,[gr(J(n.draftItemIndex+1),1),u[0]||(u[0]=w("span",{"text-secondary-light":""},"/",-1)),w("span",lf,J(v(r).length),1)])):Q("",!0),q(d,{placement:"top",content:v(l)},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":v(l),onClick:s},[v(o)?(T(),I("div",uf)):(T(),I("div",df))],8,cf)]),_:1},8,["content"])],2)}}}),pf=Object.assign(ff,{__name:"PublishThreadTools"});function Se(n){this.content=n}Se.prototype={constructor:Se,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Se(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Se(t)},addToStart:function(n,e){return new Se([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Se(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Se(i)}
vendor: 9,506 bytes, line 1
1,forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Se.from(n),n.size?new Se(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Se.from(n),n.size?new Se(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Se.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Se.from=function(n){if(n instanceof Se)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Se(e)};function kl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=kl(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function wl(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){t-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let c=wl(s.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,a=0;a<t;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!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)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new O(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),i+=a.nodeSize),s=l}return new O(r,i)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new O(i,o)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return kl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return wl(this,e,t,r)}findIndex(e){if(e==0)return Vr(0,e);if(e==this.size)return Vr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),o=r+i.nodeSize;if(o>=e)return o==e?Vr(t+1,o):Vr(t,r);r=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 O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new O(t||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const zi={index:0,offset:0};function Vr(n,e){return zi.index=n,zi.offset=e,zi}function ni(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ni(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ni(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let re=class ho{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ni(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ho.none;if(e instanceof ho)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};re.none=[];class ri extends Error{}class R{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Cl(this.content,e+this.openStart,t);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,t){return new R(Sl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return R.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(O.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new R(e,r,i)}}R.empty=new R(O.empty,0,0);function Sl(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(i==e||o.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Sl(o.content,e-i-1,t-i-1)))}function Cl(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Cl(s.content,e-o-1,t,s);return a&&n.replaceChild(i,s.copy(a))}function hf(n,e,t){if(t.openStart>n.depth)throw new ri("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ri("Inconsistent open depths");return Ml(n,e,t,0)}function Ml(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Ml(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return fn(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=mf(t,n);return fn(o,Ol(n,s,a,e,r))}else return fn(o,ii(n,e,r))}function Tl(n,e){if(!e.type.compatibleContent(n.type))throw new ri("Cannot join "+e.type.name+" onto "+n.type.name)}function mo(n,e,t){let r=n.node(t);return Tl(r,e.node(t)),r}function dn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function cr(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>
vendor: 8,802 bytes, line 1
1t?o++:n.textOffset&&(dn(n.nodeAfter,r),o++));for(let a=o;a<s;a++)dn(i.child(a),r);e&&e.depth==t&&e.textOffset&&dn(e.nodeBefore,r)}function fn(n,e){return n.type.checkContent(e),n.copy(e)}function Ol(n,e,t,r,i){let o=n.depth>i&&mo(n,e,i+1),s=r.depth>i&&mo(t,r,i+1),a=[];return cr(null,n,i,a),o&&s&&e.index(i)==t.index(i)?(Tl(o,s),dn(fn(o,Ol(n,e,t,r,i+1)),a)):(o&&dn(fn(o,ii(n,e,i+1)),a),cr(e,t,i,a),s&&dn(fn(s,ii(t,r,i+1)),a)),cr(r,null,i,a),new O(a)}function ii(n,e,t){let r=[];if(cr(null,n,t,r),n.depth>t){let i=mo(n,e,t+1);dn(fn(i,ii(n,e,t+1)),r)}return cr(e,null,t,r),new O(r)}function mf(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(O.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class br{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):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 r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return re.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new oi(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new br(t,r,o)}static resolveCached(e,t){let r=As.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else As.set(e,r=new gf);let i=r.elts[r.i]=br.resolve(e,t);return r.i=(r.i+1)%yf,i}}class gf{constructor(){this.elts=[],this.i=0}}const yf=12,As=new WeakMap;class oi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const bf=Object.create(null);let Dt=class go{constructor(e,t,r,i=re.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,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,r,i){return this.content.textBetween(e,t,r,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,r){return this.type==e&&ni(this.attrs,t||e.defaultAttrs||bf)&&re.sameSet(this.marks,r||re.none)}copy(e=null){return e==this.content?this:new go(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new go(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return R.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new R(c,i.depth-s,o.depth-s)}replace(e,t,r){return hf(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return br.resolveCached(this,e)}resolveNoCache(e){return br.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.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()+")"),El(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=O.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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=re.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!re.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=O.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Dt.prototype.text=void 0;
vendor: 10,111 bytes, lines 1-2
1class si extends Dt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):El(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 si(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new si(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 El(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class yn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new vf(e,t);if(r.next==null)return yn.empty;let i=Al(r);r.next&&r.err("Unexpected trailing text");let o=Tf(Mf(i));return Of(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!t||l.validEnd))return O.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=o(d,a.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.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(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(` 2`)}}yn.empty=new yn(!0);class vf{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 Al(n){let e=[];do e.push(xf(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function xf(n){let e=[];do e.push(kf(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kf(n){let e=Cf(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=wf(n,e);else break;return e}function Ds(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function wf(n,e){let t=Ds(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ds(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Sf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Cf(n){if(n.eat("(")){let e=Al(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Sf(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Mf(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=t())}else if(s.type=="star"){let l=t();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=t();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,l),u),l=u}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=t();r(l,u),i(o(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Dl(n,e){return e-n}function Ns(n,e){let t=[];return r(e),t.sort(Dl);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&t.indexOf(l)==-1&&r(l)}}}function Tf(n){let e=Object.create(null);return t(Ns(n,0));function t(r){let i=[];r.forEach(s=>{n[s].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]);Ns(n,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new yn(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(Dl);o.next.push({type:i[s][0],next:e[a.join(",")]||t(a)})}return o}}function Of(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Nl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Il(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Pl(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Rl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Af(n,r,e[r]);return t}let Is=class _l{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Rl(e,r.attrs),this.defaultAttrs=Nl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yn.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:Il(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Dt(this,this.computeAttrs(e),O.from(t),re.setFrom(r))}createChecked(e=null,t,r){return t=O.from(t),this.checkContent(t),new Dt(this,this.computeAttrs(e),t,re.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=O.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(O.empty,!0);return o?new Dt(this,e,t.append(o),re.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Pl(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:re.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new _l(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Ef(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class Af{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ef(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}
vendor: 3,549 bytes, line 2
2class vi{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Rl(e,i.attrs),this.excluded=null;let o=Nl(this.attrs);this.instance=o?new re(this,o):null}create(e=null){return!e&&this.instance?this.instance:new re(this,Il(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new vi(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Pl(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class $l{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=Se.from(e.nodes),t.marks=Se.from(e.marks||{}),this.nodes=Is.compile(this.spec.nodes,this),this.marks=vi.compile(this.spec.marks,this);let r=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 o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=yn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Ps(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Ps(this,s.split(" "))}this.nodeFromJSON=i=>Dt.fromJSON(this,i),this.markFromJSON=i=>re.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Is){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new si(r,r.defaultAttrs,e,re.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ps(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Df(n){return n.tag!=null}function Nf(n){return n.style!=null}class qt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Df(i))this.tags.push(i);else if(Nf(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new _s(this,t,!1);return r.addAll(e,re.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new _s(this,t,!0);return r.addAll(e,re.none,t.from,t.to),R.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Rf(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}
vendor: 1,339 bytes, line 2
2matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let a=t[s];if((a.priority==null?50:a.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=$s(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=$s(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qt(e,qt.schemaRules(e)))}}const Ll={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},If={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Bl={ol:!0,ul:!0},vr=1,yo=2,ur=4;function Rs(n,e,t){return e!=null?(e?vr:0)|(e==="full"?yo:0):n&&n.whitespace=="pre"?vr|yo:t&~ur}
vendor: 8,434 bytes, lines 2-4
2class zr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=re.none,this.match=o||(s&ur?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(O.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&vr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=O.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(O.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&&!Ll.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class _s{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=Rs(null,t.preserveWhitespace,0)|(r?ur:0);i?o=new zr(i.type,i.attrs,re.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new zr(null,null,re.none,!0,null,s):o=new zr(e.schema.topNodeType,null,re.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&yo?"full":this.localPreserveWS||(i.options&vr)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` 3`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Bl.hasOwnProperty(s)&&this.parser.normalizeLists&&Pf(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:If.hasOwnProperty(s))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(Ll.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),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(` 4`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,t.attrs||null,r,t.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=re.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):Ls(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Rs(e,o,s.options);s.options&ur&&s.content.length==0&&(a|=ur);let l=re.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Ls(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new zr(e,t,l,i,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=vr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let 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)&(r?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("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Pf(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Bl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Rf(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function $s(n){let e={};for(let t in n)e[t]=n[t];return e}function Ls(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];
vendor: 7,349 bytes, line 4
4if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Sn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Fi(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Yr(Fi(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 r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Yr(Fi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Yr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Bs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Bs(e.marks)}}function Bs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Fi(n){return n.document||window.document}const Vs=new WeakMap;function _f(n){let e=Vs.get(n);return e===void 0&&Vs.set(n,e=$f(n)),e}function $f(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Yr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=_f(r))&&o.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 s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=Yr(n,f,t,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const Vl=65535,zl=Math.pow(2,16);function Lf(n,e){return n+e*zl}function zs(n){return n&Vl}function Bf(n){return(n-(n&Vl))/zl}const Fl=1,jl=2,Xr=4,Hl=8;class bo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Hl)>0}get deletedBefore(){return(this.delInfo&(Fl|Xr))>0}get deletedAfter(){return(this.delInfo&(jl|Xr))>0}get deletedAcross(){return(this.delInfo&Xr)>0}}class Je{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Je.empty)return Je.empty}recover(e){let t=0,r=zs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Bf(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=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+o],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,p=l+i+(f<0?0:u);if(r)return p;let h=e==(t<0?l:d)?null:Lf(a/3,e-l),m=e==l?jl:e==d?Fl:Xr;return(t<0?e!=l:e!=d)&&(m|=Hl),new bo(p,m,h)}i+=u-c}return r?e+i:new bo(e+i,0,null)}touches(e,t){let r=0,i=zs(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new Je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Je.empty:new Je(e<0?[0,-e,0]:[0,0,e])}}Je.empty=new Je([]);class xr{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new xr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+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,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new xr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new bo(e,i,null)}}const ji=Object.create(null);class Pe{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ji[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ji)throw new RangeError("Duplicate use of step JSON ID "+e);return ji[e]=t,t.prototype.jsonID=e,t}}class pe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,t,r,i){try{return pe.ok(e.replace(t,r,i))}catch(o){if(o instanceof ri)return pe.fail(o.message);throw o}}}function qo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(qo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return O.fromArray(r)}class jt extends Pe{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.no
vendor: 5,494 bytes, line 4
4de(r.sharedDepth(this.to)),o=new R(qo(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return pe.fromReplace(e,this.from,this.to,o)}invert(){return new mt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new jt(t.pos,r.pos,this.mark)}merge(e){return e instanceof jt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jt(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 jt(t.from,t.to,e.markFromJSON(t.mark))}}Pe.jsonID("addMark",jt);class mt extends Pe{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new R(qo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new jt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new mt(t.pos,r.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:"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 mt(t.from,t.to,e.markFromJSON(t.mark))}}Pe.jsonID("removeMark",mt);class Ht extends Pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return pe.fromReplace(e,this.pos,this.pos+1,new R(O.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Ht(this.pos,t.marks[i]);return new Ht(this.pos,this.mark)}}return new bn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ht(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 Ht(t.pos,e.markFromJSON(t.mark))}}Pe.jsonID("addNodeMark",Ht);class bn extends Pe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return pe.fromReplace(e,this.pos,this.pos+1,new R(O.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ht(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new bn(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 bn(t.pos,e.markFromJSON(t.mark))}}Pe.jsonID("removeNodeMark",bn);class ge extends Pe{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&vo(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(e){return new ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new ge(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ge(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 ge(t.from,t.to,R.fromJSON(e,t.slice),!!t.structure)}}Pe.jsonID("replace",ge);class ye extends Pe{constructor(e,t,r,i,o,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(vo(e,this.from,this.gapFrom)||vo(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);
vendor: 18,931 bytes, lines 4-5
4return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new Je([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 ye(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ye(t.pos,r.pos,i,o,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 ye(t.from,t.to,t.gapFrom,t.gapTo,R.fromJSON(e,t.slice),t.insert,!!t.structure)}}Pe.jsonID("replaceAround",ye);function vo(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Vf(n,e,t,r){let i=[],o=[],s,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,t),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=p:i.push(s=new mt(f,p,d[m])));a&&a.to==f?a.to=p:o.push(a=new jt(f,p,r))}}),i.forEach(l=>n.step(l)),o.forEach(l=>n.step(l))}function zf(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof vi){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&d.eq(i[p].style)&&(f=h)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>n.step(new mt(s.from,s.to,s.style)))}function Ko(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ge(a,u,R.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new mt(a,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new R(O.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new ge(a+f.index,a+f.index+f[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(O.empty,!0);n.replace(a,a,new R(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function Ff(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Qn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Ff(i,o,s))break}return null}function jf(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,u=O.empty,d=0;for(let h=o,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,u=O.from(r.node(h).copy(u)),d++):l--;let f=O.empty,p=0;for(let h=o,m=!1;h>t;h--)m||i.after(h+1)<i.end(h)?(m=!0,f=O.from(i.node(h).copy(f)),p++):c++;n.step(new ye(l,c,s,a,new R(u.append(f),d,p),u.size-d,!0))}function Wl(n,e,t=null,r=n){let i=Hf(n,e),o=i&&Wf(r,e);return o?i.map(Fs).concat({type:e,attrs:t}).concat(o.map(Fs)):null}function Fs(n){return{type:n,attrs:null}}function Hf(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Wf(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:s}function qf(n,e,t){let r=O.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=O.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ye(i,o,i,o,new R(r,0,0),t.length,!0))}function Kf(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Uf(n.doc,n.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&Kl(n,s,a,o),Ko(n,n.mapping.slice(o).map(a,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return n.step(new ye(d,f,d+1,f-1,new R(O.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&ql(n,s,a,o),!1}})}function ql(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Kl(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(` 5`))}})}function Uf(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Jf(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ye(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new R(O.from(s),0,0),1,!0))}function Nt(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Gf(n,e,t=1,r){let i=n.doc.resolve(e),o=O.empty,s=O.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){o=O.from(i.node(a).copy(o));let u=r&&r[c];s=O.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}n.step(new ge(e,e,new R(o.append(s),t,t),!0))}function Cn(n,e){let t=n.resolve(e),r=t.index();return Ul(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Yf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function Ul(n,e){return!!(n&&e&&!n.isLeaf&&Yf(n,e))}function xi(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Ul(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Xf(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Kl(n,u.node(),u.before(),a)}s.inlineContent&&Ko(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new ge(c,l.map(e+t,-1),R.empty,!0)),r===!0){let u=n.doc.resolve(c);ql(n,u.node(),u.before(),n.steps.length)}return n}function Qf(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Zf(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function ki(n,e,t=e,r=R.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Jl(i,o,r)?new ge(e,t,r):new ep(i,o,r).fit()}function Jl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class ep{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=O.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=O.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,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new R(o,s,a);return e>-1?new ye(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new ge(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Hi(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(O.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Hi(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Hi(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new R(or(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new R(or(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(Gl(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=sr(this.placed,t,O.from(u)),this.frontier[t].match=d,h&&p<0&&r&&r.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?R.empty:new R(or(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new R(or(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Wi(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Wi(e,t,i,r,o);if(s){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Wi(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?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=sr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=sr(this.placed,this.depth,O.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(O.empty,!0);t.childCount&&(this.placed=sr(this.placed,this.frontier.length,t))}}function or(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(or(n.firstChild.content,e-1,t)))}function sr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(sr(n.lastChild.content,e-1,t)))}function Hi(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Gl(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Gl(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(O.empty,!0)))),n.copy(r)}function Wi(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!tp(t,o.content,s)?a:null}function tp(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function np(n){return n.spec.defining||n.spec.definingForContent}function rp(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Jl(i,o,r))return n.step(new ge(e,t,r));let s=Xl(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let f=i.depth,p=i.pos-1;f>0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:i.before(f)==p&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=np(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let A=i.node(g-1),S=i.index(g-1);if(A.canReplaceWith(S,S,h.type,h.marks))return n.replace(i.before(g),b?o.after(g):t,new R(Yl(r.content,0,r.openStart,p),p,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let p=s[f];p<0||(e=i.before(p),t=o.after(p))}}function Yl(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Yl(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(O.empty,!0))}return n}function ip(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Qf(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new R(O.from(r),0,0))}function op(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Xl(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Xl(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Vn extends Pe{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return pe.fromReplace(e,this.pos,this.pos+1,new R(O.from(i),0,t.isLeaf?0:1))}getMap(){return Je.empty}invert(e){return new Vn(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 Vn(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 Vn(t.pos,t.attr,t.value)}}Pe.jsonID("attr",Vn);class kr 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 r=e.type.create(t,e.content,e.marks);return pe.ok(r)}getMap(){return Je.empty}invert(e){return new kr(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 kr(t.attr,t.value)}}Pe.jsonID("docAttr",kr);
vendor: 3,246 bytes, line 5
5let Hn=class extends Error{};Hn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Hn.prototype=Object.create(Error.prototype);Hn.prototype.constructor=Hn;Hn.prototype.name="TransformError";class sp{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Hn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=R.empty){let i=ki(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new R(O.from(r),0,0))}delete(e,t){return this.replace(e,t,R.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return rp(this,e,t,r),this}replaceRangeWith(e,t,r){return ip(this,e,t,r),this}deleteRange(e,t){return op(this,e,t),this}lift(e,t){return jf(this,e,t),this}join(e,t=1){return Xf(this,e,t),this}wrap(e,t){return qf(this,e,t),this}setBlockType(e,t=e,r,i=null){return Kf(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Jf(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Vn(e,t,r)),this}setDocAttribute(e,t){return this.step(new kr(e,t)),this}addNodeMark(e,t){return this.step(new Ht(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof re)t.isInSet(r.marks)&&this.step(new bn(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new bn(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,t=1,r){return Gf(this,e,t,r),this}addMark(e,t,r){return Vf(this,e,t,r),this}removeMark(e,t,r){return zf(this,e,t,r),this}clearIncompatible(e,t,r){return Ko(this,e,t,r),this}}const qi=Object.create(null);class G{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ap(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=R.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(c.pos),a?R.empty:t),a==0&&Ws(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Ws(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new U(e):Rn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?Rn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Rn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}
vendor: 7,342 bytes, line 5
5static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ye(e.node(0))}static atStart(e){return Rn(e,e,0,0,1)||new Ye(e)}static atEnd(e){return Rn(e,e,e.content.size,e.childCount,-1)||new Ye(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=qi[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in qi)throw new RangeError("Duplicate use of selection JSON ID "+e);return qi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return U.between(this.$anchor,this.$head).getBookmark()}}G.prototype.visible=!0;class ap{constructor(e,t){this.$from=e,this.$to=t}}let js=!1;function Hs(n){!js&&!n.parent.inlineContent&&(js=!0)}class U extends G{constructor(e,t=e){Hs(e),Hs(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=e.resolve(t.map(this.anchor));return new U(i.parent.inlineContent?i:r,r)}replace(e,t=R.empty){if(super.replace(e,t),t==R.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof U&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wi(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 U(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=G.findFrom(t,r,!0)||G.findFrom(t,-r,!0);if(o)t=o.$head;else return G.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(G.findFrom(e,-r,!0)||G.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new U(e,t)}}G.jsonID("text",U);class wi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new wi(e.map(this.anchor),e.map(this.head))}resolve(e){return U.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends G{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?G.near(o):new z(o)}content(){return new R(O.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Uo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(t.anchor))}static create(e,t){return new z(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;G.jsonID("node",z);class Uo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new wi(r,r):new Uo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&z.isSelectable(r)?new z(t):G.near(t)}}class Ye extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=R.empty){if(t==R.empty){e.delete(0,e.doc.content.size);let r=G.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ye(e)}map(e){return new Ye(e)}eq(e){return e instanceof Ye}getBookmark(){return lp}}G.jsonID("all",Ye);const lp={map(){return this},resolve(n){return new Ye(n)}};function Rn(n,e,t,r,i,o=!1){if(e.inlineContent)return U.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&z.isSelectable(a))return z.create(n,t-(i<0?a.nodeSize:0))}else{let l=Rn(n,a,t+i,i<0?a.childCount:0,i,o);if(l)return l}t+=a.nodeSize*i}return null}function Ws(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof ge||i instanceof ye))return;let o=n.mapping.maps[r],s;o.forEach((a,l,c,u)=>{s==null&&(s=u)}),n.setSelection(G.near(n.doc.resolve(s),t))}const qs=1,Fr=2,Ks=4;class cp extends sp{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|qs)&~Fr,this.storedMarks=null,this}get selectionSet(){return(this.updated&qs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fr,this}ensureMarks(e){return re.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&Fr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Fr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||re.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(G.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|=Ks,this}get scrolledIntoView(){return(this.updated&Ks)>0}}function Us(n,e){return!e||!n?n:n.bind(e)}class ar{constructor(e,t,r){this.name=e,this.init=Us(t.init,r),this.apply=Us(t.apply,r)}}const up=[new ar("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ar("selection",{init(n,e){return n.selection||G.atStart(e.doc)},apply(n){return n.selection}}),new ar("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ar("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ki{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=up.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ar(r.key,r.spec.state,r))})}}class Ln{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 4,601 bytes, line 5
5apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];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],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ln(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new cp(this)}static create(e){let t=new Ki(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ln(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Ki(this.schema,e.plugins),r=t.fields,i=new Ln(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].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(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ki(e.schema,e.plugins),o=new Ln(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Dt.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=G.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){o[s.name]=c.fromJSON.call(l,e,t[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Ql(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ql(i,e,{})),t[r]=i}return t}class Re{constructor(e){this.spec=e,this.props={},e.props&&Ql(e.props,this,this.props),this.key=e.key?e.key.key:Zl("plugin")}getState(e){return e[this.key]}}const Ui=Object.create(null);function Zl(n){return n in Ui?n+"$"+ ++Ui[n]:(Ui[n]=0,n+"$")}class Te{constructor(e="key"){this.key=Zl(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ce=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Wn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let xo=null;const Et=function(n,e,t){let r=xo||(xo=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},dp=function(){xo=null},vn=function(n,e,t,r){return t&&(Js(n,e,t,r,-1)||Js(n,e,t,r,1))},fp=/^(img|br|input|textarea|hr)$/i;function Js(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:tt(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Pr(n)||fp.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ce(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?tt(n):0}else return!1}}function tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function pp(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=tt(n)}else if(n.parentNode&&!Pr(n))e=Ce(n),n=n.parentNode;else return null}}function hp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Pr(n))e=Ce(n)+1,n=n.parentNode;else return null}}function mp(n,e,t){for(let r=e==0,i=e==tt(n);r||i;){if(n==t)return!0;let o=Ce(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==tt(n)}}function Pr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);
vendor: 4,879 bytes, line 5
5t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Si=function(n){return n.focusNode&&vn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function sn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function gp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function yp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(tt(r.startContainer),r.startOffset)}}}const yt=typeof navigator<"u"?navigator:null,Gs=typeof document<"u"?document:null,Yt=yt&&yt.userAgent||"",ko=/Edge\/(\d+)/.exec(Yt),ec=/MSIE \d/.exec(Yt),wo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Yt),je=!!(ec||wo||ko),Kt=ec?document.documentMode:wo?+wo[1]:ko?+ko[1]:0,nt=!je&&/gecko\/(\d+)/i.test(Yt);nt&&+(/Firefox\/(\d+)/.exec(Yt)||[0,0])[1];const So=!je&&/Chrome\/(\d+)/.exec(Yt),Ie=!!So,tc=So?+So[1]:0,Le=!je&&!!yt&&/Apple Computer/.test(yt.vendor),qn=Le&&(/Mobile\/\w+/.test(Yt)||!!yt&&yt.maxTouchPoints>2),et=qn||(yt?/Mac/.test(yt.platform):!1),bp=yt?/Win/.test(yt.platform):!1,At=/Android \d/.test(Yt),Rr=!!Gs&&"webkitFontSmoothing"in Gs.documentElement.style,vp=Rr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xp(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ot(n,e){return typeof n=="number"?n:n[e]}function kp(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ys(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Wn(s);continue}let a=s,l=a==o.body,c=l?xp(o):kp(a),u=0,d=0;if(e.top<c.top+Ot(r,"top")?d=-(c.top-e.top+Ot(i,"top")):e.bottom>c.bottom-Ot(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ot(i,"top")-c.top:e.bottom-c.bottom+Ot(i,"bottom")),e.left<c.left+Ot(r,"left")?u=-(c.left-e.left+Ot(i,"left")):e.right>c.right-Ot(r,"right")&&(u=e.right-c.right+Ot(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-p,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Wn(s)}}function wp(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=n.root.elementFromPoint(o,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:nc(n.dom)}}function nc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Wn(r));return e}function Sp({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;rc(t,r==0?0:r-e)}function rc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let In=null;function Cp(n){if(n.setActive)return n.setActive();if(In)return n.focus(In);let e=nc(n);n.focus(In==null?{get preventScroll(){return In={preventScroll:!0},!0}}:void 0),In||(In=!1,rc(e,0))}function ic(n,e){let t,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Et(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),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<r){t=u,r=m,i=m&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(o=d+(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)&&(o=d+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?Mp(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:ic(t,i)}function Mp(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=Bt(r,1);if(o.top!=o.bottom&&Jo(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function Jo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Tp(n,e){let t=n.parentNode;
vendor: 4,984 bytes, line 5
5return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Op(n,e,t){let{node:r,offset:i}=ic(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Ep(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let a=n.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function oc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Jo(e,c))return oc(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function Ap(n,e){let t=n.dom.ownerDocument,r,i=0,o=yp(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!Jo(e,c)||(s=oc(n.dom,e,c),!s))return null}if(Le)for(let c=s;r&&c;c=Wn(c))c.draggable&&(r=void 0);if(s=Tp(s,e),r){if(nt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Rr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Ep(n,r,i,e))}a==null&&(a=Op(n,s,e));let l=n.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Xs(n){return n.top<n.bottom||n.left<n.right}function Bt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Xs(r))return r}return Array.prototype.find.call(t,Xs)||n.getBoundingClientRect()}const Dp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sc(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=Rr||nt;if(r.nodeType==3)if(s&&(Dp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Bt(Et(r,i,i),t);if(nt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Bt(Et(r,i-1,i-1),-1);if(c.top==l.top){let u=Bt(Et(r,i,i+1),-1);if(u.top!=l.top)return rr(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==r.nodeValue.length?(l--,u=1):t<0?l--:c++,rr(Bt(Et(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Ji(l.getBoundingClientRect(),!1)}if(o==null&&i<tt(r)){let l=r.childNodes[i];if(l.nodeType==1)return Ji(l.getBoundingClientRect(),!0)}return Ji(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Et(l,tt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return rr(Bt(c,1),!1)}if(o==null&&i<tt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Et(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return rr(Bt(c,-1),!0)}return rr(Bt(r.nodeType==3?Et(r):r,-t),t>=0)}function rr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ji(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function ac(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Np(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return ac(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=sc(n,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Et(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"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ip=/[\u0590-\u08ac]/;function Pp(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=n.domSelection();return a?!Ip.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?o:s:ac(n,e,()=>
vendor: 5,068 bytes, line 5
5{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:m}=n.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let Qs=null,Zs=null,ea=!1;function Rp(n,e,t){return Qs==e&&Zs==t?ea:(Qs=e,Zs=t,ea=t=="up"||t=="down"?Np(n,e,t):Pp(n,e,t))}const rt=0,ta=1,ln=2,bt=3;class _r{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=rt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=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,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Ce(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 o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof cc){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof lc&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?Ce(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?Ce(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let u=s+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=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Ce(f.dom)+1;break}e-=f.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 d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Ce(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);
vendor: 2,134 bytes, lines 5-6
5if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=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(o>h&&s<g)return m.setSelection(e-h-m.border,t-h-m.border,r,i);h=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((nt||Le)&&e==t){let{node:p,offset:h}=a;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==` 6`),d&&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:Ce(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=p.childNodes[h-1];d=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||d&&Le)&&vn(a.node,a.offset,u.anchorNode,u.anchorOffset)&&vn(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&nt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){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 r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let a=r+o.border,l=s-o.border;if(e>=a&&t<=l){this.dirty=e==r||t==s?ln:ta,e==a&&t==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=bt:o.markDirty(e-a,t-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?ln:bt}r=s}this.dirty=ln}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ln:ta;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}
vendor: 4,843 bytes, line 6
6class lc extends _r{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==rt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class _p extends _r{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,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 xn extends _r{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Sn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new xn(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&bt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=bt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=rt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=rt}}slice(e,t,r){let i=xn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Mo(o,t,s,r)),e>0&&(o=Mo(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ut extends _r{constructor(e,t,r,i,o,s,a,l,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,o,s){let a=o.nodeViews[t.type.name],l,c=a&&a(t,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=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:d}=Sn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=fc(u,r,t),c?l=new $p(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Ci(e,t,r,i,u,f,o):new Ut(e,t,r,i,u,d||null,f,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>O.empty)}return e}matchesNode(e,t,r){return this.dirty==rt&&e.eq(this.node)&&ai(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Bp(this,s&&s.node,e);Fp(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?re.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ln)&&(s&&this.protectLocalComposition(e,s),uc(this.contentDOM,this.children,e),qn&&jp(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof U)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=Hp(this.node.content,s,r-t,i-t);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}
vendor: 20,643 bytes, line 6
6protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new _p(this,o,t,i);e.input.compositionNodes.push(s),this.children=Mo(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==bt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=rt}updateOuterDeco(e){if(ai(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=dc(this.dom,this.nodeDOM,Co(this.outerDeco,this.node,t),Co(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function na(n,e,t,r,i){fc(r,e,n);let o=new Ut(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Ci extends Ut{constructor(e,t,r,i,o,s,a){super(e,t,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==bt||this.dirty!=rt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=rt||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=rt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Ci(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=bt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class cc extends _r{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==rt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $p extends Ut{constructor(e,t,r,i,o,s,a,l,c,u){super(e,t,r,i,o,s,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==bt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,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 uc(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=ra(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof xn){let l=r?r.previousSibling:n.lastChild;uc(s.contentDOM,s.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=ra(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const dr=function(n){n&&(this.nodeName=n)};dr.prototype=Object.create(null);const cn=[new dr];function Co(n,e,t){if(n.length==0)return cn;let r=t?cn[0]:new dr,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new dr(s.nodeName));for(let a in s){let l=s[a];l!=null&&(t&&i.length==1&&i.push(r=new dr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function dc(n,e,t,r){if(t==cn&&r==cn)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=t[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=cn[0]),i=l}Lp(i,a||cn[0],s)}return i}function Lp(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function fc(n,e,t){return dc(n,n,cn,Co(e,t,n.nodeType!=1))}function ai(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function ra(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Bp{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Vp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=rt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;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[o])&&!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=xn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==bt&&s.dom==s.contentDOM&&(s.dirty=ln),s.update(e,t,r,o)?(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 r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ut){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=bt&&ai(t,l.outerDeco));if(!f&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,t,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=ln,d.updateChildren(i,s+1),d.dirty=rt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ai(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Ut.create(this.top,t,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,o){let s=Ut.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){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 o=new lc(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof xn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ci)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Le||Ie)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new cc(this.top,[],r,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 Vp(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof xn)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function zp(n,e){return n.type.side-e.type.side}function Fp(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(zp);for(let g=0;g<d.length;g++)t(d[g],c,!!l)}else t(u,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<n.childCount)p=c,f=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let h=o+f.nodeSize;if(f.isText){let g=h;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<h&&(l=f.cut(g-o),f=f.cut(0,g-o),h=g,p=-1)}else for(;s<i.length&&i[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,m,e.forChild(o,f),p),o=h}}function jp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Hp(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=t){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Mo(n,e,t,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],c=a,u=a+=l.size;c>=t||u<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(l.slice(t-c,l.size,r)))}return o}function Go(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Si(t)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&mp(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new z(s==f?a:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,f=s;for(let p=0;p<t.rangeCount;p++){let h=t.getRangeAt(p);d=Math.min(d,n.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,s]=f==n.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||n.state.selection.head<a.pos&&!o?1:-1;c=Yo(n,u,a,d)}return c}function pc(n){return n.editable?n.hasFocus():mc(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function It(n,e=!1){let t=n.state.selection;if(hc(n,t),!!pc(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ie){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&vn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)qp(n);else{let{anchor:r,head:i}=t,o,s;ia&&!(t instanceof U)&&(t.$from.parent.inlineContent||(o=oa(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=oa(n,t.to))),n.docView.setSelection(r,i,n,e),ia&&(o&&sa(o),s&&sa(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Wp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ia=Le||Ie&&tc<63;function oa(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Le&&i&&i.contentEditable=="false")return Gi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Gi(i);if(o)return Gi(o)}}function Gi(n){return n.contentEditable="true",Le&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function sa(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Wp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!pc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function qp(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ce(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&je&&Kt<=11&&(t.disabled=!0,t.disabled=!1)}function hc(n,e){if(e instanceof z){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(aa(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else aa(n)}function aa(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Yo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||U.between(e,t,r)}function la(n){return n.editable&&!n.hasFocus()?!1:mc(n)}function mc(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Kp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return vn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function To(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&G.findFrom(o,e)}function Vt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ca(n,e,t){let r=n.state.selection;if(r instanceof U)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Vt(n,new U(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=To(n.state,e);return i&&i instanceof z?Vt(n,i):!1}else if(!(et&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?z.isSelectable(o)?Vt(n,new z(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Rr?Vt(n,new U(n.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return Vt(n,new U(e>0?r.$to:r.$from));{let i=To(n.state,e);return i?Vt(n,i):!1}}}function li(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Pn(n,e){return e<0?Up(n):Jp(n)}function Up(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(nt&&t.nodeType==1&&r<li(t)&&fr(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(fr(a,-1))i=t,o=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(gc(t))break;{let a=t.previousSibling;for(;a&&fr(a,-1);)i=t.parentNode,o=Ce(a),a=a.previousSibling;if(a)t=a,r=li(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Oo(n,t,r):i&&Oo(n,i,o)}function Jp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=li(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(fr(a,1))o=t,s=++r;else break}else{if(gc(t))break;{let a=t.nextSibling;for(;a&&fr(a,1);)o=a.parentNode,s=Ce(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=li(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Oo(n,o,s)}function gc(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Gp(n,e){for(;n&&e==n.childNodes.length&&!Pr(n);)e=Ce(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Yp(n,e){for(;n&&!e&&!Pr(n);)e=Ce(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Oo(n,e,t){if(e.nodeType!=3){let o,s;(s=Gp(e,t))?(e=s,t=0):(o=Yp(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Si(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&It(n)},50)}function ua(n,e){let t=n.state.doc.resolve(e);if(!(Ie||bp)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function da(n,e,t){let r=n.state.selection;if(r instanceof U&&!r.empty||t.indexOf("s")>-1||et&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=To(n.state,e);if(s&&s instanceof z)return Vt(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof Ye?G.near(s,e):G.findFrom(s,e);return a?Vt(n,a):!1}return!1}function fa(n,e){if(!(n.state.selection instanceof U))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function pa(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Xp(n){if(!Le||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;pa(n,r,"true"),setTimeout(()=>pa(n,r,"false"),20)}return!1}function Qp(n){let e="";
vendor: 5,485 bytes, lines 6-9
6return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Zp(n,e){let t=e.keyCode,r=Qp(e);if(t==8||et&&t==72&&r=="c")return fa(n,-1)||Pn(n,-1);if(t==46&&!e.shiftKey||et&&t==68&&r=="c")return fa(n,1)||Pn(n,1);if(t==13||t==27)return!0;if(t==37||et&&t==66&&r=="c"){let i=t==37?ua(n,n.state.selection.from)=="ltr"?-1:1:-1;return ca(n,i,r)||Pn(n,i)}else if(t==39||et&&t==70&&r=="c"){let i=t==39?ua(n,n.state.selection.from)=="ltr"?1:-1:1;return ca(n,i,r)||Pn(n,i)}else{if(t==38||et&&t==80&&r=="c")return da(n,-1,r)||Pn(n,-1);if(t==40||et&&t==78&&r=="c")return Xp(n)||da(n,1,r)||Pn(n,1);if(r==(et?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Xo(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Sn.fromSchema(n.state.schema),a=wc(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=kc[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),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,` 7 8`);return{dom:l,text:f,slice:e}}function yc(n,e,t,r,i){let o=i.parent.type.spec.code,s,a;if(!t&&!e)return null;let l=!!e&&(r||o||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,o||r,n)}),o)return a=new R(O.from(n.state.schema.text(e.replace(/\r\n?/g,` 9`))),0,0),n.someProp("transformPasted",f=>{a=f(a,n,!0)}),a;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)a=d;else{let f=i.marks(),{schema:p}=n.state,h=Sn.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=rh(t),Rr&&ih(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||qt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!eh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=oh(ha(a,+u[1],+u[2]),u[4]);else if(a=R.maxOpen(th(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=ha(a,d,f)}return n.someProp("transformPasted",d=>{a=d(a,n,l)}),a}const eh=/^(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 th(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&vc(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=xc(s[s.length-1],o.length));let u=bc(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return O.from(s)}return n}function bc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,O.from(n));return n}function vc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=vc(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(O.from(bc(t,n,i+1))))}}function xc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,xc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(O.empty,!0);return n.copy(t.append(r))}function Eo(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(o=0),i<r-1&&(a=Eo(a,e,t,r,i+1,o)),i>=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(O.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function ha(n,e,t){return e<n.openStart&&(n=new R(Eo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new R(Eo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const kc={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 ma=null;function wc(){return ma||(ma=document.implementation.createHTMLDocument("title"))}let Yi=null;function nh(n){let e=window.trustedTypes;return e?(Yi||(Yi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Yi.createHTML(n)):n}function rh(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=wc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&kc[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=nh(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function ih(n){let e=n.querySelectorAll(Ie?"span:not([class]):not
9([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="Â "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function oh(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=O.from(l.create(r[a+1],i)),o++,s++}return new R(i,o,s)}const Be={},Ve={},sh={touchstart:!0,touchmove:!0};class ah{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function lh(n){for(let e in Be){let t=Be[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{uh(n,r)&&!Qo(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},sh[e]?{passive:!0}:void 0)}Le&&n.dom.addEventListener("input",()=>null),Ao(n)}function Wt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ch(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ao(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Qo(n,r))})}function Qo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function uh(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function dh(n,e){!Qo(n,e)&&Be[e.type]&&(n.editable||!(e.type in Ve))&&Be[e.type](n,e)}Ve.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Cc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(At&&Ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),qn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,sn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Zp(n,t)?t.preventDefault():Wt(n,"key")};Ve.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ve.keypress=(n,e)=>{let t=e;if(Cc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||et&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof U)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i,o))&&n.dispatch(o()),t.preventDefault()}};function Mi(n){return{left:n.clientX,top:n.clientY}}function fh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Zo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,a=>s>o.depth?a(n,t,o.nodeAfter,o.before(s),i,!0):a(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function zn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function ph(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(zn(n,new z(t)),!0):!1}function hh(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof z&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(z.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(zn(n,z.create(n.state.doc,i)),!0):!1}function mh(n,e,t,r,i){return Zo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>
vendor: 1,278 bytes, line 9
9o(n,e,r))||(i?hh(n,t):ph(n,t))}function gh(n,e,t,r){return Zo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function yh(n,e,t,r){return Zo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||bh(n,t,r)}function bh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(zn(n,U.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)zn(n,U.create(r,a+1,a+1+s.content.size));else if(z.isSelectable(s))zn(n,z.create(r,a));else continue;return!0}}function es(n){return ci(n)}const Sc=et?"metaKey":"ctrlKey";Be.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=es(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&fh(t,n.input.lastClick)&&!t[Sc]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o,button:t.button};let s=n.posAtCoords(Mi(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new vh(n,s,t,!!r)):(o=="doubleClick"?gh:yh)(n,s.pos,s.inside,t)?t.preventDefault():Wt(n,"pointer"))};
vendor: 23,909 bytes, line 9
9class vh{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Sc],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof z&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,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)),Wt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>It(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(Mi(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wt(this.view,"pointer"):mh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Le&&this.mightDrag&&!this.mightDrag.node.isAtom||Ie&&!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)?(zn(this.view,G.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Wt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Be.touchstart=n=>{n.input.lastTouch=Date.now(),es(n),Wt(n,"pointer")};Be.touchmove=n=>{n.input.lastTouch=Date.now(),Wt(n,"pointer")};Be.contextmenu=n=>es(n);function Cc(n,e){return n.composing?!0:Le&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const xh=At?5e3:-1;Ve.compositionstart=Ve.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof U&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ci(n,!0),n.markCursor=null;else if(ci(n,!e.selection.empty),nt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Mc(n,xh)};Ve.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Mc(n,20))};function Mc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ci(n),e))}function Tc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=wh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function kh(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=pp(e.focusNode,e.focusOffset),r=hp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function wh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ci(n,e=!1){if(!(At&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Tc(n),e||n.docView&&n.docView.dirty){let t=Go(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Sh(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const wr=je&&Kt<15||qn&&vp<604;Be.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=wr?null:t.clipboardData,s=r.content(),{dom:a,text:l}=Xo(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Sh(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ch(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Mh(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Sr(n,r.value,null,i,e):Sr(n,r.textContent,r.innerHTML,i,e)},50)}function Sr(n,e,t,r,i){let o=yc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,o||R.empty)))return!0;if(!o)return!1;let s=Ch(o),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Oc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ve.paste=(n,e)=>{let t=e;if(n.composing&&!At)return;let r=wr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Sr(n,Oc(r),r.getData("text/html"),i,t)?t.preventDefault():Mh(n,t)};class Ec{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Th=et?"altKey":"ctrlKey";function Ac(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Th]}Be.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Mi(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)s=z.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=z.create(n.state.doc,d.posBefore))}}let a=(s||n.state.selection).content(),{dom:l,text:c,slice:u}=Xo(n,a);(!t.dataTransfer.files.length||!Ie||tc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",wr||t.dataTransfer.setData("text/plain",c),n.dragging=new Ec(u,Ac(n,t),s)};Be.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ve.dragover=Ve.dragenter=(n,e)=>e.preventDefault();Ve.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Mi(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",h=>{s=h(s,n,!1)}):s=yc(n,Oc(t.dataTransfer),wr?null:t.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&Ac(n,t));if(n.someProp("handleDrop",h=>h(n,t,s||R.empty,a))){t.preventDefault();return}if(!s)return;t.preventDefault();let l=s?Zf(n.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let c=n.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new z(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,A)=>h=A),c.setSelection(Yo(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Be.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&It(n)},20))};Be.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Be.beforeinput=(n,e)=>{if(Ie&&At&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,sn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Ve)Be[n]=Ve[n];function Cr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class ui{constructor(e,t){this.toDOM=e,this.spec=t||pn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new $e(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ui&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Cr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Jt{constructor(e,t){this.attrs=e,this.spec=t||pn}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new $e(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Jt&&Cr(this.attrs,e.attrs)&&Cr(this.spec,e.spec)}static is(e){return e.type instanceof Jt}destroy(){}}class ts{constructor(e,t){this.attrs=e,this.spec=t||pn}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new $e(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof ts&&Cr(this.attrs,e.attrs)&&Cr(this.spec,e.spec)}destroy(){}}class $e{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new $e(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new $e(e,e,new ui(t,r))}static inline(e,t,r,i){return new $e(e,t,new Jt(r,i))}static node(e,t,r,i){return new $e(e,t,new ts(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof ui}}const _n=[],pn={};class de{constructor(e,t){this.local=e.length?e:_n,this.children=t.length?t:_n}static create(e,t){return t.length?di(t,e,0,pn):Ee}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,i+a,o)}}map(e,t,r){return this==Ee||e.maps.length==0?this:this.mapInner(e,t,0,0,r||pn)}mapInner(e,t,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?Oh(this.children,s||[],e,t,r,i,o):s?new de(s.sort(hn),_n):Ee}add(e,t){return t.length?this==Ee?de.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Nc(t,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,di(u,a,c+1,pn)),o+=3}});let s=Dc(o?Ic(t):t,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new de(s.length?this.local.concat(s).sort(hn):this.local,i||this.children)}remove(e){return e.length==0||this==Ee?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+t,l=r[o+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=Ee?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new de(i,r):Ee}forChild(e,t){if(this==Ee)return this;if(t.isLeaf)return de.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Jt){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new de(i.sort(hn),_n);return r?new Ft([a,r]):a}return r||Ee}eq(e){if(this==e)return!0;if(!(e instanceof de)||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 ns(this.localsInner(e))}localsInner(e){if(this==Ee)return _n;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}de.empty=new de([],[]);de.removeOverlap=ns;const Ee=de.empty;class Ft{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,pn));return Ft.from(r)}forChild(e,t){if(t.isLeaf)return de.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Ee&&(o instanceof Ft?r=r.concat(o.members):r.push(o))}return Ft.from(r)}eq(e){if(!(e instanceof Ft)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?ns(r?t:t.sort(hn)):_n}static from(e){switch(e.length){case 0:return Ee;case 1:return e[0];default:return new Ft(e.every(t=>t instanceof de)?e:e.reduce((t,r)=>t.concat(r instanceof de?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Oh(n,e,t,r,i,o,s){let a=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,p,h,m)=>{let g=m-h-(p-f);for(let b=0;b<a.length;b+=3){let A=a[b+1];if(A<0||f>A+u-d)continue;let S=a[b]+u-d;p>=S?a[b+1]=f<=S?-2:-1:f>=u&&g&&(a[b]+=g,a[b+1]+=g)}d+=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(n[c]+o),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let f=t.map(n[c+1]+o,-1),p=f-i,{index:h,offset:m}=r.content.findIndex(d),g=r.maybeChild(h);if(g&&m==d&&m+g.nodeSize==p){let b=a[c+2].mapInner(t,g,u+1,n[c]+o+1,s);b!=Ee?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Eh(a,n,e,t,i,o,s),u=di(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new de(e.sort(hn),a)}function Dc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new $e(i.from+e,i.to+e,i.type))}return t}function Eh(n,e,t,r,i,o,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?t.push(d):s.onRemove&&s.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<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+o+1);return t}function Nc(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Ic(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function di(n,e,t,r){let i=[],o=!1;e.forEach((a,l)=>{let c=Nc(n,a,l+t);if(c){o=!0;let u=di(c,a,t+l+1,r);u!=Ee&&i.push(l,l+a.nodeSize,u)}});let s=Dc(o?Ic(n):n,-t).sort(hn);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new de(s,i):Ee}function hn(n,e){return n.from-e.from||n.to-e.to}function ns(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),ga(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),ga(e,i,r.copy(o.from,r.to)));break}}}return e}function ga(n,e,t){for(;e<n.length&&hn(t,n[e])>0;)e++;n.splice(e,0,t)}function Xi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ee&&e.push(r)}),n.cursorWrapper&&e.push(de.create(n.state.doc,[n.cursorWrapper.deco])),Ft.from(e)}const Ah={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dh=je&&Kt<=11;class Nh{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 Ih{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Nh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);je&&Kt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Dh&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ah)),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(la(this.view)){if(this.suppressingSelectionUpdates)return It(this.view);if(je&&Kt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=Wn(o))t.add(o);for(let o=e.anchorNode;o;o=Wn(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&la(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(nt&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||_h(e,d)!=p)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Si(r)&&(c=Go(e))&&c.eq(G.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,It(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Ph(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||It(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(je&&Kt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?Ce(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Ce(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAt
vendor: 48,110 bytes, lines 9-12
9End+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ya=new WeakMap,ba=!1;function Ph(n){if(!ya.has(n)&&(ya.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=nt,ba)return;ba=!0}}function va(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return vn(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Rh(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return va(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?va(n,t):null}function _h(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function $h(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,u=l.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Si(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ie&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],A=b.pmViewDesc;if(b.nodeName=="BR"&&!A){o=g;break}if(!A||A.size)break}let d=n.state.doc,f=n.someProp("domParser")||qt.fromSchema(n.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Lh,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+s,head:b+s}}return{doc:m,sel:h,from:s,to:a}}function Lh(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Le&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Le&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Bh=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Vh(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,$=Go(n,E);if($&&!n.state.selection.eq($)){if(Ie&&At&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",W=>W(n,sn(13,"Enter"))))return;let F=n.state.tr.setSelection($);E=="pointer"?F.setMeta("pointer",!0):E=="key"&&F.scrollIntoView(),o&&F.setMeta("composition",o),n.dispatch(F)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=$h(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,p="end"):(f=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let h=jh(d.content,c.doc.content,c.from,f,p);if(h&&n.input.domChangeCount++,(qn&&n.input.lastIOSEnter>Date.now()-225||At)&&i.some(E=>E.nodeType==1&&!Bh.test(E.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",E=>E(n,sn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof U&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let E=xa(n,n.state.doc,c.sel);if(E&&!E.eq(n.state.selection)){let $=n.state.tr.setSelection(E);o&&$.setMeta("composition",o),n.dispatch($)}}return}n.state.selection.from<n.state.selection.to&&h.start==h.endB&&n.state.selection instanceof U&&(h.start>n.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA<n.state.selection.to&&h.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),je&&Kt<=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),A=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA,S;if((qn&&n.input.lastIOSEnter>Date.now()-225&&(!A||i.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!A&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"",""))&&(S=G.findFrom(c.doc.resolve(m.pos+1),1,!0))&&S.head>m.pos)&&n.someProp("handleKeyDown",E=>E(n,sn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&Fh(u,h.start,h.endA,m,g)&&n.someProp("handleKeyDown",E=>E(n,sn(8,"Backspace")))){At&&Ie&&n.domObserver.suppressSelectionUpdates();return}Ie&&h.endB==h.start&&(n.input.lastChromeDelete=Date.now()),At&&!A&&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(()=>{n.someProp("handleKeyDown",function(E){return E(n,sn(13,"Enter"))})},20));let y=h.start,D=h.endA,C=E=>{let $=E||n.state.tr.replace(y,D,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let F=xa(n,$.doc,c.sel);F&&!(Ie&&n.composing&&F.empty&&(h.start!=h.endB||n.input.lastChromeDelete<Date.now()-100)&&(F.head==y||F.head==$.mapping.map(D)-1)||je&&F.empty&&F.head==y)&&$.setSelection(F)}return o&&$.setMeta("composition",o),$.scrollIntoView()},N;if(A){if(m.pos==g.pos){je&&Kt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>It(n),20));let E=C(n.state.tr.delete(y,D)),$=u.resolve(h.start).marksAcross(u.resolve(h.endA));$&&E.ensureMarks($),n.dispatch(E)}else if(h.endA==h.endB&&(N=zh(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let E=C(n.state.tr);N.type=="add"?E.addMark(y,D,N.mark):E.removeMark(y,D,N.mark),n.dispatch(E)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,g.parentOffset),$=()=>C(n.state.tr.insertText(E,y,D));n.someProp("handleTextInput",F=>F(n,y,D,E,$))||n.dispatch($())}}else n.dispatch(C())}function xa(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Yo(n,e.resolve(t.anchor),e.resolve(t.head))}function zh(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="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(O.from(c).eq(n))return{mark:a,type:s}}function Fh(n,e,t,r,i){if(t-e<=i.pos-r.pos||Qi(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&t==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Qi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Qi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Qi(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function jh(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&n.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&ka(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<n.size&&ka(n.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function ka(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Pc{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 ah,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Ta),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=Ca(this),Sa(this),this.nodeViews=Ma(this),this.docView=na(this.state.doc,wa(this),Xi(this),this.dom,this),this.domObserver=new Ih(this,(r,i,o,s)=>Vh(this,r,i,o,s)),this.domObserver.start(),lh(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&&Ao(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ta),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Tc(this),s=!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=Ma(this);Wh(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ao(this),this.editable=Ca(this),Sa(this);let l=Xi(this),c=wa(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&wp(this);if(s){this.domObserver.stop();let p=d&&(je||Ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Hh(i.selection,e.selection);if(d){let h=Ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=kh(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=na(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Kp(this))?It(this,p):(hc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Sp(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof z){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ys(this,t.getBoundingClientRect(),e)}else Ys(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Ec(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=t?t(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(je){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&&Cp(this.dom),It(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 Ap(this,e)}coordsAtPos(e,t=1){return sc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Rp(this,t||this.state,e)}pasteHTML(e,t){return Sr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Sr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Xo(this,e)}destroy(){this.docView&&(ch(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dh(this,e)}domSelectionRange(){let e=this.domSelection();return e?Le&&this.root.nodeType===11&&gp(this.dom.ownerDocument)==this.dom&&Rh(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Pc.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function wa(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[$e.node(0,n.state.doc.content.size,e)]}function Sa(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:$e.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ca(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Hh(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ma(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Wh(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Ta(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Gt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qh=typeof navigator<"u"&&/Mac/.test(navigator.platform),Kh=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Me=0;Me<10;Me++)Gt[48+Me]=Gt[96+Me]=String(Me);for(var Me=1;Me<=24;Me++)Gt[Me+111]="F"+Me;for(var Me=65;Me<=90;Me++)Gt[Me]=String.fromCharCode(Me+32),fi[Me]=String.fromCharCode(Me);for(var Zi in Gt)fi.hasOwnProperty(Zi)||(fi[Zi]=Gt[Zi]);function Uh(n){var e=qh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Kh&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?fi:Gt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Jh=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Gh=typeof navigator<"u"&&/Win/.test(navigator.platform);function Yh(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Jh?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Xh(n){let e=Object.create(null);for(let t in n)e[Yh(t)]=n[t];return e}function eo(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Qh(n){return new Re({props:{handleKeyDown:Zh(n)}})}function Zh(n){let e=Xh(n);return function(t,r){let i=Uh(r),o,s=e[eo(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[eo(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Gh&&r.ctrlKey&&r.altKey)&&(o=Gt[r.keyCode])&&o!=i){let a=e[eo(o,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const rs=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Rc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const _c=(n,e,t)=>{let r=Rc(n,t);if(!r)return!1;let i=is(r);if(!i){let s=r.blockRange(),a=s&&Qn(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(Wc(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Kn(o,"end")||z.isSelectable(o)))for(let s=r.depth;;s--){let a=ki(n.doc,r.before(s),r.after(s),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Kn(o,"end")?G.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):z.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},em=(n,e,t)=>{let r=Rc(n,t);if(!r)return!1;let i=is(r);return i?$c(n,i,e):!1},tm=(n,e,t)=>{let r=Bc(n,t);if(!r)return!1;let i=ss(r);return i?$c(n,i,e):!1};function $c(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,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=ki(n.doc,o,l,R.empty);if(!c||c.from!=o||c instanceof ge&&c.slice.size>=l-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(U.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Kn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Lc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=is(r)}let s=o&&o.nodeBefore;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function is(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Bc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Vc=(n,e,t)=>{let r=Bc(n,t);if(!r)return!1;let i=ss(r);if(!i)return!1;let o=i.nodeAfter;if(Wc(n,i,e,1))return!0;if(r.parent.content.size==0&&(Kn(o,"start")||z.isSelectable(o))){let s=ki(n.doc,r.before(),r.after(),R.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=n.tr.step(s);a.setSelection(Kn(o,"start")?G.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):z.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},zc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=ss(r)}let s=o&&o.nodeAfter;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos)).scrollIntoView()),!0)};function ss(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const nm=(n,e)=>{let t=n.selection,r=t instanceof z,i;if(r){if(t.node.isTextblock||!Cn(n.doc,t.from))return!1;i=t.from}else if(i=xi(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(z.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},rm=(n,e)=>{let t=n.selection,r;if(t instanceof z){if(t.node.isTextblock||!Cn(n.doc,t.to))return!1;r=t.to}else if(r=xi(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},im=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Qn(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Fc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` 10`).scrollIntoView()),!0)};function as(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const om=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=as(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(G.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},jc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ye||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=as(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(U.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Hc=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Nt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Qn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function sm(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!Nt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=as(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),o.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof U||e.selection instanceof Ye)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Nt(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=Nt(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),h=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return t&&t(u.scrollIntoView()),!0}}const am=sm(),lm=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(z.create(n.doc,i))),!0)};function cm(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Cn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Wc(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&cm(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,h=O.empty;for(let b=s.length-1;b>=0;b--)h=O.from(s[b].create(null,h));h=O.from(i.copy(h));let m=n.tr.step(new ye(e.pos-1,p,e.pos,p,new R(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Cn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:G.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Qn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Kn(o,"start",!0)&&Kn(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let b=O.empty;for(let S=h.length-1;S>=0;S--)b=O.from(h[S].copy(b));let A=n.tr.step(new ye(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new R(b,h.length,0),0,!0));t(A.scrollIntoView())}return!0}}return!1}function qc(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(U.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const um=qc(-1),dm=qc(1);function fm(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),a=s&&Wl(s,n,e);return a?(r&&r(t.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Oa(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=t.selection.ranges[o];t.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[s];o.setBlockType(a,l,n,e)}r(o.scrollIntoView())}return!0}}function ls(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}ls(rs,_c,Lc);ls(rs,Vc,zc);ls(Fc,jc,Hc,am);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function pm(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let a=r?t.tr:null;return hm(a,s,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function hm(n,e,t,r=null){let i=!1,o=e,s=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=s.resolve(e.start-2);o=new oi(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new oi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Wl(o,t,r,e);return a?(n&&mm(n,e,a,i,t),!0):!1}function mm(n,e,t,r,i){let o=O.empty;for(let u=t.length-1;u>=0;u--)o=O.from(t[u].type.create(t[u].attrs,o));n.step(new ye(e.start-(r?2:0),e.end,e.start,e.end,new R(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let a=t.length-s,l=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Nt(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return n}function gm(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?ym(e,t,n,o):bm(e,t,o):!0:!1}}function ym(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ye(o-1,s,o,s,new R(O.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new oi(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=Qn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Cn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function bm(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?O.empty:O.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new ye(d-(a?1:0),f+(l?1:0),d+1,f-1,new R((a?O.empty:O.from(i.copy(O.empty))).append(l?O.empty:O.from(i.copy(O.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function vm(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=O.from(c?n.create():null),d=new R(O.from(n.create(null,O.from(a.type.create(null,u)))),c?3:1,0),f=o.start,p=o.end;t(e.tr.step(new ye(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function Ti(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class Oi{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:r}=this,{view:i}=t,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,t),b=p(...m)(g);return a.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:Ti({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class xm{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function L(n,e,t){return n.config[e]===void 0&&n.parent?L(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?L(n.parent,e,t):null}):n.config[e]}function Ei(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Kc(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ei(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=L(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...o,...p}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=L(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...o,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function ve(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Ge(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function Do(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ge(t,r),{})}function Uc(n){return typeof n=="function"}function K(n,e=void 0,...t){return Uc(n)?e?n.bind(e)(...t):n(...t):n}function km(n={}){return Object.keys(n).length===0&&n.constructor===Object}function wm(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Ea(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(t):wm(t.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Aa(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&km(t)?!1:t!=null))}function Sm(n,e){var t;const r=Kc(n),{nodeExtensions:i,markExtensions:o}=Ei(n),s=(t=i.find(c=>L(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((b,A)=>{const S=L(A,"extendNodeSchema",d);return{...b,...S?S(c):{}}},{}),p=Aa({...f,content:K(L(c,"content",d)),marks:K(L(c,"marks",d)),group:K(L(c,"group",d)),inline:K(L(c,"inline",d)),atom:K(L(c,"atom",d)),selectable:K(L(c,"selectable",d)),draggable:K(L(c,"draggable",d)),code:K(L(c,"code",d)),whitespace:K(L(c,"whitespace",d)),linebreakReplacement:K(L(c,"linebreakReplacement",d)),defining:K(L(c,"defining",d)),isolating:K(L(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var A;return[b.name,{default:(A=b?.attribute)===null||A===void 0?void 0:A.default}]}))}),h=K(L(c,"parseHTML",d));h&&(p.parseDOM=h.map(b=>Ea(b,u)));const m=L(c,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:Do(b,u)}));const g=L(c,"renderText",d);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(o.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,b)=>{const A=L(b,"extendMarkSchema",d);return{...g,...A?A(c):{}}},{}),p=Aa({...f,inclusive:K(L(c,"inclusive",d)),excludes:K(L(c,"excludes",d)),group:K(L(c,"group",d)),spanning:K(L(c,"spanning",d)),code:K(L(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),h=K(L(c,"parseHTML",d));h&&(p.parseDOM=h.map(g=>Ea(g,u)));const m=L(c,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:Do(g,u)})),[c.name,p]}));return new $l({topNode:s,nodes:a,marks:l})}function to(n,e){return e.nodes[n]||e.marks[n]||null}function Da(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function cs(n,e){const t=Sn.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Cm=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function us(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Ai{constructor(e){this.find=e.find,this.handler=e.handler}}const Mm=(n,e)=>{if(us(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith),r.push(t.replaceWith)),r};function jr(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Cm(c)+o;return s.forEach(f=>{if(u)return;const p=Mm(d,f.find);if(!p)return;const h=l.state.tr,m=Ti({state:l.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:A,can:S}=new Oi({editor:t,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:A,can:S})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:o}),l.dispatch(h),u=!0)}),u}function Tm(n){const{editor:e,rules:t}=n,r=new Re({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=cs(O.from(u),s.schema);const{from:d}=l,f=d+u.length;jr({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return jr({editor:e,from:o,to:s,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&jr({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?jr({editor:e,from:s.pos,to:s.pos,text:` 11`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Om(n){return Object.prototype.toString.call(n).slice(8,-1)}function Hr(n){return Om(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Di(n,e){const t={...n};return Hr(n)&&Hr(e)&&Object.keys(e).forEach(r=>{Hr(e[r])&&Hr(n[r])?t[r]=Di(n[r],e[r]):t[r]=e[r]}),t}class kn{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,this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new kn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Di(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new kn(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,t.options=K(L(t,"addOptions",{name:t.name})),t.storage=K(L(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>c?.type.name===t.name))return!1;const l=s.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function Em(n){return typeof n=="number"}class Jc{constructor(e){this.find=e.find,this.handler=e.handler}}const Am=(n,e,t)=>{if(us(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith),o.push(i.replaceWith)),o}):[]};function Dm(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Oi({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const m=Math.max(r,h),g=Math.min(i,h+p.content.size),b=p.textBetween(m-h,g-h,void 0,"");Am(b,o.find,s).forEach(S=>{if(S.index===void 0)return;const y=m+S.index+1,D=y+S[0].length,C={from:t.tr.mapping.map(y),to:t.tr.mapping.map(D)},N=o.handler({state:t,range:C,match:S,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(N)})}),d.every(p=>p!==null)}let Wr=null;const Nm=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Im(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:p,pasteEvt:h})=>{const m=u.tr,g=Ti({state:u,transaction:m});if(!(!Dm({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new Re({view(d){const f=h=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(h.target)?d.dom.parentElement:null,r&&(Wr=e)},p=()=>{Wr&&(Wr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,a=f,!o){const p=Wr;p?.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;const h=(p=f.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=f,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!o,b=h.getMeta("applyPasteRules"),A=!!b;if(!m&&!g&&!A)return;if(A){let{text:D}=b;typeof D=="string"?D=D:D=cs(O.from(D),p.schema);const{from:C}=b,N=C+D.length,E=Nm(D);return l({rule:u,state:p,from:C,to:{b:N},pasteEvt:E})}const S=f.doc.content.findDiffStart(p.doc.content),y=f.doc.content.findDiffEnd(p.doc.content);if(!(!Em(S)||!y||S===y.b))return l({rule:u,state:p,from:S,to:y,pasteEvt:s})}}))}function Pm(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Bn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Bn.resolve(e),this.schema=Sm(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Bn.sort(Bn.flatten(e));return Pm(t.map(i=>i.name)).length,t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=L(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=L(r,"priority")||100,s=L(i,"priority")||100;return o>s?-1:o<s?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:to(t.name,this.schema)},i=L(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Bn.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:to(s.name,this.schema)},l=[],c=L(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&L(s,"exitable",a)&&(u.ArrowRight=()=>kn.handleExit({editor:e,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const d=Qh(u);l.push(d);const f=L(s,"addInputRules",a);Da(s,e.options.enableInputRules)&&f&&r.push(...f());const p=L(s,"addPasteRules",a);Da(s,e.options.enablePasteRules)&&p&&i.push(...p());const h=L(s,"addProseMirrorPlugins",a);if(h){const m=h();l.push(...m)}return l}).flat();return[Tm({editor:e,rules:r}),...Im({editor:e,rules:i}),...o]}get attributes(){return Kc(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ei(this.extensions);return Object.fromEntries(t.filter(r=>!!L(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:ve(r.name,this.schema)},s=L(r,"addNodeView",o);if(!s)return[];const a=(l,c,u,d,f)=>{const p=Do(l,i);return s()({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:p})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:to(e.name,this.schema)};e.type==="mark"&&(!((t=K(L(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=L(e,"onBeforeCreate",r),o=L(e,"onCreate",r),s=L(e,"onUpdate",r),a=L(e,"onSelectionUpdate",r),l=L(e,"onTransaction",r),c=L(e,"onFocus",r),u=L(e,"onBlur",r),d=L(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class qe{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,this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Di(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new qe({...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,t.options=K(L(t,"addOptions",{name:t.name})),t.storage=K(L(t,"addStorage",{name:t.name,options:t.options})),t}}function Gc(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=` 12
13`,textSerializers:s={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=o);const p=s?.[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function Yc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Rm=qe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Re({key:new Te("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=Yc(t);return Gc(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),_m=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),$m=(n=!1)=>({commands:e})=>e.setContent("",n),Lm=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Qn(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},Bm=n=>e=>n(e),Vm=()=>({state:n,dispatch:e})=>jc(n,e),zm=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new U(r.doc.resolve(Math.max(s-1,0)))),!0},Fm=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);n.delete(a,l).scrollIntoView()}return!0}return!1},jm=n=>({tr:e,state:t,dispatch:r})=>{const i=ve(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},Hm=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Wm=()=>({state:n,dispatch:e})=>rs(n,e),qm=()=>({commands:n})=>n.keyboardShortcut("Enter"),Km=()=>({state:n,dispatch:e})=>om(n,e);function pi(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:us(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Xc(n,e,t={}){return n.find(r=>r.type===e&&pi(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Na(n,e,t={}){return!!Xc(n,e,t)}function ds(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!Xc([...i.node.marks],e,t)))return;let s=i.index,a=n.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&Na([...n.parent.child(s-1).marks],e,t);)s-=1,a-=n.parent.child(s).nodeSize;for(;l<n.parent.childCount&&Na([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Xt(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const Um=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Xt(n,r.schema),{doc:s,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=ds(l,o,e);if(d&&d.from<=c&&d.to>=u){const f=U.create(s,d.from,d.to);t.setSelection(f)}}return!0},Jm=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Qc(n){return n instanceof U}function un(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Zc(n,e=null){if(!e)return null;const t=G.atStart(n),r=G.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?U.create(n,un(0,i,o),un(n.content.size,i,o)):U.create(n,un(e,i,o),un(e,i,o))}function No(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Mr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Gm(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Ym=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Mr()||No())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),Gm()&&!Mr()&&!No()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&n===null||n===!1)return!0;
vendor: 33,860 bytes, lines 13-89
13if(o&&n===null&&!Qc(t.state.selection))return s(),!0;const a=Zc(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Xm=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Qm=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),eu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&eu(r)}return n};function qr(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return eu(t)}function Tr(n,e,t){if(n instanceof Dt||n instanceof O)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return O.fromArray(n.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return Tr("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,a="";const l=new $l({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=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?qt.fromSchema(l).parseSlice(qr(n),t.parseOptions):qt.fromSchema(l).parse(qr(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=qt.fromSchema(e);return t.slice?o.parseSlice(qr(n),t.parseOptions).content:o.parse(qr(n),t.parseOptions)}return Tr("",e,t)}function Zm(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof ge||i instanceof ye))return;const o=n.mapping.maps[r];let s=0;o.forEach((a,l,c,u)=>{s===0&&(s=u)}),n.setSelection(G.near(n.doc.resolve(s),t))}const eg=n=>!("type"in n),tg=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{o.emit("contentError",{editor:o,error:g,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Tr(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Tr(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,p=!0;if((eg(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,p=p?g.isBlock:!1}),u===d&&p){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof O){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else m=a,r.replaceWith(u,d,m);t.updateSelection&&Zm(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},ng=()=>({state:n,dispatch:e})=>nm(n,e),rg=()=>({state:n,dispatch:e})=>rm(n,e),ig=()=>({state:n,dispatch:e})=>_c(n,e),og=()=>({state:n,dispatch:e})=>Vc(n,e),sg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xi(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ag=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xi(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},lg=()=>({state:n,dispatch:e})=>em(n,e),cg=()=>({state:n,dispatch:e})=>tm(n,e);function tu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ug(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Mr()||tu()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const dg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=ug(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Or(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?ve(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(i,f+d.nodeSize);a.push({node:d,from:p,to:h})});const l=i-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>pi(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const fg=(n,e={})=>({state:t,dispatch:r})=>{const i=ve(n,t.schema);return Or(t,i,e)?im(t,r):!1},pg=()=>({state:n,dispatch:e})=>Hc(n,e),hg=n=>({state:e,dispatch:t})=>{const r=ve(n,e.schema);return gm(r)(e,t)},mg=()=>({state:n,dispatch:e})=>Fc(n,e);function Ni(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ia(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const gg=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Ni(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(o=ve(n,r.schema)),a==="mark"&&(s=Xt(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{o&&o===c.type&&t.setNodeMarkup(u,void 0,Ia(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(Ia(d.attrs,e)))})})}),!0):!1},yg=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),bg=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ye(n.doc);n.setSelection(t)}return!0},vg=()=>({state:n,dispatch:e})=>Lc(n,e),xg=()=>({state:n,dispatch:e})=>zc(n,e),kg=()=>({state:n,dispatch:e})=>lm(n,e),wg=()=>({state:n,dispatch:e})=>dm(n,e),Sg=()=>({state:n,dispatch:e})=>um(n,e);function Io(n,e,t={},r={}){return Tr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Cg=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,c;const{doc:u}=o;if(t.preserveWhitespace!=="full"){const d=Io(n,i.schema,t,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function nu(n,e){const t=Xt(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Mg(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Tg(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function fs(n){return e=>Tg(e.$from,n)}function Og(n,e){const t={from:0,to:n.content.size};return Gc(n,t,e)}function Eg(n,e){const t=ve(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===t.name);return s?{...s.attrs}:{}}function Ag(n,e){const t=Ni(typeof e=="string"?e:e.name,n.schema);return t==="node"?Eg(n,e):t==="mark"?nu(n,e):{}}function ru(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=ds(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Qr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Po(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Xt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>pi(d.attrs,t,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;n.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(p,g),A=Math.min(h,g+m.nodeSize),S=A-b;s+=S,a.push(...m.marks.map(y=>({mark:y,from:b,to:A})))})}),s===0)return!1;const l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>pi(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function Dg(n,e,t={}){if(!e)return Or(n,null,t)||Po(n,null,t);const r=Ni(e,n.schema);return r==="node"?Or(n,e,t):r==="mark"?Po(n,e,t):!1}function Pa(n,e){const{nodeExtensions:t}=Ei(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=K(L(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Ii(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(Ii(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Ng(n,e,t){var r;const{selection:i}=e;let o=null;if(Qc(i)&&(o=i.$cursor),o){const a=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(t),h=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=p&&h}return!c}),c})}const Ig=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:a}=o,l=Xt(n,r.schema);if(i)if(s){const c=nu(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),m=Math.min(p+f.nodeSize,d);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&t.addMark(h,m,l.create({...b.attrs,...e}))}):t.addMark(h,m,l.create(e))})});return Ng(r,t,l)},Pg=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Rg=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=ve(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>Oa(o,{...s,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Oa(o,{...s,...e})(a,r)).run():!1},_g=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=un(n,0,r.content.size),o=z.create(r,i);e.setSelection(o)}return!0},$g=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=U.atStart(r).from,a=U.atEnd(r).to,l=un(i,s,a),c=un(o,s,a),u=U.create(r,l,c);e.setSelection(u)}return!0},Lg=n=>({state:e,dispatch:t})=>{const r=ve(n,e.schema);return vm(r)(e,t)};function Ra(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const Bg=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=Qr(c,a.node().type.name,a.node().attrs);if(o instanceof z&&o.node.isBlock)return!a.parentOffset||!Nt(s,a.pos)?!1:(r&&(n&&Ra(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Mg(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=Nt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&Nt(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(h&&(o instanceof U&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&Ra(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},Vg=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const a=ve(n,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=o.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=O.empty;const A=l.index(-1)?1:l.index(-2)?2:3;for(let E=l.depth-A;E>=l.depth-3;E-=1)b=O.from(l.node(E).copy(b));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,y={...Qr(f,l.node().type.name,l.node().attrs),...e},D=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(y))||void 0;b=b.append(O.from(a.createAndFill(null,D)||void 0));const C=l.before(l.depth-(A-1));t.replace(C,l.after(-S),new R(b,4-A,0));let N=-1;t.doc.nodesBetween(C,t.doc.content.size,(E,$)=>{if(N>-1)return!1;E.isTextblock&&E.content.size===0&&(N=$+1)}),N>-1&&t.setSelection(U.near(t.doc.resolve(N))),t.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...Qr(f,d.type.name,d.attrs),...e},m={...Qr(f,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(!Nt(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:A}=r,{splittableMarks:S}=o.extensionManager,y=A||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!y||!i)return!0;const D=y.filter(C=>S.includes(C.type.name));t.ensureMarks(D)}return!0},no=(n,e)=>{const t=fs(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Cn(n.doc,t.pos)&&n.join(t.pos),!0},ro=(n,e)=>{const t=fs(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Cn(n.doc,r)&&n.join(r),!0},zg=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,p=ve(n,s.schema),h=ve(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:A}=m,S=b.blockRange(A),y=g||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const D=fs(C=>Pa(C.type.name,d))(m);if(S.depth>=1&&D&&S.depth-D.depth<=1){if(D.node.type===p)return c.liftListItem(h);if(Pa(D.node.type.name,d)&&p.validContent(D.node.content)&&a)return l().command(()=>(o.setNodeMarkup(D.pos,p),!0)).command(()=>no(o,p)).command(()=>ro(o,p)).run()}return!t||!y||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>no(o,p)).command(()=>ro(o,p)).run():l().command(()=>{const C=u().wrapInList(p,r),N=y.filter(E=>f.includes(E.type.name));return o.ensureMarks(N),C?!0:c.clearNodes()}).wrapInList(p,r).command(()=>no(o,p)).command(()=>ro(o,p)).run()},Fg=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Xt(n,r.schema);return Po(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},jg=(n,e,t={})=>({state:r,commands:i})=>{const o=ve(n,r.schema),s=ve(e,r.schema),a=Or(r,o,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...t})},Hg=(n,e={})=>({state:t,commands:r})=>{const i=ve(n,t.schema);return Or(t,i,e)?r.lift(i):r.wrapIn(i,e)},Wg=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},qg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Kg=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=t,l=Xt(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:f,to:p}=a;const h=(o=c.marks().find(g=>g.type===l))===null||o===void 0?void 0:o.attrs,m=ds(c,l,h);m&&(f=m.from,p=m.to),t.removeMark(f,p,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},Ug=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Ni(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(o=ve(n,r.schema)),a==="mark"&&(s=Xt(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,p,h;t.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{o&&o===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g<c&&o&&o===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(o&&o===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const A=Math.max(g,c),S=Math.min(g+m.nodeSize,u);t.addMark(A,S,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(p,h,s.create({...m.attrs,...e}))}))}),!0):!1},Jg=(n,e={})=>({state:t,dispatch:r})=>{const i=ve(n,t.schema);return fm(i,e)(t,r)},Gg=(n,e={})=>({state:t,dispatch:r})=>{const i=ve(n,t.schema);return pm(i,e)(t,r)};var Yg=Object.freeze({__proto__:null,blur:_m,clearContent:$m,clearNodes:Lm,command:Bm,createParagraphNear:Vm,cut:zm,deleteCurrentNode:Fm,deleteNode:jm,deleteRange:Hm,deleteSelection:Wm,enter:qm,exitCode:Km,extendMarkRange:Um,first:Jm,focus:Ym,forEach:Xm,insertContent:Qm,insertContentAt:tg,joinBackward:ig,joinDown:rg,joinForward:og,joinItemBackward:sg,joinItemForward:ag,joinTextblockBackward:lg,joinTextblockForward:cg,joinUp:ng,keyboardShortcut:dg,lift:fg,liftEmptyBlock:pg,liftListItem:hg,newlineInCode:mg,resetAttributes:gg,scrollIntoView:yg,selectAll:bg,selectNodeBackward:vg,selectNodeForward:xg,selectParentNode:kg,selectTextblockEnd:wg,selectTextblockStart:Sg,setContent:Cg,setMark:Ig,setMeta:Pg,setNode:Rg,setNodeSelection:_g,setTextSelection:$g,sinkListItem:Lg,splitBlock:Bg,splitListItem:Vg,toggleList:zg,toggleMark:Fg,toggleNode:jg,toggleWrap:Hg,undoInputRule:Wg,unsetAllMarks:qg,unsetMark:Kg,updateAttributes:Ug,wrapIn:Jg,wrapInList:Gg});const Xg=qe.create({name:"commands",addCommands(){return{...Yg}}}),Qg=qe.create({name:"drop",addProseMirrorPlugins(){return[new Re({key:new Te("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Zg=qe.create({name:"editable",addProseMirrorPlugins(){return[new Re({key:new Te("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ey=new Te("focusEvents"),ty=qe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Re({key:ey,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ny=qe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&h.parent.childCount===1?g===d.pos:G.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Mr()||tu()?o:i},addProseMirrorPlugins(){return[new Re({key:new Te("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=G.atStart(e.doc).from,c=G.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!Ii(t.doc))return;const f=t.tr,p=Ti({state:t,transaction:f}),{commands:h}=new Oi({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),ry=qe.create({name:"paste",addProseMirrorPlugins(){return[new Re({key:new Te("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),iy=qe.create({name:"tabindex",addProseMirrorPlugins(){return[new Re({key:new Te("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class an{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,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,r=this.to;if(this.isBlock){if(this.content.size===0)return;t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new an(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new an(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new an(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new an(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new an(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 r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>t[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),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 oy=`.ProseMirror { 14 position: relative; 15} 16 17.ProseMirror { 18 word-wrap: break-word; 19 white-space: pre-wrap; 20 white-space: break-spaces; 21 -webkit-font-variant-ligatures: none; 22 font-variant-ligatures: none; 23 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 24} 25 26.ProseMirror [contenteditable="false"] { 27 white-space: normal; 28} 29 30.ProseMirror [contenteditable="false"] [contenteditable="true"] { 31 white-space: pre-wrap; 32} 33 34.ProseMirror pre { 35 white-space: pre-wrap; 36} 37 38img.ProseMirror-separator { 39 display: inline !important; 40 border: none !important; 41 margin: 0 !important; 42 width: 0 !important; 43 height: 0 !important; 44} 45 46.ProseMirror-gapcursor { 47 display: none; 48 pointer-events: none; 49 position: absolute; 50 margin: 0; 51} 52 53.ProseMirror-gapcursor:after { 54 content: ""; 55 display: block; 56 position: absolute; 57 top: -2px; 58 width: 20px; 59 border-top: 1px solid black; 60 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 61} 62 63@keyframes ProseMirror-cursor-blink { 64 to { 65 visibility: hidden; 66 } 67} 68 69.ProseMirror-hideselection *::selection { 70 background: transparent; 71} 72 73.ProseMirror-hideselection *::-moz-selection { 74 background: transparent; 75} 76 77.ProseMirror-hideselection * { 78 caret-color: transparent; 79} 80 81.ProseMirror-focused .ProseMirror-gapcursor { 82 display: block; 83} 84 85.tippy-box[data-animation=fade][data-state=hidden] { 86 opacity: 0 87}`;function sy(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}let ay=class extends xm{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,emitContentError:!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:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),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=sy(oy,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 r=Uc(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=r.filter(a=>!a.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[Zg,Rm.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Xg,ty,ny,iy,Qg,ry].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Bn(i,this)}createCommandManager(){this.commandManager=new Oi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Io(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),t=Io(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Zc(t,this.options.autofocus);this.view=new Pc(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:Ln.create({doc:t,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.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(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}const t=this.state.apply(e),r=!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}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ag(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Dg(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cs(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` 88 89`,textSerializers:r={}}=e||{};return Og(this.state.doc,{blockSeparator:t,textSerializers:{...Yc(this.schema),...r}})}get isEmpty(){return Ii(this.state.doc)}getCharacterCount(){return 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 r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new an(t,this)}get $doc(){return this.$pos(0)}};function Er(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=K(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=t.from+a.indexOf(s),u=c+s.length;if(ru(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===n.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;u<t.to&&o.delete(u,t.to),c>t.from&&o.delete(t.from+l,c);const f=t.from+l+s.length;o.addMark(t.from+l,f,n.type.create(i||{}
89)),o.removeStoredMark(n.type)}}})}function ly(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=K(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function _a(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=K(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}class ft{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,this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(L(this,"addOptions",{name:this.name}))),this.storage=K(L(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ft(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Di(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new ft(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,t.options=K(L(t,"addOptions",{name:t.name})),t.storage=K(L(t,"addStorage",{name:t.name,options:t.options})),t}}class cy{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,o,s,a,l;const{view:c}=this.editor,u=e.target,d=u.nodeType===3?(t=u.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!d)return;let f=0,p=0;if(this.dom!==d){const A=this.dom.getBoundingClientRect(),S=d.getBoundingClientRect(),y=(i=e.offsetX)!==null&&i!==void 0?i:(o=e.nativeEvent)===null||o===void 0?void 0:o.offsetX,D=(s=e.offsetY)!==null&&s!==void 0?s:(a=e.nativeEvent)===null||a===void 0?void 0:a.offsetY;f=S.x-A.x+y,p=S.y-A.y+D}const h=this.dom.cloneNode(!0);(l=e.dataTransfer)===null||l===void 0||l.setDragImage(h,f,p);const m=this.getPos();if(typeof m!="number")return;const g=z.create(c.state.doc,m),b=c.state.tr.setSelection(g);c.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;const o=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!o)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=z.isSelectable(this.node),f=e.type==="copy",p=e.type==="paste",h=e.type==="cut",m=e.type==="mousedown";if(!u&&d&&o&&e.target===this.dom&&e.preventDefault(),u&&o&&!c&&e.target===this.dom)return e.preventDefault(),!1;if(u&&l&&!c&&m){const g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(c||s||f||p||h||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Mr()||No())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes
89)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function Ar(n){return new Jc({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=K(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(ru(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;f<t.to&&s.delete(f,t.to),d>t.from&&s.delete(t.from+u,d),c=t.from+u+a.length,s.addMark(t.from+u,c,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}function uy(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function dy(n){return new Jc({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:i}){const o=K(n.getAttributes,void 0,e,i),s=K(n.getContent,void 0,o);if(o===!1||o===null)return null;const a={type:n.type.name,attrs:o};s&&(a.content=s),e.input&&t().deleteRange(r).insertContentAt(r.from,a)}})}var He="top",ot="bottom",st="right",We="left",ps="auto",$r=[He,ot,st,We],Un="start",Dr="end",fy="clippingParents",iu="viewport",ir="popper",py="reference",$a=$r.reduce(function(n,e){return n.concat([e+"-"+Un,e+"-"+Dr])},[]),ou=[].concat($r,[ps]).reduce(function(n,e){return n.concat([e,e+"-"+Un,e+"-"+Dr])},[]),hy="beforeRead",my="read",gy="afterRead",yy="beforeMain",by="main",vy="afterMain",xy="beforeWrite",ky="write",wy="afterWrite",Sy=[hy,my,gy,yy,by,vy,xy,ky,wy];function vt(n){return n?(n.nodeName||"").toLowerCase():null}function Xe(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function wn(n){var e=Xe(n).Element;return n instanceof e||n instanceof Element}function it(n){var e=Xe(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function hs(n){if(typeof ShadowRoot>"u")return!1;var e=Xe(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function Cy(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];
vendor: 18,815 bytes, line 89
89!it(o)||!vt(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function My(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!it(i)||!vt(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const su={name:"applyStyles",enabled:!0,phase:"write",fn:Cy,effect:My,requires:["computeStyles"]};function gt(n){return n.split("-")[0]}var mn=Math.max,hi=Math.min,Jn=Math.round;function Ro(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function au(){return!/^((?!chrome|android).)*safari/i.test(Ro())}function Gn(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,o=1;e&&it(n)&&(i=n.offsetWidth>0&&Jn(r.width)/n.offsetWidth||1,o=n.offsetHeight>0&&Jn(r.height)/n.offsetHeight||1);var s=wn(n)?Xe(n):window,a=s.visualViewport,l=!au()&&t,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,f=r.height/o;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function ms(n){var e=Gn(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function lu(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&hs(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Pt(n){return Xe(n).getComputedStyle(n)}function Ty(n){return["table","td","th"].indexOf(vt(n))>=0}function Qt(n){return((wn(n)?n.ownerDocument:n.document)||window.document).documentElement}function Pi(n){return vt(n)==="html"?n:n.assignedSlot||n.parentNode||(hs(n)?n.host:null)||Qt(n)}function La(n){return!it(n)||Pt(n).position==="fixed"?null:n.offsetParent}function Oy(n){var e=/firefox/i.test(Ro()),t=/Trident/i.test(Ro());if(t&&it(n)){var r=Pt(n);if(r.position==="fixed")return null}var i=Pi(n);for(hs(i)&&(i=i.host);it(i)&&["html","body"].indexOf(vt(i))<0;){var o=Pt(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Lr(n){for(var e=Xe(n),t=La(n);t&&Ty(t)&&Pt(t).position==="static";)t=La(t);return t&&(vt(t)==="html"||vt(t)==="body"&&Pt(t).position==="static")?e:t||Oy(n)||e}function gs(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function pr(n,e,t){return mn(n,hi(e,t))}function Ey(n,e,t){var r=pr(n,e,t);return r>t?t:r}function cu(){return{top:0,right:0,bottom:0,left:0}}function uu(n){return Object.assign({},cu(),n)}function du(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var Ay=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,uu(typeof e!="number"?e:du(e,$r))};function Dy(n){var e,t=n.state,r=n.name,i=n.options,o=t.elements.arrow,s=t.modifiersData.popperOffsets,a=gt(t.placement),l=gs(a),c=[We,st].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var d=Ay(i.padding,t),f=ms(o),p=l==="y"?He:We,h=l==="y"?ot:st,m=t.rects.reference[u]+t.rects.reference[l]-s[l]-t.rects.popper[u],g=s[l]-t.rects.reference[l],b=Lr(o),A=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,S=m/2-g/2,y=d[p],D=A-f[u]-d[h],C=A/2-f[u]/2+S,N=pr(y,C,D),E=l;t.modifiersData[r]=(e={},e[E]=N,e.centerOffset=N-C,e)}}function Ny(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||lu(e.elements.popper,i)&&(e.elements.arrow=i))}const Iy={name:"arrow",enabled:!0,phase:"main",fn:Dy,effect:Ny,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yn(n){return n.split("-")[1]}var Py={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Ry(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:Jn(t*i)/i||0,y:Jn(r*i)/i||0}}function Ba(n){var e,t=n.popper,r=n.popperRect,i=n.placement,o=n.variation,s=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,d=n.isFixed,f=s.x,p=f===void 0?0:f,h=s.y,m=h===void 0?0:h,g=typeof u=="function"?u({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var b=s.hasOwnProperty("x"),A=s.hasOwnProperty("y"),S=We,y=He,D=window;if(c){var C=Lr(t),N="clientHeight",E="clientWidth";if(C===Xe(t)&&(C=Qt(t),Pt(C).position!=="static"&&a==="absolute"&&(N="scrollHeight",E="scrollWidth")),C=C,i===He||(i===We||i===st)&&o===Dr){y=ot;var $=d&&C===D&&D.visualViewport?D.visualViewport.height:C[N];m-=$-r.height,m*=l?1:-1}if(i===We||(i===He||i===ot)&&o===Dr){S=st;var F=d&&C===D&&D.visualViewport?D.visualViewport.width:C[E];p-=F-r.width,p*=l?1:-1}}var W=Object.assign({position:a},c&&Py),B=u===!0?Ry({x:p,y:m},Xe(t)):{x:p,y:m};if(p=B.x,m=B.y,l){var H;return Object.assign({},W,(H={},H[y]=A?"0":"",H[S]=b?"0":"",H.transform=(D.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",H))}return Object.assign({},W,(e={},e[y]=A?m+"px":"",e[S]=b?p+"px":"",e.transform="",e))}function _y(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,o=t.adaptive,s=o===void 0?!0:o,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:gt(e.placement),variation:Yn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Ba(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Ba(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const $y={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:_y,data:{}};var Kr={passive:!0};function Ly(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Xe(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",t.update,Kr)}),a&&l.addEventListener("resize",t.update,Kr),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",t.update,Kr)}),a&&l.removeEventListener("resize",t.update,Kr)}}const By={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Ly,data:{}};var Vy={left:"right",right:"left",bottom:"top",top:"bottom"};function Zr(n){return n.replace(/left|right|bottom|top/g,function(e){return Vy[e]})}var zy={start:"end",end:"start"};function Va(n){return n.replace(/start|end/g,function(e){return zy[e]})}function ys(n){var e=Xe(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function bs(n){return Gn(Qt(n)).left+ys(n).scrollLeft}function Fy(n,e){var t=Xe(n),r=Qt(n),i=t.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=au();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+bs(n),y:l}}function jy(n){var e,t=Qt(n),r=ys(n),i=(e=n.ownerDocument)==null?void 0:e.body,o=mn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=mn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+bs(n),l=-r.scrollTop;return Pt(i||t).direction==="rtl"&&(a+=mn(t.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function vs(n){var e=Pt(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function fu(n){return["html","body","#document"].indexOf(vt(n))>=0?n.ownerDocument.body:it(n)&&vs(n)?n:fu(Pi(n))}function hr(n,e){var t;e===void 0&&(e=[]);var r=fu(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),o=Xe(r),s=i?[o].concat(o.visualViewport||[],vs(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(hr(Pi(s)))}function _o(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function Hy(n,e){var t=Gn(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function za(n,e,t){return e===iu?_o(Fy(n,t)):wn(e)?Hy(e,t):_o(jy(Qt(n)))}function Wy(n){var e=hr(Pi(n)),t=["absolute","fixed"].indexOf(Pt(n).position)>=0,r=t&&it(n)?Lr(n):n;return wn(r)?e.filter(function(i){return wn(i)&&lu(i,r)&&vt(i)!=="body"}):[]}function qy(n,e,t,r){var i=e==="clippingParents"?Wy(n):[].concat(e),o=[].concat(i,[t]),s=o[0],a=o.reduce(function(l,c){var u=za(n,c,r);return l.top=mn(u.top,l.top),l.right=hi(u.right,l.right),l.bottom=hi(u.bottom,l.bottom),l.left=mn(u.left,l.left),l},za(n,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function pu(n){var e=n.reference,t=n.element,r=n.placement,i=r?gt(r):null,o=r?Yn(r):null,s=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case He:l={x:s,y:e.y-t.height};break;case ot:l={x:s,y:e.y+e.height};break;case st:l={x:e.x+e.width,y:a};break;case We:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?gs(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case Un:l[c]=l[c]-(e[u]/2-t[u]/2);break;case Dr:l[c]=l[c]+(e[u]/2-t[u]/2);break}}return l}function Nr(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,o=t.strategy,s=o===void 0?n.strategy:o,a=t.boundary,l=a===void 0?fy:a,c=t.rootBoundary,u=c===void 0?iu:c,d=t.elementContext,f=d===void 0?ir:d,p=t.altBoundary,h=p===void 0?!1:p,m=t.padding,g=m===void 0?0:m,b=uu(typeof g!="number"?g:du(g,$r)),A=f===ir?py:ir,S=n.rects.popper,y=n.elements[h?A:f],D=qy(wn(y)?y:y.contextElement||Qt(n.elements.popper),l,u,s),C=Gn(n.elements.reference),N=pu({reference:C,element:S,placement:i}),E=_o(Object.assign({},S,N)),$=f===ir?E:C,F={top:D.top-$.top+b.top,bottom:$.bottom-D.bottom+b.bottom,left:D.left-$.left+b.left,right:$.right-D.right+b.right},W=n.modifiersData.offset;if(f===ir&&W){var B=W[i];Object.keys(F).forEach(function(H){var Z=[st,ot].indexOf(H)>=0?1:-1,ce=[He,ot].indexOf(H)>=0?"y":"x";F[H]+=B[ce]*Z})}return F}function Ky(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,o=t.rootBoundary,s=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?ou:l,u=Yn(r),d=u?a?$a:$a.filter(function(h){return Yn(h)===u}):$r,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var p=f.reduce(function(h,m){return h[m]=Nr(n,{placement:m,boundary:i,rootBoundary:o,padding:s})[gt(m)],h},{});return Object.keys(p).sort(function(h,m){return p[h]-p[m]})}function Uy(n){if(gt(n)===ps)return[];var e=Zr(n);return[Va(n),e,Va(e)]}function Jy(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!0:s,l=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,p=t.flipVariations,h=p===void 0?!0:p,m=t.allowedAutoPlacements,g=e.options.placement,b=gt(g),A=b===g,S=l||(A||!h?[Zr(g)]:Uy(g)),y=[g].concat(S).reduce(function(Ke,ke){return Ke.concat(gt(ke)===ps?Ky(e,{placement:ke,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:m}):ke)},[]),D=e.rects.reference,C=e.rects.popper,N=new Map,E=!0,$=y[0],F=0;F<y.length;F++){var W=y[F],B=gt(W),H=Yn(W)===Un,Z=[He,ot].indexOf(B)>=0,ce=Z?"width":"height",oe=Nr(e,{placement:W,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),le=Z?H?st:We:H?ot:He;D[ce]>C[ce]&&(le=Zr(le));var ie=Zr(le),ee=[];if(o&&ee.push(oe[B]<=0),a&&ee.push(oe[le]<=0,oe[ie]<=0),ee.every(function(Ke){return Ke})){$=W,E=!1;break}N.set(W,ee)}if(E)for(var Oe=h?3:1,he=function(ke){var Qe=y.find(function(Rt){var at=N.get(Rt);if(at)return at.slice(0,ke).every(function(xt){return xt})});if(Qe)return $=Qe,"break"},xe=Oe;xe>0;xe--){var _e=he(xe);if(_e==="break")break}e.placement!==$&&(e.modifiersData[r]._skip=!0,e.placement=$,e.reset=!0)}}const Gy={name:"flip",enabled:!0,phase:"main",fn:Jy,requiresIfExists:["offset"],data:{_skip:!1}};function Fa(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function ja(n){return[He,st,ot,We].some(function(e){return n[e]>=0})}function Yy(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Nr(e,{elementContext:"reference"}),a=Nr(e,{altBoundary:!0}),l=Fa(s,r),c=Fa(a,i,o),u=ja(l),d=ja(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const Xy={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Yy};function Qy(n,e,t){var r=gt(n),i=[We,He].indexOf(r)>=0?-1:1,o=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[We,st].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function Zy(n){var e=n.state,t=n.options,r=n.name,i=t.offset,o=i===void 0?[0,0]:i,s=ou.reduce(function(u,d){return u[d]=Qy(d,e.rects,o),u},{}),a=s[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const eb={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Zy};function tb(n){var e=n.state,t=n.name;e.modifiersData[t]=pu({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const nb={name:"popperOffsets",enabled:!0,phase:"read",fn:tb,data:{}};function rb(n){return n==="x"?"y":"x"}function ib(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!1:s,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,p=f===void 0?!0:f,h=t.tetherOffset,m=h===void 0?0:h,g=Nr(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=gt(e.placement),A=Yn(e.placement),S=!A,y=gs(b),D=rb(y),C=e.modifiersData.popperOffsets,N=e.rects.reference,E=e.rects.popper,$=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,F=typeof $=="number"?{mainAxis:$,altAxis:$}:Object.assign({mainAxis:0,altAxis:0},$),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(C){if(o){var H,Z=y==="y"?He:We,ce=y==="y"?ot:st,oe=y==="y"?"height":"width",le=C[y],ie=le+g[Z],ee=le-g[ce],Oe=p?-E[oe]/2:0,he=A===Un?N[oe]:E[oe],xe=A===Un?-E[oe]:-N[oe],_e=e.elements.arrow,Ke=p&&_e?ms(_e):{width:0,height:0},ke=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:cu(),Qe=ke[Z],Rt=ke[ce],at=pr(0,N[oe],Ke[oe]),xt=S?N[oe]/2-Oe-at-Qe-F.mainAxis:he-at-Qe-F.mainAxis,Ue=S?-N[oe]/2+Oe+at+Rt+F.mainAxis:xe+at+Rt+F.mainAxis,kt=e.elements.arrow&&Lr(e.elements.arrow),Mn=kt?y==="y"?kt.clientTop||0:kt.clientLeft||0:0,wt=(H=W?.[y])!=null?H:0,St=le+xt-wt-Mn,Ct=le+Ue-wt,Zt=pr(p?hi(ie,St):ie,le,p?mn(ee,Ct):ee);C[y]=Zt,B[y]=Zt-le}if(a){var en,Tn=y==="x"?He:We,On=y==="x"?ot:st,lt=C[D],ct=D==="y"?"height":"width",tn=lt+g[Tn],Mt=lt-g[On],nn=[He,We].indexOf(b)!==-1,rn=(en=W?.[D])!=null?en:0,_t=nn?tn:lt-N[ct]-E[ct]-rn+F.altAxis,Tt=nn?lt+N[ct]+E[ct]-rn-F.altAxis:Mt,En=p&&nn?Ey(_t,lt,Tt):pr(p?_t:tn,lt,p?Tt:Mt);C[D]=En,B[D]=En-lt}e.modifiersData[r]=B}}const ob={name:"preventOverflow",enabled:!0,phase:"main",fn:ib,requiresIfExists:["offset"]};function sb(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function ab(n){return n===Xe(n)||!it(n)?ys(n):sb(n)}function lb(n){var e=n.getBoundingClientRect(),t=Jn(e.width)/n.offsetWidth||1,r=Jn(e.height)/n.offsetHeight||1;return t!==1||r!==1}function cb(n,e,t){t===void 0&&(t=!1);var r=it(e),i=it(e)&&lb(e),o=Qt(e),s=Gn(n,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((vt(e)!=="body"||vs(o))&&(a=ab(e)),it(e)?(l=Gn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=bs(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function ub(n){var e=new Map,t=new Set,r=[];n.forEach(function(o){e.set(o.name,o)});function i(o){t.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return n.forEach(function(o){t.has(o.name)||i(o)}),r}function db(n){var e=ub(n);return Sy.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function fb(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function pb(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Ha={placement:"bottom",modifiers:[],strategy:"absolute"};function Wa(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function hb(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,r=t===void 0?[]:t,i=e.defaultOptions,o=i===void 0?Ha:i;return function(a,l,c){c===void 0&&(c=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ha,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],f=!1,p={state:u,setOptions:function(b){var A=typeof b=="function"?b(u.options):b;m(),u.options=Object.assign({},o,u.options,A),u.scrollParents={reference:wn(a)?hr(a):a.contextElement?hr(a.contextElement):[],popper:hr(l)};var S=db(pb([].concat(r,u.options.modifiers)));return u.orderedModifiers=S.filter(function(y){return y.enabled}),h(),p.update()},forceUpdate:function(){if(!f){var b=u.elements,A=b.reference,S=b.popper;if(Wa(A,S)){u.rects={reference:cb(A,Lr(S),u.options.strategy==="fixed"),popper:ms(S)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(F){return u.modifiersData[F.name]=Object.assign({},F.data)});for(var y=0;y<u.orderedModifiers.length;y++){if(u.reset===!0){u.reset=!1,y=-1;continue}var D=u.orderedModifiers[y],C=D.fn,N=D.options,E=N===void 0?{}:N,$=D.name;typeof C=="function"&&(u=C({state:u,options:E,name:$,instance:p})||u)}}}},update:fb(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){m(),f=!0}};if(!Wa(a,l))return p;p.setOptions(c).then(function(g){!f&&c.onFirstUpdate&&c.onFirstUpdate(g)});
vendor: 14,758 bytes, line 89
89function h(){u.orderedModifiers.forEach(function(g){var b=g.name,A=g.options,S=A===void 0?{}:A,y=g.effect;if(typeof y=="function"){var D=y({state:u,name:b,instance:p,options:S}),C=function(){};d.push(D||C)}})}function m(){d.forEach(function(g){return g()}),d=[]}return p}}var mb=[By,nb,$y,su,eb,Gy,ob,Iy,Xy],gb=hb({defaultModifiers:mb}),yb="tippy-box",hu="tippy-content",bb="tippy-backdrop",mu="tippy-arrow",gu="tippy-svg-arrow",on={passive:!0,capture:!0},yu=function(){return document.body};function io(n,e,t){if(Array.isArray(n)){var r=n[e];return r??(Array.isArray(t)?t[e]:t)}return n}function xs(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function bu(n,e){return typeof n=="function"?n.apply(void 0,e):n}function qa(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function vb(n){return n.split(/\s+/).filter(Boolean)}function $n(n){return[].concat(n)}function Ka(n,e){n.indexOf(e)===-1&&n.push(e)}function xb(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function kb(n){return n.split("-")[0]}function mi(n){return[].slice.call(n)}function Ua(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function mr(){return document.createElement("div")}function Ri(n){return["Element","Fragment"].some(function(e){return xs(n,e)})}function wb(n){return xs(n,"NodeList")}function Sb(n){return xs(n,"MouseEvent")}function Cb(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function Mb(n){return Ri(n)?[n]:wb(n)?mi(n):Array.isArray(n)?n:mi(document.querySelectorAll(n))}function oo(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Ja(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Tb(n){var e,t=$n(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Ob(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,l=a.interactiveBorder,c=kb(s.placement),u=s.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,h=c==="left"?u.right.x:0,m=o.top-r+d>l,g=r-o.bottom-f>l,b=o.left-t+p>l,A=t-o.right-h>l;return m||g||b||A})}function so(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function Ga(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var ht={isTouch:!1},Ya=0;function Eb(){ht.isTouch||(ht.isTouch=!0,window.performance&&document.addEventListener("mousemove",vu))}function vu(){var n=performance.now();n-Ya<20&&(ht.isTouch=!1,document.removeEventListener("mousemove",vu)),Ya=n}function Ab(){var n=document.activeElement;if(Cb(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function Db(){document.addEventListener("touchstart",Eb,on),window.addEventListener("blur",Ab)}var Nb=typeof window<"u"&&typeof document<"u",Ib=Nb?!!window.msCrypto:!1,Pb={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Rb={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},dt=Object.assign({appendTo:yu,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Pb,Rb),_b=Object.keys(dt),$b=function(e){var t=Object.keys(e);t.forEach(function(r){dt[r]=e[r]})};function xu(n){var e=n.plugins||[],t=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=n[o]!==void 0?n[o]:(a=dt[o])!=null?a:s}return r},{});return Object.assign({},n,t)}function Lb(n,e){var t=e?Object.keys(xu(Object.assign({},dt,{plugins:e}))):_b,r=t.reduce(function(i,o){var s=(n.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Xa(n,e){var t=Object.assign({},e,{content:bu(e.content,[n])},e.ignoreAttributes?{}:Lb(n,e.plugins));return t.aria=Object.assign({},dt.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var Bb=function(){return"innerHTML"};function $o(n,e){n[Bb()]=e}function Qa(n){var e=mr();return n===!0?e.className=mu:(e.className=gu,Ri(n)?e.appendChild(n):$o(e,n)),e}function Za(n,e){Ri(e.content)?($o(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?$o(n,e.content):n.textContent=e.content)}function Lo(n){var e=n.firstElementChild,t=mi(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(hu)}),arrow:t.find(function(r){return r.classList.contains(mu)||r.classList.contains(gu)}),backdrop:t.find(function(r){return r.classList.contains(bb)})}}function ku(n){var e=mr(),t=mr();t.className=yb,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=mr();r.className=hu,r.setAttribute("data-state","hidden"),Za(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(o,s){var a=Lo(e),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&Za(c,n.props),s.arrow?u?o.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(Qa(s.arrow))):l.appendChild(Qa(s.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}ku.$$tippy=!0;var Vb=1,Ur=[],ao=[];function zb(n,e){var t=Xa(n,Object.assign({},dt,xu(Ua(e)))),r,i,o,s=!1,a=!1,l=!1,c=!1,u,d,f,p=[],h=qa(St,t.interactiveDebounce),m,g=Vb++,b=null,A=xb(t.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:g,reference:n,popper:mr(),popperInstance:b,props:t,state:S,plugins:A,clearDelayTimeouts:_t,setProps:Tt,setContent:En,show:Zn,hide:_i,hideWithInteractivity:x,enable:nn,disable:rn,unmount:M,destroy:ze};if(!t.render)return y;var D=t.render(y),C=D.popper,N=D.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+y.id,y.popper=C,n._tippy=y,C._tippy=y;var E=A.map(function(k){return k.fn(y)}),$=n.hasAttribute("aria-expanded");return kt(),Oe(),le(),ie("onCreate",[y]),t.showOnCreate&&tn(),C.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&Z().addEventListener("mousemove",h)}),y;function F(){var k=y.props.touch;return Array.isArray(k)?k:[k,0]}function W(){return F()[0]==="hold"}function B(){var k;return!!((k=y.props.render)!=null&&k.$$tippy)}function H(){return m||n}function Z(){var k=H().parentNode;return k?Tb(k):document}function ce(){return Lo(C)}function oe(k){return y.state.isMounted&&!y.state.isVisible||ht.isTouch||u&&u.type==="focus"?0:io(y.props.delay,k?0:1,dt.delay)}function le(k){k===void 0&&(k=!1),C.style.pointerEvents=y.props.interactive&&!k?"":"none",C.style.zIndex=""+y.props.zIndex}function ie(k,P,_){if(_===void 0&&(_=!0),E.forEach(function(X){X[k]&&X[k].apply(X,P)}),_){var Y;(Y=y.props)[k].apply(Y,P)}}function ee(){var k=y.props.aria;if(k.content){var P="aria-"+k.content,_=C.id,Y=$n(y.props.triggerTarget||n);Y.forEach(function(X){var we=X.getAttribute(P);if(y.state.isVisible)X.setAttribute(P,we?we+" "+_:_);else{var Fe=we&&we.replace(_,"").trim();Fe?X.setAttribute(P,Fe):X.removeAttribute(P)}})}}function Oe(){if(!($||!y.props.aria.expanded)){var k=$n(y.props.triggerTarget||n);k.forEach(function(P){y.props.interactive?P.setAttribute("aria-expanded",y.state.isVisible&&P===H()?"true":"false"):P.removeAttribute("aria-expanded")})}}function he(){Z().removeEventListener("mousemove",h),Ur=Ur.filter(function(k){return k!==h})}function xe(k){if(!(ht.isTouch&&(l||k.type==="mousedown"))){var P=k.composedPath&&k.composedPath()[0]||k.target;if(!(y.props.interactive&&Ga(C,P))){if($n(y.props.triggerTarget||n).some(function(_){return Ga(_,P)})){if(ht.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else ie("onClickOutside",[y,k]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),a=!0,setTimeout(function(){a=!1}),y.state.isMounted||Qe())}}}function _e(){l=!0}function Ke(){l=!1}function ke(){var k=Z();k.addEventListener("mousedown",xe,!0),k.addEventListener("touchend",xe,on),k.addEventListener("touchstart",Ke,on),k.addEventListener("touchmove",_e,on)}function Qe(){var k=Z();k.removeEventListener("mousedown",xe,!0),k.removeEventListener("touchend",xe,on),k.removeEventListener("touchstart",Ke,on),k.removeEventListener("touchmove",_e,on)}function Rt(k,P){xt(k,function(){!y.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&P()})}function at(k,P){xt(k,P)}function xt(k,P){var _=ce().box;function Y(X){X.target===_&&(so(_,"remove",Y),P())}if(k===0)return P();so(_,"remove",d),so(_,"add",Y),d=Y}function Ue(k,P,_){_===void 0&&(_=!1);var Y=$n(y.props.triggerTarget||n);Y.forEach(function(X){X.addEventListener(k,P,_),p.push({node:X,eventType:k,handler:P,options:_})})}function kt(){W()&&(Ue("touchstart",wt,{passive:!0}),Ue("touchend",Ct,{passive:!0})),vb(y.props.trigger).forEach(function(k){if(k!=="manual")switch(Ue(k,wt),k){case"mouseenter":Ue("mouseleave",Ct);break;case"focus":Ue(Ib?"focusout":"blur",Zt);break;case"focusin":Ue("focusout",Zt);break}})}function Mn(){p.forEach(function(k){var P=k.node,_=k.eventType,Y=k.handler,X=k.options;P.removeEventListener(_,Y,X)}),p=[]}function wt(k){var P,_=!1;if(!(!y.state.isEnabled||en(k)||a)){var Y=((P=u)==null?void 0:P.type)==="focus";u=k,m=k.currentTarget,Oe(),!y.state.isVisible&&Sb(k)&&Ur.forEach(function(X){return X(k)}),k.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||s)&&y.props.hideOnClick!==!1&&y.state.isVisible?_=!0:tn(k),k.type==="click"&&(s=!_),_&&!Y&&Mt(k)}}function St(k){var P=k.target,_=H().contains(P)||C.contains(P);if(!(k.type==="mousemove"&&_)){var Y=ct().concat(C).map(function(X){var we,Fe=X._tippy,$t=(we=Fe.popperInstance)==null?void 0:we.state;return $t?{popperRect:X.getBoundingClientRect(),popperState:$t,props:t}:null}).filter(Boolean);Ob(Y,k)&&(he(),Mt(k))}}function Ct(k){var P=en(k)||y.props.trigger.indexOf("click")>=0&&s;if(!P){if(y.props.interactive){y.hideWithInteractivity(k);return}Mt(k)}}function Zt(k){y.props.trigger.indexOf("focusin")<0&&k.target!==H()||y.props.interactive&&k.relatedTarget&&C.contains(k.relatedTarget)||Mt(k)}function en(k){return ht.isTouch?W()!==k.type.indexOf("touch")>=0:!1}function Tn(){On();var k=y.props,P=k.popperOptions,_=k.placement,Y=k.offset,X=k.getReferenceClientRect,we=k.moveTransition,Fe=B()?Lo(C).arrow:null,$t=X?{getBoundingClientRect:X,contextElement:X.contextElement||H()}:n,er={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(An){var Lt=An.state;if(B()){var $i=ce(),nr=$i.box;["placement","reference-hidden","escaped"].forEach(function(Dn){Dn==="placement"?nr.setAttribute("data-placement",Lt.placement):Lt.attributes.popper["data-popper-"+Dn]?nr.setAttribute("data-"+Dn,""):nr.removeAttribute("data-"+Dn)}),Lt.attributes.popper={}}}},Ze=[{name:"offset",options:{offset:Y}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!we}},er];B()&&Fe&&Ze.push({name:"arrow",options:{element:Fe,padding:3}}),Ze.push.apply(Ze,P?.modifiers||[]),y.popperInstance=gb($t,C,Object.assign({},P,{placement:_,onFirstUpdate:f,modifiers:Ze}))}function On(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function lt(){var k=y.props.appendTo,P,_=H();y.props.interactive&&k===yu||k==="parent"?P=_.parentNode:P=bu(k,[_]),P.contains(C)||P.appendChild(C),y.state.isMounted=!0,Tn()}function ct(){return mi(C.querySelectorAll("[data-tippy-root]"))}function tn(k){y.clearDelayTimeouts(),k&&ie("onTrigger",[y,k]),ke();var P=oe(!0),_=F(),Y=_[0],X=_[1];ht.isTouch&&Y==="hold"&&X&&(P=X),P?r=setTimeout(function(){y.show()},P):y.show()}function Mt(k){if(y.clearDelayTimeouts(),ie("onUntrigger",[y,k]),!y.state.isVisible){Qe();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(k.type)>=0&&s)){var P=oe(!1);P?i=setTimeout(function(){y.state.isVisible&&y.hide()},P):o=requestAnimationFrame(function(){y.hide()})}}function nn(){y.state.isEnabled=!0}function rn(){y.hide(),y.state.isEnabled=!1}function _t(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function Tt(k){if(!y.state.isDestroyed){ie("onBeforeUpdate",[y,k]),Mn();var P=y.props,_=Xa(n,Object.assign({},P,Ua(k),{ignoreAttributes:!0}));y.props=_,kt(),P.interactiveDebounce!==_.interactiveDebounce&&(he(),h=qa(St,_.interactiveDebounce)),P.triggerTarget&&!_.triggerTarget?$n(P.triggerTarget).forEach(function(Y){Y.removeAttribute("aria-expanded")}):_.triggerTarget&&n.removeAttribute("aria-expanded"),Oe(),le(),N&&N(P,_),y.popperInstance&&(Tn(),ct().forEach(function(Y){requestAnimationFrame(Y._tippy.popperInstance.forceUpdate)})),ie("onAfterUpdate",[y,k])}}function En(k){y.setProps({content:k})}function Zn(){var k=y.state.isVisible,P=y.state.isDestroyed,_=!y.state.isEnabled,Y=ht.isTouch&&!y.props.touch,X=io(y.props.duration,0,dt.duration);if(!(k||P||_||Y)&&!H().hasAttribute("disabled")&&(ie("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,B()&&(C.style.visibility="visible"),le(),ke(),y.state.isMounted||(C.style.transition="none"),B()){var we=ce(),Fe=we.box,$t=we.content;oo([Fe,$t],0)}f=function(){var Ze;if(!(!y.state.isVisible||c)){if(c=!0,C.offsetHeight,C.style.transition=y.props.moveTransition,B()&&y.props.animation){var tr=ce(),An=tr.box,Lt=tr.content;oo([An,Lt],X),Ja([An,Lt],"visible")}ee(),Oe(),Ka(ao,y),(Ze=y.popperInstance)==null||Ze.forceUpdate(),ie("onMount",[y]),y.props.animation&&B()&&at(X,function(){y.state.isShown=!0,ie("onShown",[y])})}},lt()}}function _i(){var k=!y.state.isVisible,P=y.state.isDestroyed,_=!y.state.isEnabled,Y=io(y.props.duration,1,dt.duration);
89if(!(k||P||_)&&(ie("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,c=!1,s=!1,B()&&(C.style.visibility="hidden"),he(),Qe(),le(!0),B()){var X=ce(),we=X.box,Fe=X.content;y.props.animation&&(oo([we,Fe],Y),Ja([we,Fe],"hidden"))}ee(),Oe(),y.props.animation?B()&&Rt(Y,y.unmount):y.unmount()}}function x(k){Z().addEventListener("mousemove",h),Ka(Ur,h),h(k)}function M(){y.state.isVisible&&y.hide(),y.state.isMounted&&(On(),ct().forEach(function(k){k._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),ao=ao.filter(function(k){return k!==y}),y.state.isMounted=!1,ie("onHidden",[y]))}function ze(){y.state.isDestroyed||(y.clearDelayTimeouts(),y.unmount(),Mn(),delete n._tippy,y.state.isDestroyed=!0,ie("onDestroy",[y]))}}function Br(n,e){e===void 0&&(e={});var t=dt.plugins.concat(e.plugins||[]);Db();var r=Object.assign({},e,{plugins:t}),i=Mb(n),o=i.reduce(function(s,a){var l=a&&zb(a,r);return l&&s.push(l),s},[]);return Ri(n)?o[0]:o}Br.defaultProps=dt;Br.setDefaultProps=$b;Br.currentInput=ht;Object.assign({},su,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});Br.setDefaultProps({render:ku});function el(n){return Fu((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class Fb extends ay{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=el(this.view.state),this.reactiveExtensionStorage=el(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),hl(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const r=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const jb=me({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=ae(),t=Bu();return Jr(()=>{const r=n.editor;r&&r.options.element&&e.value&&cl(()=>{if(!e.value||!r.options.element.firstChild)return;const i=v(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:i}),r.createNodeViews()})}),pl(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return bi("div",{ref:n=>{this.rootEl=n}})}}),Hb=me({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return bi(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Wb=me({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return bi(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))}}),qb=(n={})=>{const e=zu();return Vu(()=>{e.value=new Fb(n)}),pl(()=>{var t,r,i;const o=(t=e.value)===null||t===void 0?void 0:t.options.element,s=o?.cloneNode(!0);(r=o?.parentNode)===null||r===void 0||r.replaceChild(s,o),(i=e.value)===null||i===void 0||i.destroy()}),e};class wu{constructor(e,{props:t={},editor:r}){this.editor=r,this.component=hl(e),this.el=document.createElement("div"),this.props=ju(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,r,i;return!((t=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||t===void 0)&&t.exposed?this.renderedComponent.vNode.component.exposed:(i=(r=this.renderedComponent.vNode)===null||r===void 0?void 0:r.component)===null||i===void 0?void 0:i.proxy}renderComponent(){let e=bi(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&Cs(e,this.el),{vNode:e,destroy:()=>{this.el&&Cs(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([t,r])=>{this.props[t]=r}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const Kb={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class Ub extends cy{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(i={})=>this.updateAttributes(i),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=ae(this.getDecorationClasses());const r=me({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:i=>{var o,s;return Ss("onDragStart",t),Ss("decorationClasses",this.decorationClasses),(s=(o=this.component).setup)===null||s===void 0?void 0:s.call(o,i,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new wu(r,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}
89get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(o)};if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function Jb(n,e){return t=>{if(!t.editor.contentComponent)return{};const r=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new Ub(r,t,e)}}function Gb({onlyFirst:n=!1}={}){const i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,n?void 0:"g")}const Yb=Gb();function Xb(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(Yb,"")}function Qb(){const n="\\ud800-\\udfff",s="\\u0300-\\u036f"+"\\ufe20-\\ufe2f"+"\\u20d0-\\u20ff"+"\\u1ab0-\\u1aff"+"\\u1dc0-\\u1dff",a="\\ufe0e\\ufe0f",l="\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c14\\u0c60-\\u0c61",c="\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4c\\u0c62-\\u0c63",u="\\u0c15-\\u0c28\\u0c2a-\\u0c39",d="\\u0c58-\\u0c5a",f="\\u0c01-\\u0c03\\u0c4d\\u0c55\\u0c56",h=`[${l}\\u0c66-\\u0c6f\\u0c78-\\u0c7e${d}]|[${u}](?!\\u0c4d)`,m=`[${u}${d}][${c}]|[${u}${d}][${f}]`,b=`(?:${`[${u}]\\u0c4d[${u}]`}|${m}|${h})`,A=`[${n}]`,S=`[${s}]`,y="\\ud83c[\\udffb-\\udfff]",D=`(?:${S}|${y})`,C=`[^${n}]`,N="(?:\\ud83c[\\udde6-\\uddff]){2}",E="[\\ud800-\\udbff][\\udc00-\\udfff]",$="\\u200d",F="(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)",W=`${D}?`,B=`[${a}]?`,H=`(?:${$}(?:${[C,N,E].join("|")})${B+W})*`,Z=B+W+H,ce=`${C}${S}?`,oe=`(?:${[F,ce,S,N,E,A].join("|")})`;return new RegExp(`${y}(?=${y})|${b}|${oe+Z}`,"g")}function tl(n,{countAnsiEscapeCodes:e=!1}={}){return n===""||(e||(n=Xb(n)),n==="")?0:n.match(Qb()).length}const Zb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ev=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,tv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,nv=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,rv=kn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",Ge(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
vendor: 7,475 bytes, lines 89-90
89,addInputRules(){return[Er({find:Zb,type:this.type}),Er({find:tv,type:this.type})]},addPasteRules(){return[Ar({find:ev,type:this.type}),Ar({find:nv,type:this.type})]}}),iv=/(^|[^`])`([^`]+)`(?!`)/,ov=/(^|[^`])`([^`]+)`(?!`)/g,sv=kn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Ge(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Er({find:iv,type:this.type})]},addPasteRules(){return[Ar({find:ov,type:this.type})]}}),av=ft.create({name:"doc",topNode:!0,content:"block+"}),lv=ft.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Ge(this.options.HTMLAttributes,n)]},renderText(){return` 90`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var gi=200,be=function(){};be.prototype.append=function(e){return e.length?(e=be.from(e),!this.length&&e||e.length<gi&&this.leafAppend(e)||this.length<gi&&e.leafPrepend(this)||this.appendInner(e)):this};be.prototype.prepend=function(e){return e.length?be.from(e).append(this):this};be.prototype.appendInner=function(e){return new cv(this,e)};be.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};be.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};be.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};be.from=function(e){return e instanceof be?e:e&&e.length?new Su(e):be.empty};var Su=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=gi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=gi)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(be);be.empty=new Su([]);var cv=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(be);const uv=500;class ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new pt(d.map));let p=d.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new pt(h,void 0,void 0,c.length+u.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new ut(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,t,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new pt(e.mapping.maps[u],d,t),p;(p=l&&l.merge(f))&&(f=p,u?o.pop():a=a.slice(0,a.length-1)),o.push(f),t&&(s++,t=void 0),i||(l=f)}let c=s-r.depth;return c>fv&&(a=dv(a,c),s-=c),new ut(a.append(o),s)}remapping(e,t){let r=new xr;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new ut(this.items.append(e.map(t=>new pt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(l+1,p));g&&a++,r.push(new pt(h,m,g))}else r.push(new pt(h))},i);let c=[];for(let f=t;f<s;f++)c.push(new pt(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new ut(u,a);return d.emptyItemCount()>uv&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,a)=>
vendor: 4,391 bytes, line 90
90{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let d=new pt(c.invert(),l,u),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new ut(be.from(i.reverse()),o)}}ut.empty=new ut(be.empty,0);function dv(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class pt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new pt(t.getMap().invert(),t,this.selection)}}}class zt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const fv=20;function pv(n,e,t,r){let i=t.getMeta(gn),o;if(i)return i.historyState;t.getMeta(gv)&&(n=new zt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(gn))return s.getMeta(gn).redo?new zt(n.done.addTransform(t,void 0,r,ei(e)),n.undone,nl(t.mapping.maps),n.prevTime,n.prevComposition):new zt(n.done,n.undone.addTransform(t,void 0,r,ei(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!s&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!hv(t,n.prevRanges)),c=s?lo(n.prevRanges,t.mapping):nl(t.mapping.maps);return new zt(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,ei(e)),ut.empty,c,t.time,a??n.prevComposition)}else return(o=t.getMeta("rebased"))?new zt(n.done.rebased(t,o),n.undone.rebased(t,o),lo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new zt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),lo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function hv(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function nl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function lo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function mv(n,e,t){let r=ei(e),i=gn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new zt(t?a:o.remaining,t?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(gn,{redo:t,historyState:l})}let co=!1,rl=null;function ei(n){let e=n.plugins;if(rl!=e){co=!1,rl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){co=!0;break}}return co}const gn=new Te("history"),gv=new Te("closeHistory");function yv(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Re({key:gn,state:{init(){return new zt(ut.empty,ut.empty,null,0,-1)},apply(e,t,r){return pv(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Mu:r=="historyRedo"?Tu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Cu(n,e){return(t,r)=>{let i=gn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=mv(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Mu=Cu(!1,!0),Tu=Cu(!0,!0),bv=qe.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Mu(n,e),redo:()=>({state:n,dispatch:e})=>Tu(n,e)}},addProseMirrorPlugins(){return[yv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),vv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,xv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kv=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,wv=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sv=kn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}
90){return["em",Ge(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Er({find:vv,type:this.type}),Er({find:kv,type:this.type})]},addPasteRules(){return[Ar({find:xv,type:this.type}),Ar({find:wv,type:this.type})]}});function Cv(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:a}=n,l=r&&!i,c=uy(t),u=new RegExp(`\\s${c}$`),d=s?"^":"",f=i?"":c,p=l?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),h=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!h)return null;const m=a.pos-h.length,g=Array.from(h.matchAll(p)).pop();if(!g||g.input===void 0||g.index===void 0)return null;const b=g.input.slice(Math.max(0,g.index-1),g.index),A=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!A)return null;const S=m+g.index;let y=S+g[0].length;return l&&u.test(h.slice(y-1,y+1))&&(g[0]+=" ",y+=1),S<a.pos&&y>=a.pos?{range:{from:S,to:y},query:g[0].slice(t.length),text:g[0]}:null}const Mv=new Te("suggestion");function Tv({pluginKey:n=Mv,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:h=()=>!0,findSuggestionMatch:m=Cv}){let g;const b=p?.(),A=new Re({key:n,view(){return{update:async(S,y)=>{var D,C,N,E,$,F,W;const B=(D=this.key)===null||D===void 0?void 0:D.getState(y),H=(C=this.key)===null||C===void 0?void 0:C.getState(S.state),Z=B.active&&H.active&&B.range.from!==H.range.from,ce=!B.active&&H.active,oe=B.active&&!H.active,le=!ce&&!oe&&B.query!==H.query,ie=ce||Z&&le,ee=le||Z,Oe=oe||Z&≤if(!ie&&!ee&&!Oe)return;const he=Oe&&!ie?B:H,xe=S.dom.querySelector(`[data-decoration-id="${he.decorationId}"]`);g={editor:e,range:he.range,query:he.query,text:he.text,items:[],command:_e=>d({editor:e,range:he.range,props:_e}),decorationNode:xe,clientRect:xe?()=>{var _e;const{decorationId:Ke}=(_e=this.key)===null||_e===void 0?void 0:_e.getState(e.state),ke=S.dom.querySelector(`[data-decoration-id="${Ke}"]`);return ke?.getBoundingClientRect()||null}:null},ie&&((N=b?.onBeforeStart)===null||N===void 0||N.call(b,g)),ee&&((E=b?.onBeforeUpdate)===null||E===void 0||E.call(b,g)),(ee||ie)&&(g.items=await f({editor:e,query:he.query})),Oe&&(($=b?.onExit)===null||$===void 0||$.call(b,g)),ee&&((F=b?.onUpdate)===null||F===void 0||F.call(b,g)),ie&&((W=b?.onStart)===null||W===void 0||W.call(b,g))},destroy:()=>{var S;g&&((S=b?.onExit)===null||S===void 0||S.call(b,g))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,y,D,C){const{isEditable:N}=e,{composing:E}=e.view,{selection:$}=S,{empty:F,from:W}=$,B={...y};if(B.composing=E,N&&(F||e.view.composing)){(W<y.range.from||W>y.range.to)&&!E&&!y.composing&&(B.active=!1);const H=m({char:t,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:$.$from}),Z=`id_${Math.floor(Math.random()*4294967295)}`;H&&h({editor:e,state:C,range:H.range,isActive:y.active})?(B.active=!0,B.decorationId=y.decorationId?y.decorationId:Z,B.range=H.range,B.query=H.query,B.text=H.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(S,y){var D;const{active:C,range:N}=A.getState(S.state);return C&&((D=b?.onKeyDown)===null||D===void 0?void 0:D.call(b,{view:S,event:y,range:N}))||!1},decorations(S){const{active:y,range:D,decorationId:C,query:N}=A.getState(S);if(!y)return null;const E=!N?.length,$=[l];return E&&$.push(u),de.create(S.doc,[$e.inline(D.from,D.to,{nodeName:a,class:$.join(" "),"data-decoration-id":C,"data-decoration-content":c})])}}});return A}function Ov({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){const i=new Te;return{editor:n,char:r,pluginKey:i,command:({editor:o,range:s,props:a})=>{var l,c,u;const d=o.view.state.selection.$to.nodeAfter;!((l=d?.text)===null||l===void 0)&&l.startsWith(" ")&&(s.to+=1),o.chain().focus().insertContentAt(s,[{type:t,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(u=(c=o.view.dom.ownerDocument.defaultView)===null||c===void 0?void 0:c.getSelection())===null||u===void 0||u.collapseToEnd()},allow:({state:o,range:s})=>{const a=o.doc.resolve(s.from),l=o.schema.nodes[t];return!!a.parent.type.contentMatch.matchType(l)},...e}}function Ou(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>Ov({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function il(n,e){const t=Ou(n),r=t.find(i=>i.char===e);return r||(t.length?t[0]:null)}const uo=ft.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!==null&&t!==void 0?t:"@"}${(r=n.attrs.label)!==null&&r!==void 0?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,i;return["span",Ge(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!==null&&r!==void 0?r:"@"}${(i=e.attrs.label)!==null&&i!==void 0?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=il(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=Ge({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof i=="string"?["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},renderText({node:n}){const e={options:this.options,node:n,suggestion:il(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?this.options.renderLabel(e):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:o}=r;if(!i)return!1;e.doc.nodesBetween(o-1,o,(l,c)=>
90{if(l.type.name===this.name)return t=!0,n.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",c,c+l.nodeSize),!1});let s=new Dt,a=0;return e.doc.nodesBetween(o-1,o,(l,c)=>{if(l.type.name===this.name)return t=!0,s=l,a=c,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),t})}},addProseMirrorPlugins(){return Ou(this).map(Tv)}}),Ev=ft.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ge(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Av=qe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Re({key:new Te("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Ii(s);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=$e.node(a,a+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),de.create(n,i)}}})]}}),Dv=ft.create({name:"text",group:"inline"}),Nv=/(?:^|\s)(!\[(.+|:?)\]\((\S+)(?:\s+["'](\S+)["'])?\))$/,Iv=ft.create({name:"custom-emoji",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!1,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},"data-emoji-id":{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",Ge(this.options.HTMLAttributes,n)]},addCommands(){return{insertCustomEmoji:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[ly({find:Nv,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});function Pv(n){return((...e)=>{try{return n(...e)}catch{return null}})}function ol(n,e){const t=n({find:gl,type:e,getAttributes:r=>{const[i]=r;return ml(i)}});return t.handler=Pv(t.handler.bind(t)),[t]}const Rv=ft.create({name:"em-emoji",inline:()=>!0,group:()=>"inline",draggable:!1,parseHTML(){return[{tag:"img.iconify-emoji"}]},addAttributes(){return{alt:{default:null},src:{default:null},class:{default:null}}},renderHTML(n){return["img",Ge(this.options.HTMLAttributes,n.HTMLAttributes)]},addCommands(){return{insertEmoji:n=>({commands:e})=>e.insertContent({type:this.name,attrs:ml(n)})}},addInputRules(){function n(e){return new Ai({find:e.find,handler:({state:t,range:r,match:i})=>{const o=K(e.getAttributes,void 0,i)||{},{tr:s}=t,a=r.from,l=r.to;s.insert(a,e.type.create(o)).delete(s.mapping.map(a),s.mapping.map(l)),s.scrollIntoView()}})}return ol(n,this.type)},addPasteRules(){return ol(dy,this.type)}}),_v=/^```([a-z]+)?[\s\n]$/,$v=/^~~~([a-z]+)?[\s\n]$/,Lv=ft.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,o=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Ge(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` 91 92`);return!o||!s?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(G.near(r.resolve(a))),!0)):n.commands.exitCode()}}}
92,addInputRules(){return[_a({find:_v,type:this.type,getAttributes:n=>({language:n[1]})}),_a({find:$v,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Re({key:new Te("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!t||!o)return!1;const{tr:s,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,` 93`));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(U.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}});var Bv=class Eu{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,t,r){e<0||this.cache.set(e,[t,r])}replace(e,t,r,i){this.remove(e),this.set(t,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const t=new Eu(this.cache),r=e.mapping;return this.cache.forEach(([i,o],s)=>{if(s<0)return;const a=r.mapResult(s),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))t.remove(s);else if(s!==a.pos){const c=o.map(u=>u.map(r,0,0)).filter(u=>u!=null);t.replace(s,a.pos,l,c)}}),t}};function Vv({parser:n,nodeTypes:e=["code_block","codeBlock"],languageExtractor:t=r=>r.attrs.language}){const r=new Te("prosemirror-highlight");return new Re({key:r,state:{init(i,o){const s=new Bv,[a,l]=sl(o.doc,n,e,t,s);return{cache:s,decorations:a,promises:l}},apply:(i,o)=>{const s=o.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:s,decorations:o.decorations?.map(i.mapping,i.doc),promises:o.promises};const[l,c]=sl(i.doc,n,e,t,s);return{cache:s,decorations:l,promises:c}}},view:i=>{const o=new Set,s=()=>{if(o.size>0)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const c of l?.promises??[])o.add(c),c.then(()=>{o.delete(c),s()}).catch(u=>{o.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function sl(n,e,t,r,i){const o=[],s=[],a=zv(n,t);try{for(const[l,c]of a){const u=r(l),d=i.get(c);if(d){const[f,p]=d;p.length>0&&o.push(p)}else{const f=e({content:l.textContent,language:u||void 0,pos:c,size:l.nodeSize});f&&Array.isArray(f)?(i.set(c,l,f),f.length>0&&o.push(f)):f instanceof Promise&&(i.remove(c),s.push(f))}}}catch{}return[o.length>0?de.create(n,o.flat()):void 0,s]}function zv(n,e){const t=[];return n.descendants((r,i)=>{if(r.type.isTextblock&&e.includes(r.type.name))return t.push([r,i]),!1}),t}const Fv={relative:"",my2:""},jv=["value"],Hv={class:"code-block"},Wv=me({__name:"TiptapCodeBlock",props:Kb,setup(n){const e=["c","cpp","csharp","css","dart","go","html","java","javascript","jsx","kotlin","python","rust","svelte","swift","tsx","typescript","vue"],t=te({get(){return n.node.attrs.language},set(r){n.updateAttributes({language:r})}});return(r,i)=>(T(),ne(v(Wb),null,{default:V(()=>[w("div",Fv,[yr(w("select",{"onUpdate:modelValue":i[0]||(i[0]=o=>Fn(t)?t.value=o:null),contenteditable:"false",absolute:"","top-1":"","right-1":"",rounded:"",px2:"",op0:"","hover:op100":"","focus:op100":"",transition:"","outline-none":"",border:"~ base"},[i[1]||(i[1]=w("option",{value:null}," plain ",-1)),(T(),I(fe,null,De(e,(o,s)=>w("option",{key:s,value:o},J(o),9,jv)),64))],512),[[Hu,v(t)]]),w("pre",Hv,[w("code",null,[q(v(Hb))])])])]),_:1}))}}),qv=Object.assign(Wv,{__name:"TiptapCodeBlock"});function Kv(n,e){return function({content:r,language:i,pos:o,size:s}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=n.codeToTokens(r,{lang:i,theme:n.getLoadedThemes()[0]}),f=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(f){const h=$e.node(o,o+s,{style:f});a.push(h)}let p=o+1;for(const h of l){for(const m of h){const g=p+m.content.length,b=$e.inline(p,g,{style:Uv(m.htmlStyle??`color: ${m.color}`),class:"shiki"});a.push(b),p=g}p+=1}return a}}function Uv(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}let fo;const Jv=n=>{const e=n.language??"text",{highlighter:t,promise:r}=Wu(e);return t?(fo||(fo=Kv(t)),fo(n)):r??[]},Gv=Lv.extend({addOptions(){return{...this.parent?.(),defaultLanguage:null}},addProseMirrorPlugins(){return[Vv({parser:Jv,nodeTypes:["codeBlock"]})]},addNodeView(){return Jb(qv)}}),Yv={flex:"~ gap3","items-center":"","text-base":""},Xv=["src"],Qv={shrink:"","overflow-hidden":"","leading-none":"","text-base":""},Zv=me({__name:"SearchEmojiInfo",props:{emoji:{}},setup(n){return(e,t)=>
93(T(),I("div",Yv,[w("img",{width:"20",height:"20",src:n.emoji.src,loading:"lazy"},null,8,Xv),w("span",Qv,[t[0]||(t[0]=w("span",{"text-secondary":""},":",-1)),gr(J(n.emoji.title),1),t[1]||(t[1]=w("span",{"text-secondary":""},":",-1))])]))}}),e0=Object.assign(Zv,{__name:"SearchEmojiInfo"}),t0={key:0,relative:"","bg-base":"","text-base":"",shadow:"",border:"~ base rounded","text-sm":"","py-2":"","overflow-x-hidden":"","overflow-y-auto":"","max-h-100":"","min-w-40":"","max-w-50":""},n0={key:0,flex:"","gap-1":"","items-center":"",p2:"","animate-pulse":""},r0={key:1},i0=me({__name:"TiptapEmojiList",props:{items:{},command:{type:Function},isPending:{type:Boolean}},setup(n,{expose:e}){const t=te(()=>n.items.map(s=>{if(Au(s))return{title:s.shortcode,src:s.url,emoji:s};const a=s.skins.find(u=>u.native!==void 0),l=qu(gl,a.native)[0],c=Ku(l);return{title:s.id,src:`/emojis/${Uu}/${c.filename}`,emoji:s}})),r=ae(0);jn(()=>n.items,()=>{r.value=0});function i(s){return n.items.length===0?!1:s.key==="ArrowUp"?(r.value=(r.value+n.items.length-1)%n.items.length,!0):s.key==="ArrowDown"?(r.value=(r.value+1)%n.items.length,!0):s.key==="Enter"?(o(r.value),!0):!1}function o(s){const a=t.value[s];a&&n.command(a)}return e({onKeyDown:i}),(s,a)=>{const l=e0,c=Ho;return n.isPending||n.items.length?(T(),I("div",t0,[n.isPending?(T(),I("div",n0,[a[0]||(a[0]=w("div",{"i-ri:loader-2-line":"","animate-spin":""},null,-1)),w("span",null,J(s.$t("common.fetching")),1)])):Q("",!0),n.items.length?(T(!0),I(fe,{key:1},De(v(t),(u,d)=>(T(),ne(c,{key:d,active:d===v(r),as:"button",class:Ae(d===v(r)?"bg-active":"text-secondary"),block:"",m0:"","w-full":"","text-left":"",px2:"",py1:"",onClick:f=>o(d)},{default:V(()=>[q(l,{emoji:u},null,8,["emoji"])]),_:2},1032,["active","class","onClick"]))),128)):Q("",!0)])):(T(),I("div",r0))}}}),o0=Object.assign(i0,{__name:"TiptapEmojiList"}),s0={key:0,relative:"","bg-base":"","text-base":"",shadow:"",border:"~ base rounded","text-sm":"","py-2":"","overflow-x-hidden":"","overflow-y-auto":"","max-h-100":""},a0={key:0,flex:"","gap-1":"","items-center":"",p2:"","animate-pulse":""},l0={key:1},c0=me({__name:"TiptapHashtagList",props:{items:{},command:{type:Function},isPending:{type:Boolean}},setup(n,{expose:e}){const t=ae(0);jn(()=>n.items,()=>{t.value=0});function r(o){return n.items.length===0?!1:o.key==="ArrowUp"?(t.value=(t.value+n.items.length-1)%n.items.length,!0):o.key==="ArrowDown"?(t.value=(t.value+1)%n.items.length,!0):o.key==="Enter"?(i(t.value),!0):!1}function i(o){const s=n.items[o];s&&n.command({id:s.name})}return e({onKeyDown:r}),(o,s)=>{const a=kd,l=Ho;return n.isPending||n.items.length?(T(),I("div",s0,[n.isPending?(T(),I("div",a0,[s[0]||(s[0]=w("div",{"animate-spin":"","preserve-3d":""},[w("div",{"i-ri:loader-2-line":""})],-1)),w("span",null,J(o.$t("common.fetching")),1)])):Q("",!0),n.items.length?(T(!0),I(fe,{key:1},De(n.items,(c,u)=>(T(),ne(l,{key:u,active:u===v(t),as:"button",class:Ae(u===v(t)?"bg-active":"text-secondary"),block:"",m0:"","w-full":"","text-left":"",px2:"",py1:"",onClick:d=>i(u)},{default:V(()=>[q(a,{hashtag:c},null,8,["hashtag"])]),_:2},1032,["active","class","onClick"]))),128)):Q("",!0)])):(T(),I("div",l0))}}}),u0=Object.assign(c0,{__name:"TiptapHashtagList"}),d0={key:0,relative:"","bg-base":"","text-base":"",shadow:"",border:"~ base rounded","text-sm":"","py-2":"","overflow-x-hidden":"","overflow-y-auto":"","max-h-100":""},f0={key:0,flex:"","gap-1":"","items-center":"",p2:"","animate-pulse":""},p0={key:1},h0=me({__name:"TiptapMentionList",props:{items:{},command:{type:Function},isPending:{type:Boolean}},setup(n,{expose:e}){const t=ae(0);jn(()=>n.items,()=>{t.value=0});function r(o){return n.items.length===0?!1:o.key==="ArrowUp"?(t.value=(t.value+n.items.length-1)%n.items.length,!0):o.key==="ArrowDown"?(t.value=(t.value+1)%n.items.length,!0):o.key==="Enter"?(i(t.value),!0):!1}function i(o){const s=n.items[o];s&&n.command({id:s.acct})}return e({onKeyDown:r}),(o,s)=>{const a=Ju,l=Ho;return n.isPending||n.items.length?(T(),I("div",d0,[n.isPending?(T(),I("div",f0,[s[0]||(s[0]=w("div",{"animate-spin":"","preserve-3d":""},[w("div",{"i-ri:loader-2-line":""})],-1)),w("span",null,J(o.$t("common.fetching")),1)])):Q("",!0),n.items.length?(T(!0),I(fe,{key:1},De(n.items,(c,u)=>(T(),ne(l,{key:u,active:u===v(t),as:"button",class:Ae(u===v(t)?"bg-active":"text-secondary"),block:"",m0:"","w-full":"","text-left":"",px2:"",py1:"",onClick:d=>i(u)},{default:V(()=>[q(a,{account:c},null,8,["account"])]),_:2},1032,["active","class","onClick"]))),128)):Q("",!0)])):(T(),I("div",p0))}}}),m0=Object.assign(h0,{__name:"TiptapMentionList"});function Au(n){return!!n.custom}const g0={pluginKey:new Te("mention"),char:"@",async items({query:n}){return n.length===0?[]:(await yl().v2.search.list({q:n,type:"accounts",limit:25,resolve:!0}).values().next()).value?.accounts??[]},render:ks(m0)},y0={pluginKey:new Te("hashtag"),char:"#",async items({query:n}){return n.length===0?[]:(await yl().v2.search.list({q:n,type:"hashtags",limit:25,resolve:!1,excludeUnreviewed:!0}).values().next()).value?.hashtags??[]},render:ks(u0)},b0={pluginKey:new Te("emoji"),char:":",async items({query:n}){if(n.length===0)return[];Ms.value.emojis.length===0&&await ll();const e=n.toLowerCase(),{data:t}=await Gu("emoji-data",()=>se(()=>import("./48B9X9Wg.js"),[],import.meta.url).then(o=>o.default)),r=Object.values(t.value?.emojis||[]).filter(({id:o})=>o.toLowerCase().startsWith(e)),i=Ms.value.emojis.filter(o=>o.shortcode.toLowerCase().startsWith(e)).map(o=>({...o,custom:!0}));return[...r,...i]},command:({editor:n,props:e,range:t})=>{const r=e.emoji;if(n.commands.deleteRange(t),Au(r))n.commands.insertCustomEmoji({title:r.shortcode,src:r.url});else{const i=r.skins.find(o=>o.native!==void 0);i&&n.commands.insertEmoji(i.native)}},render:ks(o0)};function ks(n){return()=>{let e,t;return{onStart(r){e=new wu(n,{props:r,editor:r.editor}),r.clientRect&&(t=Br(document.body,{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.renderedComponent.el,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onBeforeUpdate:r=>{r.editor.isFocused&&e.updateProps({...r,isPending:!0})},onUpdate(r){r.editor.isFocused&&(e.updateProps({...r,isPending:!1}),r.clientRect&&t?.setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){return r.event.key==="Escape"?(t?.hide(),!0):e?.ref?.onKeyDown(r.event)},onExit(){t?.destroy(),e?.destroy()}}}}function v0(n){const{autofocus:e,content:t,placeholder:r}=n,i=qb({content:t.value,extensions:[av,Ev,lv,rv,Sv,sv,Dv,Rv,Iv.configure({inline:!0,HTMLAttributes:{class:"custom-emoji"}}),uo.configure({renderHTML({options:o,node:s}){return["span",{"data-type":"mention","data-id":s.attrs.id},`${o.suggestion.char}${s.attrs.label??s.attrs.id}`]},suggestion:g0}),uo.extend({name:"hashtag"}
93).configure({renderHTML({options:o,node:s}){return["span",{"data-type":"hashtag","data-id":s.attrs.id},`${o.suggestion.char}${s.attrs.label??s.attrs.id}`]},suggestion:y0}),uo.extend({name:"emoji"}).configure({suggestion:b0}),Av.configure({placeholder:()=>r.value}),Gv,bv.configure({depth:10}),qe.create({name:"api",addKeyboardShortcuts(){return{"Mod-Enter":()=>(n.onSubmit(),!0)}},onFocus(){n.onFocus()},addProseMirrorPlugins(){return[new Re({props:{handleDOMEvents:{paste(o,s){n.onPaste(s)}}}})]}})],onUpdate({editor:o}){t.value=o.getHTML()},editorProps:{attributes:{class:"content-editor content-rich"}},parseOptions:{preserveWhitespace:"full"},autofocus:e,editable:!0});return jn(t,o=>{i.value?.getHTML()!==o&&i.value?.commands.setContent(o||"",!1)}),jn(r,()=>{i.value?.view.dispatch(i.value?.state.tr)}),{editor:i}}const x0=cd(Vd),k0={key:0,flex:"~ col gap-4",py3:"",px2:"","sm:px4":"","aria-roledescription":"publish-widget"},w0={key:0,id:"state-editing","text-secondary":"","self-center":""},S0={flex:"","gap-3":"","flex-1":""},C0={key:0,"w-full":"","h-full":"",flex:"","mt--3px":"","justify-center":""},M0={"w-full":""},T0={flex:"","gap-3":"","flex-1":""},O0=["onClick"],E0={key:1},A0=["placeholder"],D0={id:"publish-failed",flex:"","justify-between":""},N0={flex:"","items-center":"","gap-x-2":"","font-bold":""},I0=["aria-label"],P0={"ps-2":"","sm:ps-1":""},R0={id:"publish-failed",flex:"","justify-between":""},_0={flex:"","items-center":"","gap-x-2":"","font-bold":""},$0=["aria-label"],L0={"ps-2":"","sm:ps-1":""},B0={id:"scheduled-time-invalid",flex:"","justify-between":""},V0={flex:"","items-center":"","gap-x-2":"","font-bold":""},z0={key:5,flex:"","gap-1":"","items-center":"","text-sm":"",p1:"","text-primary":""},F0={id:"upload-failed",flex:"","justify-between":""},j0={flex:"","items-center":"","gap-x-2":"","font-bold":""},H0=["aria-label"],W0={key:0,id:"uploads-per-post","ps-2":"","sm:ps-1":"","text-small":""},q0={"ps-2":"","sm:ps-1":""},K0={key:7,flex:"~ col gap-2","overflow-auto":""},U0={flex:"~ col 1","max-w-full":""},J0={key:0,"my-4":"",flex:"~ 1 col","gap-3":"",m:"s--1"},G0=["value","placeholder","onInput"],Y0=["disabled","onClick"],X0={flex:"","justify-end":"","mt-2":""},Q0=["aria-label"],Z0={key:0,border:"~ base 1","rounded-lg":"","overflow-hidden":"","my-3":""},e1={key:1,"text-danger":"",border:"base 1","rounded-lg":"","hover:bg-active":"","my-3":"","p-3":""},t1={key:2,flex:"~ gap-1 1 wrap",m:"s--1","pt-2":"",justify:"end","max-w-full":"",border:"t base"},n1=["title","aria-label"],r1=["aria-label"],i1=["aria-label"],o1={key:1,"rounded-full":"","b-1":"","border-dark":"",flex:"~ row","gap-1":""},s1=["aria-label"],a1=["aria-label"],l1={flex:"~ col","gap-1":"","p-2":""},c1=["aria-label"],u1=["aria-label"],d1=["min"],f1=["aria-label"],p1={key:0,"text-secondary":"","text-sm":"",ml1:""},h1={key:1,"i-ri:translate-2":""},m1=["aria-label"],g1={key:0,"i-ri:alarm-warning-fill":"","text-orange":""},y1={key:1,"i-ri:alarm-warning-line":""},b1=["disabled","aria-label"],v1={key:0,"i-ri:arrow-down-s-line":"","text-sm":"","text-secondary":"","me--1":""},x1=["disabled","aria-label"],k1={key:0,"i-ri:arrow-down-s-line":"","text-sm":"","text-secondary":"","me--1":""},w1={"btn-danger":"","rounded-3":"","text-sm":"","w-full":"",flex:"~ gap1","items-center":"","md:w-fit":"","aria-describedby":"publish-failed-tooltip"},S1=["aria-disabled","disabled"],C1={key:0,block:"","animate-spin":"","preserve-3d":""},M1={key:1,block:""},T1={key:2},O1={key:0},E1={key:1},A1={key:2},D1={key:3},N1=2,I1=me({__name:"PublishWidget",props:{draftKey:{},draftItemIndex:{},initial:{type:Function,default:Fo},threadComposer:{},placeholder:{},inReplyToId:{},inReplyToVisibility:{},expanded:{type:Boolean,default:!1},dialogLabelledBy:{}},emits:["published"],async setup(n,{expose:e,emit:t}){let r,i;const o=t,{t:s}=Ir(),{threadItems:a,threadIsActive:l,publishThread:c,threadIsSending:u}=n.threadComposer??Wo(n.draftKey),d=te({get:()=>a.value[n.draftItemIndex],set:x=>{a.value[n.draftItemIndex]=x}}),f=te(()=>n.draftItemIndex===a.value.length-1),{isExceedingAttachmentLimit:p,isUploading:h,failedAttachments:m,isOverDropZone:g,uploadAttachments:b,pickAttachments:A,setDescription:S,removeAttachment:y,dropZoneRef:D}=of(d),{shouldExpanded:C,isExpanded:N,isSending:E,isPublishDisabled:$,publishDraft:F,failedMessages:W,preferredLanguage:B,publishSpoilerText:H}=xl({draftItem:d,expanded:Yu(()=>n.expanded),isUploading:h,initialDraft:n.initial,isPartOfThread:!1}),{editor:Z}=v0({content:te({get:()=>d.value.params.status,set:x=>{d.value.params.status=x,d.value.lastUpdated=Date.now()}}),placeholder:te(()=>n.placeholder??d.value.params.inReplyToId?s("placeholder.replying"):s("placeholder.default_1")),autofocus:C.value,onSubmit:ct,onFocus(){!N&&d.value.initialText&&(Z.value?.chain().insertContent(`${d.value.initialText} `).focus("end").run(),d.value.initialText=""),N.value=!0},onPaste:en});function ce(){const x=d.value.params.poll.options.findLastIndex(ze=>ze.trim().length>0),M=d.value.params.poll.options.slice(0,x+1);Ne.value?.configuration&&M.length>=Ne.value?.configuration?.polls.maxOptions?d.value.params.poll.options=M:d.value.params.poll.options=[...M,""]}function oe(x,M){d.value.params.poll.options=Object.assign(d.value.params.poll.options.slice(),{[M]:x.target.value}),ce()}function le(x){const M=d.value.params.poll.options.slice();
93M.splice(x,1),d.value.params.poll.options=M,ce()}const ie=te(()=>[{seconds:3600,label:s("time_ago_options.hour_future",1)},{seconds:7200,label:s("time_ago_options.hour_future",2)},{seconds:1440*60,label:s("time_ago_options.day_future",1)},{seconds:2880*60,label:s("time_ago_options.day_future",2)},{seconds:10080*60,label:s("time_ago_options.day_future",7)}]),ee=ae(""),Oe=ld({interval:1e3}),he=te(()=>ke(Oe.value)),xe=te(()=>{if(ee.value==="")return!0;const x=new Date(ee.value);return he.value.getTime()<=x.getTime()}),_e=te(()=>{const x=new Date(he.value.getTime());return x.setHours(x.getHours()+1),x.setMinutes(0),x.setSeconds(0),x.setMilliseconds(0),x});Jr(()=>{if(ee.value){const x=new Date(ee.value);d.value.params.scheduledAt=x.toISOString()}else d.value.params.scheduledAt=""});function Ke(){ee.value===""&&(ee.value=Qe(_e.value))}Jr(()=>{d.value.params.scheduledAt=ee.value});function ke(x){const ze=Math.floor(x.getTime()/1e3),k=Math.ceil((ze+305)/60)*60;return new Date(k*1e3)}function Qe(x){const M=x.getFullYear(),ze=(x.getMonth()+1).toString().padStart(2,"0"),k=x.getDate().toString().padStart(2,"0"),P=x.getHours().toString().padStart(2,"0"),_=x.getMinutes().toString().padStart(2,"0");return`${M}-${ze}-${k}T${P}:${_}`}const Rt=/(https?:\/\/|xmpp:)\S+/g,at=/(^|[^/\w])@((\w+)@[a-z0-9.-]+[a-z0-9])/gi,xt=te(()=>{const x=po(Z.value?.getHTML()||"");let M=tl(x);const ze=23;for(const[k]of x.matchAll(Rt))M-=k.length-Math.min(ze,k.length);for(const[k,P,_,Y]of x.matchAll(at))M-=k.length-(P+Y).length-1;return d.value.mentions&&(M+=d.value.mentions.map(k=>{const[P]=k.split("@");return`@${P}`}).join(" ").length+1),M+=tl(H.value),M}),Ue=te(()=>xt.value>Os.value),kt=te(()=>Gr.find(x=>x.code===(d.value.params.language||B.value))?.nativeName),Mn=te(()=>d.value.params.visibility==="direct"),wt=te(()=>!!d.value.params.quotedStatusId),St=ae(null),Ct=ae(null);Jr(async()=>{if(wt.value)try{St.value=await Xu(d.value.params.quotedStatusId)}catch(x){Ct.value=x.message}});function Zt(){d.value.params.quotedStatusId=void 0,d.value.params.quoteApprovalPolicy=void 0,St.value=null,Ct.value=null}async function en(x){const M=x.clipboardData?.files;!M||M.length===0||(x.preventDefault(),await b([...M]))}function Tn(x){Z.value?.chain().focus().insertEmoji(x).run()}function On(x){Z.value?.chain().focus().insertCustomEmoji(x).run()}async function lt(){d.value.params.sensitive=!d.value.params.sensitive}async function ct(){if($.value||Ue.value)return;const x=await(l.value?c():F());x&&(Array.isArray(x)?W.value=x:o("published",x))}wd(async({data:{data:x,action:M}})=>{if(M==="compose-with-shared-data"){Z.value?.commands.focus("end");for(const ze of x.textParts)for(const k of ze.split(` 94`))Z.value?.commands.insertContent({type:"paragraph",content:[{type:"text",text:k}]});x.files.length!==0&&await b(x.files)}}),e({focusEditor:()=>{Z.value?.commands?.focus?.()}});function tn(x){x.key==="?"&&x.stopImmediatePropagation()}const Mt=zo(),nn=te(()=>sd(Mt.value,"optimizeForLowPerformanceDevice")),rn="LanguageDetector"in globalThis;let _t=!nn.value&&rn&&([r,i]=Qu(()=>globalThis.LanguageDetector.availability()),r=await r,i(),r==="available"),Tt;rn&&!_t&&globalThis.LanguageDetector.create().then(x=>{_t=!0,Tt=x});function En(x){return[...new Intl.Segmenter("und",{granularity:"grapheme"}).segment(x)].length}let Zn=new AbortController;const _i=ad(async()=>{if(!_t)return;Tt||(Tt=await globalThis.LanguageDetector.create()),Zn.abort(),Zn=new AbortController;const x=po(Z.value?.getHTML()||"");if(!x||En(x)<=5){d.value.params.language=B.value;return}try{const M=(await Tt.detect(x,{signal:Zn.signal}))[0].detectedLanguage;d.value.params.language=M==="und"?B.value:M.substring(0,2)}catch(M){M.name,d.value.params.language=B.value}},500);return(x,M)=>{const ze=td,k=Zu,P=nd,_=Xn,Y=hd,X=$d,we=gd,Fe=bd,$t=x0,er=vd,Ze=jo,tr=yi,An=Kd,Lt=vl,$i=Qd,nr=ef,Dn=rf,Du=pf;return("isHydrated"in x?x.isHydrated:v(bl))&&("currentUser"in x?x.currentUser:v(lr))?(T(),I("div",k0,[v(d).editingStatus?(T(),I("div",w0,J(x.$t("state.editing")),1)):Q("",!0),w("div",S0,[w("div",null,[q(k,{"self-start":"",to:("getAccountRoute"in x?x.getAccountRoute:v(ed))(("currentUser"in x?x.currentUser:v(lr)).account)},{default:V(()=>[q(ze,{account:("currentUser"in x?x.currentUser:v(lr)).account,square:""},null,8,["account"])]),_:1},8,["to"]),v(f)?Q("",!0):(T(),I("div",C0,[...M[14]||(M[14]=[w("div",{"w-1px":"",border:"x base","mb-6":""},null,-1)])]))]),w("div",M0,[w("div",T0,[w("div",{ref_key:"dropZoneRef",ref:D,flex:"","w-0":"","flex-col":"","gap-3":"","flex-1":"",border:"2 dashed transparent",class:Ae([v(E)?"pointer-events-none":"",v(g)?"!border-primary":""])},[v(d).mentions?.length&&v(C)?(T(),ne(P,{key:0,replying:""},{default:V(()=>[(T(!0),I(fe,null,De(v(d).mentions,(j,ue)=>(T(),I("button",{key:j,"text-primary":"","hover:color-red":"",onClick:Nn=>
94v(d).mentions?.splice(ue,1)},J(("accountToShortHandle"in x?x.accountToShortHandle:v(rd))(j)),9,O0))),128))]),_:1})):Q("",!0),v(d).params.sensitive?(T(),I("div",E0,[yr(w("input",{"onUpdate:modelValue":M[0]||(M[0]=j=>Fn(H)?H.value=j:null),type:"text",placeholder:x.$t("placeholder.content_warning"),p2:"","border-rounded":"","w-full":"","bg-transparent":"","outline-none":"",border:"~ base"},null,8,A0),[[ti,v(H)]])])):Q("",!0),v(W).length>0?(T(),ne(Y,{key:2,"described-by":"publish-failed"},{default:V(()=>[w("header",D0,[w("div",N0,[M[15]||(M[15]=w("div",{"aria-hidden":"true","i-ri:error-warning-fill":""},null,-1)),w("p",null,J(x.$t("state.publish_failed")),1)]),q(_,{placement:"bottom",content:x.$t("action.clear_publish_failed")},{default:V(()=>[w("button",{flex:"","rounded-4":"",p1:"","hover:bg-active":"","cursor-pointer":"","transition-100":"","aria-label":x.$t("action.clear_publish_failed"),onClick:M[1]||(M[1]=j=>W.value=[])},[...M[16]||(M[16]=[w("span",{"aria-hidden":"true",w:"1.75em",h:"1.75em","i-ri:close-line":""},null,-1)])],8,I0)]),_:1},8,["content"])]),w("ol",P0,[(T(!0),I(fe,null,De(v(W),(j,ue)=>(T(),I("li",{key:ue,flex:"~ col sm:row","gap-y-1":"","sm:gap-x-2":""},[w("strong",null,J(ue+1)+".",1),w("span",null,J(j),1)]))),128))])]),_:1})):Q("",!0),v(W).length>0?(T(),ne(Y,{key:3,"described-by":"publish-failed"},{default:V(()=>[w("header",R0,[w("div",_0,[M[17]||(M[17]=w("div",{"aria-hidden":"true","i-ri:error-warning-fill":""},null,-1)),w("p",null,J(v(ee)?x.$t("state.schedule_failed"):x.$t("state.publish_failed")),1)]),q(_,{placement:"bottom",content:v(ee)?x.$t("action.clear_schedule_failed"):x.$t("action.clear_publish_failed")},{default:V(()=>[w("button",{flex:"","rounded-4":"",p1:"","hover:bg-active":"","cursor-pointer":"","transition-100":"","aria-label":v(ee)?x.$t("action.clear_schedule_failed"):x.$t("action.clear_publish_failed"),onClick:M[2]||(M[2]=j=>W.value=[])},[...M[18]||(M[18]=[w("span",{"aria-hidden":"true",w:"1.75em",h:"1.75em","i-ri:close-line":""},null,-1)])],8,$0)]),_:1},8,["content"])]),w("ol",L0,[(T(!0),I(fe,null,De(v(W),(j,ue)=>(T(),I("li",{key:ue,flex:"~ col sm:row","gap-y-1":"","sm:gap-x-2":""},[w("strong",null,J(ue+1)+".",1),w("span",null,J(j),1)]))),128))])]),_:1})):Q("",!0),v(xe)?Q("",!0):(T(),ne(Y,{key:4,"described-by":"scheduled-time-invalid","pt-2":""},{default:V(()=>[w("header",B0,[w("div",V0,[M[19]||(M[19]=w("div",{"aria-hidden":"true","i-ri:error-warning-fill":""},null,-1)),w("p",null,J(x.$t("state.schedule_time_invalid",[v(he).toLocaleString()])),1)])])]),_:1})),w("div",{relative:"","flex-1":"",flex:"","flex-col":"",class:Ae(v(C)?"min-h-30":"")},[q(v(jb),{editor:v(Z),flex:"","max-w-full":"",class:Ae({"md:max-h-[calc(100vh-200px)] sm:max-h-[calc(100vh-400px)] max-h-35 of-y-auto overscroll-contain":v(C),"py2 px3.5 bg-dm rounded-4 me--1 ms--1 mt--1":v(Mn)}),onKeydown:[tn,M[3]||(M[3]=id(Ts(j=>v(Z)?.commands.blur(),["prevent"]),["esc"]))],onKeyup:v(_i)},null,8,["editor","class","onKeyup"])],2),v(h)?(T(),I("div",z0,[M[20]||(M[20]=w("div",{"animate-spin":"","preserve-3d":""},[w("div",{"i-ri:loader-2-fill":""})],-1)),gr(" "+J(x.$t("state.uploading")),1)])):v(m).length>0?(T(),ne(Y,{key:6,"described-by":v(p)?"upload-failed uploads-per-post":"upload-failed"},{default:V(()=>[w("header",F0,[w("div",j0,[M[21]||(M[21]=w("div",{"aria-hidden":"true","i-ri:error-warning-fill":""},null,-1)),w("p",null,J(x.$t("state.upload_failed")),1)]),q(_,{placement:"bottom",content:x.$t("action.clear_upload_failed")},{default:V(()=>[w("button",{flex:"","rounded-4":"",p1:"","hover:bg-active":"","cursor-pointer":"","transition-100":"","aria-label":x.$t("action.clear_upload_failed"),onClick:M[4]||(M[4]=j=>m.value=[])},[...M[22]||(M[22]=[w("span",{"aria-hidden":"true",w:"1.75em",h:"1.75em","i-ri:close-line":""},null,-1)])],8,H0)]),_:1},8,["content"])]),v(p)?(T(),I("div",W0,J(x.$t("state.attachments_exceed_server_limit")),1)):Q("",!0),w("ol",q0,[(T(!0),I(fe,null,De(v(m),j=>(T(),I("li",{key:j[0],flex:"~ col sm:row","gap-y-1":"","sm:gap-x-2":""},[w("strong",null,J(j[1])+":",1),w("span",null,J(j[0]),1)]))),128))])]),_:1},8,["described-by"])):Q("",!0),v(d).attachments.length?(T(),I("div",K0,[(T(!0),I(fe,null,De(v(d).attachments,(j,ue)=>(T(),ne(X,{key:j.id,attachment:j,"dialog-labelled-by":n.dialogLabelledBy??(v(d).editingStatus?"state-editing":void 0),onRemove:Nn=>v(y)(ue),onSetDescription:Nn=>
94v(S)(j,Nn)},null,8,["attachment","dialog-labelled-by","onRemove","onSetDescription"]))),128))])):Q("",!0)],2)]),w("div",U0,[v(N)&&v(d).params.poll?(T(),I("form",J0,[(T(!0),I(fe,null,De(v(d).params.poll.options,(j,ue)=>(T(),I("div",{key:ue,flex:"~ row","gap-3":""},[w("input",{value:j,"bg-base":"",border:"~ base","flex-1":"",h10:"","pe-4":"","rounded-2":"","w-full":"",flex:"~ row","items-center":"",relative:"","focus-within:box-shadow-outline":"","gap-3":"","px-4":"","py-2":"",placeholder:x.$t("polls.option_placeholder",{current:ue+1,max:("currentInstance"in x?x.currentInstance:v(Ne))?.configuration?.polls.maxOptions}),class:"option-input",onInput:Nn=>oe(Nn,ue)},null,40,G0),q(_,{placement:"top",content:x.$t("polls.remove_option"),class:"delete-button"},{default:V(()=>[w("button",{"btn-action-icon":"",class:"hover:bg-red/75",disabled:ue===v(d).params.poll.options.length-1&&(ue+1!==("currentInstance"in x?x.currentInstance:v(Ne))?.configuration?.polls.maxOptions||v(d).params.poll.options[ue].length===0),onClick:Ts(Nn=>le(ue),["prevent"])},[...M[23]||(M[23]=[w("div",{"i-ri:delete-bin-line":""},null,-1)])],8,Y0)]),_:2},1032,["content"]),("currentInstance"in x?x.currentInstance:v(Ne))?.configuration?.polls.maxCharactersPerOption?(T(),I("span",{key:0,class:"char-limit-radial","aspect-ratio-1":"","h-10":"",style:od({background:`radial-gradient(closest-side, rgba(var(--rgb-bg-base)) 79%, transparent 80% 100%), conic-gradient(${v(d).params.poll.options[ue].length/("currentInstance"in x?x.currentInstance:v(Ne))?.configuration?.polls.maxCharactersPerOption>1?"var(--c-danger)":"var(--c-primary)"} ${v(d).params.poll.options[ue].length/("currentInstance"in x?x.currentInstance:v(Ne))?.configuration?.polls.maxCharactersPerOption*100}%, var(--c-primary-fade) 0)`})},J(v(d).params.poll.options[ue].length),5)):Q("",!0)]))),128))])):Q("",!0),v(wt)?(T(),I(fe,{key:1},[w("div",X0,[w("button",{"text-sm":"","px-2":"","py-1":"","rounded-3":"","hover:bg-gray-300":"",flex:"~ gap1","items-center":"","aria-label":x.$t("action.remove_quote"),onClick:Zt},[M[24]||(M[24]=w("div",{"i-ri:close-line":""},null,-1)),gr(" "+J(x.$t("action.remove_quote")),1)],8,Q0)]),v(St)?(T(),I("blockquote",Z0,[q(we,{status:v(St),actions:!1,"is-nested":!0},null,8,["status"])])):v(Ct)?(T(),I("div",e1,J(x.$t("error.quote_fetch_error"))+" ("+J(v(Ct))+") ",1)):(T(),ne(Fe,{key:2,border:"base 1","rounded-lg":"","hover:bg-active":"","my-3":""}))],64)):Q("",!0),v(C)?(T(),I("div",t1,[q($t,{onSelect:Tn,onSelectCustom:On},{default:V(()=>[w("button",{"btn-action-icon":"",title:x.$t("tooltip.emojis"),"aria-label":x.$t("tooltip.add_emojis")},[...M[25]||(M[25]=[w("div",{"i-ri:emotion-line":""},null,-1)])],8,n1)]),_:1}),v(d).params.poll===void 0?(T(),ne(_,{key:0,placement:"top",content:x.$t("tooltip.add_media")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":x.$t("tooltip.add_media"),onClick:M[5]||(M[5]=(...j)=>v(A)&&v(A)(...j))},[...M[26]||(M[26]=[w("div",{"i-ri:image-add-line":""},null,-1)])],8,r1)]),_:1},8,["content"])):Q("",!0),v(d).attachments.length===0?(T(),I(fe,{key:1},[v(d).params.poll?(T(),I("div",o1,[q(_,{placement:"top",content:x.$t("polls.cancel")},{default:V(()=>[w("button",{"btn-action-icon":"","b-r":"","border-dark":"","aria-label":x.$t("polls.cancel"),onClick:M[7]||(M[7]=j=>v(d).params.poll=void 0)},[...M[28]||(M[28]=[w("div",{"i-ri:close-line":""},null,-1)])],8,s1)]),_:1},8,["content"]),q(Ze,{placement:"top"},{popper:V(()=>[w("div",l1,[q(er,{modelValue:v(d).params.poll.multiple,"onUpdate:modelValue":M[8]||(M[8]=j=>v(d).params.poll.multiple=j),label:v(d).params.poll.multiple?x.$t("polls.disallow_multiple"):x.$t("polls.allow_multiple"),"px-2":"","gap-3":"","h-9":"",flex:"","justify-center":"","hover:bg-active":"","rounded-full":"","icon-checked":"i-ri:checkbox-multiple-blank-line","icon-unchecked":"i-ri:checkbox-blank-circle-line"},null,8,["modelValue","label"]),q(er,{modelValue:v(d).params.poll.hideTotals,"onUpdate:modelValue":M[9]||(M[9]=j=>v(d).params.poll.hideTotals=j),label:v(d).params.poll.hideTotals?x.$t("polls.show_votes"):x.$t("polls.hide_votes"),"px-2":"","gap-3":"","h-9":"",flex:"","justify-center":"","hover:bg-active":"","rounded-full":"","icon-checked":"i-ri:eye-close-line","icon-unchecked":"i-ri:eye-line"},null,8,["modelValue","label"])])]),default:V(()=>[q(_,{placement:"top",content:x.$t("polls.settings")},{default:V(()=>[w("button",{"aria-label":x.$t("polls.settings"),"btn-action-icon":"","w-12":""}
94,[...M[29]||(M[29]=[w("div",{"i-ri:list-settings-line":""},null,-1),w("div",{"i-ri:arrow-down-s-line":"","text-sm":"","text-secondary":"","me--1":""},null,-1)])],8,a1)]),_:1},8,["content"])]),_:1}),q(Ze,{placement:"bottom"},{popper:V(()=>[(T(!0),I(fe,null,De(v(ie),j=>(T(),ne(tr,{key:j.seconds,text:j.label,checked:v(d).params.poll.expiresIn===j.seconds,onClick:ue=>v(d).params.poll.expiresIn=j.seconds},null,8,["text","checked","onClick"]))),128))]),default:V(()=>[q(_,{placement:"top",content:x.$t("polls.expiration")},{default:V(()=>[w("button",{"aria-label":x.$t("polls.expiration"),"btn-action-icon":"","w-12":""},[...M[30]||(M[30]=[w("div",{"i-ri:hourglass-line":""},null,-1),w("div",{"i-ri:arrow-down-s-line":"","text-sm":"","text-secondary":"","me--1":""},null,-1)])],8,c1)]),_:1},8,["content"])]),_:1})])):(T(),ne(_,{key:0,placement:"top",content:x.$t("polls.create")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":x.$t("polls.create"),onClick:M[6]||(M[6]=j=>v(d).params.poll={options:[""],expiresIn:v(ie)[N1].seconds})},[...M[27]||(M[27]=[w("div",{"i-ri:chat-poll-line":""},null,-1)])],8,i1)]),_:1},8,["content"]))],64)):Q("",!0),v(Z)?(T(),ne(An,{key:2,editor:v(Z)},null,8,["editor"])):Q("",!0),q(Ze,{placement:"bottom",onClick:Ke},{popper:V(()=>[yr(w("input",{"onUpdate:modelValue":M[10]||(M[10]=j=>Fn(ee)?ee.value=j:null),p2:"",type:"datetime-local",name:"schedule-datetime",min:Qe(v(he))},null,8,d1),[[ti,v(ee)]])]),default:V(()=>[q(_,{placement:"top",content:x.$t("tooltip.schedule_post"),"no-auto-focus":""},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":x.$t("tooltip.schedule_post")},[w("div",{"i-ri:calendar-schedule-line":"",class:Ae(v(ee)!==""?"text-primary":"")},null,2)],8,u1)]),_:1},8,["content"])]),_:1}),M[35]||(M[35]=w("div",{"flex-auto":""},null,-1)),q(Lt,{max:"characterLimit"in x?x.characterLimit:v(Os),length:v(xt)},null,8,["max","length"]),q(_,{placement:"top",content:x.$t("tooltip.change_language")},{default:V(()=>[q(Ze,{placement:"bottom","auto-boundary-max-size":""},{popper:V(()=>[q($i,{modelValue:v(d).params.language,"onUpdate:modelValue":M[11]||(M[11]=j=>v(d).params.language=j),"min-w-80":""},null,8,["modelValue"])]),default:V(()=>[w("button",{"btn-action-icon":"","aria-label":x.$t("tooltip.change_language"),"w-max":"",mr1:""},[v(kt)?(T(),I("span",p1,J(v(kt)),1)):(T(),I("div",h1)),M[31]||(M[31]=w("div",{"i-ri:arrow-down-s-line":"","text-sm":"","text-secondary":"","me--1":""},null,-1))],8,f1)]),_:1})]),_:1},8,["content"]),q(_,{placement:"top",content:x.$t("tooltip.add_content_warning")},{default:V(()=>[w("button",{"btn-action-icon":"","aria-label":x.$t("tooltip.add_content_warning"),onClick:lt},[v(d).params.sensitive?(T(),I("div",g1)):(T(),I("div",y1))],8,m1)]),_:1},8,["content"]),q(nr,{modelValue:v(d).params.visibility,"onUpdate:modelValue":M[12]||(M[12]=j=>v(d).params.visibility=j),editing:!!v(d).editingStatus},{default:V(({visibility:j})=>[w("button",{disabled:!!v(d).editingStatus,"aria-label":x.$t("tooltip.change_content_visibility"),"btn-action-icon":"",class:Ae({"w-12":!v(d).editingStatus})},[w("div",{class:Ae(j.icon)},null,2),v(d).editingStatus?Q("",!0):(T(),I("div",v1))],10,b1)]),_:1},8,["modelValue","editing"]),v(wt)?(T(),ne(Dn,{key:3,modelValue:v(d).params.quoteApprovalPolicy,"onUpdate:modelValue":M[13]||(M[13]=j=>v(d).params.quoteApprovalPolicy=j),editing:!!v(d).editingStatus},{default:V(({quoteApprovalPolicy:j})=>[w("button",{disabled:!!v(d).editingStatus,"aria-label":x.$t("tooltip.change_content_visibility"),"btn-action-icon":"",class:Ae({"w-12":!v(d).editingStatus})},[w("div",{class:Ae(j.icon)},null,2),v(d).editingStatus?Q("",!0):(T(),I("div",k1))],10,x1)]),_:1},8,["modelValue","editing"])):Q("",!0),q(Du,{"draft-item-index":n.draftItemIndex,"draft-key":n.draftKey},null,8,["draft-item-index","draft-key"]),v(W).length>0?(T(),ne(_,{key:4,id:"publish-failed-tooltip",placement:"top",content:v(ee)?x.$t("state.schedule_failed"):x.$t("tooltip.publish_failed")},{default:V(()=>[w("button",w1,[M[32]||(M[32]=w("span",{block:""},[w("div",{block:"","i-carbon:face-dizzy-filled":""})],-1)),w("span",null,J(v(ee)?x.$t("state.schedule_failed"):x.$t("state.publish_failed")),1)])]),_:1},8,["content"])):(T(),ne(_,{key:5,id:"publish-tooltip",placement:"top",content:x.$t("tooltip.add_publishable_content"),disabled:!(v($)||v(Ue))},{default:V(()=>[!v(l)||v(f)?(T(),I("button",{key:0,"btn-solid":"","rounded-3":"","text-sm":"","w-full":"",flex:"~ gap1","items-center":"","md:w-fit":"",class:"publish-button","aria-disabled":v($)||v(Ue)||v(u)||!v(xe),"aria-describedby":"publish-tooltip",disabled:v($)||v(Ue)||v(u)||!v(xe),onClick:ct},[v(E)||v(u)?(T(),I("span",C1,[...M[33]||(M[33]=[w("div",{block:"","i-ri:loader-2-fill":""},null,-1)])])):Q("",!0),v(W).length?(T(),I("span",M1,[...M[34]||(M[34]=[w("div",{block:"","i-carbon:face-dizzy-filled":""},null,-1)])])):Q("",!0),v(l)?(T(),I("span",T1,J(v(u)?x.$t("state.publishing"):x.$t("action.publish_thread")),1)):(T(),I(fe,{key:3},[v(d).editingStatus?(T(),I("span",O1,J(x.$t("action.save_changes")),1)):v(ee)?(T(),I("span",E1,J(v(E)?x.$t("state.scheduling"):x.$t("action.schedule")),1)):v(d).params.inReplyToId?(T(),I("span",A1,J(x.$t("action.reply")),1)):(T(),I("span",D1,J(v(E)?x.$t("state.publishing"):x.$t("action.publish")),1))],64))],8,S1)):Q("",!0)]),_:1},8,["content","disabled"]))])):Q("",!0)])])])])):Q("",!0)}}}),P1=Object.assign(ud(I1,[["__scopeId","data-v-a0eb1532"]]),{__name:"PublishWidget"}),R1=me({__name:"PublishWidgetList",props:{draftKey:{},initial:{type:Function,default:Fo},placeholder:{},inReplyToId:{},inReplyToVisibility:{},expanded:{type:Boolean,default:!1},dialogLabelledBy:{}},setup(n){const e=Wo(n.draftKey,n.initial),t=te(()=>e.threadItems.value);dd(()=>{fd()});function r(i){return i===0}return(i,o)=>{const s=P1;return("isHydrated"in i?i.isHydrated:v(bl))&&("currentUser"in i?i.currentUser:v(lr))?(T(!0),I(fe,{key:0},De(v(t),(a,l)=>(T(),ne(s,pd({key:`${n.draftKey}-${l}`},{ref_for:!0},i.$attrs,{"thread-composer":v(e),"draft-key":n.draftKey,"draft-item-index":l,expanded:r(l)?n.expanded:!0,placeholder:n.placeholder,"dialog-labelled-by":n.dialogLabelledBy,"in-reply-to-id":r(l)?n.inReplyToId:void 0,"in-reply-to-visibility":n.inReplyToVisibility}
94),null,16,["thread-composer","draft-key","draft-item-index","expanded","placeholder","dialog-labelled-by","in-reply-to-id","in-reply-to-visibility"]))),128)):Q("",!0)}}}),G1=Object.assign(R1,{__name:"PublishWidgetList"});export{G1 as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.