var gg=Object.defineProperty,bg=Object.defineProperties;var yg=Object.getOwnPropertyDescriptors;var lu=Object.getOwnPropertySymbols;var wg=Object.prototype.hasOwnProperty,vg=Object.prototype.propertyIsEnumerable;var au=(i,e,t)=>e in i?gg(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Fe=(i,e)=>{for(var t in e||(e={}))wg.call(e,t)&&au(i,t,e[t]);if(lu)for(var t of lu(e))vg.call(e,t)&&au(i,t,e[t]);return i},qt=(i,e)=>bg(i,yg(e));var tt=(i,e,t)=>new Promise((n,s)=>{var r=a=>{try{l(t.next(a))}catch(c){s(c)}},o=a=>{try{l(t.throw(a))}catch(c){s(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(r,o);l((t=t.apply(i,e)).next())});import{d as Gt,f as ze,c as dt,u as G,h as Ys,w as mt,a6 as vt,_ as it,a7 as Bt,a8 as ft,$ as dn,F as _s,a9 as Gn,G as Vn,a2 as Yn,aa as cn,ab as Hi,ac as Sn,ae as Wi,af as fs,k as rt,a1 as $i,o as Nr,H as kg,a0 as rs,a3 as Bo,ad as Xa,s as Tl,e as xg,J as ea,j as ff,l as Sg,L as Cg,Q as Ag,y as Ir,m as df,A as pf,I as Tg,i as Mg,g as Dg,ap as Og,r as cu,am as Eg,b as Fg}from"./vue-CmlY4eyV.js";import{u as Xi,C as Pg}from"./index-D5QnXKgB.js";import{p as Ee,aJ as ws,b as In,_ as Mn,aF as cs,f as ll,aM as uu,I as hu,z as Ja,i as mf,ak as gf,Z as Bg,c as Rg,O as Ng,aB as fu,s as Ig,t as Lg,ao as $g,x as Bi,aN as yi,an as _g,aO as du,aL as xo,d as bf,aK as zg,aP as Vg}from"./entry/index-CP6zkLsN-1726190694502.js";import{ak as Fs,o as Lr,e as Et,al as Cn,l as hr,am as al,an as zs,ao as Hg,ap as yf,aq as wf,ar as vf,as as $r,at as Qa,au as Wg,n as Kn,av as jg,t as Xs,N as qg,aw as Ug,ax as Kg,_ as kf,ay as Gg,a2 as cl,az as Yg,aA as Xg,a9 as Jg,ad as xf,aB as Qg,aC as Zg,F as Sf,O as Cs,H as Ro,aa as No,f as _i,aD as e0,aE as t0,s as us,aF as pu,d as fr,aG as mu,Z as n0,R as i0}from"./antd-Bp5u6ujY.js";import{b as s0}from"./tree-Cz4SXb17.js";import{u as r0,c as o0}from"./copyTextToClipboard-o-L2h2rZ.js";import{I as l0,B as a0}from"./index-BPgn07DB.js";import{S as c0}from"./index-BAxfTGAN.js";import{S as u0,B as Cf,a as h0,b as f0}from"./index-caYAhZot.js";import{C as d0}from"./index-Ci1vkPDT.js";import{t as Ml}from"./plugin-BdCvh_fX.js";import{b as gu}from"./uuid-BUBnBT7J.js";import{o as p0}from"./onMountedOrActivated-C4hclMrd.js";import{u as m0}from"./index-5JuY20kX.js";function g0(i){return"slot"in i}function b0(i){return!g0(i)}const y0=Gt({name:"ApiRadioGroup",components:{RadioGroup:Fs.Group,RadioButton:Fs.Button,Radio:Fs},props:{api:{type:Function,default:null},params:{type:[Object,String],default:()=>({})},value:{type:[String,Number,Boolean]},isBtn:{type:[Boolean],default:!1},numberToString:Ee.bool,resultField:Ee.string.def(""),labelField:Ee.string.def("label"),valueField:Ee.string.def("value"),immediate:Ee.bool.def(!0)},emits:["options-change","change"],setup(i,{emit:e}){const t=ze([]),n=ze(!1),s=ze(!0),r=ze([]),o=ws(),{t:l}=In(),[a]=Xi(i,"value","change",r),c=dt(()=>{const{labelField:d,valueField:p,numberToString:y}=i;return G(t).reduce((b,m)=>{if(m){const A=m[p];b.push(Fe({label:m[d],value:y?`${A}`:A},Lr(m,[d,p])))}return b},[])});Ys(()=>{i.immediate&&u()}),mt(()=>i.params,()=>{!G(s)&&u()},{deep:!0});function u(){return tt(this,null,function*(){const d=i.api;if(!(!d||!Et(d))){t.value=[];try{n.value=!0;const p=yield d(i.params);if(Array.isArray(p)){t.value=p,h();return}i.resultField&&(t.value=Cn(p,i.resultField)||[]),h()}catch(p){}finally{n.value=!1}}})}function h(){e("options-change",G(c))}function f(...d){r.value=d}return{state:a,getOptions:c,attrs:o,loading:n,t:l,handleClick:f,props:i}}});function w0(i,e,t,n,s,r){const o=vt("RadioButton"),l=vt("Radio"),a=vt("RadioGroup");return it(),Bt(a,cn(i.attrs,{value:i.state,"onUpdate:value":e[0]||(e[0]=c=>i.state=c),"button-style":"solid"}),{default:ft(()=>[(it(!0),dn(_s,null,Gn(i.getOptions,c=>(it(),dn(_s,{key:`${c.value}`},[i.props.isBtn?(it(),Bt(o,{key:0,value:c.value,disabled:c.disabled,onClick:u=>i.handleClick(c)},{default:ft(()=>[Vn(Yn(c.label),1)]),_:2},1032,["value","disabled","onClick"])):(it(),Bt(l,{key:1,value:c.value,disabled:c.disabled,onClick:u=>i.handleClick(c)},{default:ft(()=>[Vn(Yn(c.label),1)]),_:2},1032,["value","disabled","onClick"]))],64))),128))]),_:1},16,["value"])}const v0=Mn(y0,[["render",w0]]),k0=Gt({name:"RadioButtonGroup",components:{RadioGroup:Fs.Group,RadioButton:Fs.Button},props:{value:{type:[String,Number,Boolean]},options:{type:Array,default:()=>[]}},emits:["change"],setup(i){const e=ws(),t=ze([]),[n]=Xi(i,"value","change",t),s=dt(()=>{const{options:o}=i;return!o||(o==null?void 0:o.length)===0?[]:o.some(a=>hr(a))?o.map(a=>({label:a,value:a})):o});function r(...o){t.value=o}return{state:n,getOptions:s,attrs:e,handleClick:r}}});function x0(i,e,t,n,s,r){const o=vt("RadioButton"),l=vt("RadioGroup");return it(),Bt(l,cn(i.attrs,{value:i.state,"onUpdate:value":e[0]||(e[0]=a=>i.state=a),"button-style":"solid"}),{default:ft(()=>[(it(!0),dn(_s,null,Gn(i.getOptions,a=>(it(),Bt(o,{key:`${a.value}`,value:a.value,disabled:a.disabled,onClick:c=>i.handleClick(a)},{default:ft(()=>[Vn(Yn(a.label),1)]),_:2},1032,["value","disabled","onClick"]))),128))]),_:1},16,["value"])}const S0=Mn(k0,[["render",x0]]),C0=Gt({name:"ApiSelect",components:{Select:al,LoadingOutlined:zs},inheritAttrs:!1,props:{value:{type:[Array,Object,String,Number]},numberToString:Ee.bool,api:{type:Function,default:null},params:Ee.any.def({}),resultField:Ee.string.def(""),labelField:Ee.string.def("label"),valueField:Ee.string.def("value"),immediate:Ee.bool.def(!0),alwaysLoad:Ee.bool.def(!1),options:{type:Array,default:[]},isSearch:Ee.bool.def(!1),searchField:Ee.string},emits:["options-change","change","update:value"],setup(i,{emit:e}){const t=ze([]),n=ze(!1),s=ze(!1),r=ze([]),o=ws(),{t:l}=In(),a=i.isSearch,c=ze();a&&(c.value=d);const[u]=Xi(i,"value","change",r),h=dt(()=>{const{labelField:m,valueField:A,numberToString:v}=i;let F=G(t).reduce((D,E)=>{if(E){const P=Cn(E,A);D.push(qt(Fe({},Lr(E,[m,A])),{label:Cn(E,m),value:v?`${P}`:P}))}return D},[]);return F.length>0?F:i.options});mt(()=>u.value,m=>{e("update:value",m)}),mt(()=>i.params,()=>{a==!1&&!G(s)&&f()},{deep:!0,immediate:i.immediate});function f(){return tt(this,null,function*(){const m=i.api;if(!(!m||!Et(m)||n.value)){t.value=[];try{n.value=!0;const A=yield m(i.params);if(s.value=!0,Array.isArray(A)){t.value=A,y();return}i.resultField&&(t.value=Cn(A,i.resultField)||[]),y()}catch(A){}finally{n.value=!1,s.value=!1}}})}function d(m){return tt(this,null,function*(){const A=i.api;if(!(!A||!Et(A)||n.value)){t.value=[];try{n.value=!0;let v={};i.searchField!=null&&(v[i.searchField]=m),v.page=1,v.pageSize=10;const F=yield A(v);if(Array.isArray(F)){t.value=F,y();return}i.resultField&&(t.value=Cn(F,i.resultField)||[]),y()}catch(v){}finally{n.value=!1}}})}function p(m){return tt(this,null,function*(){m&&!a&&(i.alwaysLoad?yield f():!i.immediate&&!G(s)&&(yield f()))})}function y(){e("options-change",G(h))}function b(m,...A){r.value=A,e("change",A)}return{state:u,attrs:o,getOptions:h,loading:n,t:l,handleFetch:p,handleChange:b,useSearch:a,searchFun:c}}});function A0(i,e,t,n,s,r){const o=vt("LoadingOutlined"),l=vt("Select");return it(),Bt(l,cn({onDropdownVisibleChange:i.handleFetch},i.$attrs,{onChange:i.handleChange,options:i.getOptions,value:i.state,"onUpdate:value":e[0]||(e[0]=a=>i.state=a),"show-search":i.useSearch,onSearch:i.searchFun,"show-arrow":!1,"filter-option":!1}),Hi({_:2},[Gn(Object.keys(i.$slots),a=>({name:a,fn:ft(c=>[Sn(i.$slots,a,Wi(fs(c||{})))])})),i.loading?{name:"suffixIcon",fn:ft(()=>[rt(o,{spin:""})]),key:"0"}:void 0,i.loading?{name:"notFoundContent",fn:ft(()=>[$i("span",null,[rt(o,{spin:"",class:"mr-1"}),Vn(" "+Yn(i.t("component.form.apiSelectNotFound")),1)])]),key:"1"}:void 0]),1040,["onDropdownVisibleChange","onChange","options","value","show-search","onSearch"])}const T0=Mn(C0,[["render",A0]]),M0=Gt({name:"ApiTree",components:{ATree:Hg},props:{api:{type:Function},params:{type:Object},immediate:{type:Boolean,default:!0},resultField:Ee.string.def(""),afterFetch:{type:Function}},emits:["options-change","change"],setup(i,{attrs:e,emit:t}){const n=ze([]),s=ze(!1),r=ze(!1),o=dt(()=>Fe(Fe({},i.api?{treeData:G(n)}:{}),e));function l(...c){t("change",...c)}mt(()=>i.params,()=>{!G(s)&&a()},{deep:!0}),mt(()=>i.immediate,c=>{c&&!s.value&&a()}),Nr(()=>{i.immediate&&a()});function a(){return tt(this,null,function*(){const{api:c,afterFetch:u}=i;if(!c||!Et(c))return;r.value=!0,n.value=[];let h;try{h=yield c(i.params)}catch(f){}u&&Et(u)&&(h=u(h)),r.value=!1,h&&(cs(h)||(h=Cn(h,i.resultField)),n.value=h||[],s.value=!0,t("options-change",n.value))})}return{getAttrs:o,loading:r,handleChange:l}}});function D0(i,e,t,n,s,r){const o=vt("ATree");return it(),Bt(o,cn(i.getAttrs,{onChange:i.handleChange}),Hi({_:2},[Gn(Object.keys(i.$slots),l=>({name:l,fn:ft(a=>[Sn(i.$slots,l,Wi(fs(a||{})))])}))]),1040,["onChange"])}const O0=Mn(M0,[["render",D0]]),E0=Gt({name:"ApiTreeSelect",components:{ATreeSelect:yf,LoadingOutlined:zs},props:{api:{type:Function},params:{type:Object},immediate:{type:Boolean,default:!0},resultField:Ee.string.def(""),labelField:Ee.string.def(""),valueField:Ee.string.def(""),idKeyField:Ee.string.def("id"),parentKeyField:Ee.string.def("parentId"),childrenKeyField:Ee.string.def("children"),defaultValue:{type:Object}},emits:["options-change","change"],setup(i,{attrs:e,emit:t}){const n=ze([]),s=ze(!1),r=ze(!1),o=dt(()=>Fe(Fe({},i.api?{treeData:G(n)}:{}),e));function l(...c){t("change",...c)}mt(()=>i.params,()=>{!G(s)&&a()},{deep:!0}),mt(()=>i.immediate,c=>{c&&!s.value&&a()}),Nr(()=>{i.immediate&&a()});function a(){return tt(this,null,function*(){const{api:c}=i;if(!c||!Et(c))return;r.value=!0,n.value=[];let u;try{u=yield c(i.params)}catch(h){}r.value=!1,u&&(cs(u)||(u=Cn(u,i.resultField)),n.value=s0(u,{idKeyField:i.idKeyField,parentKeyField:i.parentKeyField,childrenKeyField:i.childrenKeyField,valueField:i.valueField,labelField:i.labelField,defaultValue:i.defaultValue}),s.value=!0,t("options-change",n.value))})}return{getAttrs:o,loading:r,handleChange:l,fetch:a}}});function F0(i,e,t,n,s,r){const o=vt("LoadingOutlined"),l=vt("a-tree-select");return it(),Bt(l,cn(i.getAttrs,{onChange:i.handleChange,onDropdownVisibleChange:i.fetch}),Hi({_:2},[Gn(Object.keys(i.$slots),a=>({name:a,fn:ft(c=>[Sn(i.$slots,a,Wi(fs(c||{})))])})),i.loading?{name:"suffixIcon",fn:ft(()=>[rt(o,{spin:""})]),key:"0"}:void 0]),1040,["onChange","onDropdownVisibleChange"])}const P0=Mn(E0,[["render",F0]]),B0=Gt({name:"ApiCascader",__name:"ApiCascader",props:{value:{type:Array},api:{type:Function,default:null},numberToString:Ee.bool,resultField:Ee.string.def(""),labelField:Ee.string.def("label"),valueField:Ee.string.def("value"),childrenField:Ee.string.def("children"),apiParamKey:Ee.string.def("parentCode"),immediate:Ee.bool.def(!0),initFetchParams:{type:Object,default:()=>({})},isLeaf:{type:Function,default:null},displayRenderArray:{type:Array}},emits:["change","defaultChange"],setup(i,{emit:e}){const t=i,n=e,s=ze([]),r=ze([]),o=ze(!1),l=ze([]),a=ze(!0),{t:c}=In(),[u]=Xi(t,"value","change",l);mt(s,b=>{const m=h(b);r.value=m},{deep:!0});function h(b){const{labelField:m,valueField:A,numberToString:v,childrenField:F,isLeaf:D}=t;return b.reduce((E,P)=>{if(P){const T=P[A],M=qt(Fe({},Lr(P,[m,A])),{label:P[m],value:v?`${T}`:T,isLeaf:D&&typeof D=="function"?D(P):!1}),V=Reflect.get(P,F);V&&Reflect.set(M,F,h(V)),E.push(M)}return E},[])}function f(){return tt(this,null,function*(){const b=t.api;if(!(!b||!Et(b))){s.value=[],o.value=!0;try{const m=yield b(t.initFetchParams);if(Array.isArray(m)){s.value=m;return}t.resultField&&(s.value=Cn(m,t.resultField)||[])}catch(m){}finally{o.value=!1}}})}const d=b=>tt(this,null,function*(){const m=b[b.length-1];m.loading=!0;const A=t.api;if(!(!A||!Et(A)))try{const v=yield A({[t.apiParamKey]:Reflect.get(m,"value")});if(Array.isArray(v)){const F=h(v);m.children=F;return}if(t.resultField){const F=h(Cn(v,t.resultField)||[]);m.children=F}}catch(v){}finally{m.loading=!1}});Ys(()=>{t.immediate&&f()}),mt(()=>t.initFetchParams,()=>{!G(a)&&f()},{deep:!0});function p(b,m){l.value=m,n("defaultChange",b,m)}const y=({labels:b,selectedOptions:m})=>G(l).length===(m==null?void 0:m.length)?b.join(" / "):t.displayRenderArray?t.displayRenderArray.join(" / "):"";return(b,m)=>(it(),Bt(G(wf),{value:G(u),"onUpdate:value":m[0]||(m[0]=A=>kg(u)?u.value=A:null),options:r.value,"load-data":d,"change-on-select":"",onChange:p,displayRender:y},Hi({_:2},[o.value?{name:"suffixIcon",fn:ft(()=>[rt(G(zs),{spin:""})]),key:"0"}:void 0,o.value?{name:"notFoundContent",fn:ft(()=>[$i("span",null,[rt(G(zs),{spin:"",class:"mr-1"}),Vn(" "+Yn(G(c)("component.form.apiSelectNotFound")),1)])]),key:"1"}:void 0]),1032,["value","options"]))}}),R0=Gt({name:"ApiTransfer",components:{Transfer:vf},props:{value:{type:Array},api:{type:Function,default:null},params:{type:Object},dataSource:{type:Array},immediate:Ee.bool.def(!0),alwaysLoad:Ee.bool.def(!1),afterFetch:{type:Function},resultField:Ee.string.def(""),labelField:Ee.string.def("title"),valueField:Ee.string.def("key"),showSearch:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},filterOption:{type:Function},selectedKeys:{type:Array},showSelectAll:{type:Boolean,default:!1},targetKeys:{type:Array}},emits:["options-change","change"],setup(i,{attrs:e,emit:t}){const n=ze([]),s=ze([]),{t:r}=In(),o=dt(()=>Fe(Fe({},i.api?{}:{dataSource:G(n)}),e)),l=dt(()=>{const{labelField:f,valueField:d}=i;return G(n).reduce((p,y)=>(y&&p.push(qt(Fe({},Lr(y,[f,d])),{title:y[f],key:y[d]})),p),[])}),a=dt(()=>Array.isArray(i.value)?i.value:Array.isArray(i.targetKeys)?i.targetKeys:[]);function c(f,d,p){s.value=f,t("change",f)}Ys(()=>{i.immediate&&!i.alwaysLoad&&u()}),mt(()=>i.params,()=>{u()},{deep:!0});function u(){return tt(this,null,function*(){const f=i.api;if(!f||!Et(f)){Array.isArray(i.dataSource)&&(n.value=i.dataSource);return}n.value=[];try{const d=yield f(i.params);if(Array.isArray(d)){n.value=d,h();return}i.resultField&&(n.value=Cn(d,i.resultField)||[]),h()}catch(d){}})}function h(){t("options-change",G(l))}return{getTargetKeys:a,getdataSource:l,t:r,getAttrs:o,handleChange:c}}});function N0(i,e,t,n,s,r){const o=vt("Transfer");return it(),Bt(o,{"data-source":i.getdataSource,"filter-option":i.filterOption,render:l=>l.title,showSelectAll:i.showSelectAll,selectedKeys:i.selectedKeys,targetKeys:i.getTargetKeys,showSearch:i.showSearch,disabled:i.disabled,onChange:i.handleChange},null,8,["data-source","filter-option","render","showSelectAll","selectedKeys","targetKeys","showSearch","disabled","onChange"])}const I0=Mn(R0,[["render",N0]]),L0=Gt({name:"SimpleTimePicker",components:{DatePicker:$r,TimePicker:Qa,FormItemRest:Wg},inheritAttrs:!1,props:{timeMode:Ee.string.def("datetime"),valueFormat:Ee.string.def("unixmilli"),value:[Number]},emits:["options-change","change","update:value"],setup(i,{emit:e}){const t=ze([]),n=ws(),{t:s}=In(),r=ze(),o=ze(),l=ze();i.timeMode==="datetime"?l.value=!0:l.value=!1;const[a]=Xi(i,"value","change",t);mt(()=>a.value,u=>{u!==null&&u!=null&&(i.valueFormat==="unixmilli"?(r.value=Kn(u),o.value=Kn(u)):u!==void 0&&(r.value=Kn.unix(u),o.value=Kn.unix(u))),e("update:value",u),e("change",u)});function c(u){var h;if(u!==null){let f=Kn();r.value!=null&&(f=(h=r.value)==null?void 0:h.clone()),i.timeMode==="datetime"?o.value!=null&&(f=f.hour(o.value.hour()).minute(o.value.minute()).second(o.value.second()).millisecond(0)):f=f.hour(0).minute(0).second(0).millisecond(0),i.valueFormat==="unixmilli"?a.value=f.valueOf():a.value=f.unix()}else a.value=void 0}return{state:a,attrs:n,showTimePicker:l,t:s,handleChange:c,dateVal:r,timeVal:o}}});function $0(i,e,t,n,s,r){const o=vt("DatePicker"),l=vt("TimePicker"),a=vt("FormItemRest");return it(),dn(_s,null,[rt(o,{"allow-clear":"",value:i.dateVal,"onUpdate:value":e[0]||(e[0]=c=>i.dateVal=c),onChange:i.handleChange},null,8,["value","onChange"]),rt(a,null,{default:ft(()=>[i.showTimePicker?(it(),Bt(l,{key:0,class:"ml-4",value:i.timeVal,"onUpdate:value":e[1]||(e[1]=c=>i.timeVal=c),onChange:i.handleChange,"allow-clear":""},null,8,["value","onChange"])):rs("",!0)]),_:1})],64)}const _0=Mn(L0,[["render",$0]]),z0=Gt({name:"SimpleRangePicker",components:{RangePicker:jg},inheritAttrs:!1,props:{timeMode:Ee.string.def("datetime"),valueFormat:Ee.string.def("unixmilli"),value:{type:Array,default:void 0}},emits:["options-change","change","update:value"],setup(i,{emit:e}){const t=ze([]),n=ws(),{t:s}=In(),r=ze(),o=ze();i.timeMode==="datetime"?o.value=!0:o.value=!1;const[l]=Xi(i,"value","change",t);mt(()=>l.value,c=>{c!==null&&c!=null&&(i.valueFormat==="unixmilli"?r.value=[Kn(c[0]),Kn(c[1])]:c!==void 0&&(r.value=[Kn.unix(c[0]),Kn.unix(c[1])])),e("update:value",c),e("change",c)});function a(c){var u,h;if(c!==null){let f=[Kn(),Kn()];r.value!=null&&(f[0]=(u=r.value[0])==null?void 0:u.clone(),f[1]=(h=r.value[1])==null?void 0:h.clone()),i.timeMode!=="datetime"&&(f[0]=f[0].hour(0).minute(0).second(0).millisecond(0),f[1]=f[1].hour(0).minute(0).second(0).millisecond(0)),i.valueFormat==="unixmilli"?l.value=[f[0].valueOf(),f[1].valueOf()]:l.value=[f[0].unix(),f[1].unix()]}else l.value=[0,0]}return{state:l,attrs:n,showTimePicker:o,t:s,handleChange:a,dateVal:r}}});function V0(i,e,t,n,s,r){const o=vt("RangePicker");return it(),Bt(o,{"allow-clear":"",value:i.dateVal,"onUpdate:value":e[0]||(e[0]=l=>i.dateVal=l),onChange:i.handleChange,"show-time":i.showTimePicker},null,8,["value","onChange","show-time"])}const H0=Mn(z0,[["render",V0]]),W0=Gt({name:"ApiMultipleSelect",components:{Select:al,LoadingOutlined:zs},inheritAttrs:!1,props:{value:[Array,Object,String,Number],numberToString:Ee.bool,api:{type:Function,default:null},params:{type:Object,default:()=>({})},resultField:Ee.string.def(""),labelField:Ee.string.def("label"),valueField:Ee.string.def("value"),immediate:Ee.bool.def(!0),alwaysLoad:Ee.bool.def(!1)},emits:["options-change","change","update:value"],setup(i,{emit:e}){const t=ze([]),n=ze(!1),s=ze(!0),r=ze([]),o=ws(),{t:l}=In(),[a]=Xi(i,"value","change",r),c=dt(()=>{const{labelField:p,valueField:y,numberToString:b}=i;return G(t).reduce((m,A)=>{if(A){const v=A[y];m.push(qt(Fe({},Lr(A,[p,y])),{label:A[p],value:b?`${v}`:v}))}return m},[])});Ys(()=>{i.immediate&&!i.alwaysLoad&&u()}),mt(()=>a.value,p=>{e("update:value",p)}),mt(()=>i.params,()=>{!G(s)&&u()},{deep:!0});function u(){return tt(this,null,function*(){const p=i.api;if(!(!p||!Et(p))){t.value=[];try{n.value=!0;const y=yield p(i.params);if(Array.isArray(y)){t.value=y,f();return}i.resultField&&(t.value=Cn(y,i.resultField)||[]),f()}catch(y){}finally{n.value=!1}}})}function h(p){return tt(this,null,function*(){p&&(i.alwaysLoad?yield u():!i.immediate&&G(s)&&(yield u(),s.value=!1))})}function f(){e("options-change",G(c))}function d(p,...y){r.value=y,e("change",y)}return{state:a,attrs:o,getOptions:c,loading:n,t:l,handleFetch:h,handleChange:d}}});function j0(i,e,t,n,s,r){const o=vt("LoadingOutlined"),l=vt("Select");return it(),Bt(l,cn({onDropdownVisibleChange:i.handleFetch},i.$attrs,{onChange:i.handleChange,options:i.getOptions,mode:"multiple",value:i.state,"onUpdate:value":e[0]||(e[0]=a=>i.state=a)}),Hi({_:2},[Gn(Object.keys(i.$slots),a=>({name:a,fn:ft(c=>[Sn(i.$slots,a,Wi(fs(c||{})))])})),i.loading?{name:"suffixIcon",fn:ft(()=>[rt(o,{spin:""})]),key:"0"}:void 0,i.loading?{name:"notFoundContent",fn:ft(()=>[$i("span",null,[rt(o,{spin:"",class:"mr-1"}),Vn(" "+Yn(i.t("component.form.apiSelectNotFound")),1)])]),key:"1"}:void 0]),1040,["onDropdownVisibleChange","onChange","options","value"])}const q0=Mn(W0,[["render",j0]]),U0=Gt({name:"DictionarySelect",components:{Select:al,LoadingOutlined:zs},inheritAttrs:!1,props:{dictionaryName:Ee.string.def(""),value:[String,Number],cache:Ee.bool.def(!0)},emits:["options-change","change","update:value"],setup(i,{emit:e}){const t=ze(!1),n=ze([]),s=ws(),{t:r}=In(),o=ze(),[l]=Xi(i,"value","change",n);Nr(()=>{a()}),mt(()=>l.value,u=>{e("update:value",u)});function a(){return tt(this,null,function*(){t.value=!0;const h=yield r0().getDictionary(i.dictionaryName,i.cache);h!=null&&(o.value=h.data),t.value=!1})}function c(u,...h){n.value=h,e("change",h)}return{state:l,attrs:s,loading:t,t:r,options:o,handleFetch:a,handleChange:c}}});function K0(i,e,t,n,s,r){const o=vt("LoadingOutlined"),l=vt("Select");return it(),Bt(l,cn(i.$attrs,{onChange:i.handleChange,options:i.options,value:i.state,"onUpdate:value":e[0]||(e[0]=a=>i.state=a)}),Hi({_:2},[Gn(Object.keys(i.$slots),a=>({name:a,fn:ft(c=>[Sn(i.$slots,a,Wi(fs(c||{})))])})),i.loading?{name:"suffixIcon",fn:ft(()=>[rt(o,{spin:""})]),key:"0"}:void 0,i.loading?{name:"notFoundContent",fn:ft(()=>[$i("span",null,[rt(o,{spin:"",class:"mr-1"}),Vn(" "+Yn(i.t("component.form.apiSelectNotFound")),1)])]),key:"1"}:void 0]),1040,["onChange","options","value"])}const G0=Mn(U0,[["render",K0]]),bu={prefix:"ant-design",icons:["account-book-filled","account-book-outlined","account-book-twotone","aim-outlined","alert-filled","alert-outlined","alert-twotone","alibaba-outlined","align-center-outlined","align-left-outlined","align-right-outlined","alipay-circle-filled","alipay-circle-outlined","alipay-outlined","alipay-square-filled","aliwangwang-filled","aliwangwang-outlined","aliyun-outlined","amazon-circle-filled","amazon-outlined","amazon-square-filled","android-filled","android-outlined","ant-cloud-outlined","ant-design-outlined","apartment-outlined","api-filled","api-outlined","api-twotone","apple-filled","apple-outlined","appstore-add-outlined","appstore-filled","appstore-outlined","appstore-twotone","area-chart-outlined","arrow-down-outlined","arrow-left-outlined","arrow-right-outlined","arrow-up-outlined","arrows-alt-outlined","audio-filled","audio-muted-outlined","audio-outlined","audio-twotone","audit-outlined","backward-filled","backward-outlined","bank-filled","bank-outlined","bank-twotone","bar-chart-outlined","barcode-outlined","bars-outlined","behance-circle-filled","behance-outlined","behance-square-filled","behance-square-outlined","bell-filled","bell-outlined","bell-twotone","bg-colors-outlined","block-outlined","bold-outlined","book-filled","book-outlined","book-twotone","border-bottom-outlined","border-horizontal-outlined","border-inner-outlined","border-left-outlined","border-outer-outlined","border-outlined","border-right-outlined","border-top-outlined","border-verticle-outlined","borderless-table-outlined","box-plot-filled","box-plot-outlined","box-plot-twotone","branches-outlined","bug-filled","bug-outlined","bug-twotone","build-filled","build-outlined","build-twotone","bulb-filled","bulb-outlined","bulb-twotone","calculator-filled","calculator-outlined","calculator-twotone","calendar-filled","calendar-outlined","calendar-twotone","camera-filled","camera-outlined","camera-twotone","car-filled","car-outlined","car-twotone","caret-down-filled","caret-down-outlined","caret-left-filled","caret-left-outlined","caret-right-filled","caret-right-outlined","caret-up-filled","caret-up-outlined","carry-out-filled","carry-out-outlined","carry-out-twotone","check-circle-filled","check-circle-outlined","check-circle-twotone","check-outlined","check-square-filled","check-square-outlined","check-square-twotone","chrome-filled","chrome-outlined","ci-circle-filled","ci-circle-outlined","ci-circle-twotone","ci-outlined","ci-twotone","clear-outlined","clock-circle-filled","clock-circle-outlined","clock-circle-twotone","close-circle-filled","close-circle-outlined","close-circle-twotone","close-outlined","close-square-filled","close-square-outlined","close-square-twotone","cloud-download-outlined","cloud-filled","cloud-outlined","cloud-server-outlined","cloud-sync-outlined","cloud-twotone","cloud-upload-outlined","cluster-outlined","code-filled","code-outlined","code-sandbox-circle-filled","code-sandbox-outlined","code-sandbox-square-filled","code-twotone","codepen-circle-filled","codepen-circle-outlined","codepen-outlined","codepen-square-filled","coffee-outlined","column-height-outlined","column-width-outlined","comment-outlined","compass-filled","compass-outlined","compass-twotone","compress-outlined","console-sql-outlined","contacts-filled","contacts-outlined","contacts-twotone","container-filled","container-outlined","container-twotone","control-filled","control-outlined","control-twotone","copy-filled","copy-outlined","copy-twotone","copyright-circle-filled","copyright-circle-outlined","copyright-circle-twotone","copyright-outlined","copyright-twotone","credit-card-filled","credit-card-outlined","credit-card-twotone","crown-filled","crown-outlined","crown-twotone","customer-service-filled","customer-service-outlined","customer-service-twotone","dash-outlined","dashboard-filled","dashboard-outlined","dashboard-twotone","database-filled","database-outlined","database-twotone","delete-column-outlined","delete-filled","delete-outlined","delete-row-outlined","delete-twotone","delivered-procedure-outlined","deployment-unit-outlined","desktop-outlined","diff-filled","diff-outlined","diff-twotone","dingding-outlined","dingtalk-circle-filled","dingtalk-outlined","dingtalk-square-filled","disconnect-outlined","dislike-filled","dislike-outlined","dislike-twotone","dollar-circle-filled","dollar-circle-outlined","dollar-circle-twotone","dollar-outlined","dollar-twotone","dot-chart-outlined","double-left-outlined","double-right-outlined","down-circle-filled","down-circle-outlined","down-circle-twotone","down-outlined","down-square-filled","down-square-outlined","down-square-twotone","download-outlined","drag-outlined","dribbble-circle-filled","dribbble-outlined","dribbble-square-filled","dribbble-square-outlined","dropbox-circle-filled","dropbox-outlined","dropbox-square-filled","edit-filled","edit-outlined","edit-twotone","ellipsis-outlined","enter-outlined","environment-filled","environment-outlined","environment-twotone","euro-circle-filled","euro-circle-outlined","euro-circle-twotone","euro-outlined","euro-twotone","exception-outlined","exclamation-circle-filled","exclamation-circle-outlined","exclamation-circle-twotone","exclamation-outlined","expand-alt-outlined","expand-outlined","experiment-filled","experiment-outlined","experiment-twotone","export-outlined","eye-filled","eye-invisible-filled","eye-invisible-outlined","eye-invisible-twotone","eye-outlined","eye-twotone","facebook-filled","facebook-outlined","fall-outlined","fast-backward-filled","fast-backward-outlined","fast-forward-filled","fast-forward-outlined","field-binary-outlined","field-number-outlined","field-string-outlined","field-time-outlined","file-add-filled","file-add-outlined","file-add-twotone","file-done-outlined","file-excel-filled","file-excel-outlined","file-excel-twotone","file-exclamation-filled","file-exclamation-outlined","file-exclamation-twotone","file-filled","file-gif-outlined","file-image-filled","file-image-outlined","file-image-twotone","file-jpg-outlined","file-markdown-filled","file-markdown-outlined","file-markdown-twotone","file-outlined","file-pdf-filled","file-pdf-outlined","file-pdf-twotone","file-ppt-filled","file-ppt-outlined","file-ppt-twotone","file-protect-outlined","file-search-outlined","file-sync-outlined","file-text-filled","file-text-outlined","file-text-twotone","file-twotone","file-unknown-filled","file-unknown-outlined","file-unknown-twotone","file-word-filled","file-word-outlined","file-word-twotone","file-zip-filled","file-zip-outlined","file-zip-twotone","filter-filled","filter-outlined","filter-twotone","fire-filled","fire-outlined","fire-twotone","flag-filled","flag-outlined","flag-twotone","folder-add-filled","folder-add-outlined","folder-add-twotone","folder-filled","folder-open-filled","folder-open-outlined","folder-open-twotone","folder-outlined","folder-twotone","folder-view-outlined","font-colors-outlined","font-size-outlined","fork-outlined","form-outlined","format-painter-filled","format-painter-outlined","forward-filled","forward-outlined","frown-filled","frown-outlined","frown-twotone","fullscreen-exit-outlined","fullscreen-outlined","function-outlined","fund-filled","fund-outlined","fund-projection-screen-outlined","fund-twotone","fund-view-outlined","funnel-plot-filled","funnel-plot-outlined","funnel-plot-twotone","gateway-outlined","gif-outlined","gift-filled","gift-outlined","gift-twotone","github-filled","github-outlined","gitlab-filled","gitlab-outlined","global-outlined","gold-filled","gold-outlined","gold-twotone","golden-filled","google-circle-filled","google-outlined","google-plus-circle-filled","google-plus-outlined","google-plus-square-filled","google-square-filled","group-outlined","hdd-filled","hdd-outlined","hdd-twotone","heart-filled","heart-outlined","heart-twotone","heat-map-outlined","highlight-filled","highlight-outlined","highlight-twotone","history-outlined","home-filled","home-outlined","home-twotone","hourglass-filled","hourglass-outlined","hourglass-twotone","html5-filled","html5-outlined","html5-twotone","idcard-filled","idcard-outlined","idcard-twotone","ie-circle-filled","ie-outlined","ie-square-filled","import-outlined","inbox-outlined","info-circle-filled","info-circle-outlined","info-circle-twotone","info-outlined","insert-row-above-outlined","insert-row-below-outlined","insert-row-left-outlined","insert-row-right-outlined","instagram-filled","instagram-outlined","insurance-filled","insurance-outlined","insurance-twotone","interaction-filled","interaction-outlined","interaction-twotone","issues-close-outlined","italic-outlined","key-outlined","laptop-outlined","layout-filled","layout-outlined","layout-twotone","left-circle-filled","left-circle-outlined","left-circle-twotone","left-outlined","left-square-filled","left-square-outlined","left-square-twotone","like-filled","like-outlined","like-twotone","line-chart-outlined","line-height-outlined","line-outlined","link-outlined","linkedin-filled","linkedin-outlined","loading-3-quarters-outlined","loading-outlined","lock-filled","lock-outlined","lock-twotone","login-outlined","logout-outlined","mac-command-filled","mac-command-outlined","mail-filled","mail-outlined","mail-twotone","man-outlined","medicine-box-filled","medicine-box-outlined","medicine-box-twotone","medium-circle-filled","medium-outlined","medium-square-filled","medium-workmark-outlined","meh-filled","meh-outlined","meh-twotone","menu-fold-outlined","menu-outlined","menu-unfold-outlined","merge-cells-outlined","message-filled","message-outlined","message-twotone","minus-circle-filled","minus-circle-outlined","minus-circle-twotone","minus-outlined","minus-square-filled","minus-square-outlined","minus-square-twotone","mobile-filled","mobile-outlined","mobile-twotone","money-collect-filled","money-collect-outlined","money-collect-twotone","monitor-outlined","more-outlined","node-collapse-outlined","node-expand-outlined","node-index-outlined","notification-filled","notification-outlined","notification-twotone","number-outlined","one-to-one-outlined","ordered-list-outlined","paper-clip-outlined","partition-outlined","pause-circle-filled","pause-circle-outlined","pause-circle-twotone","pause-outlined","pay-circle-filled","pay-circle-outlined","percentage-outlined","phone-filled","phone-outlined","phone-twotone","pic-center-outlined","pic-left-outlined","pic-right-outlined","picture-filled","picture-outlined","picture-twotone","pie-chart-filled","pie-chart-outlined","pie-chart-twotone","play-circle-filled","play-circle-outlined","play-circle-twotone","play-square-filled","play-square-outlined","play-square-twotone","plus-circle-filled","plus-circle-outlined","plus-circle-twotone","plus-outlined","plus-square-filled","plus-square-outlined","plus-square-twotone","pound-circle-filled","pound-circle-outlined","pound-circle-twotone","pound-outlined","poweroff-outlined","printer-filled","printer-outlined","printer-twotone","profile-filled","profile-outlined","profile-twotone","project-filled","project-outlined","project-twotone","property-safety-filled","property-safety-outlined","property-safety-twotone","pull-request-outlined","pushpin-filled","pushpin-outlined","pushpin-twotone","qq-circle-filled","qq-outlined","qq-square-filled","qrcode-outlined","question-circle-filled","question-circle-outlined","question-circle-twotone","question-outlined","radar-chart-outlined","radius-bottomleft-outlined","radius-bottomright-outlined","radius-setting-outlined","radius-upleft-outlined","radius-upright-outlined","read-filled","read-outlined","reconciliation-filled","reconciliation-outlined","reconciliation-twotone","red-envelope-filled","red-envelope-outlined","red-envelope-twotone","reddit-circle-filled","reddit-outlined","reddit-square-filled","redo-outlined","reload-outlined","rest-filled","rest-outlined","rest-twotone","retweet-outlined","right-circle-filled","right-circle-outlined","right-circle-twotone","right-outlined","right-square-filled","right-square-outlined","right-square-twotone","rise-outlined","robot-filled","robot-outlined","rocket-filled","rocket-outlined","rocket-twotone","rollback-outlined","rotate-left-outlined","rotate-right-outlined","safety-certificate-filled","safety-certificate-outlined","safety-certificate-twotone","safety-outlined","save-filled","save-outlined","save-twotone","scan-outlined","schedule-filled","schedule-outlined","schedule-twotone","scissor-outlined","search-outlined","security-scan-filled","security-scan-outlined","security-scan-twotone","select-outlined","send-outlined","setting-filled","setting-outlined","setting-twotone","shake-outlined","share-alt-outlined","shop-filled","shop-outlined","shop-twotone","shopping-cart-outlined","shopping-filled","shopping-outlined","shopping-twotone","shrink-outlined","signal-filled","sisternode-outlined","sketch-circle-filled","sketch-outlined","sketch-square-filled","skin-filled","skin-outlined","skin-twotone","skype-filled","skype-outlined","slack-circle-filled","slack-outlined","slack-square-filled","slack-square-outlined","sliders-filled","sliders-outlined","sliders-twotone","small-dash-outlined","smile-filled","smile-outlined","smile-twotone","snippets-filled","snippets-outlined","snippets-twotone","solution-outlined","sort-ascending-outlined","sort-descending-outlined","sound-filled","sound-outlined","sound-twotone","split-cells-outlined","star-filled","star-outlined","star-twotone","step-backward-filled","step-backward-outlined","step-forward-filled","step-forward-outlined","stock-outlined","stop-filled","stop-outlined","stop-twotone","strikethrough-outlined","subnode-outlined","swap-left-outlined","swap-outlined","swap-right-outlined","switcher-filled","switcher-outlined","switcher-twotone","sync-outlined","table-outlined","tablet-filled","tablet-outlined","tablet-twotone","tag-filled","tag-outlined","tag-twotone","tags-filled","tags-outlined","tags-twotone","taobao-circle-filled","taobao-circle-outlined","taobao-outlined","taobao-square-filled","team-outlined","thunderbolt-filled","thunderbolt-outlined","thunderbolt-twotone","to-top-outlined","tool-filled","tool-outlined","tool-twotone","trademark-circle-filled","trademark-circle-outlined","trademark-circle-twotone","trademark-outlined","transaction-outlined","translation-outlined","trophy-filled","trophy-outlined","trophy-twotone","twitter-circle-filled","twitter-outlined","twitter-square-filled","underline-outlined","undo-outlined","ungroup-outlined","unlock-filled","unlock-outlined","unlock-twotone","unordered-list-outlined","up-circle-filled","up-circle-outlined","up-circle-twotone","up-outlined","up-square-filled","up-square-outlined","up-square-twotone","upload-outlined","usb-filled","usb-outlined","usb-twotone","user-add-outlined","user-delete-outlined","user-outlined","user-switch-outlined","usergroup-add-outlined","usergroup-delete-outlined","verified-outlined","vertical-align-bottom-outlined","vertical-align-middle-outlined","vertical-align-top-outlined","vertical-left-outlined","vertical-right-outlined","video-camera-add-outlined","video-camera-filled","video-camera-outlined","video-camera-twotone","wallet-filled","wallet-outlined","wallet-twotone","warning-filled","warning-outlined","warning-twotone","wechat-filled","wechat-outlined","weibo-circle-filled","weibo-circle-outlined","weibo-outlined","weibo-square-filled","weibo-square-outlined","whats-app-outlined","wifi-outlined","windows-filled","windows-outlined","woman-outlined","yahoo-filled","yahoo-outlined","youtube-filled","youtube-outlined","yuque-filled","yuque-outlined","zhihu-circle-filled","zhihu-outlined","zhihu-square-filled","zoom-in-outlined","zoom-out-outlined"]};function Y0(i,e,t){const n=(e-1)*Number(t);return n+Number(t)>=i.length?i.slice(n,i.length):i.slice(n,n+Number(t))}function X0(i,e){const t=ze(1),n=ze(e),s=dt(()=>Y0(G(i),G(t),G(n))),r=dt(()=>G(i).length);function o(a){t.value=a}function l(a){n.value=a}return{setCurrentPage:o,getTotal:r,setPageSize:l,getPaginationList:s}}const J0=["icon-download-count","icon-dynamic-avatar-1","icon-dynamic-avatar-2","icon-dynamic-avatar-3","icon-dynamic-avatar-4","icon-dynamic-avatar-5","icon-dynamic-avatar-6","icon-moon","icon-sun","icon-test","icon-total-sales","icon-transaction","icon-visit-count"],Q0={class:"flex justify-between"},Z0={key:0},eb={class:"flex flex-wrap px-2"},tb=["onClick","title"],nb={key:0,class:"flex py-2 items-center justify-center"},ib={key:1,class:"p-5"},sb={key:0,class:"cursor-pointer px-2 py-1 flex items-center"},rb=Gt({inheritAttrs:!1,__name:"IconPicker",props:{value:{default:""},width:{default:"100%"},pageSize:{default:140},copy:{type:Boolean,default:!1},mode:{default:"iconify"}},emits:["change","update:value"],setup(i,{emit:e}){const t=Xs,n=qg,s=Ug,r=Kg;function o(){const V=bu.prefix;return bu.icons.map(H=>`${V}:${H}`)}function l(){return J0.map(V=>V.replace("icon-",""))}const a=i,c=e,u=a.mode==="svg",h=u?l():o(),f=ze(""),d=ze(!1),p=ze(h),y=ze(),b=()=>{y.value&&y.value.click()},{t:m}=In(),{prefixCls:A}=ll("icon-picker"),v=Ja(M,100),{getPaginationList:F,getTotal:D,setCurrentPage:E}=X0(p,a.pageSize);Ys(()=>{f.value=a.value}),mt(()=>f.value,V=>{c("update:value",V),c("change",V)});function P(V){E(V)}function T(V){f.value=V,a.copy&&o0(V,m("component.icon.copy"))}function M(V){const H=V.target.value;if(!H){E(1),p.value=h;return}f.value=H,p.value=h.filter(te=>te.includes(H))}return(V,H)=>(it(),Bt(G(t),{readonly:"",style:Xa({width:V.width}),placeholder:G(m)("component.icon.placeholder"),class:Bo(G(A)),value:f.value,"onUpdate:value":H[1]||(H[1]=te=>f.value=te),onClick:b},{addonAfter:ft(()=>[rt(G(n),{placement:"bottomLeft",trigger:"click",modelValue:d.value,"onUpdate:modelValue":H[0]||(H[0]=te=>d.value=te),overlayClassName:`${G(A)}-popover`},{title:ft(()=>[$i("div",Q0,[rt(G(t),{placeholder:G(m)("component.icon.search"),onChange:G(v),allowClear:""},null,8,["placeholder","onChange"])])]),content:ft(()=>[G(F).length?(it(),dn("div",Z0,[rt(G(u0),{class:"border border-solid border-t-0"},{default:ft(()=>[$i("ul",eb,[(it(!0),dn(_s,null,Gn(G(F),te=>(it(),dn("li",{key:te,class:Bo([f.value===te?"border border-primary":"","p-2 w-1/8 cursor-pointer mr-1 mt-1 flex justify-center items-center border border-solid hover:border-primary"]),onClick:ue=>T(te),title:te},[u?(it(),Bt(uu,{key:0,name:te},null,8,["name"])):(it(),Bt(hu,{key:1,icon:te},null,8,["icon"]))],10,tb))),128))])]),_:1}),G(D)>=V.pageSize?(it(),dn("div",nb,[rt(G(s),{showLessItems:"",size:"small",pageSize:V.pageSize,total:G(D),onChange:P},null,8,["pageSize","total"])])):rs("",!0)])):(it(),dn("div",ib,[rt(G(r))]))]),default:ft(()=>[$i("div",{ref_key:"trigger",ref:y},[u&&f.value?(it(),dn("span",sb,[rt(uu,{name:f.value},null,8,["name"])])):(it(),Bt(hu,{key:1,icon:f.value||"ion:apps-outline",class:"cursor-pointer px-2 py-1"},null,8,["icon"]))],512)]),_:1},8,["modelValue","overlayClassName"])]),_:1},8,["style","placeholder","class","value"]))}});class yt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vs(this,e,t);let s=[];return this.decompose(0,e,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(t,this.length,s,1),ci.from(s,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vs(this,e,t);let n=[];return this.decompose(e,t,n,0),ci.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),s=new dr(this),r=new dr(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=n)return!0}}iter(e=1){return new dr(this,e)}iterRange(e,t=this.length){return new Af(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;n=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Tf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?yt.empty:e.length<=32?new zt(e):ci.from(zt.split(e,[]))}}class zt extends yt{constructor(e,t=ob(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?n:l)>=e)return new lb(s,l,n,o);s=l+1,n++}}decompose(e,t,n,s){let r=e<=0&&t>=this.length?this:new zt(yu(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),l=So(r.text,o.text.slice(),0,r.length);if(l.length<=32)n.push(new zt(l,o.length+r.length));else{let a=l.length>>1;n.push(new zt(l.slice(0,a)),new zt(l.slice(a)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof zt))return super.replace(e,t,n);[e,t]=Vs(this,e,t);let s=So(this.text,So(n.text,yu(this.text,0,e)),t),r=this.length+n.length-(t-e);return s.length<=32?new zt(s,r):ci.from(zt.split(s,[]),r)}sliceString(e,t=this.length,n=` `){[e,t]=Vs(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=n),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],s=-1;for(let r of e)n.push(r),s+=r.length+1,n.length==32&&(t.push(new zt(n,s)),n=[],s=-1);return s>-1&&t.push(new zt(n,s)),t}}class ci extends yt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,s);s=l+1,n=a+1}}decompose(e,t,n,s){for(let r=0,o=0;o<=t&&r=o){let c=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?n.push(l):l.decompose(e-o,t-o,n,c)}o=a+1}}replace(e,t,n){if([e,t]=Vs(this,e,t),n.lines=r&&t<=l){let a=o.replace(e-r,t-r,n),c=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>c>>6){let u=this.children.slice();return u[s]=a,new ci(u,this.length-(t-e)+n.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` `){[e,t]=Vs(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=n),eo&&(s+=l.sliceString(e-o,t-o,n)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ci))return 0;let n=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return n;let a=this.children[s],c=e.children[r];if(a!=c)return n+a.scanIdentical(c,t);n+=a.length+1}}static from(e,t=e.reduce((n,s)=>n+s.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new zt(d,t)}let s=Math.max(32,n>>5),r=s<<1,o=s>>1,l=[],a=0,c=-1,u=[];function h(d){let p;if(d.lines>r&&d instanceof ci)for(let y of d.children)h(y);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof zt&&a&&(p=u[u.length-1])instanceof zt&&d.lines+p.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new zt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:ci.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new ci(l,t)}}yt.empty=new zt([""],0);function ob(i){let e=-1;for(let t of i)e+=t.length+1;return e}function So(i,e,t=0,n=1e9){for(let s=0,r=0,o=!0;r=t&&(a>n&&(l=l.slice(0,n-s)),s0?1:(e instanceof zt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],r=this.offsets[n],o=r>>1,l=s instanceof zt?s.text.length:s.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof zt){let a=s.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof zt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Af{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new dr(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=n?s:t<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Tf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol!="undefined"&&(yt.prototype[Symbol.iterator]=function(){return this.iter()},dr.prototype[Symbol.iterator]=Af.prototype[Symbol.iterator]=Tf.prototype[Symbol.iterator]=function(){return this});class lb{constructor(e,t,n,s){this.from=e,this.to=t,this.number=n,this.text=s}get length(){return this.to-this.from}}function Vs(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}let Ps="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(i=>i?parseInt(i,36):1);for(let i=1;ii)return Ps[e-1]<=i;return!1}function wu(i){return i>=127462&&i<=127487}const vu=8205;function nn(i,e,t=!0,n=!0){return(t?Mf:cb)(i,e,n)}function Mf(i,e,t){if(e==i.length)return e;e&&Df(i.charCodeAt(e))&&Of(i.charCodeAt(e-1))&&e--;let n=Zt(i,e);for(e+=$n(n);e=0&&wu(Zt(i,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function cb(i,e,t){for(;e>0;){let n=Mf(i,e-2,t);if(n=56320&&i<57344}function Of(i){return i>=55296&&i<56320}function Zt(i,e){let t=i.charCodeAt(e);if(!Of(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Df(n)?(t-55296<<10)+(n-56320)+65536:t}function Za(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function $n(i){return i<65536?1:2}const ta=/\r\n?|\n/;var gn=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(gn||(gn={}));class di{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(n!=gn.Simple&&c>=e&&(n==gn.TrackDel&&se||n==gn.TrackBefore&&se))return null;if(c>e||c==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let n=0,s=0;n=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new di(e)}static create(e){return new di(e)}}class Ut extends di{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return na(this,(t,n,s,r,o)=>e=e.replace(s,s+(n-t),o),!1),e}mapDesc(e,t=!1){return ia(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;n.length0&&Ri(n,t,r.text),r.forward(u),l+=u}let c=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let s=[],r=[],o=0,l=null;function a(u=!1){if(!u&&!s.length)return;of||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let p=d?typeof d=="string"?yt.of(d.split(n||ta)):d:yt.empty,y=p.length;if(h==f&&y==0)return;ho&&ln(s,h-o,-1),ln(s,f-h,y),Ri(r,s,p),o=f}}return c(e),a(!l),l}static empty(e){return new Ut(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;n.length=0&&t<=0&&t==i[s+1]?i[s]+=e:e==0&&i[s]==0?i[s+1]+=t:n?(i[s]+=e,i[s+1]+=t):i.push(e,t)}function Ri(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(s,c,r,u,h),s=c,r=u}}}function ia(i,e,t,n=!1){let s=[],r=n?[]:null,o=new wr(i),l=new wr(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let c=Math.min(o.len,l.len);ln(s,c,-1),o.forward(c),l.forward(c)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let c=0,u=o.len;for(;u;)if(l.ins==-1){let h=Math.min(u,l.len);c+=h,u-=h,l.forward(h)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>c),r.forward2(a),o.forward(a)}}}}class wr{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?yt.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?yt.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class os{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,s;return this.empty?n=s=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new os(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ce.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ce.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ce.range(e.anchor,e.head)}static create(e,t,n){return new os(e,t,n)}}class ce{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ce.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ce(e.ranges.map(t=>os.fromJSON(t)),e.main)}static single(e,t=e){return new ce([ce.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;se?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(n);for(let s=1;sr.head?ce.range(a,l):ce.range(l,a))}}return new ce(e,t)}}function Ff(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let ec=0;class Ne{constructor(e,t,n,s,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=s,this.id=ec++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new Ne(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:tc),!!e.static,e.enables)}of(e){return new Co([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Co(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Co(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function tc(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class Co{constructor(e,t,n,s){this.dependencies=e,this.facet=t,this.type=n,this.value=s,this.id=ec++}dynamicSlot(e){var t;let n=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?c=!0:((t=e[h.id])!==null&&t!==void 0?t:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,f){if(a&&f.docChanged||c&&(f.docChanged||f.selection)||sa(h,u)){let d=n(h);if(l?!ku(d,h.values[o],s):!s(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,p=f.config.address[r];if(p!=null){let y=Lo(f,p);if(this.dependencies.every(b=>b instanceof Ne?f.facet(b)===h.facet(b):b instanceof rn?f.field(b,!1)==h.field(b,!1):!0)||(l?ku(d=n(h),y,s):s(d=n(h),y)))return h.values[o]=y,0}else d=n(h);return h.values[o]=d,1}}}}function ku(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),s=t.map(a=>a.type),r=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let c=[];for(let u=0;un===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(xu).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,s)=>{let r=n.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(n.values[t]=o,1)},reconfigure:(n,s)=>s.config.address[this.id]!=null?(n.values[t]=s.field(this),0):(n.values[t]=this.create(n),1)}}init(e){return[this,xu.of({field:this,create:e})]}get extension(){return this}}const ns={lowest:4,low:3,default:2,high:1,highest:0};function er(i){return e=>new Pf(e,i)}const vs={highest:er(ns.highest),high:er(ns.high),default:er(ns.default),low:er(ns.low),lowest:er(ns.lowest)};class Pf{constructor(e,t){this.inner=e,this.prec=t}}class _r{of(e){return new ra(this,e)}reconfigure(e){return _r.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ra{constructor(e,t){this.compartment=e,this.inner=t}}class Io{constructor(e,t,n,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let s=[],r=Object.create(null),o=new Map;for(let f of hb(e,t,o))f instanceof rn?s.push(f):(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],c=[];for(let f of s)l[f.id]=c.length<<1,c.push(d=>f.slot(d));let u=n==null?void 0:n.config.facets;for(let f in r){let d=r[f],p=d[0].facet,y=u&&u[f]||[];if(d.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,tc(y,d))a.push(n.facet(p));else{let b=p.combine(d.map(m=>m.value));a.push(n&&p.compare(b,n.facet(p))?n.facet(p):b)}else{for(let b of d)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=c.length<<1,c.push(m=>b.dynamicSlot(m)));l[p.id]=c.length<<1,c.push(b=>ub(b,p,d))}}let h=c.map(f=>f(l));return new Io(e,o,h,l,a,r)}}function hb(i,e,t){let n=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let c=n[a].indexOf(o);c>-1&&n[a].splice(c,1),o instanceof ra&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let c of o)r(c,l);else if(o instanceof ra){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),r(c,l)}else if(o instanceof Pf)r(o.inner,o.prec);else if(o instanceof rn)n[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Co)n[l].push(o),o.facet.extensions&&r(o.facet.extensions,ns.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(c,l)}}return r(i,ns.default),n.reduce((o,l)=>o.concat(l))}function pr(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let s=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|s}function Lo(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Bf=Ne.define(),oa=Ne.define({combine:i=>i.some(e=>e),static:!0}),Rf=Ne.define({combine:i=>i.length?i[0]:void 0,static:!0}),Nf=Ne.define(),If=Ne.define(),Lf=Ne.define(),$f=Ne.define({combine:i=>i.length?i[0]:!1});class Si{constructor(e,t){this.type=e,this.value=t}static define(){return new fb}}class fb{of(e){return new Si(this,e)}}class db{constructor(e){this.map=e}of(e){return new nt(this,e)}}class nt{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new nt(this.type,t)}is(e){return this.type==e}static define(e={}){return new db(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let s of e){let r=s.map(t);r&&n.push(r)}return n}}nt.reconfigure=nt.define();nt.appendConfig=nt.define();class Kt{constructor(e,t,n,s,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Ff(n,t.newLength),r.some(l=>l.type==Kt.time)||(this.annotations=r.concat(Kt.time.of(Date.now())))}static create(e,t,n,s,r,o){return new Kt(e,t,n,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Kt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Kt.time=Si.define();Kt.userEvent=Si.define();Kt.addToHistory=Si.define();Kt.remote=Si.define();function pb(i,e){let t=[];for(let n=0,s=0;;){let r,o;if(n=i[n]))r=i[n++],o=i[n++];else if(s=0;s--){let r=n[s](i);r instanceof Kt?i=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Kt?i=r[0]:i=zf(e,Bs(r),!1)}return i}function gb(i){let e=i.startState,t=e.facet(Lf),n=i;for(let s=t.length-1;s>=0;s--){let r=t[s](i);r&&Object.keys(r).length&&(n=_f(n,la(e,r,i.changes.newLength),!0))}return n==i?i:Kt.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const bb=[];function Bs(i){return i==null?bb:Array.isArray(i)?i:[i]}var It=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(It||(It={}));const yb=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let aa;try{aa=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(i){}function wb(i){if(aa)return aa.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||yb.test(t)))return!0}return!1}function vb(i){return e=>{if(!/\S/.test(e))return It.Space;if(wb(e))return It.Word;for(let t=0;t-1)return It.Word;return It.Other}}class ht{constructor(e,t,n,s,r,o){this.config=e,this.doc=t,this.selection=n,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(c,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(nt.reconfigure)?(t=null,n=l.value):l.is(nt.appendConfig)&&(t=null,n=Bs(n).concat(l.value));let r;t?r=e.startState.values.slice():(t=Io.resolve(n,s,this),r=new ht(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,c)=>c.reconfigure(a,this),null).values);let o=e.startState.facet(oa)?e.newSelection:e.newSelection.asSingle();new ht(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ce.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),s=this.changes(n.changes),r=[n.range],o=Bs(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return ht.create({doc:e.doc,selection:ce.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Io.resolve(e.extensions||[],new Map),n=e.doc instanceof yt?e.doc:yt.of((e.doc||"").split(t.staticFacet(ht.lineSeparator)||ta)),s=e.selection?e.selection instanceof ce?e.selection:ce.single(e.selection.anchor,e.selection.head):ce.single(0);return Ff(s,n.length),t.staticFacet(oa)||(s=s.asSingle()),new ht(t,n,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(ht.tabSize)}get lineBreak(){return this.facet(ht.lineSeparator)||` `}get readOnly(){return this.facet($f)}phrase(e,...t){for(let n of this.facet(ht.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?n:t[r-1]})),e}languageDataAt(e,t,n=-1){let s=[];for(let r of this.facet(Bf))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return vb(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=nn(t,o,!1);if(r(t.slice(a,o))!=It.Word)break;o=a}for(;li.length?i[0]:4});ht.lineSeparator=Rf;ht.readOnly=$f;ht.phrases=Ne.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(s=>i[s]==e[s])}});ht.languageData=Bf;ht.changeFilter=Nf;ht.transactionFilter=If;ht.transactionExtender=Lf;_r.reconfigure=nt.define();function pi(i,e,t={}){let n={};for(let s of i)for(let r of Object.keys(s)){let o=s[r],l=n[r];if(l===void 0)n[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))n[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)n[s]===void 0&&(n[s]=e[s]);return n}class ds{eq(e){return this==e}range(e,t=e){return ca.create(e,t,this)}}ds.prototype.startSide=ds.prototype.endSide=0;ds.prototype.point=!1;ds.prototype.mapMode=gn.TrackDel;let ca=class Vf{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Vf(e,t,n)}};function ua(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class nc{constructor(e,t,n,s){this.from=e,this.to=t,this.value=n,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,s=0){let r=n?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,c=r[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,n,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);rd||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),n.push(c),s.push(f-o),r.push(d-o))}return{mapped:n.length?new nc(s,r,n,l):null,pos:o}}}class gt{constructor(e,t,n,s){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=s}static create(e,t,n,s){return new gt(e,t,n,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(ua)),this.isEmpty)return t.length?gt.of(t):this;let l=new Hf(this,null,-1).goto(0),a=0,c=[],u=new ji;for(;l.value||a=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return vr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return vr.from(e).goto(t)}static compare(e,t,n,s,r=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=r),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=r),a=Su(o,l,n),c=new tr(o,a,r),u=new tr(l,a,r);n.iterGaps((h,f,d)=>Cu(c,h,u,f,d,s)),n.empty&&n.length==0&&Cu(c,0,u,0,0,s)}static eq(e,t,n=0,s){s==null&&(s=999999999);let r=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Su(r,o),a=new tr(r,l,0).goto(n),c=new tr(o,l,0).goto(n);for(;;){if(a.to!=c.to||!ha(a.active,c.active)||a.point&&(!c.point||!a.point.eq(c.point)))return!1;if(a.to>s)return!0;a.next(),c.next()}}static spans(e,t,n,s,r=-1){let o=new tr(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFroml&&(s.span(l,c,o.active,a),a=o.openEnd(c));if(o.to>n)return a+(o.point&&o.to>n?1:0);l=o.to,o.next()}}static of(e,t=!1){let n=new ji;for(let s of e instanceof ca?[e]:t?kb(e):e)n.add(s.from,s.to,s.value);return n.finish()}static join(e){if(!e.length)return gt.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=gt.empty;s=s.nextLayer)t=new gt(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}gt.empty=new gt([],[],null,-1);function kb(i){if(i.length>1)for(let e=i[0],t=1;t0)return i.slice().sort(ua);e=n}return i}gt.empty.nextLayer=gt.empty;class ji{finishChunk(e){this.chunks.push(new nc(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new ji)).add(e,t,n)}addInner(e,t,n){let s=e-this.lastTo||n.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(gt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=gt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Su(i,e,t){let n=new Map;for(let r of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&s.push(new Hf(o,t,n,r));return s.length==1?s[0]:new vr(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Dl(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Dl(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Dl(this.heap,0)}}}function Dl(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let s=i[n];if(n+1=0&&(s=i[n+1],n++),t.compare(s)<0)break;i[n]=t,i[e]=s,e=n}}class tr{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vr.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Xr(this.active,e),Xr(this.activeTo,e),Xr(this.activeRank,e),this.minActive=Au(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:s,rank:r}=this.cursor;for(;t0;)t++;Jr(this.active,t,n),Jr(this.activeTo,t,s),Jr(this.activeRank,t,r),e&&Jr(e,t,this.cursor.from),this.minActive=Au(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),n&&Xr(n,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[s]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Cu(i,e,t,n,s,r){i.goto(e),t.goto(n);let o=n+s,l=n,a=n-e;for(;;){let c=i.to+a-t.to||i.endSide-t.endSide,u=c<0?i.to+a:t.to,h=Math.min(u,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&ha(i.activeForPoint(i.to),t.activeForPoint(t.to))||r.comparePoint(l,h,i.point,t.point):h>l&&!ha(i.active,t.active)&&r.compareRange(l,h,i.active,t.active),u>o)break;l=u,c<=0&&i.next(),c>=0&&t.next()}}function ha(i,e){if(i.length!=e.length)return!1;for(let t=0;t=e;n--)i[n+1]=i[n];i[e]=t}function Au(i,e){let t=-1,n=1e9;for(let s=0;s=e)return s;if(s==i.length)break;r+=i.charCodeAt(s)==9?t-r%t:1,s=nn(i,s)}return n===!0?-1:i.length}const da="ͼ",Tu=typeof Symbol=="undefined"?"__"+da:Symbol.for(da),pa=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Mu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class qi{constructor(e,t){this.rules=[];let{finish:n}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(y=>o.map(b=>y.replace(/&/,b))).reduce((y,b)=>y.concat(b)),p,a);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,u,f)}else p!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(u.length||f)&&a.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=Mu[Tu]||1;return Mu[Tu]=e+1,da+e.toString(36)}static mount(e,t,n){let s=e[pa],r=n&&n.nonce;s?r&&s.setNonce(r):s=new xb(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let Du=new Map;class xb{constructor(e,t){let n=e.ownerDocument||e,s=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=Du.get(n);if(r)return e[pa]=r;this.sheet=new s.CSSStyleSheet,Du.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[pa]=this}mount(e,t){let n=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),n)for(let c=0;c",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Sb=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Cb=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var en=0;en<10;en++)Ui[48+en]=Ui[96+en]=String(en);for(var en=1;en<=24;en++)Ui[en+111]="F"+en;for(var en=65;en<=90;en++)Ui[en]=String.fromCharCode(en+32),kr[en]=String.fromCharCode(en);for(var Ol in Ui)kr.hasOwnProperty(Ol)||(kr[Ol]=Ui[Ol]);function Ab(i){var e=Sb&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||Cb&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?kr:Ui)[i.keyCode]||i.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}function xr(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function ma(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Tb(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ao(i,e){if(!e.anchorNode)return!1;try{return ma(i,e.anchorNode)}catch(t){return!1}}function Hs(i){return i.nodeType==3?ms(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function mr(i,e,t,n){return t?Ou(i,e,t,n,-1)||Ou(i,e,t,n,1):!1}function ps(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function $o(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Ou(i,e,t,n,s){for(;;){if(i==t&&e==n)return!0;if(e==(s<0?0:vi(i))){if(i.nodeName=="DIV")return!1;let r=i.parentNode;if(!r||r.nodeType!=1)return!1;e=ps(i)+(s<0?0:1),i=r}else if(i.nodeType==1){if(i=i.childNodes[e+(s<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=s<0?vi(i):0}else return!1}}function vi(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function ul(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function Mb(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Wf(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function Db(i,e,t,n,s,r,o,l){let a=i.ownerDocument,c=a.defaultView||window;for(let u=i,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,p=1,y=1;if(d)f=Mb(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let A=u.getBoundingClientRect();({scaleX:p,scaleY:y}=Wf(u,A)),f={left:A.left,right:A.left+u.clientWidth*p,top:A.top,bottom:A.top+u.clientHeight*y}}let b=0,m=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+m&&(m=e.bottom-f.bottom+m+o)):e.bottom>f.bottom&&(m=e.bottom-f.bottom+o,t<0&&e.top-m0&&e.right>f.right+b&&(b=e.right-f.right+b+r)):e.right>f.right&&(b=e.right-f.right+r,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class Eb{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?vi(t):0),n,Math.min(e.focusOffset,n?vi(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let Ss=null;function jf(i){if(i.setActive)return i.setActive();if(Ss)return i.focus(Ss);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Ss==null?{get preventScroll(){return Ss={preventScroll:!0},!0}}:void 0),!Ss){Ss=!1;for(let t=0;tMath.max(1,i.scrollHeight-i.clientHeight-4)}function Kf(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=vi(t)}else if(t.parentNode&&!$o(t))n=ps(t),t=t.parentNode;else return null}}function Gf(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&nt)return h.domBoundsAround(e,t,c);if(f>=e&&s==-1&&(s=a,r=c),c>t&&h.dom.parentNode==this.dom){o=a,l=u;break}u=f,c=f+h.breakAfter}return{from:r,to:l<0?n+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ic){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Xf(i,e,t,n,s,r,o,l,a){let{children:c}=i,u=c.length?c[e]:null,h=r.length?r[r.length-1]:null,f=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!f&&r.length<2&&u.merge(t,s,r.length?h:null,t==0,l,a))){if(n0&&(!o&&r.length&&u.merge(t,u.length,r[0],!1,l,0)?u.breakAfter=r.shift().breakAfter:(t2);var Re={mac:Ru||/Mac/.test(kn.platform),windows:/Win/.test(kn.platform),linux:/Linux|X11/.test(kn.platform),ie:hl,ie_version:Qf?ga.documentMode||6:ya?+ya[1]:ba?+ba[1]:0,gecko:Pu,gecko_version:Pu?+(/Firefox\/(\d+)/.exec(kn.userAgent)||[0,0])[1]:0,chrome:!!El,chrome_version:El?+El[1]:0,ios:Ru,android:/Android\b/.test(kn.userAgent),webkit:Bu,safari:Zf,webkit_version:Bu?+(/\bAppleWebKit\/(\d+)/.exec(kn.userAgent)||[0,0])[1]:0,tabSize:ga.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Bb=256;class Xn extends At{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof Xn)||this.length-(t-e)+n.length>Bb||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Xn(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new an(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Rb(this.dom,e,t)}}class ki extends At{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let s of t)s.setParent(this)}setAttrs(e){if(qf(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,s,r,o){return n&&(!(n instanceof ki&&n.mark.eq(this.mark))||e&&r<=0||te&&t.push(n=e&&(s=r),n=a,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new ki(this.mark,t,o)}domAtPos(e){return ed(this,e)}coordsAt(e,t){return nd(this,e,t)}}function Rb(i,e,t){let n=i.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;e==0&&t<0||e==n&&t>=0?Re.chrome||Re.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Re.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,c=>c.width)||a),o?ul(a,o<0):a||null}class Ni extends At{static create(e,t,n){return new Ni(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ni.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,s,r,o){return n&&(!(n instanceof Ni)||!this.widget.compare(n.widget)||e>0&&r<=0||t0)?an.before(this.dom):an.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?s.length-1:0;r=s[l],!(e>0?l==0:l==s.length-1||r.top0?an.before(this.dom):an.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return yt.empty}get isHidden(){return!0}}Xn.prototype.children=Ni.prototype.children=Ws.prototype.children=ic;function ed(i,e){let t=i.dom,{children:n}=i,s=0;for(let r=0;sr&&e0;r--){let o=n[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof ki&&s.length&&(n=s[s.length-1])instanceof ki&&n.mark.eq(e.mark)?td(n,e.children[0],t-1):(s.push(e),e.setParent(i)),i.length+=e.length}function nd(i,e,t){let n=null,s=-1,r=null,o=-1;function l(c,u){for(let h=0,f=0;h=u&&(d.children.length?l(d,u-f):(!r||r.isHidden&&t>0)&&(p>u||f==p&&d.getSide()>0)?(r=d,o=u-f):(f-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of n)if(r!=t&&(s.indexOf(r)==-1||i[r]!==e[r]))return!1;return!0}function va(i,e,t){let n=!1;if(e)for(let s in e)t&&s in t||(n=!0,s=="style"?i.style.cssText="":i.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(n=!0,s=="style"?i.style.cssText=t[s]:i.setAttribute(s,t[s]));return n}function Ib(i){let e=Object.create(null);for(let t=0;t0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){_o(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){td(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=wa(t,this.attrs||{})),n&&(this.attrs=wa({class:n},this.attrs||{}))}domAtPos(e){return ed(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(qf(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(va(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&At.get(s)instanceof ki;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((n=At.get(s))===null||n===void 0?void 0:n.isEditable)==!1&&(!Re.ios||!this.children.some(r=>r instanceof Xn))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof Xn)||/[^ -~]/.test(n.text))return null;let s=Hs(n.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=nd(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=n.bottom-n.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof Ht)return r;if(o>t)break}s=o+r.breakAfter}return null}}class wi extends At{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,s,r,o){return n&&(!(n instanceof wi)||!this.widget.compare(n.widget)||e>0&&r<=0||t0}}class Ci{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var bn=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(bn||(bn={}));class _e extends ds{constructor(e,t,n,s){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(e){return new zr(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ki(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,s;if(e.isBlockGap)n=-5e8,s=4e8;else{let{start:r,end:o}=id(e,t);n=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Ki(e,n,s,t,e.widget||null,!0)}static line(e){return new Vr(e)}static set(e,t=!1){return gt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}_e.none=gt.empty;class zr extends _e{constructor(e){let{start:t,end:n}=id(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof zr&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&_o(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}zr.prototype.point=!1;class Vr extends _e{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Vr&&this.spec.class==e.spec.class&&_o(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Vr.prototype.mapMode=gn.TrackBefore;Vr.prototype.point=!0;class Ki extends _e{constructor(e,t,n,s,r,o){super(t,n,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?gn.TrackBefore:gn.TrackAfter:gn.TrackDel}get type(){return this.startSide!=this.endSide?bn.WidgetRange:this.startSide<=0?bn.WidgetBefore:bn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ki&&Lb(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ki.prototype.point=!0;function id(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t!=null?t:e,end:n!=null?n:e}}function Lb(i,e){return i==e||!!(i&&e&&i.compare(e))}function ka(i,e,t,n=0){let s=t.length-1;s>=0&&t[s]+n>=i?t[s]=Math.max(t[s],e):t.push(i,e)}class gr{constructor(e,t,n,s){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof wi&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ht),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Qr(new Ws(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof wi)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Qr(new Xn(this.text.slice(this.textOff,this.textOff+s)),t),n),this.atCursorPos=!0,this.textOff+=s,e-=s,n=0}}span(e,t,n,s){this.buildText(t-e,n,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,n,s,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Ki){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(n instanceof Ki)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new wi(n.widget||js.block,l,n));else{let a=Ni.create(n.widget||js.inline,l,l?0:n.startSide),c=this.atCursorPos&&!a.isEditable&&r<=s.length&&(e0),u=!a.isEditable&&(es.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(h.append(Qr(new Ws(1),s),r),r=s.length+Math.max(0,r-s.length)),h.append(Qr(a,s),r),this.atCursorPos=u,this.pendingBuffer=u?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,n,s,r){let o=new gr(e,t,n,r);return o.openEnd=gt.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Qr(i,e){for(let t of e)i=new ki(t,[i],i.length);return i}class js extends Ci{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}js.inline=new js("span");js.block=new js("div");var Rt=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Rt||(Rt={}));const gs=Rt.LTR,sc=Rt.RTL;function sd(i){let e=[];for(let t=0;t=t){if(l.level==n)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function od(i,e){if(i.length!=e.length)return!1;for(let t=0;t=0;y-=3)if(si[y+1]==-d){let b=si[y+2],m=b&2?s:b&4?b&1?r:s:0;m&&(Ct[h]=Ct[si[y]]=m),l=y;break}}else{if(si.length==189)break;si[l++]=h,si[l++]=f,si[l++]=a}else if((p=Ct[h])==2||p==1){let y=p==s;a=y?0:1;for(let b=l-3;b>=0;b-=3){let m=si[b+2];if(m&2)break;if(y)si[b+2]|=2;else{if(m&4)break;si[b+2]|=4}}}}}function Wb(i,e,t,n){for(let s=0,r=n;s<=t.length;s++){let o=s?t[s-1].to:i,l=sa;)p==b&&(p=t[--y].from,b=y?t[y-1].to:i),Ct[--p]=d;a=u}else r=c,a++}}}function Sa(i,e,t,n,s,r,o){let l=n%2?2:1;if(n%2==s%2)for(let a=e,c=0;aa&&o.push(new Ii(a,y.from,d));let b=y.direction==gs!=!(d%2);Ca(i,b?n+1:n,s,y.inner,y.from,y.to,o),a=y.to}p=y.to}else{if(p==t||(u?Ct[p]!=l:Ct[p]==l))break;p++}f?Sa(i,a,p,n+1,s,f,o):ae;){let u=!0,h=!1;if(!c||a>r[c-1].to){let y=Ct[a-1];y!=l&&(u=!1,h=y==16)}let f=!u&&l==1?[]:null,d=u?n:n+1,p=a;e:for(;;)if(c&&p==r[c-1].to){if(h)break e;let y=r[--c];if(!u)for(let b=y.from,m=c;;){if(b==e)break e;if(m&&r[m-1].to==b)b=r[--m].from;else{if(Ct[b-1]==l)break e;break}}if(f)f.push(y);else{y.toCt.length;)Ct[Ct.length]=256;let n=[],s=e==gs?0:1;return Ca(i,s,s,t,0,i.length,n),n}function ld(i){return[new Ii(0,i,0)]}let ad="";function qb(i,e,t,n,s){var r;let o=n.head-i.from,l=Ii.find(e,o,(r=n.bidiLevel)!==null&&r!==void 0?r:-1,n.assoc),a=e[l],c=a.side(s,t);if(o==c){let f=l+=s?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!s,t),c=a.side(s,t)}let u=nn(i.text,o,a.forward(s,t));(ua.to)&&(u=c),ad=i.text.slice(Math.min(o,u),Math.max(o,u));let h=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return h&&u==c&&h.level+(s?0:1)i.some(e=>e)}),gd=Ne.define({combine:i=>i.some(e=>e)}),bd=Ne.define();class Ns{constructor(e,t="nearest",n="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Ns(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ns(ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zr=nt.define({map:(i,e)=>i.map(e)}),yd=nt.define();function An(i,e,t){let n=i.facet(fd);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)}const Fi=Ne.define({combine:i=>i.length?i[0]:!0});let Kb=0;const or=Ne.define();class Vt{constructor(e,t,n,s,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=t||{};return new Vt(Kb++,e,n,s,l=>{let a=[or.of(l)];return o&&a.push(Sr.of(c=>{let u=c.plugin(l);return u?o(u):_e.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return Vt.define(n=>new e(n),t)}}class Fl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(An(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(s){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){An(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){An(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const wd=Ne.define(),rc=Ne.define(),Sr=Ne.define(),vd=Ne.define(),oc=Ne.define(),kd=Ne.define();function Iu(i,e){let t=i.state.facet(kd);if(!t.length)return t;let n=t.map(r=>r instanceof Function?r(i):r),s=[];return gt.spans(n,e.from,e.to,{point(){},span(r,o,l,a){let c=r-e.from,u=o-e.from,h=s;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,p;if(d==null&&(d=Ub(e.text,c,u)),a>0&&h.length&&(p=h[h.length-1]).to==c&&p.direction==d)p.to=u,h=p.inner;else{let y={from:c,to:u,direction:d,inner:[]};h.push(y),h=y.inner}}}}),s}const xd=Ne.define();function Sd(i){let e=0,t=0,n=0,s=0;for(let r of i.state.facet(xd)){let o=r(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:n,bottom:s}}const lr=Ne.define();class Hn{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new Hn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>n.toA)){if(s.toAu)break;r+=2}if(!a)return n;new Hn(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,l=a.toB}}}class zo{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Ut.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Hn(r,o,l,a))),this.changedRanges=s}static create(e,t,n){return new zo(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Lu extends At{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=_e.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Ht],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Hn(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>uthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!ey(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Yb(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new Hn(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Re.ie||Re.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Qb(o,l,e.changes);return n=Hn.extendWithRanges(n,a),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Re.chrome||Re.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:c,fromB:u,toB:h}=l,f,d,p,y;if(n&&n.range.fromBu){let F=gr.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),D=gr.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);d=F.breakAtStart,p=F.openStart,y=D.openEnd;let E=this.compositionView(n);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),F.content.length&&E.merge(0,0,F.content[F.content.length-1],!0,0,F.openEnd)&&F.content.pop(),f=F.content.concat(E).concat(D.content)}else({content:f,breakAtStart:d,openStart:p,openEnd:y}=gr.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:b,off:m}=r.findPos(c,1),{i:A,off:v}=r.findPos(a,-1);Xf(this,A,v,b,m,f,d,p,y)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(yd)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new Xn(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new ki(s,[t],t.length);let n=new Ht;return n.append(t,0),n}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=At.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},n=this.childPos(e.range.fromB,1),s=this.children[n.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)n=s.childPos(n.off,1),s=s.children[n.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,s=n==this.dom,r=!s&&Ao(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Re.gecko&&l.empty&&!this.hasComposition&&Gb(a)){let h=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(h,a.node.childNodes[a.offset]||null)),a=c=new an(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!mr(a.node,a.offset,u.anchorNode,u.anchorOffset)||!mr(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{Re.android&&Re.chrome&&this.dom.contains(u.focusNode)&&Zb(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=xr(this.view.root);if(h)if(l.empty){if(Re.gecko){let f=Xb(a.node,a.offset);if(f&&f!=3){let d=(f==1?Kf:Gf)(a.node,a.offset);d&&(a=new an(d.node,d.offset))}}h.collapse(a.node,a.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(a.node,a.offset);try{h.extend(c.node,c.offset)}catch(f){}}else{let f=document.createRange();l.anchor>l.head&&([a,c]=[c,a]),f.setEnd(c.node,c.offset),f.setStart(a.node,a.offset),h.removeAllRanges(),h.addRange(f)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,c)),this.impreciseAnchor=a.precise?null:new an(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new an(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&mr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=xr(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Ht.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!a||!c||a.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(s,r)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let s=e.offset;!n&&s=0;s--){let r=At.get(t.childNodes[s]);r instanceof Ht&&(n=r.domAtPos(r.length))}return n?new an(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=At.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,c=a-l.length;if(ae||l.covers(1))&&(!n||l instanceof Ht&&!(n instanceof Ht&&t>=0)))n=l,s=c;else if(n&&c==e&&a==e&&l instanceof wi&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(n=null)}r=c}return n?n.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),s=this.children[t];if(!(s instanceof Ht))return null;for(;s.children.length;){let{i:l,off:a}=s.childPos(n,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}n=a}if(!(s instanceof Xn))return null;let r=nn(s.text,n);if(r==n)return null;let o=ms(s.dom,n,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Rt.LTR;for(let c=0,u=0;us)break;if(c>=n){let d=h.dom.getBoundingClientRect();if(t.push(d.height),o){let p=h.dom.lastChild,y=p?Hs(p):[];if(y.length){let b=y[y.length-1],m=a?b.right-d.left:d.right-b.left;m>l&&(l=m,this.minWidth=r,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Rt.RTL:Rt.LTR}measureTextSize(){for(let r of this.children)if(r instanceof Ht){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Hs(e.firstChild)[0];t=e.getBoundingClientRect().height,n=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Yf(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>n){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(_e.replace({widget:new $u(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return _e.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Sr).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,s=this.view.state.facet(vd).map((r,o)=>{let l=typeof r=="function";return l&&(n=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(gt.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.anchor?-1:1),s;if(!n)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let r=Sd(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Db(this.view.scrollDOM,o,t.head{ne.from&&(t=!0)}),t}function ty(i,e,t=1){let n=i.charCategorizer(e),s=i.doc.lineAt(e),r=e-s.from;if(s.length==0)return ce.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=nn(s.text,r,!1):l=nn(s.text,r);let a=n(s.text.slice(o,l));for(;o>0;){let c=nn(s.text,o,!1);if(n(s.text.slice(c,o))!=a)break;o=c}for(;li?e.left-i:Math.max(0,i-e.right)}function iy(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Pl(i,e){return i.tope.top+1}function _u(i,e){return ei.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function Ta(i,e,t){let n,s,r,o,l=!1,a,c,u,h;for(let p=i.firstChild;p;p=p.nextSibling){let y=Hs(p);for(let b=0;bv||o==v&&r>A){n=p,s=m,r=A,o=v;let F=v?t0?b0)}A==0?t>m.bottom&&(!u||u.bottomm.top)&&(c=p,h=m):u&&Pl(u,m)?u=zu(u,m.bottom):h&&Pl(h,m)&&(h=_u(h,m.top))}}if(u&&u.bottom>=t?(n=a,s=u):h&&h.top<=t&&(n=c,s=h),!n)return{node:i,offset:0};let f=Math.max(s.left,Math.min(s.right,e));if(n.nodeType==3)return Vu(n,f,t);if(l&&n.contentEditable!="false")return Ta(n,f,t);let d=Array.prototype.indexOf.call(i.childNodes,n)+(e>=(s.left+s.right)/2?1:0);return{node:i,offset:d}}function Vu(i,e,t){let n=i.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h=(u.left+u.right)/2,d=f;if((Re.chrome||Re.gecko)&&ms(i,l).getBoundingClientRect().left==u.right&&(d=!f),h<=0)return{node:i,offset:l+(d?1:0)};s=l+(d?1:0),r=h}}}return{node:i,offset:s>-1?s:o>0?i.nodeValue.length:0}}function Ad(i,e,t,n=-1){var s,r;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:c}=i.viewState,{x:u,y:h}=e,f=h-l;if(f<0)return 0;if(f>c)return i.state.doc.length;for(let F=i.viewState.heightOracle.textHeight/2,D=!1;a=i.elementAtHeight(f),a.type!=bn.Text;)for(;f=n>0?a.bottom+F:a.top-F,!(f>=0&&f<=c);){if(D)return t?null:0;D=!0,n=-n}h=l+f;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:Hu(i,o,a,u,h);let p=i.dom.ownerDocument,y=i.root.elementFromPoint?i.root:p,b=y.elementFromPoint(u,h);b&&!i.contentDOM.contains(b)&&(b=null),b||(u=Math.max(o.left+1,Math.min(o.right-1,u)),b=y.elementFromPoint(u,h),b&&!i.contentDOM.contains(b)&&(b=null));let m,A=-1;if(b&&((s=i.docView.nearest(b))===null||s===void 0?void 0:s.isEditable)!=!1){if(p.caretPositionFromPoint){let F=p.caretPositionFromPoint(u,h);F&&({offsetNode:m,offset:A}=F)}else if(p.caretRangeFromPoint){let F=p.caretRangeFromPoint(u,h);F&&({startContainer:m,startOffset:A}=F,(!i.contentDOM.contains(m)||Re.safari&&sy(m,A,u)||Re.chrome&&ry(m,A,u))&&(m=void 0))}}if(!m||!i.docView.dom.contains(m)){let F=Ht.find(i.docView,d);if(!F)return f>a.top+a.height/2?a.to:a.from;({node:m,offset:A}=Ta(F.dom,u,h))}let v=i.docView.nearest(m);if(!v)return null;if(v.isWidget&&((r=v.dom)===null||r===void 0?void 0:r.nodeType)==1){let F=v.dom.getBoundingClientRect();return e.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(i.defaultLineHeight-l)*.5)/l);r+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+fa(o,r,i.state.tabSize)}function sy(i,e,t){let n;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(let s=i.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return ms(i,n-1,n).getBoundingClientRect().left>t}function ry(i,e,t){if(e!=0)return!1;for(let s=i;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let n=i.nodeType==1?i.getBoundingClientRect():ms(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function Ma(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==bn.Text))return n}return t}function oy(i,e,t,n){let s=Ma(i,e.head),r=!n||s.type!=bn.Text||!(i.lineWrapping||s.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(s.from),a=i.posAtCoords({x:t==(l==Rt.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return ce.cursor(a,t?-1:1)}return ce.cursor(t?s.to:s.from,t?-1:1)}function Wu(i,e,t,n){let s=i.state.doc.lineAt(e.head),r=i.bidiSpans(s),o=i.textDirectionAt(s.from);for(let l=e,a=null;;){let c=qb(s,r,o,l,t),u=ad;if(!c){if(s.number==(t?i.state.doc.lines:1))return l;u=` `,s=i.state.doc.line(s.number+(t?1:-1)),r=i.bidiSpans(s),c=i.visualLineSide(s,!t)}if(a){if(!a(u))return l}else{if(!n)return c;a=n(u)}l=c}}function ly(i,e,t){let n=i.state.charCategorizer(e),s=n(t);return r=>{let o=n(r);return s==It.Space&&(s=o),s==o}}function ay(i,e,t,n){let s=e.head,r=t?1:-1;if(s==(t?i.state.doc.length:0))return ce.cursor(s,e.assoc);let o=e.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(s,e.assoc||-1),u=i.documentTop;if(c)o==null&&(o=c.left-a.left),l=r<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+u}let h=a.left+o,f=n!=null?n:i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(f+d)*r,y=Ad(i,{x:h,y:p},!1,r);if(pa.bottom||(r<0?ys)){let b=i.docView.coordsForChar(y),m=!b||p{if(e>r&&es(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:ce.cursor(n,nnull),Re.gecko&&Ay(e.contentDOM.ownerDocument)}handleEvent(e){!by(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let s of n.observers)s(this.view,t);for(let s of n.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=uy(e),n=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=n[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Md.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Re.android&&Re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Td.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||hy.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:Re.safari&&!Re.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ju(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(s){An(t.state,s)}}}function uy(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let s=n.spec;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];o&&t(r).handlers.push(ju(n.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];o&&t(r).observers.push(ju(n.value,o))}}for(let n in Jn)t(n).handlers.push(Jn[n]);for(let n in jn)t(n).observers.push(jn[n]);return e}const Td=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hy="dthko",Md=[16,17,18,20,91,92,224,225],eo=6;function to(i){return Math.max(0,i)*.7+8}function fy(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class dy{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Ob(e.contentDOM),this.atoms=e.state.facet(oc).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(ht.allowMultipleSelections)&&py(e,t),this.dragging=gy(e,t)&&Fd(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&fy(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,s=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=Sd(this.view);e.clientX-o.left<=r.left+eo?n=-to(r.left-e.clientX):e.clientX+o.right>=r.right-eo&&(n=to(e.clientX-r.right)),e.clientY-o.top<=r.top+eo?s=-to(r.top-e.clientY):e.clientY+o.bottom>=r.bottom-eo&&(s=to(e.clientY-r.bottom)),this.setScrollSpeed(n,s)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;nt.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function py(i,e){let t=i.state.facet(cd);return t.length?t[0](e):Re.mac?e.metaKey:e.ctrlKey}function my(i,e){let t=i.state.facet(ud);return t.length?t[0](e):Re.mac?!e.altKey:!e.ctrlKey}function gy(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=xr(i.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function by(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=At.get(t))&&n.ignoreEvent(e))return!1;return!0}const Jn=Object.create(null),jn=Object.create(null),Dd=Re.ie&&Re.ie_version<15||Re.ios&&Re.webkit_version<604;function yy(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Od(i,t.value)},50)}function Od(i,e){let{state:t}=i,n,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Da!=null&&t.selection.ranges.every(a=>a.empty)&&Da==r.toString()){let a=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==a)return{range:c};a=u.from;let h=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:ce.cursor(c.from+h.length)}})}else o?n=t.changeByRange(a=>{let c=r.line(s++);return{changes:{from:a.from,to:a.to,insert:c.text},range:ce.cursor(a.from+c.length)}}):n=t.replaceSelection(r);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}jn.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};Jn.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);jn.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};jn.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};Jn.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(hd))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=ky(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new dy(i,e,t,n)),n&&i.observer.ignore(()=>{jf(i.contentDOM);let r=i.root.activeElement;r&&!r.contains(i.contentDOM)&&r.blur()});let s=i.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}return!1};function qu(i,e,t,n){if(n==1)return ce.cursor(e,t);if(n==2)return ty(i.state,e,t);{let s=Ht.find(i.docView,e),r=i.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return li>=e.top&&i<=e.bottom,Uu=(i,e,t)=>Ed(e,t)&&i>=t.left&&i<=t.right;function wy(i,e,t,n){let s=Ht.find(i.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Uu(t,n,o))return-1;let l=s.coordsAt(r,1);return l&&Uu(t,n,l)?1:o&&Ed(n,o)?-1:1}function Ku(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:wy(i,t,e.clientX,e.clientY)}}const vy=Re.ie&&Re.ie_version<=11;let Gu=null,Yu=0,Xu=0;function Fd(i){if(!vy)return i.detail;let e=Gu,t=Xu;return Gu=i,Xu=Date.now(),Yu=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Yu+1)%3:1}function ky(i,e){let t=Ku(i,e),n=Fd(e),s=i.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=Ku(i,r),c,u=qu(i,a.pos,a.bias,n);if(t.pos!=a.pos&&!o){let h=qu(i,t.pos,t.bias,n),f=Math.min(h.from,u.from),d=Math.max(h.to,u.to);u=f1&&(c=xy(s,a.pos))?c:l?s.addRange(u):ce.create([u])}}}function xy(i,e){for(let t=0;t=e)return ce.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}Jn.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let s=i.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=ce.range(r,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",i.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Jn.dragend=i=>(i.inputState.draggedContent=null,!1);function Ju(i,e,t,n){if(!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=i.inputState,o=n&&r&&my(i,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}Jn.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),s=0,r=()=>{++s==t.length&&Ju(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ju(i,e,n,!0),!0}return!1};Jn.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Dd?null:e.clipboardData;return t?(Od(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(yy(i),!1)};function Sy(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function Cy(i){let e=[],t=[],n=!1;for(let s of i.selection.ranges)s.empty||(e.push(i.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of i.selection.ranges){let o=i.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),s=o.number}n=!0}return{text:e.join(i.lineBreak),ranges:t,linewise:n}}let Da=null;Jn.copy=Jn.cut=(i,e)=>{let{text:t,ranges:n,linewise:s}=Cy(i.state);if(!t&&!s)return!1;Da=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=Dd?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(Sy(i,t),!1)};const Pd=Si.define();function Bd(i,e){let t=[];for(let n of i.facet(pd)){let s=n(i,e);s&&t.push(s)}return t?i.update({effects:t,annotations:Pd.of(!0)}):null}function Rd(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=Bd(i.state,e);t?i.dispatch(t):i.update([])}},10)}jn.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Rd(i)};jn.blur=i=>{i.observer.clearSelectionRange(),Rd(i)};jn.compositionstart=jn.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};jn.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Re.chrome&&Re.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};jn.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};Jn.beforeinput=(i,e)=>{var t;let n;if(Re.chrome&&Re.android&&(n=Td.find(s=>s.inputType==e.inputType))&&(i.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Re.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),Re.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>jn.compositionend(i,e),20),!1};const Qu=new Set;function Ay(i){Qu.has(i)||(Qu.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Zu=["pre-wrap","normal","pre-line","break-spaces"];class Ty{constructor(e){this.lineWrapping=e,this.doc=yt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Zu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=n,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let c=0;c0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Mo&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return yn.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,s){let r=this,o=n.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:c,fromB:u,toB:h}=s[l],f=r.lineAt(a,Pt.ByPosNoHeight,n.setDoc(t),0,0),d=f.to>=c?f:r.lineAt(c,Pt.ByPosNoHeight,n,0,0);for(h+=d.to-c,c=d.to;l>0&&f.from<=s[l-1].toA;)a=s[l-1].fromA,u=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),n+=1+l.break,s-=l.size}else if(r>s*2){let l=e[n];l.break?e.splice(n,1,l.left,null,l.right):e.splice(n,1,l.left,l.right),n+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,n,s,r))}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Rn extends Nd{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,s){return new ui(s,this.length,n,this.height,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof Rn||s instanceof Qt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Qt?s=new Rn(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):yn.of(n)}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Qt extends yn{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-n+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:n,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,n,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+(e0){let r=n[n.length-1];r instanceof Qt?n[n.length-1]=new Qt(r.length+s):n.push(null,new Qt(s-1))}if(e>0){let r=n[0];r instanceof Qt?n[0]=new Qt(e+r.length):n.unshift(new Qt(e-1),null)}return yn.of(n)}decomposeLeft(e,t){t.push(new Qt(e-1),null)}decomposeRight(e,t){t.push(null,new Qt(this.length-e-1))}updateHeight(e,t=0,n=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new Qt(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let h=s.heights[s.index++];a==-1?a=h:Math.abs(h-a)>=Mo&&(a=-2);let f=new Rn(u,h);f.outdated=!1,o.push(f),l+=u+1}l<=r&&o.push(null,new Qt(r-l).updateHeight(e,l));let c=yn.of(o);return(a<0||Math.abs(c.height-this.height)>=Mo||Math.abs(a-this.heightMetrics(e,t).perLine)>=Mo)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Dy extends yn{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,s){let r=n+this.left.height;return el))return c;let u=t==Pt.ByPosNoHeight?Pt.ByPosNoHeight:Pt.ByPos;return a?c.join(this.right.lineAt(l,u,n,o,l)):this.left.lineAt(l,u,n,s,r).join(c)}forEachLine(e,t,n,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,l,a,o);else{let c=this.lineAt(a,Pt.ByPos,n,s,r);e=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,l,a,o)}}replace(e,t,n){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,n));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of n)r.push(l);if(e>0&&eh(r,o-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,s=n+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?yn.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,n,s):r.updateHeight(e,t,n),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,n,s):o.updateHeight(e,l,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function eh(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof Qt&&(n=i[e+1])instanceof Qt&&i.splice(e-1,3,new Qt(t.length+1+n.length))}const Oy=5;class lc{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Rn?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Rn(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=Oy)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Rn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Qt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Rn)return e;let t=new Rn(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Rn)&&!this.isCovered?this.nodes.push(new Rn(0,-1)):(this.writtenTou.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();r=Math.max(r,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=c==i.parentNode?f.bottom:Math.min(a,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function By(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Rl{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;ntypeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Ty(t),this.stateDeco=e.facet(Sr).filter(n=>typeof n!="function"),this.heightMap=yn.empty().applyChanges(this.stateDeco,yt.empty,this.heightOracle.setDoc(e.doc),[new Hn(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=_e.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let s=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new no(r,o))}}return this.viewports=e.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?nh:new ac(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ar(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Sr).filter(u=>typeof u!="function");let s=e.changedRanges,r=Hn.extendWithRanges(s,Ey(n,this.stateDeco,e?e.changes:Ut.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let c=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(gd)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Rt.RTL:Rt.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,u=0;if(l.width&&l.height){let{scaleX:F,scaleY:D}=Wf(t,l);(F>.005&&Math.abs(this.scaleX-F)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=F,this.scaleY=D,c|=8,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Uf(e.scrollDOM);let p=(this.printing?By:Py)(t,this.paddingTop),y=p.top-this.pixelViewport.top,b=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let A=l.width;if((this.contentDOMWidth!=A||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),a){let F=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(F)&&(o=!0),o||s.lineWrapping&&Math.abs(A-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:P}=e.docView.measureTextSize();o=D>0&&s.refresh(r,D,E,P,A/E,F),o&&(e.docView.minWidth=0,c|=8)}y>0&&b>0?u=Math.max(y,b):y<0&&b<0&&(u=Math.min(y,b)),s.heightChanged=!1;for(let D of this.viewports){let E=D.from==this.viewport.from?F:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?yn.empty().applyChanges(this.stateDeco,yt.empty,this.heightOracle,[new Hn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new My(D.from,E))}s.heightChanged&&(c|=2)}let v=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new no(s.lineAt(o-n*1e3,Pt.ByHeight,r,0,0).from,s.lineAt(l+(1-n)*1e3,Pt.ByHeight,r,0,0).to);if(t){let{head:c}=t.range;if(ca.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=s.lineAt(c,Pt.ByPos,r,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c=l+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=Rt.LTR&&!n)return[];let l=[],a=(u,h,f,d)=>{if(h-uu&&mm.from>=f.from&&m.to<=f.to&&Math.abs(m.from-u)m.fromA));if(!b){if(hm.from<=h&&m.to>=h)){let m=t.moveToLineBoundary(ce.cursor(h),!1,!0).head;m>u&&(h=m)}b=new Rl(u,h,this.gapSize(f,u,h,d))}l.push(b)},c=u=>{if(u.lengthu.from&&a(u.from,d,u,h),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];gt.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ar(this.heightMap.lineAt(e,Pt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ar(this.heightMap.lineAt(this.scaler.fromDOM(e),Pt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ar(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class no{constructor(e,t){this.from=e,this.to=t}}function Ny(i,e,t){let n=[],s=i,r=0;return gt.spans(t,i,e,{span(){},point(o,l){o>s&&(n.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(n<=l)return r+n;n-=l}}function so(i,e){let t=0;for(let{from:n,to:s}of i.ranges){if(e<=s){t+=e-n;break}t+=s-n}return t/i.total}function Iy(i,e){for(let t of i)if(e(t))return t}const nh={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class ac{constructor(e,t,n){let s=0,r=0,o=0;this.viewports=n.map(({from:l,to:a})=>{let c=t.lineAt(l,Pt.ByPos,e,0,0).top,u=t.lineAt(a,Pt.ByPos,e,0,0).bottom;return s+=u-c,{from:l,to:a,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,n=0,s=0;;t++){let r=tt.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function ar(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new ui(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(s=>ar(s,e)):i._content)}const ro=Ne.define({combine:i=>i.join(" ")}),Oa=Ne.define({combine:i=>i.indexOf(!0)>-1}),Ea=qi.newName(),Id=qi.newName(),Ld=qi.newName(),$d={"&light":"."+Id,"&dark":"."+Ld};function Fa(i,e,t){return new qi(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return i;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):i+" "+n}})}const Ly=Fa("."+Ea,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$d),cr="￿";class $y{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(ht.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=cr}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let s=e;;){this.findPointBefore(n,s);let r=this.text.length;this.readNode(s);let o=s.nextSibling;if(o==t)break;let l=At.get(s),a=At.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:$o(s))||$o(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)&&this.lineBreak(),s=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=r+o}}readNode(e){if(e.cmIgnore)return;let t=At.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let s=n.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(_y(e,n.node,n.offset)?t:0))}}function _y(i,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let l=r||o?[]:Wy(e),a=new $y(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=jy(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!ma(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!ma(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((Re.ios||Re.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.toDate.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,c=null;(r===8||Re.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:i.state.doc.slice(s.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,s.to))}:(Re.mac||Re.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=ce.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:yt.of([" "])}):Re.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` `&&i.lineWrapping&&(n&&(n=ce.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:yt.of([" "])}),t)return zd(i,t,n,r);if(n&&!n.main.eq(s)){let o=!1,l="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function zd(i,e,t,n=-1){if(Re.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(Re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&i.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Rs(i.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||n==8&&e.insert.lengths.head)&&Rs(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Rs(i.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=Vy(i,e,t));return i.state.facet(dd).some(a=>a(i,e.from,e.to,r,l))||i.dispatch(l()),!0}function Vy(i,e,t){let n,s=i.state,r=s.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=r.frome.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=s.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(s.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let c=i.state.sliceDoc(e.from,e.to),u,h=t&&Cd(i,t.main.head);if(h){let p=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-p}}else u=i.state.doc.lineAt(r.head);let f=r.to-e.to,d=r.to-r.from;n=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:a||p.map(l)};let y=p.to-f,b=y-c.length;if(p.to-p.from!=d||i.state.sliceDoc(b,y)!=c||p.to>=u.from&&p.from<=u.to)return{range:p};let m=s.changes({from:b,to:y,insert:e.insert}),A=p.to-r.to;return{changes:m,range:a?ce.range(Math.max(0,a.anchor+A),Math.max(0,a.head+A)):p.map(m)}})}else n={changes:l,selection:a&&s.selection.replaceRange(a)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:o,scrollIntoView:!0})}function Hy(i,e,t,n){let s=Math.min(i.length,e.length),r=0;for(;r0&&l>0&&i.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Wy(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}=i.observer.selectionRange;return t&&(e.push(new ih(t,n)),(s!=t||r!=n)&&e.push(new ih(s,r))),e}function jy(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?ce.single(t+e,n+e):null}const qy={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Nl=Re.ie&&Re.ie_version<=11;class Uy{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Eb,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(Re.ie&&Re.ie_version<=11||Re.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(Re.chrome&&Re.chrome_version<126)&&(this.editContext=new Gy(e),e.state.facet(Fi)&&(e.contentDOM.editContext=this.editContext.editContext)),Nl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(Fi)?n.root.activeElement!=this.dom:!Ao(n.dom,s))return;let r=s.anchorNode&&n.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Re.ie&&Re.ie_version<=11||Re.android&&Re.chrome)&&!n.state.selection.main.empty&&s.focusNode&&mr(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=xr(e.root);if(!t)return!1;let n=Re.safari&&e.root.nodeType==11&&Tb(this.dom.ownerDocument)==this.dom&&Ky(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Ao(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Rs(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:s}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),s=this.selectionChanged&&Ao(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new zy(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,s=_d(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=sh(t,e.previousSibling||e.target.previousSibling,-1),s=sh(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Fi)!=e.state.facet(Fi)&&(e.view.contentDOM.editContext=e.state.facet(Fi)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function sh(i,e,t){for(;e;){let n=At.get(e);if(n&&n.parent==i)return n;let s=e.parentNode;e=s!=i.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function rh(i,e){let t=e.startContainer,n=e.startOffset,s=e.endContainer,r=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return mr(o.node,o.offset,s,r)&&([t,n,s,r]=[s,r,t,n]),{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:r}}function Ky(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return rh(i,s)}let t=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?rh(i,t):null}class Gy{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});t.addEventListener("textupdate",n=>{let{anchor:s}=e.state.selection.main,r={from:this.toEditorPos(n.updateRangeStart),to:this.toEditorPos(n.updateRangeEnd),insert:yt.of(n.text.split(` `))};r.from==this.from&&sthis.to&&(r.to=s),!(r.from==r.to&&!r.insert.length)&&(this.pendingContextChange=r,zd(e,r,ce.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd))),this.pendingContextChange&&this.revertPending(e.state))}),t.addEventListener("characterboundsupdate",n=>{let s=[],r=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o{let s=[];for(let r of n.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;s.push(_e.mark({attributes:{style:a}}).range(this.toEditorPos(r.rangeStart),this.toEditorPos(r.rangeEnd)))}}e.dispatch({effects:yd.of(_e.set(s))})}),t.addEventListener("compositionstart",()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)}),t.addEventListener("compositionend",()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null}),this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=xr(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,c)=>{if(n)return;let u=c.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,t+=u;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(rthis.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),s&&!n&&this.revertPending(e.state),!n}update(e){!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.to+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}}class Pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(n=>n.forEach(s=>t(s,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Fb(e.parent)||document,this.viewState=new th(e.state||ht.create(e)),e.scrollTo&&e.scrollTo.is(Zr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(or).map(n=>new Fl(n));for(let n of this.plugins)n.update(this);this.observer=new Uy(this),this.inputState=new cy(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Lu(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof Kt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,s,r=this.state;for(let f of e){if(f.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Bd(r,o),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(ht.phrases)!=this.state.facet(ht.phrases))return this.setState(r);s=zo.create(this,r,e),s.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;h=new Ns(d.empty?d:ce.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(Zr)&&(h=d.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=Vo.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(lr)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(ro)!=s.state.facet(ro)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet(Aa))try{f(s)}catch(d){An(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!_d(this,u)&&c.force&&Rs(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new th(e),this.plugins=e.facet(or).map(n=>new Fl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Lu(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(or),n=e.state.facet(or);if(t!=n){let s=[];for(let r of n){let o=t.indexOf(r);if(o<0)s.push(new Fl(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Uf(n))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null||l>5)break;let c=[];a&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(d=>{try{return d.read(this)}catch(p){return An(this.state,p),oh}}),h=zo.create(this,this.state,[]),f=!1;h.flags|=a,t?t.flags|=a:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d1||p<-1){s=s+p,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Aa))l(t)}get themeClasses(){return Ea+" "+(this.state.facet(Oa)?Ld:Id)+" "+this.state.facet(ro)}updateAttrs(){let e=lh(this,wd,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Fi)?"true":"false",class:"cm-content",style:`${Re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),lh(this,rc,t);let n=this.observer.ignore(()=>{let s=va(this.contentDOM,this.contentAttrs,t),r=va(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let s of n.effects)if(s.is(Pe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(lr);let e=this.state.facet(Pe.cspNonce);qi.mount(this.root,this.styleModules.concat(Ly).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;tn.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Bl(this,e,Wu(this,e,t,n))}moveByGroup(e,t){return Bl(this,e,Wu(this,e,t,n=>ly(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return ce.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return oy(this,e,t,n)}moveVertically(e,t,n){return Bl(this,e,ay(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Ad(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Ii.find(r,e-s.from,-1,t)];return ul(n,o.dir==Rt.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(md)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Yy)return ld(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||od(r.isolates,n=Iu(this,e))))return r.order;n||(n=Iu(this,e));let s=jb(e.text,t,n);return this.bidiCache.push(new Vo(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{jf(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Zr.of(new Ns(typeof e=="number"?ce.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Zr.of(new Ns(ce.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Vt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Vt.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qi.newName(),s=[ro.of(n),lr.of(Fa(`.${n}`,e))];return t&&t.dark&&s.push(Oa.of(!0)),s}static baseTheme(e){return vs.lowest(lr.of(Fa("."+Ea,e,$d)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&At.get(n)||At.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}Pe.styleModule=lr;Pe.inputHandler=dd;Pe.scrollHandler=bd;Pe.focusChangeEffect=pd;Pe.perLineTextDirection=md;Pe.exceptionSink=fd;Pe.updateListener=Aa;Pe.editable=Fi;Pe.mouseSelectionStyle=hd;Pe.dragMovesSelection=ud;Pe.clickAddsSelectionRange=cd;Pe.decorations=Sr;Pe.outerDecorations=vd;Pe.atomicRanges=oc;Pe.bidiIsolatedRanges=kd;Pe.scrollMargins=xd;Pe.darkTheme=Oa;Pe.cspNonce=Ne.define({combine:i=>i.length?i[0]:""});Pe.contentAttributes=rc;Pe.editorAttributes=wd;Pe.lineWrapping=Pe.contentAttributes.of({class:"cm-lineWrapping"});Pe.announce=nt.define();const Yy=4096,oh={};class Vo{constructor(e,t,n,s,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let n=[],s=e.length?e[e.length-1].dir:Rt.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=n[s],o=typeof r=="function"?r(i):r;o&&wa(o,t)}return t}const Xy=Re.mac?"mac":Re.windows?"win":Re.linux?"linux":"key";function Jy(i,e){const t=i.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let s,r,o,l;for(let a=0;an.concat(s),[]))),t}function Zy(i,e,t){return Hd(Vd(i.state),e,i,t)}let Pi=null;const ew=4e3;function tw(i,e=Xy){let t=Object.create(null),n=Object.create(null),s=(o,l)=>{let a=n[o];if(a==null)n[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,c,u)=>{var h,f;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>Jy(m,e));for(let m=1;m{let F=Pi={view:v,prefix:A,scope:o};return setTimeout(()=>{Pi==F&&(Pi=null)},ew),!0}]})}let y=p.join(" ");s(y,!1);let b=d[y]||(d[y]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&b.run.push(a),c&&(b.preventDefault=!0),u&&(b.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of l){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(d=>h(d,Pa))}let a=o[e]||o.key;if(a)for(let c of l)r(c,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(c,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let Pa=null;function Hd(i,e,t,n){Pa=e;let s=Ab(e),r=Zt(s,0),o=$n(r)==s.length&&s!=" ",l="",a=!1,c=!1,u=!1;Pi&&Pi.view==t&&Pi.scope==n&&(l=Pi.prefix+" ",Md.indexOf(e.keyCode)<0&&(c=!0,Pi=null));let h=new Set,f=b=>{if(b){for(let m of b.run)if(!h.has(m)&&(h.add(m),m(t)))return b.stopPropagation&&(u=!0),!0;b.preventDefault&&(b.stopPropagation&&(u=!0),c=!0)}return!1},d=i[n],p,y;return d&&(f(d[l+oo(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Re.windows&&e.ctrlKey&&e.altKey)&&(p=Ui[e.keyCode])&&p!=s?(f(d[l+oo(p,e,!0)])||e.shiftKey&&(y=kr[e.keyCode])!=s&&y!=p&&f(d[l+oo(y,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+oo(s,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),Pa=null,a}class Hr{constructor(e,t,n,s,r){this.className=e,this.left=t,this.top=n,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let s=e.coordsAtPos(n.head,n.assoc||1);if(!s)return[];let r=Wd(e);return[new Hr(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return nw(e,t,n)}}function Wd(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Rt.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function ch(i,e,t,n){let s=i.coordsAtPos(e,t*2);if(!s)return n;let r=i.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=i.posAtCoords({x:r.left+1,y:o}),a=i.posAtCoords({x:r.right-1,y:o});return l==null||a==null?n:{from:Math.max(n.from,Math.min(l,a)),to:Math.min(n.to,Math.max(l,a))}}function nw(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),s=Math.min(t.to,i.viewport.to),r=i.textDirection==Rt.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Wd(i),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=l.right-(u?parseInt(u.paddingRight):0),d=Ma(i,n),p=Ma(i,s),y=d.type==bn.Text?d:null,b=p.type==bn.Text?p:null;if(y&&(i.lineWrapping||d.widgetLineBreaks)&&(y=ch(i,n,1,y)),b&&(i.lineWrapping||p.widgetLineBreaks)&&(b=ch(i,s,-1,b)),y&&b&&y.from==b.from&&y.to==b.to)return A(v(t.from,t.to,y));{let D=y?v(t.from,null,y):F(d,!1),E=b?v(null,t.to,b):F(p,!0),P=[];return(y||d).to<(b||p).from-(y&&b?1:0)||d.widgetLineBreaks>1&&D.bottom+i.defaultLineHeight/2te&&L.from=N)break;le>re&&H(Math.max(ie,re),D==null&&ie<=te,Math.min(le,N),E==null&&le>=ue,$.dir)}if(re=Q.to+1,re>=N)break}return V.length==0&&H(te,D==null,ue,E==null,i.textDirection),{top:T,bottom:M,horizontal:V}}function F(D,E){let P=l.top+(E?D.top:D.bottom);return{top:P,bottom:P,horizontal:[]}}}function iw(i,e){return i.constructor==e.constructor&&i.eq(e)}class sw{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Do)!=e.state.facet(Do)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Do);for(;t!iw(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[n].constructor&&s.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Do=Ne.define();function jd(i){return[Vt.define(e=>new sw(e,i)),Do.of(i)]}const qd=!Re.ios,Cr=Ne.define({combine(i){return pi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function rw(i={}){return[Cr.of(i),ow,lw,aw,gd.of(!0)]}function Ud(i){return i.startState.facet(Cr)!=i.state.facet(Cr)}const ow=jd({above:!0,markers(i){let{state:e}=i,t=e.facet(Cr),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||qd:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:ce.cursor(s.head,s.head>s.anchor?-1:1);for(let a of Hr.forRange(i,o,l))n.push(a)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ud(i);return t&&uh(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){uh(e.state,i)},class:"cm-cursorLayer"});function uh(i,e){e.style.animationDuration=i.facet(Cr).cursorBlinkRate+"ms"}const lw=jd({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Hr.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Ud(i)},class:"cm-selectionLayer"}),Ba={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};qd&&(Ba[".cm-line"].caretColor=Ba[".cm-content"].caretColor="transparent !important");const aw=vs.highest(Pe.theme(Ba)),Kd=nt.define({map(i,e){return i==null?null:e.mapPos(i)}}),ur=rn.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,n)=>n.is(Kd)?n.value:t,i)}}),cw=Vt.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(ur);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(ur)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(ur),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(ur)!=i&&this.view.dispatch({effects:Kd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function uw(){return[ur,cw]}function hh(i,e,t,n,s){e.lastIndex=0;for(let r=i.iterRange(t,n),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function hw(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let n=[];for(let{from:s,to:r}of t)s=Math.max(i.state.doc.lineAt(s).from,s-e),r=Math.min(i.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}class fw{constructor(e){const{regexp:t,decoration:n,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,c,u)=>s(u,c,c+l[0].length,l,a);else if(typeof n=="function")this.addMatch=(l,a,c,u)=>{let h=n(l,a,c);h&&u(c,c+l[0].length,h)};else if(n)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new ji,n=t.add.bind(t);for(let{from:s,to:r}of hw(e,this.maxLength))hh(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),n,s):t}updateRange(e,t,n,s){for(let r of e.visibleRanges){let o=Math.max(r.from,n),l=Math.min(r.to,s);if(l>o){let a=e.state.doc.lineAt(o),c=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;lf.push(m.range(y,b));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(b,e,y,p));t=t.update({filterFrom:u,filterTo:h,filter:(y,b)=>yh,add:f})}}return t}}const Ra=/x/.unicode!=null?"gu":"g",dw=new RegExp(`[\0-\b --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Ra),pw={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Il=null;function mw(){var i;if(Il==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Il=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Il||!1}const Oo=Ne.define({combine(i){let e=pi(i,{render:null,specialChars:dw,addSpecialChars:null});return(e.replaceTabs=!mw())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Ra)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ra)),e}});function gw(i={}){return[Oo.of(i),bw()]}let fh=null;function bw(){return fh||(fh=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=_e.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Oo)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new fw({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,r=Zt(e[0],0);if(r==9){let o=s.lineAt(n),l=t.state.tabSize,a=Js(o.text,l,n-o.from);return _e.replace({widget:new kw((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=_e.replace({widget:new vw(i,r)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Oo);i.startState.facet(Oo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const yw="•";function ww(i){return i>=32?yw:i==10?"␤":String.fromCharCode(9216+i)}class vw extends Ci{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=ww(this.code),n=e.state.phrase("Control character")+" "+(pw[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,n,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class kw extends Ci{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function xw(){return Cw}const Sw=_e.line({class:"cm-activeLine"}),Cw=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let s=i.lineBlockAt(n.head);s.from>e&&(t.push(Sw.range(s.from)),e=s.from)}return _e.set(t)}},{decorations:i=>i.decorations});class Aw extends Ci{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?Hs(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),s=ul(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function Tw(i){return Vt.fromClass(class{constructor(e){this.view=e,this.placeholder=i?_e.set([_e.widget({widget:new Aw(i),side:1}).range(0)]):_e.none}get decorations(){return this.view.state.doc.length?_e.none:this.placeholder}},{decorations:e=>e.decorations})}const Na=2e3;function Mw(i,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Na||t.off>Na||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=n;a<=s;a++){let c=i.doc.line(a);c.length<=l&&r.push(ce.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=n;a<=s;a++){let c=i.doc.line(a),u=fa(c.text,o,i.tabSize,!0);if(u<0)r.push(ce.cursor(c.to));else{let h=fa(c.text,l,i.tabSize);r.push(ce.range(c.from+u,c.from+h))}}}return r}function Dw(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function dh(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),s=t-n.from,r=s>Na?-1:s==n.length?Dw(i,e.clientX):Js(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:r,off:s}}function Ow(i,e){let t=dh(i,e),n=i.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(s.changes)}},get(s,r,o){let l=dh(i,s);if(!l)return n;let a=Mw(i.state,t,l);return a.length?o?ce.create(a.concat(n.ranges)):ce.create(a):n}}:null}function Ew(i){let e=t=>t.altKey&&t.button==0;return Pe.mouseSelectionStyle.of((t,n)=>e(n)?Ow(t,n):null)}const Fw={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Pw={style:"cursor: crosshair"};function Bw(i={}){let[e,t]=Fw[i.key||"Alt"],n=Vt.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[n,Pe.contentAttributes.of(s=>{var r;return!((r=s.plugin(n))===null||r===void 0)&&r.isDown?Pw:null})]}const nr="-10000px";class Gd{constructor(e,t,n,s){this.facet=t,this.createTooltipView=n,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=n(o,r))}update(e,t){var n;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[c]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Rw(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ll=Ne.define({combine:i=>{var e,t,n;return{position:Re.ios?"absolute":((e=i.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=i.find(s=>s.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||Rw}}}),ph=new WeakMap,cc=Vt.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(Ll);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Gd(i,uc,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,n=i.state.facet(Ll);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=nr,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Re.gecko)n=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==nr&&s.style.left=="0px"){let r=s.getBoundingClientRect();n=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((s,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Ll).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:n,scaleX:s,scaleY:r}=i,o=[];for(let l=0;l=Math.min(t.bottom,n.bottom)||h.rightMath.min(t.right,n.right)+.1){u.style.top=nr;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,y=f.right-f.left,b=(e=ph.get(c))!==null&&e!==void 0?e:f.bottom-f.top,m=c.offset||Iw,A=this.view.textDirection==Rt.LTR,v=f.width>n.right-n.left?A?n.left:n.right-f.width:A?Math.min(h.left-(d?14:0)+m.x,n.right-y):Math.max(n.left,h.left-y+(d?14:0)-m.x),F=this.above[l];!a.strictSide&&(F?h.top-(f.bottom-f.top)-m.yn.bottom)&&F==n.bottom-h.bottom>h.top-n.top&&(F=this.above[l]=!F);let D=(F?h.top-n.top:n.bottom-h.bottom)-p;if(Dv&&T.topE&&(E=F?T.top-b-2-p:T.bottom+p+2);if(this.position=="absolute"?(u.style.top=(E-i.parent.top)/r+"px",u.style.left=(v-i.parent.left)/s+"px"):(u.style.top=E/r+"px",u.style.left=v/s+"px"),d){let T=h.left+(A?m.x:-m.x)-(v+14-7);d.style.left=T/s+"px"}c.overlap!==!0&&o.push({left:v,top:E,right:P,bottom:E+b}),u.classList.toggle("cm-tooltip-above",F),u.classList.toggle("cm-tooltip-below",!F),c.positioned&&c.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=nr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Nw=Pe.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Iw={x:0,y:0},uc=Ne.define({enables:[cc,Nw]}),Ho=Ne.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class dl{static create(e){return new dl(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Gd(e,Ho,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let s=n[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Lw=uc.compute([Ho],i=>{let e=i.facet(Ho);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:dl.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class $w{constructor(e,t,n,s,r){this.view=e,this.source=t,this.field=n,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),c=a&&a.dir==Rt.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>An(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(cc),t=e?e.manager.tooltips.findIndex(n=>n.create==dl.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!_w(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(n=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!zw(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const lo=4;function _w(i,e){let t=i.getBoundingClientRect();return e.clientX>=t.left-lo&&e.clientX<=t.right+lo&&e.clientY>=t.top-lo&&e.clientY<=t.bottom+lo}function zw(i,e,t,n,s,r){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>n||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Vw(i,e={}){let t=nt.define(),n=rn.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,gn.TrackDel);if(a!=null){let c=Object.assign(Object.create(null),l);c.pos=a,c.end!=null&&(c.end=r.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Hw)&&(s=[]);return s},provide:s=>Ho.from(s)});return[n,Vt.define(s=>new $w(s,i,n,t,e.hoverTime||300)),Lw]}function Yd(i,e){let t=i.plugin(cc);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const Hw=nt.define(),mh=Ne.define({combine(i){let e,t;for(let n of i)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ar(i,e){let t=i.plugin(Xd),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Xd=Vt.fromClass(class{constructor(i){this.input=i.state.facet(Tr),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(mh);this.top=new ao(i,!0,e.topContainer),this.bottom=new ao(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(mh);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ao(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ao(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Tr);if(t!=this.input){let n=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of n){let c=this.specs.indexOf(a),u;c<0?(u=a(i.view),l.push(u)):(u=this.panels[c],u.update&&u.update(i)),s.push(u),(u.top?r:o).push(u)}this.specs=n,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>Pe.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class ao{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=gh(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=gh(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function gh(i){let e=i.nextSibling;return i.remove(),e}const Tr=Ne.define({enables:Xd});class xi extends ds{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}xi.prototype.elementClass="";xi.prototype.toDOM=void 0;xi.prototype.mapMode=gn.TrackBefore;xi.prototype.startSide=xi.prototype.endSide=-1;xi.prototype.point=!0;const Eo=Ne.define(),Ww={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>gt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},br=Ne.define();function jw(i){return[Jd(),br.of(Object.assign(Object.assign({},Ww),i))]}const bh=Ne.define({combine:i=>i.some(e=>e)});function Jd(i){return[qw]}const qw=Vt.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(br).map(e=>new wh(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(bh),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(bh)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=gt.iter(this.view.state.facet(Eo),this.view.viewport.from),n=[],s=this.gutters.map(r=>new Uw(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==bn.Text&&o){Ia(t,n,l.from);for(let a of s)a.line(this.view,l,n);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==bn.Text){Ia(t,n,r.from);for(let o of s)o.line(this.view,r,n)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();i&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(i){let e=i.startState.facet(br),t=i.state.facet(br),n=i.docChanged||i.heightChanged||i.viewportChanged||!gt.eq(i.startState.facet(Eo),i.state.facet(Eo),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(i)&&(n=!0);else{n=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new wh(this.view,r)):(this.gutters[o].update(i),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>Pe.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==Rt.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function yh(i){return Array.isArray(i)?i:[i]}function Ia(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class Uw{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=gt.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Qd(e,o,r,n);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,n);this.height=t.bottom,this.i++}line(e,t,n){let s=[];Ia(this.cursor,s,t.from),n.length&&(s=s.concat(n));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class wh{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,l,s)&&s.preventDefault()});this.markers=yh(t.markers(e)),t.initialSpacer&&(this.spacer=new Qd(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=yh(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let n=e.view.viewport;return!gt.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Qd{constructor(e,t,n,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,s)}update(e,t,n,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),Kw(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let n="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,c)||o(l,a,c):o}return n}})}});class $l extends xi{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function _l(i,e){return i.state.facet(Os).formatNumber(e,i.state)}const Yw=br.compute([Os],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Gw)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new $l(_l(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Os)!=e.state.facet(Os),initialSpacer(e){return new $l(_l(e,vh(e.state.doc.lines)))},updateSpacer(e,t){let n=_l(t.view,vh(t.view.state.doc.lines));return n==e.number?e:new $l(n)},domEventHandlers:i.facet(Os).domEventHandlers}));function Xw(i={}){return[Os.of(i),Jd(),Yw]}function vh(i){let e=9;for(;e{let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.head).from;s>t&&(t=s,e.push(Jw.range(s)))}return gt.of(e)});function Zw(){return Qw}const Zd=1024;let ev=0;class zl{constructor(e,t){this.from=e,this.to=t}}class ot{constructor(e={}){this.id=ev++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=wn.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}ot.closedBy=new ot({deserialize:i=>i.split(" ")});ot.openedBy=new ot({deserialize:i=>i.split(" ")});ot.group=new ot({deserialize:i=>i.split(" ")});ot.isolate=new ot({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});ot.contextHash=new ot({perNode:!0});ot.lookAhead=new ot({perNode:!0});ot.mounted=new ot({perNode:!0});class Wo{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ot.mounted.id]}}const tv=Object.create(null);class wn{constructor(e,t,n,s=0){this.name=e,this.props=t,this.id=n,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):tv,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new wn(e.name||"",t,e.id,n);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ot.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let s of n.split(" "))t[s]=e[n];return n=>{for(let s=n.prop(ot.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?n.name:s[r]];if(o)return o}}}}wn.none=new wn("",Object.create(null),0,8);class pl{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|Xt.IncludeAnonymous);;){let c=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;c&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:dc(wn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,s)=>new Tt(this.type,t,n,s,this.propValues),e.makeTree||((t,n,s)=>new Tt(wn.none,t,n,s)))}static build(e){return rv(e)}}Tt.empty=new Tt(wn.none,[],[],0);class hc{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new hc(this.buffer,this.index)}}class Gi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return wn.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Mr(i,e,t,n){for(var s;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=c;e+=t){let u=l[e],h=a[e]+o.from;if(ep(s,n,h,h+u.length)){if(u instanceof Gi){if(r&Xt.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,t,n-h,s);if(f>-1)return new Li(new nv(o,u,e,h),null,f)}else if(r&Xt.IncludeAnonymous||!u.type.isAnonymous||fc(u)){let f;if(!(r&Xt.IgnoreMounts)&&(f=Wo.get(u))&&!f.overlay)return new Wn(f.tree,h,e,o);let d=new Wn(u,h,e,o);return r&Xt.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?u.children.length-1:0,t,n,s)}}}if(r&Xt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let s;if(!(n&Xt.IgnoreOverlays)&&(s=Wo.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Wn(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function xh(i,e,t,n){let s=i.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(n!=null&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return n==null?r:[]}}function La(i,e,t=e.length-1){for(let n=i.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class nv{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class Li extends tp{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Li(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&Xt.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Li(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Li(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Li(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,s=this.index+4,r=n.buffer[this.index+3];if(r>s){let o=n.buffer[this.index+1];e.push(n.slice(s,r,o)),t.push(0)}return new Tt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function np(i){if(!i.length)return null;let e=0,t=i[0];for(let r=1;rt.from||o.to=e){let l=new Wn(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(Mr(l,e,t,!1))}}return s?np(s):n}class $a{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Wn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=n+s.buffer[e+1],this.to=n+s.buffer[e+2],!0}yield(e){return e?e instanceof Wn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,n);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Xt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Xt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Xt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let s=n<0?0:this.stack[n]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(s)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let l=n._tree.children[r];if(this.mode&Xt.IncludeAnonymous||l instanceof Gi||!l.type.isAnonymous||fc(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,n=r+1;break e}s=this.stack[--r]}for(let s=n;s=0;r--){if(r<0)return La(this.node,e,s);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function fc(i){return i.children.some(e=>e instanceof Gi||!e.type.isAnonymous||fc(e))}function rv(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=Zd,reused:r=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new hc(t,t.length):t,a=n.types,c=0,u=0;function h(D,E,P,T,M,V){let{id:H,start:te,end:ue,size:L}=l,re=u;for(;L<0;)if(l.next(),L==-1){let le=r[H];P.push(le),T.push(te-D);return}else if(L==-3){c=H;return}else if(L==-4){u=H;return}else throw new RangeError(`Unrecognized record size: ${L}`);let N=a[H],Q,$,ie=te-D;if(ue-te<=s&&($=b(l.pos-E,M))){let le=new Uint16Array($.size-$.skip),_=l.pos-$.size,Y=le.length;for(;l.pos>_;)Y=m($.start,le,Y);Q=new Gi(le,ue-$.start,n),ie=$.start-D}else{let le=l.pos-L;l.next();let _=[],Y=[],ye=H>=o?H:-1,we=0,Le=ue;for(;l.pos>le;)ye>=0&&l.id==ye&&l.size>=0?(l.end<=Le-s&&(p(_,Y,te,we,l.end,Le,ye,re),we=_.length,Le=l.end),l.next()):V>2500?f(te,le,_,Y):h(te,le,_,Y,ye,V+1);if(ye>=0&&we>0&&we<_.length&&p(_,Y,te,we,te,Le,ye,re),_.reverse(),Y.reverse(),ye>-1&&we>0){let ve=d(N);Q=dc(N,_,Y,0,_.length,0,ue-te,ve,ve)}else Q=y(N,_,Y,ue-te,re-ue)}P.push(Q),T.push(ie)}function f(D,E,P,T){let M=[],V=0,H=-1;for(;l.pos>E;){let{id:te,start:ue,end:L,size:re}=l;if(re>4)l.next();else{if(H>-1&&ue=0;L-=3)te[re++]=M[L],te[re++]=M[L+1]-ue,te[re++]=M[L+2]-ue,te[re++]=re;P.push(new Gi(te,M[2]-ue,n)),T.push(ue-D)}}function d(D){return(E,P,T)=>{let M=0,V=E.length-1,H,te;if(V>=0&&(H=E[V])instanceof Tt){if(!V&&H.type==D&&H.length==T)return H;(te=H.prop(ot.lookAhead))&&(M=P[V]+H.length+te)}return y(D,E,P,T,M)}}function p(D,E,P,T,M,V,H,te){let ue=[],L=[];for(;D.length>T;)ue.push(D.pop()),L.push(E.pop()+P-M);D.push(y(n.types[H],ue,L,V-M,te-V)),E.push(M-P)}function y(D,E,P,T,M=0,V){if(c){let H=[ot.contextHash,c];V=V?[H].concat(V):[H]}if(M>25){let H=[ot.lookAhead,M];V=V?[H].concat(V):[H]}return new Tt(D,E,P,T,V)}function b(D,E){let P=l.fork(),T=0,M=0,V=0,H=P.end-s,te={size:0,start:0,skip:0};e:for(let ue=P.pos-D;P.pos>ue;){let L=P.size;if(P.id==E&&L>=0){te.size=T,te.start=M,te.skip=V,V+=4,T+=4,P.next();continue}let re=P.pos-L;if(L<0||re=o?4:0,Q=P.start;for(P.next();P.pos>re;){if(P.size<0)if(P.size==-3)N+=4;else break e;else P.id>=o&&(N+=4);P.next()}M=Q,T+=L,V+=N}return(E<0||T==D)&&(te.size=T,te.start=M,te.skip=V),te.size>4?te:void 0}function m(D,E,P){let{id:T,start:M,end:V,size:H}=l;if(l.next(),H>=0&&T4){let ue=l.pos-(H-4);for(;l.pos>ue;)P=m(D,E,P)}E[--P]=te,E[--P]=V-D,E[--P]=M-D,E[--P]=T}else H==-3?c=T:H==-4&&(u=T);return P}let A=[],v=[];for(;l.pos>0;)h(i.start||0,i.bufferStart||0,A,v,-1,0);let F=(e=i.length)!==null&&e!==void 0?e:A.length?v[0]+A[0].length:0;return new Tt(a[i.topID],A.reverse(),v.reverse(),F)}const Sh=new WeakMap;function Fo(i,e){if(!i.isAnonymous||e instanceof Gi||e.type!=i)return 1;let t=Sh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof Tt)){t=1;break}t+=Fo(i,n)}Sh.set(e,t)}return t}function dc(i,e,t,n,s,r,o,l,a){let c=0;for(let p=n;p=u)break;E+=P}if(v==F+1){if(E>u){let P=p[F];d(P.children,P.positions,0,P.children.length,y[F]+A);continue}h.push(p[F])}else{let P=y[v-1]+p[v-1].length-D;h.push(dc(i,p,y,F,v,D,P,null,a))}f.push(D+A-r)}}return d(e,t,n,s,0),(l||a)(h,f,o)}class hs{constructor(e,t,n,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let s=[new hs(0,e.length,e,0,!1,n)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,n=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,c=0;;l++){let u=l=n)for(;o&&o.from=f.from||h<=f.to||c){let d=Math.max(f.from,a)-c,p=Math.min(f.to,h)-c;f=d>=p?null:new hs(d,p,f.tree,f.offset+c,l>0,!!u)}if(f&&s.push(f),o.to>h)break;o=rnew zl(s.from,s.to)):[new zl(0,0)]:[new zl(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let s=this.startParse(e,t,n);for(;;){let r=s.advance();if(r)return r}}}class ov{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ot({perNode:!0});let lv=0;class ai{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=lv++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new ai([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new jo;return t=>t.modified.indexOf(e)>-1?t:jo.get(t.base||t,t.modified.concat(e).sort((n,s)=>n.id-s.id))}}let av=0;class jo{constructor(){this.instances=[],this.id=av++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&cv(t,l.modified));if(n)return n;let s=[],r=new ai(s,e,t);for(let l of t)l.instances.push(r);let o=uv(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(jo.get(l,a));return r}}function cv(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function uv(i){let e=[[]];for(let t=0;tn.length-t.length)}function ip(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let h=0;;){if(l=="..."&&h>0&&h+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+s);if(r.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==s.length)break;let d=s[h++];if(h==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(h)}let a=r.length-1,c=r[a];if(!c)throw new RangeError("Invalid path: "+s);let u=new qo(n,o,a>0?r.slice(0,a):null);e[c]=u.sort(e[c])}}return sp.add(e)}const sp=new ot;class qo{constructor(e,t,n,s){this.tags=e,this.mode=t,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let c=t[a.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function hv(i,e){let t=null;for(let n of i){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function fv(i,e,t,n=0,s=i.length){let r=new dv(n,Array.isArray(e)?e:[e],t);r.highlightRange(i.cursor(),n,s,"",r.highlighters),r.flush(s)}class dv{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,r){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=s,u=pv(e)||qo.empty,h=hv(r,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(s+=(s?" ":"")+h)),this.startSpan(Math.max(t,l),c),u.opaque)return;let f=e.tree&&e.tree.prop(ot.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),y=e.firstChild();for(let b=0,m=l;;b++){let A=b=v||!e.nextSibling())););if(!A||v>n)break;m=A.to+l,m>t&&(this.highlightRange(d.cursor(),Math.max(t,A.from+l),Math.min(n,m),"",p),this.startSpan(Math.min(n,m),c))}y&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,r),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function pv(i){let e=i.type.prop(sp);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const Te=ai.define,uo=Te(),Oi=Te(),Ch=Te(Oi),Ah=Te(Oi),Ei=Te(),ho=Te(Ei),Vl=Te(Ei),li=Te(),es=Te(li),ri=Te(),oi=Te(),_a=Te(),ir=Te(_a),fo=Te(),X={comment:uo,lineComment:Te(uo),blockComment:Te(uo),docComment:Te(uo),name:Oi,variableName:Te(Oi),typeName:Ch,tagName:Te(Ch),propertyName:Ah,attributeName:Te(Ah),className:Te(Oi),labelName:Te(Oi),namespace:Te(Oi),macroName:Te(Oi),literal:Ei,string:ho,docString:Te(ho),character:Te(ho),attributeValue:Te(ho),number:Vl,integer:Te(Vl),float:Te(Vl),bool:Te(Ei),regexp:Te(Ei),escape:Te(Ei),color:Te(Ei),url:Te(Ei),keyword:ri,self:Te(ri),null:Te(ri),atom:Te(ri),unit:Te(ri),modifier:Te(ri),operatorKeyword:Te(ri),controlKeyword:Te(ri),definitionKeyword:Te(ri),moduleKeyword:Te(ri),operator:oi,derefOperator:Te(oi),arithmeticOperator:Te(oi),logicOperator:Te(oi),bitwiseOperator:Te(oi),compareOperator:Te(oi),updateOperator:Te(oi),definitionOperator:Te(oi),typeOperator:Te(oi),controlOperator:Te(oi),punctuation:_a,separator:Te(_a),bracket:ir,angleBracket:Te(ir),squareBracket:Te(ir),paren:Te(ir),brace:Te(ir),content:li,heading:es,heading1:Te(es),heading2:Te(es),heading3:Te(es),heading4:Te(es),heading5:Te(es),heading6:Te(es),contentSeparator:Te(li),list:Te(li),quote:Te(li),emphasis:Te(li),strong:Te(li),link:Te(li),monospace:Te(li),strikethrough:Te(li),inserted:Te(),deleted:Te(),changed:Te(),invalid:Te(),meta:fo,documentMeta:Te(fo),annotation:Te(fo),processingInstruction:Te(fo),definition:ai.defineModifier(),constant:ai.defineModifier(),function:ai.defineModifier(),standard:ai.defineModifier(),local:ai.defineModifier(),special:ai.defineModifier()};rp([{tag:X.link,class:"tok-link"},{tag:X.heading,class:"tok-heading"},{tag:X.emphasis,class:"tok-emphasis"},{tag:X.strong,class:"tok-strong"},{tag:X.keyword,class:"tok-keyword"},{tag:X.atom,class:"tok-atom"},{tag:X.bool,class:"tok-bool"},{tag:X.url,class:"tok-url"},{tag:X.labelName,class:"tok-labelName"},{tag:X.inserted,class:"tok-inserted"},{tag:X.deleted,class:"tok-deleted"},{tag:X.literal,class:"tok-literal"},{tag:X.string,class:"tok-string"},{tag:X.number,class:"tok-number"},{tag:[X.regexp,X.escape,X.special(X.string)],class:"tok-string2"},{tag:X.variableName,class:"tok-variableName"},{tag:X.local(X.variableName),class:"tok-variableName tok-local"},{tag:X.definition(X.variableName),class:"tok-variableName tok-definition"},{tag:X.special(X.variableName),class:"tok-variableName2"},{tag:X.definition(X.propertyName),class:"tok-propertyName tok-definition"},{tag:X.typeName,class:"tok-typeName"},{tag:X.namespace,class:"tok-namespace"},{tag:X.className,class:"tok-className"},{tag:X.macroName,class:"tok-macroName"},{tag:X.propertyName,class:"tok-propertyName"},{tag:X.operator,class:"tok-operator"},{tag:X.comment,class:"tok-comment"},{tag:X.meta,class:"tok-meta"},{tag:X.invalid,class:"tok-invalid"},{tag:X.punctuation,class:"tok-punctuation"}]);var Hl;const ls=new ot;function op(i){return Ne.define({combine:i?e=>e.concat(i):void 0})}const mv=new ot;class _n{constructor(e,t,n=[],s=""){this.data=e,this.name=s,ht.prototype.hasOwnProperty("tree")||Object.defineProperty(ht.prototype,"tree",{get(){return sn(this)}}),this.parser=t,this.extension=[Yi.of(this),ht.languageData.of((r,o,l)=>{let a=Th(r,o,l),c=a.type.prop(ls);if(!c)return[];let u=r.facet(c),h=a.type.prop(mv);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Th(e,t,n).type.prop(ls)==this.data}findRegions(e){let t=e.facet(Yi);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],s=(r,o)=>{if(r.prop(ls)==this.data){n.push({from:o,to:o+r.length});return}let l=r.prop(ot.mounted);if(l){if(l.tree.prop(ls)==this.data){if(l.overlay)for(let a of l.overlay)n.push({from:a.from+o,to:a.to+o});else n.push({from:o,to:o+r.length});return}else if(l.overlay){let a=n.length;if(s(l.tree,l.overlay[0].from+o),n.length>a)return}}for(let a=0;an.isTop?t:void 0)]}),e.name)}configure(e,t){return new Uo(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function sn(i){let e=i.field(_n.state,!1);return e?e.tree:Tt.empty}class gv{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let sr=null;class qs{constructor(e,t,n=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=n,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new qs(e,t,[],Tt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new gv(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Tt.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(hs.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=sr;sr=this;try{return e()}finally{sr=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Mh(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,h,f)=>a.push({fromA:c,toA:u,fromB:h,toB:f})),n=hs.applyChanges(n,a),s=Tt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);ue.from&&(this.fragments=Mh(this.fragments,s,r),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends pc{createParse(t,n,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=sr;if(a){for(let c of s)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Tt(wn.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return sr}}function Mh(i,e,t){return hs.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class Us{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Us(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=qs.create(e.facet(Yi).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Us(n)}}_n.state=rn.define({create:Us.init,update(i,e){for(let t of e.effects)if(t.is(_n.setState))return t.value;return e.startState.facet(Yi)!=e.state.facet(Yi)?Us.init(e.state):i.apply(e)}});let lp=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(lp=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Wl=typeof navigator!="undefined"&&(!((Hl=navigator.scheduling)===null||Hl===void 0)&&Hl.isInputPending)?()=>navigator.scheduling.isInputPending():null,bv=Vt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(_n.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(_n.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=lp(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>Wl&&Wl()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:_n.setState.of(new Us(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>An(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Yi=Ne.define({combine(i){return i.length?i[0]:null},enables:i=>[_n.state,bv,Pe.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class yv{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const ap=Ne.define(),ml=Ne.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function bs(i){let e=i.facet(ml);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Dr(i,e){let t="",n=i.tabSize,s=i.facet(ml)[0];if(s==" "){for(;e>=n;)t+=" ",e-=n;s=" "}for(let r=0;r=e?wv(i,t,e):null}class gl{constructor(e,t={}){this.state=e,this.options=t,this.unit=bs(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=n.from&&s<=n.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Js(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const cp=new ot;function wv(i,e,t){let n=e.resolveStack(t),s=n.node.enterUnfinishedNodesBefore(t);if(s!=n.node){let r=[];for(let o=s;o!=n.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)n={node:r[o],next:n}}return up(n,i,t)}function up(i,e,t){for(let n=i;n;n=n.next){let s=kv(n.node);if(s)return s(gc.create(e,t,n))}return 0}function vv(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function kv(i){let e=i.type.prop(cp);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(ot.closedBy))){let s=i.lastChild,r=s&&n.indexOf(s.name)>-1;return o=>Av(o,!0,1,void 0,r&&!vv(o)?s.from:void 0)}return i.parent==null?xv:null}function xv(){return 0}class gc extends gl{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new gc(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Sv(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return up(this.context.next,this.base,this.pos)}}function Sv(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function Cv(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let s=i.options.simulateBreak,r=i.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==n)return null;if(!a.type.isSkipped)return a.from{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const Tv=200;function Mv(){return ht.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,s=t.lineAt(n);if(n>s.from+Tv)return i;let r=t.sliceString(s.from,n);if(!e.some(c=>c.test(r)))return i;let{state:o}=i,l=-1,a=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==l)continue;l=u.from;let h=mc(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],d=Dr(o,h);f!=d&&a.push({from:u.from,to:u.from+f.length,insert:d})}return a.length?[i,{changes:a,sequential:!0}]:i})}const Dv=Ne.define(),hp=new ot;function Ov(i){let e=i.firstChild,t=i.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&c.to>t&&(r=c)}}return r}function Fv(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function Ko(i,e,t){for(let n of i.facet(Dv)){let s=n(i,e,t);if(s)return s}return Ev(i,e,t)}function fp(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}const bl=nt.define({map:fp}),Wr=nt.define({map:fp});function dp(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(i.lineBlockAt(t));return e}const ys=rn.define({create(){return _e.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(bl)&&!Pv(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(gp),s=n?_e.replace({widget:new _v(n(e.state,t.value))}):Oh;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(Wr)&&(i=i.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;i.between(n,n,(s,r)=>{sn&&(t=!0)}),t&&(i=i.update({filterFrom:n,filterTo:n,filter:(s,r)=>r<=n||s>=n}))}return i},provide:i=>Pe.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,s)=>{t.push(n,s)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{(!s||s.from>r)&&(s={from:r,to:o})}),s}function Pv(i,e,t){let n=!1;return i.between(e,e,(s,r)=>{s==e&&r==t&&(n=!0)}),n}function pp(i,e){return i.field(ys,!1)?e:e.concat(nt.appendConfig.of(bp()))}const Bv=i=>{for(let e of dp(i)){let t=Ko(i.state,e.from,e.to);if(t)return i.dispatch({effects:pp(i.state,[bl.of(t),mp(i,t)])}),!0}return!1},Rv=i=>{if(!i.state.field(ys,!1))return!1;let e=[];for(let t of dp(i)){let n=Go(i.state,t.from,t.to);n&&e.push(Wr.of(n),mp(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function mp(i,e,t=!0){let n=i.state.doc.lineAt(e.from).number,s=i.state.doc.lineAt(e.to).number;return Pe.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${s}.`)}const Nv=i=>{let{state:e}=i,t=[];for(let n=0;n{let e=i.state.field(ys,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,s)=>{t.push(Wr.of({from:n,to:s}))}),i.dispatch({effects:t}),!0},Lv=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Bv},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Rv},{key:"Ctrl-Alt-[",run:Nv},{key:"Ctrl-Alt-]",run:Iv}],$v={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},gp=Ne.define({combine(i){return pi(i,$v)}});function bp(i){return[ys,Hv]}function yp(i,e){let{state:t}=i,n=t.facet(gp),s=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=Go(i.state,l.from,l.to);a&&i.dispatch({effects:Wr.of(a)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,s,e);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Oh=_e.replace({widget:new class extends Ci{toDOM(i){return yp(i,null)}}});class _v extends Ci{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return yp(e,this.value)}}const zv={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class jl extends xi{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Vv(i={}){let e=Object.assign(Object.assign({},zv),i),t=new jl(e,!0),n=new jl(e,!1),s=Vt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Yi)!=o.state.facet(Yi)||o.startState.field(ys,!1)!=o.state.field(ys,!1)||sn(o.startState)!=sn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ji;for(let a of o.viewportLineBlocks){let c=Go(o.state,a.from,a.to)?n:Ko(o.state,a.from,a.to)?t:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:r}=e;return[s,jw({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||gt.empty},initialSpacer(){return new jl(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let c=Go(o.state,l.from,l.to);if(c)return o.dispatch({effects:Wr.of(c)}),!0;let u=Ko(o.state,l.from,l.to);return u?(o.dispatch({effects:bl.of(u)}),!0):!1}})}),bp()]}const Hv=Pe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class jr{constructor(e,t){this.specs=e;let n;function s(l){let a=qi.newName();return(n||(n=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof _n?l=>l.prop(ls)==o.data:o?l=>l==o:void 0,this.style=rp(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=n?new qi(n):null,this.themeType=t.themeType}static define(e,t){return new jr(e,t||{})}}const za=Ne.define(),wp=Ne.define({combine(i){return i.length?[i[0]]:null}});function ql(i){let e=i.facet(za);return e.length?e:i.facet(wp)}function vp(i,e){let t=[jv],n;return i instanceof jr&&(i.module&&t.push(Pe.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(wp.of(i)):n?t.push(za.computeN([Pe.darkTheme],s=>s.facet(Pe.darkTheme)==(n=="dark")?[i]:[])):t.push(za.of(i)),t}class Wv{constructor(e){this.markCache=Object.create(null),this.tree=sn(e.state),this.decorations=this.buildDeco(e,ql(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=sn(e.state),n=ql(e.state),s=n!=ql(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return _e.none;let n=new ji;for(let{from:s,to:r}of e.visibleRanges)fv(this.tree,t,(o,l,a)=>{n.add(o,l,this.markCache[a]||(this.markCache[a]=_e.mark({class:a})))},s,r);return n.finish()}}const jv=vs.high(Vt.fromClass(Wv,{decorations:i=>i.decorations})),qv=jr.define([{tag:X.meta,color:"#404740"},{tag:X.link,textDecoration:"underline"},{tag:X.heading,textDecoration:"underline",fontWeight:"bold"},{tag:X.emphasis,fontStyle:"italic"},{tag:X.strong,fontWeight:"bold"},{tag:X.strikethrough,textDecoration:"line-through"},{tag:X.keyword,color:"#708"},{tag:[X.atom,X.bool,X.url,X.contentSeparator,X.labelName],color:"#219"},{tag:[X.literal,X.inserted],color:"#164"},{tag:[X.string,X.deleted],color:"#a11"},{tag:[X.regexp,X.escape,X.special(X.string)],color:"#e40"},{tag:X.definition(X.variableName),color:"#00f"},{tag:X.local(X.variableName),color:"#30a"},{tag:[X.typeName,X.namespace],color:"#085"},{tag:X.className,color:"#167"},{tag:[X.special(X.variableName),X.macroName],color:"#256"},{tag:X.definition(X.propertyName),color:"#00c"},{tag:X.comment,color:"#940"},{tag:X.invalid,color:"#f00"}]),Uv=Pe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),kp=1e4,xp="()[]{}",Sp=Ne.define({combine(i){return pi(i,{afterCursor:!0,brackets:xp,maxScanDistance:kp,renderMatch:Yv})}}),Kv=_e.mark({class:"cm-matchingBracket"}),Gv=_e.mark({class:"cm-nonmatchingBracket"});function Yv(i){let e=[],t=i.matched?Kv:Gv;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}const Xv=rn.define({create(){return _e.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(Sp);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=hi(e.state,s.head,-1,n)||s.head>0&&hi(e.state,s.head-1,1,n)||n.afterCursor&&(hi(e.state,s.head,1,n)||s.headPe.decorations.from(i)}),Jv=[Xv,Uv];function Qv(i={}){return[Sp.of(i),Jv]}const Zv=new ot;function Va(i,e,t){let n=i.prop(e<0?ot.openedBy:ot.closedBy);if(n)return n;if(i.name.length==1){let s=t.indexOf(i.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Ha(i){let e=i.type.prop(Zv);return e?e(i.node):i}function hi(i,e,t,n={}){let s=n.maxScanDistance||kp,r=n.brackets||xp,o=sn(i),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let c=Va(a.type,t,r);if(c&&a.from0?e>=u.from&&eu.from&&e<=u.to))return e1(i,e,t,a,u,c,r)}}return t1(i,e,t,o,l.type,s,r)}function e1(i,e,t,n,s,r,o){let l=n.parent,a={from:s.from,to:s.to},c=0,u=l==null?void 0:l.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&r.indexOf(u.type.name)>-1&&u.from0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=i.doc.iterRange(e,t>0?i.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=r;){let d=u.value;t<0&&(f+=d.length);let p=e+f*t;for(let y=t>0?0:d.length-1,b=t>0?d.length:-1;y!=b;y+=t){let m=o.indexOf(d[y]);if(!(m<0||n.resolveInner(p+y,1).type!=s))if(m%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:p+y,to:p+y+1},matched:m>>1==a>>1};h--}}t>0&&(f+=d.length)}return u.done?{start:c,matched:!1}:null}function Eh(i,e,t,n=0,s=0){e==null&&(e=i.search(/[^\s\u00a0]/),e==-1&&(e=i.length));let r=s;for(let o=n;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosn?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function n1(i){return{name:i.name||"",token:i.token,blankLine:i.blankLine||(()=>{}),startState:i.startState||(()=>!0),copyState:i.copyState||i1,indent:i.indent||(()=>null),languageData:i.languageData||{},tokenTable:i.tokenTable||wc}}function i1(i){if(typeof i!="object")return i;let e={};for(let t in i){let n=i[t];e[t]=n instanceof Array?n.slice():n}return e}const Fh=new WeakMap;class bc extends _n{constructor(e){let t=op(e.languageData),n=n1(e),s,r=new class extends pc{createParse(o,l,a){return new r1(s,o,l,a)}};super(t,r,[ap.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=a1(t),s=this,this.streamParser=n,this.stateAfter=new ot({perNode:!0}),this.tokenTable=e.tokenTable?new Dp(n.tokenTable):l1}static define(e){return new bc(e)}getIndent(e,t){let n=sn(e.state),s=n.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let r,{overrideIndentation:o}=e.options;o&&(r=Fh.get(e.state),r!=null&&r1e4)return null;for(;a=n&&t+e.length<=s&&e.prop(i.stateAfter);if(r)return{state:i.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],c=l instanceof Tt&&a=e.length)return e;!s&&e.type==i.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&yc(i,s.tree,0-s.offset,t,o),a;if(l&&(a=Ap(i,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:a}}return{state:i.streamParser.startState(n?bs(n):4),tree:Tt.empty}}let r1=class{constructor(e,t,n,s){this.lang=e,this.input=t,this.fragments=n,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=qs.get(),o=s[0].from,{state:l,tree:a}=s1(e,n,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let c=0;c=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` `&&(t="");else{let n=t.indexOf(` `);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=n||(t=t.slice(0,r-(n-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,n=o+l.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(n>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,n,s),r}parseLine(e){let{line:t,end:n}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new Cp(t,e?e.state.tabSize:4,e?bs(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Tp(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const wc=Object.create(null),Or=[wn.none],o1=new pl(Or),Ph=[],Bh=Object.create(null),Mp=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Mp[i]=Op(wc,e);class Dp{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Mp)}resolve(e){return e?this.table[e]||(this.table[e]=Op(this.extra,e)):0}}const l1=new Dp(wc);function Ul(i,e){Ph.indexOf(i)>-1||Ph.push(i)}function Op(i,e){let t=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=i[c]||X[c];u?typeof u=="function"?a.length?a=a.map(u):Ul(c,`Modifier ${c} used at start of tag`):a.length?Ul(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:Ul(c,`Unknown highlighting tag ${c}`)}for(let c of a)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(l=>l.id),r=Bh[s];if(r)return r.id;let o=Bh[s]=wn.define({id:Or.length,name:n,props:[ip({[n]:t})]});return Or.push(o),o.id}function a1(i){let e=wn.define({id:Or.length,name:"Document",props:[ls.add(()=>i)],top:!0});return Or.push(e),e}Rt.RTL,Rt.LTR;const c1=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=kc(i.state,t.from);return n.line?u1(i):n.block?f1(i):!1};function vc(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=i(e,t);return s?(n(t.update(s)),!0):!1}}const u1=vc(m1,0),h1=vc(Ep,0),f1=vc((i,e)=>Ep(i,e,p1(e)),0);function kc(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const rr=50;function d1(i,{open:e,close:t},n,s){let r=i.sliceDoc(n-rr,n),o=i.sliceDoc(s,s+rr),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,c=r.length-l;if(r.slice(c-e.length,c)==e&&o.slice(a,a+t.length)==t)return{open:{pos:n-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let u,h;s-n<=2*rr?u=h=i.sliceDoc(n,s):(u=i.sliceDoc(n,n+rr),h=i.sliceDoc(s-rr,s));let f=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-t.length;return u.slice(f,f+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:n+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function p1(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),s=t.to<=n.to?n:i.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}function Ep(i,e,t=e.selection.ranges){let n=t.map(r=>kc(e,r.from).block);if(!n.every(r=>r))return null;let s=t.map((r,o)=>d1(e,n[o],r.from,r.to));if(i!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:n[o].open+" "},{from:r.to,insert:" "+n[o].close}]))};if(i!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>h.from)){s=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,p=h.text.slice(f,f+c.length)==c?f:-1;fr.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:c,empty:u,single:h}of n)(h||!u)&&r.push({from:l.from+c,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of n)if(l>=0){let c=o.from+l,u=c+a.length;o.text[u-o.from]==" "&&u++,r.push({from:c,to:u})}return{changes:r}}return null}const Wa=Si.define(),g1=Si.define(),b1=Ne.define(),Fp=Ne.define({combine(i){return pi(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,s)=>e(n,s)||t(n,s)})}}),Pp=rn.define({create(){return fi.empty},update(i,e){let t=e.state.facet(Fp),n=e.annotation(Wa);if(n){let a=Tn.fromTransaction(e,n.selection),c=n.side,u=c==0?i.undone:i.done;return a?u=Yo(u,u.length,t.minDepth,a):u=Np(u,e.startState.selection),new fi(c==0?n.rest:u,c==0?u:n.rest)}let s=e.annotation(g1);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(Kt.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let r=Tn.fromTransaction(e),o=e.annotation(Kt.time),l=e.annotation(Kt.userEvent);return r?i=i.addChanges(r,o,l,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new fi(i.done.map(Tn.fromJSON),i.undone.map(Tn.fromJSON))}});function y1(i={}){return[Pp,Fp.of(i),Pe.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Bp:e.inputType=="historyRedo"?ja:null;return n?(e.preventDefault(),n(t)):!1}})]}function yl(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(Pp,!1);if(!s)return!1;let r=s.pop(i,t,e);return r?(n(r),!0):!1}}const Bp=yl(0,!1),ja=yl(1,!1),w1=yl(0,!0),v1=yl(1,!0);class Tn{constructor(e,t,n,s,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Tn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Tn(e.changes&&Ut.fromJSON(e.changes),[],e.mapped&&di.fromJSON(e.mapped),e.startSelection&&ce.fromJSON(e.startSelection),e.selectionsAfter.map(ce.fromJSON))}static fromTransaction(e,t){let n=zn;for(let s of e.startState.facet(b1)){let r=s(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Tn(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,zn)}static selection(e){return new Tn(void 0,zn,void 0,void 0,e)}}function Yo(i,e,t,n){let s=e+1>t+20?e-t-1:0,r=i.slice(s,e);return r.push(n),r}function k1(i,e){let t=[],n=!1;return i.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=c&&o<=u&&(n=!0)}}),n}function x1(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function Rp(i,e){return i.length?e.length?i.concat(e):i:e}const zn=[],S1=200;function Np(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-S1));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),Yo(i,i.length-1,1e9,t.setSelAfter(n)))}else return[Tn.selection([e])]}function C1(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Kl(i,e){if(!i.length)return i;let t=i.length,n=zn;for(;t;){let s=A1(i[t-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let r=i.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,n=s.selectionsAfter}return n.length?[Tn.selection(n)]:zn}function A1(i,e,t){let n=Rp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(e)):zn,t);if(!i.changes)return Tn.selection(n);let s=i.changes.map(e),r=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(r):r;return new Tn(s,nt.mapEffects(i.effects,e),o,i.startSelection.map(r),n)}const T1=/^(input\.type|delete)($|\.)/;class fi{constructor(e,t,n=0,s=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new fi(this.done,this.undone):this}addChanges(e,t,n,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!n||T1.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?i.moveByChar(t,e):wl(t,e))}function un(i){return i.textDirectionAt(i.state.selection.main.head)==Rt.LTR}const Lp=i=>Ip(i,!un(i)),$p=i=>Ip(i,un(i));function _p(i,e){return Qn(i,t=>t.empty?i.moveByGroup(t,e):wl(t,e))}const D1=i=>_p(i,!un(i)),O1=i=>_p(i,un(i));function E1(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function vl(i,e,t){let n=sn(i).resolveInner(e.head),s=t?ot.closedBy:ot.openedBy;for(let a=e.head;;){let c=t?n.childAfter(a):n.childBefore(a);if(!c)break;E1(i,c,s)?n=c:a=t?c.to:c.from}let r=n.type.prop(s),o,l;return r&&(o=t?hi(i,n.from,1):hi(i,n.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?n.to:n.from,ce.cursor(l,t?-1:1)}const F1=i=>Qn(i,e=>vl(i.state,e,!un(i))),P1=i=>Qn(i,e=>vl(i.state,e,un(i)));function zp(i,e){return Qn(i,t=>{if(!t.empty)return wl(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const Vp=i=>zp(i,!1),Hp=i=>zp(i,!0);function Wp(i){let e=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,e,t.height):wl(o,e));if(s.eq(n.selection))return!1;let r;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,c=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomjp(i,!1),qa=i=>jp(i,!0);function Ji(i,e,t){let n=i.lineBlockAt(e.head),s=i.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?n.to:n.from)&&(s=i.moveToLineBoundary(e,t,!1)),!t&&s.head==n.from&&n.length){let r=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;r&&e.head!=n.from+r&&(s=ce.cursor(n.from+r))}return s}const B1=i=>Qn(i,e=>Ji(i,e,!0)),R1=i=>Qn(i,e=>Ji(i,e,!1)),N1=i=>Qn(i,e=>Ji(i,e,!un(i))),I1=i=>Qn(i,e=>Ji(i,e,un(i))),L1=i=>Qn(i,e=>ce.cursor(i.lineBlockAt(e.head).from,1)),$1=i=>Qn(i,e=>ce.cursor(i.lineBlockAt(e.head).to,-1));function _1(i,e,t){let n=!1,s=Qs(i.selection,r=>{let o=hi(i,r.head,-1)||hi(i,r.head,1)||r.head>0&&hi(i,r.head-1,1)||r.head_1(i,e);function qn(i,e){let t=Qs(i.state.selection,n=>{let s=e(n);return ce.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(mi(i.state,t)),!0)}function qp(i,e){return qn(i,t=>i.moveByChar(t,e))}const Up=i=>qp(i,!un(i)),Kp=i=>qp(i,un(i));function Gp(i,e){return qn(i,t=>i.moveByGroup(t,e))}const V1=i=>Gp(i,!un(i)),H1=i=>Gp(i,un(i)),W1=i=>qn(i,e=>vl(i.state,e,!un(i))),j1=i=>qn(i,e=>vl(i.state,e,un(i)));function Yp(i,e){return qn(i,t=>i.moveVertically(t,e))}const Xp=i=>Yp(i,!1),Jp=i=>Yp(i,!0);function Qp(i,e){return qn(i,t=>i.moveVertically(t,e,Wp(i).height))}const Nh=i=>Qp(i,!1),Ih=i=>Qp(i,!0),q1=i=>qn(i,e=>Ji(i,e,!0)),U1=i=>qn(i,e=>Ji(i,e,!1)),K1=i=>qn(i,e=>Ji(i,e,!un(i))),G1=i=>qn(i,e=>Ji(i,e,un(i))),Y1=i=>qn(i,e=>ce.cursor(i.lineBlockAt(e.head).from)),X1=i=>qn(i,e=>ce.cursor(i.lineBlockAt(e.head).to)),Lh=({state:i,dispatch:e})=>(e(mi(i,{anchor:0})),!0),$h=({state:i,dispatch:e})=>(e(mi(i,{anchor:i.doc.length})),!0),_h=({state:i,dispatch:e})=>(e(mi(i,{anchor:i.selection.main.anchor,head:0})),!0),zh=({state:i,dispatch:e})=>(e(mi(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),J1=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),Q1=({state:i,dispatch:e})=>{let t=kl(i).map(({from:n,to:s})=>ce.range(n,Math.min(s+1,i.doc.length)));return e(i.update({selection:ce.create(t),userEvent:"select"})),!0},Z1=({state:i,dispatch:e})=>{let t=Qs(i.selection,n=>{var s;let r=sn(i).resolveStack(n.from,1);for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=n.to||l.to>n.to&&l.from<=n.from)&&(!((s=l.parent)===null||s===void 0)&&s.parent))return ce.range(l.to,l.from)}return n});return e(mi(i,t)),!0},ek=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=ce.create([t.main]):t.main.empty||(n=ce.create([ce.cursor(t.main.head)])),n?(e(mi(i,n)),!0):!1};function qr(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,s=n.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=po(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=po(i,o,!1),l=po(i,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:ce.cursor(o,os(i)))n.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Zp=(i,e,t)=>qr(i,n=>{let s=n.from,{state:r}=i,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sZp(i,!1,!0),em=i=>Zp(i,!0,!1),tm=(i,e)=>qr(i,t=>{let n=t.head,{state:s}=i,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let l=null;;){if(n==(e?r.to:r.from)){n==t.head&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let a=nn(r.text,n-r.from,e)+r.from,c=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),u=o(c);if(l!=null&&u!=l)break;(c!=" "||n!=t.head)&&(l=u),n=a}return n}),nm=i=>tm(i,!1),tk=i=>tm(i,!0),nk=i=>qr(i,e=>{let t=i.lineBlockAt(e.head).to;return e.headqr(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),sk=i=>qr(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:yt.of(["",""])},range:ce.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},ok=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let s=n.from,r=i.doc.lineAt(s),o=s==r.from?s-1:nn(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:nn(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:i.doc.slice(s,l).append(i.doc.slice(o,s))},range:ce.cursor(l)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function kl(i){let e=[],t=-1;for(let n of i.selection.ranges){let s=i.doc.lineAt(n.from),r=i.doc.lineAt(n.to);if(!n.empty&&n.to==r.from&&(r=i.doc.lineAt(n.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});t=r.number+1}return e}function im(i,e,t){if(i.readOnly)return!1;let n=[],s=[];for(let r of kl(i)){if(t?r.to==i.doc.length:r.from==0)continue;let o=i.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){n.push({from:r.to,to:o.to},{from:r.from,insert:o.text+i.lineBreak});for(let a of r.ranges)s.push(ce.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{n.push({from:o.from,to:r.from},{from:r.to,insert:i.lineBreak+o.text});for(let a of r.ranges)s.push(ce.range(a.anchor-l,a.head-l))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:ce.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const lk=({state:i,dispatch:e})=>im(i,e,!1),ak=({state:i,dispatch:e})=>im(i,e,!0);function sm(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of kl(i))t?n.push({from:s.from,insert:i.doc.slice(s.from,s.to)+i.lineBreak}):n.push({from:s.to,insert:i.lineBreak+i.doc.slice(s.from,s.to)});return e(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ck=({state:i,dispatch:e})=>sm(i,e,!1),uk=({state:i,dispatch:e})=>sm(i,e,!0),hk=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(kl(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(i.lineWrapping){let o=i.lineBlockAt(s.head),l=i.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+i.documentTop-l.bottom+i.defaultLineHeight/2)}return i.moveVertically(s,!0,r)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function fk(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=sn(i).resolveInner(e),n=t.childBefore(e),s=t.childAfter(e),r;return n&&s&&n.to<=e&&s.from>=e&&(r=n.type.prop(ot.closedBy))&&r.indexOf(s.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(s.from).from&&!/\S/.test(i.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const dk=rm(!1),pk=rm(!0);function rm(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!i&&r==o&&fk(e,r);i&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let c=new gl(e,{simulateBreak:r,simulateDoubleBreak:!!a}),u=mc(c,r);for(u==null&&(u=Js(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=n.from;o<=n.to;){let l=i.doc.lineAt(o);l.number>t&&(n.empty||n.to>l.from)&&(e(l,s,n),t=l.number),o=l.to+1}let r=i.changes(s);return{changes:s,range:ce.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const mk=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new gl(i,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=xc(i,(r,o,l)=>{let a=mc(n,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let c=/^\s*/.exec(r.text)[0],u=Dr(i,a);(c!=u||l.fromi.readOnly?!1:(e(i.update(xc(i,(t,n)=>{n.push({from:t.from,insert:i.facet(ml)})}),{userEvent:"input.indent"})),!0),lm=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(xc(i,(t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Js(s,i.tabSize),o=0,l=Dr(i,Math.max(0,r-bs(i)));for(;o(i.setTabFocusMode(),!0),bk=[{key:"Ctrl-b",run:Lp,shift:Up,preventDefault:!0},{key:"Ctrl-f",run:$p,shift:Kp},{key:"Ctrl-p",run:Vp,shift:Xp},{key:"Ctrl-n",run:Hp,shift:Jp},{key:"Ctrl-a",run:L1,shift:Y1},{key:"Ctrl-e",run:$1,shift:X1},{key:"Ctrl-d",run:em},{key:"Ctrl-h",run:Ua},{key:"Ctrl-k",run:nk},{key:"Ctrl-Alt-h",run:nm},{key:"Ctrl-o",run:rk},{key:"Ctrl-t",run:ok},{key:"Ctrl-v",run:qa}],yk=[{key:"ArrowLeft",run:Lp,shift:Up,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:D1,shift:V1,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:N1,shift:K1,preventDefault:!0},{key:"ArrowRight",run:$p,shift:Kp,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:O1,shift:H1,preventDefault:!0},{mac:"Cmd-ArrowRight",run:I1,shift:G1,preventDefault:!0},{key:"ArrowUp",run:Vp,shift:Xp,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Lh,shift:_h},{mac:"Ctrl-ArrowUp",run:Rh,shift:Nh},{key:"ArrowDown",run:Hp,shift:Jp,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$h,shift:zh},{mac:"Ctrl-ArrowDown",run:qa,shift:Ih},{key:"PageUp",run:Rh,shift:Nh},{key:"PageDown",run:qa,shift:Ih},{key:"Home",run:R1,shift:U1,preventDefault:!0},{key:"Mod-Home",run:Lh,shift:_h},{key:"End",run:B1,shift:q1,preventDefault:!0},{key:"Mod-End",run:$h,shift:zh},{key:"Enter",run:dk},{key:"Mod-a",run:J1},{key:"Backspace",run:Ua,shift:Ua},{key:"Delete",run:em},{key:"Mod-Backspace",mac:"Alt-Backspace",run:nm},{key:"Mod-Delete",mac:"Alt-Delete",run:tk},{mac:"Mod-Backspace",run:ik},{mac:"Mod-Delete",run:sk}].concat(bk.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),wk=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:F1,shift:W1},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:P1,shift:j1},{key:"Alt-ArrowUp",run:lk},{key:"Shift-Alt-ArrowUp",run:ck},{key:"Alt-ArrowDown",run:ak},{key:"Shift-Alt-ArrowDown",run:uk},{key:"Escape",run:ek},{key:"Mod-Enter",run:pk},{key:"Alt-l",mac:"Ctrl-l",run:Q1},{key:"Mod-i",run:Z1,preventDefault:!0},{key:"Mod-[",run:lm},{key:"Mod-]",run:om},{key:"Mod-Alt-\\",run:mk},{key:"Shift-Mod-k",run:hk},{key:"Shift-Mod-\\",run:z1},{key:"Mod-/",run:c1},{key:"Alt-A",run:h1},{key:"Ctrl-m",mac:"Shift-Alt-m",run:gk}].concat(yk),vk={key:"Tab",run:om,shift:lm};function Ft(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];typeof s=="string"?i.setAttribute(n,s):s!=null&&(i[n]=s)}e++}for(;ei.normalize("NFKD"):i=>i;class Ks{constructor(e,t,n=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=r?l=>r(Vh(l)):Vh,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Zt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Za(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=$n(e);let s=this.normalize(t);for(let r=0,o=n;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==n&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,s=n+t[0].length;if(this.matchPos=Xo(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||s.to<=t){let l=new Is(t,e.sliceString(t,n));return Gl.set(e,l),l}if(s.from==t&&s.to==n)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this.matchPos=Xo(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Is.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol!="undefined"&&(um.prototype[Symbol.iterator]=hm.prototype[Symbol.iterator]=function(){return this});function kk(i){try{return new RegExp(i,Sc),!0}catch(e){return!1}}function Xo(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}function Ka(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=Ft("input",{class:"cm-textfield",name:"line",value:e}),n=Ft("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:Jo.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},Ft("label",i.state.phrase("Go to line"),": ",t)," ",Ft("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,c,u,h]=r,f=u?+u.slice(1):0,d=c?+c:l.number;if(c&&h){let b=d/100;a&&(b=b*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*b)}else c&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),y=ce.cursor(p.from+Math.max(0,Math.min(f,p.length)));i.dispatch({effects:[Jo.of(!1),Pe.scrollIntoView(y.from,{y:"center"})],selection:y}),i.focus()}return{dom:n}}const Jo=nt.define(),Hh=rn.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Jo)&&(i=t.value);return i},provide:i=>Tr.from(i,e=>e?Ka:null)}),xk=i=>{let e=Ar(i,Ka);if(!e){let t=[Jo.of(!0)];i.state.field(Hh,!1)==null&&t.push(nt.appendConfig.of([Hh,Sk])),i.dispatch({effects:t}),e=Ar(i,Ka)}return e&&e.dom.querySelector("input").select(),!0},Sk=Pe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Ck={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ak=Ne.define({combine(i){return pi(i,Ck,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Tk(i){return[Fk,Ek]}const Mk=_e.mark({class:"cm-selectionMatch"}),Dk=_e.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wh(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=It.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=It.Word)}function Ok(i,e,t,n){return i(e.sliceDoc(t,t+1))==It.Word&&i(e.sliceDoc(n-1,n))==It.Word}const Ek=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(Ak),{state:t}=i,n=t.selection;if(n.ranges.length>1)return _e.none;let s=n.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return _e.none;let a=t.wordAt(s.head);if(!a)return _e.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return _e.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Wh(o,t,s.from,s.to)&&Ok(o,t,s.from,s.to)))return _e.none}else if(r=t.sliceDoc(s.from,s.to),!r)return _e.none}let l=[];for(let a of i.visibleRanges){let c=new Ks(t.doc,r,a.from,a.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||Wh(o,t,u,h))&&(s.empty&&u<=s.from&&h>=s.to?l.push(Dk.range(u,h)):(u>=s.to||h<=s.from)&&l.push(Mk.range(u,h)),l.length>e.maxMatches))return _e.none}}return _e.set(l)}},{decorations:i=>i.decorations}),Fk=Pe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Pk=({state:i,dispatch:e})=>{let{selection:t}=i,n=ce.create(t.ranges.map(s=>i.wordAt(s.head)||ce.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function Bk(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new Ks(i.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Ks(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(a=>a.from==l.value.from))continue;if(r){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Rk=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return Pk({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=n))return!1;let s=Bk(i,n);return s?(e(i.update({selection:i.selection.addRange(ce.range(s.from,s.to),!1),effects:Pe.scrollIntoView(s.to)})),!0):!1},Zs=Ne.define({combine(i){return pi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Uk(e),scrollToMatch:e=>Pe.scrollIntoView(e)})}});class fm{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||kk(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?` `:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new $k(this):new Ik(this)}getCursor(e,t=0,n){let s=e.doc?e:ht.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Ts(this,s,t,n):As(this,s,t,n)}}class dm{constructor(e){this.spec=e}}function As(i,e,t,n){return new Ks(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),i.wholeWord?Nk(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Nk(i,e){return(t,n,s,r)=>((r>t||r+s.length=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=As(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Ts(i,e,t,n){return new um(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?Lk(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function Qo(i,e){return i.slice(nn(i,e,!1),e)}function Zo(i,e){return i.slice(e,nn(i,e))}function Lk(i){return(e,t,n)=>!n[0].length||(i(Qo(n.input,n.index))!=It.Word||i(Zo(n.input,n.index))!=It.Word)&&(i(Zo(n.input,n.index+n[0].length))!=It.Word||i(Qo(n.input,n.index+n[0].length))!=It.Word)}class $k extends dm{nextMatch(e,t,n){let s=Ts(this.spec,e,n,e.doc.length).next();return s.done&&(s=Ts(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let r=Math.max(t,n-s*1e4),o=Ts(this.spec,e,r,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=Ts(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Er=nt.define(),Cc=nt.define(),zi=rn.define({create(i){return new Yl(Ga(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Er)?i=new Yl(t.value.create(),i.panel):t.is(Cc)&&(i=new Yl(i.query,t.value?Ac:null));return i},provide:i=>Tr.from(i,e=>e.panel)});class Yl{constructor(e,t){this.query=e,this.panel=t}}const _k=_e.mark({class:"cm-searchMatch"}),zk=_e.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Vk=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(zi))}update(i){let e=i.state.field(zi);(e!=i.startState.field(zi)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return _e.none;let{view:t}=this,n=new ji;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)a=r[++s].to;i.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);n.add(c,u,h?zk:_k)})}return n.finish()}},{decorations:i=>i.decorations});function Ur(i){return e=>{let t=e.state.field(zi,!1);return t&&t.query.spec.valid?i(e,t):gm(e)}}const el=Ur((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=ce.single(n.from,n.to),r=i.state.facet(Zs);return i.dispatch({selection:s,effects:[Tc(i,n),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),mm(i),!0}),tl=Ur((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let r=ce.single(s.from,s.to),o=i.state.facet(Zs);return i.dispatch({selection:r,effects:[Tc(i,s),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),mm(i),!0}),Hk=Ur((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:ce.create(t.map(n=>ce.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Wk=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,r=[],o=0;for(let l=new Ks(i.doc,i.sliceDoc(n,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==n&&(o=r.length),r.push(ce.range(l.value.from,l.value.to))}return e(i.update({selection:ce.create(r,o),userEvent:"select.search.matches"})),!0},jh=Ur((i,{query:e})=>{let{state:t}=i,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,n,n);if(!r)return!1;let o=[],l,a,c=[];if(r.from==n&&r.to==s&&(a=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(t,r.from,r.to),c.push(Pe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),r){let u=o.length==0||o[0].from>=r.to?0:r.to-r.from-a.length;l=ce.single(r.from-u,r.to-u),c.push(Tc(i,r)),c.push(t.facet(Zs).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:c,userEvent:"input.replace"}),!0}),jk=Ur((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:Pe.announce.of(n),userEvent:"input.replace.all"}),!0});function Ac(i){return i.state.facet(Zs).createPanel(i)}function Ga(i,e){var t,n,s,r,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?"":i.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=i.facet(Zs);return new fm({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function pm(i){let e=Ar(i,Ac);return e&&e.dom.querySelector("[main-field]")}function mm(i){let e=pm(i);e&&e==i.root.activeElement&&e.select()}const gm=i=>{let e=i.state.field(zi,!1);if(e&&e.panel){let t=pm(i);if(t&&t!=i.root.activeElement){let n=Ga(i.state,e.query.spec);n.valid&&i.dispatch({effects:Er.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Cc.of(!0),e?Er.of(Ga(i.state,e.query.spec)):nt.appendConfig.of(Gk)]});return!0},bm=i=>{let e=i.state.field(zi,!1);if(!e||!e.panel)return!1;let t=Ar(i,Ac);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Cc.of(!1)}),!0},qk=[{key:"Mod-f",run:gm,scope:"editor search-panel"},{key:"F3",run:el,shift:tl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:el,shift:tl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:bm,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Wk},{key:"Mod-Alt-g",run:xk},{key:"Mod-d",run:Rk,preventDefault:!0}];class Uk{constructor(e){this.view=e;let t=this.query=e.state.field(zi).query.spec;this.commit=this.commit.bind(this),this.searchField=Ft("input",{value:t.search,placeholder:Pn(e,"Find"),"aria-label":Pn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ft("input",{value:t.replace,placeholder:Pn(e,"Replace"),"aria-label":Pn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ft("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ft("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ft("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,r,o){return Ft("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=Ft("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>el(e),[Pn(e,"next")]),n("prev",()=>tl(e),[Pn(e,"previous")]),n("select",()=>Hk(e),[Pn(e,"all")]),Ft("label",null,[this.caseField,Pn(e,"match case")]),Ft("label",null,[this.reField,Pn(e,"regexp")]),Ft("label",null,[this.wordField,Pn(e,"by word")]),...e.state.readOnly?[]:[Ft("br"),this.replaceField,n("replace",()=>jh(e),[Pn(e,"replace")]),n("replaceAll",()=>jk(e),[Pn(e,"replace all")])],Ft("button",{name:"close",onclick:()=>bm(e),"aria-label":Pn(e,"close"),type:"button"},["×"])])}commit(){let e=new fm({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Er.of(e)}))}keydown(e){Zy(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?tl:el)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),jh(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Er)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Zs).top}}function Pn(i,e){return i.state.phrase(e)}const mo=30,go=/[\s\.,:;?!]/;function Tc(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,r=Math.max(n.from,e-mo),o=Math.min(s,t+mo),l=i.state.sliceDoc(r,o);if(r!=n.from){for(let a=0;al.length-mo;a--)if(!go.test(l[a-1])&&go.test(l[a])){l=l.slice(0,a);break}}return Pe.announce.of(`${i.state.phrase("current match")}. ${l} ${i.state.phrase("on line")} ${n.number}.`)}const Kk=Pe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Gk=[zi,vs.low(Vk),Kk];class ym{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=sn(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),s=t.text.slice(n-t.from,this.pos-t.from),r=s.search(wm(e,!1));return r<0?null:{from:n+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function qh(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Yk(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Yk(e);return s=>{let r=s.matchBefore(n);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Uh{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function Vi(i){return i.selection.main.from}function wm(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",r=n[n.length-1]!="$";return!s&&!r?i:new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const vm=Si.define();function Jk(i,e,t,n){let{main:s}=i.selection,r=t-s.from,o=n-s.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=s&&t!=n&&i.sliceDoc(l.from+r,l.from+o)!=i.sliceDoc(t,n)?{range:l}:{changes:{from:l.from+r,to:n==s.from?l.to:l.from+o,insert:e},range:ce.cursor(l.from+r+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Kh=new WeakMap;function Qk(i){if(!Array.isArray(i))return i;let e=Kh.get(i);return e||Kh.set(i,e=Xk(i)),e}const nl=nt.define(),Fr=nt.define();class Zk{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=Za(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!A||P==1&&b||F==0&&P!=0)&&(t[h]==D||n[h]==D&&(f=!0)?o[h++]=A:o.length&&(m=!1)),F=P,A+=$n(D)}return h==a&&o[0]==0&&m?this.result(-100+(f?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,y]):h==a?this.result(-100+(f?-200:0)+-700+(m?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],r=0;for(let o of t){let l=o+(this.astral?$n(Zt(n,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-n.length,s)}}class ex{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tx,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Gh(e(n),t(n)),optionClass:(e,t)=>n=>Gh(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Gh(i,e){return i?e?i+" "+e:i:e}function tx(i,e,t,n,s,r){let o=i.textDirection==Rt.RTL,l=o,a=!1,c="top",u,h,f=e.left-s.left,d=s.right-e.right,p=n.right-n.left,y=n.bottom-n.top;if(l&&f=y||A>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let b=(e.bottom-e.top)/r.offsetHeight,m=(e.right-e.left)/r.offsetWidth;return{style:`${c}: ${u/b}px; max-width: ${h/m}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function nx(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let c=0;ca&&o.appendChild(document.createTextNode(l.slice(a,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(u,h))),f.className="cm-completionMatchedText",a=h}return at.position-n.position).map(t=>t.render)}function Xl(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class ix{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(tn);this.optionContent=nx(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Xl(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(t).open;for(let u=a.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(tn).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Fr.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:r,selected:o,disabled:l}=n.open;(!s.open||s.open.options!=r)&&(this.range=Xl(r.length,o,e.state.facet(tn).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Xl(t.options.length,t.selected,this.view.state.facet(tn).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:s}=n;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(n);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>An(this.view.state,o,"completion info")):this.addInfoPane(r,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;n.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&rx(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottomn.from||n.from==0))if(r=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(l);h&&(u.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.tonew ix(t,i,e)}function rx(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.topt.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function Yh(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function ox(i,e){let t=[],n=null,s=c=>{t.push(c);let{section:u}=c.completion;if(u){n||(n=[]);let h=typeof u=="string"?u:u.name;n.some(f=>f.name==h)||n.push(typeof u=="string"?{name:h}:u)}},r=e.facet(tn);for(let c of i)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)s(new Uh(h,c.source,u?u(h):[],1e9-t.length));else{let h=e.sliceDoc(c.from,c.to),f,d=r.filterStrict?new ex(h):new Zk(h);for(let p of c.result.options)if(f=d.match(p.label)){let y=p.displayLabel?u?u(p,f.matched):[]:f.matched;s(new Uh(p,c.source,y,f.score+(p.boost||0)))}}}if(n){let c=Object.create(null),u=0,h=(f,d)=>{var p,y;return((p=f.rank)!==null&&p!==void 0?p:1e9)-((y=d.rank)!==null&&y!==void 0?y:1e9)||(f.nameh.score-u.score||a(u.completion,h.completion))){let u=c.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?o.push(c):Yh(c.completion)>Yh(l)&&(o[o.length-1]=c),l=c.completion}return o}class Es{constructor(e,t,n,s,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Es(this.options,Xh(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,r){let o=ox(e,t);if(!o.length)return s&&e.some(a=>a.state==1)?new Es(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;let l=t.facet(tn).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let a=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(a,c.from):a,1e8),create:fx,above:r.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new Es(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class il{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new il(ux,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(tn),r=(n.override||t.languageDataAt("autocomplete",Vi(t)).map(Qk)).map(l=>(this.active.find(c=>c.source==l)||new pn(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));r.length==this.active.length&&r.every((l,a)=>l==this.active[a])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!lx(r,this.active)?o=Es.build(r,t,this.id,o,n):o&&o.disabled&&!r.some(l=>l.state==1)&&(o=null),!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new pn(l.source,0):l));for(let l of e.effects)l.is(xm)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new il(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ax:cx}}function lx(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t-1&&(t["aria-activedescendant"]=i+"-"+e),t}const ux=[];function Ya(i,e){if(i.isUserEvent("input.complete")){let t=i.annotation(vm);if(t&&e.activateOnCompletion(t))return"input"}return i.isUserEvent("input.type")?"input":i.isUserEvent("delete.backward")?"delete":null}class pn{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=Ya(e,t),s=this;n?s=s.handleUserEvent(e,n,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new pn(s.source,0));for(let r of e.effects)if(r.is(nl))s=new pn(s.source,1,r.value?Vi(e.state):-1);else if(r.is(Fr))s=new pn(s.source,0);else if(r.is(km))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,n){return t=="delete"||!n.activateOnTyping?this.map(e.changes):new pn(this.source,1)}handleChange(e){return e.changes.touchesRange(Vi(e.startState))?new pn(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new pn(this.source,this.state,e.mapPos(this.explicitPos))}}class Ls extends pn{constructor(e,t,n,s,r){super(e,2,t),this.result=n,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var s;let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let o=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=Vi(e.state);if((this.explicitPos<0?a<=o:al||!r||t=="delete"&&Vi(e.startState)==this.from)return new pn(this.source,t=="input"&&n.activateOnTyping?1:0);let c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return hx(r.validFor,e.state,o,l)?new Ls(this.source,c,r,o,l):r.update&&(r=r.update(r,o,l,new ym(e.state,a,c>=0)))?new Ls(this.source,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:Vi(e.state)):new pn(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new pn(this.source,0):this.map(e.changes)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Ls(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new pn(this.source,0)}}function hx(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):wm(i,!0).test(s)}const km=nt.define({map(i,e){return i.map(t=>t.map(e))}}),xm=nt.define(),xn=rn.define({create(){return il.start()},update(i,e){return i.update(e)},provide:i=>[uc.from(i,e=>e.tooltip),Pe.contentAttributes.from(i,e=>e.attrs)]});function Mc(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(xn).active.find(s=>s.source==e.source);return n instanceof Ls?(typeof t=="string"?i.dispatch(Object.assign(Object.assign({},Jk(i.state,t,n.from,n.to)),{annotations:vm.of(e.completion)})):t(i,e.completion,n.from,n.to),!0):!1}const fx=sx(xn,Mc);function bo(i,e="option"){return t=>{let n=t.state.field(xn,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+s*(i?1:-1):i?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:xm.of(l)}),!0}}const dx=i=>{let e=i.state.field(xn,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampi.state.field(xn,!1)?(i.dispatch({effects:nl.of(!0)}),!0):!1,mx=i=>{let e=i.state.field(xn,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:Fr.of(null)}),!0)};class gx{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const bx=50,yx=1e3,wx=Vt.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(xn).active)e.state==1&&this.startQuery(e)}update(i){let e=i.state.field(xn),t=i.state.facet(tn);if(!i.selectionSet&&!i.docChanged&&i.startState.field(xn)==e)return;let n=i.transactions.some(r=>(r.selection||r.docChanged)&&!Ya(r,t));for(let r=0;rbx&&Date.now()-o.time>yx){for(let l of o.context.abortListeners)try{l()}catch(a){An(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(r=>r.effects.some(o=>o.is(nl)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of i.transactions)Ya(r,t)=="input"?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(xn);for(let t of e.active)t.state==1&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t)}startQuery(i){let{state:e}=this.view,t=Vi(e),n=new ym(e,t,i.explicitPos==t),s=new gx(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Fr.of(null)}),An(this.view.state,r)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(tn).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(tn);for(let n=0;no.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new pn(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:km.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(xn,!1);if(e&&e.tooltip&&this.view.state.facet(tn).closeOnBlur){let t=e.open&&Yd(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Fr.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:nl.of(!1)}),20),this.composing=0}}}),vx=typeof navigator=="object"&&/Win/.test(navigator.platform),kx=vs.highest(Pe.domEventHandlers({keydown(i,e){let t=e.state.field(xn,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(vx&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(o=>o.source==n.source),r=n.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(i.key)>-1&&Mc(e,n),!1}})),xx=Pe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Pr={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},as=nt.define({map(i,e){let t=e.mapPos(i,-1,gn.TrackAfter);return t==null?void 0:t}}),Dc=new class extends ds{};Dc.startSide=1;Dc.endSide=-1;const Sm=rn.define({create(){return gt.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(as)&&(i=i.update({add:[Dc.range(t.value,t.value+1)]}));return i}});function Sx(){return[Ax,Sm]}const Jl="()[]{}<>";function Cm(i){for(let e=0;e{if((Cx?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&$n(Zt(n,0))==1||e!=s.from||t!=s.to)return!1;let r=Dx(i.state,n);return r?(i.dispatch(r),!0):!1}),Tx=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Am(i,i.selection.main.head).brackets||Pr.brackets,s=null,r=i.changeByRange(o=>{if(o.empty){let l=Ox(i.doc,o.head);for(let a of n)if(a==l&&xl(i.doc,o.head)==Cm(Zt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:ce.cursor(o.head-a.length)}}return{range:s=o}});return s||e(i.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Mx=[{key:"Backspace",run:Tx}];function Dx(i,e){let t=Am(i,i.selection.main.head),n=t.brackets||Pr.brackets;for(let s of n){let r=Cm(Zt(s,0));if(e==s)return r==s?Px(i,s,n.indexOf(s+s+s)>-1,t):Ex(i,s,r,t.before||Pr.before);if(e==r&&Tm(i,i.selection.main.from))return Fx(i,s,r)}return null}function Tm(i,e){let t=!1;return i.field(Sm).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function xl(i,e){let t=i.sliceString(e,e+2);return t.slice(0,$n(Zt(t,0)))}function Ox(i,e){let t=i.sliceString(e-2,e);return $n(Zt(t,0))==t.length?t:t.slice(1)}function Ex(i,e,t,n){let s=null,r=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:as.of(o.to+e.length),range:ce.range(o.anchor+e.length,o.head+e.length)};let l=xl(i.doc,o.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:as.of(o.head+e.length),range:ce.cursor(o.head+e.length)}:{range:s=o}});return s?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Fx(i,e,t){let n=null,s=i.changeByRange(r=>r.empty&&xl(i.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:ce.cursor(r.head+t.length)}:n={range:r});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Px(i,e,t,n){let s=n.stringPrefixes||Pr.stringPrefixes,r=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:as.of(l.to+e.length),range:ce.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=xl(i.doc,a),u;if(c==e){if(Jh(i,a))return{changes:{insert:e+e,from:a},effects:as.of(a+e.length),range:ce.cursor(a+e.length)};if(Tm(i,a)){let f=t&&i.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:ce.cursor(a+f.length)}}}else{if(t&&i.sliceDoc(a-2*e.length,a)==e+e&&(u=Qh(i,a-2*e.length,s))>-1&&Jh(i,u))return{changes:{insert:e+e+e+e,from:a},effects:as.of(a+e.length),range:ce.cursor(a+e.length)};if(i.charCategorizer(a)(c)!=It.Word&&Qh(i,a,s)>-1&&!Bx(i,a,e,s))return{changes:{insert:e+e,from:a},effects:as.of(a+e.length),range:ce.cursor(a+e.length)}}return{range:r=l}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Jh(i,e){let t=sn(i).resolveInner(e+1);return t.parent&&t.from==e}function Bx(i,e,t,n){let s=sn(i).resolveInner(e,-1),r=n.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&n.indexOf(l.slice(0,a))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>t.length+a;){if(i.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function Qh(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=It.Word)return e;for(let s of t){let r=e-s.length;if(i.sliceDoc(r,e)==s&&n(i.sliceDoc(r-1,r))!=It.Word)return r}return-1}function Rx(i={}){return[kx,xn,tn.of(i),wx,Nx,xx]}const Mm=[{key:"Ctrl-Space",run:px},{key:"Escape",run:mx},{key:"ArrowDown",run:bo(!0)},{key:"ArrowUp",run:bo(!1)},{key:"PageDown",run:bo(!0,"page")},{key:"PageUp",run:bo(!1,"page")},{key:"Enter",run:dx}],Nx=vs.highest(fl.computeN([tn],i=>i.facet(tn).defaultKeymap?[Mm]:[]));class Ix{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class is{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=e,r=n.facet(Br).markerFilter;r&&(s=r(s,n));let o=_e.set(s.map(l=>l.from==l.to||l.from==l.to-1&&n.doc.lineAt(l.from).to==l.from?_e.widget({widget:new qx(l),diagnostic:l}).range(l.from):_e.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l}).range(l.from,l.to)),!0);return new is(o,t,Gs(o))}}function Gs(i,e=null,t=0){let n=null;return i.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new Ix(s,r,o.diagnostic),!1}),n}function Lx(i,e){let t=e.pos,n=e.end||t,s=i.state.facet(Br).hideOn(i,t,n);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(Dm))||i.changes.touchesRange(r.from,Math.max(r.to,n)))}function $x(i,e){return i.field(Nn,!1)?e:e.concat(nt.appendConfig.of(Gx))}const Dm=nt.define(),Oc=nt.define(),Om=nt.define(),Nn=rn.define({create(){return new is(_e.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),n=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);n=Gs(t,i.selected.diagnostic,r)||Gs(t,null,r)}!t.size&&s&&e.state.facet(Br).autoPanel&&(s=null),i=new is(t,s,n)}for(let t of e.effects)if(t.is(Dm)){let n=e.state.facet(Br).autoPanel?t.value.length?Rr.open:null:i.panel;i=is.init(t.value,n,e.state)}else t.is(Oc)?i=new is(i.diagnostics,t.value?Rr.open:null,i.selected):t.is(Om)&&(i=new is(i.diagnostics,i.panel,t.value));return i},provide:i=>[Tr.from(i,e=>e.panel),Pe.decorations.from(i,e=>e.diagnostics)]}),_x=_e.mark({class:"cm-lintRange cm-lintRange-active"});function zx(i,e,t){let{diagnostics:n}=i.state.field(Nn),s=[],r=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:u})=>{e>=a&&e<=c&&(a==c||(e>a||t>0)&&(eFm(i,t,!1)))}const Hx=i=>{let e=i.state.field(Nn,!1);(!e||!e.panel)&&i.dispatch({effects:$x(i.state,[Oc.of(!0)])});let t=Ar(i,Rr.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Zh=i=>{let e=i.state.field(Nn,!1);return!e||!e.panel?!1:(i.dispatch({effects:Oc.of(!1)}),!0)},Wx=i=>{let e=i.state.field(Nn,!1);if(!e)return!1;let t=i.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},jx=[{key:"Mod-Shift-m",run:Hx,preventDefault:!0},{key:"F8",run:Wx}],Br=Ne.define({combine(i){return Object.assign({sources:i.map(e=>e.source).filter(e=>e!=null)},pi(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function Em(i){let e=[];if(i)e:for(let{name:t}of i){for(let n=0;nr.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Fm(i,e,t){var n;let s=t?Em(e.actions):[];return Ft("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ft("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((r,o)=>{let l=!1,a=f=>{if(f.preventDefault(),l)return;l=!0;let d=Gs(i.state.field(Nn).diagnostics,e);d&&r.apply(i,d.from,d.to)},{name:c}=r,u=s[o]?c.indexOf(s[o]):-1,h=u<0?c:[c.slice(0,u),Ft("u",c.slice(u,u+1)),c.slice(u+1)];return Ft("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[o]})"`}.`},h)}),e.source&&Ft("div",{class:"cm-diagnosticSource"},e.source))}class qx extends Ci{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ft("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class ef{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Fm(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Rr{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)Zh(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Em(r.actions);for(let l=0;l{for(let r=0;rZh(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Nn).selected;if(!e)return-1;for(let t=0;t{let c=-1,u;for(let h=n;hn&&(this.items.splice(n,c-n),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Nn),n=Gs(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Om.of(n)})}static open(e){return new Rr(e)}}function Ux(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function yo(i){return Ux(``,'width="6" height="3"')}const Kx=Pe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:yo("#d11")},".cm-lintRange-warning":{backgroundImage:yo("orange")},".cm-lintRange-info":{backgroundImage:yo("#999")},".cm-lintRange-hint":{backgroundImage:yo("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),Gx=[Nn,Pe.decorations.compute([Nn],i=>{let{selected:e,panel:t}=i.field(Nn);return!e||!t||e.from==e.to?_e.none:_e.set([_x.range(e.from,e.to)])}),Vw(zx,{hideOn:Lx}),Kx],Yx=[Xw(),Zw(),gw(),y1(),Vv(),rw(),uw(),ht.allowMultipleSelections.of(!0),Mv(),vp(qv,{fallback:!0}),Qv(),Sx(),Rx(),Ew(),Bw(),xw(),Tk(),fl.of([...Mx,...wk,...qk,...M1,...Lv,...Mm,...jx])];/*! * VueCodemirror v6.1.1 * Copyright (c) Surmon. All rights reserved. * Released under the MIT License. * Surmon */var Xx=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[Yx]}),Jx=Symbol("vue-codemirror-global-config"),mn,Qx=function(i){var e=i.onUpdate,t=i.onChange,n=i.onFocus,s=i.onBlur,r=function(o,l){var a={};for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&l.indexOf(c)<0&&(a[c]=o[c]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function"){var u=0;for(c=Object.getOwnPropertySymbols(o);u(i.JSON="json",i.YAML="yaml",i))(Ds||{}),Bm=i=>{var{theme:e,settings:t={},styles:n=[]}=i,s={".cm-gutters":{}},r={};t.background&&(r.backgroundColor=t.background),t.backgroundImage&&(r.backgroundImage=t.backgroundImage),t.foreground&&(r.color=t.foreground),t.fontSize&&(r.fontSize=t.fontSize),(t.background||t.foreground)&&(s["&"]=r),t.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(s[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(s[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(s[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(s[".cm-content"]={caretColor:t.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var o={};t.gutterActiveForeground&&(o.color=t.gutterActiveForeground),t.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:t.lineHighlight},o.backgroundColor=t.lineHighlight),s[".cm-activeLineGutter"]=o,t.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var l=Pe.theme(s,{dark:e==="dark"}),a=jr.define(n),c=[l,vp(a)];return c},rS={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},oS=i=>{var{theme:e="light",settings:t={},styles:n=[]}={};return Bm({theme:e,settings:kf({},rS,t),styles:[{tag:[X.standard(X.tagName),X.tagName],color:"#116329"},{tag:[X.comment,X.bracket],color:"#6a737d"},{tag:[X.className,X.propertyName],color:"#6f42c1"},{tag:[X.variableName,X.attributeName,X.number,X.operator],color:"#005cc5"},{tag:[X.keyword,X.typeName,X.typeOperator,X.typeName],color:"#d73a49"},{tag:[X.string,X.meta,X.regexp],color:"#032f62"},{tag:[X.name,X.quote],color:"#22863a"},{tag:[X.heading,X.strong],color:"#24292e",fontWeight:"bold"},{tag:[X.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[X.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[X.atom,X.bool,X.special(X.variableName)],color:"#e36209"},{tag:[X.url,X.escape,X.regexp,X.link],color:"#032f62"},{tag:X.link,textDecoration:"underline"},{tag:X.strikethrough,textDecoration:"line-through"},{tag:X.invalid,color:"#cb2431"},...n]})},lS=oS(),aS={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},cS=i=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return Bm({theme:e,settings:kf({},aS,t),styles:[{tag:[X.standard(X.tagName),X.tagName],color:"#7ee787"},{tag:[X.comment,X.bracket],color:"#8b949e"},{tag:[X.className,X.propertyName],color:"#d2a8ff"},{tag:[X.variableName,X.attributeName,X.number,X.operator],color:"#79c0ff"},{tag:[X.keyword,X.typeName,X.typeOperator,X.typeName],color:"#ff7b72"},{tag:[X.string,X.meta,X.regexp],color:"#a5d6ff"},{tag:[X.name,X.quote],color:"#7ee787"},{tag:[X.heading,X.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[X.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[X.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[X.atom,X.bool,X.special(X.variableName)],color:"#ffab70"},{tag:X.link,textDecoration:"underline"},{tag:X.strikethrough,textDecoration:"line-through"},{tag:X.invalid,color:"#f97583"},...n]})},uS=cS(),hS=["true","false","on","off","yes","no"],fS=new RegExp("\\b(("+hS.join(")|(")+"))$","i");const dS={name:"yaml",token:function(i,e){var t=i.peek(),n=e.escaped;if(e.escaped=!1,t=="#"&&(i.pos==0||/\s/.test(i.string.charAt(i.pos-1))))return i.skipToEnd(),"comment";if(i.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&i.indentation()>e.keyCol)return i.skipToEnd(),"string";if(e.literal&&(e.literal=!1),i.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,i.match("---")||i.match("..."))return"def";if(i.match(/^\s*-\s+/))return"meta"}if(i.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&t==",")return i.next(),"meta";if(e.inlinePairs>0&&!n&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,i.next(),"meta";if(e.pairStart){if(i.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(i.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&i.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&i.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(i.match(fS))return"keyword"}return!e.pair&&i.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=i.indentation(),"atom"):e.pair&&i.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",i.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};var nf={};class sl{constructor(e,t,n,s,r,o,l,a,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let s=e.parser.context;return new sl(e,[],t,n,n,0,[],0,s?new sf(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,s=e&65535,{parser:r}=this.p;this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(s,a)}storeNode(e,t,n,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==n)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=n;return}}}if(!r||this.pos==n)this.buffer.push(e,t,n,s);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=s}}shift(e,t,n,s){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,s,4);else{let r=e,{parser:o}=this.p;(s>this.pos||t<=o.maxNode)&&(this.pos=s,o.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,s,4)}}apply(e,t,n,s){e&65536?this.reduce(e):this.shift(e,t,n,s)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(n,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new sl(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new pS(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let n=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-n*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,c=this.stack.length-l*3;if(c>=0&&e.getGoto(this.stack[c],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,r+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class sf{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class pS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class rl{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new rl(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new rl(this.stack,this.pos,this.index)}}function vo(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,s=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Po{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const rf=new Po;class mS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=rf,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,s=this.rangeIndex,r=this.pos+e;for(;rn.to:r>=n.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-n.to,n=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,s;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),s=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),s}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=rf,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(n+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return n}}class $s{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;gS(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}$s.prototype.contextual=$s.prototype.fallback=$s.prototype.extend=!1;$s.prototype.fallback=$s.prototype.extend=!1;function gS(i,e,t,n,s,r){let o=0,l=1<0){let p=i[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||bS(p,e.token.value,s,r))){e.acceptToken(p);break}}let u=e.next,h=0,f=i[o+2];if(e.next<0&&f>h&&i[c+f*3-3]==65535){o=i[c+f*3-1];continue e}for(;h>1,p=c+d+(d<<1),y=i[p],b=i[p+1]||65536;if(u=b)h=d+1;else{o=i[p+2],e.advance();continue e}}break}}function of(i,e,t){for(let n=e,s;(s=i[n])!=65535;n++)if(s==t)return n-e;return-1}function bS(i,e,t,n){let s=of(t,n,e);return s<0||of(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}class yS{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lf(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lf(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof Tt){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class wS{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Po)}getActions(e){let t=0,n=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let c=0;ch.end+25&&(a=Math.max(h.lookAhead,a)),h.value!=0)){let f=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Po,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Po,{pos:n,p:s}=e;return t.start=n,t.end=Math.min(n+1,s.stream.end),t.value=n==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,n){let s=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(s,e),n),e.value>-1){let{parser:r}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,n,s){for(let r=0;re.bufferLength*4?new yS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!n.length){let o=s&&xS(s);if(o)return this.stackToTree(o);if(this.parser.strict)throw new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,n);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&c.buffer.length>500)if((l.score-c.score||l.buffer.length-c.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(s);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?r.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!c||(h.prop(ot.contextHash)||0)==u))return e.useNode(h,f),!0;if(!(h instanceof Tt)||h.children.length==0||h.positions[0]>0)break;let d=h.children[0];if(d instanceof Tt&&h.positions[0]==0)h=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let c=0;cs?t.push(p):n.push(p)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return af(e,t),!0}}runRecovery(e,t,n){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),this.advanceFully(l,n))))continue;let h=l.split(),f=u;for(let d=0;h.forceReduce()&&d<10&&!this.advanceFully(h,n);d++)Bn&&(f=this.stackID(h)+" -> ");for(let d of l.recoverByInsert(a))this.advanceFully(d,n);this.stream.end>l.pos?(c==l.pos&&(c++,a=0),l.recoverByDelete(a,c),af(l,n)):(!s||s.scoree.topRules[l][1]),s=[];for(let l=0;l=0)r(u,a,l[c++]);else{let h=l[c+-u];for(let f=-u;f>0;f--)r(l[c++],a,h);c++}}}this.nodeSet=new pl(t.map((l,a)=>wn.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Zd;let o=vo(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new $s(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let s=new vS(this,e,t,n);for(let r of this.wrappers)s=r(s,e,t,n);return s}getGoto(e,t,n=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&n)return a;for(let c=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),s=n?t(n):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=bi(this.data,r+2);else break;s=t(bi(this.data,r+1))}return s}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=bi(this.data,n+2);else break;if(!(this.data[n+2]&1)){let s=this.data[n+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[n],s)}}return t}configure(e){let t=Object.assign(Object.create(ol.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let s=e.tokenizers.find(r=>r.from==n);return s?s.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,s)=>{let r=e.specializers.find(l=>l.from==n.external);if(!r)return n;let o=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[s]=cf(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(n[o]=!0)}let s=null;for(let r=0;rn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}const SS=ip({String:X.string,Number:X.number,"True False":X.bool,PropertyName:X.propertyName,Null:X.null,",":X.separator,"[ ]":X.squareBracket,"{ }":X.brace}),CS=ol.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[SS],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),AS=Uo.define({name:"json",parser:CS.configure({props:[cp.add({Object:Dh({except:/^\s*\}/}),Array:Dh({except:/^\s*\]/})}),hp.add({"Object Array":Ov})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function TS(){return new yv(AS)}const MS={class:"h-full"},DS=Gt({__name:"CodeEditor",props:{value:{type:[Object,String]},mode:{type:String,default:Ds.JSON,validator(i){return Object.values(Ds).includes(i)}},autoFormat:{type:Boolean,default:!0}},emits:["change","update:value","format-error"],setup(i,{emit:e}){const t=i,n=ze("");Cg(()=>{n.value=t.value});const s=e,o=mf().getDarkMode;let l=[];switch(o==="dark"?l.push(uS):l.push(lS),t.mode){case Ds.YAML:{l.push(bc.define(dS));break}case Ds.JSON:l.push(TS())}function a(c){t.mode==Ds.JSON&&(c=c.replace(/(\r\n|\n|\r)/gm,"")),s("update:value",c),s("change",c)}return(c,u)=>(it(),dn("div",MS,[rt(G(sS),{"model-value":n.value,"onUpdate:modelValue":u[0]||(u[0]=h=>n.value=h),onChange:a,extensions:G(l),autofocus:!0,"indent-with-tab":!0,"tab-size":2},null,8,["model-value","extensions"])]))}}),OS=gf(DS);(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),t=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=L=>re=>re.options.get(L),s=L=>{const re=L.options.register;re("allow_html_in_named_anchor",{processor:"boolean",default:!1})},r=n("allow_html_in_named_anchor"),o="a:not([href])",l=L=>!L,a=L=>L.getAttribute("id")||L.getAttribute("name")||"",c=L=>L.nodeName.toLowerCase()==="a",u=L=>c(L)&&!L.getAttribute("href")&&a(L)!=="",h=L=>u(L)&&!L.firstChild,f=L=>{const re=L.dom;e(re).walk(L.selection.getRng(),N=>{t.each(N,Q=>{h(Q)&&re.remove(Q,!1)})})},d=L=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(L),p=L=>L.dom.getParent(L.selection.getStart(),o),y=L=>{const re=p(L);return re?a(re):""},b=(L,re)=>{L.undoManager.transact(()=>{r(L)||L.selection.collapse(!0),L.selection.isCollapsed()?L.insertContent(L.dom.createHTML("a",{id:re})):(f(L),L.formatter.remove("namedAnchor",void 0,void 0,!0),L.formatter.apply("namedAnchor",{value:re}),L.addVisual())})},m=(L,re,N)=>{N.removeAttribute("name"),N.id=re,L.addVisual(),L.undoManager.add()},A=(L,re)=>{const N=p(L);N?m(L,re,N):b(L,re),L.focus()},v=(L,re)=>d(re)?(A(L,re),!0):(L.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1),F=L=>{const re=y(L);L.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:re},onSubmit:N=>{v(L,N.getData().id)&&N.close()}})},D=L=>{L.addCommand("mceAnchor",()=>{F(L)})},E=L=>l(L.attr("href"))&&!l(L.attr("id")||L.attr("name")),P=L=>E(L)&&!L.firstChild,T=L=>re=>{for(let N=0;N{L.on("PreInit",()=>{L.parser.addNodeFilter("a",T("false")),L.serializer.addNodeFilter("a",T(null))})},V=L=>{L.formatter.register("namedAnchor",{inline:"a",selector:o,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(re,N,Q)=>u(re)})},H=L=>re=>{const N=()=>{re.setEnabled(L.selection.isEditable())};return L.on("NodeChange",N),N(),()=>{L.off("NodeChange",N)}},te=L=>{const re=()=>L.execCommand("mceAnchor");L.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:re,onSetup:N=>{const Q=L.selection.selectorChangedWithUnbind("a:not([href])",N.setActive).unbind,$=H(L)(N);return()=>{Q(),$()}}}),L.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:re,onSetup:H(L)})};var ue=()=>{i.add("anchor",L=>{s(L),M(L),D(L),te(L),L.on("PreInit",()=>{V(L)})})};ue()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=($,ie,le)=>{var _;return le($,ie.prototype)?!0:((_=$.constructor)===null||_===void 0?void 0:_.name)===ie.name},t=$=>{const ie=typeof $;return $===null?"null":ie==="object"&&Array.isArray($)?"array":ie==="object"&&e($,String,(le,_)=>_.isPrototypeOf(le))?"string":ie},n=$=>ie=>t(ie)===$,s=$=>ie=>$===ie,r=n("string"),o=s(void 0);var l=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),c=tinymce.util.Tools.resolve("tinymce.util.Tools");const u=$=>$.dispatch("RestoreDraft"),h=$=>$.dispatch("StoreDraft"),f=$=>$.dispatch("RemoveDraft"),d=$=>{const ie={s:1e3,m:6e4},le=/^(\d+)([ms]?)$/.exec($);return(le&&le[2]?ie[le[2]]:1)*parseInt($,10)},p=$=>ie=>ie.options.get($),y=$=>{const ie=$.options.register,le=_=>{const Y=r(_);return Y?{value:d(_),valid:Y}:{valid:!1,message:"Must be a string."}};ie("autosave_ask_before_unload",{processor:"boolean",default:!0}),ie("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),ie("autosave_restore_when_empty",{processor:"boolean",default:!1}),ie("autosave_interval",{processor:le,default:"30s"}),ie("autosave_retention",{processor:le,default:"20m"})},b=p("autosave_ask_before_unload"),m=p("autosave_restore_when_empty"),A=p("autosave_interval"),v=p("autosave_retention"),F=$=>{const ie=document.location;return $.options.get("autosave_prefix").replace(/{path}/g,ie.pathname).replace(/{query}/g,ie.search).replace(/{hash}/g,ie.hash).replace(/{id}/g,$.id)},D=($,ie)=>{if(o(ie))return $.dom.isEmpty($.getBody());{const le=c.trim(ie);if(le==="")return!0;{const _=new DOMParser().parseFromString(le,"text/html");return $.dom.isEmpty(_)}}},E=$=>{var ie;const le=parseInt((ie=a.getItem(F($)+"time"))!==null&&ie!==void 0?ie:"0",10)||0;return new Date().getTime()-le>v($)?(P($,!1),!1):!0},P=($,ie)=>{const le=F($);a.removeItem(le+"draft"),a.removeItem(le+"time"),ie!==!1&&f($)},T=$=>{const ie=F($);!D($)&&$.isDirty()&&(a.setItem(ie+"draft",$.getContent({format:"raw",no_events:!0})),a.setItem(ie+"time",new Date().getTime().toString()),h($))},M=$=>{var ie;const le=F($);E($)&&($.setContent((ie=a.getItem(le+"draft"))!==null&&ie!==void 0?ie:"",{format:"raw"}),u($))},V=$=>{const ie=A($);l.setEditorInterval($,()=>{T($)},ie)},H=$=>{$.undoManager.transact(()=>{M($),P($)}),$.focus()},te=$=>({hasDraft:()=>E($),storeDraft:()=>T($),restoreDraft:()=>M($),removeDraft:ie=>P($,ie),isEmpty:ie=>D($,ie)});var ue=tinymce.util.Tools.resolve("tinymce.EditorManager");const L=$=>{$.editorManager.on("BeforeUnload",ie=>{let le;c.each(ue.get(),_=>{_.plugins.autosave&&_.plugins.autosave.storeDraft(),!le&&_.isDirty()&&b(_)&&(le=_.translate("You have unsaved changes are you sure you want to navigate away?"))}),le&&(ie.preventDefault(),ie.returnValue=le)})},re=$=>ie=>{ie.setEnabled(E($));const le=()=>ie.setEnabled(E($));return $.on("StoreDraft RestoreDraft RemoveDraft",le),()=>$.off("StoreDraft RestoreDraft RemoveDraft",le)},N=$=>{V($);const ie=()=>{H($)};$.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:ie,onSetup:re($)}),$.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:ie,onSetup:re($)})};var Q=()=>{i.add("autosave",$=>(y($),L($),N($),$.on("init",()=>{m($)&&$.dom.isEmpty($.getBody())&&M($)}),te($)))};Q()})();(function(){const i=v=>{let F=v;return{get:()=>F,set:P=>{F=P}}};var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=v=>()=>v;var n=tinymce.util.Tools.resolve("tinymce.Env");const s=v=>v.dispatch("ResizeEditor"),r=v=>F=>F.options.get(v),o=v=>{const F=v.options.register;F("autoresize_overflow_padding",{processor:"number",default:1}),F("autoresize_bottom_margin",{processor:"number",default:50})},l=r("min_height"),a=r("max_height"),c=r("autoresize_overflow_padding"),u=r("autoresize_bottom_margin"),h=v=>v.plugins.fullscreen&&v.plugins.fullscreen.isFullscreen(),f=(v,F)=>{const D=v.getBody();D&&(D.style.overflowY=F?"":"hidden",F||(D.scrollTop=0))},d=(v,F,D,E)=>{var P;const T=parseInt((P=v.getStyle(F,D,E))!==null&&P!==void 0?P:"",10);return isNaN(T)?0:T},p=v=>{if((v==null?void 0:v.type.toLowerCase())==="setcontent"){const F=v;return F.selection===!0||F.paste===!0}else return!1},y=(v,F,D,E)=>{var P;const T=v.dom,M=v.getDoc();if(!M)return;if(h(v)){f(v,!0);return}const V=M.documentElement,H=E?E():c(v),te=(P=l(v))!==null&&P!==void 0?P:v.getElement().offsetHeight;let ue=te;const L=d(T,V,"margin-top",!0),re=d(T,V,"margin-bottom",!0);let N=V.offsetHeight+L+re+H;N<0&&(N=0);const Q=v.getContainer().offsetHeight,$=v.getContentAreaContainer().offsetHeight,ie=Q-$;N+ie>te&&(ue=N+ie);const le=a(v);if(le&&ue>le?(ue=le,f(v,!0)):f(v,!1),ue!==F.get()){const _=ue-F.get();if(T.setStyle(v.getContainer(),"height",ue+"px"),F.set(ue),s(v),n.browser.isSafari()&&(n.os.isMacOS()||n.os.isiOS())){const Y=v.getWin();Y.scrollTo(Y.pageXOffset,Y.pageYOffset)}v.hasFocus()&&p(D)&&v.selection.scrollIntoView(),(n.browser.isSafari()||n.browser.isChromium())&&_<0&&y(v,F,D,E)}},b=(v,F)=>{let D=()=>u(v),E,P;v.on("init",T=>{E=0;const M=c(v),V=v.dom;V.setStyles(v.getDoc().documentElement,{height:"auto"}),n.browser.isEdge()||n.browser.isIE()?V.setStyles(v.getBody(),{paddingLeft:M,paddingRight:M,"min-height":0}):V.setStyles(v.getBody(),{paddingLeft:M,paddingRight:M}),y(v,F,T,D),E+=1}),v.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",T=>{if(E===1)P=v.getContainer().offsetHeight,y(v,F,T,D),E+=1;else if(E===2){const M=P{v.addCommand("mceAutoResize",()=>{y(v,F)})};var A=()=>{e.add("autoresize",v=>{if(o(v),v.options.isSet("resize")||v.options.set("resize",!1),!v.inline){const F=i(0);m(v,F),b(v,F)}})};A()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(l,a)=>{l.focus(),l.undoManager.transact(()=>{l.setContent(a)}),l.selection.setCursorLocation(),l.nodeChanged()},t=l=>l.getContent({source_view:!0}),n=l=>{const a=t(l);l.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:a},onSubmit:c=>{e(l,c.getData().code),c.close()}})},s=l=>{l.addCommand("mceCodeEditor",()=>{n(l)})},r=l=>{const a=()=>l.execCommand("mceCodeEditor");l.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:a}),l.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:a})};var o=()=>{i.add("code",l=>(s(l),r(l),{}))};o()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=N=>N==null,t=N=>!e(N),n=()=>{},s=N=>()=>N;class r{constructor(Q,$){this.tag=Q,this.value=$}static some(Q){return new r(!0,Q)}static none(){return r.singletonNone}fold(Q,$){return this.tag?$(this.value):Q()}isSome(){return this.tag}isNone(){return!this.tag}map(Q){return this.tag?r.some(Q(this.value)):r.none()}bind(Q){return this.tag?Q(this.value):r.none()}exists(Q){return this.tag&&Q(this.value)}forall(Q){return!this.tag||Q(this.value)}filter(Q){return!this.tag||Q(this.value)?this:r.none()}getOr(Q){return this.tag?this.value:Q}or(Q){return this.tag?this:Q}getOrThunk(Q){return this.tag?this.value:Q()}orThunk(Q){return this.tag?this:Q()}getOrDie(Q){if(this.tag)return this.value;throw new Error(Q!=null?Q:"Called getOrDie on None")}static from(Q){return t(Q)?r.some(Q):r.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Q){this.tag&&Q(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}r.singletonNone=new r(!1);const o=(N,Q)=>Q>=0&&Qo(N,0);var a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils");const c=typeof window!="undefined"?window:Function("return this;")(),u=function(N,Q,$){const ie=window.Prism;window.Prism={manual:!0};var le=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope?self:{},_=function(Y){var ye=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,we=0,Le={},ve={manual:Y.Prism&&Y.Prism.manual,disableWorkerMessageHandler:Y.Prism&&Y.Prism.disableWorkerMessageHandler,util:{encode:function j(ee){return ee instanceof qe?new qe(ee.type,j(ee.content),ee.alias):Array.isArray(ee)?ee.map(j):ee.replace(/&/g,"&").replace(/"+fe.content+""};function st(j,ee,ae,he){j.lastIndex=ee;var fe=j.exec(ae);if(fe&&he&&fe[1]){var O=fe[1].length;fe.index+=O,fe[0]=fe[0].slice(O)}return fe}function Je(j,ee,ae,he,fe,O){for(var I in ae)if(!(!ae.hasOwnProperty(I)||!ae[I])){var Z=ae[I];Z=Array.isArray(Z)?Z:[Z];for(var xe=0;xe=O.reach);ke+=ne.value.length,ne=ne.next){var Ie=ne.value;if(ee.length>j.length)return;if(!(Ie instanceof qe)){var et=1,We;if(kt){if(We=st(se,ke,j,bt),!We||We.index>=j.length)break;var Wt=We.index,lt=We.index+We[0].length,wt=ke;for(wt+=ne.value.length;Wt>=wt;)ne=ne.next,wt+=ne.value.length;if(wt-=ne.value.length,ke=wt,ne.value instanceof qe)continue;for(var ut=ne;ut!==ee.tail&&(wtO.reach&&(O.reach=on);var On=ne.prev;Dn&&(On=Xe(ee,On,Dn),ke+=Dn.length),Lt(ee,On,et);var ei=new qe(I,He?ve.tokenize(Jt,He):Jt,Nt,Jt);if(ne=Xe(ee,On,ei),Zn&&Xe(ee,ne,Zn),et>1){var Ln={cause:I+","+xe,reach:on};Je(j,ee,ae,ne.prev,ke,Ln),O&&Ln.reach>O.reach&&(O.reach=Ln.reach)}}}}}}function pt(){var j={value:null,prev:null,next:null},ee={value:null,prev:j,next:null};j.next=ee,this.head=j,this.tail=ee,this.length=0}function Xe(j,ee,ae){var he=ee.next,fe={value:ae,prev:ee,next:he};return ee.next=fe,he.prev=fe,j.length++,fe}function Lt(j,ee,ae){for(var he=ee.next,fe=0;fe]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},function(Y){function ye(we,Le){return"___"+we.toUpperCase()+Le+"___"}Object.defineProperties(Y.languages["markup-templating"]={},{buildPlaceholders:{value:function(we,Le,ve,qe){if(we.language===Le){var st=we.tokenStack=[];we.code=we.code.replace(ve,function(Je){if(typeof qe=="function"&&!qe(Je))return Je;for(var pt=st.length,Xe;we.code.indexOf(Xe=ye(Le,pt))!==-1;)++pt;return st[pt]=Je,Xe}),we.grammar=Y.languages.markup}}},tokenizePlaceholders:{value:function(we,Le){if(we.language!==Le||!we.tokenStack)return;we.grammar=Y.languages[Le];var ve=0,qe=Object.keys(we.tokenStack);function st(Je){for(var pt=0;pt=qe.length);pt++){var Xe=Je[pt];if(typeof Xe=="string"||Xe.content&&typeof Xe.content=="string"){var Lt=qe[ve],Mt=we.tokenStack[Lt],oe=typeof Xe=="string"?Xe:Xe.content,be=ye(Le,Lt),de=oe.indexOf(be);if(de>-1){++ve;var j=oe.substring(0,de),ee=new Y.Token(Le,Y.tokenize(Mt,we.grammar),"language-"+Le,Mt),ae=oe.substring(de+be.length),he=[];j&&he.push.apply(he,st([j])),he.push(ee),ae&&he.push.apply(he,st([ae])),typeof Xe=="string"?Je.splice.apply(Je,[pt,1].concat(he)):Xe.content=he}}else Xe.content&&st(Xe.content)}return Je}st(we.tokens)}}})}(_),_.languages.c=_.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),_.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),_.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},_.languages.c.string],char:_.languages.c.char,comment:_.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:_.languages.c}}}}),_.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete _.languages.c.boolean,function(Y){var ye=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,we=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return ye.source});Y.languages.cpp=Y.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return ye.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:ye,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),Y.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return we})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),Y.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:Y.languages.cpp}}}}),Y.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),Y.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:Y.languages.extend("cpp",{})}}),Y.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},Y.languages.cpp["base-clause"])}(_),function(Y){function ye(We,lt){return We.replace(/<<(\d+)>>/g,function(wt,ut){return"(?:"+lt[+ut]+")"})}function we(We,lt,wt){return RegExp(ye(We,lt),"")}function Le(We,lt){for(var wt=0;wt>/g,function(){return"(?:"+We+")"});return We.replace(/<>/g,"[^\\s\\S]")}var ve={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function qe(We){return"\\b(?:"+We.trim().replace(/ /g,"|")+")\\b"}var st=qe(ve.typeDeclaration),Je=RegExp(qe(ve.type+" "+ve.typeDeclaration+" "+ve.contextual+" "+ve.other)),pt=qe(ve.typeDeclaration+" "+ve.contextual+" "+ve.other),Xe=qe(ve.type+" "+ve.typeDeclaration+" "+ve.other),Lt=Le(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),Mt=Le(/\((?:[^()]|<>)*\)/.source,2),oe=/@?\b[A-Za-z_]\w*\b/.source,be=ye(/<<0>>(?:\s*<<1>>)?/.source,[oe,Lt]),de=ye(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[pt,be]),j=/\[\s*(?:,\s*)*\]/.source,ee=ye(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[de,j]),ae=ye(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[Lt,Mt,j]),he=ye(/\(<<0>>+(?:,<<0>>+)+\)/.source,[ae]),fe=ye(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[he,de,j]),O={keyword:Je,punctuation:/[<>()?,.:[\]]/},I=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,Z=/"(?:\\.|[^\\"\r\n])*"/.source,xe=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;Y.languages.csharp=Y.languages.extend("clike",{string:[{pattern:we(/(^|[^$\\])<<0>>/.source,[xe]),lookbehind:!0,greedy:!0},{pattern:we(/(^|[^@$\\])<<0>>/.source,[Z]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:we(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[de]),lookbehind:!0,inside:O},{pattern:we(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[oe,fe]),lookbehind:!0,inside:O},{pattern:we(/(\busing\s+)<<0>>(?=\s*=)/.source,[oe]),lookbehind:!0},{pattern:we(/(\b<<0>>\s+)<<1>>/.source,[st,be]),lookbehind:!0,inside:O},{pattern:we(/(\bcatch\s*\(\s*)<<0>>/.source,[de]),lookbehind:!0,inside:O},{pattern:we(/(\bwhere\s+)<<0>>/.source,[oe]),lookbehind:!0},{pattern:we(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[ee]),lookbehind:!0,inside:O},{pattern:we(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[fe,Xe,oe]),inside:O}],keyword:Je,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),Y.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),Y.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:we(/([(,]\s*)<<0>>(?=\s*:)/.source,[oe]),lookbehind:!0,alias:"punctuation"}}),Y.languages.insertBefore("csharp","class-name",{namespace:{pattern:we(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[oe]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:we(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[Mt]),lookbehind:!0,alias:"class-name",inside:O},"return-type":{pattern:we(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[fe,de]),inside:O,alias:"class-name"},"constructor-invocation":{pattern:we(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[fe]),lookbehind:!0,inside:O,alias:"class-name"},"generic-method":{pattern:we(/<<0>>\s*<<1>>(?=\s*\()/.source,[oe,Lt]),inside:{function:we(/^<<0>>/.source,[oe]),generic:{pattern:RegExp(Lt),alias:"class-name",inside:O}}},"type-list":{pattern:we(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[st,be,oe,fe,Je.source,Mt,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:we(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[be,Mt]),lookbehind:!0,greedy:!0,inside:Y.languages.csharp},keyword:Je,"class-name":{pattern:RegExp(fe),greedy:!0,inside:O},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var $e=Z+"|"+I,He=ye(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[$e]),bt=Le(ye(/[^"'/()]|<<0>>|\(<>*\)/.source,[He]),2),kt=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,Nt=ye(/<<0>>(?:\s*\(<<1>>*\))?/.source,[de,bt]);Y.languages.insertBefore("csharp","class-name",{attribute:{pattern:we(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[kt,Nt]),lookbehind:!0,greedy:!0,inside:{target:{pattern:we(/^<<0>>(?=\s*:)/.source,[kt]),alias:"keyword"},"attribute-arguments":{pattern:we(/\(<<0>>*\)/.source,[bt]),inside:Y.languages.csharp},"class-name":{pattern:RegExp(de),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var q=/:[^}\r\n]+/.source,se=Le(ye(/[^"'/()]|<<0>>|\(<>*\)/.source,[He]),2),ne=ye(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[se,q]),ke=Le(ye(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[$e]),2),Ie=ye(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[ke,q]);function et(We,lt){return{interpolation:{pattern:we(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[We]),lookbehind:!0,inside:{"format-string":{pattern:we(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[lt,q]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:Y.languages.csharp}}},string:/[\s\S]+/}}Y.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:we(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[ne]),lookbehind:!0,greedy:!0,inside:et(ne,se)},{pattern:we(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[Ie]),lookbehind:!0,greedy:!0,inside:et(Ie,ke)}],char:{pattern:RegExp(I),greedy:!0}}),Y.languages.dotnet=Y.languages.cs=Y.languages.csharp}(_),function(Y){var ye=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;Y.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+ye.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+ye.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+ye.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+ye.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:ye,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},Y.languages.css.atrule.inside.rest=Y.languages.css;var we=Y.languages.markup;we&&(we.tag.addInlined("style","css"),we.tag.addAttribute("style","css"))}(_),function(Y){var ye=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,we=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,Le={pattern:RegExp(/(^|[^\w.])/.source+we+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};Y.languages.java=Y.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[Le,{pattern:RegExp(/(^|[^\w.])/.source+we+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:Le.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+we+/[A-Z]\w*\b/.source),lookbehind:!0,inside:Le.inside}],keyword:ye,function:[Y.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),Y.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),Y.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":Le,keyword:ye,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+we+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:Le.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+we+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:Le.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return ye.source})),lookbehind:!0,inside:{punctuation:/\./}}})}(_),_.languages.javascript=_.languages.extend("clike",{"class-name":[_.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),_.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,_.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:_.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:_.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:_.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:_.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:_.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),_.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:_.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),_.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),_.languages.markup&&(_.languages.markup.tag.addInlined("script","javascript"),_.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),_.languages.js=_.languages.javascript,_.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},_.languages.markup.tag.inside["attr-value"].inside.entity=_.languages.markup.entity,_.languages.markup.doctype.inside["internal-subset"].inside=_.languages.markup,_.hooks.add("wrap",function(Y){Y.type==="entity"&&(Y.attributes.title=Y.content.replace(/&/,"&"))}),Object.defineProperty(_.languages.markup.tag,"addInlined",{value:function(ye,we){var Le={};Le["language-"+we]={pattern:/(^$)/i,lookbehind:!0,inside:_.languages[we]},Le.cdata=/^$/i;var ve={"included-cdata":{pattern://i,inside:Le}};ve["language-"+we]={pattern:/[\s\S]+/,inside:_.languages[we]};var qe={};qe[ye]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return ye}),"i"),lookbehind:!0,greedy:!0,inside:ve},_.languages.insertBefore("markup","cdata",qe)}}),Object.defineProperty(_.languages.markup.tag,"addAttribute",{value:function(Y,ye){_.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+Y+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[ye,"language-"+ye],inside:_.languages[ye]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),_.languages.html=_.languages.markup,_.languages.mathml=_.languages.markup,_.languages.svg=_.languages.markup,_.languages.xml=_.languages.extend("markup",{}),_.languages.ssml=_.languages.xml,_.languages.atom=_.languages.xml,_.languages.rss=_.languages.xml,function(Y){var ye=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,we=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],Le=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,ve=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,qe=/[{}\[\](),:;]/;Y.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:ye,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:we,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:Le,operator:ve,punctuation:qe};var st={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:Y.languages.php},Je=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:st}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:st}}];Y.languages.insertBefore("php","variable",{string:Je,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:ye,string:Je,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:we,number:Le,operator:ve,punctuation:qe}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),Y.hooks.add("before-tokenize",function(pt){if(/<\?/.test(pt.code)){var Xe=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;Y.languages["markup-templating"].buildPlaceholders(pt,"php",Xe)}}),Y.hooks.add("after-tokenize",function(pt){Y.languages["markup-templating"].tokenizePlaceholders(pt,"php")})}(_),_.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},_.languages.python["string-interpolation"].inside.interpolation.inside.rest=_.languages.python,_.languages.py=_.languages.python,function(Y){Y.languages.ruby=Y.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),Y.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var ye={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:Y.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete Y.languages.ruby.function;var we="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",Le=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;Y.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+we+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:ye,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:ye,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+Le),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+Le+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),Y.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+we),greedy:!0,inside:{interpolation:ye,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:ye,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:ye,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+we),greedy:!0,inside:{interpolation:ye,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:ye,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete Y.languages.ruby.string,Y.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),Y.languages.rb=Y.languages.ruby}(_),window.Prism=ie,_}(),h=N=>Q=>Q.options.get(N),f=N=>{const Q=N.options.register;Q("codesample_languages",{processor:"object[]"}),Q("codesample_global_prismjs",{processor:"boolean",default:!1})},d=h("codesample_languages"),p=h("codesample_global_prismjs"),y=N=>c.Prism&&p(N)?c.Prism:u,b=N=>t(N)&&N.nodeName==="PRE"&&N.className.indexOf("language-")!==-1,m=N=>{const Q=N.selection?N.selection.getNode():null;return b(Q)?r.some(Q):r.none()},A=(N,Q,$)=>{const ie=N.dom;N.undoManager.transact(()=>{const le=m(N);return $=a.DOM.encode($),le.fold(()=>{N.insertContent('
'+$+"
");const _=ie.select("#__new")[0];ie.setAttrib(_,"id",null),N.selection.select(_)},_=>{ie.setAttrib(_,"class","language-"+Q),_.innerHTML=$,y(N).highlightElement(_),N.selection.select(_)})})},v=N=>m(N).bind($=>r.from($.textContent)).getOr(""),F=N=>{const Q=[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}],$=d(N);return $||Q},D=(N,Q)=>m(N).fold(()=>Q,ie=>{const le=ie.className.match(/language-(\w+)/);return le?le[1]:Q}),E=N=>{const Q=F(N),$=l(Q).fold(s(""),_=>_.value),ie=D(N,$),le=v(N);N.windowManager.open({title:"Insert/Edit Code Sample",size:"large",body:{type:"panel",items:[{type:"listbox",name:"language",label:"Language",items:Q},{type:"textarea",name:"code",label:"Code view"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{language:ie,code:le},onSubmit:_=>{const Y=_.getData();A(N,Y.language,Y.code),_.close()}})},P=N=>{N.addCommand("codesample",()=>{const Q=N.selection.getNode();N.selection.isCollapsed()||b(Q)?E(N):N.formatter.toggle("code")})},M=(N=>Q=>Q.replace(N,""))(/^\s+|\s+$/g);var V=tinymce.util.Tools.resolve("tinymce.util.Tools");const H=N=>{N.on("PreProcess",Q=>{const $=N.dom,ie=$.select("pre[contenteditable=false]",Q.node);V.each(V.grep(ie,b),le=>{const _=le.textContent;$.setAttrib(le,"class",M($.getAttrib(le,"class"))),$.setAttrib(le,"contentEditable",null),$.setAttrib(le,"data-mce-highlighted",null);let Y;for(;Y=le.firstChild;)le.removeChild(Y);const ye=$.add(le,"code");ye.textContent=_})}),N.on("SetContent",()=>{const Q=N.dom,$=V.grep(Q.select("pre"),ie=>b(ie)&&Q.getAttrib(ie,"data-mce-highlighted")!=="true");$.length&&N.undoManager.transact(()=>{V.each($,ie=>{var le;V.each(Q.select("br",ie),_=>{Q.replace(N.getDoc().createTextNode(` `),_)}),ie.innerHTML=Q.encode((le=ie.textContent)!==null&&le!==void 0?le:""),y(N).highlightElement(ie),Q.setAttrib(ie,"data-mce-highlighted",!0),ie.className=M(ie.className)})})}),N.on("PreInit",()=>{N.parser.addNodeFilter("pre",Q=>{var $;for(let ie=0,le=Q.length;ie$=>{const ie=()=>{$.setEnabled(N.selection.isEditable()),Q($)};return N.on("NodeChange",ie),ie(),()=>{N.off("NodeChange",ie)}},ue=N=>{const Q=N.selection.getStart();return N.dom.is(Q,'pre[class*="language-"]')},L=N=>{const Q=()=>N.execCommand("codesample");N.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:Q,onSetup:te(N,$=>{$.setActive(ue(N))})}),N.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:Q,onSetup:te(N)})};var re=()=>{i.add("codesample",N=>{f(N),H(N),L(N),P(N),N.on("dblclick",Q=>{b(Q.target)&&E(N)})})};re()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(q,se,ne)=>{var ke;return ne(q,se.prototype)?!0:((ke=q.constructor)===null||ke===void 0?void 0:ke.name)===se.name},t=q=>{const se=typeof q;return q===null?"null":se==="object"&&Array.isArray(q)?"array":se==="object"&&e(q,String,(ne,ke)=>ke.isPrototypeOf(ne))?"string":se},n=q=>se=>t(se)===q,s=q=>se=>typeof se===q,r=n("string"),o=s("boolean"),l=q=>q==null,a=q=>!l(q),c=s("function"),u=s("number"),h=(q,se)=>ne=>q(se(ne)),d=(q=>()=>q)(!1);class p{constructor(se,ne){this.tag=se,this.value=ne}static some(se){return new p(!0,se)}static none(){return p.singletonNone}fold(se,ne){return this.tag?ne(this.value):se()}isSome(){return this.tag}isNone(){return!this.tag}map(se){return this.tag?p.some(se(this.value)):p.none()}bind(se){return this.tag?se(this.value):p.none()}exists(se){return this.tag&&se(this.value)}forall(se){return!this.tag||se(this.value)}filter(se){return!this.tag||se(this.value)?this:p.none()}getOr(se){return this.tag?this.value:se}or(se){return this.tag?this:se}getOrThunk(se){return this.tag?this.value:se()}orThunk(se){return this.tag?this:se()}getOrDie(se){if(this.tag)return this.value;throw new Error(se!=null?se:"Called getOrDie on None")}static from(se){return a(se)?p.some(se):p.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(se){this.tag&&se(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}p.singletonNone=new p(!1);const y=(q,se)=>{const ne=q.length,ke=new Array(ne);for(let Ie=0;Ie{for(let ne=0,ke=q.length;ne{const ne=[];for(let ke=0,Ie=q.length;ke{const ke=(se||document).createElement("div");if(ke.innerHTML=q,!ke.hasChildNodes()||ke.childNodes.length>1){const Ie="HTML does not have a single root node";throw new Error(Ie)}return M(ke.childNodes[0])},P=(q,se)=>{const ke=(se||document).createElement(q);return M(ke)},T=(q,se)=>{const ke=(se||document).createTextNode(q);return M(ke)},M=q=>{if(q==null)throw new Error("Node cannot be null or undefined");return{dom:q}},H={fromHtml:E,fromTag:P,fromText:T,fromDom:M,fromPoint:(q,se,ne)=>p.from(q.dom.elementFromPoint(se,ne)).map(M)},te=(q,se)=>{const ne=q.dom;if(ne.nodeType!==F)return!1;{const ke=ne;if(ke.matches!==void 0)return ke.matches(se);if(ke.msMatchesSelector!==void 0)return ke.msMatchesSelector(se);if(ke.webkitMatchesSelector!==void 0)return ke.webkitMatchesSelector(se);if(ke.mozMatchesSelector!==void 0)return ke.mozMatchesSelector(se);throw new Error("Browser lacks native selectors")}};typeof window!="undefined"||Function("return this;")();const ue=q=>q.dom.nodeName.toLowerCase(),L=q=>q.dom.nodeType,re=q=>se=>L(se)===q,N=re(F),Q=re(D),$=re(A),ie=re(v),le=q=>se=>N(se)&&ue(se)===q,_=q=>H.fromDom(q.dom.ownerDocument),Y=q=>$(q)?q:_(q),ye=q=>p.from(q.dom.parentNode).map(H.fromDom),we=q=>y(q.dom.childNodes,H.fromDom),Le=(q,se,ne)=>{if(r(ne)||o(ne)||u(ne))q.setAttribute(se,ne+"");else throw new Error("Attribute value was not simple")},ve=(q,se,ne)=>{Le(q.dom,se,ne)},qe=(q,se)=>{q.dom.removeAttribute(se)},st=q=>ie(q)&&a(q.dom.host),pt=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?q=>H.fromDom(q.dom.getRootNode()):Y,Xe=q=>{const se=pt(q);return st(se)?p.some(se):p.none()},Lt=q=>H.fromDom(q.dom.host),Mt=q=>{const se=Q(q)?q.dom.parentNode:q.dom;if(se==null||se.ownerDocument===null)return!1;const ne=se.ownerDocument;return Xe(H.fromDom(se)).fold(()=>ne.body.contains(se),h(Mt,Lt))},oe=(q,se,ne)=>{let ke=q.dom;const Ie=c(ne)?ne:d;for(;ke.parentNode;){ke=ke.parentNode;const et=H.fromDom(ke);if(se(et))return p.some(et);if(Ie(et))break}return p.none()},be=(q,se,ne)=>oe(q,ke=>te(ke,se),ne),de=q=>q.style!==void 0&&c(q.style.getPropertyValue),j=(q,se)=>{const ne=q.dom,Ie=window.getComputedStyle(ne).getPropertyValue(se);return Ie===""&&!Mt(q)?ee(ne,se):Ie},ee=(q,se)=>de(q)?q.style.getPropertyValue(se):"",ae=q=>j(q,"direction")==="rtl"?"rtl":"ltr",he=(q,se)=>m(we(q),se),fe=(q,se)=>he(q,ne=>te(ne,se)),O=q=>ye(q).filter(N),I=(q,se)=>(se?be(q,"ol,ul"):p.some(q)).getOr(q),Z=le("li"),xe=(q,se,ne)=>{b(se,ke=>{const Ie=H.fromDom(ke),et=Z(Ie),We=I(Ie,et);O(We).each(wt=>{if(q.setStyle(We.dom,"direction",null),ae(wt)===ne?qe(We,"dir"):ve(We,"dir",ne),ae(We)!==ne&&q.setStyle(We.dom,"direction",ne),et){const Wt=fe(We,"li[dir],li[style]");b(Wt,Jt=>{qe(Jt,"dir"),q.setStyle(Jt.dom,"direction",null)})}})})},$e=(q,se)=>{q.selection.isEditable()&&(xe(q.dom,q.selection.getSelectedBlocks(),se),q.nodeChanged())},He=q=>{q.addCommand("mceDirectionLTR",()=>{$e(q,"ltr")}),q.addCommand("mceDirectionRTL",()=>{$e(q,"rtl")})},bt=(q,se)=>ne=>{const ke=Ie=>{const et=H.fromDom(Ie.element);ne.setActive(ae(et)===se),ne.setEnabled(q.selection.isEditable())};return q.on("NodeChange",ke),ne.setEnabled(q.selection.isEditable()),()=>q.off("NodeChange",ke)},kt=q=>{q.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>q.execCommand("mceDirectionLTR"),onSetup:bt(q,"ltr")}),q.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>q.execCommand("mceDirectionRTL"),onSetup:bt(q,"rtl")})};var Nt=()=>{i.add("directionality",q=>{He(q),kt(q)})};Nt()})();(function(){const i=g=>{let w=g;return{get:()=>w,set:Ae=>{w=Ae}}};var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=g=>({isFullscreen:()=>g.get()!==null}),n=(g,w,R)=>{var K;return R(g,w.prototype)?!0:((K=g.constructor)===null||K===void 0?void 0:K.name)===w.name},s=g=>{const w=typeof g;return g===null?"null":w==="object"&&Array.isArray(g)?"array":w==="object"&&n(g,String,(R,K)=>K.isPrototypeOf(R))?"string":w},r=g=>w=>s(w)===g,o=g=>w=>typeof w===g,l=g=>w=>g===w,a=r("string"),c=r("object"),u=r("array"),h=l(null),f=o("boolean"),d=l(void 0),p=g=>g==null,y=g=>!p(g),b=o("function"),m=o("number"),A=()=>{},v=(g,w)=>(...R)=>g(w.apply(null,R)),F=(g,w)=>R=>g(w(R)),D=g=>()=>g;function E(g,...w){return(...R)=>{const K=w.concat(R);return g.apply(null,K)}}const P=D(!1),T=D(!0);class M{constructor(w,R){this.tag=w,this.value=R}static some(w){return new M(!0,w)}static none(){return M.singletonNone}fold(w,R){return this.tag?R(this.value):w()}isSome(){return this.tag}isNone(){return!this.tag}map(w){return this.tag?M.some(w(this.value)):M.none()}bind(w){return this.tag?w(this.value):M.none()}exists(w){return this.tag&&w(this.value)}forall(w){return!this.tag||w(this.value)}filter(w){return!this.tag||w(this.value)?this:M.none()}getOr(w){return this.tag?this.value:w}or(w){return this.tag?this:w}getOrThunk(w){return this.tag?this.value:w()}orThunk(w){return this.tag?this:w()}getOrDie(w){if(this.tag)return this.value;throw new Error(w!=null?w:"Called getOrDie on None")}static from(w){return y(w)?M.some(w):M.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(w){this.tag&&w(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}M.singletonNone=new M(!1);const V=Array.prototype.push,H=(g,w)=>{const R=g.length,K=new Array(R);for(let Ae=0;Ae{for(let R=0,K=g.length;R{const R=[];for(let K=0,Ae=g.length;K{for(let K=0,Ae=g.length;KL(g,w,P),N=g=>{const w=[];for(let R=0,K=g.length;RN(H(g,w)),$=(g,w)=>w>=0&&w$(g,0),le=(g,w)=>{for(let R=0;Rg.isSome()&&w.isSome()?M.some(R(g.getOrDie(),w.getOrDie())):M.none(),Y=g=>{const w=i(M.none()),R=()=>w.get().each(g);return{clear:()=>{R(),w.set(M.none())},isSet:()=>w.get().isSome(),get:()=>w.get(),set:hn=>{R(),w.set(M.some(hn))}}},ye=()=>Y(g=>g.unbind()),we=()=>{const g=Y(A),w=R=>g.get().each(R);return qt(Fe({},g),{on:w})},Le=(g,w)=>{let R=null;return{cancel:()=>{h(R)||(clearTimeout(R),R=null)},throttle:(...Ge)=>{h(R)&&(R=setTimeout(()=>{R=null,g.apply(null,Ge)},w))}}},ve=Object.keys,qe=(g,w)=>{const R=ve(g);for(let K=0,Ae=R.length;K{let R=w!=null?w:st;for(let K=0;K{const R=g.split(".");return Je(R,w)},Xe=(g,w)=>pt(g,w),Lt=(g,w)=>{const R=Xe(g,w);if(R==null)throw new Error(g+" not available on this browser");return R},Mt=Object.getPrototypeOf,oe=g=>Lt("HTMLElement",g),be=g=>{const w=pt("ownerDocument.defaultView",g);return c(g)&&(oe(w).prototype.isPrototypeOf(g)||/^HTML\w*Element$/.test(Mt(g).constructor.name))},de=9,j=11,ee=1,ae=3,he=g=>g.dom.nodeType,fe=g=>w=>he(w)===g,O=g=>I(g)&&be(g.dom),I=fe(ee),Z=fe(ae),xe=fe(de),$e=fe(j),He=(g,w,R)=>{if(a(R)||f(R)||m(R))g.setAttribute(w,R+"");else throw new Error("Attribute value was not simple")},bt=(g,w,R)=>{He(g.dom,w,R)},kt=(g,w)=>{const R=g.dom.getAttribute(w);return R===null?void 0:R},Nt=(g,w)=>{g.dom.removeAttribute(w)},q=g=>g.dom.classList!==void 0,se=(g,w)=>q(g)&&g.dom.classList.contains(w),ne=(g,w,R=0,K)=>{const Ae=g.indexOf(w,R);return Ae!==-1?d(K)?!0:Ae+w.length<=K:!1},ke=g=>g.style!==void 0&&b(g.style.getPropertyValue),Ie=(g,w)=>{const K=(w||document).createElement("div");if(K.innerHTML=g,!K.hasChildNodes()||K.childNodes.length>1){const Ae="HTML does not have a single root node";throw new Error(Ae)}return lt(K.childNodes[0])},et=(g,w)=>{const K=(w||document).createElement(g);return lt(K)},We=(g,w)=>{const K=(w||document).createTextNode(g);return lt(K)},lt=g=>{if(g==null)throw new Error("Node cannot be null or undefined");return{dom:g}},ut={fromHtml:Ie,fromTag:et,fromText:We,fromDom:lt,fromPoint:(g,w,R)=>M.from(g.dom.elementFromPoint(w,R)).map(lt)},Wt=(g,w)=>{const R=g.dom;if(R.nodeType!==ee)return!1;{const K=R;if(K.matches!==void 0)return K.matches(w);if(K.msMatchesSelector!==void 0)return K.msMatchesSelector(w);if(K.webkitMatchesSelector!==void 0)return K.webkitMatchesSelector(w);if(K.mozMatchesSelector!==void 0)return K.mozMatchesSelector(w);throw new Error("Browser lacks native selectors")}},Jt=g=>g.nodeType!==ee&&g.nodeType!==de&&g.nodeType!==j||g.childElementCount===0,Dn=(g,w)=>{const R=document;return Jt(R)?[]:H(R.querySelectorAll(g),ut.fromDom)},Zn=(g,w)=>g.dom===w.dom,on=g=>ut.fromDom(g.dom.ownerDocument),On=g=>xe(g)?g:on(g),ei=g=>M.from(g.dom.parentNode).map(ut.fromDom),Ln=(g,w)=>{const R=b(w)?w:P;let K=g.dom;const Ae=[];for(;K.parentNode!==null&&K.parentNode!==void 0;){const Ge=K.parentNode,Ot=ut.fromDom(Ge);if(Ae.push(Ot),R(Ot)===!0)break;K=Ge}return Ae},Un=g=>{const w=R=>ue(R,K=>!Zn(g,K));return ei(g).map(Ti).map(w).getOr([])},Ai=g=>M.from(g.dom.nextSibling).map(ut.fromDom),Ti=g=>H(g.dom.childNodes,ut.fromDom),ti=g=>$e(g)&&y(g.dom.host),B=b(Element.prototype.attachShadow)&&b(Node.prototype.getRootNode),z=D(B),me=B?g=>ut.fromDom(g.dom.getRootNode()):On,Oe=g=>{const w=me(g);return ti(w)?M.some(w):M.none()},Qe=g=>ut.fromDom(g.dom.host),$t=g=>{if(z()&&y(g.target)){const w=ut.fromDom(g.target);if(I(w)&&En(w)&&g.composed&&g.composedPath){const R=g.composedPath();if(R)return ie(R)}}return M.from(g.target)},En=g=>y(g.dom.shadowRoot),jt=g=>{const w=Z(g)?g.dom.parentNode:g.dom;if(w==null||w.ownerDocument===null)return!1;const R=w.ownerDocument;return Oe(ut.fromDom(w)).fold(()=>R.body.contains(w),F(jt,Qe))},ni=g=>{const w=g.dom.body;if(w==null)throw new Error("Body is not available yet");return ut.fromDom(w)},x=(g,w,R)=>{if(!a(R))throw new Error("CSS value must be a string: "+R);ke(g)&&g.style.setProperty(w,R)},S=(g,w,R)=>{const K=g.dom;x(K,w,R)},W=(g,w)=>{const R=g.dom;qe(w,(K,Ae)=>{x(R,Ae,K)})},U=(g,w)=>{const R=g.dom,Ae=window.getComputedStyle(R).getPropertyValue(w);return Ae===""&&!jt(g)?Me(R,w):Ae},Me=(g,w)=>ke(g)?g.style.getPropertyValue(w):"",Be=(g,w,R,K,Ae,Ge,Ot)=>({target:g,x:w,y:R,stop:K,prevent:Ae,kill:Ge,raw:Ot}),je=g=>{const w=ut.fromDom($t(g).getOr(g.target)),R=()=>g.stopPropagation(),K=()=>g.preventDefault(),Ae=v(K,R);return Be(w,g.clientX,g.clientY,R,K,Ae,g)},xt=(g,w)=>R=>{g(R)&&w(je(R))},Ze=(g,w,R,K,Ae)=>{const Ge=xt(R,K);return g.dom.addEventListener(w,Ge,Ae),{unbind:E(k,g,w,Ge,Ae)}},Ue=(g,w,R,K)=>Ze(g,w,R,K,!1),k=(g,w,R,K)=>{g.dom.removeEventListener(w,R,K)},C=T,J=(g,w,R)=>Ue(g,w,C,R),pe=g=>{let w=!1,R;return(...K)=>(w||(w=!0,R=g.apply(null,K)),R)},ge=(g,w,R,K)=>{const Ae=g.isiOS()&&/ipad/i.test(R)===!0,Ge=g.isiOS()&&!Ae,Ot=g.isiOS()||g.isAndroid(),hn=Ot||K("(pointer:coarse)"),Yt=Ae||!Ge&&Ot&&K("(min-device-width:768px)"),Fn=Ge||Ot&&!Yt,gi=w.isSafari()&&g.isiOS()&&/safari/i.test(R)===!1,fn=!Fn&&!Yt&&!gi;return{isiPad:D(Ae),isiPhone:D(Ge),isTablet:D(Yt),isPhone:D(Fn),isTouch:D(hn),isAndroid:g.isAndroid,isiOS:g.isiOS,isWebView:D(gi),isDesktop:D(fn)}},Ce=(g,w)=>{for(let R=0;R{const R=Ce(g,w);if(!R)return{major:0,minor:0};const K=Ae=>Number(w.replace(R,"$"+Ae));return Ke(K(1),K(2))},Se=(g,w)=>{const R=String(w).toLowerCase();return g.length===0?Ve():De(g,R)},Ve=()=>Ke(0,0),Ke=(g,w)=>({major:g,minor:w}),at={nu:Ke,detect:Se,unknown:Ve},_t=(g,w)=>le(w.brands,R=>{const K=R.brand.toLowerCase();return re(g,Ae=>{var Ge;return K===((Ge=Ae.brand)===null||Ge===void 0?void 0:Ge.toLowerCase())}).map(Ae=>({current:Ae.name,version:at.nu(parseInt(R.version,10),0)}))}),Mi=(g,w)=>{const R=String(w).toLowerCase();return re(g,K=>K.search(R))},Qi=(g,w)=>Mi(g,w).map(R=>{const K=at.detect(R.versionRegexes,w);return{current:R.name,version:K}}),Kr=(g,w)=>Mi(g,w).map(R=>{const K=at.detect(R.versionRegexes,w);return{current:R.name,version:K}}),St=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ct=g=>w=>ne(w,g),Dt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:g=>ne(g,"edge/")&&ne(g,"chrome")&&ne(g,"safari")&&ne(g,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,St],search:g=>ne(g,"chrome")&&!ne(g,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:g=>ne(g,"msie")||ne(g,"trident")},{name:"Opera",versionRegexes:[St,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ct("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ct("firefox")},{name:"Safari",versionRegexes:[St,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:g=>(ne(g,"safari")||ne(g,"mobile/"))&&ne(g,"applewebkit")}],ii=[{name:"Windows",search:ct("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:g=>ne(g,"iphone")||ne(g,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ct("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:ct("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ct("linux"),versionRegexes:[]},{name:"Solaris",search:ct("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ct("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ct("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Zi={browsers:D(Dt),oses:D(ii)},Ec="Edge",Fc="Chromium",Pc="IE",Bc="Opera",Rc="Firefox",Nc="Safari",Lm=()=>Ic({current:void 0,version:at.unknown()}),Ic=g=>{const w=g.current,R=g.version,K=Ae=>()=>w===Ae;return{current:w,version:R,isEdge:K(Ec),isChromium:K(Fc),isIE:K(Pc),isOpera:K(Bc),isFirefox:K(Rc),isSafari:K(Nc)}},Lc={unknown:Lm,nu:Ic,edge:D(Ec),chromium:D(Fc),ie:D(Pc),opera:D(Bc),firefox:D(Rc),safari:D(Nc)},$c="Windows",_c="iOS",zc="Android",Vc="Linux",Hc="macOS",Wc="Solaris",jc="FreeBSD",qc="ChromeOS",$m=()=>Uc({current:void 0,version:at.unknown()}),Uc=g=>{const w=g.current,R=g.version,K=Ae=>()=>w===Ae;return{current:w,version:R,isWindows:K($c),isiOS:K(_c),isAndroid:K(zc),isMacOS:K(Hc),isLinux:K(Vc),isSolaris:K(Wc),isFreeBSD:K(jc),isChromeOS:K(qc)}},Kc={unknown:$m,nu:Uc,windows:D($c),ios:D(_c),android:D(zc),linux:D(Vc),macos:D(Hc),solaris:D(Wc),freebsd:D(jc),chromeos:D(qc)},_m={detect:(g,w,R)=>{const K=Zi.browsers(),Ae=Zi.oses(),Ge=w.bind(Yt=>_t(K,Yt)).orThunk(()=>Qi(K,g)).fold(Lc.unknown,Lc.nu),Ot=Kr(Ae,g).fold(Kc.unknown,Kc.nu),hn=ge(Ot,Ge,g,R);return{browser:Ge,os:Ot,deviceType:hn}}},zm=g=>window.matchMedia(g).matches;let Vm=pe(()=>_m.detect(navigator.userAgent,M.from(navigator.userAgentData),zm));const Hm=()=>Vm(),Gc=(g,w)=>({left:g,top:w,translate:(K,Ae)=>Gc(g+K,w+Ae)}),Wm=Gc,jm=g=>{const w=g!==void 0?g.dom:document,R=w.body.scrollLeft||w.documentElement.scrollLeft,K=w.body.scrollTop||w.documentElement.scrollTop;return Wm(R,K)},Sl=g=>{const w=g===void 0?window:g;return Hm().browser.isFirefox()?M.none():M.from(w.visualViewport)},Yc=(g,w,R,K)=>({x:g,y:w,width:R,height:K,right:g+R,bottom:w+K}),qm=g=>{const w=g===void 0?window:g,R=w.document,K=jm(ut.fromDom(R));return Sl(w).fold(()=>{const Ae=w.document.documentElement,Ge=Ae.clientWidth,Ot=Ae.clientHeight;return Yc(K.left,K.top,Ge,Ot)},Ae=>Yc(Math.max(Ae.pageLeft,K.left),Math.max(Ae.pageTop,K.top),Ae.width,Ae.height))},Xc=(g,w,R)=>Sl(R).map(K=>{const Ae=Ge=>w(je(Ge));return K.addEventListener(g,Ae),{unbind:()=>K.removeEventListener(g,Ae)}}).getOrThunk(()=>({unbind:A}));var Um=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Jc=tinymce.util.Tools.resolve("tinymce.Env");const Qc=(g,w)=>{g.dispatch("FullscreenStateChanged",{state:w}),g.dispatch("ResizeEditor")},Km=g=>w=>w.options.get(g),Gm=g=>{const w=g.options.register;w("fullscreen_native",{processor:"boolean",default:!1})},Cl=Km("fullscreen_native"),Ym=g=>{const w=ut.fromDom(g.getElement());return Oe(w).map(Qe).getOrThunk(()=>ni(on(w)))},Xm=g=>g.fullscreenElement!==void 0?g.fullscreenElement:g.msFullscreenElement!==void 0?g.msFullscreenElement:g.webkitFullscreenElement!==void 0?g.webkitFullscreenElement:null,Jm=()=>document.fullscreenElement!==void 0?"fullscreenchange":document.msFullscreenElement!==void 0?"MSFullscreenChange":document.webkitFullscreenElement!==void 0?"webkitfullscreenchange":"fullscreenchange",Qm=g=>{const w=g.dom;w.requestFullscreen?w.requestFullscreen():w.msRequestFullscreen?w.msRequestFullscreen():w.webkitRequestFullScreen&&w.webkitRequestFullScreen()},Zm=g=>{const w=g.dom;w.exitFullscreen?w.exitFullscreen():w.msExitFullscreen?w.msExitFullscreen():w.webkitCancelFullScreen&&w.webkitCancelFullScreen()},Zc=g=>g.dom===Xm(on(g).dom),eg=(g,w,R)=>ue(Ln(g,R),w),tg=(g,w)=>ue(Un(g),w),ng=g=>Dn(g),ig=(g,w,R)=>eg(g,K=>Wt(K,w),R),sg=(g,w)=>tg(g,R=>Wt(R,w)),Gr="data-ephox-mobile-fullscreen-style",rg="display:none!important;",eu="position:absolute!important;",tu="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;",og="background-color:rgb(255,255,255)!important;",lg=Jc.os.isAndroid(),ag=g=>{const w=U(g,"background-color");return w!==void 0&&w!==""?"background-color:"+w+"!important":og},cg=(g,w,R)=>{const K=Fn=>sg(Fn,"*:not(.tox-silver-sink)"),Ae=Fn=>gi=>{const fn=kt(gi,"style"),ks=fn===void 0?"no-styles":fn.trim();ks!==Fn&&(bt(gi,Gr,ks),W(gi,g.parseStyle(Fn)))},Ge=ig(w,"*"),Ot=Q(Ge,K),hn=ag(R);te(Ot,Ae(rg)),te(Ge,Ae(eu+tu+hn)),Ae((lg===!0?"":eu)+tu+hn)(w)},ug=g=>{const w=ng("["+Gr+"]");te(w,R=>{const K=kt(R,Gr);K&&K!=="no-styles"?W(R,g.parseStyle(K)):Nt(R,"style"),Nt(R,Gr)})},nu=Um.DOM,hg=()=>qm(window),fg=g=>window.scrollTo(g.x,g.y),iu=Sl().fold(()=>({bind:A,unbind:A}),g=>{const w=we(),R=ye(),K=ye(),Ae=()=>{document.body.scrollTop=0,document.documentElement.scrollTop=0},Ge=()=>{window.requestAnimationFrame(()=>{w.on(Fn=>W(Fn,{top:g.offsetTop+"px",left:g.offsetLeft+"px",height:g.height+"px",width:g.width+"px"}))})},Ot=Le(()=>{Ae(),Ge()},50);return{bind:Fn=>{w.set(Fn),Ot.throttle(),R.set(Xc("resize",Ot.throttle)),K.set(Xc("scroll",Ot.throttle))},unbind:()=>{w.on(()=>{R.clear(),K.clear()}),w.clear()}}}),su=(g,w)=>{const R=document.body,K=document.documentElement,Ae=g.getContainer(),Ge=ut.fromDom(Ae),Ot=Ai(Ge).filter(vn=>O(vn)&&se(vn,"tox-silver-sink")),hn=Ym(g),Yt=w.get(),Fn=ut.fromDom(g.getBody()),gi=Jc.deviceType.isTouch(),fn=Ae.style,ks=g.iframeElement,xs=ks==null?void 0:ks.style,ou=vn=>{vn(R,"tox-fullscreen"),vn(K,"tox-fullscreen"),vn(Ae,"tox-fullscreen"),Oe(Ge).map(Di=>Qe(Di).dom).each(Di=>{vn(Di,"tox-fullscreen"),vn(Di,"tox-shadowhost")})},Al=()=>{gi&&ug(g.dom),ou(nu.removeClass),iu.unbind(),M.from(w.get()).each(vn=>vn.fullscreenChangeHandler.unbind())};if(Yt)Yt.fullscreenChangeHandler.unbind(),Cl(g)&&Zc(hn)&&Zm(on(hn)),xs.width=Yt.iframeWidth,xs.height=Yt.iframeHeight,fn.width=Yt.containerWidth,fn.height=Yt.containerHeight,fn.top=Yt.containerTop,fn.left=Yt.containerLeft,_(Ot,Yt.sinkCssPosition,(vn,Di)=>{S(vn,"position",Di)}),Al(),fg(Yt.scrollPos),w.set(null),Qc(g,!1),g.off("remove",Al);else{const vn=J(on(hn),Jm(),Yr=>{Cl(g)&&!Zc(hn)&&w.get()!==null&&su(g,w)}),Di={scrollPos:hg(),containerWidth:fn.width,containerHeight:fn.height,containerTop:fn.top,containerLeft:fn.left,iframeWidth:xs.width,iframeHeight:xs.height,fullscreenChangeHandler:vn,sinkCssPosition:Ot.map(Yr=>U(Yr,"position"))};gi&&cg(g.dom,Ge,Fn),xs.width=xs.height="100%",fn.width=fn.height="",ou(nu.addClass),Ot.each(Yr=>{S(Yr,"position","fixed")}),iu.bind(Ge),g.on("remove",Al),w.set(Di),Cl(g)&&Qm(hn),Qc(g,!0)}},dg=(g,w)=>{g.addCommand("mceFullScreen",()=>{su(g,w)})},ru=(g,w)=>R=>{R.setActive(w.get()!==null);const K=Ae=>R.setActive(Ae.state);return g.on("FullscreenStateChanged",K),()=>g.off("FullscreenStateChanged",K)},pg=(g,w)=>{const R=()=>g.execCommand("mceFullScreen");g.ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",icon:"fullscreen",shortcut:"Meta+Shift+F",onAction:R,onSetup:ru(g,w)}),g.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:R,onSetup:ru(g,w)})};var mg=()=>{e.add("fullscreen",g=>{const w=i(null);return g.inline||(Gm(g),dg(g,w),pg(g,w),g.addShortcut("Meta+Shift+F","","mceFullScreen")),t(w)})};mg()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=E=>P=>P.options.get(E),t=E=>{const P=E.options.register;P("insertdatetime_dateformat",{processor:"string",default:E.translate("%Y-%m-%d")}),P("insertdatetime_timeformat",{processor:"string",default:E.translate("%H:%M:%S")}),P("insertdatetime_formats",{processor:"string[]",default:["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"]}),P("insertdatetime_element",{processor:"boolean",default:!1})},n=e("insertdatetime_dateformat"),s=e("insertdatetime_timeformat"),r=e("insertdatetime_formats"),o=e("insertdatetime_element"),l=E=>{const P=r(E);return P.length>0?P[0]:s(E)},a="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),c="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),u="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),h="January February March April May June July August September October November December".split(" "),f=(E,P)=>{if(E=""+E,E.length(P=P.replace("%D","%m/%d/%Y"),P=P.replace("%r","%I:%M:%S %p"),P=P.replace("%Y",""+T.getFullYear()),P=P.replace("%y",""+T.getYear()),P=P.replace("%m",f(T.getMonth()+1,2)),P=P.replace("%d",f(T.getDate(),2)),P=P.replace("%H",""+f(T.getHours(),2)),P=P.replace("%M",""+f(T.getMinutes(),2)),P=P.replace("%S",""+f(T.getSeconds(),2)),P=P.replace("%I",""+((T.getHours()+11)%12+1)),P=P.replace("%p",T.getHours()<12?"AM":"PM"),P=P.replace("%B",""+E.translate(h[T.getMonth()])),P=P.replace("%b",""+E.translate(u[T.getMonth()])),P=P.replace("%A",""+E.translate(c[T.getDay()])),P=P.replace("%a",""+E.translate(a[T.getDay()])),P=P.replace("%%","%"),P),p=(E,P,T,M)=>{const V=E.dom.create("time",{datetime:T},M);E.dom.replace(V,P),E.selection.select(V,!0),E.selection.collapse(!1)},y=(E,P)=>{if(o(E)){const T=d(E,P);let M;/%[HMSIp]/.test(P)?M=d(E,"%Y-%m-%dT%H:%M"):M=d(E,"%Y-%m-%d");const V=E.dom.getParent(E.selection.getStart(),"time");V?p(E,V,M,T):E.insertContent('")}else E.insertContent(d(E,P))},b=E=>{E.addCommand("mceInsertDate",(P,T)=>{y(E,T!=null?T:n(E))}),E.addCommand("mceInsertTime",(P,T)=>{y(E,T!=null?T:s(E))})},m=E=>{let P=E;return{get:()=>P,set:V=>{P=V}}};var A=tinymce.util.Tools.resolve("tinymce.util.Tools");const v=E=>P=>{const T=()=>{P.setEnabled(E.selection.isEditable())};return E.on("NodeChange",T),T(),()=>{E.off("NodeChange",T)}},F=E=>{const P=r(E),T=m(l(E)),M=H=>E.execCommand("mceInsertDate",!1,H);E.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:H=>H===T.get(),fetch:H=>{H(A.map(P,te=>({type:"choiceitem",text:d(E,te),value:te})))},onAction:H=>{M(T.get())},onItemAction:(H,te)=>{T.set(te),M(te)},onSetup:v(E)});const V=H=>()=>{T.set(H),M(H)};E.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:()=>A.map(P,H=>({type:"menuitem",text:d(E,H),onAction:V(H)})),onSetup:v(E)})};var D=()=>{i.add("insertdatetime",E=>{t(E),b(E),F(E)})};D()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(x,S,W)=>{var U;return W(x,S.prototype)?!0:((U=x.constructor)===null||U===void 0?void 0:U.name)===S.name},t=x=>{const S=typeof x;return x===null?"null":S==="object"&&Array.isArray(x)?"array":S==="object"&&e(x,String,(W,U)=>U.isPrototypeOf(W))?"string":S},n=x=>S=>t(S)===x,s=n("string"),r=n("object"),o=n("array"),l=x=>x==null,a=x=>!l(x);class c{constructor(S,W){this.tag=S,this.value=W}static some(S){return new c(!0,S)}static none(){return c.singletonNone}fold(S,W){return this.tag?W(this.value):S()}isSome(){return this.tag}isNone(){return!this.tag}map(S){return this.tag?c.some(S(this.value)):c.none()}bind(S){return this.tag?S(this.value):c.none()}exists(S){return this.tag&&S(this.value)}forall(S){return!this.tag||S(this.value)}filter(S){return!this.tag||S(this.value)?this:c.none()}getOr(S){return this.tag?this.value:S}or(S){return this.tag?this:S}getOrThunk(S){return this.tag?this.value:S()}orThunk(S){return this.tag?this:S()}getOrDie(S){if(this.tag)return this.value;throw new Error(S!=null?S:"Called getOrDie on None")}static from(S){return a(S)?c.some(S):c.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(S){this.tag&&S(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}c.singletonNone=new c(!1);const u=Array.prototype.push,h=(x,S)=>{for(let W=0,U=x.length;W{const S=[];for(let W=0,U=x.length;W{let S=x;return{get:()=>S,set:Me=>{S=Me}}},p=Object.keys,y=Object.hasOwnProperty,b=(x,S)=>{const W=p(x);for(let U=0,Me=W.length;UA(x,S)?c.from(x[S]):c.none(),A=(x,S)=>y.call(x,S),v=x=>S=>S.options.get(x),F=x=>{const S=x.options.register;S("audio_template_callback",{processor:"function"}),S("video_template_callback",{processor:"function"}),S("iframe_template_callback",{processor:"function"}),S("media_live_embeds",{processor:"boolean",default:!0}),S("media_filter_html",{processor:"boolean",default:!0}),S("media_url_resolver",{processor:"function"}),S("media_alt_source",{processor:"boolean",default:!0}),S("media_poster",{processor:"boolean",default:!0}),S("media_dimensions",{processor:"boolean",default:!0})},D=v("audio_template_callback"),E=v("video_template_callback"),P=v("iframe_template_callback"),T=v("media_live_embeds"),M=v("media_filter_html"),V=v("media_url_resolver"),H=v("media_alt_source"),te=v("media_poster"),ue=v("media_dimensions");var L=tinymce.util.Tools.resolve("tinymce.util.Tools"),re=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),N=tinymce.util.Tools.resolve("tinymce.html.DomParser");const Q=re.DOM,$=x=>x.replace(/px$/,""),ie=x=>{const S=x.attr("style"),W=S?Q.parseStyle(S):{};return{type:"ephox-embed-iri",source:x.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:m(W,"max-width").map($).getOr(""),height:m(W,"max-height").map($).getOr("")}},le=(x,S)=>{let W={};const Me=N({validate:!1,forced_root_block:!1},S).parse(x);for(let Be=Me;Be;Be=Be.walk())if(Be.type===1){const je=Be.name;if(Be.attr("data-ephox-embed-iri")){W=ie(Be);break}else!W.source&&je==="param"&&(W.source=Be.attr("movie")),(je==="iframe"||je==="object"||je==="embed"||je==="video"||je==="audio")&&(W.type||(W.type=je),W=L.extend(Be.attributes.map,W)),je==="source"&&(W.source?W.altsource||(W.altsource=Be.attr("src")):W.source=Be.attr("src")),je==="img"&&!W.poster&&(W.poster=Be.attr("src"))}return W.source=W.source||W.src||"",W.altsource=W.altsource||"",W.poster=W.poster||"",W},_=x=>{var S;const W={mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"},U=(S=x.toLowerCase().split(".").pop())!==null&&S!==void 0?S:"";return m(W,U).getOr("")};var Y=tinymce.util.Tools.resolve("tinymce.html.Node"),ye=tinymce.util.Tools.resolve("tinymce.html.Serializer");const we=(x,S={})=>N(Fe({forced_root_block:!1,validate:!1,allow_conditional_comments:!0},S),x),Le=re.DOM,ve=x=>/^[0-9.]+$/.test(x)?x+"px":x,qe=(x,S)=>{const W=S.attr("style"),U=W?Le.parseStyle(W):{};a(x.width)&&(U["max-width"]=ve(x.width)),a(x.height)&&(U["max-height"]=ve(x.height)),S.attr("style",Le.serializeStyle(U))},st=["source","altsource"],Je=(x,S,W,U)=>{let Me=0,Be=0;const je=we(U);je.addNodeFilter("source",Ze=>Me=Ze.length);const xt=je.parse(x);for(let Ze=xt;Ze;Ze=Ze.walk())if(Ze.type===1){const Ue=Ze.name;if(Ze.attr("data-ephox-embed-iri")){qe(S,Ze);break}else{switch(Ue){case"video":case"object":case"embed":case"img":case"iframe":S.height!==void 0&&S.width!==void 0&&(Ze.attr("width",S.width),Ze.attr("height",S.height));break}if(W)switch(Ue){case"video":Ze.attr("poster",S.poster),Ze.attr("src",null);for(let C=Me;C<2;C++)if(S[st[C]]){const J=new Y("source",1);J.attr("src",S[st[C]]),J.attr("type",S[st[C]+"mime"]||null),Ze.append(J)}break;case"iframe":Ze.attr("src",S.source);break;case"object":const k=Ze.getAll("img").length>0;if(S.poster&&!k){Ze.attr("src",S.poster);const C=new Y("img",1);C.attr("src",S.poster),C.attr("width",S.width),C.attr("height",S.height),Ze.append(C)}break;case"source":if(Be<2&&(Ze.attr("src",S[st[Be]]),Ze.attr("type",S[st[Be]+"mime"]||null),!S[st[Be]])){Ze.remove();continue}Be++;break;case"img":S.poster||Ze.remove();break}}}return ye({},U).serialize(xt)},pt=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?h=$2&title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?h=$3&title=0&byline=0",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],Xe=x=>{const S=x.match(/^(https?:\/\/|www\.)(.+)$/i);return S&&S.length>1?S[1]==="www."?"https://":S[1]:"https://"},Lt=(x,S)=>{const W=Xe(S),U=x.regex.exec(S);let Me=W+x.url;if(a(U))for(let Be=0;BeU[Be]?U[Be]:"");return Me.replace(/\?$/,"")},Mt=x=>{const S=pt.filter(W=>W.regex.test(x));return S.length>0?L.extend({},S[0],{url:Lt(S[0],x)}):null},oe=(x,S)=>{if(S)return S(x);{const W=x.allowfullscreen?' allowFullscreen="1"':"";return'"}},be=x=>{let S='';return x.poster&&(S+=''),S+="",S},de=(x,S)=>S?S(x):'",j=(x,S)=>S?S(x):'",ee=(x,S)=>{var W;const U=L.extend({},S);if(!U.source&&(L.extend(U,le((W=U.embed)!==null&&W!==void 0?W:"",x.schema)),!U.source))return"";U.altsource||(U.altsource=""),U.poster||(U.poster=""),U.source=x.convertURL(U.source,"source"),U.altsource=x.convertURL(U.altsource,"source"),U.sourcemime=_(U.source),U.altsourcemime=_(U.altsource),U.poster=x.convertURL(U.poster,"poster");const Me=Mt(U.source);if(Me&&(U.source=Me.url,U.type=Me.type,U.allowfullscreen=Me.allowFullscreen,U.width=U.width||String(Me.w),U.height=U.height||String(Me.h)),U.embed)return Je(U.embed,U,!0,x.schema);{const Be=D(x),je=E(x),xt=P(x);return U.width=U.width||"300",U.height=U.height||"150",L.each(U,(Ze,Ue)=>{U[Ue]=x.dom.encode(""+Ze)}),U.type==="iframe"?oe(U,xt):U.sourcemime==="application/x-shockwave-flash"?be(U):U.sourcemime.indexOf("audio")!==-1?de(U,Be):j(U,je)}},ae=x=>x.hasAttribute("data-mce-object")||x.hasAttribute("data-ephox-embed-iri"),he=x=>{x.on("click keyup touchend",()=>{const S=x.selection.getNode();S&&x.dom.hasClass(S,"mce-preview-object")&&x.dom.getAttrib(S,"data-mce-selected")&&S.setAttribute("data-mce-selected","2")}),x.on("ObjectResized",S=>{const W=S.target;if(W.getAttribute("data-mce-object")){let U=W.getAttribute("data-mce-html");U&&(U=unescape(U),W.setAttribute("data-mce-html",escape(Je(U,{width:String(S.width),height:String(S.height)},!1,x.schema))))}})},fe={},O=(x,S,W)=>new Promise((U,Me)=>{const Be=je=>(je.html&&(fe[x.source]=je),U({url:x.source,html:je.html?je.html:S(x)}));fe[x.source]?Be(fe[x.source]):W({url:x.source},Be,Me)}),I=(x,S)=>Promise.resolve({html:S(x),url:x.source}),Z=x=>S=>ee(x,S),xe=(x,S)=>{const W=V(x);return W?O(S,Z(x),W):I(S,Z(x))},$e=x=>A(fe,x),He=(x,S)=>m(S,x).bind(W=>m(W,"meta")),bt=(x,S,W)=>U=>{const Me=()=>m(x,U),Be=()=>m(S,U),je=Ue=>m(Ue,"value").bind(k=>k.length>0?c.some(k):c.none()),xt=()=>Me().bind(Ue=>r(Ue)?je(Ue).orThunk(Be):Be().orThunk(()=>c.from(Ue))),Ze=()=>Be().orThunk(()=>Me().bind(Ue=>r(Ue)?je(Ue):c.from(Ue)));return{[U]:(U===W?xt():Ze()).getOr("")}},kt=(x,S)=>{const W={};return m(x,"dimensions").each(U=>{h(["width","height"],Me=>{m(S,Me).orThunk(()=>m(U,Me)).each(Be=>W[Me]=Be)})}),W},Nt=(x,S)=>{const W=S&&S!=="dimensions"?He(S,x).getOr({}):{},U=bt(x,W,S);return Fe(Fe(Fe(Fe(Fe({},U("source")),U("altsource")),U("poster")),U("embed")),kt(x,W))},q=x=>{const S=qt(Fe({},x),{source:{value:m(x,"source").getOr("")},altsource:{value:m(x,"altsource").getOr("")},poster:{value:m(x,"poster").getOr("")}});return h(["width","height"],W=>{m(x,W).each(U=>{const Me=S.dimensions||{};Me[W]=U,S.dimensions=Me})}),S},se=x=>S=>{const W=S&&S.msg?"Media embed handler error: "+S.msg:"Media embed handler threw unknown error.";x.notificationManager.open({type:"error",text:W})},ne=x=>{const S=x.selection.getNode(),W=ae(S)?x.serializer.serialize(S,{selection:!0}):"",U=le(W,x.schema),Be=(()=>{if(We(U.source,U.type)){const je=x.dom.getRect(S);return{width:je.w.toString().replace(/px$/,""),height:je.h.toString().replace(/px$/,"")}}else return{}})();return Fe(Fe({embed:W},U),Be)},ke=(x,S)=>W=>{if(s(W.url)&&W.url.trim().length>0){const U=W.html,Me=le(U,S.schema),Be=qt(Fe({},Me),{source:W.url,embed:U});x.setData(q(Be))}},Ie=(x,S)=>{const W=x.dom.select("*[data-mce-object]");for(let U=0;U=0;Me--)S[U]===W[Me]&&W.splice(Me,1);x.selection.select(W[0])},et=(x,S)=>{const W=x.dom.select("*[data-mce-object]");x.insertContent(S),Ie(x,W),x.nodeChanged()},We=(x,S)=>a(S)&&S==="ephox-embed-iri"&&a(Mt(x)),lt=(x,S)=>((U,Me)=>U.width!==Me.width||U.height!==Me.height)(x,S)&&We(S.source,x.type),wt=(x,S,W)=>{var U;S.embed=lt(x,S)&&ue(W)?ee(W,qt(Fe({},S),{embed:""})):Je((U=S.embed)!==null&&U!==void 0?U:"",S,!1,W.schema),S.embed&&(x.source===S.source||$e(S.source))?et(W,S.embed):xe(W,S).then(Me=>{et(W,Me.html)}).catch(se(W))},ut=x=>{const S=ne(x),W=d(S),U=q(S),Me=(Se,Ve)=>{const Ke=Nt(Ve.getData(),"source");Se.source!==Ke.source&&(ke(De,x)({url:Ke.source,html:""}),xe(x,Ke).then(ke(De,x)).catch(se(x)))},Be=Se=>{var Ve;const Ke=Nt(Se.getData()),at=le((Ve=Ke.embed)!==null&&Ve!==void 0?Ve:"",x.schema);Se.setData(q(at))},je=(Se,Ve,Ke)=>{const at=Nt(Se.getData(),Ve),_t=lt(Ke,at)&&ue(x)?qt(Fe({},at),{embed:""}):at,Mi=ee(x,_t);Se.setData(q(qt(Fe({},_t),{embed:Mi})))},xt=[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],Ze=ue(x)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],Ue={title:"General",name:"general",items:f([xt,Ze])},C={title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]},J=[];H(x)&&J.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),te(x)&&J.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const pe={title:"Advanced",name:"advanced",items:J},ge=[Ue,C];J.length>0&&ge.push(pe);const Ce={type:"tabpanel",tabs:ge},De=x.windowManager.open({title:"Insert/Edit Media",size:"normal",body:Ce,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:Se=>{const Ve=Nt(Se.getData());wt(W.get(),Ve,x),Se.close()},onChange:(Se,Ve)=>{switch(Ve.name){case"source":Me(W.get(),Se);break;case"embed":Be(Se);break;case"dimensions":case"altsource":case"poster":je(Se,Ve.name,W.get());break}W.set(Nt(Se.getData()))},initialData:U})},Wt=x=>({showDialog:()=>{ut(x)}}),Jt=x=>{const S=()=>{ut(x)};x.addCommand("mceMedia",S)},Dn=(x,S,W)=>x.length>=S.length&&x.substr(W,W+S.length)===S,Zn=(x,S)=>Dn(x,S,0);var on=tinymce.util.Tools.resolve("tinymce.Env");const On=x=>{const S=x.name;return S==="iframe"||S==="video"||S==="audio"},ei=(x,S,W,U=null)=>{const Me=x.attr(W);return a(Me)?Me:A(S,W)?null:U},Ln=(x,S,W)=>{const U=S.name==="img"||x.name==="video",Me=U?"300":null,Be=x.name==="audio"?"30":"150",je=U?Be:null;S.attr({width:ei(x,W,"width",Me),height:ei(x,W,"height",je)})},Un=(x,S,W,U)=>{const Me=we(x.schema).parse(U,{context:S});for(;Me.firstChild;)W.append(Me.firstChild)},Ai=(x,S)=>{const W=S.name,U=new Y("img",1);return ti(x,S,U),Ln(S,U,{}),U.attr({style:S.attr("style"),src:on.transparentSrc,"data-mce-object":W,class:"mce-object mce-object-"+W}),U},Ti=(x,S)=>{var W;const U=S.name,Me=new Y("span",1);Me.attr({contentEditable:"false",style:S.attr("style"),"data-mce-object":U,class:"mce-preview-object mce-object-"+U}),ti(x,S,Me);const Be=x.dom.parseStyle((W=S.attr("style"))!==null&&W!==void 0?W:""),je=new Y(U,1);if(Ln(S,je,Be),je.attr({src:S.attr("src"),style:S.attr("style"),class:S.attr("class")}),U==="iframe")je.attr({allowfullscreen:S.attr("allowfullscreen"),frameborder:"0",sandbox:S.attr("sandbox")});else{h(["controls","crossorigin","currentTime","loop","muted","poster","preload"],k=>{je.attr(k,S.attr(k))});const Ue=Me.attr("data-mce-html");a(Ue)&&Un(x,U,je,unescape(Ue))}const xt=new Y("span",1);return xt.attr("class","mce-shim"),Me.append(je),Me.append(xt),Me},ti=(x,S,W)=>{var U;const Me=(U=S.attributes)!==null&&U!==void 0?U:[];let Be=Me.length;for(;Be--;){const Ue=Me[Be].name;let k=Me[Be].value;Ue!=="width"&&Ue!=="height"&&Ue!=="style"&&!Zn(Ue,"data-mce-")&&((Ue==="data"||Ue==="src")&&(k=x.convertURL(k,Ue)),W.attr("data-mce-p-"+Ue,k))}const je=ye({inner:!0},x.schema),xt=new Y("div",1);h(S.children(),Ue=>xt.append(Ue));const Ze=je.serialize(xt);Ze&&(W.attr("data-mce-html",escape(Ze)),W.empty())},B=x=>{const S=x.attr("class");return s(S)&&/\btiny-pageembed\b/.test(S)},z=x=>{let S=x;for(;S=S.parent;)if(S.attr("data-ephox-embed-iri")||B(S))return!0;return!1},me=x=>S=>{let W=S.length,U;for(;W--;)U=S[W],U.parent&&(U.parent.attr("data-mce-object")||(On(U)&&T(x)?z(U)||U.replace(Ti(x,U)):z(U)||U.replace(Ai(x,U))))},Oe=(x,S,W)=>{const U=x.options.get,Me=U("xss_sanitization"),Be=M(x);return we(x.schema,{sanitize:Me,validate:Be}).parse(W,{context:S})},Qe=x=>{x.on("PreInit",()=>{const{schema:S,serializer:W,parser:U}=x,Me=S.getBoolAttrs();h("webkitallowfullscreen mozallowfullscreen".split(" "),Be=>{Me[Be]={}}),b({embed:["wmode"]},(Be,je)=>{const xt=S.getElementRule(je);xt&&h(Be,Ze=>{xt.attributes[Ze]={},xt.attributesOrder.push(Ze)})}),U.addNodeFilter("iframe,video,audio,object,embed",me(x)),W.addAttributeFilter("data-mce-object",(Be,je)=>{var xt;let Ze=Be.length;for(;Ze--;){const Ue=Be[Ze];if(!Ue.parent)continue;const k=Ue.attr(je),C=new Y(k,1);if(k!=="audio"){const Ce=Ue.attr("class");Ce&&Ce.indexOf("mce-preview-object")!==-1&&Ue.firstChild?C.attr({width:Ue.firstChild.attr("width"),height:Ue.firstChild.attr("height")}):C.attr({width:Ue.attr("width"),height:Ue.attr("height")})}C.attr({style:Ue.attr("style")});const J=(xt=Ue.attributes)!==null&&xt!==void 0?xt:[];let pe=J.length;for(;pe--;){const Ce=J[pe].name;Ce.indexOf("data-mce-p-")===0&&C.attr(Ce.substr(11),J[pe].value)}const ge=Ue.attr("data-mce-html");if(ge){const Ce=Oe(x,k,unescape(ge));h(Ce.children(),De=>C.append(De))}Ue.replace(C)}})}),x.on("SetContent",()=>{const S=x.dom;h(S.select("span.mce-preview-object"),W=>{S.select("span.mce-shim",W).length===0&&S.add(W,"span",{class:"mce-shim"})})})},$t=x=>{x.on("ResolveName",S=>{let W;S.target.nodeType===1&&(W=S.target.getAttribute("data-mce-object"))&&(S.name=W)})},En=x=>S=>{const W=()=>{S.setEnabled(x.selection.isEditable())};return x.on("NodeChange",W),W(),()=>{x.off("NodeChange",W)}},jt=x=>{const S=()=>x.execCommand("mceMedia");x.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:S,onSetup:W=>{const U=x.selection;W.setActive(ae(U.getNode()));const Me=U.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",W.setActive).unbind,Be=En(x)(W);return()=>{Me(),Be()}}}),x.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:S,onSetup:En(x)})};var ni=()=>{i.add("media",x=>(F(x),Jt(x),jt(x),$t(x),Qe(x),he(x),Wt(x)))};ni()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=m=>A=>typeof A===m,t=e("boolean"),n=e("number"),s=m=>A=>A.options.get(m),r=m=>{const A=m.options.register;A("nonbreaking_force_tab",{processor:v=>t(v)?{value:v?3:0,valid:!0}:n(v)?{value:v,valid:!0}:{valid:!1,message:"Must be a boolean or number."},default:!1}),A("nonbreaking_wrap",{processor:"boolean",default:!0})},o=s("nonbreaking_force_tab"),l=s("nonbreaking_wrap"),a=(m,A)=>{let v="";for(let F=0;Fm.plugins.visualchars?m.plugins.visualchars.isEnabled():!1,u=(m,A)=>{const v=()=>c(m)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap",F=()=>`${a(" ",A)}`,E=l(m)||m.plugins.visualchars?F():a(" ",A);m.undoManager.transact(()=>m.insertContent(E))},h=m=>{m.addCommand("mceNonBreaking",()=>{u(m,1)})};var f=tinymce.util.Tools.resolve("tinymce.util.VK");const d=m=>{const A=o(m);A>0&&m.on("keydown",v=>{if(v.keyCode===f.TAB&&!v.isDefaultPrevented()){if(v.shiftKey)return;v.preventDefault(),v.stopImmediatePropagation(),u(m,A)}})},p=m=>A=>{const v=()=>{A.setEnabled(m.selection.isEditable())};return m.on("NodeChange",v),v(),()=>{m.off("NodeChange",v)}},y=m=>{const A=()=>m.execCommand("mceNonBreaking");m.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:A,onSetup:p(m)}),m.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:A,onSetup:p(m)})};var b=()=>{i.add("nonbreaking",m=>{r(m),h(m),y(m),d(m)})};b()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.Env");const t=p=>y=>y.options.get(p),n=p=>{const y=p.options.register;y("pagebreak_separator",{processor:"string",default:""}),y("pagebreak_split_block",{processor:"boolean",default:!1})},s=t("pagebreak_separator"),r=t("pagebreak_split_block"),o="mce-pagebreak",l=p=>{const y=``;return p?`

${y}

`:y},a=p=>{const y=s(p),b=()=>r(p),m=new RegExp(y.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,A=>"\\"+A),"gi");p.on("BeforeSetContent",A=>{A.content=A.content.replace(m,l(b()))}),p.on("PreInit",()=>{p.serializer.addNodeFilter("img",A=>{let v=A.length,F,D;for(;v--;)if(F=A[v],D=F.attr("class"),D&&D.indexOf(o)!==-1){const E=F.parent;if(E&&p.schema.getBlockElements()[E.name]&&b()){E.type=3,E.value=y,E.raw=!0,F.remove();continue}F.type=3,F.value=y,F.raw=!0}})})},c=p=>{p.addCommand("mcePageBreak",()=>{p.insertContent(l(r(p)))})},u=p=>{p.on("ResolveName",y=>{y.target.nodeName==="IMG"&&p.dom.hasClass(y.target,o)&&(y.name="pagebreak")})},h=p=>y=>{const b=()=>{y.setEnabled(p.selection.isEditable())};return p.on("NodeChange",b),b(),()=>{p.off("NodeChange",b)}},f=p=>{const y=()=>p.execCommand("mcePageBreak");p.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:y,onSetup:h(p)}),p.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:y,onSetup:h(p)})};var d=()=>{i.add("pagebreak",p=>{n(p),c(p),f(p),a(p),u(p)})};d()})();(function(){var i=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.Env"),t=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=d=>p=>p.options.get(d),s=n("content_style"),r=n("content_css_cors"),o=n("body_class"),l=n("body_id"),a=d=>{var p;let y="";const b=d.dom.encode,m=(p=s(d))!==null&&p!==void 0?p:"";y+='';const A=r(d)?' crossorigin="anonymous"':"";t.each(d.contentCSS,V=>{y+='"}),m&&(y+='");const v=l(d),F=o(d),E='