var ef=Object.defineProperty;var Ci=Object.getOwnPropertySymbols;var El=Object.prototype.hasOwnProperty,zl=Object.prototype.propertyIsEnumerable;var Wl=(v,M,y)=>M in v?ef(v,M,{enumerable:!0,configurable:!0,writable:!0,value:y}):v[M]=y,un=(v,M)=>{for(var y in M||(M={}))El.call(M,y)&&Wl(v,y,M[y]);if(Ci)for(var y of Ci(M))zl.call(M,y)&&Wl(v,y,M[y]);return v};var Hl=(v,M)=>{var y={};for(var E in v)El.call(v,E)&&M.indexOf(E)<0&&(y[E]=v[E]);if(v!=null&&Ci)for(var E of Ci(v))M.indexOf(E)<0&&zl.call(v,E)&&(y[E]=v[E]);return y};var Wr=(v,M,y)=>new Promise((E,$)=>{var X=P=>{try{ae(y.next(P))}catch(U){$(U)}},ve=P=>{try{ae(y.throw(P))}catch(U){$(U)}},ae=P=>P.done?E(P.value):Promise.resolve(P.value).then(X,ve);ae((y=y.apply(v,M)).next())});import{u as tf,B as rf}from"./useForm-9b8a2c16.js";import{f as nf,b as of,u as af}from"./schema-149c1808.js";import{a as lf,B as sf}from"./index-e0942325.js";import{U as uf,z as ff,i as cf,w as ql,_ as df}from"./index.js";import{c as hf,d as pf}from"./antd-029ed741.js";import{d as Kn,f as Li,w as Oo,y as Fl,h as Xl,u as _t,o as vf,b as gf,Z as Ai,_ as Yl,c as Wo,k as Ti,G as mf,r as yf,a4 as Zl,a5 as Il,a9 as bf}from"./vue-72a104e4.js";import{u as wf}from"./useWindowSizeFn-46f0db92.js";import"./index-5157bbb9.js";import"./copyTextToClipboard-8577151f.js";import"./deviceApi-260fcde9.js";var Jl={exports:{}};(function(v,M){(function(y,E){v.exports=E()})(hf,function(){var y=navigator.userAgent,E=navigator.platform,$=/gecko\/\d/i.test(y),X=/MSIE \d/.test(y),ve=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(y),ae=/Edge\/(\d+)/.exec(y),P=X||ve||ae,U=P&&(X?document.documentMode||6:+(ae||ve)[1]),K=!ae&&/WebKit\//.test(y),Y=K&&/Qt\/\d+\.\d+/.test(y),j=!ae&&/Chrome\/(\d+)/.exec(y),ue=j&&+j[1],te=/Opera\//.test(y),Ce=/Apple Computer/.test(navigator.vendor),Le=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(y),ge=/PhantomJS/.test(y),G=Ce&&(/Mobile\/\w+/.test(y)||navigator.maxTouchPoints>2),L=/Android/.test(y),W=G||L||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(y),ee=G||/Mac/.test(E),ce=/\bCrOS\b/.test(y),we=/win/i.test(E),me=te&&y.match(/Version\/(\d*\.\d*)/);me&&(me=Number(me[1])),me&&me>=15&&(te=!1,K=!0);var Ne=ee&&(Y||te&&(me==null||me<12.11)),ie=$||P&&U>=9;function Z(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Te=function(e,t){var n=e.className,r=Z(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function R(e,t){return C(e).appendChild(t)}function c(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var de=function(){this.id=null,this.f=null,this.time=0,this.handler=le(this.onTimeout,this)};de.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},de.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var ct=[""];function Ct(e){for(;ct.length<=e;)ct.push(be(ct)+" ");return ct[e]}function be(e){return e[e.length-1]}function Pe(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||Se.test(e))}function Zt(e,t){return t?t.source.indexOf("\\w")>-1&&rt(e)?!0:t.test(e):rt(e)}function Un(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Jt=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&Jt.test(e)}function or(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function ar(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var xr=null;function lr(e,t,n){var r;xr=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:xr=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:xr=i)}return r!=null?r:xr}var Di=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(u,d,p){this.level=u,this.from=d,this.to=p}return function(u,d){var p=d=="ltr"?"L":"R";if(u.length==0||d=="ltr"&&!r.test(u))return!1;for(var m=u.length,g=[],x=0;x-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ie(e,t){var n=Vt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Pt(e){e.prototype.on=function(t,n){re(this,t,n)},e.prototype.off=function(t,n){nt(this,t,n)}}function it(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function zr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function dt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function sr(e){it(e),zr(e)}function cn(e){return e.target||e.srcElement}function Wt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ee&&e.ctrlKey&&t==1&&(t=3),t}var Pi=function(){if(P&&U<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e}(),Hr;function qn(e){if(Hr==null){var t=c("span","​");R(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Hr=t.offsetWidth<=1&&t.offsetHeight>2&&!(P&&U<8))}var n=Hr?c("span","​"):c("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var dn;function ur(e){if(dn!=null)return dn;var t=R(e,document.createTextNode("AخA")),n=N(t,0,1).getBoundingClientRect(),r=N(t,1,2).getBoundingClientRect();return C(e),!n||n.left==n.right?!1:dn=r.right-n.right<3}var Ot=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` `,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},fr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Xn=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Wi(e){if(Et!=null)return Et;var t=R(e,c("span","x")),n=t.getBoundingClientRect(),r=N(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Fr={},zt={};function Ht(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Fr[e]=t}function kr(e,t){zt[e]=t}function Ir(e){if(typeof e=="string"&&zt.hasOwnProperty(e))e=zt[e];else if(e&&typeof e.name=="string"&&zt.hasOwnProperty(e.name)){var t=zt[e.name];typeof t=="string"&&(t={name:t}),e=k(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ir("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ir("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Br(e,t){t=Ir(t);var n=Fr[t.name];if(!n)return Br(e,"text/plain");var r=n(e,t);if(cr.hasOwnProperty(t.name)){var i=cr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var cr={};function Rr(e,t){var n=cr.hasOwnProperty(e)?cr[e]:cr[e]={};he(t,n)}function jt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function hn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function _r(e,t,n){return e.startState?e.startState(t,n):!0}var Re=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Re.prototype.eol=function(){return this.pos>=this.string.length},Re.prototype.sol=function(){return this.pos==this.lineStart},Re.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Re.prototype.next=function(){if(this.post},Re.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Re.prototype.skipToEnd=function(){this.pos=this.string.length},Re.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Re.prototype.backUp=function(e){this.pos-=e},Re.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Re.prototype.current=function(){return this.string.slice(this.start,this.pos)},Re.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Re.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Re.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function q(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?w(n,q(e,n).text.length):ts(t,q(e,t.line).text.length)}function ts(e,t){var n=e.ch;return n==null||n>t?w(e.line,t):n<0?w(e.line,0):e}function zo(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ut.fromSaved=function(e,t,n){return t instanceof Yn?new Ut(e,jt(e.mode,t.state),n,t.lookAhead):new Ut(e,jt(e.mode,t),n)},Ut.prototype.save=function(e){var t=e!==!1?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Yn(t,this.maxLookAhead):t};function Ho(e,t,n,r){var i=[e.state.modeGen],o={};Ko(e,t.text,e.doc.mode,n,function(u,d){return i.push(u,d)},o,r);for(var a=n.state,l=function(u){n.baseTokens=i;var d=e.state.overlays[u],p=1,m=0;n.state=!0,Ko(e,t.text,d.mode,n,function(g,x){for(var T=p;mg&&i.splice(p,1,g,i[p+1],A),p+=2,m=Math.min(g,A)}if(x)if(d.opaque)i.splice(T,p-T,g,"overlay "+x),p=T+2;else for(;Te.options.maxHighlightLength&&jt(e.doc.mode,r.state),o=Ho(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function vn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Ut(r,!0,t);var o=rs(e,t,n),a=o>r.first&&q(r,o-1).stateAfter,l=a?Ut.fromSaved(r,a,o):new Ut(r,_r(r.mode),o);return r.iter(o,t,function(s){Ei(e,s.text,l);var u=l.line;s.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&ut.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Bo=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ro(e,t,n,r){var i=e.doc,o=i.mode,a;t=fe(i,t);var l=q(i,t.line),s=vn(e,t.line,n),u=new Re(l.text,e.options.tabSize,s),d;for(r&&(d=[]);(r||u.pose.options.maxHighlightLength?(l=!1,a&&Ei(e,t,r,d.pos),d.pos=t.length,p=null):p=_o(zi(n,d,r.state,m),o),m){var g=m[0].name;g&&(p="m-"+(p?g+" "+p:g))}if(!l||u!=p){for(;sa;--l){if(l<=o.first)return o.first;var s=q(o,l-1),u=s.stateAfter;if(u&&(!n||l+(u instanceof Yn?u.lookAhead:0)<=o.modeFrontier))return l;var d=ke(s.text,null,e.options.tabSize);(i==null||r>d)&&(i=l-1,r=d)}return i}function ns(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=q(e,r).stateAfter;if(i&&(!(i instanceof Yn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new Zn(a,o.from,s?null:o.to))}}return r}function us(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var _=0;_0)){var d=[s,1],p=I(u.from,l.from),m=I(u.to,l.to);(p<0||!a.inclusiveLeft&&!p)&&d.push({from:u.from,to:l.from}),(m>0||!a.inclusiveRight&&!m)&&d.push({from:l.to,to:u.to}),i.splice.apply(i,d),s+=d.length-3}}return i}function Go(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||Fi(r,o.marker)<0)&&(r=o.marker)}return r}function Zo(e,t,n,r,i){var o=q(e,t),a=$t&&o.markedSpans;if(a)for(var l=0;l=0&&p<=0||d<=0&&p>=0)&&(d<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?I(u.to,n)>=0:I(u.to,n)>0)||d>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?I(u.from,r)<=0:I(u.from,r)<0)))return!0}}}function Ft(e){for(var t;t=Yo(e);)e=t.find(-1,!0).line;return e}function ds(e){for(var t;t=Qn(e);)e=t.find(1,!0).line;return e}function hs(e){for(var t,n;t=Qn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Ii(e,t){var n=q(e,t),r=Ft(n);return n==r?t:f(r)}function Jo(e,t){if(t>e.lastLine())return t;var n=q(e,t),r;if(!dr(e,n))return t;for(;r=Qn(n);)n=r.find(1,!0).line;return f(n)+1}function dr(e,t){var n=$t&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var jr=function(e,t,n){this.text=e,qo(this,t),this.height=n?n(this):1};jr.prototype.lineNo=function(){return f(this)},Pt(jr);function ps(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Go(e),qo(e,n);var i=r?r(e):1;i!=e.height&&Lt(e,i)}function vs(e){e.parent=null,Go(e)}var gs={},ms={};function Vo(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ms:gs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Qo(e,t){var n=F("span",null,null,K?"padding-right: .1px":null),r={pre:F("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=bs,ur(e.display.measure)&&(a=ye(o,e.doc.direction))&&(r.addToken=xs(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&f(o);ks(o,r,Fo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=At(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=At(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(qn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(K){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ie(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=At(r.pre.className,r.textClass||"")),r}function ys(e){var t=c("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function bs(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?ws(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,d;if(!s.test(t))e.col+=t.length,d=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,d),P&&U<9&&(u=!0),e.pos+=t.length;else{d=document.createDocumentFragment();for(var p=0;;){s.lastIndex=p;var m=s.exec(t),g=m?m.index-p:t.length-p;if(g){var x=document.createTextNode(l.slice(p,p+g));P&&U<9?d.appendChild(c("span",[x])):d.appendChild(x),e.map.push(e.pos,e.pos+g,x),e.col+=g,e.pos+=g}if(!m)break;p+=g+1;var T=void 0;if(m[0]==" "){var A=e.cm.options.tabSize,z=A-e.col%A;T=d.appendChild(c("span",Ct(z),"cm-tab")),T.setAttribute("role","presentation"),T.setAttribute("cm-text"," "),e.col+=z}else m[0]=="\r"||m[0]==` `?(T=d.appendChild(c("span",m[0]=="\r"?"␍":"␤","cm-invalidchar")),T.setAttribute("cm-text",m[0]),e.col+=1):(T=e.cm.options.specialCharPlaceholder(m[0]),T.setAttribute("cm-text",m[0]),P&&U<9?d.appendChild(c("span",[T])):d.appendChild(T),e.col+=1);e.map.push(e.pos,e.pos+1,T),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||u||o||a){var B=n||"";r&&(B+=r),i&&(B+=i);var H=c("span",[d],B,o);if(a)for(var _ in a)a.hasOwnProperty(_)&&_!="style"&&_!="class"&&H.setAttribute(_,a[_]);return e.content.appendChild(H)}e.content.appendChild(d)}}function ws(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&p.from<=u));m++);if(p.to>=d)return e(n,r,i,o,a,l,s);e(n,r.slice(0,p.to-u),i,o,null,l,s),o=null,r=r.slice(p.to-u),u=p.to}}}function $o(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function ks(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;as||pe.collapsed&&Q.to==s&&Q.from==s)){if(Q.to!=null&&Q.to!=s&&g>Q.to&&(g=Q.to,T=""),pe.className&&(x+=" "+pe.className),pe.css&&(m=(m?m+";":"")+pe.css),pe.startStyle&&Q.from==s&&(A+=" "+pe.startStyle),pe.endStyle&&Q.to==g&&(_||(_=[])).push(pe.endStyle,Q.to),pe.title&&((B||(B={})).title=pe.title),pe.attributes)for(var We in pe.attributes)(B||(B={}))[We]=pe.attributes[We];pe.collapsed&&(!z||Fi(z.marker,pe)<0)&&(z=Q)}else Q.from>s&&g>Q.from&&(g=Q.from)}if(_)for(var Qe=0;Qe<_.length;Qe+=2)_[Qe+1]==g&&(T+=" "+_[Qe]);if(!z||z.from==s)for(var Fe=0;Fe=l)break;for(var kt=Math.min(l,g);;){if(d){var gt=s+d.length;if(!z){var Ge=gt>kt?d.slice(0,kt-s):d;t.addToken(t,Ge,p?p+x:x,A,s+Ge.length==g?T:"",m,B)}if(gt>=kt){d=d.slice(kt-s),s=kt;break}s=gt,A=""}d=i.slice(o,o=n[u++]),p=Vo(n[u++],t.cm.options)}}}function ea(e,t,n){this.line=t,this.rest=hs(t),this.size=this.rest?f(be(this.rest))-n+1:1,this.node=this.text=null,this.hidden=dr(e,t)}function ei(e,t,n){for(var r=[],i,o=t;o2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function la(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Ws(e,t){t=Ft(t);var n=f(t),r=e.display.externalMeasured=new ea(e.doc,t,n);r.lineN=n;var i=r.built=Qo(e,r);return r.text=i.pre,R(e.display.lineMeasure,i.pre),r}function sa(e,t,n,r){return qt(e,Gr(e,t),n,r)}function Ui(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if(n=="right"&&i==s-l)for(;u=0&&(n=e[i]).left==n.right;i--);return n}function zs(e,t,n,r){var i=fa(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,u;if(o.nodeType==3){for(var d=0;d<4;d++){for(;a&&Ue(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l0&&(s=r="right");var p;e.options.lineWrapping&&(p=o.getClientRects()).length>1?u=p[r=="right"?p.length-1:0]:u=o.getBoundingClientRect()}if(P&&U<9&&!a&&(!u||!u.left&&!u.right)){var m=o.parentNode.getClientRects()[0];m?u={left:m.left,right:m.left+Xr(e.display),top:m.top,bottom:m.bottom}:u=ua}for(var g=u.top-t.rect.top,x=u.bottom-t.rect.top,T=(g+x)/2,A=t.view.measure.heights,z=0;z=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a(u=="before"?s-1:s,u=="before");function d(x,T,A){var z=l[T],B=z.level==1;return a(A?x-1:x,B!=A)}var p=lr(l,s,u),m=xr,g=d(s,p,u=="before");return m!=null&&(g.other=d(s,m,u!="before")),g}function ga(e,t){var n=0;t=fe(e.doc,t),e.options.lineWrapping||(n=Xr(e.display)*t.ch);var r=q(e.doc,t.line),i=er(r)+ti(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function qi(e,t,n,r,i){var o=w(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Xi(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return qi(r.first,0,null,-1,-1);var i=h(r,n),o=r.first+r.size-1;if(i>o)return qi(r.first+r.size-1,q(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=q(r,i);;){var l=Fs(e,a,i,t,n),s=cs(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var u=s.find(1);if(u.line==i)return u;a=q(r,i=u.line)}}function ma(e,t,n,r){r-=Gi(t);var i=t.text.length,o=Kt(function(a){return qt(e,n,a-1).bottom<=r},i,0);return i=Kt(function(a){return qt(e,n,a).top>r},o,i),{begin:o,end:i}}function ya(e,t,n,r){n||(n=Gr(e,t));var i=ri(e,t,qt(e,n,r),"line").top;return ma(e,t,n,i)}function Yi(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Fs(e,t,n,r,i){i-=er(t);var o=Gr(e,t),a=Gi(t),l=0,s=t.text.length,u=!0,d=ye(t,e.doc.direction);if(d){var p=(e.options.lineWrapping?Bs:Is)(e,t,n,o,d,r,i);u=p.level!=1,l=u?p.from:p.to-1,s=u?p.to:p.from-1}var m=null,g=null,x=Kt(function(ne){var Q=qt(e,o,ne);return Q.top+=a,Q.bottom+=a,Yi(Q,r,i,!1)?(Q.top<=i&&Q.left<=r&&(m=ne,g=Q),!0):!1},l,s),T,A,z=!1;if(g){var B=r-g.left=_.bottom?1:0}return x=or(t.text,x,1),qi(n,x,A,z,r-T)}function Is(e,t,n,r,i,o,a){var l=Kt(function(p){var m=i[p],g=m.level!=1;return Yi(It(e,w(n,g?m.to:m.from,g?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var u=s.level!=1,d=It(e,w(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Yi(d,o,a,!0)&&d.top>a&&(s=i[l-1])}return s}function Bs(e,t,n,r,i,o,a){var l=ma(e,t,r,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,p=null,m=0;m=u||g.to<=s)){var x=g.level!=1,T=qt(e,r,x?Math.min(u,g.to)-1:Math.max(s,g.from)).right,A=TA)&&(d=g,p=A)}}return d||(d=i[i.length-1]),d.fromu&&(d={from:d.from,to:u,level:d.level}),d}var Cr;function qr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Cr==null){Cr=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Cr.appendChild(document.createTextNode("x")),Cr.appendChild(c("br"));Cr.appendChild(document.createTextNode("x"))}R(e.measure,Cr);var n=Cr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),C(e.measure),n||1}function Xr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),n=c("pre",[t],"CodeMirror-line-like");R(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Zi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:Ji(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ji(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ba(e){var t=qr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Xr(e.display)-3);return function(i){if(dr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(u=q(e.doc,s.line).text).length==s.ch){var d=ke(u,u.length,e.options.tabSize)-u.length;s=w(s.line,Math.max(0,Math.round((o-aa(e.display).left)/Xr(e.display))-d))}return s}function Tr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)$t&&Ii(e.doc,t)i.viewFrom?pr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)pr(e);else if(t<=i.viewFrom){var o=ii(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):pr(e)}else if(n>=i.viewTo){var a=ii(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):pr(e)}else{var l=ii(e,t,t,-1),s=ii(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(ei(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):pr(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Tr(e,t)];if(o.node!=null){var a=o.changes||(o.changes=[]);V(a,n)==-1&&a.push(n)}}}function pr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ii(e,t,n,r){var i=Tr(e,t),o,a=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(i==a.length-1)return null;o=l+a[i].size-t,i++}else o=l-t;t+=o,n+=o}for(;Ii(e.doc,n)!=n;){if(i==(r<0?0:a.length-1))return null;n+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Rs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=ei(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=ei(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Tr(e,n)))),r.viewTo=n}function wa(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(c("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function oi(e,t){return e.top-t.top||e.left-t.left}function _s(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=aa(e.display),l=a.left,s=Math.max(r.sizerWidth,Sr(e)-r.sizer.offsetLeft)-a.right,u=i.direction=="ltr";function d(H,_,ne,Q){_<0&&(_=0),_=Math.round(_),Q=Math.round(Q),o.appendChild(c("div",null,"CodeMirror-selected","position: absolute; left: "+H+`px; top: `+_+"px; width: "+(ne==null?s-H:ne)+`px; height: `+(Q-_)+"px"))}function p(H,_,ne){var Q=q(i,H),pe=Q.text.length,We,Qe;function Fe(Ge,mt){return ni(e,w(H,Ge),"div",Q,mt)}function kt(Ge,mt,tt){var Xe=ya(e,Q,null,Ge),qe=mt=="ltr"==(tt=="after")?"left":"right",_e=tt=="after"?Xe.begin:Xe.end-(/\s/.test(Q.text.charAt(Xe.end-1))?2:1);return Fe(_e,qe)[qe]}var gt=ye(Q,i.direction);return ar(gt,_||0,ne==null?pe:ne,function(Ge,mt,tt,Xe){var qe=tt=="ltr",_e=Fe(Ge,qe?"left":"right"),yt=Fe(mt-1,qe?"right":"left"),ln=_==null&&Ge==0,wr=ne==null&&mt==pe,at=Xe==0,Xt=!gt||Xe==gt.length-1;if(yt.top-_e.top<=3){var $e=(u?ln:wr)&&at,To=(u?wr:ln)&&Xt,ir=$e?l:(qe?_e:yt).left,Dr=To?s:(qe?yt:_e).right;d(ir,_e.top,Dr-ir,_e.bottom)}else{var Pr,ut,sn,Mo;qe?(Pr=u&&ln&&at?l:_e.left,ut=u?s:kt(Ge,tt,"before"),sn=u?l:kt(mt,tt,"after"),Mo=u&&wr&&Xt?s:yt.right):(Pr=u?kt(Ge,tt,"before"):l,ut=!u&&ln&&at?s:_e.right,sn=!u&&wr&&Xt?l:yt.left,Mo=u?kt(mt,tt,"after"):s),d(Pr,_e.top,ut-Pr,_e.bottom),_e.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Yr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ka(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||to(e))}function eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Yr(e))},100)}function to(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ie(e,"focus",e,t),e.state.focused=!0,He(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),K&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),$i(e))}function Yr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ie(e,"blur",e,t),e.state.focused=!1,Te(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ai(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,a=0;a.005||g<-.005)&&(ie.display.sizerWidth){var T=Math.ceil(d/Xr(e.display));T>e.display.maxLineLength&&(e.display.maxLineLength=T,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function Sa(e){if(e.widgets)for(var t=0;t=a&&(o=h(t,er(q(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Ks(e,t){if(!Be(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!ge){var a=c("div","​",null,`position: absolute; top: `+(t.top-n.viewOffset-ti(e.display))+`px; height: `+(t.bottom-t.top+Gt(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function js(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?w(t.line,t.ch+1,"before"):t,t=t.ch?w(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=It(e,t),s=!n||n==t?l:It(e,n);i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r};var u=ro(e,i),d=e.doc.scrollTop,p=e.doc.scrollLeft;if(u.scrollTop!=null&&(Sn(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(a=!0)),u.scrollLeft!=null&&(Mr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(a=!0)),!a)break}return i}function Us(e,t){var n=ro(e,t);n.scrollTop!=null&&Sn(e,n.scrollTop),n.scrollLeft!=null&&Mr(e,n.scrollLeft)}function ro(e,t){var n=e.display,r=qr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=ji(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ki(n),s=t.topl-r;if(t.topi+o){var d=Math.min(t.top,(u?l:t.bottom)-o);d!=i&&(a.scrollTop=d)}var p=e.options.fixedGutter?0:n.gutters.offsetWidth,m=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-p,g=Sr(e)-n.gutters.offsetWidth,x=t.right-t.left>g;return x&&(t.right=t.left+g),t.left<10?a.scrollLeft=0:t.leftg+m-3&&(a.scrollLeft=t.right+(x?0:10)-g),a}function no(e,t){t!=null&&(si(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Zr(e){si(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function kn(e,t,n){(t!=null||n!=null)&&si(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Gs(e,t){si(e),e.curOp.scrollToPos=t}function si(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ga(e,t.from),r=ga(e,t.to);Ca(e,n,r,t.margin)}}function Ca(e,t,n,r){var i=ro(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});kn(e,i.scrollLeft,i.scrollTop)}function Sn(e,t){Math.abs(e.doc.scrollTop-t)<2||($||oo(e,{top:t}),La(e,t,!0),$&&oo(e),Tn(e,100))}function La(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Mr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Aa(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Cn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ki(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Gt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Nr=function(e,t,n){this.cm=n;var r=this.vert=c("div",[c("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=c("div",[c("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),re(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),re(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,P&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Nr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Nr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Nr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Nr.prototype.zeroWidthHack=function(){var e=ee&&!Le?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new de,this.disableVert=new de},Nr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Nr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ln=function(){};Ln.prototype.update=function(){return{bottom:0,right:0}},Ln.prototype.setScrollLeft=function(){},Ln.prototype.setScrollTop=function(){},Ln.prototype.clear=function(){};function Jr(e,t){t||(t=Cn(e));var n=e.display.barWidth,r=e.display.barHeight;Ta(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ai(e),Ta(e,Cn(e)),n=e.display.barWidth,r=e.display.barHeight}function Ta(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ma={native:Nr,null:Ln};function Na(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Te(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ma[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),re(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Mr(e,t):Sn(e,t)},e),e.display.scrollbars.addClass&&He(e.display.wrapper,e.display.scrollbars.addClass)}var qs=0;function Or(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++qs,markArrays:null},Ss(e.curOp)}function Ar(e){var t=e.curOp;t&&Ls(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Zs(e){e.updatedDisplay=e.mustUpdate&&io(e.cm,e.update)}function Js(e){var t=e.cm,n=t.display;e.updatedDisplay&&ai(t),e.barMeasure=Cn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=sa(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Gt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Sr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Vs(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=vn(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?jt(t.mode,r.state):null,s=Ho(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var u=o.styleClasses,d=s.classes;d?o.styleClasses=d:u&&(o.styleClasses=null);for(var p=!a||a.length!=o.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),m=0;!p&&mn)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&xt(e,function(){for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&wa(e)==0)return!1;Da(e)&&(pr(e),t.dims=Zi(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),$t&&(o=Ii(e.doc,o),a=Jo(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Rs(e,o,a),n.viewOffset=er(q(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=wa(e);if(!l&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var u=tu(e);return s>4&&(n.lineDiv.style.display="none"),nu(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ru(u),C(n.cursorDiv),C(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Tn(e,400)),n.updateLineNumbers=null,!0}function Oa(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Sr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ki(e.display)-ji(e),n.top)}),t.visible=li(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=li(e.display,e.doc,n));if(!io(e,t))break;ai(e);var i=Cn(e);xn(e),Jr(e,i),lo(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function oo(e,t){var n=new ui(e,t);if(io(e,n)){ai(e),Oa(e,n);var r=Cn(e);xn(e),Jr(e,r),lo(e,r),n.finish()}}function nu(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(x){var T=x.nextSibling;return K&&ee&&e.display.currentWheelTarget==x?x.style.display="none":x.parentNode.removeChild(x),T}for(var s=r.view,u=r.viewFrom,d=0;d-1&&(g=!1),ta(e,p,u,n)),g&&(C(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(O(e.options,u)))),a=p.node.nextSibling}u+=p.size}for(;a;)a=l(a)}function ao(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Ze(e,"gutterChanged",e)}function lo(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Gt(e)+"px"}function Aa(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ji(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),P&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!K&&!($&&W)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=so(r.gutters,r.lineNumbers),Pa(i),n.init(i)}var fi=0,rr=null;P?rr=-.53:$?rr=15:j?rr=-.7:Ce&&(rr=-1/3);function Wa(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function ou(e){var t=Wa(e);return t.x*=rr,t.y*=rr,t}function Ea(e,t){j&&ue==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=Wa(t),r=n.x,i=n.y,o=rr;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var a=e.display,l=a.scroller,s=l.scrollWidth>l.clientWidth,u=l.scrollHeight>l.clientHeight;if(r&&s||i&&u){if(i&&ee&&K){e:for(var d=t.target,p=a.view;d!=l;d=d.parentNode)for(var m=0;m=0&&I(e,r.to())<=0)return n}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return Kr(this.anchor,this.head)},Ae.prototype.to=function(){return ht(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Bt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(m,g){return I(m.from(),g.from())}),n=V(t,i);for(var o=1;o0:s>=0){var u=Kr(l.from(),a.from()),d=ht(l.to(),a.to()),p=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Ae(p?d:u,p?u:d))}}return new Tt(t,n)}function vr(e,t){return new Tt([new Ae(e,t||e)],0)}function gr(e){return e.text?w(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function za(e,t){if(I(e,t.from)<0)return e;if(I(e,t.to)<=0)return gr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=gr(t).ch-t.to.ch),w(n,r)}function uo(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,x-1),e.insert(l.line+1,z)}Ze(e,"change",e,t)}function mr(e,t,n){function r(i,o,a){if(i.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function _a(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,a,l;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=su(i,i.lastOp==r)))l=be(a.changes),I(t.from,t.to)==0&&I(t.from,l.to)==0?l.to=gr(t):a.changes.push(ho(e,t));else{var s=be(i.done);for((!s||!s.ranges)&&di(e.sel,i.done),a={changes:[ho(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Ie(e,"historyAdded")}function uu(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function fu(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||uu(e,o,be(i.done),t))?i.done[i.done.length-1]=t:di(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ra(i.undone)}function di(e,t){var n=be(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Ka(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=a.markedSpans),++o})}function cu(e){if(!e)return null;for(var t,n=0;n-1&&(be(l)[p]=u[p],delete u[p])}}return r}function po(e,t,n,r){if(r){var i=e.anchor;if(n){var o=I(t,i)<0;o!=I(n,i)<0?(i=t,t=n):o!=I(t,n)<0&&(t=n)}return new Ae(i,t)}else return new Ae(n||t,t)}function hi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ot(e,new Tt([po(e.sel.primary(),t,n,i)],0),r)}function Ua(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(Ie(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(n){var p=s.find(r<0?1:-1),m=void 0;if((r<0?d:u)&&(p=Ja(e,p,-r,p&&p.line==t.line?o:null)),p&&p.line==t.line&&(m=I(p,n))&&(r<0?m<0:m>0))return Qr(e,p,t,r,i)}var g=s.find(r<0?-1:1);return(r<0?u:d)&&(g=Ja(e,g,r,g.line==t.line?o:null)),g?Qr(e,g,t,r,i):null}}return t}function vi(e,t,n,r,i){var o=r||1,a=Qr(e,t,n,o,i)||!i&&Qr(e,t,n,o,!0)||Qr(e,t,n,-o,i)||!i&&Qr(e,t,n,-o,!0);return a||(e.cantEdit=!0,w(e.first,0))}function Ja(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?fe(e,w(t.line-1)):null:n>0&&t.ch==(r||q(e,t.line)).text.length?t.line=0;--i)$a(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $a(e,t)}}function $a(e,t){if(!(t.text.length==1&&t.text[0]==""&&I(t.from,t.to)==0)){var n=uo(e,t);_a(e,t,n,e.cm?e.cm.curOp.id:NaN),On(e,t,n,Hi(e,t));var r=[];mr(e,function(i,o){!o&&V(r,i.history)==-1&&(nl(i.history,t),r.push(i.history)),On(i,t,null,Hi(i,t))})}}function gi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,a=e.sel,l=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,u=0;u=0;--g){var x=m(g);if(x)return x.v}}}}function el(e,t){if(t!=0&&(e.first+=t,e.sel=new Tt(Pe(e.sel.ranges,function(i){return new Ae(w(i.anchor.line+t,i.anchor.ch),w(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){pt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:w(o,q(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Qt(e,t.from,t.to),n||(n=uo(e,t)),e.cm?pu(e.cm,t,r):co(e,t,r),pi(e,n,ft),e.cantEdit&&vi(e,w(e.firstLine(),0))&&(e.cantEdit=!1)}}function pu(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=f(Ft(q(r,o.line))),r.iter(s,a.line+1,function(g){if(g==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Nt(e),co(r,t,n,ba(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(g){var x=$n(g);x>i.maxLineLength&&(i.maxLine=g,i.maxLineLength=x,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),ns(r,o.line),Tn(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?pt(e):o.line==a.line&&t.text.length==1&&!Fa(e.doc,t)?hr(e,o.line,"text"):pt(e,o.line,a.line+1,u);var d=wt(e,"changes"),p=wt(e,"change");if(p||d){var m={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};p&&Ze(e,"change",e,m),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(m)}e.display.selForContextMenu=null}function en(e,t,n,r,i){var o;r||(r=n),I(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),$r(e,{from:n,to:r,text:t,origin:i})}function tl(e,t,n,r){n1||!(this.children[0]instanceof Dn))){var l=[];this.collapse(l),this.children=[new Dn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=d,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&pt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ya(e.doc)),e&&Ze(e,"markerCleared",e,this,r,i),t&&Ar(e),this.parent&&this.parent.clear()}},yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||a==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=F("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Zo(e,t.line,t,n,o)||t.line!=n.line&&Zo(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");os()}o.addToHistory&&_a(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,u;if(e.iter(l,n.line+1,function(p){s&&o.collapsed&&!s.options.lineWrapping&&Ft(p)==s.display.maxLine&&(u=!0),o.collapsed&&l!=t.line&&Lt(p,0),ls(p,new Zn(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(p){dr(e,p)&&Lt(p,0)}),o.clearOnEnter&&re(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(is(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ol,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)pt(s,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var d=t.line;d<=n.line;d++)hr(s,d,"text");o.atomic&&Ya(s.doc),Ze(s,"markerAdded",s,o)}return o}var En=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)$r(this,r[s]);l?qa(this,l):this.cm&&Zr(this.cm)}),undo:Ve(function(){gi(this,"undo")}),redo:Ve(function(){gi(this,"redo")}),undoSelection:Ve(function(){gi(this,"undo",!0)}),redoSelection:Ve(function(){gi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=fe(this,e),t=fe(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!n||n(s.marker))&&r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),fe(this,w(n,t))},indexFromPos:function(e){e=fe(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var d=e.dataTransfer.getData("Text");if(d){var p;if(t.state.draggingText&&!t.state.draggingText.copy&&(p=t.listSelections()),pi(t.doc,vr(n,n)),p)for(var m=0;m=0;l--)en(e.doc,"",r[l].from,r[l].to,"+delete");Zr(e)})}function go(e,t,n){var r=or(e.text,t+n,n);return r<0||r>e.text.length?null:r}function mo(e,t,n){var r=go(e,t.ch,n);return r==null?null:new w(t.line,r,n<0?"after":"before")}function yo(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=ye(n,t.doc.direction);if(o){var a=i<0?be(o):o[0],l=i<0==(a.level==1),s=l?"after":"before",u;if(a.level>0||t.doc.direction=="rtl"){var d=Gr(t,n);u=i<0?n.text.length-1:0;var p=qt(t,d,u).top;u=Kt(function(m){return qt(t,d,m).top==p},i<0==(a.level==1)?a.from:a.to-1,u),s=="before"&&(u=go(n,u,1))}else u=i<0?a.to:a.from;return new w(r,u,s)}}return new w(r,i<0?n.text.length:0,i<0?"before":"after")}function Nu(e,t,n,r){var i=ye(t,e.doc.direction);if(!i)return mo(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=lr(i,n.ch,n.sticky),a=i[o];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&m>=d.begin)){var g=p?"before":"after";return new w(n.line,m,g)}}var x=function(z,B,H){for(var _=function(We,Qe){return Qe?new w(n.line,l(We,1),"before"):new w(n.line,We,"after")};z>=0&&z0==(ne.level!=1),pe=Q?H.begin:l(H.end,-1);if(ne.from<=pe&&pe0?d.end:l(d.begin,-1);return A!=null&&!(r>0&&A==t.text.length)&&(T=x(r>0?0:i.length-1,r,u(A)),T)?T:null}var Fn={selectAll:Va,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ft)},killLine:function(e){return nn(e,function(t){if(t.empty()){var n=q(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new w(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),w(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=q(e.doc,i.line-1).text;a&&(i=new w(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),w(i.line-1,a.length-1),i,"+transpose"))}}n.push(new Ae(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return xt(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&I(t,this.pos)==0&&n==this.button};var Bn,Rn;function zu(e,t){var n=+new Date;return Rn&&Rn.compare(n,e,t)?(Bn=Rn=null,"triple"):Bn&&Bn.compare(n,e,t)?(Rn=new wo(n,e,t),Bn=null,"double"):(Bn=new wo(n,e,t),Rn=null,"single")}function xl(e){var t=this,n=t.display;if(!(Be(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,tr(n,e)){K||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!xo(t,e)){var r=Lr(t,e),i=Wt(e),o=r?zu(r,i):"single";se(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Hu(t,i,r,o,e))&&(i==1?r?Iu(t,r,o,e):cn(e)==n.scroller&&it(e):i==2?(r&&hi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(ie?t.display.input.onContextMenu(e):eo(t)))}}}function Hu(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,In(e,dl(o,i),i,function(a){if(typeof a=="string"&&(a=Fn[a]),!a)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=a(e,n)!=Dt}finally{e.state.suppressEdits=!1}return l})}function Fu(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=ce?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=ee?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(ee?n.altKey:n.ctrlKey)),i}function Iu(e,t,n,r){P?setTimeout(le(ka,e),0):e.curOp.focus=xe(bt(e));var i=Fu(e,n,r),o=e.doc.sel,a;e.options.dragDrop&&Pi&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(I((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(I(a.to(),t)>0||t.xRel<0)?Bu(e,r,t,i):Ru(e,r,t,i)}function Bu(e,t,n,r){var i=e.display,o=!1,a=Je(e,function(u){K&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:eo(e)),nt(i.wrapper.ownerDocument,"mouseup",a),nt(i.wrapper.ownerDocument,"mousemove",l),nt(i.scroller,"dragstart",s),nt(i.scroller,"drop",a),o||(it(u),r.addNew||hi(e.doc,n,null,null,r.extend),K&&!Ce||P&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),l=function(u){o=o||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return o=!0};K&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,re(i.wrapper.ownerDocument,"mouseup",a),re(i.wrapper.ownerDocument,"mousemove",l),re(i.scroller,"dragstart",s),re(i.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function kl(e,t,n){if(n=="char")return new Ae(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ae(w(t.line,0),fe(e.doc,w(t.line+1,0)));var r=n(e,t);return new Ae(r.from,r.to)}function Ru(e,t,n,r){P&&eo(e);var i=e.display,o=e.doc;it(t);var a,l,s=o.sel,u=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),l>-1?a=u[l]:a=new Ae(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new Ae(n,n)),n=Lr(e,t,!0,!0),l=-1;else{var d=kl(e,n,r.unit);r.extend?a=po(a,d.anchor,d.head,r.extend):a=d}r.addNew?l==-1?(l=u.length,ot(o,Bt(e,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&r.unit=="char"&&!r.extend?(ot(o,Bt(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):vo(o,l,a,St):(l=0,ot(o,new Tt([a],0),St),s=o.sel);var p=n;function m(H){if(I(p,H)!=0)if(p=H,r.unit=="rectangle"){for(var _=[],ne=e.options.tabSize,Q=ke(q(o,n.line).text,n.ch,ne),pe=ke(q(o,H.line).text,H.ch,ne),We=Math.min(Q,pe),Qe=Math.max(Q,pe),Fe=Math.min(n.line,H.line),kt=Math.min(e.lastLine(),Math.max(n.line,H.line));Fe<=kt;Fe++){var gt=q(o,Fe).text,Ge=je(gt,We,ne);We==Qe?_.push(new Ae(w(Fe,Ge),w(Fe,Ge))):gt.length>Ge&&_.push(new Ae(w(Fe,Ge),w(Fe,je(gt,Qe,ne))))}_.length||_.push(new Ae(n,n)),ot(o,Bt(e,s.ranges.slice(0,l).concat(_),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(H)}else{var mt=a,tt=kl(e,H,r.unit),Xe=mt.anchor,qe;I(tt.anchor,Xe)>0?(qe=tt.head,Xe=Kr(mt.from(),tt.anchor)):(qe=tt.anchor,Xe=ht(mt.to(),tt.head));var _e=s.ranges.slice(0);_e[l]=_u(e,new Ae(fe(o,Xe),qe)),ot(o,Bt(e,_e,l),St)}}var g=i.wrapper.getBoundingClientRect(),x=0;function T(H){var _=++x,ne=Lr(e,H,!0,r.unit=="rectangle");if(ne)if(I(ne,p)!=0){e.curOp.focus=xe(bt(e)),m(ne);var Q=li(i,o);(ne.line>=Q.to||ne.lineg.bottom?20:0;pe&&setTimeout(Je(e,function(){x==_&&(i.scroller.scrollTop+=pe,T(H))}),50)}}function A(H){e.state.selectingText=!1,x=1/0,H&&(it(H),i.input.focus()),nt(i.wrapper.ownerDocument,"mousemove",z),nt(i.wrapper.ownerDocument,"mouseup",B),o.history.lastSelOrigin=null}var z=Je(e,function(H){H.buttons===0||!Wt(H)?A(H):T(H)}),B=Je(e,A);e.state.selectingText=B,re(i.wrapper.ownerDocument,"mousemove",z),re(i.wrapper.ownerDocument,"mouseup",B)}function _u(e,t){var n=t.anchor,r=t.head,i=q(e.doc,n.line);if(I(n,r)==0&&n.sticky==r.sticky)return t;var o=ye(i);if(!o)return t;var a=lr(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s=a+(l.from==n.ch==(l.level!=1)?0:1);if(s==0||s==o.length)return t;var u;if(r.line!=n.line)u=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var d=lr(o,r.ch,r.sticky),p=d-a||(r.ch-n.ch)*(l.level==1?-1:1);d==s-1||d==s?u=p<0:u=p>0}var m=o[s+(u?-1:0)],g=u==(m.level==1),x=g?m.from:m.to,T=g?"after":"before";return n.ch==x&&n.sticky==T?t:new Ae(new w(n.line,x,T),r)}function Sl(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(m){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&it(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!wt(e,n))return dt(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var d=h(e.doc,o),p=e.display.gutterSpecs[s];return Ie(e,n,e,d,p.className,t),dt(t)}}}function xo(e,t){return Sl(e,t,"gutterClick",!0)}function Cl(e,t){tr(e.display,t)||Ku(e,t)||Be(e,t,"contextmenu")||ie||e.display.input.onContextMenu(t)}function Ku(e,t){return wt(e,"gutterContextMenu")?Sl(e,t,"gutterContextMenu",!1):!1}function Ll(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wn(e)}var on={toString:function(){return"CodeMirror.Init"}},Tl={},wi={};function ju(e){var t=e.optionHandlers;function n(r,i,o,a){e.defaults[r]=i,o&&(t[r]=a?function(l,s,u){u!=on&&o(l,s,u)}:o)}e.defineOption=n,e.Init=on,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,fo(r)},!0),n("indentUnit",2,fo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Nn(r),wn(r),pt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],a=r.doc.first;r.doc.iter(function(s){for(var u=0;;){var d=s.text.indexOf(i,u);if(d==-1)break;u=d+i.length,o.push(w(a,d))}a++});for(var l=o.length-1;l>=0;l--)en(r.doc,i,o[l],w(o[l].line,o[l].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=on&&r.refresh()}),n("specialCharPlaceholder",ys,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",W?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!we),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ll(r),Mn(r)},!0),n("keyMap","default",function(r,i,o){var a=yi(i),l=o!=on&&yi(o);l&&l.detach&&l.detach(r,a),a.attach&&a.attach(r,l||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Gu,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=so(i,r.options.lineNumbers),Mn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ji(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Jr(r)},!0),n("scrollbarStyle","native",function(r){Na(r),Jr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=so(r.options.gutters,i),Mn(r)},!0),n("firstLineNumber",1,Mn,!0),n("lineNumberFormatter",function(r){return r},Mn,!0),n("showCursorWhenSelecting",!1,xn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Yr(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Uu),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,xn,!0),n("singleCursorHeightPerLine",!0,xn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Nn,!0),n("addModeClass",!1,Nn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Nn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Uu(e,t,n){var r=n&&n!=on;if(!t!=!r){var i=e.display.dragFunctions,o=t?re:nt;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Gu(e){e.options.lineWrapping?(He(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Te(e.display.wrapper,"CodeMirror-wrap"),Ri(e)),Vi(e),pt(e),wn(e),setTimeout(function(){return Jr(e)},100)}function ze(e,t){var n=this;if(!(this instanceof ze))return new ze(e,t);this.options=t=t?he(t):{},he(Tl,t,!1);var r=t.value;typeof r=="string"?r=new vt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new ze.inputStyles[t.inputStyle](this),o=this.display=new iu(e,r,i,t);o.wrapper.CodeMirror=this,Ll(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Na(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new de,keySeq:null,specialChars:null},t.autofocus&&!W&&o.input.focus(),P&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),qu(this),Su(),Or(this),this.curOp.forceUpdate=!0,Ia(this,r),t.autofocus&&!W||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&to(n)},20):Yr(this);for(var a in wi)wi.hasOwnProperty(a)&&wi[a](this,t[a],on);Da(this),t.finishInit&&t.finishInit(this);for(var l=0;l20*20}re(t.scroller,"touchstart",function(s){if(!Be(e,s)&&!o(s)&&!xo(e,s)){t.input.ensurePolled(),clearTimeout(n);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),re(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!tr(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var d=e.coordsChar(t.activeTouch,"page"),p;!u.prev||a(u,u.prev)?p=new Ae(d,d):!u.prev.prev||a(u,u.prev.prev)?p=e.findWordAt(d):p=new Ae(w(d.line,0),fe(e.doc,w(d.line+1,0))),e.setSelection(p.anchor,p.head),e.focus(),it(s)}i()}),re(t.scroller,"touchcancel",i),re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Sn(e,t.scroller.scrollTop),Mr(e,t.scroller.scrollLeft,!0),Ie(e,"scroll",e))}),re(t.scroller,"mousewheel",function(s){return Ea(e,s)}),re(t.scroller,"DOMMouseScroll",function(s){return Ea(e,s)}),re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){Be(e,s)||sr(s)},over:function(s){Be(e,s)||(ku(e,s),sr(s))},start:function(s){return xu(e,s)},drop:Je(e,wu),leave:function(s){Be(e,s)||sl(e)}};var l=t.input.getField();re(l,"keyup",function(s){return bl.call(e,s)}),re(l,"keydown",Je(e,yl)),re(l,"keypress",Je(e,wl)),re(l,"focus",function(s){return to(e,s)}),re(l,"blur",function(s){return Yr(e,s)})}var ko=[];ze.defineInitHook=function(e){return ko.push(e)};function _n(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=vn(e,t).state:n="prev");var a=e.options.tabSize,l=q(i,t),s=ke(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],d;if(!r&&!/\S/.test(l.text))d=0,n="not";else if(n=="smart"&&(d=i.mode.indent(o,l.text.slice(u.length),l.text),d==Dt||d>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?d=ke(q(i,t-1).text,null,a):d=0:n=="add"?d=s+e.options.indentUnit:n=="subtract"?d=s-e.options.indentUnit:typeof n=="number"&&(d=s+n),d=Math.max(0,d);var p="",m=0;if(e.options.indentWithTabs)for(var g=Math.floor(d/a);g;--g)m+=a,p+=" ";if(ma,s=Ot(t),u=null;if(l&&r.ranges.length>1)if(Rt&&Rt.text.join(` `)==t){if(r.ranges.length%Rt.text.length==0){u=[];for(var d=0;d=0;m--){var g=r.ranges[m],x=g.from(),T=g.to();g.empty()&&(n&&n>0?x=w(x.line,x.ch-n):e.state.overwrite&&!l?T=w(T.line,Math.min(q(o,T.line).text.length,T.ch+be(s).length)):l&&Rt&&Rt.lineWise&&Rt.text.join(` `)==s.join(` `)&&(x=T=w(x.line,0)));var A={from:x,to:T,text:u?u[m%u.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};$r(e.doc,A),Ze(e,"inputRead",e,A)}t&&!l&&Nl(e,t),Zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ml(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&xt(t,function(){return So(t,n,0,null,"paste")}),!0}function Nl(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=_n(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(q(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=_n(e,i.head.line,"smart"));a&&Ze(e,"electricInput",e,i.head.line)}}}function Ol(e){for(var t=[],n=[],r=0;ro&&(_n(this,l.head.line,r,!0),o=l.head.line,a==this.doc.sel.primIndex&&Zr(this));else{var s=l.from(),u=l.to(),d=Math.max(o,s.line);o=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var p=d;p0&&vo(this.doc,a,new Ae(s,m[a].to()),ft)}}}),getTokenAt:function(r,i){return Ro(this,r,i)},getLineTokens:function(r,i){return Ro(this,w(r),i,!0)},getTokenTypeAt:function(r){r=fe(this.doc,r);var i=Fo(this,q(this.doc,r.line)),o=0,a=(i.length-1)/2,l=r.ch,s;if(l==0)s=i[2];else for(;;){var u=o+a>>1;if((u?i[u*2-1]:0)>=l)a=u;else if(i[u*2+1]s&&(r=s,a=!0),l=q(this.doc,r)}else l=r;return ri(this,l,{top:0,left:0},i||"page",o||a).top+(a?this.doc.height-er(l):0)},defaultTextHeight:function(){return qr(this.display)},defaultCharWidth:function(){return Xr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,a,l){var s=this.display;r=It(this,fe(this.doc,r));var u=r.bottom,d=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),a=="over")u=r.top;else if(a=="above"||a=="near"){var p=Math.max(s.wrapper.clientHeight,this.doc.height),m=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+i.offsetHeight>p)&&r.top>i.offsetHeight?u=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=p&&(u=r.bottom),d+i.offsetWidth>m&&(d=m-i.offsetWidth)}i.style.top=u+"px",i.style.left=i.style.right="",l=="right"?(d=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(l=="left"?d=0:l=="middle"&&(d=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=d+"px"),o&&Us(this,{left:d,top:u,right:d+i.offsetWidth,bottom:u+i.offsetHeight})},triggerOnKeyDown:st(yl),triggerOnKeyPress:st(wl),triggerOnKeyUp:bl,triggerOnMouseDown:st(xl),execCommand:function(r){if(Fn.hasOwnProperty(r))return Fn[r].call(null,this)},triggerElectric:st(function(r){Nl(this,r)}),findPosH:function(r,i,o,a){var l=1;i<0&&(l=-1,i=-i);for(var s=fe(this.doc,r),u=0;u0&&d(o.charAt(a-1));)--a;for(;l.5||this.options.lineWrapping)&&Vi(this),Ie(this,"refresh",this)}),swapDoc:st(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Ia(this,r),wn(this),this.display.input.reset(),kn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ze(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Pt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,a){e.registerHelper(r,i,a),n[r]._global.push({pred:o,val:a})}}function Lo(e,t,n,r,i){var o=t,a=n,l=q(e,t.line),s=i&&e.direction=="rtl"?-n:n;function u(){var B=t.line+s;return B=e.first+e.size?!1:(t=new w(B,t.ch,t.sticky),l=q(e,B))}function d(B){var H;if(r=="codepoint"){var _=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(_))H=null;else{var ne=n>0?_>=55296&&_<56320:_>=56320&&_<57343;H=new w(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(ne?2:1))),-n)}}else i?H=Nu(e.cm,l,t,n):H=mo(l,t,n);if(H==null)if(!B&&u())t=yo(i,e.cm,l,t.line,s);else return!1;else t=H;return!0}if(r=="char"||r=="codepoint")d();else if(r=="column")d(!0);else if(r=="word"||r=="group")for(var p=null,m=r=="group",g=e.cm&&e.cm.getHelper(t,"wordChars"),x=!0;!(n<0&&!d(!x));x=!1){var T=l.text.charAt(t.ch)||` `,A=Zt(T,g)?"w":m&&T==` `?"n":!m||/\s/.test(T)?null:"p";if(m&&!x&&!A&&(A="s"),p&&p!=A){n<0&&(n=1,d(),t.sticky="after");break}if(A&&(p=A),n>0&&!d(!x))break}var z=vi(e,t,o,a,!0);return Oe(o,z)&&(z.hitSide=!0),z}function Dl(e,t,n,r){var i=e.doc,o=t.left,a;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,se(e).innerHeight||i(e).documentElement.clientHeight),s=Math.max(l-.5*qr(e.display),3);a=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(a=n>0?t.bottom+3:t.top-3);for(var u;u=Xi(e,o,a),!!u.outside;){if(n<0?a<=0:a>=i.height){u.hitSide=!0;break}a+=n*5}return u}var De=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new de,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};De.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,Co(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var s=l.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}re(i,"paste",function(l){!o(l)||Be(r,l)||Ml(l,r)||U<=11&&setTimeout(Je(r,function(){return t.updateFromDOM()}),20)}),re(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),re(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),re(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),re(i,"touchstart",function(){return n.forceCompositionEnd()}),re(i,"input",function(){t.composing||t.readFromDOMSoon()});function a(l){if(!(!o(l)||Be(r,l))){if(r.somethingSelected())xi({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=Ol(r);xi({lineWise:!0,text:s.text}),l.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ft),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var u=Rt.text.join(` `);if(l.clipboardData.setData("Text",u),l.clipboardData.getData("Text")==u){l.preventDefault();return}}var d=Al(),p=d.firstChild;Co(p),r.display.lineSpace.insertBefore(d,r.display.lineSpace.firstChild),p.value=Rt.text.join(` `);var m=xe(Ee(i));Yt(p),setTimeout(function(){r.display.lineSpace.removeChild(d),m.focus(),m==i&&n.showPrimarySelection()},50)}}re(i,"copy",a),re(i,"cut",a)},De.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},De.prototype.prepareSelection=function(){var e=xa(this.cm,!1);return e.focus=xe(Ee(this.div))==this.div,e},De.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},De.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},De.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Pl(t,r)||{node:l[0].measure.map[2],offset:0},u=i.linee.firstLine()&&(r=w(r.line-1,q(e.doc,r.line-1).length)),i.ch==q(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,l;r.line==t.viewFrom||(o=Tr(e,r.line))==0?(a=f(t.view[0].line),l=t.view[0].node):(a=f(t.view[o].line),l=t.view[o-1].node.nextSibling);var s=Tr(e,i.line),u,d;if(s==t.view.length-1?(u=t.viewTo-1,d=t.lineDiv.lastChild):(u=f(t.view[s+1].line)-1,d=t.view[s+1].node.previousSibling),!l)return!1;for(var p=e.doc.splitLines(Zu(e,l,d,a,u)),m=Qt(e.doc,w(a,0),w(u,q(e.doc,u).text.length));p.length>1&&m.length>1;)if(be(p)==be(m))p.pop(),m.pop(),u--;else if(p[0]==m[0])p.shift(),m.shift(),a++;else break;for(var g=0,x=0,T=p[0],A=m[0],z=Math.min(T.length,A.length);gr.ch&&B.charCodeAt(B.length-x-1)==H.charCodeAt(H.length-x-1);)g--,x++;p[p.length-1]=B.slice(0,B.length-x).replace(/^\u200b+/,""),p[0]=p[0].slice(g).replace(/\u200b+$/,"");var ne=w(a,g),Q=w(u,m.length?be(m).length-x:0);if(p.length>1||p[0]||I(ne,Q))return en(e.doc,p,ne,Q,"+input"),!0},De.prototype.ensurePolled=function(){this.forceCompositionEnd()},De.prototype.reset=function(){this.forceCompositionEnd()},De.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},De.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},De.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&xt(this.cm,function(){return pt(e.cm)})},De.prototype.setUneditable=function(e){e.contentEditable="false"},De.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Je(this.cm,So)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},De.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},De.prototype.onContextMenu=function(){},De.prototype.resetPosition=function(){},De.prototype.needsContentAttribute=!0;function Pl(e,t){var n=Ui(e,t.line);if(!n||n.hidden)return null;var r=q(e.doc,t.line),i=la(n,r,t.line),o=ye(r,e.doc.direction),a="left";if(o){var l=lr(o,t.ch);a=l%2?"right":"left"}var s=fa(i.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Yu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function an(e,t){return t&&(e.bad=!0),e}function Zu(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function u(g){return function(x){return x.id==g}}function d(){a&&(o+=l,s&&(o+=l),a=s=!1)}function p(g){g&&(d(),o+=g)}function m(g){if(g.nodeType==1){var x=g.getAttribute("cm-text");if(x){p(x);return}var T=g.getAttribute("cm-marker"),A;if(T){var z=e.findMarks(w(r,0),w(i+1,0),u(+T));z.length&&(A=z[0].find(0))&&p(Qt(e.doc,A.from,A.to).join(l));return}if(g.getAttribute("contenteditable")=="false")return;var B=/^(pre|div|p|li|table|br)$/i.test(g.nodeName);if(!/^br$/i.test(g.nodeName)&&g.textContent.length==0)return;B&&d();for(var H=0;H=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),re(i,"paste",function(a){Be(r,a)||Ml(a,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(a){if(!Be(r,a)){if(r.somethingSelected())xi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=Ol(r);xi({lineWise:!0,text:l.text}),a.type=="cut"?r.setSelections(l.ranges,null,ft):(n.prevInput="",i.value=l.text.join(` `),Yt(i))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}re(i,"cut",o),re(i,"copy",o),re(e.scroller,"paste",function(a){if(!(tr(e,a)||Be(r,a))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var l=new Event("paste");l.clipboardData=a.clipboardData,i.dispatchEvent(l)}}),re(e.lineSpace,"selectstart",function(a){tr(e,a)||it(a)}),re(i,"compositionstart",function(){var a=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),re(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ke.prototype.createField=function(e){this.wrapper=Al(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Co(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Ke.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ke.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=xa(e);if(e.options.moveInputWithCursor){var i=It(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ke.prototype.showSelection=function(e){var t=this.cm,n=t.display;R(n.cursorDiv,e.cursors),R(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ke.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Yt(this.textarea),P&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",P&&U>=9&&(this.hasSelection=null));this.resetting=!1}},Ke.prototype.getField=function(){return this.textarea},Ke.prototype.supportsTouch=function(){return!1},Ke.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!W||xe(Ee(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},Ke.prototype.blur=function(){this.textarea.blur()},Ke.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ke.prototype.receivedFocus=function(){this.slowPoll()},Ke.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ke.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ke.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||fr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(P&&U>=9&&this.hasSelection===i||ee&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="​"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a1e3||i.indexOf(` `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ke.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ke.prototype.onKeyPress=function(){P&&U>=9&&(this.hasSelection=null),this.fastPoll()},Ke.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Lr(n,e),a=r.scroller.scrollTop;if(!o||te)return;var l=n.options.resetSelectionOnContextMenu;l&&n.doc.sel.contains(o)==-1&&Je(n,ot)(n.doc,vr(o),ft);var s=i.style.cssText,u=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+`px; z-index: 1000; background: `+(P?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var p;K&&(p=i.ownerDocument.defaultView.scrollY),r.input.focus(),K&&i.ownerDocument.defaultView.scrollTo(null,p),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=g,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function m(){if(i.selectionStart!=null){var T=n.somethingSelected(),A="​"+(T?i.value:"");i.value="⇚",i.value=A,t.prevInput=T?"":"​",i.selectionStart=1,i.selectionEnd=A.length,r.selForContextMenu=n.doc.sel}}function g(){if(t.contextMenuPending==g&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,i.style.cssText=s,P&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),i.selectionStart!=null)){(!P||P&&U<9)&&m();var T=0,A=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?Je(n,Va)(n):T++<10?r.detectingSelectAll=setTimeout(A,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(A,200)}}if(P&&U>=9&&m(),ie){sr(e);var x=function(){nt(window,"mouseup",x),setTimeout(g,20)};re(window,"mouseup",x)}else setTimeout(g,50)},Ke.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ke.prototype.setUneditable=function(){},Ke.prototype.needsContentAttribute=!1;function Vu(e,t){if(t=t?he(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=xe(Ee(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(s){}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(nt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var l=ze(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return l}function Qu(e){e.off=nt,e.on=re,e.wheelEventPixels=ou,e.Doc=vt,e.splitLines=Ot,e.countColumn=ke,e.findColumn=je,e.isWordChar=rt,e.Pass=Dt,e.signal=Ie,e.Line=jr,e.changeEnd=gr,e.scrollbarModel=Ma,e.Pos=w,e.cmpPos=I,e.modes=Fr,e.mimeModes=zt,e.resolveMode=Ir,e.getMode=Br,e.modeExtensions=cr,e.extendMode=Rr,e.copyState=jt,e.startState=_r,e.innerMode=hn,e.commands=Fn,e.keyMap=nr,e.keyName=hl,e.isModifierKey=cl,e.lookupKey=rn,e.normalizeKeyMap=Mu,e.StringStream=Re,e.SharedTextMarker=En,e.TextMarker=yr,e.LineWidget=Wn,e.e_preventDefault=it,e.e_stopPropagation=zr,e.e_stop=sr,e.addClass=He,e.contains=J,e.rmClass=Te,e.keyNames=br}ju(ze),Xu(ze);var $u="iter insert remove copy getEditor constructor".split(" ");for(var Si in vt.prototype)vt.prototype.hasOwnProperty(Si)&&V($u,Si)<0&&(ze.prototype[Si]=function(e){return function(){return e.apply(this.doc,arguments)}}(vt.prototype[Si]));return Pt(vt),ze.inputStyles={textarea:Ke,contenteditable:De},ze.defineMode=function(e){!ze.defaults.mode&&e!="null"&&(ze.defaults.mode=e),Ht.apply(this,arguments)},ze.defineMIME=kr,ze.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ze.defineMIME("text/plain","null"),ze.defineExtension=function(e,t){ze.prototype[e]=t},ze.defineDocExtension=function(e,t){vt.prototype[e]=t},ze.fromTextArea=Vu,Qu(ze),ze.version="5.65.18",ze})})(Jl);var jn=Jl.exports;const xf=pf(jn);var fn=(v=>(v.JSON="application/json",v.HTML="htmlmixed",v.JS="javascript",v))(fn||{});var kf={exports:{}};(function(v,M){(function(y){y(jn)})(function(y){y.defineMode("javascript",function(E,$){var X=E.indentUnit,ve=$.statementIndent,ae=$.jsonld,P=$.json||ae,U=$.trackScope!==!1,K=$.typescript,Y=$.wordCharacters||/[\w$\xa1-\uffff]/,j=function(){function f(Ye){return{type:Ye,style:"keyword"}}var h=f("keyword a"),S=f("keyword b"),O=f("keyword c"),w=f("keyword d"),I=f("operator"),Oe={type:"atom",style:"atom"};return{if:f("if"),while:h,with:h,else:S,do:S,try:S,finally:S,return:w,break:w,continue:w,new:f("new"),delete:O,void:O,throw:O,debugger:f("debugger"),var:f("var"),const:f("var"),let:f("var"),function:f("function"),catch:f("catch"),for:f("for"),switch:f("switch"),case:f("case"),default:f("default"),in:I,typeof:I,instanceof:I,true:Oe,false:Oe,null:Oe,undefined:Oe,NaN:Oe,Infinity:Oe,this:f("this"),class:f("class"),super:f("atom"),yield:O,export:f("export"),import:f("import"),extends:O,await:O}}(),ue=/[+\-*&%=<>!?|~^@]/,te=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function Ce(f){for(var h=!1,S,O=!1;(S=f.next())!=null;){if(!h){if(S=="/"&&!O)return;S=="["?O=!0:O&&S=="]"&&(O=!1)}h=!h&&S=="\\"}}var Le,ge;function G(f,h,S){return Le=f,ge=S,h}function L(f,h){var S=f.next();if(S=='"'||S=="'")return h.tokenize=W(S),h.tokenize(f,h);if(S=="."&&f.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return G("number","number");if(S=="."&&f.match(".."))return G("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(S))return G(S);if(S=="="&&f.eat(">"))return G("=>","operator");if(S=="0"&&f.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return G("number","number");if(/\d/.test(S))return f.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),G("number","number");if(S=="/")return f.eat("*")?(h.tokenize=ee,ee(f,h)):f.eat("/")?(f.skipToEnd(),G("comment","comment")):Lt(f,h,1)?(Ce(f),f.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),G("regexp","string-2")):(f.eat("="),G("operator","operator",f.current()));if(S=="`")return h.tokenize=ce,ce(f,h);if(S=="#"&&f.peek()=="!")return f.skipToEnd(),G("meta","meta");if(S=="#"&&f.eatWhile(Y))return G("variable","property");if(S=="<"&&f.match("!--")||S=="-"&&f.match("->")&&!/\S/.test(f.string.slice(0,f.start)))return f.skipToEnd(),G("comment","comment");if(ue.test(S))return(S!=">"||!h.lexical||h.lexical.type!=">")&&(f.eat("=")?(S=="!"||S=="=")&&f.eat("="):/[<>*+\-|&?]/.test(S)&&(f.eat(S),S==">"&&f.eat(S))),S=="?"&&f.eat(".")?G("."):G("operator","operator",f.current());if(Y.test(S)){f.eatWhile(Y);var O=f.current();if(h.lastType!="."){if(j.propertyIsEnumerable(O)){var w=j[O];return G(w.type,w.style,O)}if(O=="async"&&f.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return G("async","keyword",O)}return G("variable","variable",O)}}function W(f){return function(h,S){var O=!1,w;if(ae&&h.peek()=="@"&&h.match(te))return S.tokenize=L,G("jsonld-keyword","meta");for(;(w=h.next())!=null&&!(w==f&&!O);)O=!O&&w=="\\";return O||(S.tokenize=L),G("string","string")}}function ee(f,h){for(var S=!1,O;O=f.next();){if(O=="/"&&S){h.tokenize=L;break}S=O=="*"}return G("comment","comment")}function ce(f,h){for(var S=!1,O;(O=f.next())!=null;){if(!S&&(O=="`"||O=="$"&&f.eat("{"))){h.tokenize=L;break}S=!S&&O=="\\"}return G("quasi","string-2",f.current())}var we="([{}])";function me(f,h){h.fatArrowAt&&(h.fatArrowAt=null);var S=f.string.indexOf("=>",f.start);if(!(S<0)){if(K){var O=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(f.string.slice(f.start,S));O&&(S=O.index)}for(var w=0,I=!1,Oe=S-1;Oe>=0;--Oe){var Ye=f.string.charAt(Oe),ht=we.indexOf(Ye);if(ht>=0&&ht<3){if(!w){++Oe;break}if(--w==0){Ye=="("&&(I=!0);break}}else if(ht>=3&&ht<6)++w;else if(Y.test(Ye))I=!0;else if(/["'\/`]/.test(Ye))for(;;--Oe){if(Oe==0)return;var Kr=f.string.charAt(Oe-1);if(Kr==Ye&&f.string.charAt(Oe-2)!="\\"){Oe--;break}}else if(I&&!w){++Oe;break}}I&&!w&&(h.fatArrowAt=Oe)}}var Ne={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function ie(f,h,S,O,w,I){this.indented=f,this.column=h,this.type=S,this.prev=w,this.info=I,O!=null&&(this.align=O)}function Z(f,h){if(!U)return!1;for(var S=f.localVars;S;S=S.next)if(S.name==h)return!0;for(var O=f.context;O;O=O.prev)for(var S=O.vars;S;S=S.next)if(S.name==h)return!0}function Te(f,h,S,O,w){var I=f.cc;for(C.state=f,C.stream=w,C.marked=null,C.cc=I,C.style=h,f.lexical.hasOwnProperty("align")||(f.lexical.align=!0);;){var Oe=I.length?I.pop():P?V:ke;if(Oe(S,O)){for(;I.length&&I[I.length-1].lex;)I.pop()();return C.marked?C.marked:S=="variable"&&Z(f,O)?"variable-2":h}}}var C={state:null,column:null,marked:null,cc:null};function R(){for(var f=arguments.length-1;f>=0;f--)C.cc.push(arguments[f])}function c(){return R.apply(null,arguments),!0}function F(f,h){for(var S=h;S;S=S.next)if(S.name==f)return!0;return!1}function N(f){var h=C.state;if(C.marked="def",!!U){if(h.context){if(h.lexical.info=="var"&&h.context&&h.context.block){var S=J(f,h.context);if(S!=null){h.context=S;return}}else if(!F(f,h.localVars)){h.localVars=new At(f,h.localVars);return}}$.globalVars&&!F(f,h.globalVars)&&(h.globalVars=new At(f,h.globalVars))}}function J(f,h){if(h)if(h.block){var S=J(f,h.prev);return S?S==h.prev?h:new He(S,h.vars,!0):null}else return F(f,h.vars)?h:new He(h.prev,new At(f,h.vars),!1);else return null}function xe(f){return f=="public"||f=="private"||f=="protected"||f=="abstract"||f=="readonly"}function He(f,h,S){this.prev=f,this.vars=h,this.block=S}function At(f,h){this.name=f,this.next=h}var Yt=new At("this",new At("arguments",null));function lt(){C.state.context=new He(C.state.context,C.state.localVars,!1),C.state.localVars=Yt}function bt(){C.state.context=new He(C.state.context,C.state.localVars,!0),C.state.localVars=null}lt.lex=bt.lex=!0;function Ee(){C.state.localVars=C.state.context.vars,C.state.context=C.state.context.prev}Ee.lex=!0;function se(f,h){var S=function(){var O=C.state,w=O.indented;if(O.lexical.type=="stat")w=O.lexical.indented;else for(var I=O.lexical;I&&I.type==")"&&I.align;I=I.prev)w=I.indented;O.lexical=new ie(w,C.stream.column(),f,null,O.lexical,h)};return S.lex=!0,S}function le(){var f=C.state;f.lexical.prev&&(f.lexical.type==")"&&(f.indented=f.lexical.indented),f.lexical=f.lexical.prev)}le.lex=!0;function he(f){function h(S){return S==f?c():f==";"||S=="}"||S==")"||S=="]"?R():c(h)}return h}function ke(f,h){return f=="var"?c(se("vardef",h),zr,he(";"),le):f=="keyword a"?c(se("form"),Dt,ke,le):f=="keyword b"?c(se("form"),ke,le):f=="keyword d"?C.stream.match(/^\s*$/,!1)?c():c(se("stat"),St,he(";"),le):f=="debugger"?c(he(";")):f=="{"?c(se("}"),bt,Kt,le,Ee):f==";"?c():f=="if"?(C.state.lexical.info=="else"&&C.state.cc[C.state.cc.length-1]==le&&C.state.cc.pop()(),c(se("form"),Dt,ke,le,Hr)):f=="function"?c(Ot):f=="for"?c(se("form"),bt,qn,ke,Ee,le):f=="class"||K&&h=="interface"?(C.marked="keyword",c(se("form",f=="class"?f:h),Fr,le)):f=="variable"?K&&h=="declare"?(C.marked="keyword",c(ke)):K&&(h=="module"||h=="enum"||h=="type")&&C.stream.match(/^\s*\w/,!1)?(C.marked="keyword",h=="enum"?c(q):h=="type"?c(Xn,he("operator"),ye,he(";")):c(se("form"),dt,he("{"),se("}"),Kt,le,le)):K&&h=="namespace"?(C.marked="keyword",c(se("form"),V,ke,le)):K&&h=="abstract"?(C.marked="keyword",c(ke)):c(se("stat"),Se):f=="switch"?c(se("form"),Dt,he("{"),se("}","switch"),bt,Kt,le,le,Ee):f=="case"?c(V,he(":")):f=="default"?c(he(":")):f=="catch"?c(se("form"),lt,de,ke,le,Ee):f=="export"?c(se("stat"),Ir,le):f=="import"?c(se("stat"),cr,le):f=="async"?c(ke):h=="@"?c(V,ke):R(se("stat"),V,he(";"),le)}function de(f){if(f=="(")return c(Et,he(")"))}function V(f,h){return ft(f,h,!1)}function et(f,h){return ft(f,h,!0)}function Dt(f){return f!="("?R():c(se(")"),St,he(")"),le)}function ft(f,h,S){if(C.state.fatArrowAt==C.stream.start){var O=S?Pe:be;if(f=="(")return c(lt,se(")"),Ue(Et,")"),le,he("=>"),O,Ee);if(f=="variable")return R(lt,dt,he("=>"),O,Ee)}var w=S?je:Me;return Ne.hasOwnProperty(f)?c(w):f=="function"?c(Ot,w):f=="class"||K&&h=="interface"?(C.marked="keyword",c(se("form"),Wi,le)):f=="keyword c"||f=="async"?c(S?et:V):f=="("?c(se(")"),St,he(")"),le,w):f=="operator"||f=="spread"?c(S?et:V):f=="["?c(se("]"),Re,le,w):f=="{"?or(Zt,"}",null,w):f=="quasi"?R(ct,w):f=="new"?c(b(S)):c()}function St(f){return f.match(/[;\}\)\],]/)?R():R(V)}function Me(f,h){return f==","?c(St):je(f,h,!1)}function je(f,h,S){var O=S==!1?Me:je,w=S==!1?V:et;if(f=="=>")return c(lt,S?Pe:be,Ee);if(f=="operator")return/\+\+|--/.test(h)||K&&h=="!"?c(O):K&&h=="<"&&C.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?c(se(">"),Ue(ye,">"),le,O):h=="?"?c(V,he(":"),w):c(w);if(f=="quasi")return R(ct,O);if(f!=";"){if(f=="(")return or(et,")","call",O);if(f==".")return c(rt,O);if(f=="[")return c(se("]"),St,he("]"),le,O);if(K&&h=="as")return C.marked="keyword",c(ye,O);if(f=="regexp")return C.state.lastType=C.marked="operator",C.stream.backUp(C.stream.pos-C.stream.start-1),c(w)}}function ct(f,h){return f!="quasi"?R():h.slice(h.length-2)!="${"?c(ct):c(St,Ct)}function Ct(f){if(f=="}")return C.marked="string-2",C.state.tokenize=ce,c(ct)}function be(f){return me(C.stream,C.state),R(f=="{"?ke:V)}function Pe(f){return me(C.stream,C.state),R(f=="{"?ke:et)}function b(f){return function(h){return h=="."?c(f?k:D):h=="variable"&&K?c(wt,f?je:Me):R(f?et:V)}}function D(f,h){if(h=="target")return C.marked="keyword",c(Me)}function k(f,h){if(h=="target")return C.marked="keyword",c(je)}function Se(f){return f==":"?c(le,ke):R(Me,he(";"),le)}function rt(f){if(f=="variable")return C.marked="property",c()}function Zt(f,h){if(f=="async")return C.marked="property",c(Zt);if(f=="variable"||C.style=="keyword"){if(C.marked="property",h=="get"||h=="set")return c(Un);var S;return K&&C.state.fatArrowAt==C.stream.start&&(S=C.stream.match(/^\s*:\s*/,!1))&&(C.state.fatArrowAt=C.stream.pos+S[0].length),c(Jt)}else{if(f=="number"||f=="string")return C.marked=ae?"property":C.style+" property",c(Jt);if(f=="jsonld-keyword")return c(Jt);if(K&&xe(h))return C.marked="keyword",c(Zt);if(f=="[")return c(V,ar,he("]"),Jt);if(f=="spread")return c(et,Jt);if(h=="*")return C.marked="keyword",c(Zt);if(f==":")return R(Jt)}}function Un(f){return f!="variable"?R(Jt):(C.marked="property",c(Ot))}function Jt(f){if(f==":")return c(et);if(f=="(")return R(Ot)}function Ue(f,h,S){function O(w,I){if(S?S.indexOf(w)>-1:w==","){var Oe=C.state.lexical;return Oe.info=="call"&&(Oe.pos=(Oe.pos||0)+1),c(function(Ye,ht){return Ye==h||ht==h?R():R(f)},O)}return w==h||I==h?c():S&&S.indexOf(";")>-1?R(f):c(he(h))}return function(w,I){return w==h||I==h?c():R(f,O)}}function or(f,h,S){for(var O=3;O"),ye);if(f=="quasi")return R(nt,Nt)}function Gn(f){if(f=="=>")return c(ye)}function re(f){return f.match(/[\}\)\]]/)?c():f==","||f==";"?c(re):R(Vt,re)}function Vt(f,h){if(f=="variable"||C.style=="keyword")return C.marked="property",c(Vt);if(h=="?"||f=="number"||f=="string")return c(Vt);if(f==":")return c(ye);if(f=="[")return c(he("variable"),xr,he("]"),Vt);if(f=="(")return R(fr,Vt);if(!f.match(/[;\}\)\],]/))return c()}function nt(f,h){return f!="quasi"?R():h.slice(h.length-2)!="${"?c(nt):c(ye,Ie)}function Ie(f){if(f=="}")return C.marked="string-2",C.state.tokenize=ce,c(nt)}function Be(f,h){return f=="variable"&&C.stream.match(/^\s*[?:]/,!1)||h=="?"?c(Be):f==":"?c(ye):f=="spread"?c(Be):R(ye)}function Nt(f,h){if(h=="<")return c(se(">"),Ue(ye,">"),le,Nt);if(h=="|"||f=="."||h=="&")return c(ye);if(f=="[")return c(ye,he("]"),Nt);if(h=="extends"||h=="implements")return C.marked="keyword",c(ye);if(h=="?")return c(ye,he(":"),ye)}function wt(f,h){if(h=="<")return c(se(">"),Ue(ye,">"),le,Nt)}function Pt(){return R(ye,it)}function it(f,h){if(h=="=")return c(ye)}function zr(f,h){return h=="enum"?(C.marked="keyword",c(q)):R(dt,ar,Wt,Pi)}function dt(f,h){if(K&&xe(h))return C.marked="keyword",c(dt);if(f=="variable")return N(h),c();if(f=="spread")return c(dt);if(f=="[")return or(cn,"]");if(f=="{")return or(sr,"}")}function sr(f,h){return f=="variable"&&!C.stream.match(/^\s*:/,!1)?(N(h),c(Wt)):(f=="variable"&&(C.marked="property"),f=="spread"?c(dt):f=="}"?R():f=="["?c(V,he("]"),he(":"),sr):c(he(":"),dt,Wt))}function cn(){return R(dt,Wt)}function Wt(f,h){if(h=="=")return c(et)}function Pi(f){if(f==",")return c(zr)}function Hr(f,h){if(f=="keyword b"&&h=="else")return c(se("form","else"),ke,le)}function qn(f,h){if(h=="await")return c(qn);if(f=="(")return c(se(")"),dn,le)}function dn(f){return f=="var"?c(zr,ur):f=="variable"?c(ur):R(ur)}function ur(f,h){return f==")"?c():f==";"?c(ur):h=="in"||h=="of"?(C.marked="keyword",c(V,ur)):R(V,ur)}function Ot(f,h){if(h=="*")return C.marked="keyword",c(Ot);if(f=="variable")return N(h),c(Ot);if(f=="(")return c(lt,se(")"),Ue(Et,")"),le,lr,ke,Ee);if(K&&h=="<")return c(se(">"),Ue(Pt,">"),le,Ot)}function fr(f,h){if(h=="*")return C.marked="keyword",c(fr);if(f=="variable")return N(h),c(fr);if(f=="(")return c(lt,se(")"),Ue(Et,")"),le,lr,Ee);if(K&&h=="<")return c(se(">"),Ue(Pt,">"),le,fr)}function Xn(f,h){if(f=="keyword"||f=="variable")return C.marked="type",c(Xn);if(h=="<")return c(se(">"),Ue(Pt,">"),le)}function Et(f,h){return h=="@"&&c(V,Et),f=="spread"?c(Et):K&&xe(h)?(C.marked="keyword",c(Et)):K&&f=="this"?c(ar,Wt):R(dt,ar,Wt)}function Wi(f,h){return f=="variable"?Fr(f,h):zt(f,h)}function Fr(f,h){if(f=="variable")return N(h),c(zt)}function zt(f,h){if(h=="<")return c(se(">"),Ue(Pt,">"),le,zt);if(h=="extends"||h=="implements"||K&&f==",")return h=="implements"&&(C.marked="keyword"),c(K?ye:V,zt);if(f=="{")return c(se("}"),Ht,le)}function Ht(f,h){if(f=="async"||f=="variable"&&(h=="static"||h=="get"||h=="set"||K&&xe(h))&&C.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return C.marked="keyword",c(Ht);if(f=="variable"||C.style=="keyword")return C.marked="property",c(kr,Ht);if(f=="number"||f=="string")return c(kr,Ht);if(f=="[")return c(V,ar,he("]"),kr,Ht);if(h=="*")return C.marked="keyword",c(Ht);if(K&&f=="(")return R(fr,Ht);if(f==";"||f==",")return c(Ht);if(f=="}")return c();if(h=="@")return c(V,Ht)}function kr(f,h){if(h=="!"||h=="?")return c(kr);if(f==":")return c(ye,Wt);if(h=="=")return c(et);var S=C.state.lexical.prev,O=S&&S.info=="interface";return R(O?fr:Ot)}function Ir(f,h){return h=="*"?(C.marked="keyword",c(_r,he(";"))):h=="default"?(C.marked="keyword",c(V,he(";"))):f=="{"?c(Ue(Br,"}"),_r,he(";")):R(ke)}function Br(f,h){if(h=="as")return C.marked="keyword",c(he("variable"));if(f=="variable")return R(et,Br)}function cr(f){return f=="string"?c():f=="("?R(V):f=="."?R(Me):R(Rr,jt,_r)}function Rr(f,h){return f=="{"?or(Rr,"}"):(f=="variable"&&N(h),h=="*"&&(C.marked="keyword"),c(hn))}function jt(f){if(f==",")return c(Rr,jt)}function hn(f,h){if(h=="as")return C.marked="keyword",c(Rr)}function _r(f,h){if(h=="from")return C.marked="keyword",c(V)}function Re(f){return f=="]"?c():R(Ue(et,"]"))}function q(){return R(se("form"),dt,he("{"),se("}"),Ue(Qt,"}"),le,le)}function Qt(){return R(dt,Wt)}function pn(f,h){return f.lastType=="operator"||f.lastType==","||ue.test(h.charAt(0))||/[,.]/.test(h.charAt(0))}function Lt(f,h,S){return h.tokenize==L&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(h.lastType)||h.lastType=="quasi"&&/\{\s*$/.test(f.string.slice(0,f.pos-(S||0)))}return{startState:function(f){var h={tokenize:L,lastType:"sof",cc:[],lexical:new ie((f||0)-X,0,"block",!1),localVars:$.localVars,context:$.localVars&&new He(null,null,!1),indented:f||0};return $.globalVars&&typeof $.globalVars=="object"&&(h.globalVars=$.globalVars),h},token:function(f,h){if(f.sol()&&(h.lexical.hasOwnProperty("align")||(h.lexical.align=!1),h.indented=f.indentation(),me(f,h)),h.tokenize!=ee&&f.eatSpace())return null;var S=h.tokenize(f,h);return Le=="comment"?S:(h.lastType=Le=="operator"&&(ge=="++"||ge=="--")?"incdec":Le,Te(h,S,Le,ge,f))},indent:function(f,h){if(f.tokenize==ee||f.tokenize==ce)return y.Pass;if(f.tokenize!=L)return 0;var S=h&&h.charAt(0),O=f.lexical,w;if(!/^\s*else\b/.test(h))for(var I=f.cc.length-1;I>=0;--I){var Oe=f.cc[I];if(Oe==le)O=O.prev;else if(Oe!=Hr&&Oe!=Ee)break}for(;(O.type=="stat"||O.type=="form")&&(S=="}"||(w=f.cc[f.cc.length-1])&&(w==Me||w==je)&&!/^[,\.=+\-*:?[\(]/.test(h));)O=O.prev;ve&&O.type==")"&&O.prev.type=="stat"&&(O=O.prev);var Ye=O.type,ht=S==Ye;return Ye=="vardef"?O.indented+(f.lastType=="operator"||f.lastType==","?O.info.length+1:0):Ye=="form"&&S=="{"?O.indented:Ye=="form"?O.indented+X:Ye=="stat"?O.indented+(pn(f,h)?ve||X:0):O.info=="switch"&&!ht&&$.doubleIndentSwitch!=!1?O.indented+(/^(?:case|default)\b/.test(h)?X:2*X):O.align?O.column+(ht?0:1):O.indented+(ht?0:X)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:P?null:"/*",blockCommentEnd:P?null:"*/",blockCommentContinue:P?null:" * ",lineComment:P?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:P?"json":"javascript",jsonldMode:ae,jsonMode:P,expressionAllowed:Lt,skipExpression:function(f){Te(f,"atom","atom","true",new y.StringStream("",2,null))}}}),y.registerHelper("wordChars","javascript",/[\w$]/),y.defineMIME("text/javascript","javascript"),y.defineMIME("text/ecmascript","javascript"),y.defineMIME("application/javascript","javascript"),y.defineMIME("application/x-javascript","javascript"),y.defineMIME("application/ecmascript","javascript"),y.defineMIME("application/json",{name:"javascript",json:!0}),y.defineMIME("application/x-json",{name:"javascript",json:!0}),y.defineMIME("application/manifest+json",{name:"javascript",json:!0}),y.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),y.defineMIME("text/typescript",{name:"javascript",typescript:!0}),y.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})();var Sf=kf.exports,Cf={exports:{}};(function(v,M){(function(y){y(jn)})(function(y){y.defineMode("css",function(ie,Z){var Te=Z.inline;Z.propertyKeywords||(Z=y.resolveMode("text/css"));var C=ie.indentUnit,R=Z.tokenHooks,c=Z.documentTypes||{},F=Z.mediaTypes||{},N=Z.mediaFeatures||{},J=Z.mediaValueKeywords||{},xe=Z.propertyKeywords||{},He=Z.nonStandardPropertyKeywords||{},At=Z.fontProperties||{},Yt=Z.counterDescriptors||{},lt=Z.colorKeywords||{},bt=Z.valueKeywords||{},Ee=Z.allowNested,se=Z.lineComment,le=Z.supportsAtComponent===!0,he=ie.highlightNonStandardPropertyKeywords!==!1,ke,de;function V(b,D){return ke=D,b}function et(b,D){var k=b.next();if(R[k]){var Se=R[k](b,D);if(Se!==!1)return Se}if(k=="@")return b.eatWhile(/[\w\\\-]/),V("def",b.current());if(k=="="||(k=="~"||k=="|")&&b.eat("="))return V(null,"compare");if(k=='"'||k=="'")return D.tokenize=Dt(k),D.tokenize(b,D);if(k=="#")return b.eatWhile(/[\w\\\-]/),V("atom","hash");if(k=="!")return b.match(/^\s*\w*/),V("keyword","important");if(/\d/.test(k)||k=="."&&b.eat(/\d/))return b.eatWhile(/[\w.%]/),V("number","unit");if(k==="-"){if(/[\d.]/.test(b.peek()))return b.eatWhile(/[\w.%]/),V("number","unit");if(b.match(/^-[\w\\\-]*/))return b.eatWhile(/[\w\\\-]/),b.match(/^\s*:/,!1)?V("variable-2","variable-definition"):V("variable-2","variable");if(b.match(/^\w+-/))return V("meta","meta")}else return/[,+>*\/]/.test(k)?V(null,"select-op"):k=="."&&b.match(/^-?[_a-z][_a-z0-9-]*/i)?V("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(k)?V(null,k):b.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(b.current())&&(D.tokenize=ft),V("variable callee","variable")):/[\w\\\-]/.test(k)?(b.eatWhile(/[\w\\\-]/),V("property","word")):V(null,null)}function Dt(b){return function(D,k){for(var Se=!1,rt;(rt=D.next())!=null;){if(rt==b&&!Se){b==")"&&D.backUp(1);break}Se=!Se&&rt=="\\"}return(rt==b||!Se&&b!=")")&&(k.tokenize=null),V("string","string")}}function ft(b,D){return b.next(),b.match(/^\s*[\"\')]/,!1)?D.tokenize=null:D.tokenize=Dt(")"),V(null,"(")}function St(b,D,k){this.type=b,this.indent=D,this.prev=k}function Me(b,D,k,Se){return b.context=new St(k,D.indentation()+(Se===!1?0:C),b.context),k}function je(b){return b.context.prev&&(b.context=b.context.prev),b.context.type}function ct(b,D,k){return Pe[k.context.type](b,D,k)}function Ct(b,D,k,Se){for(var rt=Se||1;rt>0;rt--)k.context=k.context.prev;return ct(b,D,k)}function be(b){var D=b.current().toLowerCase();bt.hasOwnProperty(D)?de="atom":lt.hasOwnProperty(D)?de="keyword":de="variable"}var Pe={};return Pe.top=function(b,D,k){if(b=="{")return Me(k,D,"block");if(b=="}"&&k.context.prev)return je(k);if(le&&/@component/i.test(b))return Me(k,D,"atComponentBlock");if(/^@(-moz-)?document$/i.test(b))return Me(k,D,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(b))return Me(k,D,"atBlock");if(/^@(font-face|counter-style)/i.test(b))return k.stateArg=b,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(b))return"keyframes";if(b&&b.charAt(0)=="@")return Me(k,D,"at");if(b=="hash")de="builtin";else if(b=="word")de="tag";else{if(b=="variable-definition")return"maybeprop";if(b=="interpolation")return Me(k,D,"interpolation");if(b==":")return"pseudo";if(Ee&&b=="(")return Me(k,D,"parens")}return k.context.type},Pe.block=function(b,D,k){if(b=="word"){var Se=D.current().toLowerCase();return xe.hasOwnProperty(Se)?(de="property","maybeprop"):He.hasOwnProperty(Se)?(de=he?"string-2":"property","maybeprop"):Ee?(de=D.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(de+=" error","maybeprop")}else return b=="meta"?"block":!Ee&&(b=="hash"||b=="qualifier")?(de="error","block"):Pe.top(b,D,k)},Pe.maybeprop=function(b,D,k){return b==":"?Me(k,D,"prop"):ct(b,D,k)},Pe.prop=function(b,D,k){if(b==";")return je(k);if(b=="{"&&Ee)return Me(k,D,"propBlock");if(b=="}"||b=="{")return Ct(b,D,k);if(b=="(")return Me(k,D,"parens");if(b=="hash"&&!/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(D.current()))de+=" error";else if(b=="word")be(D);else if(b=="interpolation")return Me(k,D,"interpolation");return"prop"},Pe.propBlock=function(b,D,k){return b=="}"?je(k):b=="word"?(de="property","maybeprop"):k.context.type},Pe.parens=function(b,D,k){return b=="{"||b=="}"?Ct(b,D,k):b==")"?je(k):b=="("?Me(k,D,"parens"):b=="interpolation"?Me(k,D,"interpolation"):(b=="word"&&be(D),"parens")},Pe.pseudo=function(b,D,k){return b=="meta"?"pseudo":b=="word"?(de="variable-3",k.context.type):ct(b,D,k)},Pe.documentTypes=function(b,D,k){return b=="word"&&c.hasOwnProperty(D.current())?(de="tag",k.context.type):Pe.atBlock(b,D,k)},Pe.atBlock=function(b,D,k){if(b=="(")return Me(k,D,"atBlock_parens");if(b=="}"||b==";")return Ct(b,D,k);if(b=="{")return je(k)&&Me(k,D,Ee?"block":"top");if(b=="interpolation")return Me(k,D,"interpolation");if(b=="word"){var Se=D.current().toLowerCase();Se=="only"||Se=="not"||Se=="and"||Se=="or"?de="keyword":F.hasOwnProperty(Se)?de="attribute":N.hasOwnProperty(Se)?de="property":J.hasOwnProperty(Se)?de="keyword":xe.hasOwnProperty(Se)?de="property":He.hasOwnProperty(Se)?de=he?"string-2":"property":bt.hasOwnProperty(Se)?de="atom":lt.hasOwnProperty(Se)?de="keyword":de="error"}return k.context.type},Pe.atComponentBlock=function(b,D,k){return b=="}"?Ct(b,D,k):b=="{"?je(k)&&Me(k,D,Ee?"block":"top",!1):(b=="word"&&(de="error"),k.context.type)},Pe.atBlock_parens=function(b,D,k){return b==")"?je(k):b=="{"||b=="}"?Ct(b,D,k,2):Pe.atBlock(b,D,k)},Pe.restricted_atBlock_before=function(b,D,k){return b=="{"?Me(k,D,"restricted_atBlock"):b=="word"&&k.stateArg=="@counter-style"?(de="variable","restricted_atBlock_before"):ct(b,D,k)},Pe.restricted_atBlock=function(b,D,k){return b=="}"?(k.stateArg=null,je(k)):b=="word"?(k.stateArg=="@font-face"&&!At.hasOwnProperty(D.current().toLowerCase())||k.stateArg=="@counter-style"&&!Yt.hasOwnProperty(D.current().toLowerCase())?de="error":de="property","maybeprop"):"restricted_atBlock"},Pe.keyframes=function(b,D,k){return b=="word"?(de="variable","keyframes"):b=="{"?Me(k,D,"top"):ct(b,D,k)},Pe.at=function(b,D,k){return b==";"?je(k):b=="{"||b=="}"?Ct(b,D,k):(b=="word"?de="tag":b=="hash"&&(de="builtin"),"at")},Pe.interpolation=function(b,D,k){return b=="}"?je(k):b=="{"||b==";"?Ct(b,D,k):(b=="word"?de="variable":b!="variable"&&b!="("&&b!=")"&&(de="error"),"interpolation")},{startState:function(b){return{tokenize:null,state:Te?"block":"top",stateArg:null,context:new St(Te?"block":"top",b||0,null)}},token:function(b,D){if(!D.tokenize&&b.eatSpace())return null;var k=(D.tokenize||et)(b,D);return k&&typeof k=="object"&&(ke=k[1],k=k[0]),de=k,ke!="comment"&&(D.state=Pe[D.state](ke,b,D)),de},indent:function(b,D){var k=b.context,Se=D&&D.charAt(0),rt=k.indent;return k.type=="prop"&&(Se=="}"||Se==")")&&(k=k.prev),k.prev&&(Se=="}"&&(k.type=="block"||k.type=="top"||k.type=="interpolation"||k.type=="restricted_atBlock")?(k=k.prev,rt=k.indent):(Se==")"&&(k.type=="parens"||k.type=="atBlock_parens")||Se=="{"&&(k.type=="at"||k.type=="atBlock"))&&(rt=Math.max(0,k.indent-C))),rt},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:se,fold:"brace"}});function E(ie){for(var Z={},Te=0;Te")):null:c.match("--")?N(Le("comment","-->")):c.match("DOCTYPE",!0,!0)?(c.eatWhile(/[\w\._\-]/),N(ge(1))):null:c.eat("?")?(c.eatWhile(/[\w\._\-]/),F.tokenize=Le("meta","?>"),"meta"):(Y=c.eat("/")?"closeTag":"openTag",F.tokenize=te,"tag bracket");if(J=="&"){var xe;return c.eat("#")?c.eat("x")?xe=c.eatWhile(/[a-fA-F\d]/)&&c.eat(";"):xe=c.eatWhile(/[\d]/)&&c.eat(";"):xe=c.eatWhile(/[\w\.\-:]/)&&c.eat(";"),xe?"atom":"error"}else return c.eatWhile(/[^&<]/),null}ue.isInText=!0;function te(c,F){var N=c.next();if(N==">"||N=="/"&&c.eat(">"))return F.tokenize=ue,Y=N==">"?"endTag":"selfcloseTag","tag bracket";if(N=="=")return Y="equals",null;if(N=="<"){F.tokenize=ue,F.state=ce,F.tagName=F.tagStart=null;var J=F.tokenize(c,F);return J?J+" tag error":"tag error"}else return/[\'\"]/.test(N)?(F.tokenize=Ce(N),F.stringStartCol=c.column(),F.tokenize(c,F)):(c.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Ce(c){var F=function(N,J){for(;!N.eol();)if(N.next()==c){J.tokenize=te;break}return"string"};return F.isInAttribute=!0,F}function Le(c,F){return function(N,J){for(;!N.eol();){if(N.match(F)){J.tokenize=ue;break}N.next()}return c}}function ge(c){return function(F,N){for(var J;(J=F.next())!=null;){if(J=="<")return N.tokenize=ge(c+1),N.tokenize(F,N);if(J==">")if(c==1){N.tokenize=ue;break}else return N.tokenize=ge(c-1),N.tokenize(F,N)}return"meta"}}function G(c){return c&&c.toLowerCase()}function L(c,F,N){this.prev=c.context,this.tagName=F||"",this.indent=c.indented,this.startOfLine=N,(P.doNotIndent.hasOwnProperty(F)||c.context&&c.context.noIndent)&&(this.noIndent=!0)}function W(c){c.context&&(c.context=c.context.prev)}function ee(c,F){for(var N;;){if(!c.context||(N=c.context.tagName,!P.contextGrabbers.hasOwnProperty(G(N))||!P.contextGrabbers[G(N)].hasOwnProperty(G(F))))return;W(c)}}function ce(c,F,N){return c=="openTag"?(N.tagStart=F.column(),we):c=="closeTag"?me:ce}function we(c,F,N){return c=="word"?(N.tagName=F.current(),j="tag",Z):P.allowMissingTagName&&c=="endTag"?(j="tag bracket",Z(c,F,N)):(j="error",we)}function me(c,F,N){if(c=="word"){var J=F.current();return N.context&&N.context.tagName!=J&&P.implicitlyClosed.hasOwnProperty(G(N.context.tagName))&&W(N),N.context&&N.context.tagName==J||P.matchClosing===!1?(j="tag",Ne):(j="tag error",ie)}else return P.allowMissingTagName&&c=="endTag"?(j="tag bracket",Ne(c,F,N)):(j="error",ie)}function Ne(c,F,N){return c!="endTag"?(j="error",Ne):(W(N),ce)}function ie(c,F,N){return j="error",Ne(c,F,N)}function Z(c,F,N){if(c=="word")return j="attribute",Te;if(c=="endTag"||c=="selfcloseTag"){var J=N.tagName,xe=N.tagStart;return N.tagName=N.tagStart=null,c=="selfcloseTag"||P.autoSelfClosers.hasOwnProperty(G(J))?ee(N,J):(ee(N,J),N.context=new L(N,J,xe==N.indented)),ce}return j="error",Z}function Te(c,F,N){return c=="equals"?C:(P.allowMissing||(j="error"),Z(c,F,N))}function C(c,F,N){return c=="string"?R:c=="word"&&P.allowUnquoted?(j="string",Z):(j="error",Z(c,F,N))}function R(c,F,N){return c=="string"?R:Z(c,F,N)}return{startState:function(c){var F={tokenize:ue,state:ce,indented:c||0,tagName:null,tagStart:null,context:null};return c!=null&&(F.baseIndent=c),F},token:function(c,F){if(!F.tagName&&c.sol()&&(F.indented=c.indentation()),c.eatSpace())return null;Y=null;var N=F.tokenize(c,F);return(N||Y)&&N!="comment"&&(j=null,F.state=F.state(Y||N,c,F),j&&(N=j=="error"?N+" error":j)),N},indent:function(c,F,N){var J=c.context;if(c.tokenize.isInAttribute)return c.tagStart==c.indented?c.stringStartCol+1:c.indented+ae;if(J&&J.noIndent)return y.Pass;if(c.tokenize!=te&&c.tokenize!=ue)return N?N.match(/^(\s*)/)[0].length:0;if(c.tagName)return P.multilineTagIndentPastTag!==!1?c.tagStart+c.tagName.length+2:c.tagStart+ae*(P.multilineTagIndentFactor||1);if(P.alignCDATA&&/$/,blockCommentStart:"",configuration:P.htmlMode?"html":"xml",helperType:P.htmlMode?"html":"xml",skipAttribute:function(c){c.state==C&&(c.state=Z)},xmlCurrentTag:function(c){return c.tagName?{name:c.tagName,close:c.type=="closeTag"}:null},xmlCurrentContext:function(c){for(var F=[],N=c.context;N;N=N.prev)F.push(N.tagName);return F.reverse()}}}),y.defineMIME("text/xml","xml"),y.defineMIME("application/xml","xml"),y.mimeModes.hasOwnProperty("text/html")||y.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),Bl.exports}(function(v,M){(function(y){y(jn,Tf(),Sf,Lf)})(function(y){var E={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};function $(Y,j,ue){var te=Y.current(),Ce=te.search(j);return Ce>-1?Y.backUp(te.length-Ce):te.match(/<\/?$/)&&(Y.backUp(te.length),Y.match(j,!1)||Y.match(te)),ue}var X={};function ve(Y){var j=X[Y];return j||(X[Y]=new RegExp("\\s+"+Y+`\\s*=\\s*('|")?([^'"]+)('|")?\\s*`))}function ae(Y,j){var ue=Y.match(ve(j));return ue?/^\s*(.*?)\s*$/.exec(ue[2])[1]:""}function P(Y,j){return new RegExp((j?"^":"")+"","i")}function U(Y,j){for(var ue in Y)for(var te=j[ue]||(j[ue]=[]),Ce=Y[ue],Le=Ce.length-1;Le>=0;Le--)te.unshift(Ce[Le])}function K(Y,j){for(var ue=0;ue=0;ge--)te.script.unshift(["type",Le[ge].matches,Le[ge].mode]);function G(L,W){var ee=ue.token(L,W.htmlState),ce=/\btag\b/.test(ee),we;if(ce&&!/[<>\s\/]/.test(L.current())&&(we=W.htmlState.tagName&&W.htmlState.tagName.toLowerCase())&&te.hasOwnProperty(we))W.inTag=we+" ";else if(W.inTag&&ce&&/>$/.test(L.current())){var me=/^([\S]+) (.*)/.exec(W.inTag);W.inTag=null;var Ne=L.current()==">"&&K(te[me[1]],me[2]),ie=y.getMode(Y,Ne),Z=P(me[1],!0),Te=P(me[1],!1);W.token=function(C,R){return C.match(Z,!1)?(R.token=G,R.localState=R.localMode=null,null):$(C,Te,R.localMode.token(C,R.localState))},W.localMode=ie,W.localState=y.startState(ie,ue.indent(W.htmlState,"",""))}else W.inTag&&(W.inTag+=L.current(),L.eol()&&(W.inTag+=" "));return ee}return{startState:function(){var L=y.startState(ue);return{token:G,inTag:null,localMode:null,localState:null,htmlState:L}},copyState:function(L){var W;return L.localState&&(W=y.copyState(L.localMode,L.localState)),{token:L.token,inTag:L.inTag,localMode:L.localMode,localState:W,htmlState:y.copyState(ue,L.htmlState)}},token:function(L,W){return W.token(L,W)},indent:function(L,W,ee){return!L.localMode||/^\s*<\//.test(W)?ue.indent(L.htmlState,W,ee):L.localMode.indent?L.localMode.indent(L.localState,W,ee):y.Pass},innerMode:function(L){return{state:L.localState||L.htmlState,mode:L.localMode||ue}}}},"xml","javascript","css"),y.defineMIME("text/html","htmlmixed")})})();const Mf=Kn({__name:"CodeMirror",props:{mode:{type:String,default:fn.JSON,validator(v){return Object.values(fn).includes(v)}},value:{type:String,default:""},readonly:{type:Boolean,default:!1}},emits:["change"],setup(v,{emit:M}){const y=v,E=M,$=Li();let X;const ve=uf(U,100),ae=ff();Oo(()=>y.value,Y=>Wr(this,null,function*(){yield Fl();const j=X==null?void 0:X.getValue();Y!==j&&(X==null||X.setValue(Y||""))}),{flush:"post"}),Xl(()=>{X==null||X.setOption("mode",y.mode)}),Oo(()=>ae.getDarkMode,()=>Wr(this,null,function*(){P()}),{immediate:!0});function P(){var Y;(Y=_t(X))==null||Y.setOption("theme",ae.getDarkMode==="light"?"idea":"material-palenight")}function U(){X==null||X.refresh()}function K(){return Wr(this,null,function*(){const Y={autoCloseBrackets:!0,autoCloseTags:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers"]};X=xf($.value,un({value:"",mode:y.mode,readOnly:y.readonly,tabSize:2,theme:"material-palenight",lineWrapping:!0,lineNumbers:!0},Y)),X==null||X.setValue(y.value),P(),X==null||X.on("change",()=>{E("change",X==null?void 0:X.getValue())})})}return vf(()=>Wr(this,null,function*(){yield Fl(),K(),wf(ve)})),gf(()=>{X=null}),(Y,j)=>(Ai(),Yl("div",{class:"relative !h-full w-full overflow-hidden",ref_key:"el",ref:$},null,512))}}),Nf={class:"h-full"},Of=Kn({__name:"CodeEditor",props:{value:{type:[Object,String]},mode:{type:String,default:fn.JSON,validator(v){return Object.values(fn).includes(v)}},readonly:{type:Boolean},autoFormat:{type:Boolean,default:!0}},emits:["change","update:value","format-error"],setup(v,{emit:M}){const y=v,E=M,$=Wo(()=>{const{value:ve,mode:ae,autoFormat:P}=y;if(!P||ae!==fn.JSON)return ve;let U=ve;if(cf(ve))try{U=JSON.parse(ve)}catch(K){return E("format-error",ve),ve}return JSON.stringify(U,null,2)});function X(ve){E("update:value",ve),E("change",ve)}return(ve,ae)=>(Ai(),Yl("div",Nf,[Ti(Mf,{value:$.value,onChange:X,mode:v.mode,readonly:v.readonly},null,8,["value","mode","readonly"])]))}});var Mi={d:(v,M)=>{for(var y in M)Mi.o(M,y)&&!Mi.o(v,y)&&Object.defineProperty(v,y,{enumerable:!0,get:M[y]})},o:(v,M)=>Object.prototype.hasOwnProperty.call(v,M)},Vl={};function Ao(v,M){(M==null||M>v.length)&&(M=v.length);for(var y=0,E=new Array(M);yEf});const oe=(_l={computed:()=>Wo,createTextVNode:()=>mf,createVNode:()=>Ti,defineComponent:()=>Kn,reactive:()=>yf,ref:()=>Li,watch:()=>Oo,watchEffect:()=>Xl},No={},Mi.d(No,_l),No),Af=(0,oe.defineComponent)({props:{data:{required:!0,type:String},onClick:Function},render:function(){var v=this.data,M=this.onClick;return(0,oe.createVNode)("span",{class:"vjs-tree-brackets",onClick:M},[v])}}),Df=(0,oe.defineComponent)({emits:["change","update:modelValue"],props:{checked:{type:Boolean,default:!1},isMultiple:Boolean,onChange:Function},setup:function(v,M){var y=M.emit;return{uiType:(0,oe.computed)(function(){return v.isMultiple?"checkbox":"radio"}),model:(0,oe.computed)({get:function(){return v.checked},set:function(E){return y("update:modelValue",E)}})}},render:function(){var v=this.uiType,M=this.model,y=this.$emit;return(0,oe.createVNode)("label",{class:["vjs-check-controller",M?"is-checked":""],onClick:function(E){return E.stopPropagation()}},[(0,oe.createVNode)("span",{class:"vjs-check-controller-inner is-".concat(v)},null),(0,oe.createVNode)("input",{checked:M,class:"vjs-check-controller-original is-".concat(v),type:v,onChange:function(){return y("change",M)}},null)])}}),Pf=(0,oe.defineComponent)({props:{nodeType:{required:!0,type:String},onClick:Function},render:function(){var v=this.nodeType,M=this.onClick,y=v==="objectStart"||v==="arrayStart";return y||v==="objectCollapsed"||v==="arrayCollapsed"?(0,oe.createVNode)("span",{class:"vjs-carets vjs-carets-".concat(y?"open":"close"),onClick:M},[(0,oe.createVNode)("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},[(0,oe.createVNode)("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"},null)])]):null}});var _l,No;function Do(v){return Do=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},Do(v)}function $l(v){return Object.prototype.toString.call(v).slice(8,-1).toLowerCase()}function Er(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"root",y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,E=arguments.length>3?arguments[3]:void 0,$=E||{},X=$.key,ve=$.index,ae=$.type,P=ae===void 0?"content":ae,U=$.showComma,K=U!==void 0&&U,Y=$.length,j=Y===void 0?1:Y,ue=$l(v);if(ue==="array"){var te=Kl(v.map(function(ge,G,L){return Er(ge,"".concat(M,"[").concat(G,"]"),y+1,{index:G,showComma:G!==L.length-1,length:j,type:P})}));return[Er("[",M,y,{showComma:!1,key:X,length:v.length,type:"arrayStart"})[0]].concat(te,Er("]",M,y,{showComma:K,length:v.length,type:"arrayEnd"})[0])}if(ue==="object"){var Ce=Object.keys(v),Le=Kl(Ce.map(function(ge,G,L){return Er(v[ge],/^[a-zA-Z_]\w*$/.test(ge)?"".concat(M,".").concat(ge):"".concat(M,'["').concat(ge,'"]'),y+1,{key:ge,showComma:G!==L.length-1,length:j,type:P})}));return[Er("{",M,y,{showComma:!1,key:X,index:ve,length:Ce.length,type:"objectStart"})[0]].concat(Le,Er("}",M,y,{showComma:K,length:Ce.length,type:"objectEnd"})[0])}return[{content:v,level:y,key:X,index:ve,path:M,showComma:K,length:j,type:P}]}function Kl(v){if(typeof Array.prototype.flat=="function")return v.flat();for(var M=Ni(v),y=[];M.length;){var E=M.shift();Array.isArray(E)?M.unshift.apply(M,Ni(E)):y.push(E)}return y}function Po(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(v==null)return v;if(v instanceof Date)return new Date(v);if(v instanceof RegExp)return new RegExp(v);if(Do(v)!=="object")return v;if(M.get(v))return M.get(v);if(Array.isArray(v)){var y=v.map(function(X){return Po(X,M)});return M.set(v,y),y}var E={};for(var $ in v)E[$]=Po(v[$],M);return M.set(v,E),E}function jl(v,M){var y=Object.keys(v);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(v);M&&(E=E.filter(function($){return Object.getOwnPropertyDescriptor(v,$).enumerable})),y.push.apply(y,E)}return y}function Ul(v){for(var M=1;M=L||ce.length>=W,Ne=(we=v.pathCollapsible)===null||we===void 0?void 0:we.call(v,ce);return ce.type!=="objectStart"&&ce.type!=="arrayStart"||!me&&!Ne?ee:Mt(Mt({},ee),{},Oi({},ce.path,1))},{})},ae=(0,oe.reactive)({translateY:0,visibleData:null,hiddenPaths:ve(v.deep,v.collapsedNodeLength)}),P=(0,oe.computed)(function(){for(var L=null,W=[],ee=X.value.length,ce=0;ceL.length?L.length-ee:we;me<0&&(me=0);var Ne=me+ee;ae.translateY=me*v.itemHeight,ae.visibleData=L.filter(function(ie,Z){return Z>=me&&Z(Ai(),Zl(_t(zf),{path:"res",deep:3,showLength:!0,data:v.data},null,8,["data"]))}}),Ff=ql(Of);ql(Hf);const If=Kn({__name:"drawer",emits:["success","register"],setup(v,{emit:M}){const y=M,E=Li(!0),$=Li(),[X,{resetFields:ve,setFieldsValue:ae,validate:P}]=tf({labelWidth:120,schemas:nf,showActionButtonGroup:!1}),[U,{setDrawerProps:K,closeDrawer:Y}]=lf(te=>Wr(this,null,function*(){yield ve(),K({confirmLoading:!1}),E.value=!!(te!=null&&te.isUpdate),$.value=te==null?void 0:te.record,yield ae(un({},te.record))})),j=Wo(()=>_t(E)?"编辑":"新增");function ue(){return Wr(this,null,function*(){try{const te=yield P();K({confirmLoading:!0});const Ce=Hl(te,[]),Le=_t(E)?af:of,ge=_t(E)?Object.assign({},un(un({},_t($)),Ce)):un({},Ce);yield Le(ge),Y(),y("success")}finally{K({confirmLoading:!1})}})}return(te,Ce)=>(Ai(),Zl(_t(sf),bf(te.$attrs,{onRegister:_t(U),showFooter:"",title:j.value,width:"600px",onOk:ue}),{default:Il(()=>[Ti(_t(rf),{onRegister:_t(X)},{paramJson:Il(({model:Le})=>[Ti(_t(Ff),{style:{height:"500px"},"auto-height":!1,value:Le.paramJson,"onUpdate:value":ge=>Le.paramJson=ge,onChange:ge=>{Le.paramJson=ge}},null,8,["value","onUpdate:value","onChange"])]),_:1},8,["onRegister"])]),_:1},16,["onRegister","title"]))}});const Jf=df(If,[["__scopeId","data-v-a1e44071"]]);export{Jf as default};