diff --git a/platform/CTFd/plugins/exam_mode/__init__.py b/platform/CTFd/plugins/exam_mode/__init__.py new file mode 100644 index 0000000000..c7506226cd --- /dev/null +++ b/platform/CTFd/plugins/exam_mode/__init__.py @@ -0,0 +1,78 @@ +from flask import Blueprint, render_template, request, redirect, url_for, session +from CTFd.models import db, Users, UserFieldEntries, UserFields, Configs +from CTFd.utils.decorators import admins_only +from CTFd.plugins import register_admin_plugin_menu_bar +from CTFd.utils import set_config, get_config + +def load(app): + # Register menu item + register_admin_plugin_menu_bar( + title='Exam Mode', + route='/admin/exam_mode/' + ) + + # Create blueprint + exam_mode = Blueprint( + 'exam_mode', + __name__, + template_folder='templates', + url_prefix='/admin/exam_mode' + ) + + @exam_mode.route('/', methods=['GET']) + @admins_only + def index(): + enabled = get_config('exam_mode_enabled', False) + allowed_ids = get_config('exam_mode_allowed_ids', '') + return render_template('exam_mode_config.html', exam_mode_enabled=enabled, exam_mode_allowed_ids=allowed_ids) + + @exam_mode.route('/update', methods=['POST']) + @admins_only + def update_config(): + enabled = request.form.get('exam_mode_enabled') == 'on' + allowed_ids_text = request.form.get('exam_mode_allowed_ids', '').strip() + + # Save config + set_config('exam_mode_enabled', 'true' if enabled else 'false') + set_config('exam_mode_allowed_ids', allowed_ids_text) + + # Parse allowed IDs + allowed_ids = set(line.strip() for line in allowed_ids_text.splitlines() if line.strip()) + + # Get Student ID field + student_id_field = UserFields.query.filter_by(name="Student ID Number").first() + + if not student_id_field: + # If field doesn't exist, we can't filter by it, so maybe just warn? + # For now, let's assume it exists as per requirements. + pass + + # Bulk update logic + users = Users.query.filter_by(type='user').all() + + for user in users: + should_ban = False + + if enabled: + # Check if user has allowed student ID + user_student_id = None + if student_id_field: + entry = UserFieldEntries.query.filter_by(user_id=user.id, field_id=student_id_field.id).first() + if entry: + user_student_id = entry.value + + if user_student_id and user_student_id in allowed_ids: + should_ban = False + else: + should_ban = True + else: + # If disabled, unban everyone (or revert to previous state? Requirement says unban) + should_ban = False + + user.banned = should_ban + + db.session.commit() + + return redirect(url_for('exam_mode.index')) + + app.register_blueprint(exam_mode) diff --git a/platform/CTFd/plugins/exam_mode/templates/exam_mode_config.html b/platform/CTFd/plugins/exam_mode/templates/exam_mode_config.html new file mode 100644 index 0000000000..c1f436a776 --- /dev/null +++ b/platform/CTFd/plugins/exam_mode/templates/exam_mode_config.html @@ -0,0 +1,50 @@ +{% extends "admin/base.html" %} + +{% block stylesheets %} + +{% endblock %} + +{% block content %} +
+
+

Exam Mode Configuration

+
+
+ +
+
+
+
+ + +
+
+ + +
+ + When enabled, all users NOT in the allowed list will be BANNED. +
+ WARNING: Enabling this will modify the 'banned' status of users in the database. +
+
+ +
+ + + Enter the Student IDs of users who should be allowed access during the exam. +
+ + +
+
+
+
+{% endblock %} + +{% block scripts %} +{% endblock %} diff --git a/platform/CTFd/plugins/sql_challenges/__init__.py b/platform/CTFd/plugins/sql_challenges/__init__.py index 4a56490f3f..531a874280 100644 --- a/platform/CTFd/plugins/sql_challenges/__init__.py +++ b/platform/CTFd/plugins/sql_challenges/__init__.py @@ -222,6 +222,11 @@ def attempt(cls, challenge, request): import logging logging.info(f"SQL Challenge attempt - Test mode: {is_test}, User ID: {user_id}, User Name: {user_name}, IP: {client_ip}") + # Enforce duplicate login check (session validation) + # This will abort if the session is invalid (e.g. duplicate login) + from CTFd.utils.user import get_current_user + get_current_user() + if not submission: return ChallengeResponse( status="incorrect", diff --git a/platform/CTFd/themes/admin/static/assets/htmlmixed-DzKIYTqA.js b/platform/CTFd/themes/admin/static/assets/htmlmixed-DzKIYTqA.js deleted file mode 100644 index 66d940cec5..0000000000 --- a/platform/CTFd/themes/admin/static/assets/htmlmixed-DzKIYTqA.js +++ /dev/null @@ -1,24 +0,0 @@ -import{E as pu,G as vu}from"./pages/main-CcyKUC_q.js";var lo={exports:{}},sa;function An(){return sa||(sa=1,function(Zr,Dn){(function(F,We){Zr.exports=We()})(pu,function(){var F=navigator.userAgent,We=navigator.platform,pe=/gecko\/\d/i.test(F),Je=/MSIE \d/.test(F),dt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(F),Pe=/Edge\/(\d+)/.exec(F),P=Je||dt||Pe,I=P&&(Je?document.documentMode||6:+(Pe||dt)[1]),se=!Pe&&/WebKit\//.test(F),re=se&&/Qt\/\d+\.\d+/.test(F),X=!Pe&&/Chrome\//.test(F),J=/Opera\//.test(F),fe=/Apple Computer/.test(navigator.vendor),Le=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(F),ze=/PhantomJS/.test(F),$=!Pe&&/AppleWebKit/.test(F)&&/Mobile\/\w+/.test(F),_e=/Android/.test(F),Q=$||_e||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(F),Y=$||/Mac/.test(We),Te=/\bCrOS\b/.test(F),bt=/win/i.test(We),Ae=J&&F.match(/Version\/(\d*\.\d*)/);Ae&&(Ae=Number(Ae[1])),Ae&&Ae>=15&&(J=!1,se=!0);var rt=Y&&(re||J&&(Ae==null||Ae<12.11)),Ie=pe||P&&I>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var j=function(e,t){var n=e.className,r=_(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 k(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function z(e,t){return k(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 l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var K=function(){this.id=null,this.f=null,this.time=0,this.handler=wt(this.onTimeout,this)};K.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},K.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Dt=[""];function Ct(e){for(;Dt.length<=e;)Dt.push(ee(Dt)+" ");return Dt[e]}function ee(e){return e[e.length-1]}function ce(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||fr.test(e))}function y(e,t){return t?t.source.indexOf("\\w")>-1&&me(e)?!0:t.test(e):me(e)}function T(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var x=/[\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 oe(e){return e.charCodeAt(0)>=768&&x.test(e)}function Ge(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 Gt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),l.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var Se=null;function Lt(e,t,n){var r;Se=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:Se=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:Se=i)}return r??Se}var Sr=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]/,l=/[Lb1n]/,a=/[1n]/;function s(u,d,h){this.level=u,this.from=d,this.to=h}return function(u,d){var h=d=="ltr"?"L":"R";if(u.length==0||d=="ltr"&&!r.test(u))return!1;for(var m=u.length,g=[],b=0;b-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Me(e,t){var n=Jr(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function $t(e){e.prototype.on=function(t,n){U(this,t,n)},e.prototype.off=function(t,n){te(this,t,n)}}function Be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Wn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function dr(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function $e(e){Be(e),Wn(e)}function Lr(e){return e.target||e.srcElement}function Pn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Y&&e.ctrlKey&&t==1&&(t=3),t}var Wt=function(){if(P&&I<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e}(),Qr;function zn(e){if(Qr==null){var t=c("span","​");z(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Qr=t.offsetWidth<=1&&t.offsetHeight>2&&!(P&&I<8))}var n=Qr?c("span","​"):c("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Tr;function di(e){if(Tr!=null)return Tr;var t=z(e,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),r=L(t,1,2).getBoundingClientRect();return k(e),!n||n.left==n.right?!1:Tr=r.right-n.right<3}var Pt=` - -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),l=o.indexOf("\r");l!=-1?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},zt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},er=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mr=null;function Ut(e){if(Mr!=null)return Mr;var t=z(e,c("span","x")),n=t.getBoundingClientRect(),r=L(t,0,1).getBoundingClientRect();return Mr=Math.abs(n.left-r.left)>1}var Vr={},qt={};function Nr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Vr[e]=t}function Tt(e,t){qt[e]=t}function Xt(e){if(typeof e=="string"&&qt.hasOwnProperty(e))e=qt[e];else if(e&&typeof e.name=="string"&&qt.hasOwnProperty(e.name)){var t=qt[e.name];typeof t=="string"&&(t={name:t}),e=gt(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function $r(e,t){t=Xt(t);var n=Vr[t.name];if(!n)return $r(e,"text/plain");var r=n(e,t);if(Yt.hasOwnProperty(t.name)){var i=Yt[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 l in t.modeProps)r[l]=t.modeProps[l];return r}var Yt={};function hi(e,t){var n=Yt.hasOwnProperty(e)?Yt[e]:Yt[e]={};vt(t,n)}function kt(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 Ar(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 Hn(e,t,n){return e.startState?e.startState(t,n):!0}var we=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};we.prototype.eol=function(){return this.pos>=this.string.length},we.prototype.sol=function(){return this.pos==this.lineStart},we.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},we.prototype.next=function(){if(this.post},we.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},we.prototype.skipToEnd=function(){this.pos=this.string.length},we.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},we.prototype.backUp=function(e){this.pos-=e},we.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},we.prototype.current=function(){return this.string.slice(this.start,this.pos)},we.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},we.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},we.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function B(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?v(n,B(e,n).text.length):va(t,B(e,t.line).text.length)}function va(e,t){var n=e.ch;return n==null||n>t?v(e.line,t):n<0?v(e.line,0):e}function ao(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Et.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}},Et.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Et.fromSaved=function(e,t,n){return t instanceof Fn?new Et(e,kt(e.mode,t.state),n,t.lookAhead):new Et(e,kt(e.mode,t),n)},Et.prototype.save=function(e){var t=e!==!1?kt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function so(e,t,n,r){var i=[e.state.modeGen],o={};vo(e,t.text,e.doc.mode,n,function(u,d){return i.push(u,d)},o,r);for(var l=n.state,a=function(u){n.baseTokens=i;var d=e.state.overlays[u],h=1,m=0;n.state=!0,vo(e,t.text,d.mode,n,function(g,b){for(var S=h;mg&&i.splice(h,1,g,i[h+1],C),h+=2,m=Math.min(g,C)}if(b)if(d.opaque)i.splice(S,h-S,g,"overlay "+b),h=S+2;else for(;Se.options.maxHighlightLength&&kt(e.doc.mode,r.state),o=so(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 tn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Et(r,!0,t);var o=ga(e,t,n),l=o>r.first&&B(r,o-1).stateAfter,a=l?Et.fromSaved(r,l,o):new Et(r,Hn(r.mode),o);return r.iter(o,t,function(s){pi(e,s.text,a);var u=a.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 co=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ho(e,t,n,r){var i=e.doc,o=i.mode,l;t=Z(i,t);var a=B(i,t.line),s=tn(e,t.line,n),u=new we(a.text,e.options.tabSize,s),d;for(r&&(d=[]);(r||u.pose.options.maxHighlightLength?(a=!1,l&&pi(e,t,r,d.pos),d.pos=t.length,h=null):h=po(vi(n,d,r.state,m),o),m){var g=m[0].name;g&&(h="m-"+(h?g+" "+h:g))}if(!a||u!=h){for(;sl;--a){if(a<=o.first)return o.first;var s=B(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof Fn?u.lookAhead:0)<=o.modeFrontier))return a;var d=be(s.text,null,e.options.tabSize);(i==null||r>d)&&(i=a-1,r=d)}return i}function ma(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=B(e,r).stateAfter;if(i&&(!(i instanceof Fn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new In(l,o.from,s?null:o.to))}}return r}function Sa(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from0&&a)for(var W=0;W0)){var d=[s,1],h=M(u.from,a.from),m=M(u.to,a.to);(h<0||!l.inclusiveLeft&&!h)&&d.push({from:u.from,to:a.from}),(m>0||!l.inclusiveRight&&!m)&&d.push({from:a.to,to:u.to}),i.splice.apply(i,d),s+=d.length-3}}return i}function yo(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||mi(r,o.marker)<0)&&(r=o.marker)}return r}function ko(e,t,n,r,i){var o=B(e,t),l=jt&&o.markedSpans;if(l)for(var a=0;a=0&&h<=0||d<=0&&h>=0)&&(d<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?M(u.to,n)>=0:M(u.to,n)>0)||d>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?M(u.from,r)<=0:M(u.from,r)<0)))return!0}}}function Ft(e){for(var t;t=wo(e);)e=t.find(-1,!0).line;return e}function Ta(e){for(var t;t=Kn(e);)e=t.find(1,!0).line;return e}function Ma(e){for(var t,n;t=Kn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function yi(e,t){var n=B(e,t),r=Ft(n);return n==r?t:ae(r)}function So(e,t){if(t>e.lastLine())return t;var n=B(e,t),r;if(!tr(e,n))return t;for(;r=Kn(n);)n=r.find(1,!0).line;return ae(n)+1}function tr(e,t){var n=jt&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Dr=function(e,t,n){this.text=e,bo(this,t),this.height=n?n(this):1};Dr.prototype.lineNo=function(){return ae(this)},$t(Dr);function Na(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),yo(e),bo(e,n);var i=r?r(e):1;i!=e.height&&St(e,i)}function Aa(e){e.parent=null,yo(e)}var Da={},Oa={};function Co(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Oa:Da;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Lo(e,t){var n=D("span",null,null,se?"padding-right: .1px":null),r={pre:D("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,l=void 0;r.pos=0,r.addToken=Pa,di(e.display.measure)&&(l=nt(o,e.doc.direction))&&(r.addToken=Ha(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&ae(o);Ea(o,r,uo(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=xt(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=xt(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(zn(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(se){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 Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=xt(r.pre.className,r.textClass||"")),r}function Wa(e){var t=c("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Pa(e,t,n,r,i,o,l){if(t){var a=e.splitSpaces?za(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,d;if(!s.test(t))e.col+=t.length,d=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,d),P&&I<9&&(u=!0),e.pos+=t.length;else{d=document.createDocumentFragment();for(var h=0;;){s.lastIndex=h;var m=s.exec(t),g=m?m.index-h:t.length-h;if(g){var b=document.createTextNode(a.slice(h,h+g));P&&I<9?d.appendChild(c("span",[b])):d.appendChild(b),e.map.push(e.pos,e.pos+g,b),e.col+=g,e.pos+=g}if(!m)break;h+=g+1;var S=void 0;if(m[0]==" "){var C=e.cm.options.tabSize,N=C-e.col%C;S=d.appendChild(c("span",Ct(N),"cm-tab")),S.setAttribute("role","presentation"),S.setAttribute("cm-text"," "),e.col+=N}else m[0]=="\r"||m[0]==` -`?(S=d.appendChild(c("span",m[0]=="\r"?"␍":"␤","cm-invalidchar")),S.setAttribute("cm-text",m[0]),e.col+=1):(S=e.cm.options.specialCharPlaceholder(m[0]),S.setAttribute("cm-text",m[0]),P&&I<9?d.appendChild(c("span",[S])):d.appendChild(S),e.col+=1);e.map.push(e.pos,e.pos+1,S),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,n||r||i||u||o||l){var O=n||"";r&&(O+=r),i&&(O+=i);var A=c("span",[d],O,o);if(l)for(var W in l)l.hasOwnProperty(W)&&W!="style"&&W!="class"&&A.setAttribute(W,l[W]);return e.content.appendChild(A)}e.content.appendChild(d)}}function za(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&h.from<=u));m++);if(h.to>=d)return e(n,r,i,o,l,a,s);e(n,r.slice(0,h.to-u),i,o,null,a,s),o=null,r=r.slice(h.to-u),u=h.to}}}function To(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 Ea(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var l=1;ls||V.collapsed&&R.to==s&&R.from==s)){if(R.to!=null&&R.to!=s&&g>R.to&&(g=R.to,S=""),V.className&&(b+=" "+V.className),V.css&&(m=(m?m+";":"")+V.css),V.startStyle&&R.from==s&&(C+=" "+V.startStyle),V.endStyle&&R.to==g&&(W||(W=[])).push(V.endStyle,R.to),V.title&&((O||(O={})).title=V.title),V.attributes)for(var ge in V.attributes)(O||(O={}))[ge]=V.attributes[ge];V.collapsed&&(!N||mi(N.marker,V)<0)&&(N=R)}else R.from>s&&g>R.from&&(g=R.from)}if(W)for(var Xe=0;Xe=a)break;for(var pt=Math.min(a,g);;){if(d){var ut=s+d.length;if(!N){var Ee=ut>pt?d.slice(0,pt-s):d;t.addToken(t,Ee,h?h+b:b,C,s+Ee.length==g?S:"",m,O)}if(ut>=pt){d=d.slice(pt-s),s=pt;break}s=ut,C=""}d=i.slice(o,o=n[u++]),h=Co(n[u++],t.cm.options)}}}function Mo(e,t,n){this.line=t,this.rest=Ma(t),this.size=this.rest?ae(ee(this.rest))-n+1:1,this.node=this.text=null,this.hidden=tr(e,t)}function Gn(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 zo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Ya(e,t){t=Ft(t);var n=ae(t),r=e.display.externalMeasured=new Mo(e.doc,t,n);r.lineN=n;var i=r.built=Lo(e,r);return r.text=i.pre,z(e.display.lineMeasure,i.pre),r}function Ho(e,t,n,r){return Bt(e,Wr(e,t),n,r)}function Ci(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-a,i=o-1,t>=s&&(l="right")),i!=null){if(r=e[u+2],a==s&&n==(r.insertLeft?"left":"right")&&(l=n),n=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],l="left";if(n=="right"&&i==s-a)for(;u=0&&(n=e[i]).left==n.right;i--);return n}function Za(e,t,n,r){var i=Fo(t.map,n,r),o=i.node,l=i.start,a=i.end,s=i.collapse,u;if(o.nodeType==3){for(var d=0;d<4;d++){for(;l&&oe(t.line.text.charAt(i.coverStart+l));)--l;for(;i.coverStart+a0&&(s=r="right");var h;e.options.lineWrapping&&(h=o.getClientRects()).length>1?u=h[r=="right"?h.length-1:0]:u=o.getBoundingClientRect()}if(P&&I<9&&!l&&(!u||!u.left&&!u.right)){var m=o.parentNode.getClientRects()[0];m?u={left:m.left,right:m.left+zr(e.display),top:m.top,bottom:m.bottom}:u=Eo}for(var g=u.top-t.rect.top,b=u.bottom-t.rect.top,S=(g+b)/2,C=t.view.measure.heights,N=0;N=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l(u=="before"?s-1:s,u=="before");function d(b,S,C){var N=a[S],O=N.level==1;return l(C?b-1:b,O!=C)}var h=Lt(a,s,u),m=Se,g=d(s,h,u=="before");return m!=null&&(g.other=d(s,m,u!="before")),g}function Go(e,t){var n=0;t=Z(e.doc,t),e.options.lineWrapping||(n=zr(e.display)*t.ch);var r=B(e.doc,t.line),i=Zt(r)+Un(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Mi(e,t,n,r,i){var o=v(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Ni(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Mi(r.first,0,null,-1,-1);var i=f(r,n),o=r.first+r.size-1;if(i>o)return Mi(r.first+r.size-1,B(r,o).text.length,null,1,1);t<0&&(t=0);for(var l=B(r,i);;){var a=Qa(e,l,i,t,n),s=La(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=B(r,i=u.line)}}function Uo(e,t,n,r){r-=Li(t);var i=t.text.length,o=cr(function(l){return Bt(e,n,l-1).bottom<=r},i,0);return i=cr(function(l){return Bt(e,n,l).top>r},o,i),{begin:o,end:i}}function qo(e,t,n,r){n||(n=Wr(e,t));var i=qn(e,t,Bt(e,n,r),"line").top;return Uo(e,t,n,i)}function Ai(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Qa(e,t,n,r,i){i-=Zt(t);var o=Wr(e,t),l=Li(t),a=0,s=t.text.length,u=!0,d=nt(t,e.doc.direction);if(d){var h=(e.options.lineWrapping?$a:Va)(e,t,n,o,d,r,i);u=h.level!=1,a=u?h.from:h.to-1,s=u?h.to:h.from-1}var m=null,g=null,b=cr(function(q){var R=Bt(e,o,q);return R.top+=l,R.bottom+=l,Ai(R,r,i,!1)?(R.top<=i&&R.left<=r&&(m=q,g=R),!0):!1},a,s),S,C,N=!1;if(g){var O=r-g.left=W.bottom?1:0}return b=Ge(t.text,b,1),Mi(n,b,C,N,r-S)}function Va(e,t,n,r,i,o,l){var a=cr(function(h){var m=i[h],g=m.level!=1;return Ai(Mt(e,v(n,g?m.to:m.from,g?"before":"after"),"line",t,r),o,l,!0)},0,i.length-1),s=i[a];if(a>0){var u=s.level!=1,d=Mt(e,v(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Ai(d,o,l,!0)&&d.top>l&&(s=i[a-1])}return s}function $a(e,t,n,r,i,o,l){var a=Uo(e,t,r,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,h=null,m=0;m=u||g.to<=s)){var b=g.level!=1,S=Bt(e,r,b?Math.min(u,g.to)-1:Math.max(s,g.from)).right,C=SC)&&(d=g,h=C)}}return d||(d=i[i.length-1]),d.fromu&&(d={from:d.from,to:u,level:d.level}),d}var pr;function Pr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(pr==null){pr=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)pr.appendChild(document.createTextNode("x")),pr.appendChild(c("br"));pr.appendChild(document.createTextNode("x"))}z(e.measure,pr);var n=pr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),k(e.measure),n||1}function zr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),n=c("pre",[t],"CodeMirror-line-like");z(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Di(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:Oi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Oi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Xo(e){var t=Pr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/zr(e.display)-3);return function(i){if(tr(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l0&&(u=B(e.doc,s.line).text).length==s.ch){var d=be(u,u.length,e.options.tabSize)-u.length;s=v(s.line,Math.max(0,Math.round((o-Po(e.display).left)/zr(e.display))-d))}return s}function gr(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)jt&&yi(e.doc,t)i.viewFrom?nr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)nr(e);else if(t<=i.viewFrom){var o=Xn(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):nr(e)}else if(n>=i.viewTo){var l=Xn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):nr(e)}else{var a=Xn(e,t,t,-1),s=Xn(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Gn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):nr(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[gr(e,t)];if(o.node!=null){var l=o.changes||(o.changes=[]);E(l,n)==-1&&l.push(n)}}}function nr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Xn(e,t,n,r){var i=gr(e,t),o,l=e.display.view;if(!jt||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var a=e.display.viewFrom,s=0;s0){if(i==l.length-1)return null;o=a+l[i].size-t,i++}else o=a-t;t+=o,n+=o}for(;yi(e.doc,n)!=n;){if(i==(r<0?0:l.length-1))return null;n+=r*l[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function es(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Gn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Gn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,gr(e,n)))),r.viewTo=n}function Yo(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||a.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Hr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Jo(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Hi(e))}function zi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Hr(e))},100)}function Hi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,De(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),se&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Pi(e))}function Hr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,j(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function jn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||d<-.005)&&(St(i.line,l),Qo(i.line),i.rest))for(var h=0;he.display.sizerWidth){var m=Math.ceil(a/zr(e.display));m>e.display.maxLineLength&&(e.display.maxLineLength=m,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Qo(e){if(e.widgets)for(var t=0;t=l&&(o=f(t,Zt(B(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function rs(e,t){if(!xe(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!ze){var o=c("div","​",null,`position: absolute; - top: `+(t.top-n.viewOffset-Un(e.display))+`px; - height: `+(t.bottom-t.top+It(e)+n.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function ns(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?v(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?v(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,a=Mt(e,t),s=!n||n==t?a:Mt(e,n);i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=Ei(e,i),d=e.doc.scrollTop,h=e.doc.scrollLeft;if(u.scrollTop!=null&&(fn(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(l=!0)),u.scrollLeft!=null&&(mr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}function is(e,t){var n=Ei(e,t);n.scrollTop!=null&&fn(e,n.scrollTop),n.scrollLeft!=null&&mr(e,n.scrollLeft)}function Ei(e,t){var n=e.display,r=Pr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Si(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+ki(n),s=t.topa-r;if(t.topi+o){var d=Math.min(t.top,(u?a:t.bottom)-o);d!=i&&(l.scrollTop=d)}var h=e.options.fixedGutter?0:n.gutters.offsetWidth,m=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-h,g=hr(e)-n.gutters.offsetWidth,b=t.right-t.left>g;return b&&(t.right=t.left+g),t.left<10?l.scrollLeft=0:t.leftg+m-3&&(l.scrollLeft=t.right+(b?0:10)-g),l}function Fi(e,t){t!=null&&(Jn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Er(e){Jn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function un(e,t,n){(t!=null||n!=null)&&Jn(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function os(e,t){Jn(e),e.curOp.scrollToPos=t}function Jn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Go(e,t.from),r=Go(e,t.to);Vo(e,n,r,t.margin)}}function Vo(e,t,n,r){var i=Ei(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});un(e,i.scrollLeft,i.scrollTop)}function fn(e,t){Math.abs(e.doc.scrollTop-t)<2||(pe||Bi(e,{top:t}),$o(e,t,!0),pe&&Bi(e),hn(e,100))}function $o(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,il(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+It(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var yr=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),U(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),U(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,P&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};yr.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.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}},yr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},yr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},yr.prototype.zeroWidthHack=function(){var e=Y&&!Le?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new K,this.disableVert=new K},yr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";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.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},yr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var dn=function(){};dn.prototype.update=function(){return{bottom:0,right:0}},dn.prototype.setScrollLeft=function(){},dn.prototype.setScrollTop=function(){},dn.prototype.clear=function(){};function Fr(e,t){t||(t=cn(e));var n=e.display.barWidth,r=e.display.barHeight;el(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&jn(e),el(e,cn(e)),n=e.display.barWidth,r=e.display.barHeight}function el(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 tl={native:yr,null:dn};function rl(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new tl[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),U(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):fn(e,t)},e),e.display.scrollbars.addClass&&De(e.display.wrapper,e.display.scrollbars.addClass)}var ls=0;function br(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:++ls},Fa(e.curOp)}function xr(e){var t=e.curOp;t&&Ba(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Qn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function us(e){e.updatedDisplay=e.mustUpdate&&Ii(e.cm,e.update)}function fs(e){var t=e.cm,n=t.display;e.updatedDisplay&&jn(t),e.barMeasure=cn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ho(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+It(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-hr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function cs(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=tn(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 l=o.styles,a=o.text.length>e.options.maxHighlightLength?kt(t.mode,r.state):null,s=so(e,o,r,!0);a&&(r.state=a),o.styles=s.styles;var u=o.styleClasses,d=s.classes;d?o.styleClasses=d:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),m=0;!h&&mn)return hn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ht(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&&Yo(e)==0)return!1;ol(e)&&(nr(e),t.dims=Di(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),jt&&(o=yi(e.doc,o),l=So(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;es(e,o,l),n.viewOffset=Zt(B(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Yo(e);if(!a&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var u=vs(e);return s>4&&(n.lineDiv.style.display="none"),ms(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,gs(u),k(n.cursorDiv),k(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,hn(e,400)),n.updateLineNumbers=null,!0}function nl(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==hr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ki(e.display)-Si(e),n.top)}),t.visible=Zn(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Zn(e.display,e.doc,n));if(!Ii(e,t))break;jn(e);var i=cn(e);sn(e),Fr(e,i),Ki(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 Bi(e,t){var n=new Qn(e,t);if(Ii(e,n)){jn(e),nl(e,n);var r=cn(e);sn(e),Fr(e,r),Ki(e,r),n.finish()}}function ms(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,l=o.firstChild;function a(b){var S=b.nextSibling;return se&&Y&&e.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),S}for(var s=r.view,u=r.viewFrom,d=0;d-1&&(g=!1),No(e,h,u,n)),g&&(k(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(w(e.options,u)))),l=h.node.nextSibling}u+=h.size}for(;l;)l=a(l)}function Ri(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ki(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+It(e)+"px"}function il(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Oi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;ll.clientWidth,s=l.scrollHeight>l.clientHeight;if(r&&a||i&&s){if(i&&Y&&se){e:for(var u=t.target,d=o.view;u!=l;u=u.parentNode)for(var h=0;h=0&&M(e,r.to())<=0)return n}return-1};var ue=function(e,t){this.anchor=e,this.head=t};ue.prototype.from=function(){return lt(this.anchor,this.head)},ue.prototype.to=function(){return Re(this.anchor,this.head)},ue.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Nt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(m,g){return M(m.from(),g.from())}),n=E(t,i);for(var o=1;o0:s>=0){var u=lt(a.from(),l.from()),d=Re(a.to(),l.to()),h=a.empty()?l.from()==l.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new ue(h?d:u,h?u:d))}}return new yt(t,n)}function ir(e,t){return new yt([new ue(e,t||e)],0)}function or(e){return e.text?v(e.from.line+e.text.length-1,ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ul(e,t){if(M(e,t.from)<0)return e;if(M(e,t.to)<=0)return or(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+=or(t).ch-t.to.ch),v(n,r)}function Gi(e,t){for(var n=[],r=0;r1&&e.remove(a.line+1,b-1),e.insert(a.line+1,N)}je(e,"change",e,t)}function lr(e,t,n){function r(i,o,l){if(i.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ee(e.done)}function vl(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,l,a;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)=="*"))&&(l=ks(i,i.lastOp==r)))a=ee(l.changes),M(t.from,t.to)==0&&M(t.from,a.to)==0?a.to=or(t):l.changes.push(Xi(e,t));else{var s=ee(i.done);for((!s||!s.ranges)&&ei(e.sel,i.done),l={changes:[Xi(e,t)],generation:i.generation},i.done.push(l);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,a||Me(e,"historyAdded")}function Ss(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 Cs(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||Ss(e,o,ee(i.done),t))?i.done[i.done.length-1]=t:ei(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&pl(i.undone)}function ei(e,t){var n=ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function gl(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(l){l.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=l.markedSpans),++o})}function Ls(e){if(!e)return null;for(var t,n=0;n-1&&(ee(a)[h]=u[h],delete u[h])}}return r}function Yi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=M(t,i)<0;o!=M(n,i)<0?(i=t,t=n):o!=M(t,n)<0&&(t=n)}return new ue(i,t)}else return new ue(n||t,t)}function ti(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),et(e,new yt([Yi(e.sel.primary(),t,n,i)],0),r)}function yl(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:a.to>t.ch))){if(i&&(Me(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--l;continue}else break;if(!s.atomic)continue;if(n){var h=s.find(r<0?1:-1),m=void 0;if((r<0?d:u)&&(h=Cl(e,h,-r,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(m=M(h,n))&&(r<0?m<0:m>0))return Br(e,h,t,r,i)}var g=s.find(r<0?-1:1);return(r<0?u:d)&&(g=Cl(e,g,r,g.line==t.line?o:null)),g?Br(e,g,t,r,i):null}}return t}function ni(e,t,n,r,i){var o=r||1,l=Br(e,t,n,o,i)||!i&&Br(e,t,n,o,!0)||Br(e,t,n,-o,i)||!i&&Br(e,t,n,-o,!0);return l||(e.cantEdit=!0,v(e.first,0))}function Cl(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?Z(e,v(t.line-1)):null:n>0&&t.ch==(r||B(e,t.line)).text.length?t.line=0;--i)Ml(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ml(e,t)}}function Ml(e,t){if(!(t.text.length==1&&t.text[0]==""&&M(t.from,t.to)==0)){var n=Gi(e,t);vl(e,t,n,e.cm?e.cm.curOp.id:NaN),gn(e,t,n,gi(e,t));var r=[];lr(e,function(i,o){!o&&E(r,i.history)==-1&&(Ol(i.history,t),r.push(i.history)),gn(i,t,null,gi(i,t))})}}function ii(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,l=e.sel,a=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,u=0;u=0;--g){var b=m(g);if(b)return b.v}}}}function Nl(e,t){if(t!=0&&(e.first+=t,e.sel=new yt(ce(e.sel.ranges,function(i){return new ue(v(i.anchor.line+t,i.anchor.ch),v(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){at(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:v(o,B(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ht(e,t.from,t.to),n||(n=Gi(e,t)),e.cm?Ns(e.cm,t,r):qi(e,t,r),ri(e,n,Qe),e.cantEdit&&ni(e,v(e.firstLine(),0))&&(e.cantEdit=!1)}}function Ns(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=ae(Ft(B(r,o.line))),r.iter(s,l.line+1,function(g){if(g==i.maxLine)return a=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Cr(e),qi(r,t,n,Xo(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(g){var b=_n(g);b>i.maxLineLength&&(i.maxLine=g,i.maxLineLength=b,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),ma(r,o.line),hn(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?at(e):o.line==l.line&&t.text.length==1&&!cl(e.doc,t)?rr(e,o.line,"text"):at(e,o.line,l.line+1,u);var d=He(e,"changes"),h=He(e,"change");if(h||d){var m={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&je(e,"change",e,m),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(m)}e.display.selForContextMenu=null}function Kr(e,t,n,r,i){var o;r||(r=n),M(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),Rr(e,{from:n,to:r,text:t,origin:i})}function Al(e,t,n,r){n1||!(this.children[0]instanceof yn))){var a=[];this.collapse(a),this.children=[new yn(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var l=i.lines.length%25+25,a=l;a10);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&&at(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&kl(e.doc)),e&&je(e,"markerCleared",e,this,r,i),t&&xr(e),this.parent&&this.parent.clear()}},ar.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||l==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(ko(e,t.line,t,n,o)||t.line!=n.line&&ko(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ba()}o.addToHistory&&vl(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a=t.line,s=e.cm,u;if(e.iter(a,n.line+1,function(h){s&&o.collapsed&&!s.options.lineWrapping&&Ft(h)==s.display.maxLine&&(u=!0),o.collapsed&&a!=t.line&&St(h,0),wa(h,new In(o,a==t.line?t.ch:null,a==n.line?n.ch:null)),++a}),o.collapsed&&e.iter(t.line,n.line+1,function(h){tr(e,h)&&St(h,0)}),o.clearOnEnter&&U(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(ya(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Pl,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)at(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++)rr(s,d,"text");o.atomic&&kl(s.doc),je(s,"markerAdded",s,o)}return o}var wn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)Rr(this,r[s]);a?xl(this,a):this.cm&&Er(this.cm)}),undo:qe(function(){ii(this,"undo")}),redo:qe(function(){ii(this,"redo")}),undoSelection:qe(function(){ii(this,"undo",!0)}),redoSelection:qe(function(){ii(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=Z(this,e),t=Z(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a=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}),Z(this,v(n,t))},indexFromPos:function(e){e=Z(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 h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),ri(t.doc,ir(n,n)),h)for(var m=0;m=0;a--)Kr(e.doc,"",r[a].from,r[a].to,"+delete");Er(e)})}function Zi(e,t,n){var r=Ge(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ji(e,t,n){var r=Zi(e,t.ch,n);return r==null?null:new v(t.line,r,n<0?"after":"before")}function Qi(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=nt(n,t.doc.direction);if(o){var l=i<0?ee(o):o[0],a=i<0==(l.level==1),s=a?"after":"before",u;if(l.level>0||t.doc.direction=="rtl"){var d=Wr(t,n);u=i<0?n.text.length-1:0;var h=Bt(t,d,u).top;u=cr(function(m){return Bt(t,d,m).top==h},i<0==(l.level==1)?l.from:l.to-1,u),s=="before"&&(u=Zi(n,u,1))}else u=i<0?l.to:l.from;return new v(r,u,s)}}return new v(r,i<0?n.text.length:0,i<0?"before":"after")}function _s(e,t,n,r){var i=nt(t,e.doc.direction);if(!i)return Ji(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=Lt(i,n.ch,n.sticky),l=i[o];if(e.doc.direction=="ltr"&&l.level%2==0&&(r>0?l.to>n.ch:l.from=l.from&&m>=d.begin)){var g=h?"before":"after";return new v(n.line,m,g)}}var b=function(N,O,A){for(var W=function(ge,Xe){return Xe?new v(n.line,a(ge,1),"before"):new v(n.line,ge,"after")};N>=0&&N0==(q.level!=1),V=R?A.begin:a(A.end,-1);if(q.from<=V&&V0?d.end:a(d.begin,-1);return C!=null&&!(r>0&&C==t.text.length)&&(S=b(r>0?0:i.length-1,r,u(C)),S)?S:null}var Cn={selectAll:Ll,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Qe)},killLine:function(e){return Ur(e,function(t){if(t.empty()){var n=B(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new v(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),v(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=B(e.doc,i.line-1).text;l&&(i=new v(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),v(i.line-1,l.length-1),i,"+transpose"))}}n.push(new ue(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ht(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&&M(t,this.pos)==0&&n==this.button};var Tn,Mn;function Zs(e,t){var n=+new Date;return Mn&&Mn.compare(n,e,t)?(Tn=Mn=null,"triple"):Tn&&Tn.compare(n,e,t)?(Mn=new $i(n,e,t),Tn=null,"double"):(Tn=new $i(n,e,t),Mn=null,"single")}function Zl(e){var t=this,n=t.display;if(!(xe(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Jt(n,e)){se||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!eo(t,e)){var r=vr(t,e),i=Pn(e),o=r?Zs(r,i):"single";window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Js(t,i,r,o,e))&&(i==1?r?Vs(t,r,o,e):Lr(e)==n.scroller&&Be(e):i==2?(r&&ti(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(Ie?t.display.input.onContextMenu(e):zi(t)))}}}function Js(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,Ln(e,Rl(o,i),i,function(l){if(typeof l=="string"&&(l=Cn[l]),!l)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=l(e,n)!=ye}finally{e.state.suppressEdits=!1}return a})}function Qs(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=Te?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=Y?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(Y?n.altKey:n.ctrlKey)),i}function Vs(e,t,n,r){P?setTimeout(wt(Jo,e),0):e.curOp.focus=ve();var i=Qs(e,n,r),o=e.doc.sel,l;e.options.dragDrop&&Wt&&!e.isReadOnly()&&n=="single"&&(l=o.contains(t))>-1&&(M((l=o.ranges[l]).from(),t)<0||t.xRel>0)&&(M(l.to(),t)>0||t.xRel<0)?$s(e,r,t,i):eu(e,r,t,i)}function $s(e,t,n,r){var i=e.display,o=!1,l=Ue(e,function(u){se&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:zi(e)),te(i.wrapper.ownerDocument,"mouseup",l),te(i.wrapper.ownerDocument,"mousemove",a),te(i.scroller,"dragstart",s),te(i.scroller,"drop",l),o||(Be(u),r.addNew||ti(e.doc,n,null,null,r.extend),se&&!fe||P&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),a=function(u){o=o||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return o=!0};se&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!r.moveOnDrag,U(i.wrapper.ownerDocument,"mouseup",l),U(i.wrapper.ownerDocument,"mousemove",a),U(i.scroller,"dragstart",s),U(i.scroller,"drop",l),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Jl(e,t,n){if(n=="char")return new ue(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new ue(v(t.line,0),Z(e.doc,v(t.line+1,0)));var r=n(e,t);return new ue(r.from,r.to)}function eu(e,t,n,r){P&&zi(e);var i=e.display,o=e.doc;Be(t);var l,a,s=o.sel,u=s.ranges;if(r.addNew&&!r.extend?(a=o.sel.contains(n),a>-1?l=u[a]:l=new ue(n,n)):(l=o.sel.primary(),a=o.sel.primIndex),r.unit=="rectangle")r.addNew||(l=new ue(n,n)),n=vr(e,t,!0,!0),a=-1;else{var d=Jl(e,n,r.unit);r.extend?l=Yi(l,d.anchor,d.head,r.extend):l=d}r.addNew?a==-1?(a=u.length,et(o,Nt(e,u.concat([l]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&r.unit=="char"&&!r.extend?(et(o,Nt(e,u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):ji(o,a,l,H):(a=0,et(o,new yt([l],0),H),s=o.sel);var h=n;function m(A){if(M(h,A)!=0)if(h=A,r.unit=="rectangle"){for(var W=[],q=e.options.tabSize,R=be(B(o,n.line).text,n.ch,q),V=be(B(o,A.line).text,A.ch,q),ge=Math.min(R,V),Xe=Math.max(R,V),Ce=Math.min(n.line,A.line),pt=Math.min(e.lastLine(),Math.max(n.line,A.line));Ce<=pt;Ce++){var ut=B(o,Ce).text,Ee=_t(ut,ge,q);ge==Xe?W.push(new ue(v(Ce,Ee),v(Ce,Ee))):ut.length>Ee&&W.push(new ue(v(Ce,Ee),v(Ce,_t(ut,Xe,q))))}W.length||W.push(new ue(n,n)),et(o,Nt(e,s.ranges.slice(0,a).concat(W),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(A)}else{var ft=l,Ze=Jl(e,A,r.unit),Ke=ft.anchor,Fe;M(Ze.anchor,Ke)>0?(Fe=Ze.head,Ke=lt(ft.from(),Ze.anchor)):(Fe=Ze.anchor,Ke=Re(ft.to(),Ze.head));var Ne=s.ranges.slice(0);Ne[a]=tu(e,new ue(Z(o,Ke),Fe)),et(o,Nt(e,Ne,a),H)}}var g=i.wrapper.getBoundingClientRect(),b=0;function S(A){var W=++b,q=vr(e,A,!0,r.unit=="rectangle");if(q)if(M(q,h)!=0){e.curOp.focus=ve(),m(q);var R=Zn(i,o);(q.line>=R.to||q.lineg.bottom?20:0;V&&setTimeout(Ue(e,function(){b==W&&(i.scroller.scrollTop+=V,S(A))}),50)}}function C(A){e.state.selectingText=!1,b=1/0,A&&(Be(A),i.input.focus()),te(i.wrapper.ownerDocument,"mousemove",N),te(i.wrapper.ownerDocument,"mouseup",O),o.history.lastSelOrigin=null}var N=Ue(e,function(A){A.buttons===0||!Pn(A)?C(A):S(A)}),O=Ue(e,C);e.state.selectingText=O,U(i.wrapper.ownerDocument,"mousemove",N),U(i.wrapper.ownerDocument,"mouseup",O)}function tu(e,t){var n=t.anchor,r=t.head,i=B(e.doc,n.line);if(M(n,r)==0&&n.sticky==r.sticky)return t;var o=nt(i);if(!o)return t;var l=Lt(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s=l+(a.from==n.ch==(a.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=Lt(o,r.ch,r.sticky),h=d-l||(r.ch-n.ch)*(a.level==1?-1:1);d==s-1||d==s?u=h<0:u=h>0}var m=o[s+(u?-1:0)],g=u==(m.level==1),b=g?m.from:m.to,S=g?"after":"before";return n.ch==b&&n.sticky==S?t:new ue(new v(n.line,b,S),r)}function Ql(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{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Be(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!He(e,n))return dr(t);o-=a.top-l.viewOffset;for(var s=0;s=i){var d=f(e.doc,o),h=e.display.gutterSpecs[s];return Me(e,n,e,d,h.className,t),dr(t)}}}function eo(e,t){return Ql(e,t,"gutterClick",!0)}function Vl(e,t){Jt(e.display,t)||ru(e,t)||xe(e,t,"contextmenu")||Ie||e.display.input.onContextMenu(t)}function ru(e,t){return He(e,"gutterContextMenu")?Ql(e,t,"gutterContextMenu",!1):!1}function $l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var qr={toString:function(){return"CodeMirror.Init"}},ea={},si={};function nu(e){var t=e.optionHandlers;function n(r,i,o,l){e.defaults[r]=i,o&&(t[r]=l?function(a,s,u){u!=qr&&o(a,s,u)}:o)}e.defineOption=n,e.Init=qr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ui(r)},!0),n("indentUnit",2,Ui,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){vn(r),an(r),at(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],l=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(v(l,d))}l++});for(var a=o.length-1;a>=0;a--)Kr(r.doc,i,o[a],v(o[a].line,o[a].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=qr&&r.refresh()}),n("specialCharPlaceholder",Wa,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",Q?"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",!bt),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){$l(r),pn(r)},!0),n("keyMap","default",function(r,i,o){var l=li(i),a=o!=qr&&li(o);a&&a.detach&&a.detach(r,l),l.attach&&l.attach(r,a||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,ou,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=_i(i,r.options.lineNumbers),pn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Oi(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Fr(r)},!0),n("scrollbarStyle","native",function(r){rl(r),Fr(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=_i(r.options.gutters,i),pn(r)},!0),n("firstLineNumber",1,pn,!0),n("lineNumberFormatter",function(r){return r},pn,!0),n("showCursorWhenSelecting",!1,sn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Hr(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,iu),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,sn,!0),n("singleCursorHeightPerLine",!0,sn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,vn,!0),n("addModeClass",!1,vn,!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,vn,!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 iu(e,t,n){var r=n&&n!=qr;if(!t!=!r){var i=e.display.dragFunctions,o=t?U:te;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 ou(e){e.options.lineWrapping?(De(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(j(e.display.wrapper,"CodeMirror-wrap"),xi(e)),Wi(e),at(e),an(e),setTimeout(function(){return Fr(e)},100)}function ke(e,t){var n=this;if(!(this instanceof ke))return new ke(e,t);this.options=t=t?vt(t):{},vt(ea,t,!1);var r=t.value;typeof r=="string"?r=new st(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new ke.inputStyles[t.inputStyle](this),o=this.display=new ys(e,r,i,t);o.wrapper.CodeMirror=this,$l(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),rl(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 K,keySeq:null,specialChars:null},t.autofocus&&!Q&&o.input.focus(),P&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),lu(this),Fs(),br(this),this.curOp.forceUpdate=!0,dl(this,r),t.autofocus&&!Q||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Hi(n)},20):Hr(this);for(var l in si)si.hasOwnProperty(l)&&si[l](this,t[l],qr);ol(this),t.finishInit&&t.finishInit(this);for(var a=0;a20*20}U(t.scroller,"touchstart",function(s){if(!xe(e,s)&&!o(s)&&!eo(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)}}),U(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),U(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!Jt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var d=e.coordsChar(t.activeTouch,"page"),h;!u.prev||l(u,u.prev)?h=new ue(d,d):!u.prev.prev||l(u,u.prev.prev)?h=e.findWordAt(d):h=new ue(v(d.line,0),Z(e.doc,v(d.line+1,0))),e.setSelection(h.anchor,h.head),e.focus(),Be(s)}i()}),U(t.scroller,"touchcancel",i),U(t.scroller,"scroll",function(){t.scroller.clientHeight&&(fn(e,t.scroller.scrollTop),mr(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),U(t.scroller,"mousewheel",function(s){return sl(e,s)}),U(t.scroller,"DOMMouseScroll",function(s){return sl(e,s)}),U(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){xe(e,s)||$e(s)},over:function(s){xe(e,s)||(Es(e,s),$e(s))},start:function(s){return Hs(e,s)},drop:Ue(e,zs),leave:function(s){xe(e,s)||El(e)}};var a=t.input.getField();U(a,"keyup",function(s){return Yl.call(e,s)}),U(a,"keydown",Ue(e,Xl)),U(a,"keypress",Ue(e,jl)),U(a,"focus",function(s){return Hi(e,s)}),U(a,"blur",function(s){return Hr(e,s)})}var to=[];ke.defineInitHook=function(e){return to.push(e)};function Nn(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=tn(e,t).state:n="prev");var l=e.options.tabSize,a=B(i,t),s=be(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u=a.text.match(/^\s*/)[0],d;if(!r&&!/\S/.test(a.text))d=0,n="not";else if(n=="smart"&&(d=i.mode.indent(o,a.text.slice(u.length),a.text),d==ye||d>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?d=be(B(i,t-1).text,null,l):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 h="",m=0;if(e.options.indentWithTabs)for(var g=Math.floor(d/l);g;--g)m+=l,h+=" ";if(ml,s=Pt(t),u=null;if(a&&r.ranges.length>1)if(At&&At.text.join(` -`)==t){if(r.ranges.length%At.text.length==0){u=[];for(var d=0;d=0;m--){var g=r.ranges[m],b=g.from(),S=g.to();g.empty()&&(n&&n>0?b=v(b.line,b.ch-n):e.state.overwrite&&!a?S=v(S.line,Math.min(B(o,S.line).text.length,S.ch+ee(s).length)):a&&At&&At.lineWise&&At.text.join(` -`)==s.join(` -`)&&(b=S=v(b.line,0)));var C={from:b,to:S,text:u?u[m%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};Rr(e.doc,C),je(e,"inputRead",e,C)}t&&!a&&ra(e,t),Er(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ta(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ht(t,function(){return ro(t,n,0,null,"paste")}),!0}function ra(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),l=!1;if(o.electricChars){for(var a=0;a-1){l=Nn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(B(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Nn(e,i.head.line,"smart"));l&&je(e,"electricInput",e,i.head.line)}}}function na(e){for(var t=[],n=[],r=0;ro&&(Nn(this,a.head.line,r,!0),o=a.head.line,l==this.doc.sel.primIndex&&Er(this));else{var s=a.from(),u=a.to(),d=Math.max(o,s.line);o=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var h=d;h0&&ji(this.doc,l,new ue(s,m[l].to()),Qe)}}}),getTokenAt:function(r,i){return ho(this,r,i)},getLineTokens:function(r,i){return ho(this,v(r),i,!0)},getTokenTypeAt:function(r){r=Z(this.doc,r);var i=uo(this,B(this.doc,r.line)),o=0,l=(i.length-1)/2,a=r.ch,s;if(a==0)s=i[2];else for(;;){var u=o+l>>1;if((u?i[u*2-1]:0)>=a)l=u;else if(i[u*2+1]s&&(r=s,l=!0),a=B(this.doc,r)}else a=r;return qn(this,a,{top:0,left:0},i||"page",o||l).top+(l?this.doc.height-Zt(a):0)},defaultTextHeight:function(){return Pr(this.display)},defaultCharWidth:function(){return zr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,l,a){var s=this.display;r=Mt(this,Z(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),l=="over")u=r.top;else if(l=="above"||l=="near"){var h=Math.max(s.wrapper.clientHeight,this.doc.height),m=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(l=="above"||r.bottom+i.offsetHeight>h)&&r.top>i.offsetHeight?u=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=h&&(u=r.bottom),d+i.offsetWidth>m&&(d=m-i.offsetWidth)}i.style.top=u+"px",i.style.left=i.style.right="",a=="right"?(d=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(a=="left"?d=0:a=="middle"&&(d=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=d+"px"),o&&is(this,{left:d,top:u,right:d+i.offsetWidth,bottom:u+i.offsetHeight})},triggerOnKeyDown:it(Xl),triggerOnKeyPress:it(jl),triggerOnKeyUp:Yl,triggerOnMouseDown:it(Zl),execCommand:function(r){if(Cn.hasOwnProperty(r))return Cn[r].call(null,this)},triggerElectric:it(function(r){ra(this,r)}),findPosH:function(r,i,o,l){var a=1;i<0&&(a=-1,i=-i);for(var s=Z(this.doc,r),u=0;u0&&d(o.charAt(l-1));)--l;for(;a.5||this.options.lineWrapping)&&Wi(this),Me(this,"refresh",this)}),swapDoc:it(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),dl(this,r),an(this),this.display.input.reset(),un(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,je(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}},$t(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,l){e.registerHelper(r,i,l),n[r]._global.push({pred:o,val:l})}}function no(e,t,n,r,i){var o=t,l=n,a=B(e,t.line),s=i&&e.direction=="rtl"?-n:n;function u(){var O=t.line+s;return O=e.first+e.size?!1:(t=new v(O,t.ch,t.sticky),a=B(e,O))}function d(O){var A;if(r=="codepoint"){var W=a.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(W)?A=null:A=new v(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(W>=55296&&W<56320?2:1))),-n)}else i?A=_s(e.cm,a,t,n):A=Ji(a,t,n);if(A==null)if(!O&&u())t=Qi(i,e.cm,a,t.line,s);else return!1;else t=A;return!0}if(r=="char"||r=="codepoint")d();else if(r=="column")d(!0);else if(r=="word"||r=="group")for(var h=null,m=r=="group",g=e.cm&&e.cm.getHelper(t,"wordChars"),b=!0;!(n<0&&!d(!b));b=!1){var S=a.text.charAt(t.ch)||` -`,C=y(S,g)?"w":m&&S==` -`?"n":!m||/\s/.test(S)?null:"p";if(m&&!b&&!C&&(C="s"),h&&h!=C){n<0&&(n=1,d(),t.sticky="after");break}if(C&&(h=C),n>0&&!d(!b))break}var N=ni(e,t,o,l,!0);return le(o,N)&&(N.hitSide=!0),N}function la(e,t,n,r){var i=e.doc,o=t.left,l;if(r=="page"){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*Pr(e.display),3);l=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(l=n>0?t.bottom+3:t.top-3);for(var u;u=Ni(e,o,l),!!u.outside;){if(n<0?l<=0:l>=i.height){u.hitSide=!0;break}l+=n*5}return u}var he=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new K,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};he.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ia(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(a){for(var s=a.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}U(i,"paste",function(a){!o(a)||xe(r,a)||ta(a,r)||I<=11&&setTimeout(Ue(r,function(){return t.updateFromDOM()}),20)}),U(i,"compositionstart",function(a){t.composing={data:a.data,done:!1}}),U(i,"compositionupdate",function(a){t.composing||(t.composing={data:a.data,done:!1})}),U(i,"compositionend",function(a){t.composing&&(a.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),U(i,"touchstart",function(){return n.forceCompositionEnd()}),U(i,"input",function(){t.composing||t.readFromDOMSoon()});function l(a){if(!(!o(a)||xe(r,a))){if(r.somethingSelected())ui({lineWise:!1,text:r.getSelections()}),a.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=na(r);ui({lineWise:!0,text:s.text}),a.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,Qe),r.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var u=At.text.join(` -`);if(a.clipboardData.setData("Text",u),a.clipboardData.getData("Text")==u){a.preventDefault();return}}var d=oa(),h=d.firstChild;r.display.lineSpace.insertBefore(d,r.display.lineSpace.firstChild),h.value=At.text.join(` -`);var m=document.activeElement;Kt(h),setTimeout(function(){r.display.lineSpace.removeChild(d),m.focus(),m==i&&n.showPrimarySelection()},50)}}U(i,"copy",l),U(i,"cut",l)},he.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},he.prototype.prepareSelection=function(){var e=jo(this.cm,!1);return e.focus=document.activeElement==this.div,e},he.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},he.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},he.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&&aa(t,r)||{node:a[0].measure.map[2],offset:0},u=i.linee.firstLine()&&(r=v(r.line-1,B(e.doc,r.line-1).length)),i.ch==B(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,l,a;r.line==t.viewFrom||(o=gr(e,r.line))==0?(l=ae(t.view[0].line),a=t.view[0].node):(l=ae(t.view[o].line),a=t.view[o-1].node.nextSibling);var s=gr(e,i.line),u,d;if(s==t.view.length-1?(u=t.viewTo-1,d=t.lineDiv.lastChild):(u=ae(t.view[s+1].line)-1,d=t.view[s+1].node.previousSibling),!a)return!1;for(var h=e.doc.splitLines(uu(e,a,d,l,u)),m=Ht(e.doc,v(l,0),v(u,B(e.doc,u).text.length));h.length>1&&m.length>1;)if(ee(h)==ee(m))h.pop(),m.pop(),u--;else if(h[0]==m[0])h.shift(),m.shift(),l++;else break;for(var g=0,b=0,S=h[0],C=m[0],N=Math.min(S.length,C.length);gr.ch&&O.charCodeAt(O.length-b-1)==A.charCodeAt(A.length-b-1);)g--,b++;h[h.length-1]=O.slice(0,O.length-b).replace(/^\u200b+/,""),h[0]=h[0].slice(g).replace(/\u200b+$/,"");var q=v(l,g),R=v(u,m.length?ee(m).length-b:0);if(h.length>1||h[0]||M(q,R))return Kr(e.doc,h,q,R,"+input"),!0},he.prototype.ensurePolled=function(){this.forceCompositionEnd()},he.prototype.reset=function(){this.forceCompositionEnd()},he.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},he.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))},he.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ht(this.cm,function(){return at(e.cm)})},he.prototype.setUneditable=function(e){e.contentEditable="false"},he.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Ue(this.cm,ro)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},he.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},he.prototype.onContextMenu=function(){},he.prototype.resetPosition=function(){},he.prototype.needsContentAttribute=!0;function aa(e,t){var n=Ci(e,t.line);if(!n||n.hidden)return null;var r=B(e.doc,t.line),i=zo(n,r,t.line),o=nt(r,e.doc.direction),l="left";if(o){var a=Lt(o,t.ch);l=a%2?"right":"left"}var s=Fo(i.map,t.ch,l);return s.offset=s.collapse=="right"?s.end:s.start,s}function su(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Xr(e,t){return t&&(e.bad=!0),e}function uu(e,t,n,r,i){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function u(g){return function(b){return b.id==g}}function d(){l&&(o+=a,s&&(o+=a),l=s=!1)}function h(g){g&&(d(),o+=g)}function m(g){if(g.nodeType==1){var b=g.getAttribute("cm-text");if(b){h(b);return}var S=g.getAttribute("cm-marker"),C;if(S){var N=e.findMarks(v(r,0),v(i+1,0),u(+S));N.length&&(C=N[0].find(0))&&h(Ht(e.doc,C.from,C.to).join(a));return}if(g.getAttribute("contenteditable")=="false")return;var O=/^(pre|div|p|li|table|br)$/i.test(g.nodeName);if(!/^br$/i.test(g.nodeName)&&g.textContent.length==0)return;O&&d();for(var A=0;A=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),U(i,"paste",function(l){xe(r,l)||ta(l,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(l){if(!xe(r,l)){if(r.somethingSelected())ui({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var a=na(r);ui({lineWise:!0,text:a.text}),l.type=="cut"?r.setSelections(a.ranges,null,Qe):(n.prevInput="",i.value=a.text.join(` -`),Kt(i))}else return;l.type=="cut"&&(r.state.cutIncoming=+new Date)}}U(i,"cut",o),U(i,"copy",o),U(e.scroller,"paste",function(l){if(!(Jt(e,l)||xe(r,l))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var a=new Event("paste");a.clipboardData=l.clipboardData,i.dispatchEvent(a)}}),U(e.lineSpace,"selectstart",function(l){Jt(e,l)||Be(l)}),U(i,"compositionstart",function(){var l=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:l,range:r.markText(l,r.getCursor("to"),{className:"CodeMirror-composing"})}}),U(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Oe.prototype.createField=function(e){this.wrapper=oa(),this.textarea=this.wrapper.firstChild},Oe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Oe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=jo(e);if(e.options.moveInputWithCursor){var i=Mt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},Oe.prototype.showSelection=function(e){var t=this.cm,n=t.display;z(n.cursorDiv,e.cursors),z(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Oe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing)){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Kt(this.textarea),P&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",P&&I>=9&&(this.hasSelection=null))}},Oe.prototype.getField=function(){return this.textarea},Oe.prototype.supportsTouch=function(){return!1},Oe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!Q||ve()!=this.textarea))try{this.textarea.focus()}catch{}},Oe.prototype.blur=function(){this.textarea.blur()},Oe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Oe.prototype.receivedFocus=function(){this.slowPoll()},Oe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Oe.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)},Oe.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||zt(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&&I>=9&&this.hasSelection===i||Y&&/[\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 l=0,a=Math.min(r.length,i.length);l1e3||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},Oe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Oe.prototype.onKeyPress=function(){P&&I>=9&&(this.hasSelection=null),this.fastPoll()},Oe.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=vr(n,e),l=r.scroller.scrollTop;if(!o||J)return;var a=n.options.resetSelectionOnContextMenu;a&&n.doc.sel.contains(o)==-1&&Ue(n,et)(n.doc,ir(o),Qe);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 h;se&&(h=window.scrollY),r.input.focus(),se&&window.scrollTo(null,h),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 S=n.somethingSelected(),C="​"+(S?i.value:"");i.value="⇚",i.value=C,t.prevInput=S?"":"​",i.selectionStart=1,i.selectionEnd=C.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&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),i.selectionStart!=null)){(!P||P&&I<9)&&m();var S=0,C=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?Ue(n,Ll)(n):S++<10?r.detectingSelectAll=setTimeout(C,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(C,200)}}if(P&&I>=9&&m(),Ie){$e(e);var b=function(){te(window,"mouseup",b),setTimeout(g,20)};U(window,"mouseup",b)}else setTimeout(g,50)},Oe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Oe.prototype.setUneditable=function(){},Oe.prototype.needsContentAttribute=!1;function cu(e,t){if(t=t?vt(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=ve();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(U(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch{}}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&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var a=ke(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function du(e){e.off=te,e.on=U,e.wheelEventPixels=bs,e.Doc=st,e.splitLines=Pt,e.countColumn=be,e.findColumn=_t,e.isWordChar=me,e.Pass=ye,e.signal=Me,e.Line=Dr,e.changeEnd=or,e.scrollbarModel=tl,e.Pos=v,e.cmpPos=M,e.modes=Vr,e.mimeModes=qt,e.resolveMode=Xt,e.getMode=$r,e.modeExtensions=Yt,e.extendMode=hi,e.copyState=kt,e.startState=Hn,e.innerMode=Ar,e.commands=Cn,e.keyMap=Qt,e.keyName=Kl,e.isModifierKey=Bl,e.lookupKey=Gr,e.normalizeKeyMap=Ks,e.StringStream=we,e.SharedTextMarker=wn,e.TextMarker=ar,e.LineWidget=xn,e.e_preventDefault=Be,e.e_stopPropagation=Wn,e.e_stop=$e,e.addClass=De,e.contains=G,e.rmClass=j,e.keyNames=sr}nu(ke),au(ke);var hu="iter insert remove copy getEditor constructor".split(" ");for(var ci in st.prototype)st.prototype.hasOwnProperty(ci)&&E(hu,ci)<0&&(ke.prototype[ci]=function(e){return function(){return e.apply(this.doc,arguments)}}(st.prototype[ci]));return $t(st),ke.inputStyles={textarea:Oe,contenteditable:he},ke.defineMode=function(e){!ke.defaults.mode&&e!="null"&&(ke.defaults.mode=e),Nr.apply(this,arguments)},ke.defineMIME=Tt,ke.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ke.defineMIME("text/plain","null"),ke.defineExtension=function(e,t){ke.prototype[e]=t},ke.defineDocExtension=function(e,t){st.prototype[e]=t},ke.fromTextArea=cu,du(ke),ke.version="5.58.3",ke})}(lo)),lo.exports}var gu=An();const wu=vu(gu);var ua={exports:{}},fa;function mu(){return fa||(fa=1,function(Zr,Dn){(function(F){F(An())})(function(F){var We={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},pe={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};F.defineMode("xml",function(Je,dt){var Pe=Je.indentUnit,P={},I=dt.htmlMode?We:pe;for(var se in I)P[se]=I[se];for(var se in dt)P[se]=dt[se];var re,X;function J(c,D){function L(De){return D.tokenize=De,De(c,D)}var G=c.next();if(G=="<")return c.eat("!")?c.eat("[")?c.match("CDATA[")?L(ze("atom","]]>")):null:c.match("--")?L(ze("comment","-->")):c.match("DOCTYPE",!0,!0)?(c.eatWhile(/[\w\._\-]/),L($(1))):null:c.eat("?")?(c.eatWhile(/[\w\._\-]/),D.tokenize=ze("meta","?>"),"meta"):(re=c.eat("/")?"closeTag":"openTag",D.tokenize=fe,"tag bracket");if(G=="&"){var ve;return c.eat("#")?c.eat("x")?ve=c.eatWhile(/[a-fA-F\d]/)&&c.eat(";"):ve=c.eatWhile(/[\d]/)&&c.eat(";"):ve=c.eatWhile(/[\w\.\-:]/)&&c.eat(";"),ve?"atom":"error"}else return c.eatWhile(/[^&<]/),null}J.isInText=!0;function fe(c,D){var L=c.next();if(L==">"||L=="/"&&c.eat(">"))return D.tokenize=J,re=L==">"?"endTag":"selfcloseTag","tag bracket";if(L=="=")return re="equals",null;if(L=="<"){D.tokenize=J,D.state=Te,D.tagName=D.tagStart=null;var G=D.tokenize(c,D);return G?G+" tag error":"tag error"}else return/[\'\"]/.test(L)?(D.tokenize=Le(L),D.stringStartCol=c.column(),D.tokenize(c,D)):(c.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Le(c){var D=function(L,G){for(;!L.eol();)if(L.next()==c){G.tokenize=fe;break}return"string"};return D.isInAttribute=!0,D}function ze(c,D){return function(L,G){for(;!L.eol();){if(L.match(D)){G.tokenize=J;break}L.next()}return c}}function $(c){return function(D,L){for(var G;(G=D.next())!=null;){if(G=="<")return L.tokenize=$(c+1),L.tokenize(D,L);if(G==">")if(c==1){L.tokenize=J;break}else return L.tokenize=$(c-1),L.tokenize(D,L)}return"meta"}}function _e(c,D,L){this.prev=c.context,this.tagName=D||"",this.indent=c.indented,this.startOfLine=L,(P.doNotIndent.hasOwnProperty(D)||c.context&&c.context.noIndent)&&(this.noIndent=!0)}function Q(c){c.context&&(c.context=c.context.prev)}function Y(c,D){for(var L;;){if(!c.context||(L=c.context.tagName,!P.contextGrabbers.hasOwnProperty(L)||!P.contextGrabbers[L].hasOwnProperty(D)))return;Q(c)}}function Te(c,D,L){return c=="openTag"?(L.tagStart=D.column(),bt):c=="closeTag"?Ae:Te}function bt(c,D,L){return c=="word"?(L.tagName=D.current(),X="tag",_):P.allowMissingTagName&&c=="endTag"?(X="tag bracket",_(c,D,L)):(X="error",bt)}function Ae(c,D,L){if(c=="word"){var G=D.current();return L.context&&L.context.tagName!=G&&P.implicitlyClosed.hasOwnProperty(L.context.tagName)&&Q(L),L.context&&L.context.tagName==G||P.matchClosing===!1?(X="tag",rt):(X="tag error",Ie)}else return P.allowMissingTagName&&c=="endTag"?(X="tag bracket",rt(c,D,L)):(X="error",Ie)}function rt(c,D,L){return c!="endTag"?(X="error",rt):(Q(L),Te)}function Ie(c,D,L){return X="error",rt(c,D,L)}function _(c,D,L){if(c=="word")return X="attribute",j;if(c=="endTag"||c=="selfcloseTag"){var G=L.tagName,ve=L.tagStart;return L.tagName=L.tagStart=null,c=="selfcloseTag"||P.autoSelfClosers.hasOwnProperty(G)?Y(L,G):(Y(L,G),L.context=new _e(L,G,ve==L.indented)),Te}return X="error",_}function j(c,D,L){return c=="equals"?k:(P.allowMissing||(X="error"),_(c,D,L))}function k(c,D,L){return c=="string"?z:c=="word"&&P.allowUnquoted?(X="string",_):(X="error",_(c,D,L))}function z(c,D,L){return c=="string"?z:_(c,D,L)}return{startState:function(c){var D={tokenize:J,state:Te,indented:c||0,tagName:null,tagStart:null,context:null};return c!=null&&(D.baseIndent=c),D},token:function(c,D){if(!D.tagName&&c.sol()&&(D.indented=c.indentation()),c.eatSpace())return null;re=null;var L=D.tokenize(c,D);return(L||re)&&L!="comment"&&(X=null,D.state=D.state(re||L,c,D),X&&(L=X=="error"?L+" error":X)),L},indent:function(c,D,L){var G=c.context;if(c.tokenize.isInAttribute)return c.tagStart==c.indented?c.stringStartCol+1:c.indented+Pe;if(G&&G.noIndent)return F.Pass;if(c.tokenize!=fe&&c.tokenize!=J)return L?L.match(/^(\s*)/)[0].length:0;if(c.tagName)return P.multilineTagIndentPastTag!==!1?c.tagStart+c.tagName.length+2:c.tagStart+Pe*(P.multilineTagIndentFactor||1);if(P.alignCDATA&&/$/,blockCommentStart:"",configuration:P.htmlMode?"html":"xml",helperType:P.htmlMode?"html":"xml",skipAttribute:function(c){c.state==k&&(c.state=_)},xmlCurrentTag:function(c){return c.tagName?{name:c.tagName,close:c.type=="closeTag"}:null},xmlCurrentContext:function(c){for(var D=[],L=c.context;L;L=L.prev)D.push(L.tagName);return D.reverse()}}}),F.defineMIME("text/xml","xml"),F.defineMIME("application/xml","xml"),F.mimeModes.hasOwnProperty("text/html")||F.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),ua.exports}var ca={exports:{}},da;function yu(){return da||(da=1,function(Zr,Dn){(function(F){F(An())})(function(F){F.defineMode("javascript",function(We,pe){var Je=We.indentUnit,dt=pe.statementIndent,Pe=pe.jsonld,P=pe.json||Pe,I=pe.typescript,se=pe.wordCharacters||/[\w$\xa1-\uffff]/,re=function(){function f(Re){return{type:Re,style:"keyword"}}var p=f("keyword a"),w=f("keyword b"),v=f("keyword c"),M=f("keyword d"),le=f("operator"),de={type:"atom",style:"atom"};return{if:f("if"),while:p,with:p,else:w,do:w,try:w,finally:w,return:M,break:M,continue:M,new:f("new"),delete:v,void:v,throw:v,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:le,typeof:le,instanceof:le,true:de,false:de,null:de,undefined:de,NaN:de,Infinity:de,this:f("this"),class:f("class"),super:f("atom"),yield:v,export:f("export"),import:f("import"),extends:v,await:v}}(),X=/[+\-*&%=<>!?|~^@]/,J=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function fe(f){for(var p=!1,w,v=!1;(w=f.next())!=null;){if(!p){if(w=="/"&&!v)return;w=="["?v=!0:v&&w=="]"&&(v=!1)}p=!p&&w=="\\"}}var Le,ze;function $(f,p,w){return Le=f,ze=w,p}function _e(f,p){var w=f.next();if(w=='"'||w=="'")return p.tokenize=Q(w),p.tokenize(f,p);if(w=="."&&f.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return $("number","number");if(w=="."&&f.match(".."))return $("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(w))return $(w);if(w=="="&&f.eat(">"))return $("=>","operator");if(w=="0"&&f.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return $("number","number");if(/\d/.test(w))return f.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),$("number","number");if(w=="/")return f.eat("*")?(p.tokenize=Y,Y(f,p)):f.eat("/")?(f.skipToEnd(),$("comment","comment")):ae(f,p,1)?(fe(f),f.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),$("regexp","string-2")):(f.eat("="),$("operator","operator",f.current()));if(w=="`")return p.tokenize=Te,Te(f,p);if(w=="#"&&f.peek()=="!")return f.skipToEnd(),$("meta","meta");if(w=="#"&&f.eatWhile(se))return $("variable","property");if(w=="<"&&f.match("!--")||w=="-"&&f.match("->")&&!/\S/.test(f.string.slice(0,f.start)))return f.skipToEnd(),$("comment","comment");if(X.test(w))return(w!=">"||!p.lexical||p.lexical.type!=">")&&(f.eat("=")?(w=="!"||w=="=")&&f.eat("="):/[<>*+\-|&?]/.test(w)&&(f.eat(w),w==">"&&f.eat(w))),w=="?"&&f.eat(".")?$("."):$("operator","operator",f.current());if(se.test(w)){f.eatWhile(se);var v=f.current();if(p.lastType!="."){if(re.propertyIsEnumerable(v)){var M=re[v];return $(M.type,M.style,v)}if(v=="async"&&f.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return $("async","keyword",v)}return $("variable","variable",v)}}function Q(f){return function(p,w){var v=!1,M;if(Pe&&p.peek()=="@"&&p.match(J))return w.tokenize=_e,$("jsonld-keyword","meta");for(;(M=p.next())!=null&&!(M==f&&!v);)v=!v&&M=="\\";return v||(w.tokenize=_e),$("string","string")}}function Y(f,p){for(var w=!1,v;v=f.next();){if(v=="/"&&w){p.tokenize=_e;break}w=v=="*"}return $("comment","comment")}function Te(f,p){for(var w=!1,v;(v=f.next())!=null;){if(!w&&(v=="`"||v=="$"&&f.eat("{"))){p.tokenize=_e;break}w=!w&&v=="\\"}return $("quasi","string-2",f.current())}var bt="([{}])";function Ae(f,p){p.fatArrowAt&&(p.fatArrowAt=null);var w=f.string.indexOf("=>",f.start);if(!(w<0)){if(I){var v=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(f.string.slice(f.start,w));v&&(w=v.index)}for(var M=0,le=!1,de=w-1;de>=0;--de){var Re=f.string.charAt(de),lt=bt.indexOf(Re);if(lt>=0&<<3){if(!M){++de;break}if(--M==0){Re=="("&&(le=!0);break}}else if(lt>=3&<<6)++M;else if(se.test(Re))le=!0;else if(/["'\/`]/.test(Re))for(;;--de){if(de==0)return;var En=f.string.charAt(de-1);if(En==Re&&f.string.charAt(de-2)!="\\"){de--;break}}else if(le&&!M){++de;break}}le&&!M&&(p.fatArrowAt=de)}}var rt={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function Ie(f,p,w,v,M,le){this.indented=f,this.column=p,this.type=w,this.prev=M,this.info=le,v!=null&&(this.align=v)}function _(f,p){for(var w=f.localVars;w;w=w.next)if(w.name==p)return!0;for(var v=f.context;v;v=v.prev)for(var w=v.vars;w;w=w.next)if(w.name==p)return!0}function j(f,p,w,v,M){var le=f.cc;for(k.state=f,k.stream=M,k.marked=null,k.cc=le,k.style=p,f.lexical.hasOwnProperty("align")||(f.lexical.align=!0);;){var de=le.length?le.pop():P?H:ye;if(de(w,v)){for(;le.length&&le[le.length-1].lex;)le.pop()();return k.marked?k.marked:w=="variable"&&_(f,v)?"variable-2":p}}}var k={state:null,column:null,marked:null,cc:null};function z(){for(var f=arguments.length-1;f>=0;f--)k.cc.push(arguments[f])}function c(){return z.apply(null,arguments),!0}function D(f,p){for(var w=p;w;w=w.next)if(w.name==f)return!0;return!1}function L(f){var p=k.state;if(k.marked="def",p.context){if(p.lexical.info=="var"&&p.context&&p.context.block){var w=G(f,p.context);if(w!=null){p.context=w;return}}else if(!D(f,p.localVars)){p.localVars=new xt(f,p.localVars);return}}pe.globalVars&&!D(f,p.globalVars)&&(p.globalVars=new xt(f,p.globalVars))}function G(f,p){if(p)if(p.block){var w=G(f,p.prev);return w?w==p.prev?p:new De(w,p.vars,!0):null}else return D(f,p.vars)?p:new De(p.prev,new xt(f,p.vars),!1);else return null}function ve(f){return f=="public"||f=="private"||f=="protected"||f=="abstract"||f=="readonly"}function De(f,p,w){this.prev=f,this.vars=p,this.block=w}function xt(f,p){this.name=f,this.next=p}var Kt=new xt("this",new xt("arguments",null));function wt(){k.state.context=new De(k.state.context,k.state.localVars,!1),k.state.localVars=Kt}function vt(){k.state.context=new De(k.state.context,k.state.localVars,!0),k.state.localVars=null}function be(){k.state.localVars=k.state.context.vars,k.state.context=k.state.context.prev}be.lex=!0;function K(f,p){var w=function(){var v=k.state,M=v.indented;if(v.lexical.type=="stat")M=v.lexical.indented;else for(var le=v.lexical;le&&le.type==")"&&le.align;le=le.prev)M=le.indented;v.lexical=new Ie(M,k.stream.column(),f,null,v.lexical,p)};return w.lex=!0,w}function E(){var f=k.state;f.lexical.prev&&(f.lexical.type==")"&&(f.indented=f.lexical.indented),f.lexical=f.lexical.prev)}E.lex=!0;function ne(f){function p(w){return w==f?c():f==";"||w=="}"||w==")"||w=="]"?z():c(p)}return p}function ye(f,p){return f=="var"?c(K("vardef",p),dr,ne(";"),E):f=="keyword a"?c(K("form"),_t,ye,E):f=="keyword b"?c(K("form"),ye,E):f=="keyword d"?k.stream.match(/^\s*$/,!1)?c():c(K("stat"),Ct,ne(";"),E):f=="debugger"?c(ne(";")):f=="{"?c(K("}"),vt,Sr,E,be):f==";"?c():f=="if"?(k.state.lexical.info=="else"&&k.state.cc[k.state.cc.length-1]==E&&k.state.cc.pop()(),c(K("form"),_t,ye,E,zn)):f=="function"?c(zt):f=="for"?c(K("form"),Tr,ye,E):f=="class"||I&&p=="interface"?(k.marked="keyword",c(K("form",f=="class"?f:p),qt,E)):f=="variable"?I&&p=="declare"?(k.marked="keyword",c(ye)):I&&(p=="module"||p=="enum"||p=="type")&&k.stream.match(/^\s*\w/,!1)?(k.marked="keyword",p=="enum"?c(Ht):p=="type"?c(Mr,ne("operator"),te,ne(";")):c(K("form"),$e,ne("{"),K("}"),Sr,E,E)):I&&p=="namespace"?(k.marked="keyword",c(K("form"),H,ye,E)):I&&p=="abstract"?(k.marked="keyword",c(ye)):c(K("stat"),x):f=="switch"?c(K("form"),_t,ne("{"),K("}","switch"),vt,Sr,E,E,be):f=="case"?c(H,ne(":")):f=="default"?c(ne(":")):f=="catch"?c(K("form"),wt,Qe,ye,E,be):f=="export"?c(K("stat"),$r,E):f=="import"?c(K("stat"),hi,E):f=="async"?c(ye):p=="@"?c(H,ye):z(K("stat"),H,ne(";"),E)}function Qe(f){if(f=="(")return c(Ut,ne(")"))}function H(f,p){return Dt(f,p,!1)}function ie(f,p){return Dt(f,p,!0)}function _t(f){return f!="("?z():c(K(")"),Ct,ne(")"),E)}function Dt(f,p,w){if(k.state.fatArrowAt==k.stream.start){var v=w?fr:gt;if(f=="(")return c(wt,K(")"),Se(Ut,")"),E,ne("=>"),v,be);if(f=="variable")return z(wt,$e,ne("=>"),v,be)}var M=w?ce:ee;return rt.hasOwnProperty(f)?c(M):f=="function"?c(zt,M):f=="class"||I&&p=="interface"?(k.marked="keyword",c(K("form"),Vr,E)):f=="keyword c"||f=="async"?c(w?ie:H):f=="("?c(K(")"),Ct,ne(")"),E,M):f=="operator"||f=="spread"?c(w?ie:H):f=="["?c(K("]"),B,E,M):f=="{"?Lt(Ge,"}",null,M):f=="quasi"?z(Ve,M):f=="new"?c(me(w)):f=="import"?c(H):c()}function Ct(f){return f.match(/[;\}\)\],]/)?z():z(H)}function ee(f,p){return f==","?c(Ct):ce(f,p,!1)}function ce(f,p,w){var v=w==!1?ee:ce,M=w==!1?H:ie;if(f=="=>")return c(wt,w?fr:gt,be);if(f=="operator")return/\+\+|--/.test(p)||I&&p=="!"?c(v):I&&p=="<"&&k.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?c(K(">"),Se(te,">"),E,v):p=="?"?c(H,ne(":"),M):c(M);if(f=="quasi")return z(Ve,v);if(f!=";"){if(f=="(")return Lt(ie,")","call",v);if(f==".")return c(oe,v);if(f=="[")return c(K("]"),Ct,ne("]"),E,v);if(I&&p=="as")return k.marked="keyword",c(te,v);if(f=="regexp")return k.state.lastType=k.marked="operator",k.stream.backUp(k.stream.pos-k.stream.start-1),c(M)}}function Ve(f,p){return f!="quasi"?z():p.slice(p.length-2)!="${"?c(Ve):c(H,Ot)}function Ot(f){if(f=="}")return k.marked="string-2",k.state.tokenize=Te,c(Ve)}function gt(f){return Ae(k.stream,k.state),z(f=="{"?ye:H)}function fr(f){return Ae(k.stream,k.state),z(f=="{"?ye:ie)}function me(f){return function(p){return p=="."?c(f?T:y):p=="variable"&&I?c($t,f?ce:ee):z(f?ie:H)}}function y(f,p){if(p=="target")return k.marked="keyword",c(ee)}function T(f,p){if(p=="target")return k.marked="keyword",c(ce)}function x(f){return f==":"?c(E,ye):z(ee,ne(";"),E)}function oe(f){if(f=="variable")return k.marked="property",c()}function Ge(f,p){if(f=="async")return k.marked="property",c(Ge);if(f=="variable"||k.style=="keyword"){if(k.marked="property",p=="get"||p=="set")return c(cr);var w;return I&&k.state.fatArrowAt==k.stream.start&&(w=k.stream.match(/^\s*:\s*/,!1))&&(k.state.fatArrowAt=k.stream.pos+w[0].length),c(Gt)}else{if(f=="number"||f=="string")return k.marked=Pe?"property":k.style+" property",c(Gt);if(f=="jsonld-keyword")return c(Gt);if(I&&ve(p))return k.marked="keyword",c(Ge);if(f=="[")return c(H,nt,ne("]"),Gt);if(f=="spread")return c(ie,Gt);if(p=="*")return k.marked="keyword",c(Ge);if(f==":")return z(Gt)}}function cr(f){return f!="variable"?z(Gt):(k.marked="property",c(zt))}function Gt(f){if(f==":")return c(ie);if(f=="(")return z(zt)}function Se(f,p,w){function v(M,le){if(w?w.indexOf(M)>-1:M==","){var de=k.state.lexical;return de.info=="call"&&(de.pos=(de.pos||0)+1),c(function(Re,lt){return Re==p||lt==p?z():z(f)},v)}return M==p||le==p?c():w&&w.indexOf(";")>-1?z(f):c(ne(p))}return function(M,le){return M==p||le==p?c():z(f,v)}}function Lt(f,p,w){for(var v=3;v"),te)}function Me(f){if(f=="=>")return c(te)}function xe(f,p){if(f=="variable"||k.style=="keyword")return k.marked="property",c(xe);if(p=="?"||f=="number"||f=="string")return c(xe);if(f==":")return c(te);if(f=="[")return c(ne("variable"),On,ne("]"),xe);if(f=="(")return z(er,xe)}function Cr(f,p){return f=="variable"&&k.stream.match(/^\s*[?:]/,!1)||p=="?"?c(Cr):f==":"?c(te):f=="spread"?c(Cr):z(te)}function He(f,p){if(p=="<")return c(K(">"),Se(te,">"),E,He);if(p=="|"||f=="."||p=="&")return c(te);if(f=="[")return c(te,ne("]"),He);if(p=="extends"||p=="implements")return k.marked="keyword",c(te);if(p=="?")return c(te,ne(":"),te)}function $t(f,p){if(p=="<")return c(K(">"),Se(te,">"),E,He)}function Be(){return z(te,Wn)}function Wn(f,p){if(p=="=")return c(te)}function dr(f,p){return p=="enum"?(k.marked="keyword",c(Ht)):z($e,nt,Wt,Qr)}function $e(f,p){if(I&&ve(p))return k.marked="keyword",c($e);if(f=="variable")return L(p),c();if(f=="spread")return c($e);if(f=="[")return Lt(Pn,"]");if(f=="{")return Lt(Lr,"}")}function Lr(f,p){return f=="variable"&&!k.stream.match(/^\s*:/,!1)?(L(p),c(Wt)):(f=="variable"&&(k.marked="property"),f=="spread"?c($e):f=="}"?z():f=="["?c(H,ne("]"),ne(":"),Lr):c(ne(":"),$e,Wt))}function Pn(){return z($e,Wt)}function Wt(f,p){if(p=="=")return c(ie)}function Qr(f){if(f==",")return c(dr)}function zn(f,p){if(f=="keyword b"&&p=="else")return c(K("form","else"),ye,E)}function Tr(f,p){if(p=="await")return c(Tr);if(f=="(")return c(K(")"),di,E)}function di(f){return f=="var"?c(dr,Pt):f=="variable"?c(Pt):z(Pt)}function Pt(f,p){return f==")"?c():f==";"?c(Pt):p=="in"||p=="of"?(k.marked="keyword",c(H,Pt)):z(H,Pt)}function zt(f,p){if(p=="*")return k.marked="keyword",c(zt);if(f=="variable")return L(p),c(zt);if(f=="(")return c(wt,K(")"),Se(Ut,")"),E,U,ye,be);if(I&&p=="<")return c(K(">"),Se(Be,">"),E,zt)}function er(f,p){if(p=="*")return k.marked="keyword",c(er);if(f=="variable")return L(p),c(er);if(f=="(")return c(wt,K(")"),Se(Ut,")"),E,U,be);if(I&&p=="<")return c(K(">"),Se(Be,">"),E,er)}function Mr(f,p){if(f=="keyword"||f=="variable")return k.marked="type",c(Mr);if(p=="<")return c(K(">"),Se(Be,">"),E)}function Ut(f,p){return p=="@"&&c(H,Ut),f=="spread"?c(Ut):I&&ve(p)?(k.marked="keyword",c(Ut)):I&&f=="this"?c(nt,Wt):z($e,nt,Wt)}function Vr(f,p){return f=="variable"?qt(f,p):Nr(f,p)}function qt(f,p){if(f=="variable")return L(p),c(Nr)}function Nr(f,p){if(p=="<")return c(K(">"),Se(Be,">"),E,Nr);if(p=="extends"||p=="implements"||I&&f==",")return p=="implements"&&(k.marked="keyword"),c(I?te:H,Nr);if(f=="{")return c(K("}"),Tt,E)}function Tt(f,p){if(f=="async"||f=="variable"&&(p=="static"||p=="get"||p=="set"||I&&ve(p))&&k.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return k.marked="keyword",c(Tt);if(f=="variable"||k.style=="keyword")return k.marked="property",c(Xt,Tt);if(f=="number"||f=="string")return c(Xt,Tt);if(f=="[")return c(H,nt,ne("]"),Xt,Tt);if(p=="*")return k.marked="keyword",c(Tt);if(I&&f=="(")return z(er,Tt);if(f==";"||f==",")return c(Tt);if(f=="}")return c();if(p=="@")return c(H,Tt)}function Xt(f,p){if(p=="?")return c(Xt);if(f==":")return c(te,Wt);if(p=="=")return c(ie);var w=k.state.lexical.prev,v=w&&w.info=="interface";return z(v?er:zt)}function $r(f,p){return p=="*"?(k.marked="keyword",c(we,ne(";"))):p=="default"?(k.marked="keyword",c(H,ne(";"))):f=="{"?c(Se(Yt,"}"),we,ne(";")):z(ye)}function Yt(f,p){if(p=="as")return k.marked="keyword",c(ne("variable"));if(f=="variable")return z(ie,Yt)}function hi(f){return f=="string"?c():f=="("?z(H):z(kt,Ar,we)}function kt(f,p){return f=="{"?Lt(kt,"}"):(f=="variable"&&L(p),p=="*"&&(k.marked="keyword"),c(Hn))}function Ar(f){if(f==",")return c(kt,Ar)}function Hn(f,p){if(p=="as")return k.marked="keyword",c(kt)}function we(f,p){if(p=="from")return k.marked="keyword",c(H)}function B(f){return f=="]"?c():z(Se(ie,"]"))}function Ht(){return z(K("form"),$e,ne("{"),K("}"),Se(en,"}"),E,E)}function en(){return z($e,Wt)}function St(f,p){return f.lastType=="operator"||f.lastType==","||X.test(p.charAt(0))||/[,.]/.test(p.charAt(0))}function ae(f,p,w){return p.tokenize==_e&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(p.lastType)||p.lastType=="quasi"&&/\{\s*$/.test(f.string.slice(0,f.pos-(w||0)))}return{startState:function(f){var p={tokenize:_e,lastType:"sof",cc:[],lexical:new Ie((f||0)-Je,0,"block",!1),localVars:pe.localVars,context:pe.localVars&&new De(null,null,!1),indented:f||0};return pe.globalVars&&typeof pe.globalVars=="object"&&(p.globalVars=pe.globalVars),p},token:function(f,p){if(f.sol()&&(p.lexical.hasOwnProperty("align")||(p.lexical.align=!1),p.indented=f.indentation(),Ae(f,p)),p.tokenize!=Y&&f.eatSpace())return null;var w=p.tokenize(f,p);return Le=="comment"?w:(p.lastType=Le=="operator"&&(ze=="++"||ze=="--")?"incdec":Le,j(p,w,Le,ze,f))},indent:function(f,p){if(f.tokenize==Y||f.tokenize==Te)return F.Pass;if(f.tokenize!=_e)return 0;var w=p&&p.charAt(0),v=f.lexical,M;if(!/^\s*else\b/.test(p))for(var le=f.cc.length-1;le>=0;--le){var de=f.cc[le];if(de==E)v=v.prev;else if(de!=zn)break}for(;(v.type=="stat"||v.type=="form")&&(w=="}"||(M=f.cc[f.cc.length-1])&&(M==ee||M==ce)&&!/^[,\.=+\-*:?[\(]/.test(p));)v=v.prev;dt&&v.type==")"&&v.prev.type=="stat"&&(v=v.prev);var Re=v.type,lt=w==Re;return Re=="vardef"?v.indented+(f.lastType=="operator"||f.lastType==","?v.info.length+1:0):Re=="form"&&w=="{"?v.indented:Re=="form"?v.indented+Je:Re=="stat"?v.indented+(St(f,p)?dt||Je:0):v.info=="switch"&&!lt&&pe.doubleIndentSwitch!=!1?v.indented+(/^(?:case|default)\b/.test(p)?Je:2*Je):v.align?v.column+(lt?0:1):v.indented+(lt?0:Je)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:P?null:"/*",blockCommentEnd:P?null:"*/",blockCommentContinue:P?null:" * ",lineComment:P?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:P?"json":"javascript",jsonldMode:Pe,jsonMode:P,expressionAllowed:ae,skipExpression:function(f){var p=f.cc[f.cc.length-1];(p==H||p==ie)&&f.cc.pop()}}}),F.registerHelper("wordChars","javascript",/[\w$]/),F.defineMIME("text/javascript","javascript"),F.defineMIME("text/ecmascript","javascript"),F.defineMIME("application/javascript","javascript"),F.defineMIME("application/x-javascript","javascript"),F.defineMIME("application/ecmascript","javascript"),F.defineMIME("application/json",{name:"javascript",json:!0}),F.defineMIME("application/x-json",{name:"javascript",json:!0}),F.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),F.defineMIME("text/typescript",{name:"javascript",typescript:!0}),F.defineMIME("application/typescript",{name:"javascript",typescript:!0})})}()),ca.exports}var ha={exports:{}},pa;function bu(){return pa||(pa=1,function(Zr,Dn){(function(F){F(An())})(function(F){F.defineMode("css",function(_,j){var k=j.inline;j.propertyKeywords||(j=F.resolveMode("text/css"));var z=_.indentUnit,c=j.tokenHooks,D=j.documentTypes||{},L=j.mediaTypes||{},G=j.mediaFeatures||{},ve=j.mediaValueKeywords||{},De=j.propertyKeywords||{},xt=j.nonStandardPropertyKeywords||{},Kt=j.fontProperties||{},wt=j.counterDescriptors||{},vt=j.colorKeywords||{},be=j.valueKeywords||{},K=j.allowNested,E=j.lineComment,ne=j.supportsAtComponent===!0,ye=_.highlightNonStandardPropertyKeywords!==!1,Qe,H;function ie(y,T){return Qe=T,y}function _t(y,T){var x=y.next();if(c[x]){var oe=c[x](y,T);if(oe!==!1)return oe}if(x=="@")return y.eatWhile(/[\w\\\-]/),ie("def",y.current());if(x=="="||(x=="~"||x=="|")&&y.eat("="))return ie(null,"compare");if(x=='"'||x=="'")return T.tokenize=Dt(x),T.tokenize(y,T);if(x=="#")return y.eatWhile(/[\w\\\-]/),ie("atom","hash");if(x=="!")return y.match(/^\s*\w*/),ie("keyword","important");if(/\d/.test(x)||x=="."&&y.eat(/\d/))return y.eatWhile(/[\w.%]/),ie("number","unit");if(x==="-"){if(/[\d.]/.test(y.peek()))return y.eatWhile(/[\w.%]/),ie("number","unit");if(y.match(/^-[\w\\\-]*/))return y.eatWhile(/[\w\\\-]/),y.match(/^\s*:/,!1)?ie("variable-2","variable-definition"):ie("variable-2","variable");if(y.match(/^\w+-/))return ie("meta","meta")}else return/[,+>*\/]/.test(x)?ie(null,"select-op"):x=="."&&y.match(/^-?[_a-z][_a-z0-9-]*/i)?ie("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(x)?ie(null,x):y.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(y.current().toLowerCase())&&(T.tokenize=Ct),ie("variable callee","variable")):/[\w\\\-]/.test(x)?(y.eatWhile(/[\w\\\-]/),ie("property","word")):ie(null,null)}function Dt(y){return function(T,x){for(var oe=!1,Ge;(Ge=T.next())!=null;){if(Ge==y&&!oe){y==")"&&T.backUp(1);break}oe=!oe&&Ge=="\\"}return(Ge==y||!oe&&y!=")")&&(x.tokenize=null),ie("string","string")}}function Ct(y,T){return y.next(),y.match(/\s*[\"\')]/,!1)?T.tokenize=null:T.tokenize=Dt(")"),ie(null,"(")}function ee(y,T,x){this.type=y,this.indent=T,this.prev=x}function ce(y,T,x,oe){return y.context=new ee(x,T.indentation()+(oe===!1?0:z),y.context),x}function Ve(y){return y.context.prev&&(y.context=y.context.prev),y.context.type}function Ot(y,T,x){return me[x.context.type](y,T,x)}function gt(y,T,x,oe){for(var Ge=oe||1;Ge>0;Ge--)x.context=x.context.prev;return Ot(y,T,x)}function fr(y){var T=y.current().toLowerCase();be.hasOwnProperty(T)?H="atom":vt.hasOwnProperty(T)?H="keyword":H="variable"}var me={};return me.top=function(y,T,x){if(y=="{")return ce(x,T,"block");if(y=="}"&&x.context.prev)return Ve(x);if(ne&&/@component/i.test(y))return ce(x,T,"atComponentBlock");if(/^@(-moz-)?document$/i.test(y))return ce(x,T,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(y))return ce(x,T,"atBlock");if(/^@(font-face|counter-style)/i.test(y))return x.stateArg=y,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(y))return"keyframes";if(y&&y.charAt(0)=="@")return ce(x,T,"at");if(y=="hash")H="builtin";else if(y=="word")H="tag";else{if(y=="variable-definition")return"maybeprop";if(y=="interpolation")return ce(x,T,"interpolation");if(y==":")return"pseudo";if(K&&y=="(")return ce(x,T,"parens")}return x.context.type},me.block=function(y,T,x){if(y=="word"){var oe=T.current().toLowerCase();return De.hasOwnProperty(oe)?(H="property","maybeprop"):xt.hasOwnProperty(oe)?(H=ye?"string-2":"property","maybeprop"):K?(H=T.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(H+=" error","maybeprop")}else return y=="meta"?"block":!K&&(y=="hash"||y=="qualifier")?(H="error","block"):me.top(y,T,x)},me.maybeprop=function(y,T,x){return y==":"?ce(x,T,"prop"):Ot(y,T,x)},me.prop=function(y,T,x){if(y==";")return Ve(x);if(y=="{"&&K)return ce(x,T,"propBlock");if(y=="}"||y=="{")return gt(y,T,x);if(y=="(")return ce(x,T,"parens");if(y=="hash"&&!/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(T.current()))H+=" error";else if(y=="word")fr(T);else if(y=="interpolation")return ce(x,T,"interpolation");return"prop"},me.propBlock=function(y,T,x){return y=="}"?Ve(x):y=="word"?(H="property","maybeprop"):x.context.type},me.parens=function(y,T,x){return y=="{"||y=="}"?gt(y,T,x):y==")"?Ve(x):y=="("?ce(x,T,"parens"):y=="interpolation"?ce(x,T,"interpolation"):(y=="word"&&fr(T),"parens")},me.pseudo=function(y,T,x){return y=="meta"?"pseudo":y=="word"?(H="variable-3",x.context.type):Ot(y,T,x)},me.documentTypes=function(y,T,x){return y=="word"&&D.hasOwnProperty(T.current())?(H="tag",x.context.type):me.atBlock(y,T,x)},me.atBlock=function(y,T,x){if(y=="(")return ce(x,T,"atBlock_parens");if(y=="}"||y==";")return gt(y,T,x);if(y=="{")return Ve(x)&&ce(x,T,K?"block":"top");if(y=="interpolation")return ce(x,T,"interpolation");if(y=="word"){var oe=T.current().toLowerCase();oe=="only"||oe=="not"||oe=="and"||oe=="or"?H="keyword":L.hasOwnProperty(oe)?H="attribute":G.hasOwnProperty(oe)?H="property":ve.hasOwnProperty(oe)?H="keyword":De.hasOwnProperty(oe)?H="property":xt.hasOwnProperty(oe)?H=ye?"string-2":"property":be.hasOwnProperty(oe)?H="atom":vt.hasOwnProperty(oe)?H="keyword":H="error"}return x.context.type},me.atComponentBlock=function(y,T,x){return y=="}"?gt(y,T,x):y=="{"?Ve(x)&&ce(x,T,K?"block":"top",!1):(y=="word"&&(H="error"),x.context.type)},me.atBlock_parens=function(y,T,x){return y==")"?Ve(x):y=="{"||y=="}"?gt(y,T,x,2):me.atBlock(y,T,x)},me.restricted_atBlock_before=function(y,T,x){return y=="{"?ce(x,T,"restricted_atBlock"):y=="word"&&x.stateArg=="@counter-style"?(H="variable","restricted_atBlock_before"):Ot(y,T,x)},me.restricted_atBlock=function(y,T,x){return y=="}"?(x.stateArg=null,Ve(x)):y=="word"?(x.stateArg=="@font-face"&&!Kt.hasOwnProperty(T.current().toLowerCase())||x.stateArg=="@counter-style"&&!wt.hasOwnProperty(T.current().toLowerCase())?H="error":H="property","maybeprop"):"restricted_atBlock"},me.keyframes=function(y,T,x){return y=="word"?(H="variable","keyframes"):y=="{"?ce(x,T,"top"):Ot(y,T,x)},me.at=function(y,T,x){return y==";"?Ve(x):y=="{"||y=="}"?gt(y,T,x):(y=="word"?H="tag":y=="hash"&&(H="builtin"),"at")},me.interpolation=function(y,T,x){return y=="}"?Ve(x):y=="{"||y==";"?gt(y,T,x):(y=="word"?H="variable":y!="variable"&&y!="("&&y!=")"&&(H="error"),"interpolation")},{startState:function(y){return{tokenize:null,state:k?"block":"top",stateArg:null,context:new ee(k?"block":"top",y||0,null)}},token:function(y,T){if(!T.tokenize&&y.eatSpace())return null;var x=(T.tokenize||_t)(y,T);return x&&typeof x=="object"&&(Qe=x[1],x=x[0]),H=x,Qe!="comment"&&(T.state=me[T.state](Qe,y,T)),H},indent:function(y,T){var x=y.context,oe=T&&T.charAt(0),Ge=x.indent;return x.type=="prop"&&(oe=="}"||oe==")")&&(x=x.prev),x.prev&&(oe=="}"&&(x.type=="block"||x.type=="top"||x.type=="interpolation"||x.type=="restricted_atBlock")?(x=x.prev,Ge=x.indent):(oe==")"&&(x.type=="parens"||x.type=="atBlock_parens")||oe=="{"&&(x.type=="at"||x.type=="atBlock"))&&(Ge=Math.max(0,x.indent-z))),Ge},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:E,fold:"brace"}});function We(_){for(var j={},k=0;k<_.length;++k)j[_[k].toLowerCase()]=!0;return j}var pe=["domain","regexp","url","url-prefix"],Je=We(pe),dt=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],Pe=We(dt),P=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme"],I=We(P),se=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],re=We(se),X=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],J=We(X),fe=["border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],Le=We(fe),ze=["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],$=We(ze),_e=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],Q=We(_e),Y=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],Te=We(Y),bt=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],Ae=We(bt),rt=pe.concat(dt).concat(P).concat(se).concat(X).concat(fe).concat(Y).concat(bt);F.registerHelper("hintWords","css",rt);function Ie(_,j){for(var k=!1,z;(z=_.next())!=null;){if(k&&z=="/"){j.tokenize=null;break}k=z=="*"}return["comment","comment"]}F.defineMIME("text/css",{documentTypes:Je,mediaTypes:Pe,mediaFeatures:I,mediaValueKeywords:re,propertyKeywords:J,nonStandardPropertyKeywords:Le,fontProperties:$,counterDescriptors:Q,colorKeywords:Te,valueKeywords:Ae,tokenHooks:{"/":function(_,j){return _.eat("*")?(j.tokenize=Ie,Ie(_,j)):!1}},name:"css"}),F.defineMIME("text/x-scss",{mediaTypes:Pe,mediaFeatures:I,mediaValueKeywords:re,propertyKeywords:J,nonStandardPropertyKeywords:Le,colorKeywords:Te,valueKeywords:Ae,fontProperties:$,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(_,j){return _.eat("/")?(_.skipToEnd(),["comment","comment"]):_.eat("*")?(j.tokenize=Ie,Ie(_,j)):["operator","operator"]},":":function(_){return _.match(/\s*\{/,!1)?[null,null]:!1},$:function(_){return _.match(/^[\w-]+/),_.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(_){return _.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),F.defineMIME("text/x-less",{mediaTypes:Pe,mediaFeatures:I,mediaValueKeywords:re,propertyKeywords:J,nonStandardPropertyKeywords:Le,colorKeywords:Te,valueKeywords:Ae,fontProperties:$,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(_,j){return _.eat("/")?(_.skipToEnd(),["comment","comment"]):_.eat("*")?(j.tokenize=Ie,Ie(_,j)):["operator","operator"]},"@":function(_){return _.eat("{")?[null,"interpolation"]:_.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)?!1:(_.eatWhile(/[\w\\\-]/),_.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),F.defineMIME("text/x-gss",{documentTypes:Je,mediaTypes:Pe,mediaFeatures:I,propertyKeywords:J,nonStandardPropertyKeywords:Le,fontProperties:$,counterDescriptors:Q,colorKeywords:Te,valueKeywords:Ae,supportsAtComponent:!0,tokenHooks:{"/":function(_,j){return _.eat("*")?(j.tokenize=Ie,Ie(_,j)):!1}},name:"css",helperType:"gss"})})}()),ha.exports}(function(Zr,Dn){(function(F){F(An(),mu(),yu(),bu())})(function(F){var We={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 pe(re,X,J){var fe=re.current(),Le=fe.search(X);return Le>-1?re.backUp(fe.length-Le):fe.match(/<\/?$/)&&(re.backUp(fe.length),re.match(X,!1)||re.match(fe)),J}var Je={};function dt(re){var X=Je[re];return X||(Je[re]=new RegExp("\\s+"+re+`\\s*=\\s*('|")?([^'"]+)('|")?\\s*`))}function Pe(re,X){var J=re.match(dt(X));return J?/^\s*(.*?)\s*$/.exec(J[2])[1]:""}function P(re,X){return new RegExp((X?"^":"")+"","i")}function I(re,X){for(var J in re)for(var fe=X[J]||(X[J]=[]),Le=re[J],ze=Le.length-1;ze>=0;ze--)fe.unshift(Le[ze])}function se(re,X){for(var J=0;J=0;$--)fe.script.unshift(["type",ze[$].matches,ze[$].mode]);function _e(Q,Y){var Te=J.token(Q,Y.htmlState),bt=/\btag\b/.test(Te),Ae;if(bt&&!/[<>\s\/]/.test(Q.current())&&(Ae=Y.htmlState.tagName&&Y.htmlState.tagName.toLowerCase())&&fe.hasOwnProperty(Ae))Y.inTag=Ae+" ";else if(Y.inTag&&bt&&/>$/.test(Q.current())){var rt=/^([\S]+) (.*)/.exec(Y.inTag);Y.inTag=null;var Ie=Q.current()==">"&&se(fe[rt[1]],rt[2]),_=F.getMode(re,Ie),j=P(rt[1],!0),k=P(rt[1],!1);Y.token=function(z,c){return z.match(j,!1)?(c.token=_e,c.localState=c.localMode=null,null):pe(z,k,c.localMode.token(z,c.localState))},Y.localMode=_,Y.localState=F.startState(_,J.indent(Y.htmlState,"",""))}else Y.inTag&&(Y.inTag+=Q.current(),Q.eol()&&(Y.inTag+=" "));return Te}return{startState:function(){var Q=F.startState(J);return{token:_e,inTag:null,localMode:null,localState:null,htmlState:Q}},copyState:function(Q){var Y;return Q.localState&&(Y=F.copyState(Q.localMode,Q.localState)),{token:Q.token,inTag:Q.inTag,localMode:Q.localMode,localState:Y,htmlState:F.copyState(J,Q.htmlState)}},token:function(Q,Y){return Y.token(Q,Y)},indent:function(Q,Y,Te){return!Q.localMode||/^\s*<\//.test(Y)?J.indent(Q.htmlState,Y,Te):Q.localMode.indent?Q.localMode.indent(Q.localState,Y,Te):F.Pass},innerMode:function(Q){return{state:Q.localState||Q.htmlState,mode:Q.localMode||J}}}},"xml","javascript","css"),F.defineMIME("text/html","htmlmixed")})})();export{wu as C}; diff --git a/platform/CTFd/themes/admin/static/assets/pages/challenge-DotJhRew.js b/platform/CTFd/themes/admin/static/assets/pages/challenge-DotJhRew.js deleted file mode 100644 index f89e903e6e..0000000000 --- a/platform/CTFd/themes/admin/static/assets/pages/challenge-DotJhRew.js +++ /dev/null @@ -1,5 +0,0 @@ -import{_ as _export_sfc,$ as $$1,C as CTFd$1,n as nunjucks,o as openBlock,c as createElementBlock,a as createBaseVNode,F as Fragment,r as renderList,t as toDisplayString,w as withModifiers,b as createCommentVNode,d as createStaticVNode,e as resolveComponent,f as createVNode,g as withCtx,T as TransitionGroup,h as withDirectives,v as vModelSelect,i as vModelCheckbox,j as createTextVNode,p as pushScopeId,k as popScopeId,l as vModelText,m as withKeys,q as normalizeClass,s as helpers,u as ezQuery,x as bindMarkdownEditor,y as dayjs,z as htmlEntities,V as Vue$1,A as bindMarkdownEditors,B as ezAlert,D as ezToast}from"./main-CcyKUC_q.js";import"../tab-BrZ-GZoF.js";import{C as CommentBox}from"../CommentBox-CBClD8yz.js";const _sfc_main$c={name:"FlagCreationForm",props:{challenge_id:Number},data:function(){return{types:{},selectedType:null,createForm:""}},methods:{selectType:function(event){let flagType=event.target.value;if(this.types[flagType]===void 0){this.selectedType=null,this.createForm="";return}let createFormURL=this.types[flagType].templates.create;$$1.get(CTFd$1.config.urlRoot+createFormURL,template_data=>{const template=nunjucks.compile(template_data);this.selectedType=flagType,this.createForm=template.render(),this.createForm.includes("{$$1("
"+this.createForm+"
").find("script").each(function(){eval($$1(this).html())})},100)})},loadTypes:function(){CTFd$1.fetch("/api/v1/flags/types",{method:"GET"}).then(e=>e.json()).then(e=>{this.types=e.data})},submitFlag:function(e){let i=$$1(e.target).serializeJSON(!0);i.challenge=this.$props.challenge_id,CTFd$1.fetch("/api/v1/flags",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).then(n=>n.json()).then(n=>{this.$emit("refreshFlags",this.$options.name)})}},created(){this.loadTypes()}},_hoisted_1$c={id:"flag-create-modal",class:"modal fade",tabindex:"-1"},_hoisted_2$c={class:"modal-dialog modal-lg"},_hoisted_3$c={class:"modal-content"},_hoisted_4$c=createStaticVNode('',1),_hoisted_5$c={class:"modal-body"},_hoisted_6$b={class:"create-keys-select-div"},_hoisted_7$9=createBaseVNode("label",{for:"create-keys-select",class:"control-label"}," Choose Flag Type ",-1),_hoisted_8$9=createBaseVNode("option",null,"--",-1),_hoisted_9$9=["value"],_hoisted_10$8=createBaseVNode("br",null,null,-1),_hoisted_11$6=["innerHTML"],_hoisted_12$5={key:0,class:"btn btn-success float-right",type:"submit"};function _sfc_render$c(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$c,[createBaseVNode("div",_hoisted_2$c,[createBaseVNode("div",_hoisted_3$c,[_hoisted_4$c,createBaseVNode("div",_hoisted_5$c,[createBaseVNode("div",_hoisted_6$b,[_hoisted_7$9,createBaseVNode("select",{class:"form-control custom-select",onChange:t[0]||(t[0]=s=>o.selectType(s))},[_hoisted_8$9,(openBlock(!0),createElementBlock(Fragment,null,renderList(Object.keys(e.types),s=>(openBlock(),createElementBlock("option",{value:s,key:s},toDisplayString(s),9,_hoisted_9$9))),128))],32)]),_hoisted_10$8,createBaseVNode("form",{onSubmit:t[1]||(t[1]=withModifiers((...s)=>o.submitFlag&&o.submitFlag(...s),["prevent"]))},[createBaseVNode("div",{id:"create-flag-form",innerHTML:e.createForm},null,8,_hoisted_11$6),e.createForm?(openBlock(),createElementBlock("button",_hoisted_12$5," Create Flag ")):createCommentVNode("",!0)],32)])])])])}const FlagCreationForm=_export_sfc(_sfc_main$c,[["render",_sfc_render$c]]),_sfc_main$b={name:"FlagEditForm",props:{flag_id:Number},data:function(){return{flag:{},editForm:""}},watch:{flag_id:{immediate:!0,handler(e,t){e!==null&&this.loadFlag()}}},methods:{loadFlag:function(){CTFd$1.fetch(`/api/v1/flags/${this.$props.flag_id}`,{method:"GET"}).then(e=>e.json()).then(response=>{this.flag=response.data;let editFormURL=this.flag.templates.update;$$1.get(CTFd$1.config.urlRoot+editFormURL,template_data=>{const template=nunjucks.compile(template_data);this.editForm=template.render(this.flag),this.editForm.includes("{$$1("
"+this.editForm+"
").find("script").each(function(){eval($$1(this).html())})},100)})})},updateFlag:function(e){let i=$$1(e.target).serializeJSON(!0);CTFd$1.fetch(`/api/v1/flags/${this.$props.flag_id}`,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).then(n=>n.json()).then(n=>{this.$emit("refreshFlags",this.$options.name)})}},mounted(){this.flag_id&&this.loadFlag()},created(){this.flag_id&&this.loadFlag()}},_hoisted_1$b={id:"flag-edit-modal",class:"modal fade",tabindex:"-1"},_hoisted_2$b={class:"modal-dialog modal-lg"},_hoisted_3$b={class:"modal-content"},_hoisted_4$b=createStaticVNode('',1),_hoisted_5$b={class:"modal-body"},_hoisted_6$a=["innerHTML"];function _sfc_render$b(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$b,[createBaseVNode("div",_hoisted_2$b,[createBaseVNode("div",_hoisted_3$b,[_hoisted_4$b,createBaseVNode("div",_hoisted_5$b,[createBaseVNode("form",{method:"POST",innerHTML:e.editForm,onSubmit:t[0]||(t[0]=withModifiers((...s)=>o.updateFlag&&o.updateFlag(...s),["prevent"]))},null,40,_hoisted_6$a)])])])])}const FlagEditForm=_export_sfc(_sfc_main$b,[["render",_sfc_render$b]]),_sfc_main$a={components:{FlagCreationForm,FlagEditForm},props:{challenge_id:Number},data:function(){return{flags:[],editing_flag_id:null}},methods:{loadFlags:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/flags`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.flags=e.data)})},refreshFlags(e){this.loadFlags();let t;switch(e){case"FlagEditForm":t=this.$refs.FlagEditForm.$el,$$1(t).modal("hide");break;case"FlagCreationForm":t=this.$refs.FlagCreationForm.$el,$$1(t).modal("hide");break}},addFlag:function(){let e=this.$refs.FlagCreationForm.$el;$$1(e).modal()},editFlag:function(e){this.editing_flag_id=e;let t=this.$refs.FlagEditForm.$el;$$1(t).modal()},deleteFlag:function(e){confirm("Are you sure you'd like to delete this flag?")&&CTFd$1.fetch(`/api/v1/flags/${e}`,{method:"DELETE"}).then(t=>t.json()).then(t=>{t.success&&this.loadFlags()})}},created(){this.loadFlags()}},_hoisted_1$a={id:"flagsboard",class:"table table-striped"},_hoisted_2$a=createBaseVNode("thead",null,[createBaseVNode("tr",null,[createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Type")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Flag")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Settings")])])],-1),_hoisted_3$a=["name"],_hoisted_4$a={class:"text-center"},_hoisted_5$a={class:"text-break"},_hoisted_6$9={class:"flag-content"},_hoisted_7$8={class:"text-center"},_hoisted_8$8=["flag-id","flag-type","onClick"],_hoisted_9$8=["flag-id","onClick"],_hoisted_10$7={class:"col-md-12"};function _sfc_render$a(e,t,i,n,a,o){const s=resolveComponent("FlagCreationForm"),l=resolveComponent("FlagEditForm");return openBlock(),createElementBlock("div",null,[createBaseVNode("div",null,[createVNode(s,{ref:"FlagCreationForm",challenge_id:i.challenge_id,onRefreshFlags:o.refreshFlags},null,8,["challenge_id","onRefreshFlags"])]),createBaseVNode("div",null,[createVNode(l,{ref:"FlagEditForm",flag_id:e.editing_flag_id,onRefreshFlags:o.refreshFlags},null,8,["flag_id","onRefreshFlags"])]),createBaseVNode("table",_hoisted_1$a,[_hoisted_2$a,createBaseVNode("tbody",null,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.flags,d=>(openBlock(),createElementBlock("tr",{name:d.id,key:d.id},[createBaseVNode("td",_hoisted_4$a,toDisplayString(d.type),1),createBaseVNode("td",_hoisted_5$a,[createBaseVNode("pre",_hoisted_6$9,toDisplayString(d.content),1)]),createBaseVNode("td",_hoisted_7$8,[createBaseVNode("i",{role:"button",class:"btn-fa fas fa-edit edit-flag","flag-id":d.id,"flag-type":d.type,onClick:r=>o.editFlag(d.id)},null,8,_hoisted_8$8),createBaseVNode("i",{role:"button",class:"btn-fa fas fa-times delete-flag","flag-id":d.id,onClick:r=>o.deleteFlag(d.id)},null,8,_hoisted_9$8)])],8,_hoisted_3$a))),128))])]),createBaseVNode("div",_hoisted_10$7,[createBaseVNode("button",{id:"flag-add-button",class:"btn btn-success d-inline-block float-right",onClick:t[0]||(t[0]=d=>o.addFlag())}," Create Flag ")])])}const FlagList=_export_sfc(_sfc_main$a,[["render",_sfc_render$a]]),_sfc_main$9={props:{challenge_id:Number},data:function(){return{challenges:[],requirements:{},selectedRequirements:[],selectedAnonymize:!1}},computed:{newRequirements:function(){let e=this.requirements.prerequisites||[],t=this.requirements.anonymize||!1,i=JSON.stringify(e.sort())!==JSON.stringify(this.selectedRequirements.sort()),n=t!==this.selectedAnonymize;return i||n},requiredChallenges:function(){const e=this.requirements.prerequisites||[];return this.challenges.filter(t=>t.id!==this.$props.challenge_id&&e.includes(t.id))},otherChallenges:function(){const e=this.requirements.prerequisites||[];return this.challenges.filter(t=>t.id!==this.$props.challenge_id&&!e.includes(t.id))}},methods:{loadChallenges:function(){CTFd$1.fetch("/api/v1/challenges?view=admin",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.challenges=e.data)})},getChallengeNameById:function(e){let t=this.challenges.find(i=>i.id===e);return t?t.name:""},loadRequirements:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/requirements`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.requirements=e.data||{},this.selectedRequirements=this.requirements.prerequisites||[],this.selectedAnonymize=this.requirements.anonymize||!1)})},updateRequirements:function(){const t={requirements:{prerequisites:this.selectedRequirements}};this.selectedAnonymize&&(t.requirements.anonymize=!0),CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}`,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then(i=>i.json()).then(i=>{i.success&&this.loadRequirements()})}},created(){this.loadChallenges(),this.loadRequirements()}},_withScopeId=e=>(pushScopeId("data-v-a3fa86b4"),e=e(),popScopeId(),e),_hoisted_1$9={class:"form-group scrollbox"},_hoisted_2$9={class:"form-check-label cursor-pointer"},_hoisted_3$9=["value"],_hoisted_4$9={class:"form-check-label cursor-pointer"},_hoisted_5$9=["value"],_hoisted_6$8={class:"form-group"},_hoisted_7$7=_withScopeId(()=>createBaseVNode("label",null,[createBaseVNode("b",null,"Behavior if not unlocked")],-1)),_hoisted_8$7=_withScopeId(()=>createBaseVNode("option",{value:!1},"Hidden",-1)),_hoisted_9$7=_withScopeId(()=>createBaseVNode("option",{value:!0},"Anonymized",-1)),_hoisted_10$6=[_hoisted_8$7,_hoisted_9$7],_hoisted_11$5={class:"form-group"},_hoisted_12$4=["disabled"];function _sfc_render$9(e,t,i,n,a,o){return openBlock(),createElementBlock("div",null,[createBaseVNode("form",{onSubmit:t[3]||(t[3]=withModifiers((...s)=>o.updateRequirements&&o.updateRequirements(...s),["prevent"]))},[createBaseVNode("div",_hoisted_1$9,[createVNode(TransitionGroup,{name:"flip-list"},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.requiredChallenges,s=>(openBlock(),createElementBlock("div",{class:"form-check",key:s.id},[createBaseVNode("label",_hoisted_2$9,[withDirectives(createBaseVNode("input",{class:"form-check-input",type:"checkbox",value:s.id,"onUpdate:modelValue":t[0]||(t[0]=l=>e.selectedRequirements=l)},null,8,_hoisted_3$9),[[vModelCheckbox,e.selectedRequirements]]),createTextVNode(" "+toDisplayString(s.name),1)])]))),128)),(openBlock(!0),createElementBlock(Fragment,null,renderList(o.otherChallenges,s=>(openBlock(),createElementBlock("div",{class:"form-check",key:s.id},[createBaseVNode("label",_hoisted_4$9,[withDirectives(createBaseVNode("input",{class:"form-check-input",type:"checkbox",value:s.id,"onUpdate:modelValue":t[1]||(t[1]=l=>e.selectedRequirements=l)},null,8,_hoisted_5$9),[[vModelCheckbox,e.selectedRequirements]]),createTextVNode(" "+toDisplayString(s.name),1)])]))),128))]),_:1})]),createBaseVNode("div",_hoisted_6$8,[_hoisted_7$7,withDirectives(createBaseVNode("select",{class:"form-control custom-select",name:"anonymize","onUpdate:modelValue":t[2]||(t[2]=s=>e.selectedAnonymize=s)},_hoisted_10$6,512),[[vModelSelect,e.selectedAnonymize]])]),createBaseVNode("div",_hoisted_11$5,[createBaseVNode("button",{class:"btn btn-success float-right",disabled:!o.newRequirements}," Save ",8,_hoisted_12$4)])],32)])}const Requirements=_export_sfc(_sfc_main$9,[["render",_sfc_render$9],["__scopeId","data-v-a3fa86b4"]]),_sfc_main$8={props:{challenge_id:Number},data:function(){return{topics:[],topicValue:"",searchedTopic:"",topicResults:[],selectedResultIdx:0,awaitingSearch:!1}},methods:{loadTopics:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/topics`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.topics=e.data)})},searchTopics:function(){if(this.selectedResultIdx=0,this.topicValue==""){this.topicResults=[];return}CTFd$1.fetch(`/api/v1/topics?field=value&q=${this.topicValue}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.topicResults=e.data.slice(0,10))})},addTopic:function(){let e;if(this.selectedResultIdx===0)e=this.topicValue;else{let i=this.selectedResultIdx-1;e=this.topicResults[i].value}const t={value:e,challenge:this.$props.challenge_id,type:"challenge"};CTFd$1.fetch("/api/v1/topics",{method:"POST",body:JSON.stringify(t)}).then(i=>i.json()).then(i=>{i.success&&(this.topicValue="",this.loadTopics())})},deleteTopic:function(e){CTFd$1.fetch(`/api/v1/topics?type=challenge&target_id=${e}`,{method:"DELETE"}).then(t=>t.json()).then(t=>{t.success&&this.loadTopics()})},moveCursor:function(e){switch(e){case"up":this.selectedResultIdx&&(this.selectedResultIdx-=1);break;case"down":this.selectedResultIdx{this.searchTopics(),this.awaitingSearch=!1},500),this.awaitingSearch=!0}},created(){this.loadTopics()}},_hoisted_1$8={class:"col-md-12"},_hoisted_2$8={id:"challenge-topics",class:"my-3"},_hoisted_3$8={class:"mr-1"},_hoisted_4$8=["onClick"],_hoisted_5$8={class:"form-group"},_hoisted_6$7=createBaseVNode("label",null,[createTextVNode(" Topic "),createBaseVNode("br"),createBaseVNode("small",{class:"text-muted"},"Type topic and press Enter")],-1),_hoisted_7$6={class:"form-group"},_hoisted_8$6={class:"list-group"},_hoisted_9$6=["onClick"];function _sfc_render$8(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$8,[createBaseVNode("div",_hoisted_2$8,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.topics,s=>(openBlock(),createElementBlock("h5",{class:"challenge-tag",key:s.id},[createBaseVNode("span",_hoisted_3$8,toDisplayString(s.value),1),createBaseVNode("a",{class:"btn-fa delete-tag",onClick:l=>o.deleteTopic(s.id)}," ×",8,_hoisted_4$8)]))),128))]),createBaseVNode("div",_hoisted_5$8,[_hoisted_6$7,withDirectives(createBaseVNode("input",{id:"tags-add-input",maxlength:"255",type:"text",class:"form-control","onUpdate:modelValue":t[0]||(t[0]=s=>e.topicValue=s),onKeyup:[t[1]||(t[1]=withKeys(s=>o.moveCursor("down"),["down"])),t[2]||(t[2]=withKeys(s=>o.moveCursor("up"),["up"])),t[3]||(t[3]=withKeys(s=>o.addTopic(),["enter"]))]},null,544),[[vModelText,e.topicValue]])]),createBaseVNode("div",_hoisted_7$6,[createBaseVNode("ul",_hoisted_8$6,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.topicResults,(s,l)=>(openBlock(),createElementBlock("li",{class:normalizeClass({"list-group-item":!0,active:l+1===e.selectedResultIdx}),key:s.id,onClick:d=>o.selectTopic(l)},toDisplayString(s.value),11,_hoisted_9$6))),128))])])])}const TopicsList=_export_sfc(_sfc_main$8,[["render",_sfc_render$8]]),_sfc_main$7={props:{challenge_id:Number},data:function(){return{tags:[],tagValue:""}},methods:{loadTags:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/tags`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.tags=e.data)})},addTag:function(){if(this.tagValue){const e={value:this.tagValue,challenge:this.$props.challenge_id};CTFd$1.api.post_tag_list({},e).then(t=>{t.success&&(this.tagValue="",this.loadTags())})}},deleteTag:function(e){CTFd$1.api.delete_tag({tagId:e}).then(t=>{t.success&&this.loadTags()})}},created(){this.loadTags()}},_hoisted_1$7={class:"col-md-12"},_hoisted_2$7={id:"challenge-tags",class:"my-3"},_hoisted_3$7=["onClick"],_hoisted_4$7={class:"form-group"},_hoisted_5$7=createBaseVNode("label",null,[createTextVNode("Tag "),createBaseVNode("br"),createBaseVNode("small",{class:"text-muted"},"Type tag and press Enter")],-1);function _sfc_render$7(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$7,[createBaseVNode("div",_hoisted_2$7,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.tags,s=>(openBlock(),createElementBlock("span",{class:"badge badge-primary mx-1 challenge-tag",key:s.id},[createBaseVNode("span",null,toDisplayString(s.value),1),createBaseVNode("a",{class:"btn-fa delete-tag",onClick:l=>o.deleteTag(s.id)}," ×",8,_hoisted_3$7)]))),128))]),createBaseVNode("div",_hoisted_4$7,[_hoisted_5$7,withDirectives(createBaseVNode("input",{id:"tags-add-input",maxlength:"80",type:"text",class:"form-control","onUpdate:modelValue":t[0]||(t[0]=s=>e.tagValue=s),onKeyup:t[1]||(t[1]=withKeys(s=>o.addTag(),["enter"]))},null,544),[[vModelText,e.tagValue]])])])}const TagsList=_export_sfc(_sfc_main$7,[["render",_sfc_render$7]]),_sfc_main$6={props:{challenge_id:Number},data:function(){return{files:[],urlRoot:CTFd$1.config.urlRoot}},methods:{loadFiles:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/files`,{method:"GET"}).then(e=>e.json()).then(e=>{e.success&&(this.files=e.data)})},addFiles:function(){let e={challenge:this.$props.challenge_id,type:"challenge"},t=this.$refs.FileUploadForm;helpers.files.upload(t,e,i=>{setTimeout(()=>{this.loadFiles()},700)})},deleteFile:function(e){ezQuery({title:"Delete Files",body:"Are you sure you want to delete this file?",success:()=>{CTFd$1.fetch(`/api/v1/files/${e}`,{method:"DELETE"}).then(t=>t.json()).then(t=>{t.success&&this.loadFiles()})}})}},created(){this.loadFiles()}},_hoisted_1$6={id:"filesboard",class:"table table-striped"},_hoisted_2$6=createBaseVNode("thead",null,[createBaseVNode("tr",null,[createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"File")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Settings")])])],-1),_hoisted_3$6={class:"text-left"},_hoisted_4$6=["href"],_hoisted_5$6={class:"d-flex flex-row align-items-center"},_hoisted_6$6=createBaseVNode("strong",{class:"mr-2 small"}," SHA1: ",-1),_hoisted_7$5={class:"d-inline-block mr-2 small text-muted"},_hoisted_8$5={class:"text-center"},_hoisted_9$5=["onClick"],_hoisted_10$5={class:"col-md-12 mt-3"},_hoisted_11$4=createStaticVNode('
Attach multiple files using Control+Click or Cmd+Click.
',2),_hoisted_13$3=[_hoisted_11$4];function _sfc_render$6(e,t,i,n,a,o){return openBlock(),createElementBlock("div",null,[createBaseVNode("table",_hoisted_1$6,[_hoisted_2$6,createBaseVNode("tbody",null,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.files,s=>(openBlock(),createElementBlock("tr",{key:s.id},[createBaseVNode("td",_hoisted_3$6,[createBaseVNode("a",{href:`${e.urlRoot}/files/${s.location}`},toDisplayString(s.location.split("/").pop()),9,_hoisted_4$6),createBaseVNode("div",_hoisted_5$6,[_hoisted_6$6,createBaseVNode("span",_hoisted_7$5,toDisplayString(s.sha1sum||"null"),1)])]),createBaseVNode("td",_hoisted_8$5,[createBaseVNode("i",{role:"button",class:"btn-fa fas fa-times delete-file",onClick:l=>o.deleteFile(s.id)},null,8,_hoisted_9$5)])]))),128))])]),createBaseVNode("div",_hoisted_10$5,[createBaseVNode("form",{method:"POST",ref:"FileUploadForm",onSubmit:t[0]||(t[0]=withModifiers((...s)=>o.addFiles&&o.addFiles(...s),["prevent"]))},_hoisted_13$3,544)])])}const ChallengeFilesList=_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]),_sfc_main$5={name:"HintCreationForm",props:{challenge_id:Number,hints:Array},data:function(){return{cost:0,selectedHints:[]}},methods:{clearForm:function(){this.$refs.title.value="",this.$refs.content&&this.$refs.content.mde&&(this.$refs.content.mde.value(""),this.$refs.content.mde.codemirror.refresh()),this.$refs.content.value="",this.cost=0,this.selectedHints=[]},getCost:function(){return this.cost||0},getContent:function(){return this.$refs.content.value},getTitle:function(){return this.$refs.title.value},submitHint:function(){let e={challenge_id:this.$props.challenge_id,content:this.getContent(),cost:this.getCost(),title:this.getTitle(),requirements:{prerequisites:this.selectedHints}};CTFd.fetch("/api/v1/hints",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(t=>t.json()).then(t=>{t.success&&(this.$emit("refreshHints",this.$options.name),this.clearForm())})}}},_hoisted_1$5={class:"modal fade",tabindex:"-1"},_hoisted_2$5={class:"modal-dialog"},_hoisted_3$5={class:"modal-content"},_hoisted_4$5=createStaticVNode('',1),_hoisted_5$5={class:"modal-body"},_hoisted_6$5={class:"container"},_hoisted_7$4={class:"row"},_hoisted_8$4={class:"col-md-12"},_hoisted_9$4={class:"form-group"},_hoisted_10$4=createBaseVNode("label",null,[createTextVNode(" Title"),createBaseVNode("br"),createBaseVNode("small",null,"Content displayed before hint unlocking")],-1),_hoisted_11$3={type:"text",class:"form-control",name:"title",ref:"title"},_hoisted_12$3={class:"form-group"},_hoisted_13$2=createBaseVNode("label",null,[createTextVNode(" Hint"),createBaseVNode("br"),createBaseVNode("small",null,"Markdown & HTML are supported")],-1),_hoisted_14$2={type:"text",class:"form-control markdown",name:"content",rows:"7",ref:"content"},_hoisted_15$2={class:"form-group"},_hoisted_16$2=createBaseVNode("label",null,[createTextVNode(" Cost"),createBaseVNode("br"),createBaseVNode("small",null,"How many points it costs to see your hint.")],-1),_hoisted_17$2={class:"form-group"},_hoisted_18$2=createBaseVNode("label",null,[createTextVNode(" Requirements"),createBaseVNode("br"),createBaseVNode("small",null,"Hints that must be unlocked before unlocking this hint")],-1),_hoisted_19$2={class:"form-check-label cursor-pointer"},_hoisted_20$2=["value"],_hoisted_21$2=createBaseVNode("input",{type:"hidden",id:"hint-id-for-hint",name:"id"},null,-1),_hoisted_22$1=createStaticVNode('',1);function _sfc_render$5(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$5,[createBaseVNode("div",_hoisted_2$5,[createBaseVNode("div",_hoisted_3$5,[_hoisted_4$5,createBaseVNode("form",{method:"POST",onSubmit:t[2]||(t[2]=withModifiers((...s)=>o.submitHint&&o.submitHint(...s),["prevent"]))},[createBaseVNode("div",_hoisted_5$5,[createBaseVNode("div",_hoisted_6$5,[createBaseVNode("div",_hoisted_7$4,[createBaseVNode("div",_hoisted_8$4,[createBaseVNode("div",_hoisted_9$4,[_hoisted_10$4,createBaseVNode("input",_hoisted_11$3,null,512)]),createBaseVNode("div",_hoisted_12$3,[_hoisted_13$2,createBaseVNode("textarea",_hoisted_14$2,null,512)]),createBaseVNode("div",_hoisted_15$2,[_hoisted_16$2,withDirectives(createBaseVNode("input",{type:"number",class:"form-control",name:"cost","onUpdate:modelValue":t[0]||(t[0]=s=>e.cost=s)},null,512),[[vModelText,e.cost,void 0,{lazy:!0}]])]),createBaseVNode("div",_hoisted_17$2,[_hoisted_18$2,(openBlock(!0),createElementBlock(Fragment,null,renderList(i.hints,s=>(openBlock(),createElementBlock("div",{class:"form-check",key:s.id},[createBaseVNode("label",_hoisted_19$2,[withDirectives(createBaseVNode("input",{class:"form-check-input",type:"checkbox",value:s.id,"onUpdate:modelValue":t[1]||(t[1]=l=>e.selectedHints=l)},null,8,_hoisted_20$2),[[vModelCheckbox,e.selectedHints]]),createTextVNode(" "+toDisplayString(s.cost)+" - "+toDisplayString(s.id),1)])]))),128))]),_hoisted_21$2])])])]),_hoisted_22$1],32)])])])}const HintCreationForm=_export_sfc(_sfc_main$5,[["render",_sfc_render$5]]),_sfc_main$4={name:"HintEditForm",props:{challenge_id:Number,hint_id:Number,hints:Array},data:function(){return{cost:0,title:null,content:null,selectedHints:[]}},computed:{otherHints:function(){return this.hints.filter(e=>e.id!==this.$props.hint_id)}},watch:{hint_id:{immediate:!0,handler(e,t){e!==null&&this.loadHint()}}},methods:{loadHint:function(){CTFd$1.fetch(`/api/v1/hints/${this.$props.hint_id}?preview=true`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{var t;if(e.success){let i=e.data;this.cost=i.cost,this.title=i.title,this.content=i.content,this.selectedHints=((t=i.requirements)==null?void 0:t.prerequisites)||[];let n=this.$refs.content;bindMarkdownEditor(n),setTimeout(()=>{n.mde.codemirror.getDoc().setValue(n.value),this._forceRefresh()},200)}})},_forceRefresh:function(){this.$refs.content.mde.codemirror.refresh()},getCost:function(){return this.cost||0},getContent:function(){return this._forceRefresh(),this.$refs.content.mde.codemirror.getDoc().getValue()},getTitle:function(){return this.$refs.title.value},updateHint:function(){let e={challenge_id:this.$props.challenge_id,content:this.getContent(),cost:this.getCost(),title:this.getTitle(),requirements:{prerequisites:this.selectedHints}};CTFd$1.fetch(`/api/v1/hints/${this.$props.hint_id}`,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(t=>t.json()).then(t=>{t.success&&this.$emit("refreshHints",this.$options.name)})}},mounted(){this.hint_id&&this.loadHint()},created(){this.hint_id&&this.loadHint()}},_hoisted_1$4={class:"modal fade",tabindex:"-1"},_hoisted_2$4={class:"modal-dialog"},_hoisted_3$4={class:"modal-content"},_hoisted_4$4=createStaticVNode('',1),_hoisted_5$4={class:"modal-body"},_hoisted_6$4={class:"container"},_hoisted_7$3={class:"row"},_hoisted_8$3={class:"col-md-12"},_hoisted_9$3={class:"form-group"},_hoisted_10$3=createBaseVNode("label",null,[createTextVNode(" Title"),createBaseVNode("br"),createBaseVNode("small",null,"Content displayed before hint unlocking")],-1),_hoisted_11$2=["value"],_hoisted_12$2={class:"form-group"},_hoisted_13$1=createBaseVNode("label",null,[createTextVNode(" Hint"),createBaseVNode("br"),createBaseVNode("small",null,"Markdown & HTML are supported")],-1),_hoisted_14$1=["value"],_hoisted_15$1={class:"form-group"},_hoisted_16$1=createBaseVNode("label",null,[createTextVNode(" Cost"),createBaseVNode("br"),createBaseVNode("small",null,"How many points it costs to see your hint.")],-1),_hoisted_17$1={class:"form-group"},_hoisted_18$1=createBaseVNode("label",null,[createTextVNode(" Requirements"),createBaseVNode("br"),createBaseVNode("small",null,"Hints that must be unlocked before unlocking this hint")],-1),_hoisted_19$1={class:"form-check-label cursor-pointer"},_hoisted_20$1=["value"],_hoisted_21$1=createStaticVNode('',1);function _sfc_render$4(e,t,i,n,a,o){return openBlock(),createElementBlock("div",_hoisted_1$4,[createBaseVNode("div",_hoisted_2$4,[createBaseVNode("div",_hoisted_3$4,[_hoisted_4$4,createBaseVNode("form",{method:"POST",onSubmit:t[2]||(t[2]=withModifiers((...s)=>o.updateHint&&o.updateHint(...s),["prevent"]))},[createBaseVNode("div",_hoisted_5$4,[createBaseVNode("div",_hoisted_6$4,[createBaseVNode("div",_hoisted_7$3,[createBaseVNode("div",_hoisted_8$3,[createBaseVNode("div",_hoisted_9$3,[_hoisted_10$3,createBaseVNode("input",{type:"text",class:"form-control",name:"title",value:this.title,ref:"title"},null,8,_hoisted_11$2)]),createBaseVNode("div",_hoisted_12$2,[_hoisted_13$1,createBaseVNode("textarea",{type:"text",class:"form-control",name:"content",rows:"7",value:this.content,ref:"content"},null,8,_hoisted_14$1)]),createBaseVNode("div",_hoisted_15$1,[_hoisted_16$1,withDirectives(createBaseVNode("input",{type:"number",class:"form-control",name:"cost","onUpdate:modelValue":t[0]||(t[0]=s=>e.cost=s)},null,512),[[vModelText,e.cost,void 0,{lazy:!0}]])]),createBaseVNode("div",_hoisted_17$1,[_hoisted_18$1,(openBlock(!0),createElementBlock(Fragment,null,renderList(o.otherHints,s=>(openBlock(),createElementBlock("div",{class:"form-check",key:s.id},[createBaseVNode("label",_hoisted_19$1,[withDirectives(createBaseVNode("input",{class:"form-check-input",type:"checkbox",value:s.id,"onUpdate:modelValue":t[1]||(t[1]=l=>e.selectedHints=l)},null,8,_hoisted_20$1),[[vModelCheckbox,e.selectedHints]]),createTextVNode(" "+toDisplayString(s.content)+" - "+toDisplayString(s.cost),1)])]))),128))])])])])]),_hoisted_21$1],32)])])])}const HintEditForm=_export_sfc(_sfc_main$4,[["render",_sfc_render$4]]),_sfc_main$3={components:{HintCreationForm,HintEditForm},props:{challenge_id:Number},data:function(){return{hints:[],editing_hint_id:null}},methods:{loadHints:async function(){let t=await(await CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}/hints`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}})).json();return this.hints=t.data,t.success},addHint:function(){let e=this.$refs.HintCreationForm.$el;$(e).modal()},editHint:function(e){this.editing_hint_id=e;let t=this.$refs.HintEditForm.$el;$(t).modal()},refreshHints:function(e){this.loadHints().then(t=>{if(t){let i;switch(e){case"HintCreationForm":i=this.$refs.HintCreationForm.$el,console.log(i),$(i).modal("hide");break;case"HintEditForm":i=this.$refs.HintEditForm.$el,$(i).modal("hide");break}}else alert("An error occurred while updating this hint. Please try again.")})},deleteHint:function(e){ezQuery({title:"Delete Hint",body:"Are you sure you want to delete this hint?",success:()=>{CTFd$1.fetch(`/api/v1/hints/${e}`,{method:"DELETE"}).then(t=>t.json()).then(t=>{t.success&&this.loadHints()})}})}},created(){this.loadHints()}},_hoisted_1$3={class:"table table-striped"},_hoisted_2$3=createBaseVNode("thead",null,[createBaseVNode("tr",null,[createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"ID")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Title")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Hint")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Cost")]),createBaseVNode("td",{class:"text-center"},[createBaseVNode("b",null,"Settings")])])],-1),_hoisted_3$3={class:"text-center"},_hoisted_4$3={class:"text-center"},_hoisted_5$3={class:"text-break"},_hoisted_6$3={class:"text-center"},_hoisted_7$2={class:"text-center"},_hoisted_8$2=["onClick"],_hoisted_9$2=["onClick"],_hoisted_10$2={class:"col-md-12"};function _sfc_render$3(e,t,i,n,a,o){const s=resolveComponent("HintCreationForm"),l=resolveComponent("HintEditForm");return openBlock(),createElementBlock("div",null,[createBaseVNode("div",null,[createVNode(s,{ref:"HintCreationForm",challenge_id:i.challenge_id,hints:e.hints,onRefreshHints:o.refreshHints},null,8,["challenge_id","hints","onRefreshHints"])]),createBaseVNode("div",null,[createVNode(l,{ref:"HintEditForm",challenge_id:i.challenge_id,hint_id:e.editing_hint_id,hints:e.hints,onRefreshHints:o.refreshHints},null,8,["challenge_id","hint_id","hints","onRefreshHints"])]),createBaseVNode("table",_hoisted_1$3,[_hoisted_2$3,createBaseVNode("tbody",null,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.hints,d=>(openBlock(),createElementBlock("tr",{key:d.id},[createBaseVNode("td",_hoisted_3$3,toDisplayString(d.type),1),createBaseVNode("td",_hoisted_4$3,toDisplayString(d.title),1),createBaseVNode("td",_hoisted_5$3,[createBaseVNode("pre",null,toDisplayString(d.content),1)]),createBaseVNode("td",_hoisted_6$3,toDisplayString(d.cost),1),createBaseVNode("td",_hoisted_7$2,[createBaseVNode("i",{role:"button",class:"btn-fa fas fa-edit",onClick:r=>o.editHint(d.id)},null,8,_hoisted_8$2),createBaseVNode("i",{role:"button",class:"btn-fa fas fa-times",onClick:r=>o.deleteHint(d.id)},null,8,_hoisted_9$2)])]))),128))])]),createBaseVNode("div",_hoisted_10$2,[createBaseVNode("button",{class:"btn btn-success float-right",onClick:t[0]||(t[0]=(...d)=>o.addHint&&o.addHint(...d))}," Create Hint ")])])}const HintsList=_export_sfc(_sfc_main$3,[["render",_sfc_render$3]]),_sfc_main$2={props:{challenge_id:Number},data:function(){return{challenge:null,challenges:[],selected_id:null}},computed:{updateAvailable:function(){return this.challenge?this.selected_id!=this.challenge.next_id:!1},otherChallenges:function(){return this.challenges.filter(e=>e.id!==this.$props.challenge_id)}},methods:{loadData:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.challenge=e.data,this.selected_id=e.data.next_id)})},loadChallenges:function(){CTFd$1.fetch("/api/v1/challenges?view=admin",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success&&(this.challenges=e.data)})},updateNext:function(){CTFd$1.fetch(`/api/v1/challenges/${this.$props.challenge_id}`,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({next_id:this.selected_id!="null"?this.selected_id:null})}).then(e=>e.json()).then(e=>{e.success&&(this.loadData(),this.loadChallenges())})}},created(){this.loadData(),this.loadChallenges()}},_hoisted_1$2={class:"form-group"},_hoisted_2$2=createBaseVNode("label",null,[createTextVNode(" Next Challenge "),createBaseVNode("br"),createBaseVNode("small",{class:"text-muted"},"Challenge to recommend after solving this challenge")],-1),_hoisted_3$2=createBaseVNode("option",{value:"null"},"--",-1),_hoisted_4$2=["value"],_hoisted_5$2={class:"form-group"},_hoisted_6$2=["disabled"];function _sfc_render$2(e,t,i,n,a,o){return openBlock(),createElementBlock("div",null,[createBaseVNode("form",{onSubmit:t[1]||(t[1]=withModifiers((...s)=>o.updateNext&&o.updateNext(...s),["prevent"]))},[createBaseVNode("div",_hoisted_1$2,[_hoisted_2$2,withDirectives(createBaseVNode("select",{class:"form-control custom-select","onUpdate:modelValue":t[0]||(t[0]=s=>e.selected_id=s)},[_hoisted_3$2,(openBlock(!0),createElementBlock(Fragment,null,renderList(o.otherChallenges,s=>(openBlock(),createElementBlock("option",{value:s.id,key:s.id},toDisplayString(s.name),9,_hoisted_4$2))),128))],512),[[vModelSelect,e.selected_id]])]),createBaseVNode("div",_hoisted_5$2,[createBaseVNode("button",{class:"btn btn-success float-right",disabled:!o.updateAvailable}," Save ",8,_hoisted_6$2)])],32)])}const NextChallenge=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),_sfc_main$1={name:"SolutionEditor",props:{challenge_id:Number},data:function(){return{solution_id:null,content:"",state:"hidden",loading:!1}},watch:{solution_id:{handler(e,t){t==null&&this.loadSolution()}}},methods:{loadSolution:function(){CTFd$1.fetch(`/api/v1/solutions/${this.solution_id}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{if(e.success){let t=e.data;this.content=t.content||"",this.state=t.state||"hidden";let i=this.$refs.content;bindMarkdownEditor(i),setTimeout(()=>{i.mde&&(i.mde.codemirror.getDoc().setValue(this.content),this._forceRefresh())},200)}}).catch(e=>{console.error("Error loading solution:",e)})},resetForm:function(){this.content="",this.state="hidden",setTimeout(()=>{let e=this.$refs.content;e&&(bindMarkdownEditor(e),setTimeout(()=>{e.mde&&(e.mde.codemirror.getDoc().setValue(""),this._forceRefresh())},200))},100)},_forceRefresh:function(){let e=this.$refs.content;e&&e.mde&&e.mde.codemirror.refresh()},getContent:function(){this._forceRefresh();let e=this.$refs.content;return e&&e.mde?e.mde.codemirror.getDoc().getValue():e.value},submitSolution:function(){this.loading=!0;let e={content:this.getContent(),state:this.state},t,i;this.solution_id?(t=`/api/v1/solutions/${this.solution_id}`,i="PATCH"):(e.challenge_id=this.challenge_id,t="/api/v1/solutions",i="POST"),CTFd$1.fetch(t,{method:i,credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(n=>n.json()).then(n=>{n.success?(this.solution_id||(this.solution_id=n.data.id),this.loading=!1):(this.loading=!1,console.error("Error submitting solution:",n.errors))}).catch(n=>{this.loading=!1,console.error("Network error:",n)})}},created(){this.solution_id=window.CHALLENGE_SOLUTION_ID,$("a[href='#solution']").on("shown.bs.tab",e=>{this._forceRefresh()}),this.solution_id?this.loadSolution():this.resetForm()}},_hoisted_1$1={class:"form-group"},_hoisted_2$1=createBaseVNode("label",null,[createTextVNode(" Content"),createBaseVNode("br"),createBaseVNode("small",null,"Markdown & HTML are supported")],-1),_hoisted_3$1=["value","media-id"],_hoisted_4$1={class:"form-group"},_hoisted_5$1=createBaseVNode("label",null,[createTextVNode(" State"),createBaseVNode("br"),createBaseVNode("small",null,"Controls who can view this solution")],-1),_hoisted_6$1=createBaseVNode("option",{value:"hidden"},"Hidden",-1),_hoisted_7$1=createBaseVNode("option",{value:"visible"},"Visible",-1),_hoisted_8$1=[_hoisted_6$1,_hoisted_7$1],_hoisted_9$1={class:"btn btn-primary float-right",type:"submit"},_hoisted_10$1={key:0,class:"spinner-border spinner-border-sm ml-2",role:"status"},_hoisted_11$1=createBaseVNode("span",{class:"sr-only"},"Loading...",-1),_hoisted_12$1=[_hoisted_11$1];function _sfc_render$1(e,t,i,n,a,o){return openBlock(),createElementBlock("div",null,[createBaseVNode("form",{method:"POST",onSubmit:t[1]||(t[1]=withModifiers((...s)=>o.submitSolution&&o.submitSolution(...s),["prevent"]))},[createBaseVNode("div",_hoisted_1$1,[_hoisted_2$1,createBaseVNode("textarea",{type:"text",class:"form-control",name:"content",rows:"10",value:this.content,"media-type":"solution","media-id-title":"solution_id","media-id":this.solution_id,ref:"content"},null,8,_hoisted_3$1)]),createBaseVNode("div",_hoisted_4$1,[_hoisted_5$1,withDirectives(createBaseVNode("select",{class:"form-control custom-select",name:"state","onUpdate:modelValue":t[0]||(t[0]=s=>e.state=s)},_hoisted_8$1,512),[[vModelSelect,e.state]])]),createBaseVNode("button",_hoisted_9$1,toDisplayString(e.solution_id?"Update":"Create")+" Solution ",1),e.loading?(openBlock(),createElementBlock("div",_hoisted_10$1,_hoisted_12$1)):createCommentVNode("",!0)],32)])}const SolutionEditor=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]),_sfc_main={name:"RatingsViewer",props:{challengeId:{type:[String,Number],required:!0}},data(){return{loading:!1,error:null,ratings:[],meta:{summary:{average:null,count:0},pagination:{page:1,pages:1,prev:null,next:null,per_page:50,total:0}},urlRoot:CTFd$1.config.urlRoot}},created(){document.getElementById("ratings-viewer-load").addEventListener("click",this.onModalShow)},methods:{onModalShow(){this.loadRatings()},async loadRatings(e=1){this.loading=!0,this.error=null;try{const i=await(await CTFd$1.fetch(`/api/v1/challenges/${this.challengeId}/ratings?page=${e}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}})).json();i.success?(this.ratings=i.data,this.meta=i.meta):(this.error="Failed to load ratings",console.error("API Error:",i))}catch(t){console.error("Error loading ratings:",t),this.error="Error loading ratings"}finally{this.loading=!1}},loadPage(e){this.loadRatings(e)},toLocalTime(e){return dayjs(e).format("MMMM Do, h:mm:ss A")}}},_hoisted_1={class:"row mb-3"},_hoisted_2={class:"col-md-12"},_hoisted_3={key:0,class:"text-center"},_hoisted_4=createBaseVNode("i",{class:"fas fa-circle-notch fa-spin spinner"},null,-1),_hoisted_5={key:1,class:"alert alert-danger"},_hoisted_6={key:2,class:"text-center text-muted py-4"},_hoisted_7=createBaseVNode("i",{class:"fa fa-star fa-2x mb-3"},null,-1),_hoisted_8=createBaseVNode("p",null,"No ratings yet",-1),_hoisted_9=[_hoisted_7,_hoisted_8],_hoisted_10={key:3},_hoisted_11={key:0,class:"mb-3"},_hoisted_12={class:"row"},_hoisted_13={class:"col-md-4 text-center"},_hoisted_14={class:"text-success"},_hoisted_15=createBaseVNode("i",{class:"fa-solid fa-thumbs-up"},null,-1),_hoisted_16={class:"col-md-4 text-center"},_hoisted_17={class:"text-danger"},_hoisted_18=createBaseVNode("i",{class:"fa-solid fa-thumbs-down"},null,-1),_hoisted_19={class:"col-md-4 text-center"},_hoisted_20={class:"ratings-list"},_hoisted_21={class:"row border rounded p-3"},_hoisted_22={class:"col-md-8 p-0"},_hoisted_23={class:"mb-1"},_hoisted_24=["href"],_hoisted_25={class:"ml-2"},_hoisted_26={key:0,class:"text-success"},_hoisted_27=createBaseVNode("i",{class:"fa-solid fa-thumbs-up"},null,-1),_hoisted_28=[_hoisted_27],_hoisted_29={key:1,class:"text-danger"},_hoisted_30=createBaseVNode("i",{class:"fa-solid fa-thumbs-down"},null,-1),_hoisted_31=[_hoisted_30],_hoisted_32={key:0},_hoisted_33={class:"col-md-4 text-right p-0"},_hoisted_34={class:"text-muted"},_hoisted_35={key:1,class:"d-flex justify-content-between align-items-center mt-3"},_hoisted_36=["disabled"],_hoisted_37=createBaseVNode("i",{class:"fa fa-arrow-left"},null,-1),_hoisted_38={key:1},_hoisted_39={class:"text-muted"},_hoisted_40=["disabled"],_hoisted_41=createBaseVNode("i",{class:"fa fa-arrow-right"},null,-1),_hoisted_42={key:3};function _sfc_render(e,t,i,n,a,o){return openBlock(),createElementBlock("div",null,[createBaseVNode("div",_hoisted_1,[createBaseVNode("div",_hoisted_2,[a.loading?(openBlock(),createElementBlock("div",_hoisted_3,[_hoisted_4,createTextVNode(" Loading ratings... ")])):a.error?(openBlock(),createElementBlock("div",_hoisted_5,toDisplayString(a.error),1)):!a.ratings.length&&!a.loading?(openBlock(),createElementBlock("div",_hoisted_6,_hoisted_9)):(openBlock(),createElementBlock("div",_hoisted_10,[a.meta.summary.count>0?(openBlock(),createElementBlock("div",_hoisted_11,[createBaseVNode("div",_hoisted_12,[createBaseVNode("div",_hoisted_13,[createBaseVNode("h4",null,[createBaseVNode("strong",_hoisted_14,[_hoisted_15,createTextVNode(" "+toDisplayString(a.meta.summary.up),1)])])]),createBaseVNode("div",_hoisted_16,[createBaseVNode("h4",null,[createBaseVNode("strong",_hoisted_17,[_hoisted_18,createTextVNode(" "+toDisplayString(a.meta.summary.down),1)])])]),createBaseVNode("div",_hoisted_19,[createBaseVNode("h4",null,[createBaseVNode("strong",null," Total: "+toDisplayString(a.meta.summary.count),1)])])])])):createCommentVNode("",!0),createBaseVNode("div",_hoisted_20,[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.ratings,s=>(openBlock(),createElementBlock("div",{key:s.id,class:"mb-2"},[createBaseVNode("div",_hoisted_21,[createBaseVNode("div",_hoisted_22,[createBaseVNode("h6",_hoisted_23,[createBaseVNode("a",{href:`${a.urlRoot}/admin/users/${s.user.id}`},toDisplayString(s.user.name),9,_hoisted_24),createBaseVNode("span",_hoisted_25,[s.value===1?(openBlock(),createElementBlock("span",_hoisted_26,_hoisted_28)):s.value===-1?(openBlock(),createElementBlock("span",_hoisted_29,_hoisted_31)):createCommentVNode("",!0)])]),s.review?(openBlock(),createElementBlock("p",_hoisted_32,toDisplayString(s.review),1)):createCommentVNode("",!0)]),createBaseVNode("div",_hoisted_33,[createBaseVNode("small",_hoisted_34,toDisplayString(o.toLocalTime(s.date)),1)])])]))),128))]),a.meta.pagination.pages>1?(openBlock(),createElementBlock("div",_hoisted_35,[a.meta.pagination.prev?(openBlock(),createElementBlock("button",{key:0,onClick:t[0]||(t[0]=s=>o.loadPage(a.meta.pagination.prev)),class:"btn btn-secondary",disabled:a.loading},[_hoisted_37,createTextVNode(" Previous ")],8,_hoisted_36)):(openBlock(),createElementBlock("div",_hoisted_38)),createBaseVNode("span",_hoisted_39," Page "+toDisplayString(a.meta.pagination.page)+" of "+toDisplayString(a.meta.pagination.pages),1),a.meta.pagination.next?(openBlock(),createElementBlock("button",{key:2,onClick:t[1]||(t[1]=s=>o.loadPage(a.meta.pagination.next)),class:"btn btn-secondary",disabled:a.loading},[createTextVNode(" Next "),_hoisted_41],8,_hoisted_40)):(openBlock(),createElementBlock("div",_hoisted_42))])):createCommentVNode("",!0)]))])])])}const RatingsViewer=_export_sfc(_sfc_main,[["render",_sfc_render]]);function loadChalTemplate(e){CTFd$1._internal.challenge={},$$1.getScript(CTFd$1.config.urlRoot+e.scripts.view,function(){let t=e.create;$$1("#create-chal-entry-div").html(t),bindMarkdownEditors(),$$1.getScript(CTFd$1.config.urlRoot+e.scripts.create,function(){$$1("#create-chal-entry-div form").submit(function(i){i.preventDefault();const n=$$1("#create-chal-entry-div form").serializeJSON();CTFd$1.fetch("/api/v1/challenges",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then(function(a){return a.json()}).then(function(a){if(a.success)$$1("#challenge-create-options #challenge_id").val(a.data.id),$$1("#challenge-create-options").modal();else{let o="";for(const s in a.errors)o+=a.errors[s].join(` -`),o+=` -`;ezAlert({title:"Error",body:o,button:"OK"})}})})})})}function handleChallengeOptions(e){e.preventDefault();var t=$$1(e.target).serializeJSON(!0);let i={challenge_id:t.challenge_id,content:t.flag||"",type:t.flag_type,data:t.flag_data?t.flag_data:""},n=function(){CTFd$1.fetch("/api/v1/challenges/"+t.challenge_id,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({state:t.state})}).then(function(a){return a.json()}).then(function(a){a.success&&setTimeout(function(){window.location=CTFd$1.config.urlRoot+"/admin/challenges/"+t.challenge_id},700)})};Promise.all([new Promise(function(a,o){if(i.content.length==0){a();return}CTFd$1.fetch("/api/v1/flags",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).then(function(s){a(s.json())})}),new Promise(function(a,o){let s=e.target,l={challenge:t.challenge_id,type:"challenge"};$$1(s.elements.file).val()&&helpers.files.upload(s,l),a()})]).then(a=>{n()})}$$1(()=>{if($$1(".preview-challenge").click(function(e){let t=`${CTFd$1.config.urlRoot}/admin/challenges/preview/${window.CHALLENGE_ID}`;$$1("#challenge-window").html(``),$$1("#challenge-modal").modal()}),$$1(".comments-challenge").click(function(e){$$1("#challenge-comments-window").modal()}),$$1(".ratings-challenge").click(function(e){$$1("#challenge-ratings-window").modal()}),$$1(".delete-challenge").click(function(e){ezQuery({title:"Delete Challenge",body:`Are you sure you want to delete ${htmlEntities(window.CHALLENGE_NAME)}`,success:function(){CTFd$1.fetch("/api/v1/challenges/"+window.CHALLENGE_ID,{method:"DELETE"}).then(function(t){return t.json()}).then(function(t){t.success&&(window.location=CTFd$1.config.urlRoot+"/admin/challenges")})}})}),$$1("#challenge-update-container > form").submit(function(e){e.preventDefault();var t=$$1(e.target).serializeJSON(!0);CTFd$1.fetch("/api/v1/challenges/"+window.CHALLENGE_ID+"/flags",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(i){return i.json()}).then(function(i){let n=function(){CTFd$1.fetch("/api/v1/challenges/"+window.CHALLENGE_ID,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then(function(a){return a.json()}).then(function(a){if(a.success){switch($$1(".challenge-state").text(a.data.state),a.data.state){case"visible":$$1(".challenge-state").removeClass("badge-danger").addClass("badge-success");break;case"hidden":$$1(".challenge-state").removeClass("badge-success").addClass("badge-danger");break}ezToast({title:"Success",body:"Your challenge has been updated!"})}else{let o="";for(const s in a.errors)o+=a.errors[s].join(` -`),o+=` -`;ezAlert({title:"Error",body:o,button:"OK"})}})};i.data.length===0&&t.state==="visible"?ezQuery({title:"Missing Flags",body:"This challenge does not have any flags meaning it may be unsolveable. Are you sure you'd like to update this challenge?",success:n}):n()})}),$$1("#challenge-create-options form").submit(handleChallengeOptions),$$1(".chal-function").change(function(){const e=$$1(this).val(),t=$$1(".chal-initial").closest(".form-group"),i=$$1(".chal-decay").closest(".form-group"),n=$$1(".chal-minimum").closest(".form-group"),a=$$1(".chal-initial"),o=$$1(".chal-decay"),s=$$1(".chal-minimum"),l=$$1(".chal-value");e==="static"?(a.val()&&a.data("saved-value",a.val()),o.val()&&o.data("saved-value",o.val()),s.val()&&s.data("saved-value",s.val()),a.val(""),o.val(""),s.val(""),t.hide(),i.hide(),n.hide(),a.removeAttr("name").data("original-name","initial"),o.removeAttr("name").data("original-name","decay"),s.removeAttr("name").data("original-name","minimum"),a.removeAttr("required"),o.removeAttr("required"),s.removeAttr("required"),l.prop("disabled",!1).prop("required",!0)):(e==="linear"||e==="logarithmic")&&(t.show(),i.show(),n.show(),a.attr("name",a.data("original-name")||"initial"),o.attr("name",o.data("original-name")||"decay"),s.attr("name",s.data("original-name")||"minimum"),a.data("saved-value")&&a.val(a.data("saved-value")),o.data("saved-value")&&o.val(o.data("saved-value")),s.data("saved-value")&&s.val(s.data("saved-value")),a.prop("required",!0),o.prop("required",!0),s.prop("required",!0),l.prop("disabled",!0).prop("required",!1))}).trigger("change"),document.querySelector("#challenge-flags")){const e=Vue$1.extend(FlagList);let t=document.createElement("div");document.querySelector("#challenge-flags").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#challenge-topics")){const e=Vue$1.extend(TopicsList);let t=document.createElement("div");document.querySelector("#challenge-topics").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#challenge-tags")){const e=Vue$1.extend(TagsList);let t=document.createElement("div");document.querySelector("#challenge-tags").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#prerequisite-add-form")){const e=Vue$1.extend(Requirements);let t=document.createElement("div");document.querySelector("#prerequisite-add-form").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#challenge-files")){const e=Vue$1.extend(ChallengeFilesList);let t=document.createElement("div");document.querySelector("#challenge-files").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#challenge-hints")){const e=Vue$1.extend(HintsList);let t=document.createElement("div");document.querySelector("#challenge-hints").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#next-add-form")){const e=Vue$1.extend(NextChallenge);let t=document.createElement("div");document.querySelector("#next-add-form").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#challenge-solution")){const e=Vue$1.extend(SolutionEditor);let t=document.createElement("div");document.querySelector("#challenge-solution").appendChild(t),new e({propsData:{challenge_id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#comment-box")){const e=Vue$1.extend(CommentBox);let t=document.createElement("div");document.querySelector("#comment-box").appendChild(t),new e({propsData:{type:"challenge",id:window.CHALLENGE_ID}}).$mount(t)}if(document.querySelector("#ratings-box")){const e=Vue$1.extend(RatingsViewer);let t=document.createElement("div");document.querySelector("#ratings-box").appendChild(t),new e({propsData:{challengeId:window.CHALLENGE_ID}}).$mount(t)}$$1.get(CTFd$1.config.urlRoot+"/api/v1/challenges/types",function(e){const t=e.data;loadChalTemplate(t.standard),$$1("#create-chals-select input[name=type]").change(function(){let i=t[this.value];loadChalTemplate(i)})})}); diff --git a/platform/CTFd/themes/admin/static/assets/pages/configs-zcDLjIaq.js b/platform/CTFd/themes/admin/static/assets/pages/configs-zcDLjIaq.js deleted file mode 100644 index fced1ad6f6..0000000000 --- a/platform/CTFd/themes/admin/static/assets/pages/configs-zcDLjIaq.js +++ /dev/null @@ -1,12 +0,0 @@ -import{E as Y,G as J,_ as G,C as g,D as H,o as $,c as P,a as t,h as C,v as q,l as j,i as I,j as U,e as W,F as Z,r as Q,f as X,y as x,H as ne,$ as i,V as K,B as R,s as ee,u as ae,I as D}from"./main-CcyKUC_q.js";import"../tab-BrZ-GZoF.js";import{C as O}from"../htmlmixed-vBdNL_dI.js";var te={exports:{}};(function(e,a){(function(s,r){e.exports=r()})(Y,function(){var s="minute",r=/[+-]\d\d(?::?\d\d)?/g,l=/([+-]|\d\d)/g;return function(c,n,d){var u=n.prototype;d.utc=function(o){var h={date:o,utc:!0,args:arguments};return new n(h)},u.utc=function(o){var h=d(this.toDate(),{locale:this.$L,utc:!0});return o?h.add(this.utcOffset(),s):h},u.local=function(){return d(this.toDate(),{locale:this.$L,utc:!1})};var T=u.parse;u.parse=function(o){o.utc&&(this.$u=!0),this.$utils().u(o.$offset)||(this.$offset=o.$offset),T.call(this,o)};var M=u.init;u.init=function(){if(this.$u){var o=this.$d;this.$y=o.getUTCFullYear(),this.$M=o.getUTCMonth(),this.$D=o.getUTCDate(),this.$W=o.getUTCDay(),this.$H=o.getUTCHours(),this.$m=o.getUTCMinutes(),this.$s=o.getUTCSeconds(),this.$ms=o.getUTCMilliseconds()}else M.call(this)};var y=u.utcOffset;u.utcOffset=function(o,h){var b=this.$utils().u;if(b(o))return this.$u?0:b(this.$offset)?y.call(this):this.$offset;if(typeof o=="string"&&(o=function(_){_===void 0&&(_="");var B=_.match(r);if(!B)return null;var E=(""+B[0]).match(l)||["-",0,0],w=E[0],S=60*+E[1]+ +E[2];return S===0?0:w==="+"?S:-S}(o),o===null))return this;var p=Math.abs(o)<=16?60*o:o,v=this;if(h)return v.$offset=p,v.$u=o===0,v;if(o!==0){var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(v=this.local().add(p+k,s)).$offset=p,v.$x.$localOffset=k}else v=this.utc();return v};var m=u.format;u.format=function(o){var h=o||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return m.call(this,h)},u.valueOf=function(){var o=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*o},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var f=u.toDate;u.toDate=function(o){return o==="s"&&this.$offset?d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var A=u.diff;u.diff=function(o,h,b){if(o&&this.$u===o.$u)return A.call(this,o,h,b);var p=this.local(),v=d(o).local();return A.call(p,v,h,b)}}})})(te);var re=te.exports;const se=J(re);var ie={exports:{}};(function(e,a){(function(s,r){e.exports=r()})(Y,function(){var s={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(l,c,n){var d,u=function(m,f,A){A===void 0&&(A={});var o=new Date(m),h=function(b,p){p===void 0&&(p={});var v=p.timeZoneName||"short",k=b+"|"+v,_=r[k];return _||(_=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:v}),r[k]=_),_}(f,A);return h.formatToParts(o)},T=function(m,f){for(var A=u(m,f),o=[],h=0;h=0&&(o[k]=parseInt(v,10))}var _=o[3],B=_===24?0:_,E=o[0]+"-"+o[1]+"-"+o[2]+" "+B+":"+o[4]+":"+o[5]+":000",w=+m;return(n.utc(E).valueOf()-(w-=w%1e3))/6e4},M=c.prototype;M.tz=function(m,f){m===void 0&&(m=d);var A=this.utcOffset(),o=this.toDate(),h=o.toLocaleString("en-US",{timeZone:m}),b=Math.round((o-new Date(h))/1e3/60),p=n(h,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(o.getTimezoneOffset()/15)-b,!0);if(f){var v=p.utcOffset();p=p.add(A-v,"minute")}return p.$x.$timezone=m,p},M.offsetName=function(m){var f=this.$x.$timezone||n.tz.guess(),A=u(this.valueOf(),f,{timeZoneName:m}).find(function(o){return o.type.toLowerCase()==="timezonename"});return A&&A.value};var y=M.startOf;M.startOf=function(m,f){if(!this.$x||!this.$x.$timezone)return y.call(this,m,f);var A=n(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return y.call(A,m,f).tz(this.$x.$timezone,!0)},n.tz=function(m,f,A){var o=A&&f,h=A||f||d,b=T(+n(),h);if(typeof m!="string")return n(m).tz(h);var p=function(B,E,w){var S=B-60*E*1e3,z=T(S,w);if(E===z)return[S,E];var F=T(S-=60*(z-E)*1e3,w);return z===F?[S,z]:[B-60*Math.min(z,F)*1e3,Math.max(z,F)]}(n.utc(m,o).valueOf(),b,h),v=p[0],k=p[1],_=n(v).utcOffset(k);return _.$x.$timezone=h,_},n.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},n.tz.setDefault=function(m){d=m}}})})(ie);var ce=ie.exports;const le=J(ce),ue=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Pacific-New","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],de={props:{index:Number,initialField:Object},data:function(){return{field:this.initialField}},methods:{persistedField:function(){return this.field.id>=1},saveField:function(){let e=this.field;this.persistedField()?g.fetch(`/api/v1/configs/fields/${this.field.id}`,{method:"PATCH",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(a=>a.json()).then(a=>{a.success===!0&&(this.field=a.data,H({title:"Success",body:"Field has been updated!",delay:1e3}))}):g.fetch("/api/v1/configs/fields",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(a=>a.json()).then(a=>{a.success===!0&&(this.field=a.data,H({title:"Success",body:"Field has been created!",delay:1e3}))})},deleteField:function(){confirm("Are you sure you'd like to delete this field?")&&(this.persistedField()?g.fetch(`/api/v1/configs/fields/${this.field.id}`,{method:"DELETE",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success===!0&&this.$emit("remove-field",this.index)}):this.$emit("remove-field",this.index))}}},me={class:"border-bottom"},fe=t("span",{"aria-hidden":"true"},"×",-1),Ae=[fe],he={class:"row"},pe={class:"col-md-3"},ge={class:"form-group"},ve=t("label",null,"Field Type",-1),be=t("option",{value:"text"},"Text Field",-1),_e=t("option",{value:"boolean"},"Checkbox",-1),ye=[be,_e],ke=t("small",{class:"form-text text-muted"},"Type of field shown to the user",-1),Ee={class:"col-md-9"},Te={class:"form-group"},Me=t("label",null,"Field Name",-1),Ce=t("small",{class:"form-text text-muted"},"Field name",-1),Se={class:"col-md-12"},$e={class:"form-group"},Pe=t("label",null,"Field Description",-1),Be=t("small",{id:"emailHelp",class:"form-text text-muted"},"Field Description",-1),we={class:"col-md-12"},De={class:"form-check"},ze={class:"form-check-label"},xe={class:"form-check"},Ne={class:"form-check-label"},je={class:"form-check"},Ge={class:"form-check-label"},Fe={class:"row pb-3"},Ie={class:"col-md-12"},Ue={class:"d-block"};function Oe(e,a,s,r,l,c){return $(),P("div",me,[t("div",null,[t("button",{type:"button",class:"close float-right","aria-label":"Close",onClick:a[0]||(a[0]=n=>c.deleteField())},Ae)]),t("div",he,[t("div",pe,[t("div",ge,[ve,C(t("select",{class:"form-control custom-select","onUpdate:modelValue":a[1]||(a[1]=n=>e.field.field_type=n)},ye,512),[[q,e.field.field_type,void 0,{lazy:!0}]]),ke])]),t("div",Ee,[t("div",Te,[Me,C(t("input",{type:"text",class:"form-control","onUpdate:modelValue":a[2]||(a[2]=n=>e.field.name=n)},null,512),[[j,e.field.name,void 0,{lazy:!0}]]),Ce])]),t("div",Se,[t("div",$e,[Pe,C(t("input",{type:"text",class:"form-control","onUpdate:modelValue":a[3]||(a[3]=n=>e.field.description=n)},null,512),[[j,e.field.description,void 0,{lazy:!0}]]),Be])]),t("div",we,[t("div",De,[t("label",ze,[C(t("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":a[4]||(a[4]=n=>e.field.editable=n)},null,512),[[I,e.field.editable,void 0,{lazy:!0}]]),U(" Editable by user in profile ")])]),t("div",xe,[t("label",Ne,[C(t("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":a[5]||(a[5]=n=>e.field.required=n)},null,512),[[I,e.field.required,void 0,{lazy:!0}]]),U(" Required on registration ")])]),t("div",je,[t("label",Ge,[C(t("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":a[6]||(a[6]=n=>e.field.public=n)},null,512),[[I,e.field.public,void 0,{lazy:!0}]]),U(" Shown on public profile ")])])])]),t("div",Fe,[t("div",Ie,[t("div",Ue,[t("button",{class:"btn btn-sm btn-success btn-outlined float-right",type:"button",onClick:a[7]||(a[7]=n=>c.saveField())}," Save ")])])])])}const Le=G(de,[["render",Oe]]),Ve={name:"FieldList",components:{Field:Le},props:{type:String},data:function(){return{fields:[]}},methods:{loadFields:function(){g.fetch(`/api/v1/configs/fields?type=${this.type}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{this.fields=e.data})},addField:function(){this.fields.push({id:Math.random(),type:this.type,field_type:"text",name:"",description:"",editable:!1,required:!1,public:!1})},removeField:function(e){this.fields.splice(e,1),console.log(this.fields)}},created(){this.loadFields()}},He={class:"row"},Re={class:"col text-center"};function Ke(e,a,s,r,l,c){const n=W("Field");return $(),P("div",null,[($(!0),P(Z,null,Q(e.fields,(d,u)=>($(),P("div",{class:"mb-5",key:d.id},[X(n,{index:u,initialField:e.fields[u],onRemoveField:c.removeField},null,8,["index","initialField","onRemoveField"])]))),128)),t("div",He,[t("div",Re,[t("button",{class:"btn btn-sm btn-success btn-outlined m-auto",type:"button",onClick:a[0]||(a[0]=d=>c.addField())}," Add New Field ")])])])}const Ye=G(Ve,[["render",Ke]]),Je={props:{index:Number,initialBracket:Object},data:function(){return{bracket:this.initialBracket}},methods:{persisted:function(){return this.bracket.id>=1},saveBracket:function(){let e=this.bracket,a="",s="",r="";this.persisted()?(a=`/api/v1/brackets/${this.bracket.id}`,s="PATCH",r="Bracket has been updated!"):(a="/api/v1/brackets",s="POST",r="Bracket has been created!"),g.fetch(a,{method:s,credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then(l=>l.json()).then(l=>{l.success===!0&&(this.bracket=l.data,H({title:"Success",body:r,delay:1e3}))})},deleteBracket:function(){confirm("Are you sure you'd like to delete this bracket?")&&(this.persisted()?g.fetch(`/api/v1/brackets/${this.bracket.id}`,{method:"DELETE",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{e.success===!0&&this.$emit("remove-bracket",this.index)}):this.$emit("remove-bracket",this.index))}}},qe={class:"border-bottom"},We=t("span",{"aria-hidden":"true"},"×",-1),Ze=[We],Qe={class:"row"},Xe={class:"col-md-9"},ea={class:"form-group"},aa=t("label",null,"Bracket Name",-1),ta=t("small",{class:"form-text text-muted"},' Bracket name (e.g. "Students", "Interns", "Engineers") ',-1),ia={class:"col-md-12"},oa={class:"form-group"},na=t("label",null,"Bracket Description",-1),ra=t("small",{class:"form-text text-muted"},"Bracket Description",-1),sa={class:"col-md-12"},ca=t("label",null,"Bracket Type",-1),la=t("option",null,null,-1),ua=t("option",{value:"users"},"Users",-1),da=t("option",{value:"teams"},"Teams",-1),ma=[la,ua,da],fa=t("small",{class:"form-text text-muted"}," If you are using Team Mode and would like the bracket to apply to entire teams instead of individuals, select Teams. ",-1),Aa={class:"row pb-3"},ha={class:"col-md-12"},pa={class:"d-block"};function ga(e,a,s,r,l,c){return $(),P("div",qe,[t("div",null,[t("button",{type:"button",class:"close float-right","aria-label":"Close",onClick:a[0]||(a[0]=n=>c.deleteBracket())},Ze)]),t("div",Qe,[t("div",Xe,[t("div",ea,[aa,C(t("input",{type:"text",class:"form-control","onUpdate:modelValue":a[1]||(a[1]=n=>e.bracket.name=n)},null,512),[[j,e.bracket.name,void 0,{lazy:!0}]]),ta])]),t("div",ia,[t("div",oa,[na,C(t("input",{type:"text",class:"form-control","onUpdate:modelValue":a[2]||(a[2]=n=>e.bracket.description=n)},null,512),[[j,e.bracket.description,void 0,{lazy:!0}]]),ra])]),t("div",sa,[ca,C(t("select",{class:"custom-select","onUpdate:modelValue":a[3]||(a[3]=n=>e.bracket.type=n)},ma,512),[[q,e.bracket.type,void 0,{lazy:!0}]]),fa])]),t("div",Aa,[t("div",ha,[t("div",pa,[t("button",{class:"btn btn-sm btn-success btn-outlined float-right",type:"button",onClick:a[4]||(a[4]=n=>c.saveBracket())}," Save ")])])])])}const va=G(Je,[["render",ga]]),ba={name:"BracketList",components:{Bracket:va},data:function(){return{brackets:[]}},methods:{loadBrackets:function(){g.fetch("/api/v1/brackets",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{this.brackets=e.data})},addBracket:function(){this.brackets.push({id:Math.random(),name:"",description:"",type:null})},removeBracket:function(e){this.brackets.splice(e,1)}},created(){this.loadBrackets()}},_a={class:"row"},ya={class:"col text-center"};function ka(e,a,s,r,l,c){const n=W("Bracket");return $(),P("div",null,[($(!0),P(Z,null,Q(e.brackets,(d,u)=>($(),P("div",{class:"mb-5",key:d.id},[X(n,{index:u,initialBracket:e.brackets[u],onRemoveBracket:c.removeBracket},null,8,["index","initialBracket","onRemoveBracket"])]))),128)),t("div",_a,[t("div",ya,[t("button",{class:"btn btn-sm btn-success btn-outlined m-auto",type:"button",onClick:a[0]||(a[0]=d=>c.addBracket())}," Add New Bracket ")])])])}const Ea=G(ba,[["render",ka]]);x.extend(ne);x.extend(se);x.extend(le);function L(e,a){typeof a=="string"&&(a=parseInt(a,10)*1e3);const s=x(a);i("#"+e+"-month").val(s.month()+1),i("#"+e+"-day").val(s.date()),i("#"+e+"-year").val(s.year()),i("#"+e+"-hour").val(s.hour()),i("#"+e+"-minute").val(s.minute()),N(e)}function N(e){const a=i("#"+e+"-month").val(),s=i("#"+e+"-day").val(),r=i("#"+e+"-year").val(),l=i("#"+e+"-hour").val(),c=i("#"+e+"-minute").val(),n=i("#"+e+"-timezone").val(),d=Ta(a,s,r,l,c);d.unix()&&a&&s&&r&&l&&c?(i("#"+e).val(d.unix()),i("#"+e+"-local").val(d.format("dddd, MMMM Do YYYY, h:mm:ss a z (zzz)")),i("#"+e+"-zonetime").val(d.tz(n).format("dddd, MMMM Do YYYY, h:mm:ss a z (zzz)"))):(i("#"+e).val(""),i("#"+e+"-local").val(""),i("#"+e+"-zonetime").val(""))}function Ta(e,a,s,r,l){let c=e.toString();c.length==1&&(c="0"+c);let n=a.toString();n.length==1&&(n="0"+n);let d=r.toString();d.length==1&&(d="0"+d);let u=l.toString();u.length==1&&(u="0"+u);const T=s.toString()+"-"+c+"-"+n+" "+d+":"+u+":00";return x(T)}function oe(e){e.preventDefault();const a=i(this).serializeJSON(),s={};a.mail_useauth===!1?(a.mail_username=null,a.mail_password=null):(a.mail_username===""&&delete a.mail_username,a.mail_password===""&&delete a.mail_password),Object.keys(a).forEach(function(r){a[r]==="true"?s[r]=!0:a[r]==="false"?s[r]=!1:s[r]=a[r]}),g.api.patch_config_list({},s).then(function(r){if(r.success)window.location.reload();else{let l=r.errors.value.join(` -`);R({title:"Error!",body:l,button:"Okay"})}})}function Ma(e){e.preventDefault();let a=e.target;ee.files.upload(a,{},function(s){const l={value:s.data[0].location};g.fetch("/api/v1/configs/ctf_logo",{method:"PATCH",body:JSON.stringify(l)}).then(function(c){return c.json()}).then(function(c){c.success?window.location.reload():R({title:"Error!",body:"Logo uploading failed!",button:"Okay"})})})}function Ca(e){e.preventDefault();let a=new FormData(e.target),s=`Are you sure you'd like to switch user modes? - -All submissions, awards, unlocks, and tracking will be deleted!`;a.get("user_mode")=="users"&&(s=`Are you sure you'd like to switch user modes? - -All teams, submissions, awards, unlocks, and tracking will be deleted!`),confirm(s)&&(a.append("submissions",!0),a.append("nonce",g.config.csrfNonce),fetch(g.config.urlRoot+"/admin/reset",{method:"POST",credentials:"same-origin",body:a}),oe.bind(this)(e))}function Sa(){ae({title:"Remove logo",body:"Are you sure you'd like to remove the CTF logo?",success:function(){const e={value:null};g.api.patch_config({configKey:"ctf_logo"},e).then(a=>{window.location.reload()})}})}function $a(e){e.preventDefault();let a=e.target;ee.files.upload(a,{},function(s){const l={value:s.data[0].location};g.fetch("/api/v1/configs/ctf_small_icon",{method:"PATCH",body:JSON.stringify(l)}).then(function(c){return c.json()}).then(function(c){c.success?window.location.reload():R({title:"Error!",body:"Icon uploading failed!",button:"Okay"})})})}function Pa(){ae({title:"Remove logo",body:"Are you sure you'd like to remove the small site icon?",success:function(){const e={value:null};g.api.patch_config({configKey:"ctf_small_icon"},e).then(a=>{window.location.reload()})}})}function Ba(e){e.preventDefault();let a=document.getElementById("import-csv-file").files[0],s=document.getElementById("import-csv-type").value,r=new FormData;r.append("csv_file",a),r.append("csv_type",s),r.append("nonce",g.config.csrfNonce);let l=D({width:0,title:"Upload Progress"});i.ajax({url:g.config.urlRoot+"/admin/import/csv",type:"POST",data:r,processData:!1,contentType:!1,statusCode:{500:function(c){let n=JSON.parse(c.responseText),d="";n.forEach(u=>{d+=`Line ${u[0]}: ${JSON.stringify(u[1])} -`}),alert(d),l=D({target:l,width:100}),setTimeout(function(){l.modal("hide")},500)}},xhr:function(){let c=i.ajaxSettings.xhr();return c.upload.onprogress=function(n){if(n.lengthComputable){let d=n.loaded/n.total*100;l=D({target:l,width:d})}},c},success:function(c){l=D({target:l,width:100}),setTimeout(function(){l.modal("hide")},500),setTimeout(function(){window.location.reload()},700)}})}function wa(e){e.preventDefault();let a=document.getElementById("import-file").files[0],s=new FormData;s.append("backup",a),s.append("nonce",g.config.csrfNonce);let r=D({width:0,title:"Upload Progress"});i.ajax({url:g.config.urlRoot+"/admin/import",type:"POST",data:s,processData:!1,contentType:!1,statusCode:{500:function(l){alert(l.responseText)}},xhr:function(){let l=i.ajaxSettings.xhr();return l.upload.onprogress=function(c){if(c.lengthComputable){let n=c.loaded/c.total*100;r=D({target:r,width:n})}},l},success:function(l){r=D({target:r,width:100}),location.href=g.config.urlRoot+"/admin/import"}})}function Da(e){e.preventDefault(),window.location.href=i(this).attr("href")}function V(e){let a=i("