You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
345 lines
623 KiB
345 lines
623 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[182,7,8],{"+NIl":function(At,at,x){(function($){$(x("VrN/"))})(function($){"use strict";$.defineMode("stex",function(Pe,oe){"use strict";function Ce(z,V){z.cmdState.push(V)}function ve(z){return z.cmdState.length>0?z.cmdState[z.cmdState.length-1]:null}function ge(z){var V=z.cmdState.pop();V&&V.closeBracket()}function j(z){for(var V=z.cmdState,J=V.length-1;J>=0;J--){var B=V[J];if(B.name=="DEFAULT")continue;return B}return{styleIdentifier:function(){return null}}}function ee(z,V,J){return function(){this.name=z,this.bracketNo=0,this.style=V,this.styles=J,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var W={};W.importmodule=ee("importmodule","tag",["string","builtin"]),W.documentclass=ee("documentclass","tag",["","atom"]),W.usepackage=ee("usepackage","tag",["atom"]),W.begin=ee("begin","tag",["atom"]),W.end=ee("end","tag",["atom"]),W.label=ee("label","tag",["atom"]),W.ref=ee("ref","tag",["atom"]),W.eqref=ee("eqref","tag",["atom"]),W.cite=ee("cite","tag",["atom"]),W.bibitem=ee("bibitem","tag",["atom"]),W.Bibitem=ee("Bibitem","tag",["atom"]),W.RBibitem=ee("RBibitem","tag",["atom"]),W.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function se(z,V){z.f=V}function L(z,V){var J;if(z.match(/^\\[a-zA-Z@]+/)){var B=z.current().slice(1);return J=W.hasOwnProperty(B)?W[B]:W.DEFAULT,J=new J,Ce(V,J),se(V,le),J.style}if(z.match(/^\\[$&%#{}_]/))return"tag";if(z.match(/^\\[,;!\/\\]/))return"tag";if(z.match("\\["))return se(V,function(ne,pe){return I(ne,pe,"\\]")}),"keyword";if(z.match("\\("))return se(V,function(ne,pe){return I(ne,pe,"\\)")}),"keyword";if(z.match("$$"))return se(V,function(ne,pe){return I(ne,pe,"$$")}),"keyword";if(z.match("$"))return se(V,function(ne,pe){return I(ne,pe,"$")}),"keyword";var ce=z.next();if(ce=="%")return z.skipToEnd(),"comment";if(ce=="}"||ce=="]"){if(J=ve(V),J)J.closeBracket(ce),se(V,le);else return"error";return"bracket"}else return ce=="{"||ce=="["?(J=W.DEFAULT,J=new J,Ce(V,J),"bracket"):/\d/.test(ce)?(z.eatWhile(/[\w.%]/),"atom"):(z.eatWhile(/[\w\-_]/),J=j(V),J.name=="begin"&&(J.argument=z.current()),J.styleIdentifier())}function I(z,V,J){if(z.eatSpace())return null;if(J&&z.match(J))return se(V,L),"keyword";if(z.match(/^\\[a-zA-Z@]+/))return"tag";if(z.match(/^[a-zA-Z]+/))return"variable-2";if(z.match(/^\\[$&%#{}_]/))return"tag";if(z.match(/^\\[,;!\/]/))return"tag";if(z.match(/^[\^_&]/))return"tag";if(z.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(z.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var B=z.next();return B=="{"||B=="}"||B=="["||B=="]"||B=="("||B==")"?"bracket":B=="%"?(z.skipToEnd(),"comment"):"error"}function le(z,V){var J=z.peek(),B;return J=="{"||J=="["?(B=ve(V),B.openBracket(J),z.eat(J),se(V,L),"bracket"):/[ \t\r]/.test(J)?(z.eat(J),null):(se(V,L),ge(V),L(z,V))}return{startState:function(){var z=oe.inMathMode?function(V,J){return I(V,J)}:L;return{cmdState:[],f:z}},copyState:function(z){return{cmdState:z.cmdState.slice(),f:z.f}},token:function(z,V){return V.f(z,V)},blankLine:function(z){z.f=L,z.cmdState.length=0},lineComment:"%"}}),$.defineMIME("text/x-stex","stex"),$.defineMIME("text/x-latex","stex")})},"+yhJ":function(At,at,x){At.exports=x.p+"static/xixi.d492fb65.svg"},"0eGx":function(At,at,x){At.exports=x.p+"static/zhong.c1924b73.svg"},"19Vz":function(At,at,x){(function($){$(x("VrN/"))})(function($){$.defineOption("placeholder","",function(ee,W,se){var L=se&&se!=$.Init;if(W&&!L)ee.on("blur",ve),ee.on("change",ge),ee.on("swapDoc",ge),$.on(ee.getInputField(),"compositionupdate",ee.state.placeholderCompose=function(){Ce(ee)}),ge(ee);else if(!W&&L){ee.off("blur",ve),ee.off("change",ge),ee.off("swapDoc",ge),$.off(ee.getInputField(),"compositionupdate",ee.state.placeholderCompose),Pe(ee);var I=ee.getWrapperElement();I.className=I.className.replace(" CodeMirror-empty","")}W&&!ee.hasFocus()&&ve(ee)});function Pe(ee){ee.state.placeholder&&(ee.state.placeholder.parentNode.removeChild(ee.state.placeholder),ee.state.placeholder=null)}function oe(ee){Pe(ee);var W=ee.state.placeholder=document.createElement("pre");W.style.cssText="height: 0; overflow: visible",W.style.direction=ee.getOption("direction"),W.className="CodeMirror-placeholder CodeMirror-line-like";var se=ee.getOption("placeholder");typeof se=="string"&&(se=document.createTextNode(se)),W.appendChild(se),ee.display.lineSpace.insertBefore(W,ee.display.lineSpace.firstChild)}function Ce(ee){setTimeout(function(){var W=!1,se=ee.getInputField();se.nodeName=="TEXTAREA"?W=!se.value:ee.lineCount()==1&&(W=!/[^\u200b]/.test(se.querySelector(".CodeMirror-line").textContent)),W?oe(ee):Pe(ee)},20)}function ve(ee){j(ee)&&oe(ee)}function ge(ee){var W=ee.getWrapperElement(),se=j(ee);W.className=W.className.replace(" CodeMirror-empty","")+(se?" CodeMirror-empty":""),se?oe(ee):Pe(ee)}function j(ee){return ee.lineCount()===1&&ee.getLine(0)===""}})},"1eCo":function(At,at,x){(function($){$(x("VrN/"))})(function($){"use strict";var Pe={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},oe={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};$.defineMode("xml",function(Ce,ve){var ge=Ce.indentUnit,j={},ee=ve.htmlMode?Pe:oe;for(var W in ee)j[W]=ee[W];for(var W in ve)j[W]=ve[W];var se,L;function I(b,U){function D(he){return U.tokenize=he,he(b,U)}var k=b.next();if(k=="<")return b.eat("!")?b.eat("[")?b.match("CDATA[")?D(V("atom","]]>")):null:b.match("--")?D(V("comment","-->")):b.match("DOCTYPE",!0,!0)?(b.eatWhile(/[\w\._\-]/),D(J(1))):null:b.eat("?")?(b.eatWhile(/[\w\._\-]/),U.tokenize=V("meta","?>"),"meta"):(se=b.eat("/")?"closeTag":"openTag",U.tokenize=le,"tag bracket");if(k=="&"){var G;return b.eat("#")?b.eat("x")?G=b.eatWhile(/[a-fA-F\d]/)&&b.eat(";"):G=b.eatWhile(/[\d]/)&&b.eat(";"):G=b.eatWhile(/[\w\.\-:]/)&&b.eat(";"),G?"atom":"error"}else return b.eatWhile(/[^&<]/),null}I.isInText=!0;function le(b,U){var D=b.next();if(D==">"||D=="/"&&b.eat(">"))return U.tokenize=I,se=D==">"?"endTag":"selfcloseTag","tag bracket";if(D=="=")return se="equals",null;if(D=="<"){U.tokenize=I,U.state=pe,U.tagName=U.tagStart=null;var k=U.tokenize(b,U);return k?k+" tag error":"tag error"}else return/[\'\"]/.test(D)?(U.tokenize=z(D),U.stringStartCol=b.column(),U.tokenize(b,U)):(b.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function z(b){var U=function(D,k){for(;!D.eol();)if(D.next()==b){k.tokenize=le;break}return"string"};return U.isInAttribute=!0,U}function V(b,U){return function(D,k){for(;!D.eol();){if(D.match(U)){k.tokenize=I;break}D.next()}return b}}function J(b){return function(U,D){for(var k;(k=U.next())!=null;){if(k=="<")return D.tokenize=J(b+1),D.tokenize(U,D);if(k==">")if(b==1){D.tokenize=I;break}else return D.tokenize=J(b-1),D.tokenize(U,D)}return"meta"}}function B(b,U,D){this.prev=b.context,this.tagName=U,this.indent=b.indented,this.startOfLine=D,(j.doNotIndent.hasOwnProperty(U)||b.context&&b.context.noIndent)&&(this.noIndent=!0)}function ce(b){b.context&&(b.context=b.context.prev)}function ne(b,U){for(var D;;){if(!b.context)return;if(D=b.context.tagName,!j.contextGrabbers.hasOwnProperty(D)||!j.contextGrabbers[D].hasOwnProperty(U))return;ce(b)}}function pe(b,U,D){return b=="openTag"?(D.tagStart=U.column(),Ne):b=="closeTag"?ue:pe}function Ne(b,U,D){return b=="word"?(D.tagName=U.current(),L="tag",ie):j.allowMissingTagName&&b=="endTag"?(L="tag bracket",ie(b,U,D)):(L="error",Ne)}function ue(b,U,D){if(b=="word"){var k=U.current();return D.context&&D.context.tagName!=k&&j.implicitlyClosed.hasOwnProperty(D.context.tagName)&&ce(D),D.context&&D.context.tagName==k||j.matchClosing===!1?(L="tag",K):(L="tag error",v)}else return j.allowMissingTagName&&b=="endTag"?(L="tag bracket",K(b,U,D)):(L="error",v)}function K(b,U,D){return b!="endTag"?(L="error",K):(ce(D),pe)}function v(b,U,D){return L="error",K(b,U,D)}function ie(b,U,D){if(b=="word")return L="attribute",X;if(b=="endTag"||b=="selfcloseTag"){var k=D.tagName,G=D.tagStart;return D.tagName=D.tagStart=null,b=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(k)?ne(D,k):(ne(D,k),D.context=new B(D,k,G==D.indented)),pe}return L="error",ie}function X(b,U,D){return b=="equals"?de:(j.allowMissing||(L="error"),ie(b,U,D))}function de(b,U,D){return b=="string"?A:b=="word"&&j.allowUnquoted?(L="string",ie):(L="error",ie(b,U,D))}function A(b,U,D){return b=="string"?A:ie(b,U,D)}return{startState:function(b){var U={tokenize:I,state:pe,indented:b||0,tagName:null,tagStart:null,context:null};return b!=null&&(U.baseIndent=b),U},token:function(b,U){if(!U.tagName&&b.sol()&&(U.indented=b.indentation()),b.eatSpace())return null;se=null;var D=U.tokenize(b,U);return(D||se)&&D!="comment"&&(L=null,U.state=U.state(se||D,b,U),L&&(D=L=="error"?D+" error":L)),D},indent:function(b,U,D){var k=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+ge;if(k&&k.noIndent)return $.Pass;if(b.tokenize!=le&&b.tokenize!=I)return D?D.match(/^(\s*)/)[0].length:0;if(b.tagName)return j.multilineTagIndentPastTag!==!1?b.tagStart+b.tagName.length+2:b.tagStart+ge*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(U))return 0;var G=U&&/^<(\/)?([\w_:\.-]*)/.exec(U);if(G&&G[1])for(;k;)if(k.tagName==G[2]){k=k.prev;break}else if(j.implicitlyClosed.hasOwnProperty(k.tagName))k=k.prev;else break;else if(G)for(;k;){var he=j.contextGrabbers[k.tagName];if(he&&he.hasOwnProperty(G[2]))k=k.prev;else break}for(;k&&k.prev&&!k.startOfLine;)k=k.prev;return k?k.indent+ge:b.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(b){b.state==de&&(b.state=ie)},xmlCurrentTag:function(b){return b.tagName?{name:b.tagName,close:b.type=="closeTag"}:null},xmlCurrentContext:function(b){for(var U=[],D=b.context;D;D=D.prev)D.tagName&&U.push(D.tagName);return U.reverse()}}}),$.defineMIME("text/xml","xml"),$.defineMIME("application/xml","xml"),$.mimeModes.hasOwnProperty("text/html")||$.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(At,at,x){"use strict";x.d(at,"a",function(){return K});var $=x("wx14"),Pe=x("rePB"),oe=x("VTBJ"),Ce=x("1OyB"),ve=x("vuIU"),ge=x("Ji7U"),j=x("LK+K"),ee=x("q1tI"),W=x.n(ee),se=x("TSYQ"),L=x.n(se),I=function(ie){var X,de="".concat(ie.rootPrefixCls,"-item"),A=L()(de,"".concat(de,"-").concat(ie.page),(X={},Object(Pe.a)(X,"".concat(de,"-active"),ie.active),Object(Pe.a)(X,ie.className,!!ie.className),Object(Pe.a)(X,"".concat(de,"-disabled"),!ie.page),X)),b=function(){ie.onClick(ie.page)},U=function(k){ie.onKeyPress(k,ie.onClick,ie.page)};return W.a.createElement("li",{title:ie.showTitle?ie.page:null,className:A,onClick:b,onKeyPress:U,tabIndex:"0"},ie.itemRender(ie.page,"page",W.a.createElement("a",{rel:"nofollow"},ie.page)))},le=I,z={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},V=function(v){Object(ge.a)(X,v);var ie=Object(j.a)(X);function X(){var de;Object(Ce.a)(this,X);for(var A=arguments.length,b=new Array(A),U=0;U<A;U++)b[U]=arguments[U];return de=ie.call.apply(ie,[this].concat(b)),de.state={goInputText:""},de.buildOptionText=function(D){return"".concat(D," ").concat(de.props.locale.items_per_page)},de.changeSize=function(D){de.props.changeSize(Number(D))},de.handleChange=function(D){de.setState({goInputText:D.target.value})},de.handleBlur=function(D){var k=de.props,G=k.goButton,he=k.quickGo,Y=k.rootPrefixCls,be=de.state.goInputText;if(G||be==="")return;if(D.relatedTarget&&(D.relatedTarget.className.indexOf("".concat(Y,"-prev"))>=0||D.relatedTarget.className.indexOf("".concat(Y,"-next"))>=0))return;de.setState({goInputText:""}),he(de.getValidValue())},de.go=function(D){var k=de.state.goInputText;if(k==="")return;(D.keyCode===z.ENTER||D.type==="click")&&(de.setState({goInputText:""}),de.props.quickGo(de.getValidValue()))},de}return Object(ve.a)(X,[{key:"getValidValue",value:function(){var A=this.state,b=A.goInputText,U=A.current;return!b||isNaN(b)?U:Number(b)}},{key:"getPageSizeOptions",value:function(){var A=this.props,b=A.pageSize,U=A.pageSizeOptions;return U.some(function(D){return D.toString()===b.toString()})?U:U.concat([b.toString()]).sort(function(D,k){var G=isNaN(Number(D))?0:Number(D),he=isNaN(Number(k))?0:Number(k);return G-he})}},{key:"render",value:function(){var A=this,b=this.props,U=b.pageSize,D=b.locale,k=b.rootPrefixCls,G=b.changeSize,he=b.quickGo,Y=b.goButton,be=b.selectComponentClass,S=b.buildOptionText,g=b.selectPrefixCls,q=b.disabled,Te=this.state.goInputText,we="".concat(k,"-options"),$e=be,ot=null,_e=null,je=null;if(!G&&!he)return null;var Se=this.getPageSizeOptions();if(G&&$e){var Oe=Se.map(function(Z,w){return W.a.createElement($e.Option,{key:w,value:Z.toString()},(S||A.buildOptionText)(Z))});ot=W.a.createElement($e,{disabled:q,prefixCls:g,showSearch:!1,className:"".concat(we,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(U||Se[0]).toString(),onChange:this.changeSize,getPopupContainer:function(w){return w.parentNode}},Oe)}return he&&(Y&&(je=typeof Y=="boolean"?W.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:q,className:"".concat(we,"-quick-jumper-button")},D.jump_to_confirm):W.a.createElement("span",{onClick:this.go,onKeyUp:this.go},Y)),_e=W.a.createElement("div",{className:"".concat(we,"-quick-jumper")},D.jump_to,W.a.createElement("input",{disabled:q,type:"text",value:Te,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),D.page,je)),W.a.createElement("li",{className:"".concat(we)},ot,_e)}}]),X}(W.a.Component);V.defaultProps={pageSizeOptions:["10","20","50","100"]};var J=V,B=x("N2Kk");function ce(){}function ne(v){return typeof v=="number"&&isFinite(v)&&Math.floor(v)===v}function pe(v,ie,X){return X}function Ne(v,ie,X){var de=typeof v=="undefined"?ie.pageSize:v;return Math.floor((X.total-1)/de)+1}var ue=function(v){Object(ge.a)(X,v);var ie=Object(j.a)(X);function X(de){var A;Object(Ce.a)(this,X),A=ie.call(this,de),A.getJumpPrevPage=function(){return Math.max(1,A.state.current-(A.props.showLessItems?3:5))},A.getJumpNextPage=function(){return Math.min(Ne(void 0,A.state,A.props),A.state.current+(A.props.showLessItems?3:5))},A.getItemIcon=function(G,he){var Y=A.props.prefixCls,be=G||W.a.createElement("button",{type:"button","aria-label":he,className:"".concat(Y,"-item-link")});return typeof G=="function"&&(be=W.a.createElement(G,Object(oe.a)({},A.props))),be},A.savePaginationNode=function(G){A.paginationNode=G},A.isValid=function(G){return ne(G)&&G!==A.state.current},A.shouldDisplayQuickJumper=function(){var G=A.props,he=G.showQuickJumper,Y=G.pageSize,be=G.total;return be<=Y?!1:he},A.handleKeyDown=function(G){(G.keyCode===z.ARROW_UP||G.keyCode===z.ARROW_DOWN)&&G.preventDefault()},A.handleKeyUp=function(G){var he=A.getValidValue(G),Y=A.state.currentInputValue;he!==Y&&A.setState({currentInputValue:he}),G.keyCode===z.ENTER?A.handleChange(he):G.keyCode===z.ARROW_UP?A.handleChange(he-1):G.keyCode===z.ARROW_DOWN&&A.handleChange(he+1)},A.changePageSize=function(G){var he=A.state.current,Y=Ne(G,A.state,A.props);he=he>Y?Y:he,Y===0&&(he=A.state.current),typeof G=="number"&&("pageSize"in A.props||A.setState({pageSize:G}),"current"in A.props||A.setState({current:he,currentInputValue:he})),A.props.onShowSizeChange(he,G),"onChange"in A.props&&A.props.onChange&&A.props.onChange(he,G)},A.handleChange=function(G){var he=A.props.disabled,Y=G;if(A.isValid(Y)&&!he){var be=Ne(void 0,A.state,A.props);Y>be?Y=be:Y<1&&(Y=1),"current"in A.props||A.setState({current:Y,currentInputValue:Y});var S=A.state.pageSize;return A.props.onChange(Y,S),Y}return A.state.current},A.prev=function(){A.hasPrev()&&A.handleChange(A.state.current-1)},A.next=function(){A.hasNext()&&A.handleChange(A.state.current+1)},A.jumpPrev=function(){A.handleChange(A.getJumpPrevPage())},A.jumpNext=function(){A.handleChange(A.getJumpNextPage())},A.hasPrev=function(){return A.state.current>1},A.hasNext=function(){return A.state.current<Ne(void 0,A.state,A.props)},A.runIfEnter=function(G,he){if(G.key==="Enter"||G.charCode===13){for(var Y=arguments.length,be=new Array(Y>2?Y-2:0),S=2;S<Y;S++)be[S-2]=arguments[S];he.apply(void 0,be)}},A.runIfEnterPrev=function(G){A.runIfEnter(G,A.prev)},A.runIfEnterNext=function(G){A.runIfEnter(G,A.next)},A.runIfEnterJumpPrev=function(G){A.runIfEnter(G,A.jumpPrev)},A.runIfEnterJumpNext=function(G){A.runIfEnter(G,A.jumpNext)},A.handleGoTO=function(G){(G.keyCode===z.ENTER||G.type==="click")&&A.handleChange(A.state.currentInputValue)};var b=de.onChange!==ce,U="current"in de;U&&!b&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var D=de.defaultCurrent;"current"in de&&(D=de.current);var k=de.defaultPageSize;return"pageSize"in de&&(k=de.pageSize),D=Math.min(D,Ne(k,void 0,de)),A.state={current:D,currentInputValue:D,pageSize:k},A}return Object(ve.a)(X,[{key:"componentDidUpdate",value:function(A,b){var U=this.props.prefixCls;if(b.current!==this.state.current&&this.paginationNode){var D=this.paginationNode.querySelector(".".concat(U,"-item-").concat(b.current));D&&document.activeElement===D&&D.blur()}}},{key:"getValidValue",value:function(A){var b=A.target.value,U=Ne(void 0,this.state,this.props),D=this.state.currentInputValue,k;return b===""?k=b:isNaN(Number(b))?k=D:b>=U?k=U:k=Number(b),k}},{key:"getShowSizeChanger",value:function(){var A=this.props,b=A.showSizeChanger,U=A.total,D=A.totalBoundaryShowSizeChanger;return typeof b!="undefined"?b:U>D}},{key:"renderPrev",value:function(A){var b=this.props,U=b.prevIcon,D=b.itemRender,k=D(A,"prev",this.getItemIcon(U,"prev page")),G=!this.hasPrev();return Object(ee.isValidElement)(k)?Object(ee.cloneElement)(k,{disabled:G}):k}},{key:"renderNext",value:function(A){var b=this.props,U=b.nextIcon,D=b.itemRender,k=D(A,"next",this.getItemIcon(U,"next page")),G=!this.hasNext();return Object(ee.isValidElement)(k)?Object(ee.cloneElement)(k,{disabled:G}):k}},{key:"render",value:function(){var A=this,b=this.props,U=b.prefixCls,D=b.className,k=b.style,G=b.disabled,he=b.hideOnSinglePage,Y=b.total,be=b.locale,S=b.showQuickJumper,g=b.showLessItems,q=b.showTitle,Te=b.showTotal,we=b.simple,$e=b.itemRender,ot=b.showPrevNextJumpers,_e=b.jumpPrevIcon,je=b.jumpNextIcon,Se=b.selectComponentClass,Oe=b.selectPrefixCls,Z=b.pageSizeOptions,w=this.state,Be=w.current,ut=w.pageSize,wt=w.currentInputValue;if(he===!0&&Y<=ut)return null;var Je=Ne(void 0,this.state,this.props),qe=[],fe=null,De=null,We=null,Ve=null,ze=null,Ue=S&&S.goButton,Le=g?1:2,Et=Be-1>0?Be-1:0,st=Be+1<Je?Be+1:Je,nt=Object.keys(this.props).reduce(function(y,_){return(_.substr(0,5)==="data-"||_.substr(0,5)==="aria-"||_==="role")&&(y[_]=A.props[_]),y},{});if(we)return Ue&&(typeof Ue=="boolean"?ze=W.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},be.jump_to_confirm):ze=W.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ue),ze=W.a.createElement("li",{title:q?"".concat(be.jump_to).concat(Be,"/").concat(Je):null,className:"".concat(U,"-simple-pager")},ze)),W.a.createElement("ul",Object($.a)({className:L()(U,"".concat(U,"-simple"),Object(Pe.a)({},"".concat(U,"-disabled"),G),D),style:k,ref:this.savePaginationNode},nt),W.a.createElement("li",{title:q?be.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:L()("".concat(U,"-prev"),Object(Pe.a)({},"".concat(U,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Et)),W.a.createElement("li",{title:q?"".concat(Be,"/").concat(Je):null,className:"".concat(U,"-simple-pager")},W.a.createElement("input",{type:"text",value:wt,disabled:G,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),W.a.createElement("span",{className:"".concat(U,"-slash")},"/"),Je),W.a.createElement("li",{title:q?be.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:L()("".concat(U,"-next"),Object(Pe.a)({},"".concat(U,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(st)),ze);if(Je<=3+Le*2){var ct={locale:be,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:q,itemRender:$e};Je||qe.push(W.a.createElement(le,Object($.a)({},ct,{key:"noPager",page:Je,className:"".concat(U,"-disabled")})));for(var St=1;St<=Je;St+=1){var _t=Be===St;qe.push(W.a.createElement(le,Object($.a)({},ct,{key:St,page:St,active:_t})))}}else{var pt=g?be.prev_3:be.prev_5,me=g?be.next_3:be.next_5;ot&&(fe=W.a.createElement("li",{title:q?pt:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:L()("".concat(U,"-jump-prev"),Object(Pe.a)({},"".concat(U,"-jump-prev-custom-icon"),!!_e))},$e(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(_e,"prev page"))),De=W.a.createElement("li",{title:q?me:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:L()("".concat(U,"-jump-next"),Object(Pe.a)({},"".concat(U,"-jump-next-custom-icon"),!!je))},$e(this.getJumpNextPage(),"jump-next",this.getItemIcon(je,"next page")))),Ve=W.a.createElement(le,{locale:be,last:!0,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Je,page:Je,active:!1,showTitle:q,itemRender:$e}),We=W.a.createElement(le,{locale:be,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:q,itemRender:$e});var kt=Math.max(1,Be-Le),ht=Math.min(Be+Le,Je);Be-1<=Le&&(ht=1+Le*2),Je-Be<=Le&&(kt=Je-Le*2);for(var ye=kt;ye<=ht;ye+=1){var Ee=Be===ye;qe.push(W.a.createElement(le,{locale:be,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ye,page:ye,active:Ee,showTitle:q,itemRender:$e}))}Be-1>=Le*2&&Be!==1+2&&(qe[0]=Object(ee.cloneElement)(qe[0],{className:"".concat(U,"-item-after-jump-prev")}),qe.unshift(fe)),Je-Be>=Le*2&&Be!==Je-2&&(qe[qe.length-1]=Object(ee.cloneElement)(qe[qe.length-1],{className:"".concat(U,"-item-before-jump-next")}),qe.push(De)),kt!==1&&qe.unshift(We),ht!==Je&&qe.push(Ve)}var R=null;Te&&(R=W.a.createElement("li",{className:"".concat(U,"-total-text")},Te(Y,[Y===0?0:(Be-1)*ut+1,Be*ut>Y?Y:Be*ut])));var O=!this.hasPrev()||!Je,P=!this.hasNext()||!Je;return W.a.createElement("ul",Object($.a)({className:L()(U,D,Object(Pe.a)({},"".concat(U,"-disabled"),G)),style:k,unselectable:"unselectable",ref:this.savePaginationNode},nt),R,W.a.createElement("li",{title:q?be.prev_page:null,onClick:this.prev,tabIndex:O?null:0,onKeyPress:this.runIfEnterPrev,className:L()("".concat(U,"-prev"),Object(Pe.a)({},"".concat(U,"-disabled"),O)),"aria-disabled":O},this.renderPrev(Et)),qe,W.a.createElement("li",{title:q?be.next_page:null,onClick:this.next,tabIndex:P?null:0,onKeyPress:this.runIfEnterNext,className:L()("".concat(U,"-next"),Object(Pe.a)({},"".concat(U,"-disabled"),P)),"aria-disabled":P},this.renderNext(st)),W.a.createElement(J,{disabled:G,locale:be,rootPrefixCls:U,selectComponentClass:Se,selectPrefixCls:Oe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Be,pageSize:ut,pageSizeOptions:Z,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ue}))}}],[{key:"getDerivedStateFromProps",value:function(A,b){var U={};if("current"in A&&(U.current=A.current,A.current!==b.current&&(U.currentInputValue=U.current)),"pageSize"in A&&A.pageSize!==b.pageSize){var D=b.current,k=Ne(A.pageSize,b,A);D=D>k?k:D,"current"in A||(U.current=D,U.currentInputValue=D),U.pageSize=A.pageSize}return U}}]),X}(W.a.Component);ue.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:ce,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:ce,locale:B.a,style:{},itemRender:pe,totalBoundaryShowSizeChanger:50};var K=ue},"6K3P":function(At,at,x){At.exports=x.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(At,at,x){"use strict";var $=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Pe=new Uint8Array(16);function oe(){if(!$)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $(Pe)}var Ce=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ve(le){return typeof le=="string"&&Ce.test(le)}for(var ge=ve,j=[],ee=0;ee<256;++ee)j.push((ee+256).toString(16).substr(1));function W(le){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=(j[le[z+0]]+j[le[z+1]]+j[le[z+2]]+j[le[z+3]]+"-"+j[le[z+4]]+j[le[z+5]]+"-"+j[le[z+6]]+j[le[z+7]]+"-"+j[le[z+8]]+j[le[z+9]]+"-"+j[le[z+10]]+j[le[z+11]]+j[le[z+12]]+j[le[z+13]]+j[le[z+14]]+j[le[z+15]]).toLowerCase();if(!ge(V))throw TypeError("Stringified UUID is invalid");return V}var se=W;function L(le,z,V){le=le||{};var J=le.random||(le.rng||oe)();if(J[6]=J[6]&15|64,J[8]=J[8]&63|128,z){V=V||0;for(var B=0;B<16;++B)z[V+B]=J[B];return z}return se(J)}var I=at.a=L},"7ahc":function(At,at,x){"use strict";x.d(at,"a",function(){return Ne});var $=x("k1fw"),Pe=x("0Owb"),oe=x("+L6B"),Ce=x("2/Rp"),ve=x("y8nQ"),ge=x("Vl3Y"),j=x("tJVT"),ee=x("OaEy"),W=x("2fM7"),se=x("q1tI"),L=x.n(se),I=x("VrN/"),le=x.n(I),z=x("p77/"),V=x.n(z),J=x("c5Ni"),B=x.n(J),ce=W.a.Option,ne={labelCol:{span:4},wrapperCol:{span:20}},pe={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};at.b=function(ue){var K=ue.callback,v=ue.onCancel,ie=Object(se.useState)("python"),X=Object(j.a)(ie,2),de=X[0],A=X[1];function b(D){A(pe[D][1])}function U(D){K(D)}return L.a.createElement(ge.a,Object(Pe.a)({},ne,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:U}),L.a.createElement(ge.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},L.a.createElement(W.a,{onChange:b},Object.keys(pe).map(function(D){return L.a.createElement(ce,{key:D,value:D},pe[D][0])}))),L.a.createElement(ge.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},L.a.createElement(Ne,{mode:de})),L.a.createElement("div",{className:"flex-container flex-end"},L.a.createElement(Ce.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(Ce.a,{type:"ghost",onClick:v},"\u53D6\u6D88")))};function Ne(ue){var K=ue.value,v=ue.onChange,ie=ue.mode,X=ue.options,de=X===void 0?{}:X,A=Object(se.useRef)(),b=Object(se.useState)(),U=Object(j.a)(b,2),D=U[0],k=U[1];return Object(se.useEffect)(function(){if(D){function G(he){var Y=he.getValue();v&&v(Y)}return D.on("change",G),function(){D.off("change",G)}}},[D,v]),Object(se.useEffect)(function(){D&&D.setOption("mode",ie)},[D,ie]),Object(se.useEffect)(function(){D&&((K!==D.getValue()||K==="")&&setTimeout(function(){D.setValue(K||" ")},300))},[D,K]),Object(se.useEffect)(function(){if(A.current&&!D){var G=le.a.fromTextArea(A.current,Object($.a)({mode:ie,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},de));k(G)}},[A.current,D]),L.a.createElement("div",{className:"my-codemirror-container"},L.a.createElement("textarea",{ref:A}))}},"7ixt":function(At,at,x){"use strict";x.d(at,"a",function(){return oe});var $={adjustX:1,adjustY:1},Pe=[0,0],oe={left:{points:["cr","cl"],overflow:$,offset:[-4,0],targetOffset:Pe},right:{points:["cl","cr"],overflow:$,offset:[4,0],targetOffset:Pe},top:{points:["bc","tc"],overflow:$,offset:[0,-4],targetOffset:Pe},bottom:{points:["tc","bc"],overflow:$,offset:[0,4],targetOffset:Pe},topLeft:{points:["bl","tl"],overflow:$,offset:[0,-4],targetOffset:Pe},leftTop:{points:["tr","tl"],overflow:$,offset:[-4,0],targetOffset:Pe},topRight:{points:["br","tr"],overflow:$,offset:[0,-4],targetOffset:Pe},rightTop:{points:["tl","tr"],overflow:$,offset:[4,0],targetOffset:Pe},bottomRight:{points:["tr","br"],overflow:$,offset:[0,4],targetOffset:Pe},rightBottom:{points:["bl","br"],overflow:$,offset:[4,0],targetOffset:Pe},bottomLeft:{points:["tl","bl"],overflow:$,offset:[0,4],targetOffset:Pe},leftBottom:{points:["br","bl"],overflow:$,offset:[-4,0],targetOffset:Pe}},Ce=oe},"7qnI":function(At,at,x){"use strict";var $=x("5Dmo"),Pe=x("3S7+"),oe=x("fWQN"),Ce=x("mtLc"),ve=x("yKVA"),ge=x("879j"),j=x("5NDa"),ee=x("5rEg"),W=x("q1tI"),se=x.n(W),L=x("O2Wb"),I=x.n(L),le=ee.a.TextArea,z=function(V){Object(ve.a)(B,V);var J=Object(ge.a)(B);function B(){return Object(oe.a)(this,B),J.apply(this,arguments)}return Object(Ce.a)(B,[{key:"render",value:function(){var ne=this,pe=this.props,Ne=pe.index,ue=pe.onAnswerChange,K=pe.addChildAnswer,v=pe.exerciseIsPublish,ie=pe.answers,X=pe.activeOptionErrorIndex,de=pe.flex,A=de===void 0?"0 0 1000px":de;return se.a.createElement("div",{className:I.a.flex},se.a.createElement("div",{className:"".concat(I.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",Ne+1,"):"),se.a.createElement("div",{className:"".concat(I.a.flex," ").concat(I.a.flex1),style:{flexDirection:"column"}},ie.map(function(b,U){var D="".concat(Ne,"-").concat(U);return se.a.createElement("div",{className:"".concat(I.a.flex," ").concat(I.a.flex1),key:U},se.a.createElement("div",{className:I.a.flex1,style:{flex:A}},se.a.createElement("div",null,se.a.createElement(le,{className:D===X?I.a.error:"",spellCheck:!1,rows:4,value:b||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(U==0?"":"(\u53EF\u9009)"),onChange:function(G){return ue(Ne,U,G.target.value)},style:{minHeight:95}}))),!v&&se.a.createElement(se.a.Fragment,null,U!=0&&se.a.createElement(Pe.a,{title:"\u5220\u9664"},se.a.createElement("i",{className:"".concat(I.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ne.props.deleteChildAnswer(Ne,U)},style:{float:"right"}})),U===0&&se.a.createElement(Pe.a,{title:"\u5220\u9664"},se.a.createElement("i",{className:"".concat(I.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ne.props.deleteChildAnswermain(Ne,U)},style:{float:"right"}})),se.a.createElement(Pe.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},se.a.createElement("i",{className:"".concat(I.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return K(Ne)},style:{float:"right",visibility:U==ie.length-1?"":"hidden"}}))))})))}}]),B}(W.Component);at.a=z},"8EBN":function(At,at,x){(function($){$(x("VrN/"))})(function($){"use strict";$.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Pe=0;Pe<$.modeInfo.length;Pe++){var oe=$.modeInfo[Pe];oe.mimes&&(oe.mime=oe.mimes[0])}$.findModeByMIME=function(Ce){Ce=Ce.toLowerCase();for(var ve=0;ve<$.modeInfo.length;ve++){var ge=$.modeInfo[ve];if(ge.mime==Ce)return ge;if(ge.mimes){for(var j=0;j<ge.mimes.length;j++)if(ge.mimes[j]==Ce)return ge}}if(/\+xml$/.test(Ce))return $.findModeByMIME("application/xml");if(/\+json$/.test(Ce))return $.findModeByMIME("application/json")},$.findModeByExtension=function(Ce){Ce=Ce.toLowerCase();for(var ve=0;ve<$.modeInfo.length;ve++){var ge=$.modeInfo[ve];if(ge.ext){for(var j=0;j<ge.ext.length;j++)if(ge.ext[j]==Ce)return ge}}},$.findModeByFileName=function(Ce){for(var ve=0;ve<$.modeInfo.length;ve++){var ge=$.modeInfo[ve];if(ge.file&&ge.file.test(Ce))return ge}var j=Ce.lastIndexOf("."),ee=j>-1&&Ce.substring(j+1,Ce.length);if(ee)return $.findModeByExtension(ee)},$.findModeByName=function(Ce){Ce=Ce.toLowerCase();for(var ve=0;ve<$.modeInfo.length;ve++){var ge=$.modeInfo[ve];if(ge.name.toLowerCase()==Ce)return ge;if(ge.alias){for(var j=0;j<ge.alias.length;j++)if(ge.alias[j].toLowerCase()==Ce)return ge}}}})},"8hTe":function(At,at,x){At.exports={button:"button___1wy9m"}},"9Bee":function(At,at,x){"use strict";var $=x("DYRE"),Pe=x("zeV3"),oe=x("+L6B"),Ce=x("2/Rp"),ve=x("k1fw"),ge=x("9og8"),j=x("tJVT"),ee=x("WmNS"),W=x.n(ee),se=x("q1tI"),L=x.n(se),I=x("vg9a"),le=x("DlQD"),z=x.n(le),V=x("rUJ1");function J(h,o){var a=h.match(/^(\s+)(?:```)/);if(a===null)return o;var u=a[1];return o.split(`
|
|
`).map(function(d){var c=d.match(/^\s+/);if(c===null)return d;var N=Object(j.a)(c,1),Re=N[0];return Re.length>=u.length?d.slice(u.length):d}).join(`
|
|
`)}var B=[],ce=["<ul>"],ne=new z.a.Renderer,pe=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function Ne(){B.length=0,ce=["<ul>"]}var ue={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function K(h,o,a,u){if(o>=h.length||h[o].level<=a)return o;var d=h[o];u.push("<li><a href='#"+d.anchor+"'>"+d.text+"</a>"),o++;var c=[];return o=K(h,o,d.level,c),c.length>0&&(u.push("<ul>"),c.forEach(function(N){u.push(N)}),u.push("</ul>")),u.push("</li>"),o=K(h,o,a,u),o}function v(){return K(B,0,0,ce),ce.push("</ul>"),ce.join("")}var ie={heading:function(o){var a=pe.exec(o);if(a)return{type:"heading",raw:a[0],depth:a[1].length,text:a[2]}},fences:function(o){var a=this.rules.block.fences.exec(o);if(a){var u=a[0],d=J(u,a[3]||""),c=a[2]?a[2].trim():a[2];if(["latex","katex","math"].indexOf(c)>=0){var N=A(),Re=d;d=N,b[N]={type:"block",expression:Re}}return{type:"code",raw:u,lang:c,text:d}}}},X=/(?:\${2})([^\n`]+?)(?:\${2})/gi,de=0,A=function(){return"__special_katext_id_".concat(de++,"__")},b={};function U(){return b}function D(){de=0,b={}}function k(h){return h=h.replace(X,function(o,a){var u=A();return b[u]={type:"inline",expression:a},u}),h}var G=ne.listitem;ne.listitem=function(h){return G(k(h))};var he=ne.paragraph;ne.paragraph=function(h){return he(k(h))};var Y=ne.tablecell;ne.tablecell=function(h,o){return Y(k(h),o)},ne.code=function(h,o,a){var u=(o||"").match(/\S*/)[0];return u?["latex","katex","math"].indexOf(u)>=0?"<p class='editormd-tex'>".concat(h,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(o,'">').concat(a?h:Object(V.escape)(h,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(a?h:Object(V.escape)(h,!0))+"</code></pre>"},ne.heading=function(h,o,a){var u=this.options.headerPrefix+a.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return B.push({anchor:u,level:o,text:h}),"<h"+o+' id="'+u+'">'+h+"</h"+o+">"},z.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),z.a.use({tokenizer:ie,renderer:ne});var be=z.a,S=x("SJMd"),g=x("ulZh"),q=x.n(g),Te=x("m3rI"),we=x("Oy/b"),$e=x("p5ED"),ot=x("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var _e=function(h,o){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(a[d]=u[d])})(h,o)};function je(h,o){function a(){this.constructor=h}_e(h,o),h.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function Se(h,o,a,u){return new(a||(a=Promise))(function(d,c){function N(bt){try{Ze(u.next(bt))}catch(Me){c(Me)}}function Re(bt){try{Ze(u.throw(bt))}catch(Me){c(Me)}}function Ze(bt){var Me;bt.done?d(bt.value):(Me=bt.value,Me instanceof a?Me:new a(function(ke){ke(Me)})).then(N,Re)}Ze((u=u.apply(h,o||[])).next())})}function Oe(h,o){var a,u,d,c,N={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return c={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function Re(Ze){return function(bt){return function(Me){if(a)throw new TypeError("Generator is already executing.");for(;N;)try{if(a=1,u&&(d=2&Me[0]?u.return:Me[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,Me[1])).done)return d;switch(u=0,d&&(Me=[2&Me[0],d.value]),Me[0]){case 0:case 1:d=Me;break;case 4:return N.label++,{value:Me[1],done:!1};case 5:N.label++,u=Me[1],Me=[0];continue;case 7:Me=N.ops.pop(),N.trys.pop();continue;default:if(!(d=N.trys,(d=d.length>0&&d[d.length-1])||Me[0]!==6&&Me[0]!==2)){N=0;continue}if(Me[0]===3&&(!d||Me[1]>d[0]&&Me[1]<d[3])){N.label=Me[1];break}if(Me[0]===6&&N.label<d[1]){N.label=d[1],d=Me;break}if(d&&N.label<d[2]){N.label=d[2],N.ops.push(Me);break}d[2]&&N.ops.pop(),N.trys.pop();continue}Me=o.call(h,N)}catch(ke){Me=[6,ke],u=0}finally{a=d=0}if(5&Me[0])throw Me[1];return{value:Me[0]?Me[1]:void 0,done:!0}}([Ze,bt])}}}function Z(){for(var h=0,o=0,a=arguments.length;o<a;o++)h+=arguments[o].length;var u=Array(h),d=0;for(o=0;o<a;o++)for(var c=arguments[o],N=0,Re=c.length;N<Re;N++,d++)u[d]=c[N];return u}var w=function(){function h(){}return h.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},h.setAttributes=function(o,a){for(var u=0,d=a;u<d.length;u++){var c=d[u],N=c[0],Re=c[1];o.setAttribute(N,Re)}},h.createRect=function(o,a,u){var d=document.createElementNS("http://www.w3.org/2000/svg","rect");return d.setAttribute("width",o.toString()),d.setAttribute("height",a.toString()),u&&h.setAttributes(d,u),d},h.createLine=function(o,a,u,d,c){var N=document.createElementNS("http://www.w3.org/2000/svg","line");return N.setAttribute("x1",o.toString()),N.setAttribute("y1",a.toString()),N.setAttribute("x2",u.toString()),N.setAttribute("y2",d.toString()),c&&h.setAttributes(N,c),N},h.createPolygon=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","polygon");return u.setAttribute("points",o),a&&h.setAttributes(u,a),u},h.createCircle=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","circle");return u.setAttribute("cx",(o/2).toString()),u.setAttribute("cy",(o/2).toString()),u.setAttribute("r",o.toString()),a&&h.setAttributes(u,a),u},h.createEllipse=function(o,a,u){var d=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return d.setAttribute("cx",(o/2).toString()),d.setAttribute("cy",(a/2).toString()),d.setAttribute("rx",(o/2).toString()),d.setAttribute("ry",(a/2).toString()),u&&h.setAttributes(d,u),d},h.createGroup=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&h.setAttributes(a,o),a},h.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},h.createMarker=function(o,a,u,d,c,N,Re){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return h.setAttributes(Ze,[["id",o],["orient",a],["markerWidth",u.toString()],["markerHeight",d.toString()],["refX",c.toString()],["refY",N.toString()]]),Ze.appendChild(Re),Ze},h.createText=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","text");return a.setAttribute("x","0"),a.setAttribute("y","0"),o&&h.setAttributes(a,o),a},h.createTSpan=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","tspan");return u.textContent=o,a&&h.setAttributes(u,a),u},h.createImage=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&h.setAttributes(a,o),a},h.createPoint=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return u.x=o,u.y=a,u},h.createPath=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),a&&h.setAttributes(u,a),u},h}(),Be=function(){function h(){}return h.addKey=function(o){h.key=o},Object.defineProperty(h,"isLicensed",{get:function(){return!!h.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(h.key)},enumerable:!1,configurable:!0}),h}(),ut=function(){function h(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return h.prototype.rasterize=function(o,a,u){var d=this;return new Promise(function(c){var N=u!==void 0?u:document.createElement("canvas");o===null&&(d.markersOnly=!0,d.naturalSize=!1);var Re=document.createElementNS("http://www.w3.org/2000/svg","svg");Re.setAttribute("xmlns","http://www.w3.org/2000/svg"),Re.setAttribute("width",a.width.baseVal.valueAsString),Re.setAttribute("height",a.height.baseVal.valueAsString),Re.setAttribute("viewBox","0 0 "+a.viewBox.baseVal.width.toString()+" "+a.viewBox.baseVal.height.toString()),Re.innerHTML=a.innerHTML,d.naturalSize===!0?(Re.width.baseVal.value=o.naturalWidth,Re.height.baseVal.value=o.naturalHeight):d.width!==void 0&&d.height!==void 0&&(Re.width.baseVal.value=d.width,Re.height.baseVal.value=d.height),N.width=Re.width.baseVal.value,N.height=Re.height.baseVal.value;var Ze=Re.outerHTML,bt=N.getContext("2d");d.markersOnly!==!0&&bt.drawImage(o,0,0,N.width,N.height);var Me=window.URL,ke=new Image(N.width,N.height);ke.setAttribute("crossOrigin","anonymous");var H=new Blob([Ze],{type:"image/svg+xml"}),Ie=Me.createObjectURL(H);ke.onload=function(){bt.drawImage(ke,0,0),Me.revokeObjectURL(Ie);var Rt=N.toDataURL(d.imageType,d.imageQuality);c(Rt)},ke.src=Ie})},h}(),wt=function(){},Je=function(){function h(o){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(h.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),h.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},h.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},h.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new fe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new fe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},h.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},h}(),qe=function(h,o){this.selector=h,this.style=o},fe=function(h,o){this.localName=h,this.style=o},De=function(){function h(o,a,u,d,c){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=o,this.displayMode=a,this.markerItems=u,this.uiStyleSettings=d,this.styles=c,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return h.prototype.show=function(o){var a=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var u=document.createElement("div");u.className=this.toolbarBlockStyleClass.name,u.style.whiteSpace="nowrap",this.uiContainer.appendChild(u),this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(u,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(c){var N=document.createElement("div");N.className=""+a.toolbarButtonStyleClass.name,N.setAttribute("data-type-name",c.typeName),N.innerHTML=c.icon,N.addEventListener("click",function(){a.markerToolbarButtonClicked(N,c)}),a.buttons.push(N),a.markerButtons.push(N)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var d=document.createElement("div");d.className=this.toolbarBlockStyleClass.name,d.style.whiteSpace="nowrap",d.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(d),this.addActionButton(d,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(d,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},h.prototype.addButtonClickListener=function(o){this.buttonClickListeners.push(o)},h.prototype.removeButtonClickListener=function(o){this.buttonClickListeners.indexOf(o)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(o),1)},h.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},h.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var o=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var a=0;a<this.markerButtons.length;a++)a<o||a===o&&this.markerButtons.length-1===o?this.markerButtonBlock.appendChild(this.markerButtons[a]):(a===o&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[a]))}},h.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},h.prototype.resetButtonStyles=function(){var o=this;this.buttons.forEach(function(a){a.className=a.className.replace(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name,"").trim(),a.className=a.className.replace(o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:o.toolbarActiveButtonStyleColorsClass.name,"").trim(),a.className+=" "+(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name)})},h.prototype.addActionButton=function(o,a,u){var d=this,c=document.createElement("div");switch(c.className=""+this.toolbarButtonStyleClass.name,c.innerHTML=a,c.setAttribute("data-action",u),c.addEventListener("click",function(){d.actionToolbarButtonClicked(c,u)}),u){case"select":c.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":c.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":c.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":c.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":c.style.fill=this.uiStyleSettings.closeButtonColor}o.appendChild(c),this.buttons.push(c)},h.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new fe("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new fe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new fe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new fe("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new fe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var o=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new fe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
|
|
padding: `+o+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new fe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new fe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new qe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},h.prototype.markerToolbarButtonClicked=function(o,a){this.setActiveButton(o),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(u){return u("marker",a)}),this.markerButtonOverflowBlock.style.display="none"},h.prototype.actionToolbarButtonClicked=function(o,a){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(u){return u("action",a)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},h.prototype.setActiveButton=function(o){this.resetButtonStyles(),o.className=o.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),o.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},h.prototype.setActiveMarkerButton=function(o){var a=this.markerButtons.find(function(u){return u.getAttribute("data-type-name")===o});a&&this.setActiveButton(a)},h.prototype.setCurrentMarker=function(o){var a=this;this.currentMarker=o,this.buttons.filter(function(u){return/delete|notes/.test(u.getAttribute("data-action"))}).forEach(function(u){a.currentMarker===void 0?(u.style.fillOpacity="0.4",u.style.pointerEvents="none"):(u.style.fillOpacity="1",u.style.pointerEvents="all")})},h}(),We=function(){function h(o,a,u,d){this.panels=[],this.panelButtons=[],this.markerjsContainer=o,this.displayMode=a,this.uiStyleSettings=u,this.styles=d,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return h.prototype.addStyles=function(){var o;this.toolboxStyleClass=this.styles.addClass(new fe("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new fe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new fe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new fe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new fe("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new fe("toolbox-panel-row_colors",`
|
|
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new fe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
|
|
padding: `+a+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new fe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new fe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new qe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new qe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},h.prototype.show=function(o){var a;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolboxStyleClass.name+" "+((a=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},h.prototype.setPanelButtons=function(o){var a,u,d=this;this.panels=o,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((a=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((u=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&u!==void 0?u:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(c){var N;c.uiStyleSettings=d.uiStyleSettings;var Re=document.createElement("div");Re.className=d.toolboxButtonStyleClass.name+" "+((N=d.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&N!==void 0?N:d.toolboxButtonStyleColorsClass.name),Re.innerHTML=c.icon,Re.title=c.title,Re.addEventListener("click",function(){d.panelButtonClick(c)}),d.panelButtons.push(Re),d.buttonRow.appendChild(Re)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},h.prototype.panelButtonClick=function(o){var a=this,u=-1;if(o!==this.activePanel){u=this.panels.indexOf(o),this.panelRow.innerHTML="";var d=o.getUi();d.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(d),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=o}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){a.displayMode==="inline"?a.panelRow.style.display="none":a.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(c,N){var Re,Ze;c.className=a.toolboxButtonStyleClass.name+" "+(N===u?""+((Re=a.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Re!==void 0?Re:a.toolboxActiveButtonStyleColorsClass.name):""+((Ze=a.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:a.toolboxButtonStyleColorsClass.name))})},h}(),Ve=function(h,o){this.title=h,this.icon=o},ze=function(h){function o(a,u,d,c){var N=h.call(this,a,c||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return N.colors=[],N.addTransparent=!1,N.colorBoxes=[],N.colors=u,N.currentColor=d,N.setCurrentColor=N.setCurrentColor.bind(N),N.getColorBox=N.getColorBox.bind(N),N}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.overflow="hidden",u.style.whiteSpace="nowrap",this.colors.forEach(function(d){var c=a.getColorBox(d);u.appendChild(c),a.colorBoxes.push(c)}),u},o.prototype.getColorBox=function(a){var u=this,d=this.uiStyleSettings.toolbarHeight/4,c=this.uiStyleSettings.toolbarHeight-d,N=document.createElement("div");N.style.display="inline-block",N.style.boxSizing="content-box",N.style.width=c-2+"px",N.style.height=c-2+"px",N.style.padding="1px",N.style.marginRight="2px",N.style.marginBottom="2px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderRadius=(c+2)/2+"px",N.style.borderColor=a===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){u.setCurrentColor(a,N)});var Re=document.createElement("div");return Re.style.display="inline-block",Re.style.width=c-2+"px",Re.style.height=c-2+"px",Re.style.backgroundColor=a,Re.style.borderRadius=c/2+"px",a==="transparent"&&(Re.style.fill=this.uiStyleSettings.toolboxAccentColor,Re.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),N.appendChild(Re),N},o.prototype.setCurrentColor=function(a,u){var d=this;this.currentColor=a,this.colorBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(a)},o}(Ve),Ue=function(){function h(o,a,u){this._state="new",this._isSelected=!1,this._container=o,this._overlayContainer=a,this.globalSettings=u,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(h.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(o){return!1},Object.defineProperty(h.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),h.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},h.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},h.prototype.pointerDown=function(o,a){},h.prototype.dblClick=function(o,a){},h.prototype.manipulate=function(o){},h.prototype.pointerUp=function(o){this.stateChanged()},h.prototype.dispose=function(){},h.prototype.addMarkerVisualToContainer=function(o){this.container.childNodes.length>0?this.container.insertBefore(o,this.container.childNodes[0]):this.container.appendChild(o)},h.prototype.getState=function(){return{typeName:h.typeName,state:this.state,notes:this.notes}},h.prototype.restoreState=function(o){this._state=o.state,this.notes=o.notes},h.prototype.scale=function(o,a){},h.prototype.colorChanged=function(o){this.onColorChanged&&this.onColorChanged(o),this.stateChanged()},h.prototype.fillColorChanged=function(o){this.onFillColorChanged&&this.onFillColorChanged(o),this.stateChanged()},h.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var o=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),o.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(o)&&this.onStateChanged(this)}},h.typeName="MarkerBase",h}(),Le=function(){function h(){this.findGripByVisual=this.findGripByVisual.bind(this)}return h.prototype.findGripByVisual=function(o){return this.topLeft.ownsTarget(o)?this.topLeft:this.topCenter.ownsTarget(o)?this.topCenter:this.topRight.ownsTarget(o)?this.topRight:this.centerLeft.ownsTarget(o)?this.centerLeft:this.centerRight.ownsTarget(o)?this.centerRight:this.bottomLeft.ownsTarget(o)?this.bottomLeft:this.bottomCenter.ownsTarget(o)?this.bottomCenter:this.bottomRight.ownsTarget(o)?this.bottomRight:void 0},h}(),Et=function(){function h(){this.GRIP_SIZE=10,this.visual=w.createGroup(),this.visual.appendChild(w.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(w.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return h.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},h}(),st=function(){function h(){}return h.toITransformMatrix=function(o){return{a:o.a,b:o.b,c:o.c,d:o.d,e:o.e,f:o.f}},h.toSVGMatrix=function(o,a){return o.a=a.a,o.b=a.b,o.c=a.c,o.d=a.d,o.e=a.e,o.f=a.f,o},h}(),nt=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.left=0,c.top=0,c.width=0,c.height=0,c.defaultSize={x:50,y:20},c.offsetX=0,c.offsetY=0,c.rotationAngle=0,c.CB_DISTANCE=10,c._suppressMarkerCreateEvent=!1,c.container.transform.baseVal.appendItem(w.createTransform()),c.setupControlBox(),c}return je(o,h),Object.defineProperty(o.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"visual",{get:function(){return this._visual},set:function(a){this._visual=a;var u=w.createTransform();this._visual.transform.baseVal.appendItem(u)},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(a){return!!h.prototype.ownsTarget.call(this,a)||!!(this.controlGrips.findGripByVisual(a)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(a))},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.left=a.x,this.top=a.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var d=this.unrotatePoint(a);if(this.manipulationStartX=d.x,this.manipulationStartY=d.y,this.offsetX=d.x-this.left,this.offsetY=d.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(u),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(u)){this.activeGrip=this.rotatorGrip;var c=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=c.x-this.width/2,this.top=c.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var N=this.container.transform.baseVal.getItem(0);N.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(N,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},o.prototype.pointerUp=function(a){var u=this.state;h.prototype.pointerUp.call(this,a),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(a),this._state="select",u==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},o.prototype.moveVisual=function(a){this.visual.style.transform="translate("+a.x+"px, "+a.y+"px)"},o.prototype.manipulate=function(a){var u=this.unrotatePoint(a);this.state==="creating"?this.resize(a):this.state==="move"?(this.left=this.manipulationStartLeft+(u.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(u.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(u):this.state==="rotate"&&this.rotate(a)},o.prototype.resize=function(a){var u=this.manipulationStartLeft,d=this.manipulationStartWidth,c=this.manipulationStartTop,N=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:u=this.manipulationStartLeft+a.x-this.manipulationStartX,d=this.manipulationStartWidth+this.manipulationStartLeft-u;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:d=this.manipulationStartWidth+a.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:c=this.manipulationStartTop+a.y-this.manipulationStartY,N=this.manipulationStartHeight+this.manipulationStartTop-c;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:N=this.manipulationStartHeight+a.y-this.manipulationStartY}d>=0?(this.left=u,this.width=d):(this.left=u+d,this.width=-d),N>=0?(this.top=c,this.height=N):(this.top=c+N,this.height=-N),this.setSize()},o.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},o.prototype.rotate=function(a){if(Math.abs(a.x-this.centerX)>.1){var u=Math.sign(a.x-this.centerX);this.rotationAngle=180*Math.atan((a.y-this.centerY)/(a.x-this.centerX))/Math.PI+90*u,this.applyRotation()}},o.prototype.applyRotation=function(){var a=this.container.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(a,0)},o.prototype.rotatePoint=function(a){if(this.rotationAngle===0)return a;var u=this.container.getCTM(),d=w.createPoint(a.x,a.y);return{x:(d=d.matrixTransform(u)).x,y:d.y}},o.prototype.unrotatePoint=function(a){if(this.rotationAngle===0)return a;var u=this.container.getCTM();u=u.inverse();var d=w.createPoint(a.x,a.y);return{x:(d=d.matrixTransform(u)).x,y:d.y}},o.prototype.select=function(){h.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){h.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=w.createGroup();var a=w.createTransform();a.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(a),this.container.appendChild(this.controlBox),this.controlRect=w.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=w.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Le,this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){var a=this.controlBox.transform.baseVal.getItem(0);a.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(a,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},o.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},o.prototype.createGrip=function(){var a=new Et;return a.visual.transform.baseVal.appendItem(w.createTransform()),this.controlBox.appendChild(a.visual),a},o.prototype.positionGrips=function(){var a=this.controlGrips.topLeft.GRIP_SIZE,u=-a/2,d=u,c=(this.width+this.CB_DISTANCE)/2-a/2,N=(this.height+this.CB_DISTANCE)/2-a/2,Re=this.height+this.CB_DISTANCE-a/2,Ze=this.width+this.CB_DISTANCE-a/2;this.positionGrip(this.controlGrips.topLeft.visual,u,d),this.positionGrip(this.controlGrips.topCenter.visual,c,d),this.positionGrip(this.controlGrips.topRight.visual,Ze,d),this.positionGrip(this.controlGrips.centerLeft.visual,u,N),this.positionGrip(this.controlGrips.centerRight.visual,Ze,N),this.positionGrip(this.controlGrips.bottomLeft.visual,u,Re),this.positionGrip(this.controlGrips.bottomCenter.visual,c,Re),this.positionGrip(this.controlGrips.bottomRight.visual,Ze,Re),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,c,d-3*this.CB_DISTANCE)},o.prototype.positionGrip=function(a,u,d){var c=a.transform.baseVal.getItem(0);c.setTranslate(u,d),a.transform.baseVal.replaceItem(c,0)},o.prototype.hideControlBox=function(){this.controlBox.style.display="none"},o.prototype.showControlBox=function(){this.controlBox.style.display=""},o.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:st.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:st.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},h.prototype.getState.call(this))},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a);var u=a;this.left=u.left,this.top=u.top,this.width=u.width,this.height=u.height,this.rotationAngle=u.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(st.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,u.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(st.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,u.containerTransformMatrix))},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u);var d=this.rotatePoint({x:this.left,y:this.top}),c=this.unrotatePoint({x:d.x*a,y:d.y*u});this.left=c.x,this.top=c.y,this.width=this.width*a,this.height=this.height*u,this.adjustControlBox()},o}(Ue),ct=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.fillColor="transparent",c.strokeColor="transparent",c.strokeWidth=0,c.strokeDasharray="",c.opacity=1,c.setStrokeColor=c.setStrokeColor.bind(c),c.setFillColor=c.setFillColor.bind(c),c.setStrokeWidth=c.setStrokeWidth.bind(c),c.setStrokeDasharray=c.setStrokeDasharray.bind(c),c.createVisual=c.createVisual.bind(c),c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.visual)},o.prototype.createVisual=function(){this.visual=w.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.manipulate=function(a){h.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){h.prototype.resize.call(this,a),this.setSize()},o.prototype.setSize=function(){h.prototype.setSize.call(this),w.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(a){h.prototype.pointerUp.call(this,a),this.setSize()},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&w.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},o.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&w.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&w.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&w.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},h.prototype.getState.call(this))},o.prototype.restoreState=function(a){var u=a;this.fillColor=u.fillColor,this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.opacity=u.opacity,this.createVisual(),h.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.setSize()},o.title="Rectangle marker",o}(nt),St=function(h){function o(a,u,d,c){var N=h.call(this,a,c||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return N.widths=[],N.widthBoxes=[],N.widths=u,N.currentWidth=d,N.setCurrentWidth=N.setCurrentWidth.bind(N),N}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",this.widths.forEach(function(d){var c=document.createElement("div");c.style.display="flex",c.style.flexGrow="2",c.style.alignItems="center",c.style.justifyContent="space-between",c.style.padding="5px",c.style.borderWidth="2px",c.style.borderStyle="solid",c.style.borderColor=d===a.currentWidth?a.uiStyleSettings.toolboxAccentColor:"transparent",c.addEventListener("click",function(){a.setCurrentWidth(d,c)}),u.appendChild(c);var N=document.createElement("div");N.innerText=d.toString(),N.style.marginRight="5px",c.appendChild(N);var Re=document.createElement("div");Re.style.minHeight="20px",Re.style.flexGrow="2",Re.style.display="flex",Re.style.alignItems="center";var Ze=document.createElement("hr");Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop=d+"px solid "+a.uiStyleSettings.toolboxColor,Ze.style.flexGrow="2",Re.appendChild(Ze),c.appendChild(Re),a.widthBoxes.push(c)}),u},o.prototype.setCurrentWidth=function(a,u){var d=this;this.currentWidth=a,this.widthBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},o}(Ve),_t=function(h){function o(a,u,d,c){var N=h.call(this,a,c||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return N.styles=[],N.styleBoxes=[],N.styles=u,N.currentStyle=d,N.setCurrentStyle=N.setCurrentStyle.bind(N),N}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",this.styles.forEach(function(d){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.justifyContent="space-between",c.style.padding="5px",c.style.borderWidth="2px",c.style.borderStyle="solid",c.style.overflow="hidden",c.style.maxWidth=100/a.styles.length-5+"%",c.style.borderColor=d===a.currentStyle?a.uiStyleSettings.toolboxAccentColor:"transparent",c.addEventListener("click",function(){a.setCurrentStyle(d,c)}),u.appendChild(c);var N=document.createElement("div");N.style.minHeight="20px",N.style.flexGrow="2",N.style.overflow="hidden";var Re=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+a.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(d!==""?'stroke-dasharray="'+d+'"':"")+` />
|
|
</svg>`;N.innerHTML=Re,c.appendChild(N),a.styleBoxes.push(c)}),u},o.prototype.setCurrentStyle=function(a,u){var d=this;this.currentStyle=a,this.styleBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},o}(Ve),pt=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.strokeColor=d.defaultColor,c.strokeWidth=d.defaultStrokeWidth,c.strokeDasharray=d.defaultStrokeDasharray,c.strokePanel=new ze("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new St("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new _t("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return je(o,h),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=h.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="FrameMarker",o.title="Frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',o}(ct),me=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},kt=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.x1=0,c.y1=0,c.x2=0,c.y2=0,c.defaultLength=50,c.manipulationStartX=0,c.manipulationStartY=0,c.manipulationStartX1=0,c.manipulationStartY1=0,c.manipulationStartX2=0,c.manipulationStartY2=0,c.setupControlBox(),c}return je(o,h),o.prototype.ownsTarget=function(a){return!!h.prototype.ownsTarget.call(this,a)||!(!this.grip1.ownsTarget(a)&&!this.grip2.ownsTarget(a))},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.manipulationStartX=a.x,this.manipulationStartY=a.y,this.state==="new"&&(this.x1=a.x,this.y1=a.y,this.x2=a.x,this.y2=a.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(u)?this.activeGrip=this.grip1:this.grip2.ownsTarget(u)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},o.prototype.pointerUp=function(a){var u=this.state;h.prototype.pointerUp.call(this,a),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(a),this._state="select",u==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},o.prototype.adjustVisual=function(){},o.prototype.manipulate=function(a){this.state==="creating"?this.resize(a):this.state==="move"?(this.x1=this.manipulationStartX1+a.x-this.manipulationStartX,this.y1=this.manipulationStartY1+a.y-this.manipulationStartY,this.x2=this.manipulationStartX2+a.x-this.manipulationStartX,this.y2=this.manipulationStartY2+a.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(a)},o.prototype.resize=function(a){switch(this.activeGrip){case this.grip1:this.x1=a.x,this.y1=a.y;break;case this.grip2:case void 0:this.x2=a.x,this.y2=a.y}this.adjustVisual(),this.adjustControlBox()},o.prototype.select=function(){h.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){h.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=w.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){this.positionGrips()},o.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},o.prototype.createGrip=function(){var a=new Et;return a.visual.transform.baseVal.appendItem(w.createTransform()),this.controlBox.appendChild(a.visual),a},o.prototype.positionGrips=function(){var a=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-a/2,this.y1-a/2),this.positionGrip(this.grip2.visual,this.x2-a/2,this.y2-a/2)},o.prototype.positionGrip=function(a,u,d){var c=a.transform.baseVal.getItem(0);c.setTranslate(u,d),a.transform.baseVal.replaceItem(c,0)},o.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},h.prototype.getState.call(this))},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a);var u=a;this.x1=u.x1,this.y1=u.y1,this.x2=u.x2,this.y2=u.y2},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.x1=this.x1*a,this.y1=this.y1*u,this.x2=this.x2*a,this.y2=this.y2*u,this.adjustVisual(),this.adjustControlBox()},o}(Ue),ht=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.strokeColor="transparent",c.strokeWidth=0,c.strokeDasharray="",c.setStrokeColor=c.setStrokeColor.bind(c),c.setStrokeWidth=c.setStrokeWidth.bind(c),c.setStrokeDasharray=c.setStrokeDasharray.bind(c),c.strokeColor=d.defaultColor,c.strokeWidth=d.defaultStrokeWidth,c.strokeDasharray=d.defaultStrokeDasharray,c.strokePanel=new ze("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new St("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new _t("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorLine&&a!==this.visibleLine)},o.prototype.createVisual=function(){this.visual=w.createGroup(),this.selectorLine=w.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=w.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},o.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),w.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),w.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),w.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a);var u=a;this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.createVisual(),this.adjustVisual()},o.typeName="LineMarker",o.title="Line marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',o}(kt),ye=function(h){function o(a,u,d,c){var N=h.call(this,a,c||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return N.fonts=[],N.fontBoxes=[],N.fonts=u,N.currentFont=d,N.setCurrentFont=N.setCurrentFont.bind(N),N}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.overflow="hidden",u.style.flexGrow="2",this.fonts.forEach(function(d){var c=document.createElement("div");c.style.display="inline-block",c.style.alignItems="center",c.style.justifyContent="space-between",c.style.padding="5px",c.style.borderWidth="2px",c.style.borderStyle="solid",c.style.overflow="hidden",c.style.maxWidth=100/a.fonts.length-5+"%",c.style.borderColor=d===a.currentFont?a.uiStyleSettings.toolboxAccentColor:"transparent",c.addEventListener("click",function(){a.setCurrentFont(d,c)}),u.appendChild(c);var N=document.createElement("div");N.style.display="flex",N.style.minHeight="20px",N.style.flexGrow="2",N.style.fontFamily=d,N.style.overflow="hidden";var Re=document.createElement("div");Re.style.whiteSpace="nowrap",Re.style.overflow="hidden",Re.style.textOverflow="ellipsis",Re.innerHTML="The quick brown fox jumps over the lazy dog",N.appendChild(Re),c.appendChild(N),a.fontBoxes.push(c)}),u},o.prototype.setCurrentFont=function(a,u){var d=this;this.currentFont=a,this.fontBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},o}(Ve),Ee=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.color="transparent",c.padding=5,c.DEFAULT_TEXT="your text here",c.text=c.DEFAULT_TEXT,c.isMoved=!1,c.color=d.defaultColor,c.fontFamily=d.defaultFontFamily,c.defaultSize={x:100,y:30},c.setColor=c.setColor.bind(c),c.setFont=c.setFont.bind(c),c.renderText=c.renderText.bind(c),c.sizeText=c.sizeText.bind(c),c.textEditDivClicked=c.textEditDivClicked.bind(c),c.showTextEditor=c.showTextEditor.bind(c),c.setSize=c.setSize.bind(c),c.positionTextEditor=c.positionTextEditor.bind(c),c.colorPanel=new ze("Color",d.defaultColorSet,d.defaultColor),c.colorPanel.onColorChanged=c.setColor,c.fontFamilyPanel=new ye("Font",d.defaultFontFamilies,d.defaultFontFamily),c.fontFamilyPanel.onFontChanged=c.setFont,c}return je(o,h),o.prototype.ownsTarget=function(a){if(h.prototype.ownsTarget.call(this,a)||a===this.visual||a===this.textElement||a===this.bgRectangle)return!0;var u=!1;return this.textElement.childNodes.forEach(function(d){d===a&&(u=!0)}),u},o.prototype.createVisual=function(){this.visual=w.createGroup(),this.bgRectangle=w.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=w.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(w.createTransform()),this.textElement.transform.baseVal.appendItem(w.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.isMoved=!1,this.pointerDownPoint=a,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.renderText=function(){var a=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(u){a.textElement.appendChild(w.createTSpan(u.trim()===""?" ":u.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},o.prototype.getTextScale=function(){var a=this.textElement.getBBox(),u=1;if(a.width>0&&a.height>0){var d=(1*this.width-this.width*this.padding*2/100)/a.width,c=(1*this.height-this.height*this.padding*2/100)/a.height;u=Math.min(d,c)}return u},o.prototype.getTextPosition=function(a){var u=this.textElement.getBBox(),d=0,c=0;return u.width>0&&u.height>0&&(d=(this.width-u.width*a)/2,c=this.height/2-u.height*a/2),{x:d,y:c}},o.prototype.sizeText=function(){var a=this.textElement.getBBox(),u=this.getTextScale(),d=this.getTextPosition(u);d.y-=a.y*u,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+d.x+"px, "+d.y+"px) scale("+u+", "+u+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(d.x,d.y),this.textElement.transform.baseVal.getItem(1).setScale(u,u))},o.prototype.manipulate=function(a){h.prototype.manipulate.call(this,a),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(a.x-this.pointerDownPoint.x)>5||Math.abs(a.y-this.pointerDownPoint.y)>5)},o.prototype.resize=function(a){h.prototype.resize.call(this,a),this.isMoved=!0,this.setSize(),this.sizeText()},o.prototype.setSize=function(){h.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(w.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),w.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},o.prototype.pointerUp=function(a){var u=this.state;u==="creating"&&(this._suppressMarkerCreateEvent=!0),h.prototype.pointerUp.call(this,a),this.setSize(),(u==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},o.prototype.showTextEditor=function(){var a=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(u){u.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var u=Number.parseFloat(a.textEditor.style.fontSize);a.textEditor.clientWidth>=Number.parseInt(a.textEditor.style.maxWidth)&&u>.9;)u-=.1,a.textEditor.style.fontSize=Math.max(u,.9)+"em"}),this.textEditor.addEventListener("keyup",function(u){u.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(u){if(u.clipboardData){var d=u.clipboardData.getData("text"),c=window.getSelection();if(!c.rangeCount)return!1;c.deleteFromDocument(),c.getRangeAt(0).insertNode(document.createTextNode(d)),u.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){a.textEditDivClicked(a.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},o.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var a=this.getTextScale(),u=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),d=this.textElement.getBBox(),c={x:d.width*a,y:d.height*a};u.x-=c.x/2,u.y-=c.y/2,this.textEditor.style.top=u.y+"px",this.textEditor.style.left=u.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-u.x+"px",this.textEditor.style.fontSize=Math.max(16*a,12)+"px",this.textElement.style.display="none"}},o.prototype.textEditDivClicked=function(a){this.text=a.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},o.prototype.select=function(){h.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},o.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),h.prototype.deselect.call(this)},o.prototype.dblClick=function(a,u){h.prototype.dblClick.call(this,a,u),this.showTextEditor()},o.prototype.setColor=function(a){this.textElement&&w.setAttributes(this.textElement,[["fill",a]]),this.color=a,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(a)},o.prototype.setFont=function(a){this.textElement&&w.setAttributes(this.textElement,[["font-family",a]]),this.fontFamily=a,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},o.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},o.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){var u=a;this.color=u.color,this.fontFamily=u.fontFamily,this.padding=u.padding,this.text=u.text,this.createVisual(),h.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.setSize(),this.sizeText(),this.positionTextEditor()},o.typeName="TextMarker",o.title="Text marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',o}(nt),R=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.color="transparent",c.lineWidth=3,c.drawing=!1,c.pixelRatio=1,c.color=d.defaultColor,c.lineWidth=d.defaultStrokeWidth,c.pixelRatio=d.freehandPixelRatio,c.setColor=c.setColor.bind(c),c.addCanvas=c.addCanvas.bind(c),c.finishCreation=c.finishCreation.bind(c),c.setLineWidth=c.setLineWidth.bind(c),c.colorPanel=new ze("Color",d.defaultColorSet,d.defaultColor),c.colorPanel.onColorChanged=c.setColor,c.lineWidthPanel=new St("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.lineWidthPanel.onWidthChanged=c.setLineWidth,c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.drawingImage)},o.prototype.createVisual=function(){this.visual=w.createGroup(),this.drawingImage=w.createImage(),this.visual.appendChild(this.drawingImage);var a=w.createTransform();this.visual.transform.baseVal.appendItem(a),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(a.x,a.y),this.drawing=!0):h.prototype.pointerDown.call(this,a,u)},o.prototype.manipulate=function(a){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(a.x,a.y),this.canvasContext.stroke()):h.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){h.prototype.resize.call(this,a),w.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),w.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(a){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):h.prototype.pointerUp.call(this,a)},o.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},o.prototype.select=function(){this.state==="creating"&&this.finishCreation(),h.prototype.select.call(this)},o.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),h.prototype.deselect.call(this)},o.prototype.finishCreation=function(){for(var a=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),u=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],d=u[0],c=u[1],N=u[2],Re=u[3],Ze=!1,bt=0;bt<this.canvasElement.height;bt++)for(var Me=0;Me<this.canvasElement.width;Me++)a.data[bt*this.canvasElement.width*4+4*Me+3]>0&&(Ze=!0,bt<c&&(c=bt),Me<d&&(d=Me),bt>Re&&(Re=bt),Me>N&&(N=Me));if(Ze){this.left=d/this.pixelRatio,this.top=c/this.pixelRatio,this.width=(N-d)/this.pixelRatio,this.height=(Re-c)/this.pixelRatio;var ke=document.createElement("canvas");ke.width=N-d,ke.height=Re-c,ke.getContext("2d").putImageData(this.canvasContext.getImageData(d,c,N-d,Re-c),0,0),this.drawingImgUrl=ke.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},o.prototype.setDrawingImage=function(){w.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),w.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},o.prototype.setColor=function(a){this.color=a,this.colorChanged(a)},o.prototype.setLineWidth=function(a){this.lineWidth=a},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({drawingImgUrl:this.drawingImgUrl},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){this.createVisual(),h.prototype.restoreState.call(this,a),this.drawingImgUrl=a.drawingImgUrl,this.setDrawingImage()},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.setDrawingImage()},o.typeName="FreehandMarker",o.title="Freehand marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',o}(nt),O=function(h){function o(a,u,d){var c=h.call(this,a,d||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return c.typeBoxes=[],c.currentType=u,c.setCurrentType=c.setCurrentType.bind(c),c}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2";for(var d=function(Re){var Ze="both";switch(Re){case 0:Ze="both";break;case 1:Ze="start";break;case 2:Ze="end";break;case 3:Ze="none"}var bt=document.createElement("div");if(bt.style.display="flex",bt.style.flexGrow="2",bt.style.alignItems="center",bt.style.justifyContent="space-between",bt.style.padding="5px",bt.style.borderWidth="2px",bt.style.borderStyle="solid",bt.style.borderColor=Ze===c.currentType?c.uiStyleSettings.toolboxAccentColor:"transparent",bt.addEventListener("click",function(){a.setCurrentType(Ze,bt)}),u.appendChild(bt),Ze==="both"||Ze==="start"){var Me=document.createElement("div");Me.style.display="flex",Me.style.alignItems="center",Me.style.minHeight="20px",Me.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(c.uiStyleSettings!==void 0?c.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Me.style.marginLeft="5px",bt.appendChild(Me)}var ke=document.createElement("div");ke.style.display="flex",ke.style.alignItems="center",ke.style.minHeight="20px",ke.style.flexGrow="2";var H=document.createElement("hr");if(H.style.minWidth="20px",H.style.border="0px",H.style.borderTop="3px solid "+(c.uiStyleSettings!==void 0?c.uiStyleSettings.toolboxColor:"#eeeeee"),H.style.flexGrow="2",ke.appendChild(H),bt.appendChild(ke),Ze==="both"||Ze==="end"){var Ie=document.createElement("div");Ie.style.display="flex",Ie.style.alignItems="center",Ie.style.minHeight="20px",Ie.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(c.uiStyleSettings!==void 0?c.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ie.style.marginRight="5px",bt.appendChild(Ie)}c.typeBoxes.push(bt)},c=this,N=0;N<4;N++)d(N);return u},o.prototype.setCurrentType=function(a,u){var d=this;this.currentType=a,this.typeBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings!==void 0?d.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},o}(Ve),P=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.arrowType="end",c.arrowBaseHeight=10,c.arrowBaseWidth=10,c.getArrowPoints=c.getArrowPoints.bind(c),c.setArrowType=c.setArrowType.bind(c),c.arrowTypePanel=new O("Arrow type","end"),c.arrowTypePanel.onArrowTypeChanged=c.setArrowType,c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.arrow1&&a!==this.arrow2)},o.prototype.getArrowPoints=function(a,u){var d=this.arrowBaseWidth+2*this.strokeWidth,c=this.arrowBaseHeight+2*this.strokeWidth;return a-d/2+","+(u+c/2)+" "+a+","+(u-c/2)+" "+(a+d/2)+","+(u+c/2)},o.prototype.createTips=function(){this.arrow1=w.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(w.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=w.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(w.createTransform()),this.visual.appendChild(this.arrow2)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(h.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",w.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),w.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),u=this.arrow1.transform.baseVal.getItem(0);u.setRotate(a,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(u,0);var d=this.arrow2.transform.baseVal.getItem(0);d.setRotate(a+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(d,0)}},o.prototype.setArrowType=function(a){this.arrowType=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({arrowType:this.arrowType},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a);var u=a;this.arrowType=u.arrowType,this.createTips(),this.adjustVisual()},o.typeName="ArrowMarker",o.title="Arrow marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',o}(ht),y=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.fillColor=d.defaultFillColor,c.strokeWidth=0,c.fillPanel=new ze("Color",d.defaultColorSet,d.defaultFillColor),c.fillPanel.onColorChanged=c.setFillColor,c}return je(o,h),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=h.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="CoverMarker",o.title="Cover marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',o}(ct),_=function(h){function o(a,u,d,c){var N=h.call(this,a,c||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return N.opacities=[],N.opacityBoxes=[],N.opacities=u,N.currentOpacity=d,N.setCurrentOpacity=N.setCurrentOpacity.bind(N),N}return je(o,h),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",u.style.justifyContent="space-between",this.opacities.forEach(function(d){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.justifyContent="center",c.style.padding="5px",c.style.borderWidth="2px",c.style.borderStyle="solid",c.style.borderColor=d===a.currentOpacity?a.uiStyleSettings.toolboxAccentColor:"transparent",c.addEventListener("click",function(){a.setCurrentOpacity(d,c)}),u.appendChild(c);var N=document.createElement("div");N.innerText=100*d+"%",c.appendChild(N),a.opacityBoxes.push(c)}),u},o.prototype.setCurrentOpacity=function(a,u){var d=this;this.currentOpacity=a,this.opacityBoxes.forEach(function(c){c.style.borderColor=c===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},o}(Ve),C=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.setOpacity=c.setOpacity.bind(c),c.fillColor=d.defaultHighlightColor,c.strokeWidth=0,c.opacity=d.defaultHighlightOpacity,c.fillPanel=new ze("Color",d.defaultColorSet,c.fillColor),c.fillPanel.onColorChanged=c.setFillColor,c.opacityPanel=new _("Opacity",d.defaultOpacitySteps,c.opacity),c.opacityPanel.onOpacityChanged=c.setOpacity,c}return je(o,h),o.prototype.setOpacity=function(a){this.opacity=a,this.visual&&w.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=h.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="HighlightMarker",o.title="Highlight marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',o}(y),E='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',te=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.bgColor="transparent",c.tipPosition={x:0,y:0},c.tipBase1Position={x:0,y:0},c.tipBase2Position={x:0,y:0},c.tipMoving=!1,c.color=d.defaultStrokeColor,c.bgColor=d.defaultFillColor,c.fontFamily=d.defaultFontFamily,c.defaultSize={x:100,y:30},c.setBgColor=c.setBgColor.bind(c),c.getTipPoints=c.getTipPoints.bind(c),c.positionTip=c.positionTip.bind(c),c.setTipPoints=c.setTipPoints.bind(c),c.colorPanel=new ze("Text color",d.defaultColorSet,c.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),c.colorPanel.onColorChanged=c.setColor,c.bgColorPanel=new ze("Fill color",d.defaultColorSet,c.bgColor,E),c.bgColorPanel.onColorChanged=c.setBgColor,c.fontFamilyPanel=new ye("Font",d.defaultFontFamilies,d.defaultFontFamily),c.fontFamilyPanel.onFontChanged=c.setFont,c.tipGrip=new Et,c.tipGrip.visual.transform.baseVal.appendItem(w.createTransform()),c.controlBox.appendChild(c.tipGrip.visual),c}return je(o,h),o.prototype.ownsTarget=function(a){return h.prototype.ownsTarget.call(this,a)||this.tipGrip.ownsTarget(a)||this.tip===a},o.prototype.createTip=function(){w.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=w.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},o.prototype.pointerDown=function(a,u){this.state==="new"&&h.prototype.pointerDown.call(this,a,u),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(u)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):h.prototype.pointerDown.call(this,a,u)},o.prototype.pointerUp=function(a){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,h.prototype.pointerUp.call(this,a);else{var u=this.state==="creating";h.prototype.pointerUp.call(this,a),this.setTipPoints(u),this.positionTip()}},o.prototype.manipulate=function(a){if(this.tipMoving){var u=this.unrotatePoint(a);this.tipPosition={x:u.x-this.manipulationStartLeft,y:u.y-this.manipulationStartTop},this.positionTip()}else h.prototype.manipulate.call(this,a)},o.prototype.setBgColor=function(a){this.bgRectangle&&this.tip&&(w.setAttributes(this.bgRectangle,[["fill",a]]),w.setAttributes(this.tip,[["fill",a]])),this.bgColor=a,this.fillColorChanged(a)},o.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},o.prototype.setTipPoints=function(a){a===void 0&&(a=!1);var u=Math.min(this.height/2,15),d=this.height/5;a&&(this.tipPosition={x:u+d/2,y:this.height+20});var c=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?c<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(d=this.width/5,u=Math.min(this.width/2,15),this.tipBase1Position={x:u,y:0},this.tipBase2Position={x:u+d,y:0}):(this.tipBase1Position={x:0,y:u},this.tipBase2Position={x:0,y:u+d}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?c<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(d=this.width/5,u=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-u-d,y:0},this.tipBase2Position={x:this.width-u,y:0}):(this.tipBase1Position={x:this.width,y:u},this.tipBase2Position={x:this.width,y:u+d}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?c<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(d=this.width/5,u=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-u-d,y:this.height},this.tipBase2Position={x:this.width-u,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-u-d},this.tipBase2Position={x:this.width,y:this.height-u}):c<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(d=this.width/5,u=Math.min(this.width/2,15),this.tipBase1Position={x:u,y:this.height},this.tipBase2Position={x:u+d,y:this.height}):(this.tipBase1Position={x:0,y:this.height-u},this.tipBase2Position={x:0,y:this.height-u-d})},o.prototype.resize=function(a){h.prototype.resize.call(this,a),this.positionTip()},o.prototype.positionTip=function(){w.setAttributes(this.tip,[["points",this.getTipPoints()]]);var a=this.tipGrip.visual.transform.baseVal.getItem(0);a.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(a,0)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.select=function(){this.positionTip(),h.prototype.select.call(this)},o.prototype.getState=function(){var a=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){var u=a;this.bgColor=u.bgColor,this.tipPosition=u.tipPosition,h.prototype.restoreState.call(this,a),this.createTip(),this.setTipPoints()},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.tipPosition={x:this.tipPosition.x*a,y:this.tipPosition.y*u},this.positionTip()},o.typeName="CalloutMarker",o.title="Callout marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',o}(Ee),F=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.fillColor="transparent",c.strokeColor="transparent",c.strokeWidth=0,c.strokeDasharray="",c.opacity=1,c.strokeColor=d.defaultColor,c.strokeWidth=d.defaultStrokeWidth,c.strokeDasharray=d.defaultStrokeDasharray,c.fillColor=d.defaultFillColor,c.setStrokeColor=c.setStrokeColor.bind(c),c.setFillColor=c.setFillColor.bind(c),c.setStrokeWidth=c.setStrokeWidth.bind(c),c.setStrokeDasharray=c.setStrokeDasharray.bind(c),c.setOpacity=c.setOpacity.bind(c),c.createVisual=c.createVisual.bind(c),c.strokePanel=new ze("Line color",Z(d.defaultColorSet,["transparent"]),d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.fillPanel=new ze("Fill color",Z(d.defaultColorSet,["transparent"]),c.fillColor,E),c.fillPanel.onColorChanged=c.setFillColor,c.strokeWidthPanel=new St("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new _t("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c.opacityPanel=new _("Opacity",d.defaultOpacitySteps,c.opacity),c.opacityPanel.onOpacityChanged=c.setOpacity,c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.visual)},o.prototype.createVisual=function(){this.visual=w.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.manipulate=function(a){h.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){h.prototype.resize.call(this,a),this.setSize()},o.prototype.setSize=function(){h.prototype.setSize.call(this),w.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},o.prototype.pointerUp=function(a){h.prototype.pointerUp.call(this,a),this.setSize()},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&w.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},o.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&w.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(a),this.stateChanged()},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&w.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&w.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.setOpacity=function(a){this.opacity=a,this.visual&&w.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){var u=a;this.fillColor=u.fillColor,this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.opacity=u.opacity,this.createVisual(),h.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){h.prototype.scale.call(this,a,u),this.setSize()},o.typeName="EllipseMarker",o.title="Ellipse marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(nt),ae=function(h){function o(a,u,d){return h.call(this,a,u,d)||this}return je(o,h),Object.defineProperty(o.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.tip1&&a!==this.tip2)},o.prototype.createTips=function(){this.tip1=w.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(w.createTransform()),this.visual.appendChild(this.tip1),this.tip2=w.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(w.createTransform()),this.visual.appendChild(this.tip2)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(h.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(w.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),w.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),u=this.tip1.transform.baseVal.getItem(0);u.setRotate(a,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(u,0);var d=this.tip2.transform.baseVal.getItem(0);d.setRotate(a+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(d,0)}},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=h.prototype.getState.call(this);return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a),this.createTips(),this.adjustVisual()},o.typeName="MeasurementMarker",o.title="Measurement marker",o.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',o}(ht),Ke=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.strokePanel.colors=d.defaultColorSet,c.fillColor="transparent",c}return je(o,h),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=h.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="EllipseFrameMarker",o.title="Ellipse frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(F),et=function(){function h(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(h.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),h.prototype.addUndoStep=function(o){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(o)||(this.undoStack.push(o),JSON.stringify(this.lastRedoStep)!==JSON.stringify(o)&&this.redoStack.splice(0,this.redoStack.length))},h.prototype.replaceLastUndoStep=function(o){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=o)},h.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},h.prototype.undo=function(){if(this.undoStack.length>1){var o=this.undoStack.pop();return o!==void 0&&this.redoStack.push(o),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},h.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},h}(),Ge=function(h){function o(a,u,d){var c=h.call(this,a,u,d)||this;return c.strokeColor="transparent",c.strokeWidth=0,c.strokeDasharray="",c.curveX=0,c.curveY=0,c.manipulationStartCurveX=0,c.manipulationStartCurveY=0,c.setStrokeColor=c.setStrokeColor.bind(c),c.setStrokeWidth=c.setStrokeWidth.bind(c),c.setStrokeDasharray=c.setStrokeDasharray.bind(c),c.positionGrips=c.positionGrips.bind(c),c.addControlGrips=c.addControlGrips.bind(c),c.adjustVisual=c.adjustVisual.bind(c),c.setupControlBox=c.setupControlBox.bind(c),c.resize=c.resize.bind(c),c.strokeColor=d.defaultColor,c.strokeWidth=d.defaultStrokeWidth,c.strokeDasharray=d.defaultStrokeDasharray,c.strokePanel=new ze("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new St("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new _t("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return je(o,h),o.prototype.ownsTarget=function(a){return!(!h.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorCurve&&a!==this.visibleCurve&&!this.curveGrip.ownsTarget(a))},o.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},o.prototype.createVisual=function(){this.visual=w.createGroup(),this.selectorCurve=w.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=w.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){h.prototype.pointerDown.call(this,a,u),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=a.x,this.curveY=a.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(u)&&(this.activeGrip=this.curveGrip,this._state="resize")},o.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),w.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),w.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),w.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setupControlBox=function(){h.prototype.setupControlBox.call(this),this.curveControlLine1=w.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=w.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},o.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,h.prototype.addControlGrips.call(this)},o.prototype.positionGrips=function(){h.prototype.positionGrips.call(this);var a=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-a/2,this.curveY-a/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},o.prototype.manipulate=function(a){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+a.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+a.y-this.manipulationStartY),h.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){this.activeGrip===this.curveGrip&&(this.curveX=a.x,this.curveY=a.y),h.prototype.resize.call(this,a),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual()},o.prototype.scale=function(a,u){this.curveX=this.curveX*a,this.curveY=this.curveY*u,h.prototype.scale.call(this,a,u)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},h.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){h.prototype.restoreState.call(this,a);var u=a;this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.curveX=u.curveX,this.curveY=u.curveY,this.createVisual(),this.adjustVisual()},o.typeName="CurveMarker",o.title="Curve marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',o}(kt),mt=function(){function h(o,a){a===void 0&&(a=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=o,this.cancelable=a}return Object.defineProperty(h.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),h.prototype.preventDefault=function(){this._defaultPrevented=!0},h}(),Ot=function(h){function o(a,u,d){var c=h.call(this,a,!1)||this;return c.dataUrl=u,c.state=d,c}return je(o,h),o}(mt),Ye=function(h){function o(a,u,d){d===void 0&&(d=!1);var c=h.call(this,a,d)||this;return c.marker=u,c}return je(o,h),o}(mt),Bt=function(){function h(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return h.prototype.addEventListener=function(o,a){this[o].push(a)},h.prototype.removeEventListener=function(o,a){var u=this[o].indexOf(a);u>-1&&this[o].splice(u,1)},h}(),Mt=function(){function h(o){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new me,this._isOpen=!1,this.undoRedoManager=new et,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Bt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=h.instanceCounter++,this.styles=new Je(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=o,this.targetRoot=document.body,this.width=o.clientWidth,this.height=o.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(h.prototype,"ALL_MARKER_TYPES",{get:function(){return[pt,R,P,Ee,Ke,F,C,te,ae,y,ht,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[pt,R,P,Ee,F,C,te]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"BASIC_MARKER_TYPES",{get:function(){return[pt,R,P,Ee,C]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(o){var a=this;this._availableMarkerTypes.splice(0),o.forEach(function(u){if(typeof u=="string"){var d=a.ALL_MARKER_TYPES.find(function(c){return c.typeName===u});d!==void 0&&a._availableMarkerTypes.push(d)}else a._availableMarkerTypes.push(u)})},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(o){this._zoomLevel=o,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),h.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Be.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},h.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&wt.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=wt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(a){return a(new mt(o))})},h.prototype.render=function(){return Se(this,void 0,void 0,function(){var o;return Oe(this,function(a){switch(a.label){case 0:return this.setCurrentMarker(),(o=new ut).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.markersOnly=this.renderMarkersOnly,o.width=this.renderWidth,o.height=this.renderHeight,[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return a.sent(),[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,a.sent()]}})})},h.prototype.close=function(o){var a=this;if(o===void 0&&(o=!1),this.isOpen){var u=!1;o||this.eventListeners.beforeclose.forEach(function(d){var c=new mt(a,!0);d(c),c.defaultPrevented&&(u=!0)}),u||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(d){return d(new mt(a))}),this.detachEvents(),this._isOpen=!1)}},h.prototype.addMarkersToToolbar=function(){for(var o,a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];(o=this._availableMarkerTypes).push.apply(o,a)},h.prototype.addRenderEventListener=function(o){this.addEventListener("render",function(a){o(a.dataUrl,a.state)})},h.prototype.removeRenderEventListener=function(o){},h.prototype.addCloseEventListener=function(o){this.addEventListener("close",function(){o()})},h.prototype.removeCloseEventListener=function(o){},h.prototype.setupResizeObserver=function(){var o=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return o.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},h.prototype.onPopupTargetResize=function(){var o=1*this.target.clientWidth/this.target.clientHeight,a=this.editorCanvas.clientWidth/o>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*o:this.editorCanvas.clientWidth,u=a<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/o;this.resize(a,u)},h.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},h.prototype.resize=function(o,a){this._isResizing=!0;var u=o/this.imageWidth,d=a/this.imageHeight;this.imageWidth=Math.round(o),this.imageHeight=Math.round(a),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(u,d),this._isResizing=!1},h.prototype.scaleMarkers=function(o,a){var u,d=this;this._currentMarker&&this._currentMarker instanceof Ee?this._currentMarker.scale(o,a):(u=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(c){c!==d._currentMarker&&c.scale(o,a)}),u!==void 0&&this.setCurrentMarker(u)},h.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},h.prototype.setTopLeft=function(){var o=this.editingTarget.getBoundingClientRect(),a=this.editorCanvas.getBoundingClientRect();this.left=o.left-a.left,this.top=o.top-a.top},h.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},h.prototype.addDefs=function(){for(var o,a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];this.defs=w.createDefs(),this.addDefsToImage(),(o=this.defs).append.apply(o,a)},h.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},h.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},h.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},h.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},h.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},h.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},h.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},h.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var o=document.createElement("a");o.href="https://markerjs.com/",o.target="_blank",o.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',o.title="Powered by marker.js",o.style.display="grid",o.style.alignItems="center",o.style.justifyItems="center",o.style.padding="3px",o.style.width="20px",o.style.height="20px",this.logoUI.appendChild(o),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},h.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},h.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},h.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},h.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new De(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new We(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},h.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},h.prototype.removeMarker=function(o){this.markerImage.removeChild(o.container),this.markers.indexOf(o)>-1&&this.markers.splice(this.markers.indexOf(o),1),o.dispose()},h.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},h.prototype.toolbarButtonClicked=function(o,a){if(o==="marker"&&a!==void 0)this.createNewMarker(a);else if(o==="action")switch(a){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},h.prototype.deleteSelectedMarker=function(){var o=this;if(this._currentMarker!==void 0){var a=!1;if(this.eventListeners.markerbeforedelete.forEach(function(d){var c=new Ye(o,o._currentMarker,!0);d(c),c.defaultPrevented&&(a=!0)}),!a){var u=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(d){return d(new Ye(o,u))})}}},h.prototype.clear=function(){var o=this,a=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(N){var Re=new Ye(o,void 0,!0);N(Re),Re.defaultPrevented&&(a=!0)}),!a)){this.setCurrentMarker();for(var u=function(N){var Re=d.markers[N];d.setCurrentMarker(d.markers[N]),d._currentMarker.dispose(),d.markerImage.removeChild(d._currentMarker.container),d.markers.splice(d.markers.indexOf(d._currentMarker),1),d.eventListeners.markerdelete.forEach(function(Ze){return Ze(new Ye(o,Re))})},d=this,c=this.markers.length-1;c>=0;c--)u(c);this.addUndoStep()}},Object.defineProperty(h.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),h.prototype.showNotesEditor=function(){var o;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(o=this._currentMarker.notes)!==null&&o!==void 0?o:"",this.overlayContainer.appendChild(this.notesArea))},h.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},h.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},h.prototype.addUndoStep=function(){var o=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var a=this.getState(),u=this.undoRedoManager.getLastUndoStep();if(!u||u.width===a.width&&u.height===a.height){var d=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(a),d<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(c){return c(new mt(o))})}else this.undoRedoManager.replaceLastUndoStep(a),this.eventListeners.statechange.forEach(function(c){return c(new mt(o))})}},h.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},h.prototype.undoStep=function(){var o=this,a=this.undoRedoManager.undo();a!==void 0&&(this.restoreState(a),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(u){return u(new mt(o))}))},h.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},h.prototype.redoStep=function(){var o=this,a=this.undoRedoManager.redo();a!==void 0&&(this.restoreState(a),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(u){return u(new mt(o))}))},h.prototype.stepZoom=function(){var o=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=o<this.zoomSteps.length-1?this.zoomSteps[o+1]:this.zoomSteps[0]},h.prototype.panTo=function(o){this.contentDiv.scrollBy({left:this.prevPanPoint.x-o.x,top:this.prevPanPoint.y-o.y}),this.prevPanPoint=o},h.prototype.startRenderAndClose=function(){return Se(this,void 0,void 0,function(){var o,a,u=this;return Oe(this,function(d){switch(d.label){case 0:return[4,this.render()];case 1:return o=d.sent(),a=this.getState(),this.eventListeners.render.forEach(function(c){return c(new Ot(u,o,a))}),this.close(!0),[2]}})})},h.prototype.getState=function(o){o===!0&&this.setCurrentMarker();var a={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(u){return a.markers.push(u.getState())}),a},h.prototype.restoreState=function(o){var a=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);o.markers.forEach(function(u){var d=a._availableMarkerTypes.find(function(N){return N.typeName===u.typeName});if(d!==void 0){var c=a.addNewMarker(d);c.restoreState(u),a.markers.push(c)}}),o.width&&o.height&&(o.width!==this.imageWidth||o.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/o.width,this.imageHeight/o.height),this.eventListeners.restorestate.forEach(function(u){return u(new mt(a))})},h.prototype.addNewMarker=function(o){var a=w.createGroup();return this.markerImage.appendChild(a),new o(a,this.overlayContainer,this.settings)},h.prototype.createNewMarker=function(o){var a,u=this;(a=typeof o=="string"?this._availableMarkerTypes.find(function(d){return d.typeName===o}):o)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(a),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(a.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(d){return d(new Ye(u,u._currentMarker))}))},h.prototype.markerCreated=function(o){var a=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(o),this.setCurrentMarker(o),o instanceof R&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(R):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(u){return u(new Ye(a,a._currentMarker))})},h.prototype.colorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=o,this.settings.defaultStrokeColor=o)},h.prototype.fillColorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=o)},h.prototype.markerStateChanged=function(o){var a=this;this.eventListeners.markerchange.forEach(function(u){return u(new Ye(a,o))})},h.prototype.setCurrentMarker=function(o){var a=this;this._currentMarker!==o&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(u){return u(new Ye(a,a._currentMarker))})),this._currentMarker=o,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(u){return u(new Ye(a,a._currentMarker))}))},h.prototype.onPointerDown=function(o){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||o.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var a=this.markers.find(function(u){return u.ownsTarget(o.target)});a!==void 0?(this.setCurrentMarker(a),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:o.clientX,y:o.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY))},h.prototype.onDblClick=function(o){if(this._isFocused||this.focus(),this.mode==="select"){var a=this.markers.find(function(u){return u.ownsTarget(o.target)});a!==void 0&&a!==this._currentMarker&&this.setCurrentMarker(a),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target):this.setCurrentMarker()}},h.prototype.onPointerMove=function(o){this.touchPoints!==1&&o.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||o.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(o.clientX,o.clientY)):this.zoomLevel>1&&this.panTo({x:o.clientX,y:o.clientY}))},h.prototype.onPointerUp=function(o){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(o.clientX,o.clientY)),this.isDragging=!1,this.addUndoStep()},h.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},h.prototype.onKeyUp=function(o){this._currentMarker===void 0||this.notesArea!==void 0||o.key!=="Delete"&&o.key!=="Backspace"||this.deleteSelectedMarker()},h.prototype.clientToLocalCoordinates=function(o,a){var u=this.markerImage.getBoundingClientRect();return{x:(o-u.left)/this.zoomLevel,y:(a-u.top)/this.zoomLevel}},h.prototype.onWindowResize=function(){this.positionUI()},h.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},h.prototype.addLicenseKey=function(o){Be.addKey(o)},h.prototype.addEventListener=function(o,a){this.eventListeners.addEventListener(o,a)},h.prototype.removeEventListener=function(o,a){this.eventListeners.removeEventListener(o,a)},h.prototype.renderState=function(o){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(o),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(h.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),h.prototype.focus=function(){var o=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(a){return a(new mt(o))}))},h.prototype.blur=function(){var o=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(a){return a(new mt(o))}))},h.instanceCounter=0,h}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Ft=function(h,o){return(Ft=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(a[d]=u[d])})(h,o)};function Nt(h,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function a(){this.constructor=h}Ft(h,o),h.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function vt(h,o,a,u){return new(a||(a=Promise))(function(d,c){function N(bt){try{Ze(u.next(bt))}catch(Me){c(Me)}}function Re(bt){try{Ze(u.throw(bt))}catch(Me){c(Me)}}function Ze(bt){var Me;bt.done?d(bt.value):(Me=bt.value,Me instanceof a?Me:new a(function(ke){ke(Me)})).then(N,Re)}Ze((u=u.apply(h,o||[])).next())})}function Gt(h,o){var a,u,d,c,N={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return c={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function Re(Ze){return function(bt){return function(Me){if(a)throw new TypeError("Generator is already executing.");for(;N;)try{if(a=1,u&&(d=2&Me[0]?u.return:Me[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,Me[1])).done)return d;switch(u=0,d&&(Me=[2&Me[0],d.value]),Me[0]){case 0:case 1:d=Me;break;case 4:return N.label++,{value:Me[1],done:!1};case 5:N.label++,u=Me[1],Me=[0];continue;case 7:Me=N.ops.pop(),N.trys.pop();continue;default:if(!(d=N.trys,(d=d.length>0&&d[d.length-1])||Me[0]!==6&&Me[0]!==2)){N=0;continue}if(Me[0]===3&&(!d||Me[1]>d[0]&&Me[1]<d[3])){N.label=Me[1];break}if(Me[0]===6&&N.label<d[1]){N.label=d[1],d=Me;break}if(d&&N.label<d[2]){N.label=d[2],N.ops.push(Me);break}d[2]&&N.ops.pop(),N.trys.pop();continue}Me=o.call(h,N)}catch(ke){Me=[6,ke],u=0}finally{a=d=0}if(5&Me[0])throw Me[1];return{value:Me[0]?Me[1]:void 0,done:!0}}([Ze,bt])}}}var Wt=function(){function h(){}return h.addKey=function(o){h.key=o},Object.defineProperty(h,"isLicensed",{get:function(){return!!h.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(h.key)},enumerable:!1,configurable:!0}),h}(),He=function(){function h(){}return h.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},h.setAttributes=function(o,a){for(var u=0,d=a;u<d.length;u++){var c=d[u],N=c[0],Re=c[1];o.setAttribute(N,Re)}},h.createRect=function(o,a,u){var d=document.createElementNS("http://www.w3.org/2000/svg","rect");return d.setAttribute("width",o.toString()),d.setAttribute("height",a.toString()),u&&h.setAttributes(d,u),d},h.createLine=function(o,a,u,d,c){var N=document.createElementNS("http://www.w3.org/2000/svg","line");return N.setAttribute("x1",o.toString()),N.setAttribute("y1",a.toString()),N.setAttribute("x2",u.toString()),N.setAttribute("y2",d.toString()),c&&h.setAttributes(N,c),N},h.createPolygon=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","polygon");return u.setAttribute("points",o),a&&h.setAttributes(u,a),u},h.createCircle=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","circle");return u.setAttribute("cx",(o/2).toString()),u.setAttribute("cy",(o/2).toString()),u.setAttribute("r",o.toString()),a&&h.setAttributes(u,a),u},h.createEllipse=function(o,a,u){var d=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return d.setAttribute("cx",(o/2).toString()),d.setAttribute("cy",(a/2).toString()),d.setAttribute("rx",(o/2).toString()),d.setAttribute("ry",(a/2).toString()),u&&h.setAttributes(d,u),d},h.createGroup=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&h.setAttributes(a,o),a},h.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},h.createMarker=function(o,a,u,d,c,N,Re){var Ze=document.createElementNS("http://www.w3.org/2000/svg","marker");return h.setAttributes(Ze,[["id",o],["orient",a],["markerWidth",u.toString()],["markerHeight",d.toString()],["refX",c.toString()],["refY",N.toString()]]),Ze.appendChild(Re),Ze},h.createText=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","text");return a.setAttribute("x","0"),a.setAttribute("y","0"),o&&h.setAttributes(a,o),a},h.createTSpan=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","tspan");return u.textContent=o,a&&h.setAttributes(u,a),u},h.createImage=function(o){var a=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&h.setAttributes(a,o),a},h.createPoint=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return u.x=o,u.y=a,u},h.createPath=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),a&&h.setAttributes(u,a),u},h.createElement=function(o,a){var u=document.createElementNS("http://www.w3.org/2000/svg",o);return a&&h.setAttributes(u,a),u},h.getHollowRectanglePath=function(o,a,u,d,c,N,Re,Ze){return"M"+o+","+a+"V"+(a+d)+"H"+(o+u)+"V"+a+"H"+c+"V"+N+"H"+(c+Re)+"V"+(N+Ze)+"H"+c+"V"+a+"Z"},h}(),yt=function(){function h(o){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(h.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),h.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},h.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},h.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new dt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new dt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new dt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ct("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ct("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},h.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},h}(),dt=function(h,o){this.selector=h,this.style=o},Ct=function(h,o){this.localName=h,this.style=o},Yt=function(){function h(){this.blocks=[],this.display=""}return h.prototype.addButtonBlock=function(o){o.className=this.blockClassName,o.buttonClassName=this.buttonClassName,o.buttonColorsClassName=this.buttonColorsClassName,o.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(o)},h.prototype.addElementBlock=function(o){o.className===void 0&&(o.className=this.blockClassName),this.blocks.push(o)},h.prototype.getUI=function(){var o=document.createElement("div");return o.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,o.style.display=this.display,this.blocks.forEach(function(a){return o.appendChild(a.getUI())}),o},h}(),Vt=function(){function h(){}return h.prototype.getUI=function(){var o=document.createElement("div");if(o.className=this.className,this.minWidth!==void 0&&(o.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":o.style.justifyContent="flex-start";break;case"center":o.style.justifyContent="center";break;case"end":o.style.justifyContent="flex-end"}return o.style.whiteSpace="nowrap",o},h}(),ln=function(h){function o(){var a=h!==null&&h.apply(this,arguments)||this;return a.buttons=[],a}return Nt(o,h),o.prototype.addButton=function(a){a.className=this.buttonClassName,a.colorsClassName=this.buttonColorsClassName,a.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(a)},o.prototype.getUI=function(){var a=h.prototype.getUI.call(this);return this.buttons.forEach(function(u){return a.appendChild(u.getUI())}),a},o}(Vt),Ht=function(){function h(o,a){this._isActive=!1,this._isHidden=!1,this._icon=o,this.title=a,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(h.prototype,"icon",{get:function(){return this._icon},set:function(o){this._icon=o,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isActive",{get:function(){return this._isActive},set:function(o){this._isActive=o,this.adjustClassName()},enumerable:!1,configurable:!0}),h.prototype.getUI=function(){var o=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return o.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},h.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},h.prototype.hide=function(){this._isHidden=!0},h}(),gt=function(h){function o(){var a=h!==null&&h.apply(this,arguments)||this;return a.elements=[],a}return Nt(o,h),o.prototype.addElement=function(a){this.elements.push(a)},o.prototype.getUI=function(){var a=h.prototype.getUI.call(this);return this.elements.forEach(function(u){return a.appendChild(u)}),a},o}(Vt),qt=function(){function h(o,a){this.horizontal=o,this.vertical=a}return Object.defineProperty(h.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),h.prototype.getVerticalLength=function(o){return o/this.ratio},h.prototype.getHorizontalLength=function(o){return o*this.ratio},h}(),Pt=function(){function h(){}return h.getIcon=function(o,a){if(o>0&&a>0){var u=new qt(o,a),d=u.ratio>=1?20:u.getHorizontalLength(20),c=u.ratio<1?20:u.getVerticalLength(20),N=document.createElementNS("http://www.w3.org/2000/svg","svg");N.setAttribute("xmlns","http://www.w3.org/2000/svg"),N.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(N);var Re=He.createDefs();N.appendChild(Re);var Ze=He.createElement("clipPath",[["id","text-bg-clip"]]);Re.appendChild(Ze);var bt=He.createPath(He.getHollowRectanglePath((24-d)/2,(24-c)/2,d,c,(24-d)/2+2,(24-c)/2+2,d-4,c-4));N.appendChild(bt);var Me=He.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Me.appendChild(He.createTSpan(o+":"+a)),N.appendChild(Me);var ke=Me.getBBox();He.setAttributes(Me,[["x",((24-ke.width)/2).toString()],["y",((24-ke.height)/2-ke.y).toString()]]);var H=He.createPath(He.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(ke.width))/2,(24-Math.ceil(ke.height))/2,Math.ceil(ke.width),Math.ceil(ke.height)));return Ze.appendChild(H),He.setAttributes(bt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(N),N.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},h}(),Qt=function(h){function o(a,u,d){var c=h.call(this,a,u)||this;return c.isDropdownOpen=!1,c.onClick=c.dropdownButtonClicked,c.dropdownButtons=d,c}return Nt(o,h),o.prototype.setupDropdown=function(){var a=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(u){u.className=a.className,u.colorsClassName=a.colorsClassName,a.dropdownBlock.appendChild(u.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},o.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},o.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},o.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},o.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},o.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},o}(Ht),Lt=function(){function h(o,a){this.GRIP_SIZE=10,this.color=o,this.fillColor=a,this.visual=He.createGroup(),this.visual.appendChild(He.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(He.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return h.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},h.prototype.setCenter=function(o,a){this.visual.childNodes.forEach(function(u){return He.setAttributes(u,[["cx",o.toString()],["cy",a.toString()]])})},h}(),gn=function(){function h(o,a,u,d){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=o,this.canvasHeight=a,this.margin=u,this.container=d,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(h.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(o){this._aspectRatio=o,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.gridContainer&&He.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(o){this._zoomFactor=o,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),h.prototype.open=function(){var o=this;this.cropShadeElement=He.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=He.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var a=0;a<this.numberOfGridLines;a++)this.horizontalGridLines.push(He.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(He.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(u){return o.gridContainer.appendChild(u)}),this.verticalGridLines.forEach(function(u){return o.gridContainer.appendChild(u)}),this.cropRectElement=He.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},h.prototype.setCropRectangle=function(o){this.cropRect=o;var a=Object.assign({},this.cropRect);this.zoomFactor!==1&&(a.width=this.cropRect.width*this.zoomFactor,a.height=this.cropRect.height*this.zoomFactor,a.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-a.width/2,a.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-a.height/2),He.setAttributes(this.cropRectElement,[["x",a.x.toString()],["y",a.y.toString()],["width",a.width.toString()],["height",a.height.toString()]]);var u=a.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(c,N){var Re=a.y+u*(N+1);He.setAttributes(c,[["x1",""+a.x],["y1",""+Re],["x2",""+(a.x+a.width)],["y2",""+Re]])});var d=a.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(c,N){var Re=a.x+d*(N+1);He.setAttributes(c,[["x1",""+Re],["y1",""+a.y],["x2",""+Re],["y2",""+(a.y+a.height)]])}),He.setAttributes(this.cropShadeElement,[["d",He.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,a.x,a.y,a.width,a.height)]]),this.topLeftGrip.setCenter(a.x,a.y),this.topRightGrip.setCenter(a.x+a.width,a.y),this.bottomLeftGrip.setCenter(a.x,a.y+a.height),this.bottomRightGrip.setCenter(a.x+a.width,a.y+a.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},h.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},h.prototype.clientToLocalCoordinates=function(o,a){var u=this.container.getBoundingClientRect();return{x:o-u.left+this.margin,y:a-u.top+this.margin}},h.prototype.onPointerDown=function(o){this.container.setPointerCapture(o.pointerId),this.previousPoint=this.clientToLocalCoordinates(o.clientX,o.clientY),this.cropRectElement===o.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(o.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(o.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(o.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(o.target)&&(this.activeGrip=this.bottomRightGrip)},h.prototype.onPointerMove=function(o){if(this.isMoving)this.move(this.clientToLocalCoordinates(o.clientX,o.clientY));else if(this.activeGrip){var a=this.clientToLocalCoordinates(o.clientX,o.clientY);this.resize(a)}o.preventDefault()},h.prototype.onPointerUp=function(o){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(o.pointerId)},h.prototype.move=function(o){var a=o.x-this.previousPoint.x,u=o.y-this.previousPoint.y;this.zoomFactor!==1&&(a=-a/this.zoomFactor,u=-u/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+a),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+u),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=o},h.prototype.resize=function(o){var a=Object.assign({},this.cropRect),u=o.x-this.previousPoint.x,d=o.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:a.x+u<this.margin&&(u=this.margin-a.x),a.x+=u,a.width=this.cropRect.x+this.cropRect.width-a.x;break;case this.bottomRightGrip:case this.topRightGrip:a.width+u>this.canvasWidth*this.zoomFactor&&(u=this.canvasWidth*this.zoomFactor-a.width),a.width+=u}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(a.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(u),a.height=this.aspectRatio.getVerticalLength(a.width)):(a.y+=d,a.height=this.cropRect.y+this.cropRect.height-a.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?a.height=this.aspectRatio.getVerticalLength(a.width):a.height+=d}a.width<10&&(a.x=this.cropRect.x,a.width=10),a.height<10&&(a.y=this.cropRect.y,a.height=10),this.previousPoint=o,a.x>=this.margin&&a.y>=this.margin&&a.x-this.margin+a.width<=this.canvasWidth&&a.y-this.margin+a.height<=this.canvasHeight&&(this.cropRect=a,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},h.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var o=this.cropRect.x+this.cropRect.width/2,a=this.cropRect.y+this.cropRect.height/2,u=this.aspectRatio.getHorizontalLength(this.cropRect.height),d=this.aspectRatio.getVerticalLength(this.cropRect.width);u/this.canvasWidth<d/this.canvasHeight?this.cropRect.width=u:this.cropRect.height=d,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=o-this.cropRect.width/2,this.cropRect.y=a-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},h.prototype.getRescaledRect=function(o,a,u,d,c,N){var Re=u/o,Ze=d/a;return{x:(c.x-N)*Re+N,y:(c.y-N)*Ze+N,width:c.width*Re,height:c.height*Ze}},h.prototype.scaleCanvas=function(o,a){var u=this.getRescaledRect(this.canvasWidth,this.canvasHeight,o,a,this.cropRect,this.margin);this.canvasWidth=o,this.canvasHeight=a,this.onCropChange&&this.onCropChange(u),this.setCropRectangle(u)},h}(),$n=function(){function h(o){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=o,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(h.prototype,"angle",{get:function(){return this._angle},set:function(o){this._angle=o,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),h.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},h.prototype.onPointerDown=function(o){this.controlContainer.setPointerCapture(o.pointerId),this.isDragging=!0,this.previousPoint={x:o.clientX,y:o.clientY}},h.prototype.onPointerMove=function(o){this.isDragging&&(this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.previousPoint.x=o.clientX)},h.prototype.onPointerUp=function(o){this.isDragging&&this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(o.pointerId)},h.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var o=this.angleLabelText.getBBox();He.setAttributes(this.angleLabelElement,[["x",((this.width-o.width)/2).toString()],["y",(this.height/2).toString()]])}},h.prototype.positionScaleShape=function(){if(this.scaleShape){var o=this.scaleShape.transform.baseVal.getItem(0);o.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(o,0)}},h.prototype.getVisual=function(){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("width",this.width+"px"),o.setAttribute("height",this.height+"px"),o.setAttribute("viewBox","0 0 "+this.width+" "+this.height),o.style.flexShrink="0",document.body.appendChild(o);for(var a="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,u=1;u<=this.width/5+10;u++){var d=u%5==0?this.height/3:this.height/6;a+="h4v"+-d+"h1v"+d}a+="v1H0Z",this.scaleShape=He.createPath(a);var c=He.createTransform();this.scaleShape.transform.baseVal.appendItem(c),o.appendChild(this.scaleShape),this.angleLabelElement=He.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=He.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var N=He.createTSpan("");return N.innerHTML="°",this.angleLabelElement.appendChild(N),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},h}(),si=function(){function h(){this.naturalSize=!1,this.imageType="image/png"}return h.prototype.rasterize=function(o,a,u,d,c,N,Re){var Ze=this;return new Promise(function(bt){var Me=document.createElement("canvas");Me.width=o.width.baseVal.value-2*d,Me.height=o.height.baseVal.value-2*d;var ke=1,H=1;Ze.naturalSize===!0?(ke=a.naturalWidth/(o.width.baseVal.value-2*d)/N,H=a.naturalHeight/(o.height.baseVal.value-2*d)/Re,Me.width=a.naturalWidth/N,Me.height=a.naturalHeight/Re):Ze.width!==void 0&&Ze.height!==void 0&&(ke=Ze.width/u.width,H=Ze.height/u.height,Me.width*=ke,Me.height*=H);var Ie=Me.getContext("2d");Ie.translate(Me.width/2,Me.height/2),Ie.rotate(c*Math.PI/180),Ie.scale(N,Re),Ie.translate(-Me.width/2,-Me.height/2),Ie.drawImage(a,0,0,Me.width,Me.height);var Rt=document.createElement("canvas");Rt.width=u.width*ke,Rt.height=u.height*H,Rt.getContext("2d").putImageData(Ie.getImageData((u.x-d)*ke,(u.y-d)*H,u.width*ke,u.height*H),0,0),bt(Rt.toDataURL(Ze.imageType,Ze.imageQuality))})},h}(),Ae=function(){function h(o){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=h.instanceCounter++,this.styles=new yt(this.instanceNo),this.target=o,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(h.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(o){this._zoomToCropEnabled=o,o?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"gridLines",{get:function(){return this._gridLines},set:function(o){this._gridLines=o,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(o){this._rotationAngle=o,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"aspectRatio",{get:function(){var o;return(o=this._aspectRatio)!==null&&o!==void 0?o:this.aspectRatios[0]},set:function(o){this._aspectRatio=o},enumerable:!1,configurable:!0}),h.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},h.prototype.show=function(){this.showUI(),this.open()},h.prototype.close=function(o){o===void 0&&(o=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),o||this.closeEventListeners.forEach(function(a){return a()}),this._isOpen=!1)},h.prototype.addRenderEventListener=function(o){this.renderEventListeners.push(o)},h.prototype.removeRenderEventListener=function(o){this.renderEventListeners.indexOf(o)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(o),1)},h.prototype.addCloseEventListener=function(o){this.closeEventListeners.push(o)},h.prototype.removeCloseEventListener=function(o){this.closeEventListeners.indexOf(o)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(o),1)},h.prototype.setupResizeObserver=function(){var o=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},h.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var o=1*this.target.clientWidth/this.target.clientHeight,a=this.contentDiv.clientWidth/o>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*o:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,u=a+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/o;this.resize(a,u)}},h.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},h.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",He.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},h.prototype.resize=function(o,a){this.imageWidth=Math.round(o),this.imageHeight=Math.round(a),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},h.prototype.setEditingTarget=function(){var o=document.createElement("canvas");o.width=this.target.naturalWidth,o.height=this.target.naturalHeight,o.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var a=o.toDataURL();He.setAttributes(this.editingTarget,[["href",a]]),this.setEditingTargetSize()},h.prototype.setTopLeft=function(){var o=this.target.getBoundingClientRect(),a=this.editorCanvas.getBoundingClientRect();this.left=o.left-a.left-this.CANVAS_MARGIN,this.top=o.top-a.top-this.CANVAS_MARGIN},h.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=He.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=He.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=He.createGroup(),this.editingTargetRotationScaleContainer=He.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var o=He.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(o);var a=He.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(a),this.editingTargetContainer=He.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},h.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},h.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=He.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new gn(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},h.prototype.zoomToCrop=function(){if(this.cropRect){var o=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,a=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=o+"px "+a+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-o+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-a+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},h.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},h.prototype.cropRectChanged=function(o){this.cropRect=o,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},h.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},h.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},h.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},h.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,a=this.target.offsetTop>o+this.CANVAS_MARGIN?this.target.offsetTop-(o+this.CANVAS_MARGIN):0;this.coverDiv.style.top=a+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},h.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},h.prototype.addTopToolbar=function(){var o=this;this.topToolbar=new Yt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var a=new ln;a.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(a);var u=[];this.aspectRatios.forEach(function(H){var Ie=new Ht(Pt.getIcon(H.horizontal,H.vertical),H.horizontal===0&&H.vertical===0?"FREE":H.horizontal+":"+H.vertical);Ie.onClick=function(){return o.ratioButtonClicked(H)},u.push(Ie)}),this.aspectRatioButton=new Qt(Pt.getIcon(0,0),"Aspect ratio",u),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,a.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var d=new Ht('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");d.isActive=this.isGridVisible,d.onClick=function(){o.isGridVisible=!o.isGridVisible,d.isActive=o.isGridVisible},a.addButton(d);var c=new Ht('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(c.isActive=this.zoomToCropEnabled,c.onClick=function(){o.zoomToCropEnabled=!o.zoomToCropEnabled,c.isActive=o.zoomToCropEnabled},a.addButton(c),!Wt.isLicensed){var N=new gt;this.topToolbar.addElementBlock(N);var Re=document.createElement("div");Re.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ze=document.createElement("a");Ze.style.color="currentColor",Ze.href="https://markerjs.com/products/cropro",Ze.target="_blank",Ze.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Re.appendChild(Ze),N.addElement(Re)}var bt=new ln;bt.minWidth=3*this.toolbarHeight+"px",bt.contentAlign="end",this.topToolbar.addButtonBlock(bt);var Me=new Ht('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Me.onClick=this.startRenderAndClose,bt.addButton(Me),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Me.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var ke=new Ht('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");ke.onClick=this.close,bt.addButton(ke),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(ke.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},h.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new Yt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var a=new ln;a.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(a);var u=new Ht('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");u.onClick=this.rotateLeftButtonClicked,a.addButton(u);var d=new Ht('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");d.onClick=this.rotateRightButtonClicked,a.addButton(d);var c=new gt;c.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(c),this.straightener=new $n("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(bt){o.rotateBy(bt),o.straightener.angle=o.rotationAngle},c.addElement(this.straightener.getUI());var N=new ln;N.minWidth=2*this.toolbarHeight+"px",N.contentAlign="end",this.bottomToolbar.addButtonBlock(N);var Re=new Ht('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Re.onClick=this.flipHorizontallyButtonClicked,N.addButton(Re);var Ze=new Ht('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Ze.onClick=this.flipVerticallyButtonClicked,N.addButton(Ze)},h.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},h.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Pt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},h.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new qt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},h.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},h.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},h.prototype.restoreState=function(o){if(o){var a=this.cropLayer.getRescaledRect(o.width,o.height,this.imageWidth,this.imageHeight,o.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(a),this.cropRectChanged(a),this.flippedHorizontally=o.flippedHorizontally,this.flippedVertically=o.flippedVertically,this.applyFlip(),this.rotationAngle=o.rotationAngle,this.applyRotation()}},h.prototype.clientToLocalCoordinates=function(o,a){var u=this.cropImage.getBoundingClientRect();return{x:o-u.left,y:a-u.top}},h.prototype.onWindowResize=function(){this.positionUI()},h.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var o=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},h.prototype.rotateLeftButtonClicked=function(){var o=this.rotationAngle-90;this.rotationAngle%90!=0&&(o+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(o)},h.prototype.rotateRightButtonClicked=function(){var o=this.rotationAngle+90;this.rotationAngle%90!=0&&(o-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(o)},h.prototype.rotateTo=function(o){o=(o=o>180?o-360:o)<=-180?o+360:o,this.rotationAngle=o,this.applyRotation()},h.prototype.rotateBy=function(o){this.rotateTo((this.rotationAngle+o)%360)},h.prototype.applyRotation=function(){var o=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var a=this.editingTargetRotationContainer.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(a,0);var u=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/u.width,this.imageHeight/u.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=o},h.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},h.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},h.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},h.prototype.startRenderAndClose=function(){return vt(this,void 0,void 0,function(){var o,a;return Gt(this,function(u){switch(u.label){case 0:return[4,this.render()];case 1:return o=u.sent(),a=this.getState(),this.renderEventListeners.forEach(function(d){return d(o,a)}),this.close(!0),[2]}})})},h.prototype.render=function(){return vt(this,void 0,void 0,function(){var o;return Gt(this,function(a){switch(a.label){case 0:return(o=new si).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),He.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,o.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return a.sent(),[4,o.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,a.sent()]}})})},h.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ct("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ct("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ct("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ct("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*o)+`px;
|
|
height: `+(this.toolbarHeight-2*o)+`px;
|
|
padding: `+o+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new dt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new dt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ct("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ct("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ct("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ct("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*o)+`px;
|
|
padding: `+o+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ct("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},h.instanceCounter=0,h}(),tt=x("8hTe"),dn=x.n(tt),cn=/<pre[^>]*>/g;function bn(h){var o=document.createElement("div");return o.innerHTML=h,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var _n=at.a=function(h){var o=h.value,a=o===void 0?"":o,u=h.edit,d=u===void 0?!1:u,c=h.className,N=h.showTextOnly,Re=h.showLines,Ze=h.replaces,bt=h.zoomImg,Me=h.hasMask,ke=h.style,H=ke===void 0?{}:ke,Ie=h.stylesPrev,Rt=Ie===void 0?{}:Ie,lt=String(a),Qe=Object(se.useRef)(),jt=Object(se.useRef)(),pn=Object(se.useState)(""),Jt=Object(j.a)(pn,2),fn=Jt[0],on=Jt[1],On=Object(se.useState)("office"),vn=Object(j.a)(On,2),Un=vn[0],Yn=vn[1],zn=function(){var tn=new Ae(jt.current);tn.displayMode="popup",tn.addRenderEventListener(function(){var Bn=Object(ge.a)(W.a.mark(function en(kn){var an;return W.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return Qe.current.style.display="none",wn.next=3,Object(ot.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn}});case 3:an=wn.sent,an!=null&&an.id&&Ze(jt.current.getAttribute("src").replace(Te.a.API_SERVER,""),"/api/attachments/".concat(an==null?void 0:an.id,"?type=").concat(an.content_type));case 5:case"end":return wn.stop()}},en)}));return function(en){return Bn.apply(this,arguments)}}()),tn.show()},Pn=function(){var tn=new Mt(jt.current);tn.settings.displayMode="popup",tn.addEventListener("render",function(){var Bn=Object(ge.a)(W.a.mark(function en(kn){var an;return W.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:if(Qe.current.style.display="none",!jt.current){wn.next=6;break}return wn.next=4,Object(ot.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn.dataUrl}});case 4:an=wn.sent,an!=null&&an.id&&Ze(jt.current.getAttribute("src").replace(Te.a.API_SERVER,""),"/api/attachments/".concat(an==null?void 0:an.id,"?type=").concat(an.content_type));case 6:case"end":return wn.stop()}},en)}));return function(en){return Bn.apply(this,arguments)}}()),tn.show(),window.markerArea=tn},qn=Object(se.useMemo)(function(){try{var Cn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,tn=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Bn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;lt=lt.replace(Cn,"("+Te.a.API_SERVER+"/api/attachments/").replace(tn,'"'+Te.a.API_SERVER+"/api/attachments/").replace(Bn,'"'+Te.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),lt=lt.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(gi){}var en=be(lt),kn=U();if(lt.match(/\[TOC\]/)&&(en=en.replace("<p>[TOC]</p>",v()),Ne()),en=en.replace(/(__special_katext_id_\d+__)/g,function(gi,wn){var Jn=kn[wn],Xi=Jn.type,Ki=Jn.expression;return Object(we.renderToString)(bn(Ki)||"",{displayMode:Xi==="block",throwOnError:!1,output:"html"})}),en=en.replace(/▁/g,"\u2581\u2581\u2581"),D(),N){var an=document.createElement("div");return an.innerHTML=en,an.innerText}return setTimeout(function(){return Ni()},500),en},[lt]),Hn=Object(se.useRef)();ue.WebkitLineClamp=Re,Re&&(H=Object(ve.a)(Object(ve.a)({},H),ue));function Mi(Cn){var tn=Cn.target;if(tn.tagName.toUpperCase()==="IMG"){if(bt){var Bn=tn.getAttribute("src");on(Bn),Yn("image")}}else if(tn.tagName.toUpperCase()==="A"){var en=tn.getAttribute("href");if(en.indexOf("office")>-1)Cn.preventDefault(),on(en),Yn("office");else if(en.indexOf("application/pdf")>-1)Cn.preventDefault(),on(en),Yn("pdf");else if(en.indexOf("type=text")>-1)Cn.preventDefault(),on(en),Yn("html");else if(en.startsWith("#")){Cn.preventDefault();var kn=document.getElementById(en.replace("#",""));kn&&kn.scrollIntoView(!0)}}}var Ni=function(){var tn,Bn=(tn=Hn.current)===null||tn===void 0?void 0:tn.querySelectorAll("video");Bn==null||Bn.forEach(function(en){if(en.oncontextmenu=function(){return!1},en.src.indexOf(".m3u8")>-1&&!en.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var kn=new q.a;kn.loadSource(en.src),kn.attachMedia(en)}}})};Object(se.useEffect)(function(){if(Hn.current&&qn&&(qn.match(cn)&&window.PR.prettyPrint()),Hn.current)return Hn.current.addEventListener("click",Mi),function(){Hn.current.removeEventListener("click",Mi),D(),Ne()}},[qn,Hn.current,Mi]);var dr=function(tn){if(!d)return;tn.target.nodeName==="IMG"?(Qe.current.style.display="flex",Qe.current.style.width=tn.target.clientWidth+"px",Qe.current.style.height=tn.target.clientHeight+"px",Qe.current.style.top=tn.target.offsetTop+"px",Qe.current.style.left=tn.target.offsetLeft+"px",jt.current.src=tn.target.getAttribute("src")):Qe.current.style.display="none"};return L.a.createElement("div",{style:{position:"relative"}},L.a.createElement("div",{ref:Hn,style:Object(ve.a)({},H),className:"".concat(c||""," markdown-body ").concat(dn.a.mdBody),onMouseOver:dr,dangerouslySetInnerHTML:{__html:qn}}),L.a.createElement("div",{ref:Qe,className:dn.a.button},L.a.createElement(Pe.a,null,L.a.createElement(Ce.a,{onClick:function(){return zn()}},"\u88C1\u526A"),L.a.createElement(Ce.a,{onClick:function(){return Pn()}},"\u7F16\u8F91"))),L.a.createElement("img",{ref:jt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),L.a.createElement($e.a,{close:!0,data:fn,hasMask:Me,type:fn!=null&&fn.length?Un:"",style:Object(ve.a)({},Rt),onClose:function(){return on("")}}))}},"9VGf":function(At,at,x){"use strict";x.d(at,"a",function(){return oe});var $=x("q1tI"),Pe=x.n($);function oe(Ce,ve){var ge=Object($.useRef)();Object($.useEffect)(function(){ge.current=Ce}),Object($.useEffect)(function(){function j(){ge.current()}if(ve!==null){var ee=setInterval(j,ve);return function(){return clearInterval(ee)}}},[ve])}},Bd2K:function(At,at,x){(function($){$(x("VrN/"),x("osHv"))})(function($){$.defineOption("autoCloseTags",!1,function(W,se,L){if(L!=$.Init&&L&&W.removeKeyMap("autoCloseTags"),!se)return;var I={name:"autoCloseTags"};(typeof se!="object"||se.whenClosing!==!1)&&(I["'/'"]=function(le){return ge(le)}),(typeof se!="object"||se.whenOpening!==!1)&&(I["'>'"]=function(le){return Ce(le)}),W.addKeyMap(I)});var Pe=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],oe=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Ce(W){if(W.getOption("disableInput"))return $.Pass;for(var se=W.listSelections(),L=[],I=W.getOption("autoCloseTags"),le=0;le<se.length;le++){if(!se[le].empty())return $.Pass;var z=se[le].head,V=W.getTokenAt(z),J=$.innerMode(W.getMode(),V.state),B=J.state,ce=J.mode.xmlCurrentTag&&J.mode.xmlCurrentTag(B),ne=ce&&ce.name;if(!ne)return $.Pass;var pe=J.mode.configuration=="html",Ne=typeof I=="object"&&I.dontCloseTags||pe&&Pe,ue=typeof I=="object"&&I.indentTags||pe&&oe;V.end>z.ch&&(ne=ne.slice(0,ne.length-V.end+z.ch));var K=ne.toLowerCase();if(!ne||V.type=="string"&&(V.end!=z.ch||!/[\"\']/.test(V.string.charAt(V.string.length-1))||V.string.length==1)||V.type=="tag"&&ce.close||V.string.indexOf("/")==z.ch-V.start-1||Ne&&j(Ne,K)>-1||ee(W,J.mode.xmlCurrentContext&&J.mode.xmlCurrentContext(B)||[],ne,z,!0))return $.Pass;var v=typeof I=="object"&&I.emptyTags;if(v&&j(v,ne)>-1){L[le]={text:"/>",newPos:$.Pos(z.line,z.ch+2)};continue}var ie=ue&&j(ue,K)>-1;L[le]={indent:ie,text:">"+(ie?`
|
|
|
|
`:"")+"</"+ne+">",newPos:ie?$.Pos(z.line+1,0):$.Pos(z.line,z.ch+1)}}for(var X=typeof I=="object"&&I.dontIndentOnAutoClose,le=se.length-1;le>=0;le--){var de=L[le];W.replaceRange(de.text,se[le].head,se[le].anchor,"+insert");var A=W.listSelections().slice(0);A[le]={head:de.newPos,anchor:de.newPos},W.setSelections(A),!X&&de.indent&&(W.indentLine(de.newPos.line,null,!0),W.indentLine(de.newPos.line+1,null,!0))}}function ve(W,se){for(var L=W.listSelections(),I=[],le=se?"/":"</",z=W.getOption("autoCloseTags"),V=typeof z=="object"&&z.dontIndentOnSlash,J=0;J<L.length;J++){if(!L[J].empty())return $.Pass;var B=L[J].head,ce=W.getTokenAt(B),ne=$.innerMode(W.getMode(),ce.state),pe=ne.state;if(se&&(ce.type=="string"||ce.string.charAt(0)!="<"||ce.start!=B.ch-1))return $.Pass;var Ne,ue=ne.mode.name!="xml"&&W.getMode().name=="htmlmixed";if(ue&&ne.mode.name=="javascript")Ne=le+"script";else if(ue&&ne.mode.name=="css")Ne=le+"style";else{var K=ne.mode.xmlCurrentContext&&ne.mode.xmlCurrentContext(pe);if(!K||K.length&&ee(W,K,K[K.length-1],B))return $.Pass;Ne=le+K[K.length-1]}W.getLine(B.line).charAt(ce.end)!=">"&&(Ne+=">"),I[J]=Ne}if(W.replaceSelections(I),L=W.listSelections(),!V)for(var J=0;J<L.length;J++)(J==L.length-1||L[J].head.line<L[J+1].head.line)&&W.indentLine(L[J].head.line)}function ge(W){return W.getOption("disableInput")?$.Pass:ve(W,!0)}$.commands.closeTag=function(W){return ve(W)};function j(W,se){if(W.indexOf)return W.indexOf(se);for(var L=0,I=W.length;L<I;++L)if(W[L]==se)return L;return-1}function ee(W,se,L,I,le){if(!$.scanForClosingTag)return!1;var z=Math.min(W.lastLine()+1,I.line+500),V=$.scanForClosingTag(W,I,null,z);if(!V||V.tag!=L)return!1;for(var J=le?1:0,B=se.length-1;B>=0&&se[B]==L;B--)++J;I=V.to;for(var B=1;B<J;B++){var ce=$.scanForClosingTag(W,I,null,z);if(!ce||ce.tag!=L)return!1;I=ce.to}return!0}})},BjJ7:function(At,at,x){"use strict";x.d(at,"d",function(){return Pe}),x.d(at,"c",function(){return oe}),x.d(at,"e",function(){return Ce}),x.d(at,"b",function(){return ve}),x.d(at,"a",function(){return j});var $=x("m3rI");function Pe(ee){var W=!0;if(ee.length>0){for(var se=0;se<ee.length;se++)if(ee[se].compile_success==0||!ee[se].compile_success){W=!1;break}}else W=!1;return W}function oe(ee){for(var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",se=[],L=0;L<ee.length;L++){var I=ee[L],le=W?"".concat(W,"/").concat(I.name):"".concat(I.name);se.push({title:I.name,isLeaf:!(I.type==="tree"),key:le})}return se}function Ce(ee,W,se){for(var L=0;L<ee.length;L++){var I=ee[L];if(I.key===W){I.children=se;break}I.children&&Ce(I.children,W,se)}return ee}function ve(ee,W,se){var L;return function(){var I=this,le=arguments,z=function(){L=null,se||ee.apply(I,le)},V=se&&!L;clearTimeout(L),L=setTimeout(z,W),V&&ee.apply(I,le)}}var ge=!0,j=$.a.API_SERVER},"C+DQ":function(At,at,x){},DlQD:function(At,at,x){(function($,Pe){At.exports=Pe()})(this,function(){"use strict";function $(R,O){for(var P=0;P<O.length;P++){var y=O[P];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(R,y.key,y)}}function Pe(R,O,P){return O&&$(R.prototype,O),P&&$(R,P),R}function oe(R,O){if(!R)return;if(typeof R=="string")return Ce(R,O);var P=Object.prototype.toString.call(R).slice(8,-1);if(P==="Object"&&R.constructor&&(P=R.constructor.name),P==="Map"||P==="Set")return Array.from(R);if(P==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(P))return Ce(R,O)}function Ce(R,O){(O==null||O>R.length)&&(O=R.length);for(var P=0,y=new Array(O);P<O;P++)y[P]=R[P];return y}function ve(R,O){var P;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(P=oe(R))||O&&R&&typeof R.length=="number"){P&&(R=P);var y=0;return function(){return y>=R.length?{done:!0}:{done:!1,value:R[y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return P=R[Symbol.iterator](),P.next.bind(P)}function ge(R,O){return O={exports:{}},R(O,O.exports),O.exports}var j=ge(function(R){function O(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function P(y){R.exports.defaults=y}R.exports={defaults:O(),getDefaults:O,changeDefaults:P}}),ee=j.defaults,W=j.getDefaults,se=j.changeDefaults,L=/[&<>"']/,I=/[&<>"']/g,le=/[<>"']|&(?!#?\w+;)/,z=/[<>"']|&(?!#?\w+;)/g,V={"&":"&","<":"<",">":">",'"':""","'":"'"},J=function(O){return V[O]};function B(R,O){if(O){if(L.test(R))return R.replace(I,J)}else if(le.test(R))return R.replace(z,J);return R}var ce=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ne(R){return R.replace(ce,function(O,P){return P=P.toLowerCase(),P==="colon"?":":P.charAt(0)==="#"?P.charAt(1)==="x"?String.fromCharCode(parseInt(P.substring(2),16)):String.fromCharCode(+P.substring(1)):""})}var pe=/(^|[^\[])\^/g;function Ne(R,O){R=R.source||R,O=O||"";var P={replace:function(_,C){return C=C.source||C,C=C.replace(pe,"$1"),R=R.replace(_,C),P},getRegex:function(){return new RegExp(R,O)}};return P}var ue=/[^\w:]/g,K=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function v(R,O,P){if(R){var y;try{y=decodeURIComponent(ne(P)).replace(ue,"").toLowerCase()}catch(_){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}O&&!K.test(P)&&(P=b(O,P));try{P=encodeURI(P).replace(/%25/g,"%")}catch(_){return null}return P}var ie={},X=/^[^:]+:\/*[^/]*$/,de=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(R,O){ie[" "+R]||(X.test(R)?ie[" "+R]=R+"/":ie[" "+R]=G(R,"/",!0)),R=ie[" "+R];var P=R.indexOf(":")===-1;return O.substring(0,2)==="//"?P?O:R.replace(de,"$1")+O:O.charAt(0)==="/"?P?O:R.replace(A,"$1")+O:R+O}var U={exec:function(){}};function D(R){for(var O=1,P,y;O<arguments.length;O++){P=arguments[O];for(y in P)Object.prototype.hasOwnProperty.call(P,y)&&(R[y]=P[y])}return R}function k(R,O){var P=R.replace(/\|/g,function(C,E,te){for(var F=!1,ae=E;--ae>=0&&te[ae]==="\\";)F=!F;return F?"|":" |"}),y=P.split(/ \|/),_=0;if(y.length>O)y.splice(O);else for(;y.length<O;)y.push("");for(;_<y.length;_++)y[_]=y[_].trim().replace(/\\\|/g,"|");return y}function G(R,O,P){var y=R.length;if(y===0)return"";for(var _=0;_<y;){var C=R.charAt(y-_-1);if(C===O&&!P)_++;else if(C!==O&&P)_++;else break}return R.substr(0,y-_)}function he(R,O){if(R.indexOf(O[1])===-1)return-1;for(var P=R.length,y=0,_=0;_<P;_++)if(R[_]==="\\")_++;else if(R[_]===O[0])y++;else if(R[_]===O[1]&&(y--,y<0))return _;return-1}function Y(R){R&&R.sanitize&&!R.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var be={escape:B,unescape:ne,edit:Ne,cleanUrl:v,resolveUrl:b,noopTest:U,merge:D,splitCells:k,rtrim:G,findClosingBracket:he,checkSanitizeDeprecation:Y},S=j.defaults,g=be.rtrim,q=be.splitCells,Te=be.escape,we=be.findClosingBracket;function $e(R,O,P){var y=O.href,_=O.title?Te(O.title):null,C=R[1].replace(/\\([\[\]])/g,"$1");return R[0].charAt(0)!=="!"?{type:"link",raw:P,href:y,title:_,text:C}:{type:"image",raw:P,href:y,title:_,text:Te(C)}}function ot(R,O){var P=R.match(/^(\s+)(?:```)/);if(P===null)return O;var y=P[1];return O.split(`
|
|
`).map(function(_){var C=_.match(/^\s+/);if(C===null)return _;var E=C[0];return E.length>=y.length?_.slice(y.length):_}).join(`
|
|
`)}var _e=function(){function R(P){this.options=P||S}var O=R.prototype;return O.space=function(y){var _=this.rules.block.newline.exec(y);if(_)return _[0].length>1?{type:"space",raw:_[0]}:{raw:`
|
|
`}},O.code=function(y,_){var C=this.rules.block.code.exec(y);if(C){var E=_[_.length-1];if(E&&E.type==="paragraph")return{raw:C[0],text:C[0].trimRight()};var te=C[0].replace(/^ {4}/gm,"");return{type:"code",raw:C[0],codeBlockStyle:"indented",text:this.options.pedantic?te:g(te,`
|
|
`)}}},O.fences=function(y){var _=this.rules.block.fences.exec(y);if(_){var C=_[0],E=ot(C,_[3]||"");return{type:"code",raw:C,lang:_[2]?_[2].trim():_[2],text:E}}},O.heading=function(y){var _=this.rules.block.heading.exec(y);if(_)return{type:"heading",raw:_[0],depth:_[1].length,text:_[2]}},O.nptable=function(y){var _=this.rules.block.nptable.exec(y);if(_){var C={type:"table",header:q(_[1].replace(/^ *| *\| *$/g,"")),align:_[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:_[3]?_[3].replace(/\n$/,"").split(`
|
|
`):[],raw:_[0]};if(C.header.length===C.align.length){var E=C.align.length,te;for(te=0;te<E;te++)/^ *-+: *$/.test(C.align[te])?C.align[te]="right":/^ *:-+: *$/.test(C.align[te])?C.align[te]="center":/^ *:-+ *$/.test(C.align[te])?C.align[te]="left":C.align[te]=null;for(E=C.cells.length,te=0;te<E;te++)C.cells[te]=q(C.cells[te],C.header.length);return C}}},O.hr=function(y){var _=this.rules.block.hr.exec(y);if(_)return{type:"hr",raw:_[0]}},O.blockquote=function(y){var _=this.rules.block.blockquote.exec(y);if(_){var C=_[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:_[0],text:C}}},O.list=function(y){var _=this.rules.block.list.exec(y);if(_){for(var C=_[0],E=_[2],te=E.length>1,F=E[E.length-1]===")",ae={type:"list",raw:C,ordered:te,start:te?+E.slice(0,-1):"",loose:!1,items:[]},Ke=_[0].match(this.rules.block.item),et=!1,Ge,mt,Ot,Ye,Bt,Mt,Ft,Nt=Ke.length,vt=0;vt<Nt;vt++)Ge=Ke[vt],C=Ge,mt=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
|
|
`)&&(mt-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),vt!==Nt-1&&(Ot=this.rules.block.bullet.exec(Ke[vt+1])[0],(te?Ot.length===1||!F&&Ot[Ot.length-1]===")":Ot.length>1||this.options.smartLists&&Ot!==E)&&(Ye=Ke.slice(vt+1).join(`
|
|
`),ae.raw=ae.raw.substring(0,ae.raw.length-Ye.length),vt=Nt-1)),Bt=et||/\n\n(?!\s*$)/.test(Ge),vt!==Nt-1&&(et=Ge.charAt(Ge.length-1)===`
|
|
`,Bt||(Bt=et)),Bt&&(ae.loose=!0),Mt=/^\[[ xX]\] /.test(Ge),Ft=void 0,Mt&&(Ft=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),ae.items.push({type:"list_item",raw:C,task:Mt,checked:Ft,loose:Bt,text:Ge});return ae}},O.html=function(y){var _=this.rules.block.html.exec(y);if(_)return{type:this.options.sanitize?"paragraph":"html",raw:_[0],pre:!this.options.sanitizer&&(_[1]==="pre"||_[1]==="script"||_[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(_[0]):Te(_[0]):_[0]}},O.def=function(y){var _=this.rules.block.def.exec(y);if(_){_[3]&&(_[3]=_[3].substring(1,_[3].length-1));var C=_[1].toLowerCase().replace(/\s+/g," ");return{tag:C,raw:_[0],href:_[2],title:_[3]}}},O.table=function(y){var _=this.rules.block.table.exec(y);if(_){var C={type:"table",header:q(_[1].replace(/^ *| *\| *$/g,"")),align:_[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:_[3]?_[3].replace(/\n$/,"").split(`
|
|
`):[]};if(C.header.length===C.align.length){C.raw=_[0];var E=C.align.length,te;for(te=0;te<E;te++)/^ *-+: *$/.test(C.align[te])?C.align[te]="right":/^ *:-+: *$/.test(C.align[te])?C.align[te]="center":/^ *:-+ *$/.test(C.align[te])?C.align[te]="left":C.align[te]=null;for(E=C.cells.length,te=0;te<E;te++)C.cells[te]=q(C.cells[te].replace(/^ *\| *| *\| *$/g,""),C.header.length);return C}}},O.lheading=function(y){var _=this.rules.block.lheading.exec(y);if(_)return{type:"heading",raw:_[0],depth:_[2].charAt(0)==="="?1:2,text:_[1]}},O.paragraph=function(y){var _=this.rules.block.paragraph.exec(y);if(_)return{type:"paragraph",raw:_[0],text:_[1].charAt(_[1].length-1)===`
|
|
`?_[1].slice(0,-1):_[1]}},O.text=function(y,_){var C=this.rules.block.text.exec(y);if(C){var E=_[_.length-1];return E&&E.type==="text"?{raw:C[0],text:C[0]}:{type:"text",raw:C[0],text:C[0]}}},O.escape=function(y){var _=this.rules.inline.escape.exec(y);if(_)return{type:"escape",raw:_[0],text:Te(_[1])}},O.tag=function(y,_,C){var E=this.rules.inline.tag.exec(y);if(E)return!_&&/^<a /i.test(E[0])?_=!0:_&&/^<\/a>/i.test(E[0])&&(_=!1),!C&&/^<(pre|code|kbd|script)(\s|>)/i.test(E[0])?C=!0:C&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(E[0])&&(C=!1),{type:this.options.sanitize?"text":"html",raw:E[0],inLink:_,inRawBlock:C,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):Te(E[0]):E[0]}},O.link=function(y){var _=this.rules.inline.link.exec(y);if(_){var C=we(_[2],"()");if(C>-1){var E=_[0].indexOf("!")===0?5:4,te=E+_[1].length+C;_[2]=_[2].substring(0,C),_[0]=_[0].substring(0,te).trim(),_[3]=""}var F=_[2],ae="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(F);Ke?(F=Ke[1],ae=Ke[3]):ae=""}else ae=_[3]?_[3].slice(1,-1):"";F=F.trim().replace(/^<([\s\S]*)>$/,"$1");var et=$e(_,{href:F&&F.replace(this.rules.inline._escapes,"$1"),title:ae&&ae.replace(this.rules.inline._escapes,"$1")},_[0]);return et}},O.reflink=function(y,_){var C;if((C=this.rules.inline.reflink.exec(y))||(C=this.rules.inline.nolink.exec(y))){var E=(C[2]||C[1]).replace(/\s+/g," ");if(E=_[E.toLowerCase()],!E||!E.href){var te=C[0].charAt(0);return{type:"text",raw:te,text:te}}var F=$e(C,E,C[0]);return F}},O.strong=function(y,_,C){C===void 0&&(C="");var E=this.rules.inline.strong.start.exec(y);if(E&&(!E[1]||E[1]&&(C===""||this.rules.inline.punctuation.exec(C)))){_=_.slice(-1*y.length);var te=E[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;te.lastIndex=0;for(var F;(E=te.exec(_))!=null;)if(F=this.rules.inline.strong.middle.exec(_.slice(0,E.index+3)),F)return{type:"strong",raw:y.slice(0,F[0].length),text:y.slice(2,F[0].length-2)}}},O.em=function(y,_,C){C===void 0&&(C="");var E=this.rules.inline.em.start.exec(y);if(E&&(!E[1]||E[1]&&(C===""||this.rules.inline.punctuation.exec(C)))){_=_.slice(-1*y.length);var te=E[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;te.lastIndex=0;for(var F;(E=te.exec(_))!=null;)if(F=this.rules.inline.em.middle.exec(_.slice(0,E.index+2)),F)return{type:"em",raw:y.slice(0,F[0].length),text:y.slice(1,F[0].length-1)}}},O.codespan=function(y){var _=this.rules.inline.code.exec(y);if(_){var C=_[2].replace(/\n/g," "),E=/[^ ]/.test(C),te=C.startsWith(" ")&&C.endsWith(" ");return E&&te&&(C=C.substring(1,C.length-1)),C=Te(C,!0),{type:"codespan",raw:_[0],text:C}}},O.br=function(y){var _=this.rules.inline.br.exec(y);if(_)return{type:"br",raw:_[0]}},O.del=function(y){var _=this.rules.inline.del.exec(y);if(_)return{type:"del",raw:_[0],text:_[1]}},O.autolink=function(y,_){var C=this.rules.inline.autolink.exec(y);if(C){var E,te;return C[2]==="@"?(E=Te(this.options.mangle?_(C[1]):C[1]),te="mailto:"+E):(E=Te(C[1]),te=E),{type:"link",raw:C[0],text:E,href:te,tokens:[{type:"text",raw:E,text:E}]}}},O.url=function(y,_){var C;if(C=this.rules.inline.url.exec(y)){var E,te;if(C[2]==="@")E=Te(this.options.mangle?_(C[0]):C[0]),te="mailto:"+E;else{var F;do F=C[0],C[0]=this.rules.inline._backpedal.exec(C[0])[0];while(F!==C[0]);E=Te(C[0]),C[1]==="www."?te="http://"+E:te=E}return{type:"link",raw:C[0],text:E,href:te,tokens:[{type:"text",raw:E,text:E}]}}},O.inlineText=function(y,_,C){var E=this.rules.inline.text.exec(y);if(E){var te;return _?te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):Te(E[0]):E[0]:te=Te(this.options.smartypants?C(E[0]):E[0]),{type:"text",raw:E[0],text:te}}},R}(),je=be.noopTest,Se=be.edit,Oe=be.merge,Z={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:je,table:je,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Z._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Z._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Z.def=Se(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex(),Z.bullet=/(?:[*+-]|\d{1,9}[.)])/,Z.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Z.item=Se(Z.item,"gm").replace(/bull/g,Z.bullet).getRegex(),Z.list=Se(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex(),Z._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Z._comment=/<!--(?!-?>)[\s\S]*?-->/,Z.html=Se(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=Se(Z._paragraph).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Z._tag).getRegex(),Z.blockquote=Se(Z.blockquote).replace("paragraph",Z.paragraph).getRegex(),Z.normal=Oe({},Z),Z.gfm=Oe({},Z.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Z.gfm.nptable=Se(Z.gfm.nptable).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Z._tag).getRegex(),Z.gfm.table=Se(Z.gfm.table).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Z._tag).getRegex(),Z.pedantic=Oe({},Z.normal,{html:Se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Z._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:je,paragraph:Se(Z.normal._paragraph).replace("hr",Z.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var w={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:je,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:je,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};w._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",w.punctuation=Se(w.punctuation).replace(/punctuation/g,w._punctuation).getRegex(),w._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",w._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",w.em.start=Se(w.em.start).replace(/punctuation/g,w._punctuation).getRegex(),w.em.middle=Se(w.em.middle).replace(/punctuation/g,w._punctuation).replace(/overlapSkip/g,w._overlapSkip).getRegex(),w.em.endAst=Se(w.em.endAst,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.em.endUnd=Se(w.em.endUnd,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.strong.start=Se(w.strong.start).replace(/punctuation/g,w._punctuation).getRegex(),w.strong.middle=Se(w.strong.middle).replace(/punctuation/g,w._punctuation).replace(/blockSkip/g,w._blockSkip).getRegex(),w.strong.endAst=Se(w.strong.endAst,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.strong.endUnd=Se(w.strong.endUnd,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=Se(w._blockSkip,"g").getRegex(),w.overlapSkip=Se(w._overlapSkip,"g").getRegex(),w._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=Se(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=Se(w.tag).replace("comment",Z._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=Se(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=Se(w.reflink).replace("label",w._label).getRegex(),w.reflinkSearch=Se(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal=Oe({},w),w.pedantic=Oe({},w.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()}),w.gfm=Oe({},w.normal,{escape:Se(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),w.gfm.url=Se(w.gfm.url,"i").replace("email",w.gfm._extended_email).getRegex(),w.breaks=Oe({},w.gfm,{br:Se(w.br).replace("{2,}","*").getRegex(),text:Se(w.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Be={block:Z,inline:w},ut=j.defaults,wt=Be.block,Je=Be.inline;function qe(R){return R.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function fe(R){var O="",P,y,_=R.length;for(P=0;P<_;P++)y=R.charCodeAt(P),Math.random()>.5&&(y="x"+y.toString(16)),O+="&#"+y+";";return O}var De=function(){function R(P){this.tokens=[],this.tokens.links=Object.create(null),this.options=P||ut,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var y={block:wt.normal,inline:Je.normal};this.options.pedantic?(y.block=wt.pedantic,y.inline=Je.pedantic):this.options.gfm&&(y.block=wt.gfm,this.options.breaks?y.inline=Je.breaks:y.inline=Je.gfm),this.tokenizer.rules=y}R.lex=function(y,_){var C=new R(_);return C.lex(y)};var O=R.prototype;return O.lex=function(y){return y=y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(y,this.tokens,!0),this.inline(this.tokens),this.tokens},O.blockTokens=function(y,_,C){_===void 0&&(_=[]),C===void 0&&(C=!0),y=y.replace(/^ +$/gm,"");for(var E,te,F,ae;y;){if(E=this.tokenizer.space(y)){y=y.substring(E.raw.length),E.type&&_.push(E);continue}if(E=this.tokenizer.code(y,_)){y=y.substring(E.raw.length),E.type?_.push(E):(ae=_[_.length-1],ae.raw+=`
|
|
`+E.raw,ae.text+=`
|
|
`+E.text);continue}if(E=this.tokenizer.fences(y)){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.heading(y)){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.nptable(y)){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.hr(y)){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.blockquote(y)){y=y.substring(E.raw.length),E.tokens=this.blockTokens(E.text,[],C),_.push(E);continue}if(E=this.tokenizer.list(y)){for(y=y.substring(E.raw.length),F=E.items.length,te=0;te<F;te++)E.items[te].tokens=this.blockTokens(E.items[te].text,[],!1);_.push(E);continue}if(E=this.tokenizer.html(y)){y=y.substring(E.raw.length),_.push(E);continue}if(C&&(E=this.tokenizer.def(y))){y=y.substring(E.raw.length),this.tokens.links[E.tag]||(this.tokens.links[E.tag]={href:E.href,title:E.title});continue}if(E=this.tokenizer.table(y)){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.lheading(y)){y=y.substring(E.raw.length),_.push(E);continue}if(C&&(E=this.tokenizer.paragraph(y))){y=y.substring(E.raw.length),_.push(E);continue}if(E=this.tokenizer.text(y,_)){y=y.substring(E.raw.length),E.type?_.push(E):(ae=_[_.length-1],ae.raw+=`
|
|
`+E.raw,ae.text+=`
|
|
`+E.text);continue}if(y){var Ke="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return _},O.inline=function(y){var _,C,E,te,F,ae,Ke=y.length;for(_=0;_<Ke;_++){ae=y[_];switch(ae.type){case"paragraph":case"text":case"heading":{ae.tokens=[],this.inlineTokens(ae.text,ae.tokens);break}case"table":{for(ae.tokens={header:[],cells:[]},te=ae.header.length,C=0;C<te;C++)ae.tokens.header[C]=[],this.inlineTokens(ae.header[C],ae.tokens.header[C]);for(te=ae.cells.length,C=0;C<te;C++)for(F=ae.cells[C],ae.tokens.cells[C]=[],E=0;E<F.length;E++)ae.tokens.cells[C][E]=[],this.inlineTokens(F[E],ae.tokens.cells[C][E]);break}case"blockquote":{this.inline(ae.tokens);break}case"list":{for(te=ae.items.length,C=0;C<te;C++)this.inline(ae.items[C].tokens);break}}}return y},O.inlineTokens=function(y,_,C,E,te){_===void 0&&(_=[]),C===void 0&&(C=!1),E===void 0&&(E=!1),te===void 0&&(te="");var F,ae=y,Ke;if(this.tokens.links){var et=Object.keys(this.tokens.links);if(et.length>0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(ae))!=null;)et.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(ae=ae.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+ae.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(ae))!=null;)ae=ae.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+ae.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;y;){if(F=this.tokenizer.escape(y)){y=y.substring(F.raw.length),_.push(F);continue}if(F=this.tokenizer.tag(y,C,E)){y=y.substring(F.raw.length),C=F.inLink,E=F.inRawBlock,_.push(F);continue}if(F=this.tokenizer.link(y)){y=y.substring(F.raw.length),F.type==="link"&&(F.tokens=this.inlineTokens(F.text,[],!0,E)),_.push(F);continue}if(F=this.tokenizer.reflink(y,this.tokens.links)){y=y.substring(F.raw.length),F.type==="link"&&(F.tokens=this.inlineTokens(F.text,[],!0,E)),_.push(F);continue}if(F=this.tokenizer.strong(y,ae,te)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],C,E),_.push(F);continue}if(F=this.tokenizer.em(y,ae,te)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],C,E),_.push(F);continue}if(F=this.tokenizer.codespan(y)){y=y.substring(F.raw.length),_.push(F);continue}if(F=this.tokenizer.br(y)){y=y.substring(F.raw.length),_.push(F);continue}if(F=this.tokenizer.del(y)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],C,E),_.push(F);continue}if(F=this.tokenizer.autolink(y,fe)){y=y.substring(F.raw.length),_.push(F);continue}if(!C&&(F=this.tokenizer.url(y,fe))){y=y.substring(F.raw.length),_.push(F);continue}if(F=this.tokenizer.inlineText(y,E,qe)){y=y.substring(F.raw.length),te=F.raw.slice(-1),_.push(F);continue}if(y){var Ge="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return _},Pe(R,null,[{key:"rules",get:function(){return{block:wt,inline:Je}}}]),R}(),We=j.defaults,Ve=be.cleanUrl,ze=be.escape,Ue=function(){function R(P){this.options=P||We}var O=R.prototype;return O.code=function(y,_,C){var E=(_||"").match(/\S*/)[0];if(this.options.highlight){var te=this.options.highlight(y,E);te!=null&&te!==y&&(C=!0,y=te)}return E?'<pre><code class="'+this.options.langPrefix+ze(E,!0)+'">'+(C?y:ze(y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(C?y:ze(y,!0))+`</code></pre>
|
|
`},O.blockquote=function(y){return`<blockquote>
|
|
`+y+`</blockquote>
|
|
`},O.html=function(y){return y},O.heading=function(y,_,C,E){return this.options.headerIds?"<h"+_+' id="'+this.options.headerPrefix+E.slug(C)+'">'+y+"</h"+_+`>
|
|
`:"<h"+_+">"+y+"</h"+_+`>
|
|
`},O.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},O.list=function(y,_,C){var E=_?"ol":"ul",te=_&&C!==1?' start="'+C+'"':"";return"<"+E+te+`>
|
|
`+y+"</"+E+`>
|
|
`},O.listitem=function(y){return"<li>"+y+`</li>
|
|
`},O.checkbox=function(y){return"<input "+(y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},O.paragraph=function(y){return"<p>"+y+`</p>
|
|
`},O.table=function(y,_){return _&&(_="<tbody>"+_+"</tbody>"),`<table>
|
|
<thead>
|
|
`+y+`</thead>
|
|
`+_+`</table>
|
|
`},O.tablerow=function(y){return`<tr>
|
|
`+y+`</tr>
|
|
`},O.tablecell=function(y,_){var C=_.header?"th":"td",E=_.align?"<"+C+' align="'+_.align+'">':"<"+C+">";return E+y+"</"+C+`>
|
|
`},O.strong=function(y){return"<strong>"+y+"</strong>"},O.em=function(y){return"<em>"+y+"</em>"},O.codespan=function(y){return"<code>"+y+"</code>"},O.br=function(){return this.options.xhtml?"<br/>":"<br>"},O.del=function(y){return"<del>"+y+"</del>"},O.link=function(y,_,C){if(y=Ve(this.options.sanitize,this.options.baseUrl,y),y===null)return C;var E='<a href="'+ze(y)+'"';return _&&(E+=' title="'+_+'"'),E+=">"+C+"</a>",E},O.image=function(y,_,C){if(y=Ve(this.options.sanitize,this.options.baseUrl,y),y===null)return C;var E='<img src="'+y+'" alt="'+C+'"';return _&&(E+=' title="'+_+'"'),E+=this.options.xhtml?"/>":">",E},O.text=function(y){return y},R}(),Le=function(){function R(){}var O=R.prototype;return O.strong=function(y){return y},O.em=function(y){return y},O.codespan=function(y){return y},O.del=function(y){return y},O.html=function(y){return y},O.text=function(y){return y},O.link=function(y,_,C){return""+C},O.image=function(y,_,C){return""+C},O.br=function(){return""},R}(),Et=function(){function R(){this.seen={}}var O=R.prototype;return O.slug=function(y){var _=y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(_)){var C=_;do this.seen[C]++,_=C+"-"+this.seen[C];while(this.seen.hasOwnProperty(_))}return this.seen[_]=0,_},R}(),st=j.defaults,nt=be.unescape,ct=function(){function R(P){this.options=P||st,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Et}R.parse=function(y,_){var C=new R(_);return C.parse(y)};var O=R.prototype;return O.parse=function(y,_){_===void 0&&(_=!0);var C="",E,te,F,ae,Ke,et,Ge,mt,Ot,Ye,Bt,Mt,Ft,Nt,vt,Gt,Wt,He,yt=y.length;for(E=0;E<yt;E++){Ye=y[E];switch(Ye.type){case"space":continue;case"hr":{C+=this.renderer.hr();continue}case"heading":{C+=this.renderer.heading(this.parseInline(Ye.tokens),Ye.depth,nt(this.parseInline(Ye.tokens,this.textRenderer)),this.slugger);continue}case"code":{C+=this.renderer.code(Ye.text,Ye.lang,Ye.escaped);continue}case"table":{for(mt="",Ge="",ae=Ye.header.length,te=0;te<ae;te++)Ge+=this.renderer.tablecell(this.parseInline(Ye.tokens.header[te]),{header:!0,align:Ye.align[te]});for(mt+=this.renderer.tablerow(Ge),Ot="",ae=Ye.cells.length,te=0;te<ae;te++){for(et=Ye.tokens.cells[te],Ge="",Ke=et.length,F=0;F<Ke;F++)Ge+=this.renderer.tablecell(this.parseInline(et[F]),{header:!1,align:Ye.align[F]});Ot+=this.renderer.tablerow(Ge)}C+=this.renderer.table(mt,Ot);continue}case"blockquote":{Ot=this.parse(Ye.tokens),C+=this.renderer.blockquote(Ot);continue}case"list":{for(Bt=Ye.ordered,Mt=Ye.start,Ft=Ye.loose,ae=Ye.items.length,Ot="",te=0;te<ae;te++)vt=Ye.items[te],Gt=vt.checked,Wt=vt.task,Nt="",vt.task&&(He=this.renderer.checkbox(Gt),Ft?vt.tokens.length>0&&vt.tokens[0].type==="text"?(vt.tokens[0].text=He+" "+vt.tokens[0].text,vt.tokens[0].tokens&&vt.tokens[0].tokens.length>0&&vt.tokens[0].tokens[0].type==="text"&&(vt.tokens[0].tokens[0].text=He+" "+vt.tokens[0].tokens[0].text)):vt.tokens.unshift({type:"text",text:He}):Nt+=He),Nt+=this.parse(vt.tokens,Ft),Ot+=this.renderer.listitem(Nt,Wt,Gt);C+=this.renderer.list(Ot,Bt,Mt);continue}case"html":{C+=this.renderer.html(Ye.text);continue}case"paragraph":{C+=this.renderer.paragraph(this.parseInline(Ye.tokens));continue}case"text":{for(Ot=Ye.tokens?this.parseInline(Ye.tokens):Ye.text;E+1<yt&&y[E+1].type==="text";)Ye=y[++E],Ot+=`
|
|
`+(Ye.tokens?this.parseInline(Ye.tokens):Ye.text);C+=_?this.renderer.paragraph(Ot):Ot;continue}default:{var dt='Token with "'+Ye.type+'" type was not found.';if(this.options.silent){console.error(dt);return}else throw new Error(dt)}}}return C},O.parseInline=function(y,_){_=_||this.renderer;var C="",E,te,F=y.length;for(E=0;E<F;E++){te=y[E];switch(te.type){case"escape":{C+=_.text(te.text);break}case"html":{C+=_.html(te.text);break}case"link":{C+=_.link(te.href,te.title,this.parseInline(te.tokens,_));break}case"image":{C+=_.image(te.href,te.title,te.text);break}case"strong":{C+=_.strong(this.parseInline(te.tokens,_));break}case"em":{C+=_.em(this.parseInline(te.tokens,_));break}case"codespan":{C+=_.codespan(te.text);break}case"br":{C+=_.br();break}case"del":{C+=_.del(this.parseInline(te.tokens,_));break}case"text":{C+=_.text(te.text);break}default:{var ae='Token with "'+te.type+'" type was not found.';if(this.options.silent){console.error(ae);return}else throw new Error(ae)}}}return C},R}(),St=be.merge,_t=be.checkSanitizeDeprecation,pt=be.escape,me=j.getDefaults,kt=j.changeDefaults,ht=j.defaults;function ye(R,O,P){if(typeof R=="undefined"||R===null)throw new Error("marked(): input parameter is undefined or null");if(typeof R!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(R)+", string expected");if(typeof O=="function"&&(P=O,O=null),O=St({},ye.defaults,O||{}),_t(O),P){var y=O.highlight,_;try{_=De.lex(R,O)}catch(F){return P(F)}var C=function(ae){var Ke;if(!ae)try{Ke=ct.parse(_,O)}catch(et){ae=et}return O.highlight=y,ae?P(ae):P(null,Ke)};if(!y||y.length<3)return C();if(delete O.highlight,!_.length)return C();var E=0;ye.walkTokens(_,function(F){F.type==="code"&&(E++,setTimeout(function(){y(F.text,F.lang,function(ae,Ke){if(ae)return C(ae);Ke!=null&&Ke!==F.text&&(F.text=Ke,F.escaped=!0),E--,E===0&&C()})},0))}),E===0&&C();return}try{var te=De.lex(R,O);return O.walkTokens&&ye.walkTokens(te,O.walkTokens),ct.parse(te,O)}catch(F){if(F.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,O.silent)return"<p>An error occurred:</p><pre>"+pt(F.message+"",!0)+"</pre>";throw F}}ye.options=ye.setOptions=function(R){return St(ye.defaults,R),kt(ye.defaults),ye},ye.getDefaults=me,ye.defaults=ht,ye.use=function(R){var O=St({},R);if(R.renderer&&function(){var y=ye.defaults.renderer||new Ue,_=function(te){var F=y[te];y[te]=function(){for(var ae=arguments.length,Ke=new Array(ae),et=0;et<ae;et++)Ke[et]=arguments[et];var Ge=R.renderer[te].apply(y,Ke);return Ge===!1&&(Ge=F.apply(y,Ke)),Ge}};for(var C in R.renderer)_(C);O.renderer=y}(),R.tokenizer&&function(){var y=ye.defaults.tokenizer||new _e,_=function(te){var F=y[te];y[te]=function(){for(var ae=arguments.length,Ke=new Array(ae),et=0;et<ae;et++)Ke[et]=arguments[et];var Ge=R.tokenizer[te].apply(y,Ke);return Ge===!1&&(Ge=F.apply(y,Ke)),Ge}};for(var C in R.tokenizer)_(C);O.tokenizer=y}(),R.walkTokens){var P=ye.defaults.walkTokens;O.walkTokens=function(y){R.walkTokens(y),P&&P(y)}}ye.setOptions(O)},ye.walkTokens=function(R,O){for(var P=ve(R),y;!(y=P()).done;){var _=y.value;O(_);switch(_.type){case"table":{for(var C=ve(_.tokens.header),E;!(E=C()).done;){var te=E.value;ye.walkTokens(te,O)}for(var F=ve(_.tokens.cells),ae;!(ae=F()).done;)for(var Ke=ae.value,et=ve(Ke),Ge;!(Ge=et()).done;){var mt=Ge.value;ye.walkTokens(mt,O)}break}case"list":{ye.walkTokens(_.items,O);break}default:_.tokens&&ye.walkTokens(_.tokens,O)}}},ye.Parser=ct,ye.parser=ct.parse,ye.Renderer=Ue,ye.TextRenderer=Le,ye.Lexer=De,ye.lexer=De.lex,ye.Tokenizer=_e,ye.Slugger=Et,ye.parse=ye;var Ee=ye;return Ee})},ELLl:function(At,at,x){(function($){$(x("VrN/"))})(function($){var Pe={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},oe=$.Pos;$.defineOption("autoCloseBrackets",!1,function(V,J,B){B&&B!=$.Init&&(V.removeKeyMap(ve),V.state.closeBrackets=null),J&&(ge(Ce(J,"pairs")),V.state.closeBrackets=J,V.addKeyMap(ve))});function Ce(V,J){return J=="pairs"&&typeof V=="string"?V:typeof V=="object"&&V[J]!=null?V[J]:Pe[J]}var ve={Backspace:W,Enter:se};function ge(V){for(var J=0;J<V.length;J++){var B=V.charAt(J),ce="'"+B+"'";ve[ce]||(ve[ce]=j(B))}}ge(Pe.pairs+"`");function j(V){return function(J){return I(J,V)}}function ee(V){var J=V.state.closeBrackets;if(!J||J.override)return J;var B=V.getModeAt(V.getCursor());return B.closeBrackets||J}function W(V){var J=ee(V);if(!J||V.getOption("disableInput"))return $.Pass;for(var B=Ce(J,"pairs"),ce=V.listSelections(),ne=0;ne<ce.length;ne++){if(!ce[ne].empty())return $.Pass;var pe=le(V,ce[ne].head);if(!pe||B.indexOf(pe)%2!=0)return $.Pass}for(var ne=ce.length-1;ne>=0;ne--){var Ne=ce[ne].head;V.replaceRange("",oe(Ne.line,Ne.ch-1),oe(Ne.line,Ne.ch+1),"+delete")}}function se(V){var J=ee(V),B=J&&Ce(J,"explode");if(!B||V.getOption("disableInput"))return $.Pass;for(var ce=V.listSelections(),ne=0;ne<ce.length;ne++){if(!ce[ne].empty())return $.Pass;var pe=le(V,ce[ne].head);if(!pe||B.indexOf(pe)%2!=0)return $.Pass}V.operation(function(){var Ne=V.lineSeparator()||`
|
|
`;V.replaceSelection(Ne+Ne,null),V.execCommand("goCharLeft"),ce=V.listSelections();for(var ue=0;ue<ce.length;ue++){var K=ce[ue].head.line;V.indentLine(K,null,!0),V.indentLine(K+1,null,!0)}})}function L(V){var J=$.cmpPos(V.anchor,V.head)>0;return{anchor:new oe(V.anchor.line,V.anchor.ch+(J?-1:1)),head:new oe(V.head.line,V.head.ch+(J?1:-1))}}function I(V,J){var B=ee(V);if(!B||V.getOption("disableInput"))return $.Pass;var ce=Ce(B,"pairs"),ne=ce.indexOf(J);if(ne==-1)return $.Pass;for(var pe=Ce(B,"closeBefore"),Ne=Ce(B,"triples"),ue=ce.charAt(ne+1)==J,K=V.listSelections(),v=ne%2==0,ie,X=0;X<K.length;X++){var de=K[X],A=de.head,b,U=V.getRange(A,oe(A.line,A.ch+1));if(v&&!de.empty())b="surround";else if((ue||!v)&&U==J)ue&&z(V,A)?b="both":Ne.indexOf(J)>=0&&V.getRange(A,oe(A.line,A.ch+3))==J+J+J?b="skipThree":b="skip";else if(ue&&A.ch>1&&Ne.indexOf(J)>=0&&V.getRange(oe(A.line,A.ch-2),A)==J+J){if(A.ch>2&&/\bstring/.test(V.getTokenTypeAt(oe(A.line,A.ch-2))))return $.Pass;b="addFour"}else if(ue){var D=A.ch==0?" ":V.getRange(oe(A.line,A.ch-1),A);if(!$.isWordChar(U)&&D!=J&&!$.isWordChar(D))b="both";else return $.Pass}else if(v&&(U.length===0||/\s/.test(U)||pe.indexOf(U)>-1))b="both";else return $.Pass;if(!ie)ie=b;else if(ie!=b)return $.Pass}var k=ne%2?ce.charAt(ne-1):J,G=ne%2?J:ce.charAt(ne+1);V.operation(function(){if(ie=="skip")V.execCommand("goCharRight");else if(ie=="skipThree")for(var he=0;he<3;he++)V.execCommand("goCharRight");else if(ie=="surround"){for(var Y=V.getSelections(),he=0;he<Y.length;he++)Y[he]=k+Y[he]+G;V.replaceSelections(Y,"around"),Y=V.listSelections().slice();for(var he=0;he<Y.length;he++)Y[he]=L(Y[he]);V.setSelections(Y)}else ie=="both"?(V.replaceSelection(k+G,null),V.triggerElectric(k+G),V.execCommand("goCharLeft")):ie=="addFour"&&(V.replaceSelection(k+k+k+k,"before"),V.execCommand("goCharRight"))})}function le(V,J){var B=V.getRange(oe(J.line,J.ch-1),oe(J.line,J.ch+1));return B.length==2?B:null}function z(V,J){var B=V.getTokenAt(oe(J.line,J.ch+1));return/\bstring/.test(B.type)&&B.start==J.ch&&(J.ch==0||!/\bstring/.test(V.getTokenTypeAt(J)))}})},FIWC:function(At,at,x){At.exports={flex_box_center:"flex_box_center___gdHkq",flex_space_between:"flex_space_between___lk_Gv",flex_box_vertical_center:"flex_box_vertical_center___2WNVo",flex_box_center_end:"flex_box_center_end___13O11",flex_box_column:"flex_box_column___kMb8L",wrap:"wrap___1y6rg",crumbs:"crumbs___1vKDo"}},Gytx:function(At,at){At.exports=function($,Pe,oe,Ce){var ve=oe?oe.call(Ce,$,Pe):void 0;if(ve!==void 0)return!!ve;if($===Pe)return!0;if(typeof $!="object"||!$||typeof Pe!="object"||!Pe)return!1;var ge=Object.keys($),j=Object.keys(Pe);if(ge.length!==j.length)return!1;for(var ee=Object.prototype.hasOwnProperty.bind(Pe),W=0;W<ge.length;W++){var se=ge[W];if(!ee(se))return!1;var L=$[se],I=Pe[se];if(ve=oe?oe.call(Ce,L,I,se):void 0,ve===!1||ve===void 0&&L!==I)return!1}return!0}},HmJG:function(At,at,x){},LdHM:function(At,at,x){"use strict";x.d(at,"b",function(){return pe}),x.d(at,"a",function(){return ue});var $=x("1OyB"),Pe=x("vuIU"),oe=x("Ji7U"),Ce=x("LK+K"),ve=x("q1tI"),ge=x("rePB"),j=x("Ff2n"),ee=x("ODXe"),W=x("4IlW"),se=x("bX4T"),L=x("YrtM"),I=x("TSYQ"),le=x.n(I),z=x("+nKL"),V=x("8OUc"),J=function(q,Te){var we=q.prefixCls,$e=q.id,ot=q.flattenOptions,_e=q.childrenAsData,je=q.values,Se=q.searchValue,Oe=q.multiple,Z=q.defaultActiveFirstOption,w=q.height,Be=q.itemHeight,ut=q.notFoundContent,wt=q.open,Je=q.menuItemSelectedIcon,qe=q.virtual,fe=q.onSelect,De=q.onToggleOpen,We=q.onActiveValue,Ve=q.onScroll,ze=q.onMouseEnter,Ue="".concat(we,"-item"),Le=Object(L.a)(function(){return ot},[wt,ot],function(Ee,R){return R[0]&&Ee[1]!==R[1]}),Et=ve.useRef(null),st=function(R){R.preventDefault()},nt=function(R){Et.current&&Et.current.scrollTo({index:R})},ct=function(R){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=Le.length,y=0;y<P;y+=1){var _=(R+y*O+P)%P,C=Le[_],E=C.group,te=C.data;if(!E&&!te.disabled)return _}return-1},St=ve.useState(function(){return ct(0)}),_t=Object(ee.a)(St,2),pt=_t[0],me=_t[1],kt=function(R){me(R);var O=Le[R];if(!O){We(null,-1);return}We(O.data.value,R)};ve.useEffect(function(){kt(Z!==!1?ct(0):-1)},[Le.length,Se]),ve.useEffect(function(){var Ee=setTimeout(function(){if(!Oe&&wt&&je.size===1){var R=Array.from(je)[0],O=Le.findIndex(function(P){var y=P.data;return y.value===R});kt(O),nt(O)}});return function(){return clearTimeout(Ee)}},[wt]);var ht=function(R){R!==void 0&&fe(R,{selected:!je.has(R)}),Oe||De(!1)};if(ve.useImperativeHandle(Te,function(){return{onKeyDown:function(R){var O=R.which;switch(O){case W.a.UP:case W.a.DOWN:{var P=0;if(O===W.a.UP?P=-1:O===W.a.DOWN&&(P=1),P!==0){var y=ct(pt+P,P);nt(y),kt(y)}break}case W.a.ENTER:{var _=Le[pt];_&&!_.data.disabled?ht(_.data.value):ht(void 0),wt&&R.preventDefault();break}case W.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(R){nt(R)}}}),Le.length===0)return ve.createElement("div",{role:"listbox",id:"".concat($e,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:st},ut);function ye(Ee){var R=Le[Ee];if(!R)return null;var O=R.data||{},P=O.value,y=O.label,_=O.children,C=Object(se.a)(O,!0),E=_e?_:y;return R?ve.createElement("div",Object.assign({"aria-label":typeof E=="string"?E:null},C,{key:Ee,role:"option",id:"".concat($e,"_list_").concat(Ee),"aria-selected":je.has(P)}),P):null}return ve.createElement(ve.Fragment,null,ve.createElement("div",{role:"listbox",id:"".concat($e,"_list"),style:{height:0,width:0,overflow:"hidden"}},ye(pt-1),ye(pt),ye(pt+1)),ve.createElement(z.a,{itemKey:"key",ref:Et,data:Le,height:w,itemHeight:Be,fullHeight:!1,onMouseDown:st,onScroll:Ve,virtual:qe,onMouseEnter:ze},function(Ee,R){var O,P=Ee.group,y=Ee.groupOption,_=Ee.data,C=_.label,E=_.key;if(P)return ve.createElement("div",{className:le()(Ue,"".concat(Ue,"-group"))},C!==void 0?C:E);var te=_.disabled,F=_.value,ae=_.title,Ke=_.children,et=_.style,Ge=_.className,mt=Object(j.a)(_,["disabled","value","title","children","style","className"]),Ot=je.has(F),Ye="".concat(Ue,"-option"),Bt=le()(Ue,Ye,Ge,(O={},Object(ge.a)(O,"".concat(Ye,"-grouped"),y),Object(ge.a)(O,"".concat(Ye,"-active"),pt===R&&!te),Object(ge.a)(O,"".concat(Ye,"-disabled"),te),Object(ge.a)(O,"".concat(Ye,"-selected"),Ot),O)),Mt=_e?Ke:C,Ft=!Je||typeof Je=="function"||Ot;return ve.createElement("div",Object.assign({},mt,{"aria-selected":Ot,className:Bt,title:ae,onMouseMove:function(){if(pt===R||te)return;kt(R)},onClick:function(){te||ht(F)},style:et}),ve.createElement("div",{className:"".concat(Ye,"-content")},Mt||F),ve.isValidElement(Je)||Ot,Ft&&ve.createElement(V.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Je,customizeIconProps:{isSelected:Ot}},Ot?"\u2713":null))}))},B=ve.forwardRef(J);B.displayName="OptionList";var ce=B,ne=function(){return null};ne.isSelectOption=!0;var pe=ne,Ne=function(){return null};Ne.isSelectOptGroup=!0;var ue=Ne,K=x("VTBJ"),v=x("Zm9Q");function ie(g){var q=g.key,Te=g.props,we=Te.children,$e=Te.value,ot=Object(j.a)(Te,["children","value"]);return Object(K.a)({key:q,value:$e!==void 0?$e:q,children:we},ot)}function X(g){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(v.a)(g).map(function(Te,we){if(!ve.isValidElement(Te)||!Te.type)return null;var $e=Te.type.isSelectOptGroup,ot=Te.key,_e=Te.props,je=_e.children,Se=Object(j.a)(_e,["children"]);return q||!$e?ie(Te):Object(K.a)(Object(K.a)({key:"__RC_SELECT_GRP__".concat(ot===null?we:ot,"__"),label:ot},Se),{},{options:X(je)})}).filter(function(Te){return Te})}var de=x("2Qr1"),A=x("qNPg"),b=x("U8pU"),U=x("Kwbf"),D=x("WKfj");function k(g){var q=g.mode,Te=g.options,we=g.children,$e=g.backfill,ot=g.allowClear,_e=g.placeholder,je=g.getInputElement,Se=g.showSearch,Oe=g.onSearch,Z=g.defaultOpen,w=g.autoFocus,Be=g.labelInValue,ut=g.value,wt=g.inputValue,Je=g.optionLabelProp,qe=q==="multiple"||q==="tags",fe=Se!==void 0?Se:qe||q==="combobox",De=Te||X(we);if(Object(U.a)(q!=="tags"||De.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),q==="tags"||q==="combobox"){var We=De.some(function(Ue){return Ue.options?Ue.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(U.a)(!We,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(U.a)(q!=="combobox"||!Je,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(U.a)(q==="combobox"||!$e,"`backfill` only works with `combobox` mode."),Object(U.a)(q==="combobox"||!je,"`getInputElement` only work with `combobox` mode."),Object(U.b)(q!=="combobox"||!je||!ot||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Oe&&!fe&&q!=="combobox"&&q!=="tags"&&Object(U.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(U.b)(!Z||w,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ut!=null){var Ve=Object(D.d)(ut);Object(U.a)(!Be||Ve.every(function(Ue){return Object(b.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(U.a)(!qe||Array.isArray(ut),"`value` should be array when `mode` is `multiple` or `tags`")}if(we){var ze=null;Object(v.a)(we).some(function(Ue){if(!ve.isValidElement(Ue)||!Ue.type)return!1;var Le=Ue.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Et=Object(v.a)(Ue.props.children).every(function(st){return!ve.isValidElement(st)||!Ue.type||st.type.isSelectOption?!0:(ze=st.type,!1)});return!Et}return ze=Le,!0}),ze&&Object(U.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ze.displayName||ze.name||ze,"`.")),Object(U.a)(wt===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var G=k,he=Object(A.a)({prefixCls:"rc-select",components:{optionList:ce},convertChildrenToData:X,flattenOptions:de.d,getLabeledValue:de.e,filterOptions:de.b,isValueDisabled:de.g,findValueOption:de.c,warningProps:G,fillOptionsWithMissingValue:de.a}),Y=function(g){Object(oe.a)(Te,g);var q=Object(Ce.a)(Te);function Te(){var we;return Object($.a)(this,Te),we=q.apply(this,arguments),we.selectRef=ve.createRef(),we.focus=function(){we.selectRef.current.focus()},we.blur=function(){we.selectRef.current.blur()},we}return Object(Pe.a)(Te,[{key:"render",value:function(){return ve.createElement(he,Object.assign({ref:this.selectRef},this.props))}}]),Te}(ve.Component);Y.Option=pe,Y.OptGroup=ue;var be=Y,S=at.c=be},M8RZ:function(At,at,x){"use strict";x.d(at,"a",function(){return W});var $=x("fWQN"),Pe=x("mtLc"),oe=x("yKVA"),Ce=x("879j"),ve=x("q1tI"),ge=x.n(ve),j=x("i8i4"),ee=x.n(j),W=function(se){Object(oe.a)(I,se);var L=Object(Ce.a)(I);function I(le){var z;Object($.a)(this,I),z=L.call(this,le);var V=window.document;return z.node=V.createElement("div"),V.body.appendChild(z.node),z}return Object(Pe.a)(I,[{key:"render",value:function(){var z=this.props.children;return Object(j.createPortal)(z,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),I}(ge.a.Component)},O2Wb:function(At,at,x){At.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(At,at,x){"use strict";var $=x("U8pU"),Pe=x("VTBJ"),oe=x("Ff2n"),Ce=x("q1tI"),ve=x("uciX"),ge=x("7ixt"),j=function(le){var z=le.overlay,V=le.prefixCls,J=le.id,B=le.overlayInnerStyle;return Ce.createElement("div",{className:"".concat(V,"-inner"),id:J,role:"tooltip",style:B},typeof z=="function"?z():z)},ee=j,W=function(le,z){var V=le.overlayClassName,J=le.trigger,B=J===void 0?["hover"]:J,ce=le.mouseEnterDelay,ne=ce===void 0?0:ce,pe=le.mouseLeaveDelay,Ne=pe===void 0?.1:pe,ue=le.overlayStyle,K=le.prefixCls,v=K===void 0?"rc-tooltip":K,ie=le.children,X=le.onVisibleChange,de=le.afterVisibleChange,A=le.transitionName,b=le.animation,U=le.placement,D=U===void 0?"right":U,k=le.align,G=k===void 0?{}:k,he=le.destroyTooltipOnHide,Y=he===void 0?!1:he,be=le.defaultVisible,S=le.getTooltipContainer,g=le.overlayInnerStyle,q=Object(oe.a)(le,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Te=Object(Ce.useRef)(null);Object(Ce.useImperativeHandle)(z,function(){return Te.current});var we=Object(Pe.a)({},q);"visible"in le&&(we.popupVisible=le.visible);var $e=function(){var Oe=le.arrowContent,Z=Oe===void 0?null:Oe,w=le.overlay,Be=le.id;return[Ce.createElement("div",{className:"".concat(v,"-arrow"),key:"arrow"},Z),Ce.createElement(ee,{key:"content",prefixCls:v,id:Be,overlay:w,overlayInnerStyle:g})]},ot=!1,_e=!1;if(typeof Y=="boolean")ot=Y;else if(Y&&Object($.a)(Y)==="object"){var je=Y.keepParent;ot=je===!0,_e=je===!1}return Ce.createElement(ve.a,Object.assign({popupClassName:V,prefixCls:v,popup:$e,action:B,builtinPlacements:ge.a,popupPlacement:D,ref:Te,popupAlign:G,getPopupContainer:S,onPopupVisibleChange:X,afterPopupVisibleChange:de,popupTransitionName:A,popupAnimation:b,defaultPopupVisible:be,destroyPopupOnHide:ot,autoDestroy:_e,mouseLeaveDelay:Ne,popupStyle:ue,mouseEnterDelay:ne},we),ie)},se=Object(Ce.forwardRef)(W),L=at.a=se},Ot1p:function(At,at,x){"use strict";var $=x("2qtc"),Pe=x("kLXV"),oe=x("rAM+"),Ce=x("miYZ"),ve=x("tsqr"),ge=x("9og8"),j=x("tJVT"),ee=x("jrin"),W=x("WmNS"),se=x.n(W),L=x("q1tI"),I=x.n(L),le=x("VrN/"),z=x.n(le),V=x("bdgK"),J=x("p77/"),B=x("Bd2K"),ce=x("ELLl"),ne=x("19Vz"),pe=x("lZu9"),Ne=x("+NIl"),ue=x("kSUc"),K=x("9Bee"),v=function(F){var ae=F.value,Ke=ae===void 0?"":ae,et=F.className,Ge=F.showTextOnly,mt=F.showLines,Ot=F.style,Ye=Ot===void 0?{}:Ot,Bt=Object(L.useMemo)(function(){return""},[Ke]);return I.a.createElement(I.a.Fragment,null,I.a.createElement("div",{dangerouslySetInnerHTML:{__html:Bt}}))},ie=x("0Owb"),X=x("dejd"),de=x("C+DQ"),A=x("1vsH"),b=x("m3rI"),U=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function D(F){var ae=F.onActionCallback,Ke=F.title,et=F.icon,Ge=F.actionName,mt=F.className,Ot=mt===void 0?"":mt,Ye=F.children;function Bt(){ae(Ge)}return I.a.createElement("a",{title:Ke,className:Ot,onClick:Bt},I.a.createElement("i",{className:"md-iconfont ".concat(et)}),Ye)}var k=function(F){var ae=F.watch,Ke=F.showNullButton,et=F.onActionCallback,Ge=F.fullScreen,mt=F.insertTemp,Ot=F.hidetoolBar,Ye=F.uuid,Bt=F.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(A.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(A.D)("_educoder_session"),"&key=").concat(Ye,"&api=").concat(encodeURIComponent(b.a.PROXY_SERVER)));var Mt=[].concat(U,[{title:"".concat(ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return I.a.createElement("ul",{className:"markdown-toolbar-container"},!Ot&&Mt.map(function(Ft,Nt){return I.a.createElement("li",{key:Nt},Ft.actionName?I.a.createElement(D,Object(ie.a)({},Ft,{onActionCallback:et})):I.a.createElement("span",{className:"v-line"}))}),Ke?I.a.createElement("li",null,I.a.createElement(D,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:et},I.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\u586B\u7A7A\u9879"))):null,mt&&I.a.createElement("li",null,I.a.createElement(D,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(mt),onActionCallback:et},I.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),I.a.createElement("li",{className:"btn-full-screen"},I.a.createElement(D,{icon:"".concat(Ge?"icon-shrink":"icon-enlarge"),title:Ge?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:et})))},G=x("M8RZ"),he=x("+L6B"),Y=x("2/Rp"),be=x("y8nQ"),S=x("Vl3Y"),g=x("5NDa"),q=x("5rEg"),Te={labelCol:{span:4},wrapperCol:{span:20}},we=function(F){var ae=F.callback,Ke=F.onCancel;function et(Ge){ae(Ge)}return I.a.createElement(S.a,Object(ie.a)({},Te,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:et}),I.a.createElement(S.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},I.a.createElement(q.a,null)),I.a.createElement(S.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},I.a.createElement(q.a,null)),I.a.createElement("div",{className:"flex-container flex-end"},I.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),I.a.createElement(Y.a,{type:"ghost",onClick:Ke},"\u53D6\u6D88")))},$e=x("7ahc"),ot=x("k1fw"),_e=x("HmJG"),je=x("BjJ7"),Se=S.a.useForm,Oe={width:280,marginRight:10},Z={labelCol:{span:5},wrapperCol:{span:19}},w=function(F){var ae=F.callback,Ke=F.onCancel,et=Se(),Ge=Object(j.a)(et,1),mt=Ge[0],Ot=Object(L.useRef)();function Ye(Ft){ae(Object(ot.a)(Object(ot.a)({},Ft),{},{name:Ot.current}))}function Bt(Ft,Nt){mt.setFieldsValue({src:"/api/attachments/".concat(Ft.id,"?type=").concat(Ft.content_type),type:Nt.type})}function Mt(Ft){var Nt=Ft.target.files[0];Ot.current=Nt.name,ut(Nt,Bt)}return I.a.createElement(S.a,Object(ie.a)({form:mt},Z,{className:"upload-image-panel",onFinish:Ye}),I.a.createElement(S.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},I.a.createElement("div",{className:"flex-container"},I.a.createElement(S.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},I.a.createElement(q.a,{style:Oe})),I.a.createElement(Be,{onFileChange:Mt}))),I.a.createElement(S.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},I.a.createElement(q.a,{style:{width:264}})),I.a.createElement(S.a.Item,{style:{textAlign:"right"}},I.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),I.a.createElement(Y.a,{type:"ghost",onClick:Ke},"\u53D6\u6D88")))};function Be(F){var ae=F.onFileChange;return I.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",I.a.createElement("input",{type:"file",onChange:ae}))}function ut(F,ae){if(!F)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ke=new FormData;Ke.append("editormd-image-file",F),Ke.append("file_param_name","editormd-image-file"),Ke.append("byxhr","true");var et=new window.XMLHttpRequest;et.withCredentials=!0,et.addEventListener("load",function(Ge){ae(JSON.parse(Ge.target.responseText),F)},!1),et.addEventListener("error",function(Ge){console.error(Ge)},!1),et.open("POST","".concat(je.a,"/api/attachments.json")),et.send(Ke)}var wt=x("giR+"),Je=x("fyUT"),qe=x("7Kak"),fe=x("9yH6"),De=fe.a.Group,We={margin:"0 8px"},Ve=function(F){var ae=F.callback,Ke=F.onCancel;function et(Ge){ae(Ge)}return I.a.createElement(S.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:et},I.a.createElement("div",{className:"flex-container"},I.a.createElement("span",{style:We},"\u5355\u5143\u683C\u6570\uFF1A"),I.a.createElement("span",{style:We},"\u884C\u6570"),I.a.createElement(S.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},I.a.createElement(Je.a,null)),I.a.createElement("span",{style:We},"\u5217\u6570"),I.a.createElement(S.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},I.a.createElement(Je.a,null))),I.a.createElement("div",{className:"flex-container",style:{marginTop:12}},I.a.createElement("span",{style:We},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),I.a.createElement(S.a.Item,{name:"align"},I.a.createElement(De,null,I.a.createElement(fe.a,{value:"default"},I.a.createElement("i",{className:"fa fa-align-justify"})),I.a.createElement(fe.a,{value:"left"},I.a.createElement("i",{className:"fa fa-align-left"})),I.a.createElement(fe.a,{value:"center"},I.a.createElement("i",{className:"fa fa-align-center"})),I.a.createElement(fe.a,{value:"right"},I.a.createElement("i",{className:"fa fa-align-right"}))))),I.a.createElement("div",{className:"flex-container flex-end"},I.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),I.a.createElement(Y.a,{type:"ghost",onClick:Ke},"\u53D6\u6D88")))},ze=x("ErOA"),Ue=x("7Cbv"),Le="link",Et="upload-image",st="code-block",nt="add-table",ct="------------",St={default:ct,left:":".concat(ct),center:":".concat(ct,":"),right:"".concat(ct,":")},_t=x("9VGf"),pt,me;function kt(){}var ht=0,ye=1e4,Ee="\u2581",R=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function O(F){return/^\d+$/.test(F)?"".concat(F,"px"):F}var P=navigator.platform.toUpperCase().indexOf("MAC")>=0,y=P?"Cmd":"Ctrl",_=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],C=(pt={},Object(ee.a)(pt,y+"-B","bold"),Object(ee.a)(pt,y+"-I","italic"),pt),E=(me={},Object(ee.a)(me,Le,"\u6DFB\u52A0\u94FE\u63A5"),Object(ee.a)(me,st,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(ee.a)(me,Et,"\u6DFB\u52A0\u6587\u4EF6"),Object(ee.a)(me,nt,"\u6DFB\u52A0\u8868\u683C"),me),te=at.a=function(F){var ae=F.defaultValue,Ke=ae===void 0?"":ae,et=F.onChange,Ge=F.width,mt=Ge===void 0?"100%":Ge,Ot=F.height,Ye=Ot===void 0?400:Ot,Bt=F.miniToolbar,Mt=Bt===void 0?!1:Bt,Ft=F.isFocus,Nt=Ft===void 0?!1:Ft,vt=F.watch,Gt=F.insertTemp,Wt=F.mode,He=Wt===void 0?"markdown":Wt,yt=F.id,dt=yt===void 0?"markdown-editor-id":yt,Ct=F.showResizeBar,Yt=Ct===void 0?!1:Ct,Vt=F.noStorage,ln=Vt===void 0?!1:Vt,Ht=F.showNullButton,gt=Ht===void 0?!1:Ht,qt=F.hidetoolBar,Pt=qt===void 0?!1:qt,Qt=F.fullScreen,Lt=Qt===void 0?!1:Qt,gn=F.onBlur,$n=F.onCMBeforeChange,si=F.onFullScreen,Ae=F.className,tt=Ae===void 0?"":Ae,dn=F.disablePaste,cn=dn===void 0?!1:dn,bn=F.placeholder,_n=bn===void 0?"":bn,h=F.values,o=h===void 0?"":h,a=Object(L.useState)(null),u=Object(j.a)(a,2),d=u[0],c=u[1],N=Object(L.useState)(Ke),Re=Object(j.a)(N,2),Ze=Re[0],bt=Re[1],Me=Object(L.useState)(vt),ke=Object(j.a)(Me,2),H=ke[0],Ie=ke[1],Rt=Object(L.useState)(Lt),lt=Object(j.a)(Rt,2),Qe=lt[0],jt=lt[1],pn=Object(L.useState)(""),Jt=Object(j.a)(pn,2),fn=Jt[0],on=Jt[1],On=Object(L.useState)(0),vn=Object(j.a)(On,2),Un=vn[0],Yn=vn[1],zn=Object(L.useState)(Ye),Pn=Object(j.a)(zn,2),qn=Pn[0],Hn=Pn[1],Mi=Object(L.useState)(!1),Ni=Object(j.a)(Mi,2),dr=Ni[0],Cn=Ni[1],tn=Object(L.useRef)(Object(Ue.a)()),Bn=Object(L.useRef)(!1),en=Object(L.useRef)(),kn=Object(L.useRef)(),an=Object(L.useRef)(),gi=Object(L.useRef)(),wn=Object(L.useRef)(),Jn=function(){var Tt=Object(ge.a)(se.a.mark(function zt(){var It,Kt;return se.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:return un.next=2,Object(ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:Kt=un.sent,Kt!=null&&(It=Kt.attachments)!==null&&It!==void 0&&It.length&&(console.log("cm:",d,kn),Kt.attachments.map(function(Zt){Zt.content_type.indexOf("image")>-1?d.replaceSelection(".concat(Zt.content_type,")")):Zt.content_type.indexOf("video")>-1?d.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Zt.content_type.indexOf("pdf")>-1?d.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,'&disposition=inline" target="_blank">').concat(Zt.name,"</a>")):d.replaceSelection("[".concat(Zt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,")"))}));case 4:case"end":return un.stop()}},zt)}));return function(){return Tt.apply(this,arguments)}}();Object(L.useEffect)(function(){bt(o),d==null||d.setValue(o)},[o]),Object(L.useEffect)(function(){si==null||si(Qe)},[Qe]),Object(L.useEffect)(function(){if(kn.current){var Tt=z.a.fromTextArea(kn.current,{mode:He,lineNumbers:!Mt,lineWrapping:!0,value:Ke,autoCloseTags:!0,autoCloseBrackets:!0});Nt&&Tt.focus();function zt(It,Kt){if(cn){Kt.preventDefault();return}var nn=Kt.clipboardData;if(nn){var un=nn.types.toString(),Zt=nn.items;if(un==="Files"||nn.types.indexOf("Files")>-1){if(Kt.preventDefault(),He=="stex")return;try{var Rn,Zn=Zt[1];((Rn=Zt[0])===null||Rn===void 0?void 0:Rn.kind)==="file"&&(Zn=Zt[0]);var $t=Zn.getAsFile(),wi=$t.name.split(".").pop();ut($t,function(rn){if(rn.id){var Mn,ci,hi;($t==null||((Mn=$t.type)===null||Mn===void 0)?void 0:Mn.indexOf("image"))>-1?Tt.replaceSelection(".concat(rn.content_type,")")):($t==null||((ci=$t.type)===null||ci===void 0)?void 0:ci.indexOf("video"))>-1?Tt.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,'"></video>')):($t==null||((hi=$t.type)===null||hi===void 0)?void 0:hi.indexOf("pdf"))>-1?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat($t.type,'&disposition=inline" target="_blank">').concat($t.name,"</a>")):_.includes(wi)?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,'?type=office&disposition=inline" target="_blank">').concat($t.name,"</a>")):Tt.replaceSelection("[".concat($t.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat(rn.content_type,")"))}else(rn==null?void 0:rn.status)===401&&(document.location.href="/user/login")})}catch(rn){ve.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Tt.on("paste",zt),Tt.on("dragleave",function(It,Kt){an.current.classList.remove("mouse-hover-md")}),Tt.on("dragover",function(It,Kt){an.current.classList.add("mouse-hover-md")}),Tt.on("drop",function(It,Kt){an.current.classList.add("mouse-hover-md");var nn;if(nn=Kt.dataTransfer.files,nn.length>0){Kt.preventDefault(),Kt.stopPropagation();for(var un=function(Zn){var $t=nn[Zn],wi=$t.name.split(".").pop();ut($t,function(rn){if(rn.id){var Mn,ci,hi;($t==null||((Mn=$t.type)===null||Mn===void 0)?void 0:Mn.indexOf("image"))>-1?Tt.replaceSelection(".concat(rn.content_type,")")):($t==null||((ci=$t.type)===null||ci===void 0)?void 0:ci.indexOf("video"))>-1?Tt.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,'"></video>')):($t==null||((hi=$t.type)===null||hi===void 0)?void 0:hi.indexOf("pdf"))>-1?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat($t.type,'&disposition=inline" target="_blank">').concat($t.name,"</a>")):_.includes(wi)?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,'?type=office&disposition=inline" target="_blank">').concat($t.name,"</a>")):Tt.replaceSelection("[".concat($t.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(rn.id,"?type=").concat(rn.content_type,")"))}else(rn==null?void 0:rn.status)===401&&(document.location.href="/user/login")})},Zt=0;Zt<nn.length;Zt++)un(Zt)}}),c(Tt),function(){Tt.off("paste",zt)}}},[]);var Xi=Object(L.useCallback)(function(){if(an.current)try{}catch(Tt){console.log(Tt,"---- to set md editor body height")}},[qn,an,Qe]);Object(L.useEffect)(function(){function Tt(){var It=new V.default(function(Kt){var nn=Object(oe.a)(Kt),un;try{for(nn.s();!(un=nn.n()).done;){var Zt=un.value;(Zt.target.offsetHeight>0||Zt.target.offsetWidth>0)&&(Xi(),d.setSize("100%","100%"),d.refresh())}}catch(Rn){nn.e(Rn)}finally{nn.f()}});return It.observe(kn.current.parentElement),It}if(d){var zt=Tt();return function(){zt.unobserve(kn.current.parentElement)}}},[d,Xi]),Object(L.useEffect)(function(){if(d){for(var Tt=[],zt=function(){var Zt=Kt[It];nn=Object(j.a)(Zt,2);var Rn=nn[0],Zn=nn[1],$t=Object(ee.a)({},Rn,function(){Ki(Zn)});Tt.push($t),d.addKeyMap($t)},It=0,Kt=Object.entries(C);It<Kt.length;It++){var nn;zt()}return en.current=setInterval(function(){Bn.current&&Jn()},4e3),function(){clearInterval(en.current);var un=Object(oe.a)(Tt),Zt;try{for(un.s();!(Zt=un.n()).done;){var Rn=Zt.value;d.removeKeyMap(Rn)}}catch(Zn){un.e(Zn)}finally{un.f()}}}},[d]),Object(L.useEffect)(function(){Lt!==Qe&&jt(Lt)},[Lt]),Object(_t.a)(function(){if(!ln&&Un>0){var Tt=new Date().getTime(),zt=window.sessionStorage.getItem(dt);Tt>=Un+ye&&(!zt||zt!==Ze)&&(window.sessionStorage.setItem(dt,Ze),Cn(!0))}},ye),Object(L.useEffect)(function(){Ie(vt)},[d,vt]),Object(L.useEffect)(function(){d&&(Nt&&d.focus())},[d,Nt]),Object(L.useEffect)(function(){if(H&&d){var Tt=d.getScrollerElement();function zt(It){var Kt=It.target;if(wn.current){var nn=Kt.scrollTop/Kt.scrollHeight;wn.current.scrollTop=wn.current.scrollHeight*nn}}return Tt.addEventListener("scroll",zt),function(){Tt.removeEventListener("scroll",zt)}}},[d,H]),Object(L.useEffect)(function(){if(d&&$n){function Tt(zt,It){$n(zt,It)}return d.on("beforeChange",Tt),function(){d.off("beforeChange",Tt)}}},[d,$n]),Object(L.useEffect)(function(){if(d&&gn){function Tt(){gn(d.getValue())}return d.on("blur",Tt),function(){d.off("blur",Tt)}}},[d,gn]),Object(L.useEffect)(function(){if(d){function Tt(zt){var It=zt.getValue();bt(It),Yn(new Date().getTime()),zt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),et&&et(It)}return d.on("change",Tt),function(){d.off("change",Tt)}}},[d,et]),Object(L.useEffect)(function(){d&&(Ke==null?(d.setValue(""),bt("")):Ke!==d.getValue()&&(d.setValue(Ke),bt(Ke),d.setCursor(d.lineCount(),0)))},[d,Ke]);var Ki=Object(L.useCallback)(function(Tt){var zt=d.getCursor(),It=d.getSelection(),Kt=It.split(`
|
|
`);switch(Tt){case"bold":return d.replaceSelection("**"+It+"**"),It===""&&d.setCursor(zt.line,zt.ch+2),d.focus();case"italic":return d.replaceSelection("*"+It+"*"),It===""&&d.setCursor(zt.line,zt.ch+1),d.focus();case"code":return d.replaceSelection("`"+It+"`"),It===""&&d.setCursor(zt.line,zt.ch+1),d.focus();case"inline-latex":return d.replaceSelection("`$$"+It+"$$`"),It===""&&d.setCursor(zt.line,zt.ch+3),d.focus();case"latex":return d.replaceSelection("```latex\n"+It+"\n```"),d.setCursor(zt.line+1,It.length+1),d.focus();case"line-break":return d.replaceSelection(`<br/>
|
|
`),d.focus();case"list-ul":return It===""?d.replaceSelection("- "+It):d.replaceSelection(Kt.map(function(nn){return nn===""?"":"- ".concat(nn)}).join(`
|
|
`)),d.focus();case"list-ol":return It===""?d.replaceSelection("1. "+It):d.replaceSelection(Kt.map(function(nn,un){return nn===""?"":"".concat(un+1,". ").concat(nn)}).join(`
|
|
`)),d.focus();case"add-null-ch":return It===""&&d.setCursor(zt.line,zt.ch+1),d.replaceSelection(Ee),d.focus();case"inster-template-1":return It===""&&d.setCursor(zt.line,zt.ch),d.replaceSelection(R),d.focus();case"eraser":return d.setValue(""),d.focus();case"trigger-watch":return Ie(!H),d.focus();case"trigger-full-screen":return jt(!Qe),d.focus();case Le:on(Le);return;case st:on(st);return;case Et:on(Et);return;case nt:on(nt);return;default:throw new Error}},[d,H,Qe]),Ei=Object(L.useCallback)(function(Tt){on("");switch(fn){case Le:var zt=Tt.title,It=Tt.link;return d.replaceSelection("[".concat(zt,"](").concat(It,")")),d.focus();case st:var Kt=Tt.language,nn=Tt.content;return d.replaceSelection(["```"+Kt,nn,"```"].join(`
|
|
`)),d.focus();case Et:var un=Tt.src,Zt=Tt.alt,Rn=Tt.name;return un.indexOf("type=image")>-1?d.replaceSelection(".concat(un,' "').concat(Zt||"",'" )')):un.indexOf("type=application/pdf")>-1?d.replaceSelection('<a href="'.concat(un,'&disposition=inline" target="_blank">').concat(Rn,"</a>")):d.replaceSelection('<a href="'.concat(un,'" target="_blank">').concat(Rn,"</a>")),d.focus();case nt:for(var Zn=Tt.row,$t=Tt.col,wi=Tt.align,rn=`
|
|
`,Mn=0;Mn<Zn;Mn++){for(var ci=[],hi=[],Wr=0;Wr<$t;Wr++)Mn===1&&hi.push(St[wi]),ci.push(" ");Mn===1&&(rn+="| ".concat(hi.join(" | "),` |
|
|
`)),rn+="| ".concat(ci.join($t===1?"":" | "),` |
|
|
`)}return d.replaceSelection(rn+`
|
|
`),d.focus();default:throw new Error}},[d,fn]),Br=Object(L.useMemo)(function(){switch(fn){case Le:return I.a.createElement(we,{callback:Ei,onCancel:ri});case st:return I.a.createElement($e.b,{callback:Ei,onCancel:ri});case Et:return I.a.createElement(w,{callback:Ei,onCancel:ri});case nt:return I.a.createElement(Ve,{callback:Ei,onCancel:ri});default:return null}},[fn]);function ri(){on("")}Object(L.useEffect)(function(){if(gi.current){var Tt=gi.current,zt=!1,It=0;function Kt(Zt){zt=!0,It=Zt.pageY}function nn(){zt=!1}function un(Zt){if(zt){var Rn=Zt.pageY-It;Rn<0&&(Rn=0),Rn>300&&(Rn=300);var Zn=Ye+Rn+"px";Hn(Zn)}}return Tt.addEventListener("mousedown",Kt),document.addEventListener("mousemove",un),document.addEventListener("mouseup",nn),function(){Tt.removeEventListener("mousedown",Kt),document.removeEventListener("mousemove",un),document.removeEventListener("mouseup",nn)}}},[d,gi]),Object(L.useEffect)(function(){Hn(Ye)},[Ye]);var pr=O(mt),di=O(qn),$i={width:pr,height:di},Fr=Object(L.useMemo)(function(){if(Un){var Tt=new Date(Un),zt=Tt.getHours(),It=Tt.getMinutes(),Kt=Tt.getSeconds();return zt=zt<10?"0"+zt:zt,It=It<10?"0"+It:It,Kt=Kt<10?"0"+Kt:Kt,"".concat(zt,":").concat(It,":").concat(Kt)}return 0},[Un]);function Di(){window.sessionStorage.removeItem(dt),Cn(!1),Yn(0)}function qo(){Cn(!1),Yn(0),d.setValue(window.sessionStorage.getItem(dt))}function co(Tt,zt){var It=d.getValue();It=It.replace(Tt,zt),bt(It),d==null||d.setValue(It)}return I.a.createElement(L.Fragment,null,I.a.createElement("div",{className:"markdown-editor-wrapper",ref:an},I.a.createElement("div",{className:"markdown-editor-container ".concat(tt," ").concat(H?"on-preview":""," ").concat(Mt?"mini":""," ").concat(Qe?"full-screen":""),style:$i},I.a.createElement(k,{insertTemp:Gt,watch:H,fullScreen:Qe,showNullButton:gt,onActionCallback:Ki,hidetoolBar:Pt,uuid:tn.current,setOpenPhones:function(){Bn.current=!0}}),I.a.createElement("div",{className:"markdown-editor-body"},I.a.createElement("div",{className:"codemirror-container"},I.a.createElement("textarea",{ref:kn,placeholder:_n})),H?I.a.createElement("div",{ref:wn,className:"preview-container"},He==="stex"&&I.a.createElement(v,{value:Ze}),He!=="stex"&&I.a.createElement(K.a,{edit:!0,value:Ze,replaces:co})):null))),Yt?I.a.createElement("a",{ref:gi,className:"editor-resize"}):null,I.a.createElement(G.a,null,E[fn]?I.a.createElement(Pe.a,{centered:!0,title:E[fn],visible:!0,onCancel:ri,footer:null},Br):null))}},PGNT:function(At,at,x){At.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(At,at,x){At.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},"RZ/O":function(At,at,x){At.exports=x.p+"static/bi.9c9b0364.svg"},SJMd:function(At,at){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var x,$,Pe,oe=!1,Ce,ve;window.PR_SHOULD_USE_CONTINUATION=!0;var ge,j;(function(){var ee=window,W=["break,continue,do,else,for,if,return,while"],se=[W,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],L=[se,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],I=[L,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],le=[L,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],z=[L,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],V="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",J=[L,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],B="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",ce=[W,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],ne=[W,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],pe=[W,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Ne=[I,z,le,J,B,ce,ne,pe],ue=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,K="str",v="kwd",ie="com",X="typ",de="lit",A="pun",b="pln",U="tag",D="dec",k="src",G="atn",he="atv",Y="nocode",be="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function S(fe){for(var De=0,We=!1,Ve=!1,ze=0,Ue=fe.length;ze<Ue;++ze){var Le=fe[ze];if(Le.ignoreCase)Ve=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){We=!0,Ve=!1;break}}var Et={b:8,t:9,n:10,v:11,f:12,r:13};function st(pt){var me=pt.charCodeAt(0);if(me!==92)return me;var kt=pt.charAt(1);return me=Et[kt],me||("0"<=kt&&kt<="7"?parseInt(pt.substring(1),8):kt==="u"||kt==="x"?parseInt(pt.substring(2),16):pt.charCodeAt(1))}function nt(pt){if(pt<32)return(pt<16?"\\x0":"\\x")+pt.toString(16);var me=String.fromCharCode(pt);return me==="\\"||me==="-"||me==="]"||me==="^"?"\\"+me:me}function ct(pt){var me=pt.substring(1,pt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),kt=[],ht=me[0]==="^",ye=["["];ht&&ye.push("^");for(var Ee=ht?1:0,R=me.length;Ee<R;++Ee){var O=me[Ee];if(/\\[bdsw]/i.test(O))ye.push(O);else{var P=st(O),y;Ee+2<R&&me[Ee+1]==="-"?(y=st(me[Ee+2]),Ee+=2):y=P,kt.push([P,y]),y<65||P>122||(y<65||P>90||kt.push([Math.max(65,P)|32,Math.min(y,90)|32]),y<97||P>122||kt.push([Math.max(97,P)&~32,Math.min(y,122)&~32]))}}kt.sort(function(te,F){return te[0]-F[0]||F[1]-te[1]});for(var _=[],C=[],Ee=0;Ee<kt.length;++Ee){var E=kt[Ee];E[0]<=C[1]+1?C[1]=Math.max(C[1],E[1]):_.push(C=E)}for(var Ee=0;Ee<_.length;++Ee){var E=_[Ee];ye.push(nt(E[0])),E[1]>E[0]&&(E[1]+1>E[0]&&ye.push("-"),ye.push(nt(E[1])))}return ye.push("]"),ye.join("")}function St(pt){for(var me=pt.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),kt=me.length,ht=[],ye=0,Ee=0;ye<kt;++ye){var R=me[ye];if(R==="(")++Ee;else if(R.charAt(0)==="\\"){var O=+R.substring(1);O&&(O<=Ee?ht[O]=-1:me[ye]=nt(O))}}for(var ye=1;ye<ht.length;++ye)ht[ye]===-1&&(ht[ye]=++De);for(var ye=0,Ee=0;ye<kt;++ye){var R=me[ye];if(R==="(")++Ee,ht[Ee]||(me[ye]="(?:");else if(R.charAt(0)==="\\"){var O=+R.substring(1);O&&O<=Ee&&(me[ye]="\\"+ht[O])}}for(var ye=0;ye<kt;++ye)me[ye]==="^"&&me[ye+1]!=="^"&&(me[ye]="");if(pt.ignoreCase&&We)for(var ye=0;ye<kt;++ye){var R=me[ye],P=R.charAt(0);R.length>=2&&P==="["?me[ye]=ct(R):P!=="\\"&&(me[ye]=R.replace(/[a-zA-Z]/g,function(C){var E=C.charCodeAt(0);return"["+String.fromCharCode(E&~32,E|32)+"]"}))}return me.join("")}for(var _t=[],ze=0,Ue=fe.length;ze<Ue;++ze){var Le=fe[ze];if(Le.global||Le.multiline)throw new Error(""+Le);_t.push("(?:"+St(Le)+")")}return new RegExp(_t.join("|"),Ve?"gi":"g")}function g(fe,De){var We=/(?:^|\s)nocode(?:\s|$)/,Ve=[],ze=0,Ue=[],Le=0;function Et(st){var nt=st.nodeType;if(nt==1){if(We.test(st.className))return;for(var ct=st.firstChild;ct;ct=ct.nextSibling)Et(ct);var St=st.nodeName.toLowerCase();(St==="br"||St==="li")&&(Ve[Le]=`
|
|
`,Ue[Le<<1]=ze++,Ue[Le++<<1|1]=st)}else if(nt==3||nt==4){var _t=st.nodeValue;_t.length&&(De?_t=_t.replace(/\r\n?/g,`
|
|
`):_t=_t.replace(/[ \t\r\n]+/g," "),Ve[Le]=_t,Ue[Le<<1]=ze,ze+=_t.length,Ue[Le++<<1|1]=st)}}return Et(fe),{sourceCode:Ve.join("").replace(/\n$/,""),spans:Ue}}function q(fe,De,We,Ve,ze){if(!We)return;var Ue={sourceNode:fe,pre:1,langExtension:null,numberLines:null,sourceCode:We,spans:null,basePos:De,decorations:null};Ve(Ue),ze.push.apply(ze,Ue.decorations)}var Te=/\S/;function we(fe){for(var De=void 0,We=fe.firstChild;We;We=We.nextSibling){var Ve=We.nodeType;De=Ve===1?De?fe:We:Ve===3&&Te.test(We.nodeValue)?fe:De}return De===fe?void 0:De}function $e(fe,De){var We={},Ve;(function(){for(var Le=fe.concat(De),Et=[],st={},nt=0,ct=Le.length;nt<ct;++nt){var St=Le[nt],_t=St[3];if(_t)for(var pt=_t.length;--pt>=0;)We[_t.charAt(pt)]=St;var me=St[1],kt=""+me;st.hasOwnProperty(kt)||(Et.push(me),st[kt]=null)}Et.push(/[\0-\uffff]/),Ve=S(Et)})();var ze=De.length,Ue=function(Le){for(var Et=Le.sourceCode,st=Le.basePos,nt=Le.sourceNode,ct=[st,b],St=0,_t=Et.match(Ve)||[],pt={},me=0,kt=_t.length;me<kt;++me){var ht=_t[me],ye=pt[ht],Ee=void 0,R;if(typeof ye=="string")R=!1;else{var O=We[ht.charAt(0)];if(O)Ee=ht.match(O[1]),ye=O[0];else{for(var P=0;P<ze;++P)if(O=De[P],Ee=ht.match(O[1]),Ee){ye=O[0];break}Ee||(ye=b)}R=ye.length>=5&&ye.substring(0,5)==="lang-",R&&!(Ee&&typeof Ee[1]=="string")&&(R=!1,ye=k),R||(pt[ht]=ye)}var y=St;if(St+=ht.length,!R)ct.push(st+y,ye);else{var _=Ee[1],C=ht.indexOf(_),E=C+_.length;Ee[2]&&(E=ht.length-Ee[2].length,C=E-_.length);var te=ye.substring(5);q(nt,st+y,ht.substring(0,C),Ue,ct),q(nt,st+y+C,_,w(te,_),ct),q(nt,st+y+E,ht.substring(E),Ue,ct)}}Le.decorations=ct};return Ue}function ot(fe){var De=[],We=[];fe.tripleQuotedStrings?De.push([K,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):fe.multiLineStrings?De.push([K,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([K,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),fe.verbatimStrings&&We.push([K,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ve=fe.hashComments;Ve&&(fe.cStyleComments?(Ve>1?De.push([ie,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([ie,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),We.push([K,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([ie,/^#[^\r\n]*/,null,"#"])),fe.cStyleComments&&(We.push([ie,/^\/\/[^\r\n]*/,null]),We.push([ie,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ze=fe.regexLiterals;if(ze){var Ue=ze>1?"":`
|
|
\r`,Le=Ue?".":"[\\S\\s]",Et="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";We.push(["lang-regex",RegExp("^"+be+"("+Et+")")])}var st=fe.types;st&&We.push([X,st]);var nt=(""+fe.keywords).replace(/^ | $/g,"");nt.length&&We.push([v,new RegExp("^(?:"+nt.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([b,/^\s+/,null,` \r
|
|
\xA0`]);var ct="^.[^\\s\\w.$@'\"`/\\\\]*";return fe.regexLiterals&&(ct+="(?!s*/)"),We.push([de,/^@[a-z_$][a-z_$@0-9]*/i,null],[X,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[b,/^[a-z_$][a-z_$@0-9]*/i,null],[de,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[b,/^\\[\s\S]?/,null],[A,new RegExp(ct),null]),$e(De,We)}var _e=ot({keywords:Ne,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function je(fe,De,We){for(var Ve=/(?:^|\s)nocode(?:\s|$)/,ze=/\r\n?|\n/,Ue=fe.ownerDocument,Le=Ue.createElement("li");fe.firstChild;)Le.appendChild(fe.firstChild);var Et=[Le];function st(me){var kt=me.nodeType;if(kt==1&&!Ve.test(me.className))if(me.nodeName==="br")nt(me),me.parentNode&&me.parentNode.removeChild(me);else for(var ht=me.firstChild;ht;ht=ht.nextSibling)st(ht);else if((kt==3||kt==4)&&We){var ye=me.nodeValue,Ee=ye.match(ze);if(Ee){var R=ye.substring(0,Ee.index);me.nodeValue=R;var O=ye.substring(Ee.index+Ee[0].length);if(O){var P=me.parentNode;P.insertBefore(Ue.createTextNode(O),me.nextSibling)}nt(me),R||me.parentNode.removeChild(me)}}}function nt(me){for(;!me.nextSibling;)if(me=me.parentNode,!me)return;function kt(Ee,R){var O=R?Ee.cloneNode(!1):Ee,P=Ee.parentNode;if(P){var y=kt(P,1),_=Ee.nextSibling;y.appendChild(O);for(var C=_;C;C=_)_=C.nextSibling,y.appendChild(C)}return O}for(var ht=kt(me.nextSibling,0),ye;(ye=ht.parentNode)&&ye.nodeType===1;)ht=ye;Et.push(ht)}for(var ct=0;ct<Et.length;++ct)st(Et[ct]);De===(De|0)&&Et[0].setAttribute("value",De);var St=Ue.createElement("ol");St.className="linenums";for(var _t=Math.max(0,De-1|0)||0,ct=0,pt=Et.length;ct<pt;++ct)Le=Et[ct],Le.className="L"+(ct+_t)%10,Le.firstChild||Le.appendChild(Ue.createTextNode("\xA0")),St.appendChild(Le);fe.appendChild(St)}function Se(fe){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var We=/\n/g,Ve=fe.sourceCode,ze=Ve.length,Ue=0,Le=fe.spans,Et=Le.length,st=0,nt=fe.decorations,ct=nt.length,St=0;nt[ct]=ze;var _t,pt;for(pt=_t=0;pt<ct;)nt[pt]!==nt[pt+2]?(nt[_t++]=nt[pt++],nt[_t++]=nt[pt++]):pt+=2;for(ct=_t,pt=_t=0;pt<ct;){for(var me=nt[pt],kt=nt[pt+1],ht=pt+2;ht+2<=ct&&nt[ht+1]===kt;)ht+=2;nt[_t++]=me,nt[_t++]=kt,pt=ht}ct=nt.length=_t;var ye=fe.sourceNode,Ee="";ye&&(Ee=ye.style.display,ye.style.display="none");try{for(var R=null;st<Et;){var O=Le[st],P=Le[st+2]||ze,y=nt[St+2]||ze,ht=Math.min(P,y),_=Le[st+1],C;if(_.nodeType!==1&&(C=Ve.substring(Ue,ht))){De&&(C=C.replace(We,"\r")),_.nodeValue=C;var E=_.ownerDocument,te=E.createElement("span");te.className=nt[St+1];var F=_.parentNode;F.replaceChild(te,_),te.appendChild(_),Ue<P&&(Le[st+1]=_=E.createTextNode(Ve.substring(ht,P)),F.insertBefore(_,te.nextSibling))}Ue=ht,Ue>=P&&(st+=2),Ue>=y&&(St+=2)}}finally{ye&&(ye.style.display=Ee)}}var Oe={};function Z(fe,De){for(var We=De.length;--We>=0;){var Ve=De[We];Oe.hasOwnProperty(Ve)?ee.console&&console.warn("cannot override language handler %s",Ve):Oe[Ve]=fe}}function w(fe,De){return fe&&Oe.hasOwnProperty(fe)||(fe=/^\s*</.test(De)?"default-markup":"default-code"),Oe[fe]}Z(_e,["default-code"]),Z($e([],[[b,/^[^<?]+/],[D,/^<!\w[^>]*(?:>|$)/],[ie,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[A,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Z($e([[b,/^[\s]+/,null,` \r
|
|
`],[he,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[U,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[G,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[A,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Z($e([],[[he,/^[\s\S]+/]]),["uq.val"]),Z(ot({keywords:I,hashComments:!0,cStyleComments:!0,types:ue}),["c","cc","cpp","cxx","cyc","m"]),Z(ot({keywords:"null,true,false"}),["json"]),Z(ot({keywords:z,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:ue}),["cs"]),Z(ot({keywords:le,cStyleComments:!0}),["java"]),Z(ot({keywords:pe,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Z(ot({keywords:ce,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Z(ot({keywords:B,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Z(ot({keywords:ne,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Z(ot({keywords:J,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Z(ot({keywords:V,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Z($e([],[[K,/^[\s\S]+/]]),["regex"]);function Be(fe){var De=fe.langExtension;try{var We=g(fe.sourceNode,fe.pre),Ve=We.sourceCode;fe.sourceCode=Ve,fe.spans=We.spans,fe.basePos=0,w(De,Ve)(fe),Se(fe)}catch(ze){ee.console&&console.log(ze&&ze.stack||ze)}}function ut(fe,De,We){var Ve=We||!1,ze=De||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+fe+"</pre>",Ue=Ue.firstChild,Ve&&je(Ue,Ve,!0);var Le={langExtension:ze,numberLines:Ve,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Be(Le),Ue.innerHTML}function wt(fe,De){var We=De||document.body,Ve=We.ownerDocument||document;function ze(O){return We.getElementsByTagName(O)}for(var Ue=[ze("pre"),ze("code"),ze("xmp")],Le=[],Et=0;Et<Ue.length;++Et)for(var st=0,nt=Ue[Et].length;st<nt;++st)Le.push(Ue[Et][st]);Ue=null;var ct=Date;ct.now||(ct={now:function(){return+new Date}});var St=0,_t=/\blang(?:uage)?-([\w.]+)(?!\S)/,pt=/\bprettyprint\b/,me=/\bprettyprinted\b/,kt=/pre|xmp/i,ht=/^code$/i,ye=/^(?:pre|code|xmp)$/i,Ee={};function R(){for(var O=ee.PR_SHOULD_USE_CONTINUATION?ct.now()+250:Infinity;St<Le.length&&ct.now()<O;St++){for(var P=Le[St],y=Ee,_=P;_=_.previousSibling;){var C=_.nodeType,E=(C===7||C===8)&&_.nodeValue;if(E?!/^\??prettify\b/.test(E):C!==3||/\S/.test(_.nodeValue))break;if(E){y={},E.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Nt,vt,Gt){y[vt]=Gt});break}}var te=P.className;if((y!==Ee||pt.test(te))&&!me.test(te)){for(var F=!1,ae=P.parentNode;ae;ae=ae.parentNode){var Ke=ae.tagName;if(ye.test(Ke)&&ae.className&&pt.test(ae.className)){F=!0;break}}if(!F){P.className+=" prettyprinted";var et=y.lang;if(!et){et=te.match(_t);var Ge;!et&&(Ge=we(P))&&ht.test(Ge.tagName)&&(et=Ge.className.match(_t)),et&&(et=et[1])}var mt;if(kt.test(P.tagName))mt=1;else{var Ot=P.currentStyle,Ye=Ve.defaultView,Bt=Ot?Ot.whiteSpace:Ye&&Ye.getComputedStyle?Ye.getComputedStyle(P,null).getPropertyValue("white-space"):0;mt=Bt&&Bt.substring(0,3)==="pre"}var Mt=y.linenums;(Mt=Mt==="true"||+Mt)||(Mt=te.match(/\blinenums\b(?::(\d+))?/),Mt=Mt?Mt[1]&&Mt[1].length?+Mt[1]:!0:!1),Mt&&je(P,Mt,mt);var Ft={langExtension:et,sourceNode:P,numberLines:Mt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};Be(Ft)}}}St<Le.length?ee.setTimeout(R,250):typeof fe=="function"&&fe()}R()}var Je=ee.PR={createSimpleLexer:$e,registerLangHandler:Z,sourceDecorator:ot,PR_ATTRIB_NAME:G,PR_ATTRIB_VALUE:he,PR_COMMENT:ie,PR_DECLARATION:D,PR_KEYWORD:v,PR_LITERAL:de,PR_NOCODE:Y,PR_PLAIN:b,PR_PUNCTUATION:A,PR_SOURCE:k,PR_STRING:K,PR_TAG:U,PR_TYPE:X,prettyPrintOne:oe?ee.prettyPrintOne=ut:ge=ut,prettyPrint:j=oe?ee.prettyPrint=wt:j=wt},qe=ee.define;typeof qe=="function"&&qe.amd&&qe("google-code-prettify",[],function(){return Je})})()},"VrN/":function(At,at,x){(function($,Pe){At.exports=Pe()})(this,function(){"use strict";var $=navigator.userAgent,Pe=navigator.platform,oe=/gecko\/\d/i.test($),Ce=/MSIE \d/.test($),ve=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($),ge=/Edge\/(\d+)/.exec($),j=Ce||ve||ge,ee=j&&(Ce?document.documentMode||6:+(ge||ve)[1]),W=!ge&&/WebKit\//.test($),se=W&&/Qt\/\d+\.\d+/.test($),L=!ge&&/Chrome\//.test($),I=/Opera\//.test($),le=/Apple Computer/.test(navigator.vendor),z=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test($),V=/PhantomJS/.test($),J=!ge&&/AppleWebKit/.test($)&&/Mobile\/\w+/.test($),B=/Android/.test($),ce=J||B||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test($),ne=J||/Mac/.test(Pe),pe=/\bCrOS\b/.test($),Ne=/win/i.test(Pe),ue=I&&$.match(/Version\/(\d*\.\d*)/);ue&&(ue=Number(ue[1])),ue&&ue>=15&&(I=!1,W=!0);var K=ne&&(se||I&&(ue==null||ue<12.11)),v=oe||j&&ee>=9;function ie(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var X=function(e,t){var i=e.className,n=ie(t).exec(i);if(n){var r=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(r?n[1]+r:"")}};function de(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return de(e).appendChild(t)}function b(e,t,i,n){var r=document.createElement(e);if(i&&(r.className=i),n&&(r.style.cssText=n),typeof t=="string")r.appendChild(document.createTextNode(t));else if(t)for(var s=0;s<t.length;++s)r.appendChild(t[s]);return r}function U(e,t,i,n){var r=b(e,t,i,n);return r.setAttribute("role","presentation"),r}var D;document.createRange?D=function(e,t,i,n){var r=document.createRange();return r.setEnd(n||e,i),r.setStart(e,t),r}:D=function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(r){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};function k(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function G(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function he(e,t){var i=e.className;ie(t).test(i)||(e.className+=(i?" ":"")+t)}function Y(e,t){for(var i=e.split(" "),n=0;n<i.length;n++)i[n]&&!ie(i[n]).test(t)&&(t+=" "+i[n]);return t}var be=function(e){e.select()};J?be=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(be=function(e){try{e.select()}catch(t){}});function S(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function g(e,t,i){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(i!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function q(e,t,i,n,r){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var s=n||0,l=r||0;;){var p=e.indexOf(" ",s);if(p<0||p>=t)return l+(t-s);l+=p-s,l+=i-l%i,s=p+1}}var Te=function(){this.id=null,this.f=null,this.time=0,this.handler=S(this.onTimeout,this)};Te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Te.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function we(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var $e=50,ot={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},je={origin:"*mouse"},Se={origin:"+move"};function Oe(e,t,i){for(var n=0,r=0;;){var s=e.indexOf(" ",n);s==-1&&(s=e.length);var l=s-n;if(s==e.length||r+l>=t)return n+Math.min(l,t-r);if(r+=s-n,r+=i-r%i,n=s+1,r>=t)return n}}var Z=[""];function w(e){for(;Z.length<=e;)Z.push(Be(Z)+" ");return Z[e]}function Be(e){return e[e.length-1]}function ut(e,t){for(var i=[],n=0;n<e.length;n++)i[n]=t(e[n],n);return i}function wt(e,t,i){for(var n=0,r=i(t);n<e.length&&i(e[n])<=r;)n++;e.splice(n,0,t)}function Je(){}function qe(e,t){var i;return Object.create?i=Object.create(e):(Je.prototype=e,i=new Je),t&&g(t,i),i}var fe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||fe.test(e))}function We(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Ve(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ze=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&ze.test(e)}function Le(e,t,i){for(;(i<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=i;return t}function Et(e,t,i){for(var n=t>i?-1:1;;){if(t==i)return t;var r=(t+i)/2,s=n<0?Math.ceil(r):Math.floor(r);if(s==t)return e(s)?t:i;e(s)?i=s:t=s+n}}function st(e,t,i,n){if(!e)return n(t,i,"ltr",0);for(var r=!1,s=0;s<e.length;++s){var l=e[s];(l.from<i&&l.to>t||t==i&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,i),l.level==1?"rtl":"ltr",s),r=!0)}r||n(t,i,"ltr")}var nt=null;function ct(e,t,i){var n;nt=null;for(var r=0;r<e.length;++r){var s=e[r];if(s.from<t&&s.to>t)return r;s.to==t&&(s.from!=s.to&&i=="before"?n=r:nt=r),s.from==t&&(s.from!=s.to&&i!="before"?n=r:nt=r)}return n!=null?n:nt}var St=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(m){return m<=247?e.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1785?t.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,s=/[LRr]/,l=/[Lb1n]/,p=/[1n]/;function f(m,T,M){this.level=m,this.from=T,this.to=M}return function(m,T){var M=T=="ltr"?"L":"R";if(m.length==0||T=="ltr"&&!n.test(m))return!1;for(var re=m.length,Q=[],xe=0;xe<re;++xe)Q.push(i(m.charCodeAt(xe)));for(var Fe=0,Xe=M;Fe<re;++Fe){var it=Q[Fe];it=="m"?Q[Fe]=Xe:Xe=it}for(var ft=0,rt=M;ft<re;++ft){var xt=Q[ft];xt=="1"&&rt=="r"?Q[ft]="n":s.test(xt)&&(rt=xt,xt=="r"&&(Q[ft]="R"))}for(var Ut=1,Dt=Q[0];Ut<re-1;++Ut){var Xt=Q[Ut];Xt=="+"&&Dt=="1"&&Q[Ut+1]=="1"?Q[Ut]="1":Xt==","&&Dt==Q[Ut+1]&&(Dt=="1"||Dt=="n")&&(Q[Ut]=Dt),Dt=Xt}for(var mn=0;mn<re;++mn){var In=Q[mn];if(In==",")Q[mn]="N";else if(In=="%"){var xn=void 0;for(xn=mn+1;xn<re&&Q[xn]=="%";++xn);for(var ai=mn&&Q[mn-1]=="!"||xn<re&&Q[xn]=="1"?"1":"N",ti=mn;ti<xn;++ti)Q[ti]=ai;mn=xn-1}}for(var Tn=0,ni=M;Tn<re;++Tn){var Wn=Q[Tn];ni=="L"&&Wn=="1"?Q[Tn]="L":s.test(Wn)&&(ni=Wn)}for(var Ln=0;Ln<re;++Ln)if(r.test(Q[Ln])){var An=void 0;for(An=Ln+1;An<re&&r.test(Q[An]);++An);for(var En=(Ln?Q[Ln-1]:M)=="L",ii=(An<re?Q[An]:M)=="L",cr=En==ii?En?"L":"R":M,Li=Ln;Li<An;++Li)Q[Li]=cr;Ln=An-1}for(var Vn=[],bi,jn=0;jn<re;)if(l.test(Q[jn])){var $o=jn;for(++jn;jn<re&&l.test(Q[jn]);++jn);Vn.push(new f(0,$o,jn))}else{var Ci=jn,Gi=Vn.length,Vi=T=="rtl"?1:0;for(++jn;jn<re&&Q[jn]!="L";++jn);for(var Kn=Ci;Kn<jn;)if(p.test(Q[Kn])){Ci<Kn&&(Vn.splice(Gi,0,new f(1,Ci,Kn)),Gi+=Vi);var hr=Kn;for(++Kn;Kn<jn&&p.test(Q[Kn]);++Kn);Vn.splice(Gi,0,new f(2,hr,Kn)),Gi+=Vi,Ci=Kn}else++Kn;Ci<jn&&Vn.splice(Gi,0,new f(1,Ci,jn))}return T=="ltr"&&(Vn[0].level==1&&(bi=m.match(/^\s+/))&&(Vn[0].from=bi[0].length,Vn.unshift(new f(0,0,bi[0].length))),Be(Vn).level==1&&(bi=m.match(/\s+$/))&&(Be(Vn).to-=bi[0].length,Vn.push(new f(0,re-bi[0].length,re)))),T=="rtl"?Vn.reverse():Vn}}();function _t(e,t){var i=e.order;return i==null&&(i=e.order=St(e.text,t)),i}var pt=[],me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||pt).concat(i)}};function kt(e,t){return e._handlers&&e._handlers[t]||pt}function ht(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers,r=n&&n[t];if(r){var s=we(r,i);s>-1&&(n[t]=r.slice(0,s).concat(r.slice(s+1)))}}}function ye(e,t){var i=kt(e,t);if(!i.length)return;for(var n=Array.prototype.slice.call(arguments,2),r=0;r<i.length;++r)i[r].apply(null,n)}function Ee(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ye(e,i||t.type,e,t),C(t)||t.codemirrorIgnore}function R(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)we(i,t[n])==-1&&i.push(t[n])}function O(e,t){return kt(e,t).length>0}function P(e){e.prototype.on=function(t,i){me(this,t,i)},e.prototype.off=function(t,i){ht(this,t,i)}}function y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function C(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function E(e){y(e),_(e)}function te(e){return e.target||e.srcElement}function F(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var ae=function(){if(j&&ee<9)return!1;var e=b("div");return"draggable"in e||"dragDrop"in e}(),Ke;function et(e){if(Ke==null){var t=b("span","\u200B");A(e,b("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&ee<8))}var i=Ke?b("span","\u200B"):b("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ge;function mt(e){if(Ge!=null)return Ge;var t=A(e,document.createTextNode("A\u062EA")),i=D(t,0,1).getBoundingClientRect(),n=D(t,1,2).getBoundingClientRect();return de(e),!i||i.left==i.right?!1:Ge=n.right-i.right<3}var Ot=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],n=e.length;t<=n;){var r=e.indexOf(`
|
|
`,t);r==-1&&(r=e.length);var s=e.slice(t,e.charAt(r-1)=="\r"?r-1:r),l=s.indexOf("\r");l!=-1?(i.push(s.slice(0,l)),t+=l+1):(i.push(s),t=r+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Ye=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Bt=function(){var e=b("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Ft(e){if(Mt!=null)return Mt;var t=A(e,b("span","x")),i=t.getBoundingClientRect(),n=D(t,0,1).getBoundingClientRect();return Mt=Math.abs(i.left-n.left)>1}var Nt={},vt={};function Gt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Nt[e]=t}function Wt(e,t){vt[e]=t}function He(e){if(typeof e=="string"&&vt.hasOwnProperty(e))e=vt[e];else if(e&&typeof e.name=="string"&&vt.hasOwnProperty(e.name)){var t=vt[e.name];typeof t=="string"&&(t={name:t}),e=qe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return He("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return He("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function yt(e,t){t=He(t);var i=Nt[t.name];if(!i)return yt(e,"text/plain");var n=i(e,t);if(dt.hasOwnProperty(t.name)){var r=dt[t.name];for(var s in r){if(!r.hasOwnProperty(s))continue;n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=r[s]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var dt={};function Ct(e,t){var i=dt.hasOwnProperty(e)?dt[e]:dt[e]={};g(t,i)}function Yt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var n in t){var r=t[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function Vt(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function ln(e,t,i){return e.startState?e.startState(t,i):!0}var Ht=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ht.prototype.eol=function(){return this.pos>=this.string.length},Ht.prototype.sol=function(){return this.pos==this.lineStart},Ht.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ht.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ht.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Ht.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ht.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ht.prototype.skipToEnd=function(){this.pos=this.string.length},Ht.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ht.prototype.backUp=function(e){this.pos-=e},Ht.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=q(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.indentation=function(){return q(this.string,null,this.tabSize)-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.match=function(e,t,i){if(typeof e=="string"){var n=function(l){return i?l.toLowerCase():l},r=this.string.substr(this.pos,e.length);if(n(r)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}},Ht.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ht.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ht.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ht.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function gt(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 i=e;!i.lines;)for(var n=0;;++n){var r=i.children[n],s=r.chunkSize();if(t<s){i=r;break}t-=s}return i.lines[t]}function qt(e,t,i){var n=[],r=t.line;return e.iter(t.line,i.line+1,function(s){var l=s.text;r==i.line&&(l=l.slice(0,i.ch)),r==t.line&&(l=l.slice(t.ch)),n.push(l),++r}),n}function Pt(e,t,i){var n=[];return e.iter(t,i,function(r){n.push(r.text)}),n}function Qt(e,t){var i=t-e.height;if(i)for(var n=e;n;n=n.parent)n.height+=i}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,i=we(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var r=0;!(n.children[r]==t);++r)i+=n.children[r].chunkSize();return i+t.first}function gn(e,t){var i=e.first;e:do{for(var n=0;n<e.children.length;++n){var r=e.children[n],s=r.height;if(t<s){e=r;continue e}t-=s,i+=r.chunkSize()}return i}while(!e.lines);for(var l=0;l<e.lines.length;++l){var p=e.lines[l],f=p.height;if(t<f)break;t-=f}return i+l}function $n(e,t){return t>=e.first&&t<e.first+e.size}function si(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ae(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ae))return new Ae(e,t,i);this.line=e,this.ch=t,this.sticky=i}function tt(e,t){return e.line-t.line||e.ch-t.ch}function dn(e,t){return e.sticky==t.sticky&&tt(e,t)==0}function cn(e){return Ae(e.line,e.ch)}function bn(e,t){return tt(e,t)<0?t:e}function _n(e,t){return tt(e,t)<0?e:t}function h(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function o(e,t){if(t.line<e.first)return Ae(e.first,0);var i=e.first+e.size-1;return t.line>i?Ae(i,gt(e,i).text.length):a(t,gt(e,t.line).text.length)}function a(e,t){var i=e.ch;return i==null||i>t?Ae(e.line,t):i<0?Ae(e.line,0):e}function u(e,t){for(var i=[],n=0;n<t.length;n++)i[n]=o(e,t[n]);return i}var d=function(e,t){this.state=e,this.lookAhead=t},c=function(e,t,i,n){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};c.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},c.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}},c.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},c.fromSaved=function(e,t,i){return t instanceof d?new c(e,Yt(e.mode,t.state),i,t.lookAhead):new c(e,Yt(e.mode,t),i)},c.prototype.save=function(e){var t=e!==!1?Yt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new d(t,this.maxLookAhead):t};function N(e,t,i,n){var r=[e.state.modeGen],s={};lt(e,t.text,e.doc.mode,i,function(m,T){return r.push(m,T)},s,n);for(var l=i.state,p=function(m){i.baseTokens=r;var T=e.state.overlays[m],M=1,re=0;i.state=!0,lt(e,t.text,T.mode,i,function(Q,xe){for(var Fe=M;re<Q;){var Xe=r[M];Xe>Q&&r.splice(M,1,Q,r[M+1],Xe),M+=2,re=Math.min(Q,Xe)}if(!xe)return;if(T.opaque)r.splice(Fe,M-Fe,Q,"overlay "+xe),M=Fe+2;else for(;Fe<M;Fe+=2){var it=r[Fe+1];r[Fe+1]=(it?it+" ":"")+"overlay "+xe}},s),i.state=l,i.baseTokens=null,i.baseTokenPos=1},f=0;f<e.state.overlays.length;++f)p(f);return{styles:r,classes:s.bgClass||s.textClass?s:null}}function Re(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ze(e,Lt(t)),r=t.text.length>e.options.maxHighlightLength&&Yt(e.doc.mode,n.state),s=N(e,t,n);r&&(n.state=r),t.stateAfter=n.save(!r),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ze(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState)return new c(n,!0,t);var s=Qe(e,t,i),l=s>n.first&>(n,s-1).stateAfter,p=l?c.fromSaved(n,l,s):new c(n,ln(n.mode),s);return n.iter(s,t,function(f){bt(e,f.text,p);var m=p.line;f.stateAfter=m==t-1||m%5==0||m>=r.viewFrom&&m<r.viewTo?p.save():null,p.nextLine()}),i&&(n.modeFrontier=p.line),p}function bt(e,t,i,n){var r=e.doc.mode,s=new Ht(t,e.options.tabSize,i);for(s.start=s.pos=n||0,t==""&&Me(r,i.state);!s.eol();)ke(r,s,i.state),s.start=s.pos}function Me(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Vt(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function ke(e,t,i,n){for(var r=0;r<10;r++){n&&(n[0]=Vt(e,i).mode);var s=e.token(t,i);if(t.pos>t.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}var H=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Ie(e,t,i,n){var r=e.doc,s=r.mode,l;t=o(r,t);var p=gt(r,t.line),f=Ze(e,t.line,i),m=new Ht(p.text,e.options.tabSize,f),T;for(n&&(T=[]);(n||m.pos<t.ch)&&!m.eol();)m.start=m.pos,l=ke(s,m,f.state),n&&T.push(new H(m,l,Yt(r.mode,f.state)));return n?T:new H(m,l,f.state)}function Rt(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";t[n]==null?t[n]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+i[2])}return e}function lt(e,t,i,n,r,s,l){var p=i.flattenSpans;p==null&&(p=e.options.flattenSpans);var f=0,m=null,T=new Ht(t,e.options.tabSize,n),M,re=e.options.addModeClass&&[null];for(t==""&&Rt(Me(i,n.state),s);!T.eol();){if(T.pos>e.options.maxHighlightLength?(p=!1,l&&bt(e,t,n,T.pos),T.pos=t.length,M=null):M=Rt(ke(i,T,n.state,re),s),re){var Q=re[0].name;Q&&(M="m-"+(M?Q+" "+M:Q))}if(!p||m!=M){for(;f<T.start;)f=Math.min(T.start,f+5e3),r(f,m);m=M}T.start=T.pos}for(;f<T.pos;){var xe=Math.min(T.pos,f+5e3);r(xe,m),f=xe}}function Qe(e,t,i){for(var n,r,s=e.doc,l=i?-1:t-(e.doc.mode.innerMode?1e3:100),p=t;p>l;--p){if(p<=s.first)return s.first;var f=gt(s,p-1),m=f.stateAfter;if(m&&(!i||p+(m instanceof d?m.lookAhead:0)<=s.modeFrontier))return p;var T=q(f.text,null,e.options.tabSize);(r==null||n>T)&&(r=p-1,n=T)}return r}function jt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,n=t-1;n>i;n--){var r=gt(e,n).stateAfter;if(r&&(!(r instanceof d)||n+r.lookAhead<t)){i=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var pn=!1,Jt=!1;function fn(){pn=!0}function on(){Jt=!0}function On(e,t,i){this.marker=e,this.from=t,this.to=i}function vn(e,t){if(e)for(var i=0;i<e.length;++i){var n=e[i];if(n.marker==t)return n}}function Un(e,t){for(var i,n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i}function Yn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zn(e,t,i){var n;if(e)for(var r=0;r<e.length;++r){var s=e[r],l=s.marker,p=s.from==null||(l.inclusiveLeft?s.from<=t:s.from<t);if(p||s.from==t&&l.type=="bookmark"&&(!i||!s.marker.insertLeft)){var f=s.to==null||(l.inclusiveRight?s.to>=t:s.to>t);(n||(n=[])).push(new On(l,s.from,f?null:s.to))}}return n}function Pn(e,t,i){var n;if(e)for(var r=0;r<e.length;++r){var s=e[r],l=s.marker,p=s.to==null||(l.inclusiveRight?s.to>=t:s.to>t);if(p||s.from==t&&l.type=="bookmark"&&(!i||s.marker.insertLeft)){var f=s.from==null||(l.inclusiveLeft?s.from<=t:s.from<t);(n||(n=[])).push(new On(l,f?null:s.from-t,s.to==null?null:s.to-t))}}return n}function qn(e,t){if(t.full)return null;var i=$n(e,t.from.line)&>(e,t.from.line).markedSpans,n=$n(e,t.to.line)&>(e,t.to.line).markedSpans;if(!i&&!n)return null;var r=t.from.ch,s=t.to.ch,l=tt(t.from,t.to)==0,p=zn(i,r,l),f=Pn(n,s,l),m=t.text.length==1,T=Be(t.text).length+(m?r:0);if(p)for(var M=0;M<p.length;++M){var re=p[M];if(re.to==null){var Q=vn(f,re.marker);Q?m&&(re.to=Q.to==null?null:Q.to+T):re.to=r}}if(f)for(var xe=0;xe<f.length;++xe){var Fe=f[xe];if(Fe.to!=null&&(Fe.to+=T),Fe.from==null){var Xe=vn(p,Fe.marker);Xe||(Fe.from=T,m&&(p||(p=[])).push(Fe))}else Fe.from+=T,m&&(p||(p=[])).push(Fe)}p&&(p=Hn(p)),f&&f!=p&&(f=Hn(f));var it=[p];if(!m){var ft=t.text.length-2,rt;if(ft>0&&p)for(var xt=0;xt<p.length;++xt)p[xt].to==null&&(rt||(rt=[])).push(new On(p[xt].marker,null,null));for(var Ut=0;Ut<ft;++Ut)it.push(rt);it.push(f)}return it}function Hn(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Mi(e,t,i){var n=null;if(e.iter(t.line,i.line+1,function(Q){if(Q.markedSpans)for(var xe=0;xe<Q.markedSpans.length;++xe){var Fe=Q.markedSpans[xe].marker;Fe.readOnly&&(!n||we(n,Fe)==-1)&&(n||(n=[])).push(Fe)}}),!n)return null;for(var r=[{from:t,to:i}],s=0;s<n.length;++s)for(var l=n[s],p=l.find(0),f=0;f<r.length;++f){var m=r[f];if(tt(m.to,p.from)<0||tt(m.from,p.to)>0)continue;var T=[f,1],M=tt(m.from,p.from),re=tt(m.to,p.to);(M<0||!l.inclusiveLeft&&!M)&&T.push({from:m.from,to:p.from}),(re>0||!l.inclusiveRight&&!re)&&T.push({from:p.to,to:m.to}),r.splice.apply(r,T),f+=T.length-3}return r}function Ni(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function dr(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Cn(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Bn(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var n=e.find(),r=t.find(),s=tt(n.from,r.from)||Cn(e)-Cn(t);if(s)return-s;var l=tt(n.to,r.to)||tn(e)-tn(t);return l||t.id-e.id}function en(e,t){var i=Jt&&e.markedSpans,n;if(i)for(var r=void 0,s=0;s<i.length;++s)r=i[s],r.marker.collapsed&&(t?r.from:r.to)==null&&(!n||Bn(n,r.marker)<0)&&(n=r.marker);return n}function kn(e){return en(e,!0)}function an(e){return en(e,!1)}function gi(e,t){var i=Jt&&e.markedSpans,n;if(i)for(var r=0;r<i.length;++r){var s=i[r];s.marker.collapsed&&(s.from==null||s.from<t)&&(s.to==null||s.to>t)&&(!n||Bn(n,s.marker)<0)&&(n=s.marker)}return n}function wn(e,t,i,n,r){var s=gt(e,t),l=Jt&&s.markedSpans;if(l)for(var p=0;p<l.length;++p){var f=l[p];if(!f.marker.collapsed)continue;var m=f.marker.find(0),T=tt(m.from,i)||Cn(f.marker)-Cn(r),M=tt(m.to,n)||tn(f.marker)-tn(r);if(T>=0&&M<=0||T<=0&&M>=0)continue;if(T<=0&&(f.marker.inclusiveRight&&r.inclusiveLeft?tt(m.to,i)>=0:tt(m.to,i)>0)||T>=0&&(f.marker.inclusiveRight&&r.inclusiveLeft?tt(m.from,n)<=0:tt(m.from,n)<0))return!0}}function Jn(e){for(var t;t=kn(e);)e=t.find(-1,!0).line;return e}function Xi(e){for(var t;t=an(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=an(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Ei(e,t){var i=gt(e,t),n=Jn(i);return i==n?t:Lt(n)}function Br(e,t){if(t>e.lastLine())return t;var i=gt(e,t),n;if(!ri(e,i))return t;for(;n=an(i);)i=n.find(1,!0).line;return Lt(i)+1}function ri(e,t){var i=Jt&&t.markedSpans;if(i)for(var n=void 0,r=0;r<i.length;++r){if(n=i[r],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&pr(e,t,n))return!0}}function pr(e,t,i){if(i.to==null){var n=i.marker.find(1,!0);return pr(e,n.line,vn(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var r=void 0,s=0;s<t.markedSpans.length;++s)if(r=t.markedSpans[s],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(r.to==null||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&pr(e,t,r))return!0}function di(e){e=Jn(e);for(var t=0,i=e.parent,n=0;n<i.lines.length;++n){var r=i.lines[n];if(r==e)break;t+=r.height}for(var s=i.parent;s;i=s,s=i.parent)for(var l=0;l<s.children.length;++l){var p=s.children[l];if(p==i)break;t+=p.height}return t}function $i(e){if(e.height==0)return 0;for(var t=e.text.length,i,n=e;i=kn(n);){var r=i.find(0,!0);n=r.from.line,t+=r.from.ch-r.to.ch}for(n=e;i=an(n);){var s=i.find(0,!0);t-=n.text.length-s.from.ch,n=s.to.line,t+=n.text.length-s.to.ch}return t}function Fr(e){var t=e.display,i=e.doc;t.maxLine=gt(i,i.first),t.maxLineLength=$i(t.maxLine),t.maxLineChanged=!0,i.iter(function(n){var r=$i(n);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=n)})}var Di=function(e,t,i){this.text=e,dr(this,t),this.height=i?i(this):1};Di.prototype.lineNo=function(){return Lt(this)},P(Di);function qo(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ni(e),dr(e,i);var r=n?n(e):1;r!=e.height&&Qt(e,r)}function co(e){e.parent=null,Ni(e)}var Tt={},zt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?zt:Tt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Kt(e,t){var i=U("span",null,null,W?"padding-right: .1px":null),n={pre:U("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var s=r?t.rest[r-1]:t.line,l=void 0;n.pos=0,n.addToken=un,mt(e.display.measure)&&(l=_t(s,e.doc.direction))&&(n.addToken=Rn(n.addToken,l)),n.map=[];var p=t!=e.display.externalMeasured&&Lt(s);$t(s,n,Re(e,s,p)),s.styleClasses&&(s.styleClasses.bgClass&&(n.bgClass=Y(s.styleClasses.bgClass,n.bgClass||"")),s.styleClasses.textClass&&(n.textClass=Y(s.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(et(e.display.measure))),r==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(W){var f=n.content.lastChild;(/\bcm-tab\b/.test(f.className)||f.querySelector&&f.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return ye(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Y(n.pre.className,n.textClass||"")),n}function nn(e){var t=b("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function un(e,t,i,n,r,s,l){if(!t)return;var p=e.splitSpaces?Zt(t,e.trailingSpace):t,f=e.cm.state.specialChars,m=!1,T;if(!f.test(t))e.col+=t.length,T=document.createTextNode(p),e.map.push(e.pos,e.pos+t.length,T),j&&ee<9&&(m=!0),e.pos+=t.length;else{T=document.createDocumentFragment();for(var M=0;;){f.lastIndex=M;var re=f.exec(t),Q=re?re.index-M:t.length-M;if(Q){var xe=document.createTextNode(p.slice(M,M+Q));j&&ee<9?T.appendChild(b("span",[xe])):T.appendChild(xe),e.map.push(e.pos,e.pos+Q,xe),e.col+=Q,e.pos+=Q}if(!re)break;M+=Q+1;var Fe=void 0;if(re[0]==" "){var Xe=e.cm.options.tabSize,it=Xe-e.col%Xe;Fe=T.appendChild(b("span",w(it),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=it}else re[0]=="\r"||re[0]==`
|
|
`?(Fe=T.appendChild(b("span",re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",re[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(re[0]),Fe.setAttribute("cm-text",re[0]),j&&ee<9?T.appendChild(b("span",[Fe])):T.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=p.charCodeAt(t.length-1)==32,i||n||r||m||s||l){var ft=i||"";n&&(ft+=n),r&&(ft+=r);var rt=b("span",[T],ft,s);if(l)for(var xt in l)l.hasOwnProperty(xt)&&xt!="style"&&xt!="class"&&rt.setAttribute(xt,l[xt]);return e.content.appendChild(rt)}e.content.appendChild(T)}function Zt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,n="",r=0;r<e.length;r++){var s=e.charAt(r);s==" "&&i&&(r==e.length-1||e.charCodeAt(r+1)==32)&&(s="\xA0"),n+=s,i=s==" "}return n}function Rn(e,t){return function(i,n,r,s,l,p,f){r=r?r+" cm-force-border":"cm-force-border";for(var m=i.pos,T=m+n.length;;){for(var M=void 0,re=0;re<t.length&&!(M=t[re],M.to>m&&M.from<=m);re++);if(M.to>=T)return e(i,n,r,s,l,p,f);e(i,n.slice(0,M.to-m),r,s,null,p,f),s=null,n=n.slice(M.to-m),m=M.to}}}function Zn(e,t,i,n){var r=!n&&i.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!n&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function $t(e,t,i){var n=e.markedSpans,r=e.text,s=0;if(!n){for(var l=1;l<i.length;l+=2)t.addToken(t,r.slice(s,s=i[l]),It(i[l+1],t.cm.options));return}for(var p=r.length,f=0,m=1,T="",M,re,Q=0,xe,Fe,Xe,it,ft;;){if(Q==f){xe=Fe=Xe=re="",ft=null,it=null,Q=Infinity;for(var rt=[],xt=void 0,Ut=0;Ut<n.length;++Ut){var Dt=n[Ut],Xt=Dt.marker;if(Xt.type=="bookmark"&&Dt.from==f&&Xt.widgetNode)rt.push(Xt);else if(Dt.from<=f&&(Dt.to==null||Dt.to>f||Xt.collapsed&&Dt.to==f&&Dt.from==f)){if(Dt.to!=null&&Dt.to!=f&&Q>Dt.to&&(Q=Dt.to,Fe=""),Xt.className&&(xe+=" "+Xt.className),Xt.css&&(re=(re?re+";":"")+Xt.css),Xt.startStyle&&Dt.from==f&&(Xe+=" "+Xt.startStyle),Xt.endStyle&&Dt.to==Q&&(xt||(xt=[])).push(Xt.endStyle,Dt.to),Xt.title&&((ft||(ft={})).title=Xt.title),Xt.attributes)for(var mn in Xt.attributes)(ft||(ft={}))[mn]=Xt.attributes[mn];Xt.collapsed&&(!it||Bn(it.marker,Xt)<0)&&(it=Dt)}else Dt.from>f&&Q>Dt.from&&(Q=Dt.from)}if(xt)for(var In=0;In<xt.length;In+=2)xt[In+1]==Q&&(Fe+=" "+xt[In]);if(!it||it.from==f)for(var xn=0;xn<rt.length;++xn)Zn(t,0,rt[xn]);if(it&&(it.from||0)==f){if(Zn(t,(it.to==null?p+1:it.to)-f,it.marker,it.from==null),it.to==null)return;it.to==f&&(it=!1)}}if(f>=p)break;for(var ai=Math.min(p,Q);;){if(T){var ti=f+T.length;if(!it){var Tn=ti>ai?T.slice(0,ai-f):T;t.addToken(t,Tn,M?M+xe:xe,Xe,f+Tn.length==Q?Fe:"",re,ft)}if(ti>=ai){T=T.slice(ai-f),f=ai;break}f=ti,Xe=""}T=r.slice(s,s=i[m++]),M=It(i[m++],t.cm.options)}}}function wi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Lt(Be(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ri(e,t)}function rn(e,t,i){for(var n=[],r,s=t;s<i;s=r){var l=new wi(e.doc,gt(e.doc,s),s);r=s+l.size,n.push(l)}return n}var Mn=null;function ci(e){Mn?Mn.ops.push(e):e.ownsGroup=Mn={ops:[e],delayedCallbacks:[]}}function hi(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var n=0;n<e.ops.length;n++){var r=e.ops[n];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(i<t.length)}function Wr(e,t){var i=e.ownsGroup;if(!i)return;try{hi(i)}finally{Mn=null,t(i)}}var fr=null;function Fn(e,t){var i=kt(e,t);if(!i.length)return;var n=Array.prototype.slice.call(arguments,2),r;Mn?r=Mn.delayedCallbacks:fr?r=fr:(r=fr=[],setTimeout(Ls,0));for(var s=function(p){r.push(function(){return i[p].apply(null,n)})},l=0;l<i.length;++l)s(l)}function Ls(){var e=fr;fr=null;for(var t=0;t<e.length;++t)e[t]()}function Jo(e,t,i,n){for(var r=0;r<t.changes.length;r++){var s=t.changes[r];s=="text"?Ns(e,t):s=="gutter"?Qo(e,t,i,n):s=="class"?ho(e,t):s=="widget"&&Ds(e,t,n)}t.changes=null}function mr(e){return e.node==e.text&&(e.node=b("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&ee<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var n=mr(t);t.background=n.insertBefore(b("div",null,i),n.firstChild),e.display.input.setUneditable(t.background)}}function Zo(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Kt(e,t)}function Ns(e,t){var i=t.text.className,n=Zo(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ho(e,t)):i&&(t.text.className=i)}function ho(e,t){Ms(e,t),t.line.wrapClass?mr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Qo(e,t,i,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var r=mr(t);t.gutterBackground=b("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),r.insertBefore(t.gutterBackground,t.text)}var s=t.line.gutterMarkers;if(e.options.lineNumbers||s){var l=mr(t),p=t.gutter=b("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(p),l.insertBefore(p,t.text),t.line.gutterClass&&(p.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!s||!s["CodeMirror-linenumbers"])&&(t.lineNumber=p.appendChild(b("div",si(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),s)for(var f=0;f<e.display.gutterSpecs.length;++f){var m=e.display.gutterSpecs[f].className,T=s.hasOwnProperty(m)&&s[m];T&&p.appendChild(b("div",[T],"CodeMirror-gutter-elt","left: "+n.gutterLeft[m]+"px; width: "+n.gutterWidth[m]+"px"))}}}function Ds(e,t,i){t.alignable&&(t.alignable=null);for(var n=ie("CodeMirror-linewidget"),r=t.node.firstChild,s=void 0;r;r=s)s=r.nextSibling,n.test(r.className)&&t.node.removeChild(r);ea(e,t,i)}function Is(e,t,i,n){var r=Zo(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),ho(e,t),Qo(e,t,i,n),ea(e,t,n),t.node}function ea(e,t,i){if(ta(e,t.line,t,i,!0),t.rest)for(var n=0;n<t.rest.length;n++)ta(e,t.rest[n],t,i,!1)}function ta(e,t,i,n,r){if(!t.widgets)return;for(var s=mr(i),l=0,p=t.widgets;l<p.length;++l){var f=p[l],m=b("div",[f.node],"CodeMirror-linewidget"+(f.className?" "+f.className:""));f.handleMouseEvents||m.setAttribute("cm-ignore-events","true"),js(f,m,i,n),e.display.input.setUneditable(m),r&&f.above?s.insertBefore(m,i.gutter||i.text):s.appendChild(m),Fn(f,"redraw")}}function js(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var r=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(r-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=r+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function gr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!k(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,b("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function xi(e,t){for(var i=te(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function zr(e){return e.lineSpace.offsetTop}function po(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function na(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,b("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function vi(e){return $e-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-vi(e)-e.display.barWidth}function fo(e){return e.display.scroller.clientHeight-vi(e)-e.display.barHeight}function Us(e,t,i){var n=e.options.lineWrapping,r=n&&Ii(e);if(!t.measure.heights||n&&t.measure.width!=r){var s=t.measure.heights=[];if(n){t.measure.width=r;for(var l=t.text.firstChild.getClientRects(),p=0;p<l.length-1;p++){var f=l[p],m=l[p+1];Math.abs(f.bottom-m.bottom)>2&&s.push((f.bottom+m.top)/2-i.top)}}s.push(i.bottom-i.top)}}function ia(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var r=0;r<e.rest.length;r++)if(Lt(e.rest[r])>i)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Bs(e,t){t=Jn(t);var i=Lt(t),n=e.display.externalMeasured=new wi(e.doc,t,i);n.lineN=i;var r=n.built=Kt(e,n);return n.text=r.pre,A(e.display.lineMeasure,r.pre),n}function ra(e,t,i,n){return yi(e,Yi(e,t),i,n)}function mo(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Bi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Yi(e,t){var i=Lt(t),n=mo(e,i);n&&!n.text?n=null:n&&n.changes&&(Jo(e,n,i,_o(e)),e.curOp.forceUpdate=!0),n||(n=Bs(e,t));var r=ia(n,t,i);return{line:t,view:n,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function yi(e,t,i,n,r){t.before&&(i=-1);var s=i+(n||""),l;return t.cache.hasOwnProperty(s)?l=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),l=Ws(e,t,i,n),l.bogus||(t.cache[s]=l)),{left:l.left,right:l.right,top:r?l.rtop:l.top,bottom:r?l.rbottom:l.bottom}}var oa={left:0,right:0,top:0,bottom:0};function aa(e,t,i){for(var n,r,s,l,p,f,m=0;m<e.length;m+=3)if(p=e[m],f=e[m+1],t<p?(r=0,s=1,l="left"):t<f?(r=t-p,s=r+1):(m==e.length-3||t==f&&e[m+3]>t)&&(s=f-p,r=s-1,t>=f&&(l="right")),r!=null){if(n=e[m+2],p==f&&i==(n.insertLeft?"left":"right")&&(l=i),i=="left"&&r==0)for(;m&&e[m-2]==e[m-3]&&e[m-1].insertLeft;)n=e[(m-=3)+2],l="left";if(i=="right"&&r==f-p)for(;m<e.length-3&&e[m+3]==e[m+4]&&!e[m+5].insertLeft;)n=e[(m+=3)+2],l="right";break}return{node:n,start:r,end:s,collapse:l,coverStart:p,coverEnd:f}}function Fs(e,t){var i=oa;if(t=="left")for(var n=0;n<e.length&&!((i=e[n]).left!=i.right);n++);else for(var r=e.length-1;r>=0&&!((i=e[r]).left!=i.right);r--);return i}function Ws(e,t,i,n){var r=aa(t.map,i,n),s=r.node,l=r.start,p=r.end,f=r.collapse,m;if(s.nodeType==3){for(var T=0;T<4;T++){for(;l&&Ue(t.line.text.charAt(r.coverStart+l));)--l;for(;r.coverStart+p<r.coverEnd&&Ue(t.line.text.charAt(r.coverStart+p));)++p;if(j&&ee<9&&l==0&&p==r.coverEnd-r.coverStart?m=s.parentNode.getBoundingClientRect():m=Fs(D(s,l,p).getClientRects(),n),m.left||m.right||l==0)break;p=l,l=l-1,f="right"}j&&ee<11&&(m=zs(e.display.measure,m))}else{l>0&&(f=n="right");var M;e.options.lineWrapping&&(M=s.getClientRects()).length>1?m=M[n=="right"?M.length-1:0]:m=s.getBoundingClientRect()}if(j&&ee<9&&!l&&(!m||!m.left&&!m.right)){var re=s.parentNode.getClientRects()[0];re?m={left:re.left,right:re.left+Ji(e.display),top:re.top,bottom:re.bottom}:m=oa}for(var Q=m.top-t.rect.top,xe=m.bottom-t.rect.top,Fe=(Q+xe)/2,Xe=t.view.measure.heights,it=0;it<Xe.length-1&&!(Fe<Xe[it]);it++);var ft=it?Xe[it-1]:0,rt=Xe[it],xt={left:(f=="right"?m.right:m.left)-t.rect.left,right:(f=="left"?m.left:m.right)-t.rect.left,top:ft,bottom:rt};return!m.left&&!m.right&&(xt.bogus=!0),e.options.singleCursorHeightPerLine||(xt.rtop=Q,xt.rbottom=xe),xt}function zs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ft(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*n,bottom:t.bottom*n}}function sa(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function la(e){e.display.externalMeasure=null,de(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)sa(e.display.view[t])}function vr(e){la(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ua(){return L&&B?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ca(){return L&&B?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function go(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gr(e.widgets[i]));return t}function Hr(e,t,i,n,r){if(!r){var s=go(t);i.top+=s,i.bottom+=s}if(n=="line")return i;n||(n="local");var l=di(t);if(n=="local"?l+=zr(e.display):l-=e.display.viewOffset,n=="page"||n=="window"){var p=e.display.lineSpace.getBoundingClientRect();l+=p.top+(n=="window"?0:ca());var f=p.left+(n=="window"?0:ua());i.left+=f,i.right+=f}return i.top+=l,i.bottom+=l,i}function ha(e,t,i){if(i=="div")return t;var n=t.left,r=t.top;if(i=="page")n-=ua(),r-=ca();else if(i=="local"||!i){var s=e.display.sizer.getBoundingClientRect();n+=s.left,r+=s.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:r-l.top}}function vo(e,t,i,n,r){return n||(n=gt(e.doc,t.line)),Hr(e,n,ra(e,n,t.ch,r),i)}function pi(e,t,i,n,r,s){n=n||gt(e.doc,t.line),r||(r=Yi(e,n));function l(xe,Fe){var Xe=yi(e,r,xe,Fe?"right":"left",s);return Fe?Xe.left=Xe.right:Xe.right=Xe.left,Hr(e,n,Xe,i)}var p=_t(n,e.doc.direction),f=t.ch,m=t.sticky;if(f>=n.text.length?(f=n.text.length,m="before"):f<=0&&(f=0,m="after"),!p)return l(m=="before"?f-1:f,m=="before");function T(xe,Fe,Xe){var it=p[Fe],ft=it.level==1;return l(Xe?xe-1:xe,ft!=Xe)}var M=ct(p,f,m),re=nt,Q=T(f,M,m=="before");return re!=null&&(Q.other=T(f,re,m!="before")),Q}function da(e,t){var i=0;t=o(e.doc,t),e.options.lineWrapping||(i=Ji(e.display)*t.ch);var n=gt(e.doc,t.line),r=di(n)+zr(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function yo(e,t,i,n,r){var s=Ae(e,t,i);return s.xRel=r,n&&(s.outside=n),s}function bo(e,t,i){var n=e.doc;if(i+=e.display.viewOffset,i<0)return yo(n.first,0,null,-1,-1);var r=gn(n,i),s=n.first+n.size-1;if(r>s)return yo(n.first+n.size-1,gt(n,s).text.length,null,1,1);t<0&&(t=0);for(var l=gt(n,r);;){var p=Hs(e,l,r,t,i),f=gi(l,p.ch+(p.xRel>0||p.outside>0?1:0));if(!f)return p;var m=f.find(1);if(m.line==r)return m;l=gt(n,r=m.line)}}function pa(e,t,i,n){n-=go(t);var r=t.text.length,s=Et(function(l){return yi(e,i,l-1).bottom<=n},r,0);return r=Et(function(l){return yi(e,i,l).top>n},s,r),{begin:s,end:r}}function fa(e,t,i,n){i||(i=Yi(e,t));var r=Hr(e,t,yi(e,i,n),"line").top;return pa(e,t,i,r)}function xo(e,t,i,n){return e.bottom<=i?!1:e.top>i?!0:(n?e.left:e.right)>t}function Hs(e,t,i,n,r){r-=di(t);var s=Yi(e,t),l=go(t),p=0,f=t.text.length,m=!0,T=_t(t,e.doc.direction);if(T){var M=(e.options.lineWrapping?Vs:Gs)(e,t,i,s,T,n,r);m=M.level!=1,p=m?M.from:M.to-1,f=m?M.to:M.from-1}var re=null,Q=null,xe=Et(function(Ut){var Dt=yi(e,s,Ut);return Dt.top+=l,Dt.bottom+=l,xo(Dt,n,r,!1)?(Dt.top<=r&&Dt.left<=n&&(re=Ut,Q=Dt),!0):!1},p,f),Fe,Xe,it=!1;if(Q){var ft=n-Q.left<Q.right-n,rt=ft==m;xe=re+(rt?0:1),Xe=rt?"after":"before",Fe=ft?Q.left:Q.right}else{!m&&(xe==f||xe==p)&&xe++,Xe=xe==0?"after":xe==t.text.length?"before":yi(e,s,xe-(m?1:0)).bottom+l<=r==m?"after":"before";var xt=pi(e,Ae(i,xe,Xe),"line",t,s);Fe=xt.left,it=r<xt.top?-1:r>=xt.bottom?1:0}return xe=Le(t.text,xe,1),yo(i,xe,Xe,it,n-Fe)}function Gs(e,t,i,n,r,s,l){var p=Et(function(M){var re=r[M],Q=re.level!=1;return xo(pi(e,Ae(i,Q?re.to:re.from,Q?"before":"after"),"line",t,n),s,l,!0)},0,r.length-1),f=r[p];if(p>0){var m=f.level!=1,T=pi(e,Ae(i,m?f.from:f.to,m?"after":"before"),"line",t,n);xo(T,s,l,!0)&&T.top>l&&(f=r[p-1])}return f}function Vs(e,t,i,n,r,s,l){var p=pa(e,t,n,l),f=p.begin,m=p.end;/\s/.test(t.text.charAt(m-1))&&m--;for(var T=null,M=null,re=0;re<r.length;re++){var Q=r[re];if(Q.from>=m||Q.to<=f)continue;var xe=Q.level!=1,Fe=yi(e,n,xe?Math.min(m,Q.to)-1:Math.max(f,Q.from)).right,Xe=Fe<s?s-Fe+1e9:Fe-s;(!T||M>Xe)&&(T=Q,M=Xe)}return T||(T=r[r.length-1]),T.from<f&&(T={from:f,to:T.to,level:T.level}),T.to>m&&(T={from:T.from,to:m,level:T.level}),T}var ji;function qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ji==null){ji=b("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ji.appendChild(document.createTextNode("x")),ji.appendChild(b("br"));ji.appendChild(document.createTextNode("x"))}A(e.measure,ji);var i=ji.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),de(e.measure),i||1}function Ji(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=b("span","xxxxxxxxxx"),i=b("pre",[t],"CodeMirror-line-like");A(e.measure,i);var n=t.getBoundingClientRect(),r=(n.right-n.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function _o(e){for(var t=e.display,i={},n={},r=t.gutters.clientLeft,s=t.gutters.firstChild,l=0;s;s=s.nextSibling,++l){var p=e.display.gutterSpecs[l].className;i[p]=s.offsetLeft+s.clientLeft+r,n[p]=s.clientWidth}return{fixedPos:Co(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Co(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ma(e){var t=qi(e.display),i=e.options.lineWrapping,n=i&&Math.max(5,e.display.scroller.clientWidth/Ji(e.display)-3);return function(r){if(ri(e.doc,r))return 0;var s=0;if(r.widgets)for(var l=0;l<r.widgets.length;l++)r.widgets[l].height&&(s+=r.widgets[l].height);return i?s+(Math.ceil(r.text.length/n)||1)*t:s+t}}function Eo(e){var t=e.doc,i=ma(e);t.iter(function(n){var r=i(n);r!=n.height&&Qt(n,r)})}function Ui(e,t,i,n){var r=e.display;if(!i&&te(t).getAttribute("cm-not-content")=="true")return null;var s,l,p=r.lineSpace.getBoundingClientRect();try{s=t.clientX-p.left,l=t.clientY-p.top}catch(M){return null}var f=bo(e,s,l),m;if(n&&f.xRel>0&&(m=gt(e.doc,f.line).text).length==f.ch){var T=q(m,m.length,e.options.tabSize)-m.length;f=Ae(f.line,Math.max(0,Math.round((s-na(e.display).left)/Ji(e.display))-T))}return f}function Bi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,n=0;n<i.length;n++)if(t-=i[n].size,t<0)return n}function Qn(e,t,i,n){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&i<r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Jt&&Ei(e.doc,t)<r.viewTo&&ki(e);else if(i<=r.viewFrom)Jt&&Br(e.doc,i+n)>r.viewFrom?ki(e):(r.viewFrom+=n,r.viewTo+=n);else if(t<=r.viewFrom&&i>=r.viewTo)ki(e);else if(t<=r.viewFrom){var s=Gr(e,i,i+n,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=n):ki(e)}else if(i>=r.viewTo){var l=Gr(e,t,t,-1);l?(r.view=r.view.slice(0,l.index),r.viewTo=l.lineN):ki(e)}else{var p=Gr(e,t,t,-1),f=Gr(e,i,i+n,1);p&&f?(r.view=r.view.slice(0,p.index).concat(rn(e,p.lineN,f.lineN)).concat(r.view.slice(f.index)),r.viewTo+=n):ki(e)}var m=r.externalMeasured;m&&(i<m.lineN?m.lineN+=n:t<m.lineN+m.size&&(r.externalMeasured=null))}function Si(e,t,i){e.curOp.viewChanged=!0;var n=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var s=n.view[Bi(e,t)];if(s.node==null)return;var l=s.changes||(s.changes=[]);we(l,i)==-1&&l.push(i)}function ki(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gr(e,t,i,n){var r=Bi(e,t),s,l=e.display.view;if(!Jt||i==e.doc.first+e.doc.size)return{index:r,lineN:i};for(var p=e.display.viewFrom,f=0;f<r;f++)p+=l[f].size;if(p!=t){if(n>0){if(r==l.length-1)return null;s=p+l[r].size-t,r++}else s=p-t;t+=s,i+=s}for(;Ei(e.doc,i)!=i;){if(r==(n<0?0:l.length-1))return null;i+=n*l[r-(n<0?1:0)].size,r+=n}return{index:r,lineN:i}}function Xs(e,t,i){var n=e.display,r=n.view;r.length==0||t>=n.viewTo||i<=n.viewFrom?(n.view=rn(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=rn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Bi(e,t))),n.viewFrom=t,n.viewTo<i?n.view=n.view.concat(rn(e,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,Bi(e,i)))),n.viewTo=i}function ga(e){for(var t=e.display.view,i=0,n=0;n<t.length;n++){var r=t[n];!r.hidden&&(!r.node||r.changes)&&++i}return i}function yr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function va(e,t){t===void 0&&(t=!0);for(var i=e.doc,n={},r=n.cursors=document.createDocumentFragment(),s=n.selection=document.createDocumentFragment(),l=0;l<i.sel.ranges.length;l++){if(!t&&l==i.sel.primIndex)continue;var p=i.sel.ranges[l];if(p.from().line>=e.display.viewTo||p.to().line<e.display.viewFrom)continue;var f=p.empty();(f||e.options.showCursorWhenSelecting)&&ya(e,p.head,r),f||Ks(e,p,s)}return n}function ya(e,t,i){var n=pi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=i.appendChild(b("div","\xA0","CodeMirror-cursor"));if(r.style.left=n.left+"px",r.style.top=n.top+"px",r.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var s=i.appendChild(b("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Vr(e,t){return e.top-t.top||e.left-t.left}function Ks(e,t,i){var n=e.display,r=e.doc,s=document.createDocumentFragment(),l=na(e.display),p=l.left,f=Math.max(n.sizerWidth,Ii(e)-n.sizer.offsetLeft)-l.right,m=r.direction=="ltr";function T(rt,xt,Ut,Dt){xt<0&&(xt=0),xt=Math.round(xt),Dt=Math.round(Dt),s.appendChild(b("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
|
|
top: `+xt+"px; width: "+(Ut==null?f-rt:Ut)+`px;
|
|
height: `+(Dt-xt)+"px"))}function M(rt,xt,Ut){var Dt=gt(r,rt),Xt=Dt.text.length,mn,In;function xn(Tn,ni){return vo(e,Ae(rt,Tn),"div",Dt,ni)}function ai(Tn,ni,Wn){var Ln=fa(e,Dt,null,Tn),An=ni=="ltr"==(Wn=="after")?"left":"right",En=Wn=="after"?Ln.begin:Ln.end-(/\s/.test(Dt.text.charAt(Ln.end-1))?2:1);return xn(En,An)[An]}var ti=_t(Dt,r.direction);return st(ti,xt||0,Ut==null?Xt:Ut,function(Tn,ni,Wn,Ln){var An=Wn=="ltr",En=xn(Tn,An?"left":"right"),ii=xn(ni-1,An?"right":"left"),cr=xt==null&&Tn==0,Li=Ut==null&&ni==Xt,Vn=Ln==0,bi=!ti||Ln==ti.length-1;if(ii.top-En.top<=3){var jn=(m?cr:Li)&&Vn,$o=(m?Li:cr)&&bi,Ci=jn?p:(An?En:ii).left,Gi=$o?f:(An?ii:En).right;T(Ci,En.top,Gi-Ci,En.bottom)}else{var Vi,Kn,hr,Yo;An?(Vi=m&&cr&&Vn?p:En.left,Kn=m?f:ai(Tn,Wn,"before"),hr=m?p:ai(ni,Wn,"after"),Yo=m&&Li&&bi?f:ii.right):(Vi=m?ai(Tn,Wn,"before"):p,Kn=!m&&cr&&Vn?f:En.right,hr=!m&&Li&&bi?p:ii.left,Yo=m?ai(ni,Wn,"after"):f),T(Vi,En.top,Kn-Vi,En.bottom),En.bottom<ii.top&&T(p,En.bottom,null,ii.top),T(hr,ii.top,Yo-hr,ii.bottom)}(!mn||Vr(En,mn)<0)&&(mn=En),Vr(ii,mn)<0&&(mn=ii),(!In||Vr(En,In)<0)&&(In=En),Vr(ii,In)<0&&(In=ii)}),{start:mn,end:In}}var re=t.from(),Q=t.to();if(re.line==Q.line)M(re.line,re.ch,Q.ch);else{var xe=gt(r,re.line),Fe=gt(r,Q.line),Xe=Jn(xe)==Jn(Fe),it=M(re.line,re.ch,Xe?xe.text.length+1:null).end,ft=M(Q.line,Xe?0:null,Q.ch).start;Xe&&(it.top<ft.top-2?(T(it.right,it.top,null,it.bottom),T(p,ft.top,ft.left,ft.bottom)):T(it.right,it.top,ft.left-it.right,it.bottom)),it.bottom<ft.top&&T(p,it.bottom,null,ft.top)}i.appendChild(s)}function wo(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function ba(e){e.state.focused||(e.display.input.focus(),So(e))}function xa(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function So(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ye(e,"focus",e,t),e.state.focused=!0,he(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),W&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),wo(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ye(e,"blur",e,t),e.state.focused=!1,X(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Xr(e){for(var t=e.display,i=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var r=t.view[n],s=e.options.lineWrapping,l=void 0,p=0;if(r.hidden)continue;if(j&&ee<8){var f=r.node.offsetTop+r.node.offsetHeight;l=f-i,i=f}else{var m=r.node.getBoundingClientRect();l=m.bottom-m.top,!s&&r.text.firstChild&&(p=r.text.firstChild.getBoundingClientRect().right-m.left-1)}var T=r.line.height-l;if((T>.005||T<-.005)&&(Qt(r.line,l),_a(r.line),r.rest))for(var M=0;M<r.rest.length;M++)_a(r.rest[M]);if(p>e.display.sizerWidth){var re=Math.ceil(p/Ji(e.display));re>e.display.maxLineLength&&(e.display.maxLineLength=re,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}function _a(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],n=i.node.parentNode;n&&(i.height=n.offsetHeight)}}function Kr(e,t,i){var n=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;n=Math.floor(n-zr(e));var r=i&&i.bottom!=null?i.bottom:n+e.wrapper.clientHeight,s=gn(t,n),l=gn(t,r);if(i&&i.ensure){var p=i.ensure.from.line,f=i.ensure.to.line;p<s?(s=p,l=gn(t,di(gt(t,p))+e.wrapper.clientHeight)):Math.min(f,t.lastLine())>=l&&(s=gn(t,di(gt(t,f))-e.wrapper.clientHeight),l=f)}return{from:s,to:Math.max(l,s+1)}}function $s(e,t){if(Ee(e,"scrollCursorIntoView"))return;var i=e.display,n=i.sizer.getBoundingClientRect(),r=null;if(t.top+n.top<0?r=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),r!=null&&!V){var s=b("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-zr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+vi(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(r),e.display.lineSpace.removeChild(s)}}function Ys(e,t,i,n){n==null&&(n=0);var r;!e.options.lineWrapping&&t==i&&(t=t.ch?Ae(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ae(t.line,t.ch+1,"before"):t);for(var s=0;s<5;s++){var l=!1,p=pi(e,t),f=!i||i==t?p:pi(e,i);r={left:Math.min(p.left,f.left),top:Math.min(p.top,f.top)-n,right:Math.max(p.left,f.left),bottom:Math.max(p.bottom,f.bottom)+n};var m=ko(e,r),T=e.doc.scrollTop,M=e.doc.scrollLeft;if(m.scrollTop!=null&&(xr(e,m.scrollTop),Math.abs(e.doc.scrollTop-T)>1&&(l=!0)),m.scrollLeft!=null&&(Fi(e,m.scrollLeft),Math.abs(e.doc.scrollLeft-M)>1&&(l=!0)),!l)break}return r}function qs(e,t){var i=ko(e,t);i.scrollTop!=null&&xr(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function ko(e,t){var i=e.display,n=qi(e.display);t.top<0&&(t.top=0);var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,s=fo(e),l={};t.bottom-t.top>s&&(t.bottom=t.top+s);var p=e.doc.height+po(i),f=t.top<n,m=t.bottom>p-n;if(t.top<r)l.scrollTop=f?0:t.top;else if(t.bottom>r+s){var T=Math.min(t.top,(m?p:t.bottom)-s);T!=r&&(l.scrollTop=T)}var M=e.options.fixedGutter?0:i.gutters.offsetWidth,re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-M,Q=Ii(e)-i.gutters.offsetWidth,xe=t.right-t.left>Q;return xe&&(t.right=t.left+Q),t.left<10?l.scrollLeft=0:t.left<re?l.scrollLeft=Math.max(0,t.left+M-(xe?0:10)):t.right>Q+re-3&&(l.scrollLeft=t.right+(xe?0:10)-Q),l}function Ro(e,t){if(t==null)return;$r(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Qi(e){$r(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function br(e,t,i){(t!=null||i!=null)&&$r(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){$r(e),e.curOp.scrollToPos=t}function $r(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=da(e,t.from),n=da(e,t.to);Ca(e,i,n,t.margin)}}function Ca(e,t,i,n){var r=ko(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});br(e,r.scrollLeft,r.scrollTop)}function xr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;oe||Ao(e,{top:t}),Ea(e,t,!0),oe&&Ao(e),Er(e,100)}function Ea(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fi(e,t,i,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Ta(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function _r(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+po(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?i:0,docHeight:n,scrollHeight:n+vi(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Wi=function(e,t,i){this.cm=i;var n=this.vert=b("div",[b("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=b("div",[b("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1,e(n),e(r),me(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),me(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&ee<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Wi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var r=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:t?n:0}},Wi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Wi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Wi.prototype.zeroWidthHack=function(){var e=ne&&!z?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Te,this.disableVert=new Te},Wi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function n(){var r=e.getBoundingClientRect(),s=i=="vert"?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);s!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Wi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Cr=function(){};Cr.prototype.update=function(){return{bottom:0,right:0}},Cr.prototype.setScrollLeft=function(){},Cr.prototype.setScrollTop=function(){},Cr.prototype.clear=function(){};function er(e,t){t||(t=_r(e));var i=e.display.barWidth,n=e.display.barHeight;wa(e,t);for(var r=0;r<4&&i!=e.display.barWidth||n!=e.display.barHeight;r++)i!=e.display.barWidth&&e.options.lineWrapping&&Xr(e),wa(e,_r(e)),i=e.display.barWidth,n=e.display.barHeight}function wa(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Sa={native:Wi,null:Cr};function ka(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&X(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Sa[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Fi(e,t):xr(e,t)},e),e.display.scrollbars.addClass&&he(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function zi(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:++Zs},ci(e.curOp)}function Hi(e){var t=e.curOp;t&&Wr(t,function(i){for(var n=0;n<i.ops.length;n++)i.ops[n].cm.curOp=null;Qs(i)})}function Qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var n=0;n<t.length;n++)tl(t[n]);for(var r=0;r<t.length;r++)nl(t[r]);for(var s=0;s<t.length;s++)il(t[s]);for(var l=0;l<t.length;l++)rl(t[l])}function el(e){var t=e.cm,i=t.display;al(t),e.updateMaxLine&&Fr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&To(e.cm,e.update)}function nl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Xr(t),e.barMeasure=_r(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ra(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+vi(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==G();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&er(t,e.barMeasure),e.updatedDisplay&&Po(t,e.barMeasure),e.selectionChanged&&wo(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&ba(e.cm)}function rl(e){var t=e.cm,i=t.display,n=t.doc;if(e.updatedDisplay&&Ra(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Ea(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var r=Ys(t,o(n,e.scrollToPos.from),o(n,e.scrollToPos.to),e.scrollToPos.margin);$s(t,r)}var s=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(s)for(var p=0;p<s.length;++p)s[p].lines.length||ye(s[p],"hide");if(l)for(var f=0;f<l.length;++f)l[f].lines.length&&ye(l[f],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ye(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function oi(e,t){if(e.curOp)return t();zi(e);try{return t()}finally{Hi(e)}}function Nn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);zi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Xn(e){return function(){if(this.curOp)return e.apply(this,arguments);zi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function Dn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);zi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Er(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,S(ol,e))}function ol(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,n=Ze(e,t.highlightFrontier),r=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(n.line>=e.display.viewFrom){var l=s.styles,p=s.text.length>e.options.maxHighlightLength?Yt(t.mode,n.state):null,f=N(e,s,n,!0);p&&(n.state=p),s.styles=f.styles;var m=s.styleClasses,T=f.classes;T?s.styleClasses=T:m&&(s.styleClasses=null);for(var M=!l||l.length!=s.styles.length||m!=T&&(!m||!T||m.bgClass!=T.bgClass||m.textClass!=T.textClass),re=0;!M&&re<l.length;++re)M=l[re]!=s.styles[re];M&&r.push(n.line),s.stateAfter=n.save(),n.nextLine()}else s.text.length<=e.options.maxHighlightLength&&bt(e,s.text,n),s.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>i)return Er(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),r.length&&oi(e,function(){for(var s=0;s<r.length;s++)Si(e,r[s],"text")})}var Yr=function(e,t,i){var n=e.display;this.viewport=t,this.visible=Kr(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=_o(e),this.events=[]};Yr.prototype.signal=function(e,t){O(e,t)&&this.events.push(arguments)},Yr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ye.apply(null,this.events[e])};function al(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=vi(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=vi(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=G();if(!t||!k(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&k(e.display.lineDiv,n.anchorNode)&&(i.anchorNode=n.anchorNode,i.anchorOffset=n.anchorOffset,i.focusNode=n.focusNode,i.focusOffset=n.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==G())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&k(document.body,e.anchorNode)&&k(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function To(e,t){var i=e.display,n=e.doc;if(t.editorIsHidden)return ki(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&ga(e)==0)return!1;Aa(e)&&(ki(e),t.dims=_o(e));var r=n.first+n.size,s=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(r,t.visible.to+e.options.viewportMargin);i.viewFrom<s&&s-i.viewFrom<20&&(s=Math.max(n.first,i.viewFrom)),i.viewTo>l&&i.viewTo-l<20&&(l=Math.min(r,i.viewTo)),Jt&&(s=Ei(e.doc,s),l=Br(e.doc,l));var p=s!=i.viewFrom||l!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Xs(e,s,l),i.viewOffset=di(gt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var f=ga(e);if(!p&&f==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var m=sl(e);return f>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),f>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(m),de(i.cursorDiv),de(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,p&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Er(e,400)),i.updateLineNumbers=null,!0}function Ra(e,t){for(var i=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+po(e.display)-fo(e),i.top)}),t.visible=Kr(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Kr(e.display,e.doc,i));if(!To(e,t))break;Xr(e);var r=_r(e);yr(e),er(e,r),Po(e,r),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 Ao(e,t){var i=new Yr(e,t);if(To(e,i)){Xr(e),Ra(e,i);var n=_r(e);yr(e),er(e,n),Po(e,n),i.finish()}}function ul(e,t,i){var n=e.display,r=e.options.lineNumbers,s=n.lineDiv,l=s.firstChild;function p(xe){var Fe=xe.nextSibling;return W&&ne&&e.display.currentWheelTarget==xe?xe.style.display="none":xe.parentNode.removeChild(xe),Fe}for(var f=n.view,m=n.viewFrom,T=0;T<f.length;T++){var M=f[T];if(!M.hidden)if(!M.node||M.node.parentNode!=s){var re=Is(e,M,m,i);s.insertBefore(re,l)}else{for(;l!=M.node;)l=p(l);var Q=r&&t!=null&&t<=m&&M.lineNumber;M.changes&&(we(M.changes,"gutter")>-1&&(Q=!1),Jo(e,M,m,i)),Q&&(de(M.lineNumber),M.lineNumber.appendChild(document.createTextNode(si(e.options,m)))),l=M.node.nextSibling}m+=M.size}for(;l;)l=p(l)}function Oo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Po(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+vi(e)+"px"}function Ta(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=Co(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,s=n+"px",l=0;l<i.length;l++)if(!i[l].hidden){e.options.fixedGutter&&(i[l].gutter&&(i[l].gutter.style.left=s),i[l].gutterBackground&&(i[l].gutterBackground.style.left=s));var p=i[l].alignable;if(p)for(var f=0;f<p.length;f++)p[f].style.left=s}e.options.fixedGutter&&(t.gutters.style.left=n+r+"px")}function Aa(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=si(e.options,t.first+t.size-1),n=e.display;if(i.length!=n.lineNumChars){var r=n.measure.appendChild(b("div",[b("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=r.firstChild.offsetWidth,l=r.offsetWidth-s;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(s,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Oo(e.display),!0}return!1}function Lo(e,t){for(var i=[],n=!1,r=0;r<e.length;r++){var s=e[r],l=null;if(typeof s!="string"&&(l=s.style,s=s.className),s=="CodeMirror-linenumbers")if(t)n=!0;else continue;i.push({className:s,style:l})}return t&&!n&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Oa(e){var t=e.gutters,i=e.gutterSpecs;de(t),e.lineGutter=null;for(var n=0;n<i.length;++n){var r=i[n],s=r.className,l=r.style,p=t.appendChild(b("div",null,"CodeMirror-gutter "+s));l&&(p.style.cssText=l),s=="CodeMirror-linenumbers"&&(e.lineGutter=p,p.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Oo(e)}function wr(e){Oa(e.display),Qn(e),Ta(e)}function cl(e,t,i,n){var r=this;this.input=i,r.scrollbarFiller=b("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=b("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=U("div",null,"CodeMirror-code"),r.selectionDiv=b("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=b("div",null,"CodeMirror-cursors"),r.measure=b("div",null,"CodeMirror-measure"),r.lineMeasure=b("div",null,"CodeMirror-measure"),r.lineSpace=U("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var s=U("div",[r.lineSpace],"CodeMirror-lines");r.mover=b("div",[s],null,"position: relative"),r.sizer=b("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=b("div",null,null,"position: absolute; height: "+$e+"px; width: 1px;"),r.gutters=b("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=b("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=b("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),j&&ee<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),!W&&!(oe&&ce)&&(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,r.gutterSpecs=Lo(n.gutters,n.lineNumbers),Oa(r),i.init(r)}var qr=0,li=null;j?li=-.53:oe?li=15:L?li=-.7:le&&(li=-1/3);function Pa(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=Pa(e);return t.x*=li,t.y*=li,t}function La(e,t){var i=Pa(t),n=i.x,r=i.y,s=e.display,l=s.scroller,p=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight;if(!(n&&p||r&&f))return;if(r&&ne&&W){e:for(var m=t.target,T=s.view;m!=l;m=m.parentNode)for(var M=0;M<T.length;M++)if(T[M].node==m){e.display.currentWheelTarget=m;break e}}if(n&&!oe&&!I&&li!=null){r&&f&&xr(e,Math.max(0,l.scrollTop+r*li)),Fi(e,Math.max(0,l.scrollLeft+n*li)),(!r||r&&f)&&y(t),s.wheelStartX=null;return}if(r&&li!=null){var re=r*li,Q=e.doc.scrollTop,xe=Q+s.wrapper.clientHeight;re<0?Q=Math.max(0,Q+re-50):xe=Math.min(e.doc.height,xe+re+50),Ao(e,{top:Q,bottom:xe})}qr<20&&(s.wheelStartX==null?(s.wheelStartX=l.scrollLeft,s.wheelStartY=l.scrollTop,s.wheelDX=n,s.wheelDY=r,setTimeout(function(){if(s.wheelStartX==null)return;var Fe=l.scrollLeft-s.wheelStartX,Xe=l.scrollTop-s.wheelStartY,it=Xe&&s.wheelDY&&Xe/s.wheelDY||Fe&&s.wheelDX&&Fe/s.wheelDX;if(s.wheelStartX=s.wheelStartY=null,!it)return;li=(li*qr+it)/(qr+1),++qr},200)):(s.wheelDX+=n,s.wheelDY+=r))}var ui=function(e,t){this.ranges=e,this.primIndex=t};ui.prototype.primary=function(){return this.ranges[this.primIndex]},ui.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],n=e.ranges[t];if(!dn(i.anchor,n.anchor)||!dn(i.head,n.head))return!1}return!0},ui.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new sn(cn(this.ranges[t].anchor),cn(this.ranges[t].head));return new ui(e,this.primIndex)},ui.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ui.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return i}return-1};var sn=function(e,t){this.anchor=e,this.head=t};sn.prototype.from=function(){return _n(this.anchor,this.head)},sn.prototype.to=function(){return bn(this.anchor,this.head)},sn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function fi(e,t,i){var n=e&&e.options.selectionsMayTouch,r=t[i];t.sort(function(re,Q){return tt(re.from(),Q.from())}),i=we(t,r);for(var s=1;s<t.length;s++){var l=t[s],p=t[s-1],f=tt(p.to(),l.from());if(n&&!l.empty()?f>0:f>=0){var m=_n(p.from(),l.from()),T=bn(p.to(),l.to()),M=p.empty()?l.from()==l.head:p.from()==p.head;s<=i&&--i,t.splice(--s,2,new sn(M?T:m,M?m:T))}}return new ui(t,i)}function Ri(e,t){return new ui([new sn(e,t||e)],0)}function Ti(e){return e.text?Ae(e.from.line+e.text.length-1,Be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ma(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ti(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ti(t).ch-t.to.ch),Ae(i,n)}function Mo(e,t){for(var i=[],n=0;n<e.sel.ranges.length;n++){var r=e.sel.ranges[n];i.push(new sn(Ma(r.anchor,t),Ma(r.head,t)))}return fi(e.cm,i,e.sel.primIndex)}function Na(e,t,i){return e.line==t.line?Ae(i.line,e.ch-t.ch+i.ch):Ae(i.line+(e.line-t.line),e.ch)}function dl(e,t,i){for(var n=[],r=Ae(e.first,0),s=r,l=0;l<t.length;l++){var p=t[l],f=Na(p.from,r,s),m=Na(Ti(p),r,s);if(r=p.to,s=m,i=="around"){var T=e.sel.ranges[l],M=tt(T.head,T.anchor)<0;n[l]=new sn(M?m:f,M?f:m)}else n[l]=new sn(f,f)}return new ui(n,e.sel.primIndex)}function No(e){e.doc.mode=yt(e.options,e.doc.modeOption),Sr(e)}function Sr(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Er(e,100),e.state.modeGen++,e.curOp&&Qn(e)}function Da(e,t){return t.from.ch==0&&t.to.ch==0&&Be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Do(e,t,i,n){function r(ft){return i?i[ft]:null}function s(ft,rt,xt){qo(ft,rt,xt,n),Fn(ft,"change",ft,t)}function l(ft,rt){for(var xt=[],Ut=ft;Ut<rt;++Ut)xt.push(new Di(m[Ut],r(Ut),n));return xt}var p=t.from,f=t.to,m=t.text,T=gt(e,p.line),M=gt(e,f.line),re=Be(m),Q=r(m.length-1),xe=f.line-p.line;if(t.full)e.insert(0,l(0,m.length)),e.remove(m.length,e.size-m.length);else if(Da(e,t)){var Fe=l(0,m.length-1);s(M,M.text,Q),xe&&e.remove(p.line,xe),Fe.length&&e.insert(p.line,Fe)}else if(T==M)if(m.length==1)s(T,T.text.slice(0,p.ch)+re+T.text.slice(f.ch),Q);else{var Xe=l(1,m.length-1);Xe.push(new Di(re+T.text.slice(f.ch),Q,n)),s(T,T.text.slice(0,p.ch)+m[0],r(0)),e.insert(p.line+1,Xe)}else if(m.length==1)s(T,T.text.slice(0,p.ch)+m[0]+M.text.slice(f.ch),r(0)),e.remove(p.line+1,xe);else{s(T,T.text.slice(0,p.ch)+m[0],r(0)),s(M,re+M.text.slice(f.ch),Q);var it=l(1,m.length-1);xe>1&&e.remove(p.line+1,xe-1),e.insert(p.line+1,it)}Fn(e,"change",e,t)}function Ai(e,t,i){function n(r,s,l){if(r.linked)for(var p=0;p<r.linked.length;++p){var f=r.linked[p];if(f.doc==s)continue;var m=l&&f.sharedHist;if(i&&!m)continue;t(f.doc,m),n(f.doc,r,m)}}n(e,null,!0)}function Ia(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Eo(e),No(e),ja(e),e.options.lineWrapping||Fr(e),e.options.mode=t.modeOption,Qn(e)}function ja(e){(e.doc.direction=="rtl"?he:X)(e.display.lineDiv,"CodeMirror-rtl")}function pl(e){oi(e,function(){ja(e),Qn(e)})}function Jr(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Io(e,t){var i={from:cn(t.from),to:Ti(t),text:qt(e,t.from,t.to)};return Fa(e,i,t.from.line,t.to.line+1),Ai(e,function(n){return Fa(n,i,t.from.line,t.to.line+1)},!0),i}function Ua(e){for(;e.length;){var t=Be(e);if(t.ranges)e.pop();else break}}function fl(e,t){if(t)return Ua(e.done),Be(e.done);if(e.done.length&&!Be(e.done).ranges)return Be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Be(e.done)}function Ba(e,t,i,n){var r=e.history;r.undone.length=0;var s=+new Date,l,p;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(l=fl(r,r.lastOp==n)))p=Be(l.changes),tt(t.from,t.to)==0&&tt(t.from,p.to)==0?p.to=Ti(t):l.changes.push(Io(e,t));else{var f=Be(r.done);for((!f||!f.ranges)&&Zr(e.sel,r.done),l={changes:[Io(e,t)],generation:r.generation},r.done.push(l);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=t.origin,p||ye(e,"historyAdded")}function ml(e,t,i,n){var r=t.charAt(0);return r=="*"||r=="+"&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,n){var r=e.history,s=n&&n.origin;i==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||ml(e,s,Be(r.done),t))?r.done[r.done.length-1]=t:Zr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=i,n&&n.clearRedo!==!1&&Ua(r.undone)}function Zr(e,t){var i=Be(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Fa(e,t,i,n){var r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),function(l){l.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=l.markedSpans),++s})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var n=[],r=0;r<t.text.length;++r)n.push(vl(i[r]));return n}function Wa(e,t){var i=yl(e,t),n=qn(e,t);if(!i)return n;if(!n)return i;for(var r=0;r<i.length;++r){var s=i[r],l=n[r];if(s&&l){e:for(var p=0;p<l.length;++p){for(var f=l[p],m=0;m<s.length;++m)if(s[m].marker==f.marker)continue e;s.push(f)}}else l&&(i[r]=l)}return i}function tr(e,t,i){for(var n=[],r=0;r<e.length;++r){var s=e[r];if(s.ranges){n.push(i?ui.prototype.deepCopy.call(s):s);continue}var l=s.changes,p=[];n.push({changes:p});for(var f=0;f<l.length;++f){var m=l[f],T=void 0;if(p.push({from:m.from,to:m.to,text:m.text}),t)for(var M in m)(T=M.match(/^spans_(\d+)$/))&&(we(t,Number(T[1]))>-1&&(Be(p)[M]=m[M],delete m[M]))}}return n}function jo(e,t,i,n){if(n){var r=e.anchor;if(i){var s=tt(t,r)<0;s!=tt(i,r)<0?(r=t,t=i):s!=tt(t,i)<0&&(t=i)}return new sn(r,t)}else return new sn(i||t,t)}function Qr(e,t,i,n,r){r==null&&(r=e.cm&&(e.cm.display.shift||e.extend)),Gn(e,new ui([jo(e.sel.primary(),t,i,r)],0),n)}function za(e,t,i){for(var n=[],r=e.cm&&(e.cm.display.shift||e.extend),s=0;s<e.sel.ranges.length;s++)n[s]=jo(e.sel.ranges[s],t[s],null,r);var l=fi(e.cm,n,e.sel.primIndex);Gn(e,l,i)}function Uo(e,t,i,n){var r=e.sel.ranges.slice(0);r[t]=i,Gn(e,fi(e.cm,r,e.sel.primIndex),n)}function Ha(e,t,i,n){Gn(e,Ri(t,i),n)}function bl(e,t,i){var n={ranges:t.ranges,update:function(r){this.ranges=[];for(var s=0;s<r.length;s++)this.ranges[s]=new sn(o(e,r[s].anchor),o(e,r[s].head))},origin:i&&i.origin};return ye(e,"beforeSelectionChange",e,n),e.cm&&ye(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?fi(e.cm,n.ranges,n.ranges.length-1):t}function Ga(e,t,i){var n=e.history.done,r=Be(n);r&&r.ranges?(n[n.length-1]=t,eo(e,t,i)):Gn(e,t,i)}function Gn(e,t,i){eo(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function eo(e,t,i){(O(e,"beforeSelectionChange")||e.cm&&O(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var n=i&&i.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);Va(e,Ka(e,t,n,!0)),!(i&&i.scroll===!1)&&e.cm&&Qi(e.cm)}function Va(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,R(e.cm)),Fn(e,"cursorActivity",e)}function Xa(e){Va(e,Ka(e,e.sel,null,!1))}function Ka(e,t,i,n){for(var r,s=0;s<t.ranges.length;s++){var l=t.ranges[s],p=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[s],f=to(e,l.anchor,p&&p.anchor,i,n),m=to(e,l.head,p&&p.head,i,n);(r||f!=l.anchor||m!=l.head)&&(r||(r=t.ranges.slice(0,s)),r[s]=new sn(f,m))}return r?fi(e.cm,r,t.primIndex):t}function nr(e,t,i,n,r){var s=gt(e,t.line);if(s.markedSpans)for(var l=0;l<s.markedSpans.length;++l){var p=s.markedSpans[l],f=p.marker,m="selectLeft"in f?!f.selectLeft:f.inclusiveLeft,T="selectRight"in f?!f.selectRight:f.inclusiveRight;if((p.from==null||(m?p.from<=t.ch:p.from<t.ch))&&(p.to==null||(T?p.to>=t.ch:p.to>t.ch))){if(r&&(ye(f,"beforeCursorEnter"),f.explicitlyCleared))if(s.markedSpans){--l;continue}else break;if(!f.atomic)continue;if(i){var M=f.find(n<0?1:-1),re=void 0;if((n<0?T:m)&&(M=$a(e,M,-n,M&&M.line==t.line?s:null)),M&&M.line==t.line&&(re=tt(M,i))&&(n<0?re<0:re>0))return nr(e,M,t,n,r)}var Q=f.find(n<0?-1:1);return(n<0?m:T)&&(Q=$a(e,Q,n,Q.line==t.line?s:null)),Q?nr(e,Q,t,n,r):null}}return t}function to(e,t,i,n,r){var s=n||1,l=nr(e,t,i,s,r)||!r&&nr(e,t,i,s,!0)||nr(e,t,i,-s,r)||!r&&nr(e,t,i,-s,!0);return l||(e.cantEdit=!0,Ae(e.first,0))}function $a(e,t,i,n){return i<0&&t.ch==0?t.line>e.first?o(e,Ae(t.line-1)):null:i>0&&t.ch==(n||gt(e,t.line)).text.length?t.line<e.first+e.size-1?Ae(t.line+1,0):null:new Ae(t.line,t.ch+i)}function Ya(e){e.setSelection(Ae(e.firstLine(),0),Ae(e.lastLine()),_e)}function qa(e,t,i){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return i&&(n.update=function(r,s,l,p){r&&(n.from=o(e,r)),s&&(n.to=o(e,s)),l&&(n.text=l),p!==void 0&&(n.origin=p)}),ye(e,"beforeChange",e,n),e.cm&&ye(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function ir(e,t,i){if(e.cm){if(!e.cm.curOp)return Nn(e.cm,ir)(e,t,i);if(e.cm.state.suppressEdits)return}if((O(e,"beforeChange")||e.cm&&O(e.cm,"beforeChange"))&&(t=qa(e,t,!0),!t))return;var n=pn&&!i&&Mi(e,t.from,t.to);if(n)for(var r=n.length-1;r>=0;--r)Ja(e,{from:n[r].from,to:n[r].to,text:r?[""]:t.text,origin:t.origin});else Ja(e,t)}function Ja(e,t){if(t.text.length==1&&t.text[0]==""&&tt(t.from,t.to)==0)return;var i=Mo(e,t);Ba(e,t,i,e.cm?e.cm.curOp.id:NaN),kr(e,t,i,qn(e,t));var n=[];Ai(e,function(r,s){!s&&we(n,r.history)==-1&&(ts(r.history,t),n.push(r.history)),kr(r,t,null,qn(r,t))})}function no(e,t,i){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!i)return;for(var r=e.history,s,l=e.sel,p=t=="undo"?r.done:r.undone,f=t=="undo"?r.undone:r.done,m=0;m<p.length&&!(s=p[m],i?s.ranges&&!s.equals(e.sel):!s.ranges);m++);if(m==p.length)return;for(r.lastOrigin=r.lastSelOrigin=null;;)if(s=p.pop(),s.ranges){if(Zr(s,f),i&&!s.equals(e.sel)){Gn(e,s,{clearRedo:!1});return}l=s}else if(n){p.push(s);return}else break;var T=[];Zr(l,f),f.push({changes:T,generation:r.generation}),r.generation=s.generation||++r.maxGeneration;for(var M=O(e,"beforeChange")||e.cm&&O(e.cm,"beforeChange"),re=function(Fe){var Xe=s.changes[Fe];if(Xe.origin=t,M&&!qa(e,Xe,!1))return p.length=0,{};T.push(Io(e,Xe));var it=Fe?Mo(e,Xe):Be(p);kr(e,Xe,it,Wa(e,Xe)),!Fe&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:Ti(Xe)});var ft=[];Ai(e,function(rt,xt){!xt&&we(ft,rt.history)==-1&&(ts(rt.history,Xe),ft.push(rt.history)),kr(rt,Xe,null,Wa(rt,Xe))})},Q=s.changes.length-1;Q>=0;--Q){var xe=re(Q);if(xe)return xe.v}}function Za(e,t){if(t==0)return;if(e.first+=t,e.sel=new ui(ut(e.sel.ranges,function(r){return new sn(Ae(r.anchor.line+t,r.anchor.ch),Ae(r.head.line+t,r.head.ch))}),e.sel.primIndex),e.cm){Qn(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;n<i.viewTo;n++)Si(e.cm,n,"gutter")}}function kr(e,t,i,n){if(e.cm&&!e.cm.curOp)return Nn(e.cm,kr)(e,t,i,n);if(t.to.line<e.first){Za(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var r=t.text.length-1-(e.first-t.from.line);Za(e,r),t={from:Ae(e.first,0),to:Ae(t.to.line+r,t.to.ch),text:[Be(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:Ae(s,gt(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=qt(e,t.from,t.to),i||(i=Mo(e,t)),e.cm?xl(e.cm,t,n):Do(e,t,n),eo(e,i,_e),e.cantEdit&&to(e,Ae(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var n=e.doc,r=e.display,s=t.from,l=t.to,p=!1,f=s.line;e.options.lineWrapping||(f=Lt(Jn(gt(n,s.line))),n.iter(f,l.line+1,function(Q){if(Q==r.maxLine)return p=!0,!0})),n.sel.contains(t.from,t.to)>-1&&R(e),Do(n,t,i,ma(e)),e.options.lineWrapping||(n.iter(f,s.line+t.text.length,function(Q){var xe=$i(Q);xe>r.maxLineLength&&(r.maxLine=Q,r.maxLineLength=xe,r.maxLineChanged=!0,p=!1)}),p&&(e.curOp.updateMaxLine=!0)),jt(n,s.line),Er(e,400);var m=t.text.length-(l.line-s.line)-1;t.full?Qn(e):s.line==l.line&&t.text.length==1&&!Da(e.doc,t)?Si(e,s.line,"text"):Qn(e,s.line,l.line+1,m);var T=O(e,"changes"),M=O(e,"change");if(M||T){var re={from:s,to:l,text:t.text,removed:t.removed,origin:t.origin};M&&Fn(e,"change",e,re),T&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(re)}e.display.selForContextMenu=null}function rr(e,t,i,n,r){var s;n||(n=i),tt(n,i)<0&&(s=[n,i],i=s[0],n=s[1]),typeof t=="string"&&(t=e.splitLines(t)),ir(e,{from:i,to:n,text:t,origin:r})}function Qa(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,n){for(var r=0;r<e.length;++r){var s=e[r],l=!0;if(s.ranges){s.copied||(s=e[r]=s.deepCopy(),s.copied=!0);for(var p=0;p<s.ranges.length;p++)Qa(s.ranges[p].anchor,t,i,n),Qa(s.ranges[p].head,t,i,n);continue}for(var f=0;f<s.changes.length;++f){var m=s.changes[f];if(i<m.from.line)m.from=Ae(m.from.line+n,m.from.ch),m.to=Ae(m.to.line+n,m.to.ch);else if(t<=m.to.line){l=!1;break}}l||(e.splice(0,r+1),r=0)}}function ts(e,t){var i=t.from.line,n=t.to.line,r=t.text.length-(n-i)-1;es(e.done,i,n,r),es(e.undone,i,n,r)}function Rr(e,t,i,n){var r=t,s=t;return typeof t=="number"?s=gt(e,h(e,t)):r=Lt(t),r==null?null:(n(s,r)&&e.cm&&Si(e.cm,r,i),s)}function Tr(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Tr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,n=e+t;i<n;++i){var r=this.lines[i];this.height-=r.height,co(r),Fn(r,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,i){for(var n=e+t;e<n;++e)if(i(this.lines[e]))return!0}};function Ar(e){this.children=e;for(var t=0,i=0,n=0;n<e.length;++n){var r=e[n];t+=r.chunkSize(),i+=r.height,r.parent=this}this.size=t,this.height=i,this.parent=null}Ar.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var n=this.children[i],r=n.chunkSize();if(e<r){var s=Math.min(t,r-e),l=n.height;if(n.removeInner(e,s),this.height-=l-n.height,r==s&&(this.children.splice(i--,1),n.parent=null),(t-=s)==0)break;e=0}else e-=r}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Tr))){var p=[];this.collapse(p),this.children=[new Tr(p)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var n=0;n<this.children.length;++n){var r=this.children[n],s=r.chunkSize();if(e<=s){if(r.insertInner(e,t,i),r.lines&&r.lines.length>50){for(var l=r.lines.length%25+25,p=l;p<r.lines.length;){var f=new Tr(r.lines.slice(p,p+=25));r.height-=f.height,this.children.splice(++n,0,f),f.parent=this}r.lines=r.lines.slice(0,l),this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Ar(t);if(e.parent){e.size-=i.size,e.height-=i.height;var r=we(e.parent.children,e);e.parent.children.splice(r+1,0,i)}else{var n=new Ar(e.children);n.parent=e,e.children=[n,i],e=n}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var n=0;n<this.children.length;++n){var r=this.children[n],s=r.chunkSize();if(e<s){var l=Math.min(t,s-e);if(r.iterN(e,l,i))return!0;if((t-=l)==0)break;e=0}else e-=s}}};var Or=function(e,t,i){if(i)for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);this.doc=e,this.node=t};Or.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,n=Lt(i);if(n==null||!t)return;for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(i.widgets=null);var s=gr(this);Qt(i,Math.max(0,i.height-s)),e&&(oi(e,function(){ns(e,i,-s),Si(e,n,"widget")}),Fn(e,"lineWidgetCleared",e,this,n))},Or.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,n=this.line;this.height=null;var r=gr(this)-t;if(!r)return;ri(this.doc,n)||Qt(n,n.height+r),i&&oi(i,function(){i.curOp.forceUpdate=!0,ns(i,n,r),Fn(i,"lineWidgetChanged",i,e,Lt(n))})},P(Or);function ns(e,t,i){di(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ro(e,i)}function _l(e,t,i,n){var r=new Or(e,i,n),s=e.cm;return s&&r.noHScroll&&(s.display.alignWidgets=!0),Rr(e,t,"widget",function(l){var p=l.widgets||(l.widgets=[]);if(r.insertAt==null?p.push(r):p.splice(Math.min(p.length-1,Math.max(0,r.insertAt)),0,r),r.line=l,s&&!ri(e,l)){var f=di(l)<e.scrollTop;Qt(l,l.height+gr(r)),f&&Ro(s,r.height),s.curOp.forceUpdate=!0}return!0}),s&&Fn(s,"lineWidgetAdded",s,r,typeof t=="number"?t:Lt(t)),r}var is=0,Oi=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Oi.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&zi(e),O(this,"clear")){var i=this.find();i&&Fn(this,"clear",i.from,i.to)}for(var n=null,r=null,s=0;s<this.lines.length;++s){var l=this.lines[s],p=vn(l.markedSpans,this);e&&!this.collapsed?Si(e,Lt(l),"text"):e&&(p.to!=null&&(r=Lt(l)),p.from!=null&&(n=Lt(l))),l.markedSpans=Un(l.markedSpans,p),p.from==null&&this.collapsed&&!ri(this.doc,l)&&e&&Qt(l,qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var m=Jn(this.lines[f]),T=$i(m);T>e.display.maxLineLength&&(e.display.maxLine=m,e.display.maxLineLength=T,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Qn(e,n,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xa(e.doc)),e&&Fn(e,"markerCleared",e,this,n,r),t&&Hi(e),this.parent&&this.parent.clear()},Oi.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,n,r=0;r<this.lines.length;++r){var s=this.lines[r],l=vn(s.markedSpans,this);if(l.from!=null&&(i=Ae(t?s:Lt(s),l.from),e==-1))return i;if(l.to!=null&&(n=Ae(t?s:Lt(s),l.to),e==1))return n}return i&&{from:i,to:n}},Oi.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,n=this.doc.cm;if(!t||!n)return;oi(n,function(){var r=t.line,s=Lt(t.line),l=mo(n,s);if(l&&(sa(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!ri(i.doc,r)&&i.height!=null){var p=i.height;i.height=null;var f=gr(i)-p;f&&Qt(r,r.height+f)}Fn(n,"markerChanged",n,e)})},Oi.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||we(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Oi.prototype.detachLine=function(e){if(this.lines.splice(we(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},P(Oi);function or(e,t,i,n,r){if(n&&n.shared)return Cl(e,t,i,n,r);if(e.cm&&!e.cm.curOp)return Nn(e.cm,or)(e,t,i,n,r);var s=new Oi(e,r),l=tt(t,i);if(n&&g(n,s,!1),l>0||l==0&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=U("span",[s.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(wn(e,t.line,t,i,s)||t.line!=i.line&&wn(e,i.line,t,i,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");on()}s.addToHistory&&Ba(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var p=t.line,f=e.cm,m;if(e.iter(p,i.line+1,function(M){f&&s.collapsed&&!f.options.lineWrapping&&Jn(M)==f.display.maxLine&&(m=!0),s.collapsed&&p!=t.line&&Qt(M,0),Yn(M,new On(s,p==t.line?t.ch:null,p==i.line?i.ch:null)),++p}),s.collapsed&&e.iter(t.line,i.line+1,function(M){ri(e,M)&&Qt(M,0)}),s.clearOnEnter&&me(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(fn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++is,s.atomic=!0),f){if(m&&(f.curOp.updateMaxLine=!0),s.collapsed)Qn(f,t.line,i.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var T=t.line;T<=i.line;T++)Si(f,T,"text");s.atomic&&Xa(f.doc),Fn(f,"markerAdded",f,s)}return s}var Pr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Pr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Fn(this,"clear")},Pr.prototype.find=function(e,t){return this.primary.find(e,t)},P(Pr);function Cl(e,t,i,n,r){n=g(n),n.shared=!1;var s=[or(e,t,i,n,r)],l=s[0],p=n.widgetNode;return Ai(e,function(f){p&&(n.widgetNode=p.cloneNode(!0)),s.push(or(f,o(f,t),o(f,i),n,r));for(var m=0;m<f.linked.length;++m)if(f.linked[m].isParent)return;l=Be(s)}),new Pr(s,l)}function rs(e){return e.findMarks(Ae(e.first,0),e.clipPos(Ae(e.lastLine())),function(t){return t.parent})}function El(e,t){for(var i=0;i<t.length;i++){var n=t[i],r=n.find(),s=e.clipPos(r.from),l=e.clipPos(r.to);if(tt(s,l)){var p=or(e,s,l,n.primary,n.primary.type);n.markers.push(p),p.parent=n}}}function wl(e){for(var t=function(n){var r=e[n],s=[r.primary.doc];Ai(r.primary.doc,function(f){return s.push(f)});for(var l=0;l<r.markers.length;l++){var p=r.markers[l];we(s,p.doc)==-1&&(p.parent=null,r.markers.splice(l--,1))}},i=0;i<e.length;i++)t(i)}var Sl=0,ei=function(e,t,i,n,r){if(!(this instanceof ei))return new ei(e,t,i,n,r);i==null&&(i=0),Ar.call(this,[new Tr([new Di("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var s=Ae(i,0);this.sel=Ri(s),this.history=new Jr(null),this.id=++Sl,this.modeOption=t,this.lineSep=n,this.direction=r=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Do(this,{from:s,to:s,text:e}),Gn(this,Ri(s),_e)};ei.prototype=qe(Ar.prototype,{constructor:ei,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,n=0;n<t.length;++n)i+=t[n].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Pt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Dn(function(e){var t=Ae(this.first,0),i=this.first+this.size-1;ir(this,{from:t,to:Ae(i,gt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&br(this.cm,0,0),Gn(this,Ri(t),_e)}),replaceRange:function(e,t,i,n){t=o(this,t),i=i?o(this,i):t,rr(this,e,t,i,n)},getRange:function(e,t,i){var n=qt(this,o(this,e),o(this,t));return i===!1?n:n.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if($n(this,e))return gt(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),Jn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return o(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Dn(function(e,t,i){Ha(this,o(this,typeof e=="number"?Ae(e,t||0):e),null,i)}),setSelection:Dn(function(e,t,i){Ha(this,o(this,e),o(this,t||e),i)}),extendSelection:Dn(function(e,t,i){Qr(this,o(this,e),t&&o(this,t),i)}),extendSelections:Dn(function(e,t){za(this,u(this,e),t)}),extendSelectionsBy:Dn(function(e,t){var i=ut(this.sel.ranges,e);za(this,u(this,i),t)}),setSelections:Dn(function(e,t,i){if(!e.length)return;for(var n=[],r=0;r<e.length;r++)n[r]=new sn(o(this,e[r].anchor),o(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Gn(this,fi(this.cm,n,t),i)}),addSelection:Dn(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new sn(o(this,e),o(this,t||e))),Gn(this,fi(this.cm,n,n.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,n=0;n<t.length;n++){var r=qt(this,t[n].from(),t[n].to());i=i?i.concat(r):r}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,n=0;n<i.length;n++){var r=qt(this,i[n].from(),i[n].to());e!==!1&&(r=r.join(e||this.lineSeparator())),t[n]=r}return t},replaceSelection:function(e,t,i){for(var n=[],r=0;r<this.sel.ranges.length;r++)n[r]=e;this.replaceSelections(n,t,i||"+input")},replaceSelections:Dn(function(e,t,i){for(var n=[],r=this.sel,s=0;s<r.ranges.length;s++){var l=r.ranges[s];n[s]={from:l.from(),to:l.to(),text:this.splitLines(e[s]),origin:i}}for(var p=t&&t!="end"&&dl(this,n,t),f=n.length-1;f>=0;f--)ir(this,n[f]);p?Ga(this,p):this.cm&&Qi(this.cm)}),undo:Dn(function(){no(this,"undo")}),redo:Dn(function(){no(this,"redo")}),undoSelection:Dn(function(){no(this,"undo",!0)}),redoSelection:Dn(function(){no(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Jr(this.history.maxGeneration),Ai(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:tr(this.history.done),undone:tr(this.history.undone)}},setHistory:function(e){var t=this.history=new Jr(this.history.maxGeneration);t.done=tr(e.done.slice(0),null,!0),t.undone=tr(e.undone.slice(0),null,!0)},setGutterMarker:Dn(function(e,t,i){return Rr(this,e,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&Ve(r)&&(n.gutterMarkers=null),!0})}),clearGutter:Dn(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Rr(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ve(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!$n(this,e))return null;if(t=e,e=gt(this,e),!e)return null}else if(t=Lt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Dn(function(e,t,i){return Rr(this,e,t=="gutter"?"gutter":"class",function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[r])n[r]=i;else{if(ie(i).test(n[r]))return!1;n[r]+=" "+i}return!0})}),removeLineClass:Dn(function(e,t,i){return Rr(this,e,t=="gutter"?"gutter":"class",function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",s=n[r];if(s)if(i==null)n[r]=null;else{var l=s.match(ie(i));if(!l)return!1;var p=l.index+l[0].length;n[r]=s.slice(0,l.index)+(!l.index||p==s.length?"":" ")+s.slice(p)||null}else return!1;return!0})}),addLineWidget:Dn(function(e,t,i){return _l(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return or(this,o(this,e),o(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=o(this,e),or(this,e,e,i,"bookmark")},findMarksAt:function(e){e=o(this,e);var t=[],i=gt(this,e.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var r=i[n];(r.from==null||r.from<=e.ch)&&(r.to==null||r.to>=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,i){e=o(this,e),t=o(this,t);var n=[],r=e.line;return this.iter(e.line,t.line+1,function(s){var l=s.markedSpans;if(l)for(var p=0;p<l.length;p++){var f=l[p];!(f.to!=null&&r==e.line&&e.ch>=f.to||f.from==null&&r!=e.line||f.from!=null&&r==t.line&&f.from>=t.ch)&&(!i||i(f.marker))&&n.push(f.marker.parent||f.marker)}++r}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var n=0;n<i.length;++n)i[n].from!=null&&e.push(i[n].marker)}),e},posFromIndex:function(e){var t,i=this.first,n=this.lineSeparator().length;return this.iter(function(r){var s=r.text.length+n;if(s>e)return t=e,!0;e-=s,++i}),o(this,Ae(i,t))},indexFromPos:function(e){e=o(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+i}),t},copy:function(e){var t=new ei(Pt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var n=new ei(Pt(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],El(n,rs(this)),n},unlinkDoc:function(e){if(e instanceof yn&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var n=[e.id];Ai(e,function(r){return n.push(r.id)},!0),e.history=new Jr(null),e.history.done=tr(this.history.done,n),e.history.undone=tr(this.history.undone,n)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ot(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Dn(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&pl(this.cm)})}),ei.prototype.eachLine=ei.prototype.iter;var os=0;function kl(e){var t=this;if(as(t),Ee(t,e)||xi(t.display,e))return;y(e),j&&(os=+new Date);var i=Ui(t,e,!0),n=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var r=n.length,s=Array(r),l=0,p=function(){++l==r&&Nn(t,function(){i=o(t.doc,i);var Q={from:i,to:i,text:t.doc.splitLines(s.filter(function(xe){return xe!=null}).join(t.doc.lineSeparator())),origin:"paste"};ir(t.doc,Q),Ga(t.doc,Ri(o(t.doc,i),o(t.doc,Ti(Q))))})()},f=function(Q,xe){if(t.options.allowDropFileTypes&&we(t.options.allowDropFileTypes,Q.type)==-1){p();return}var Fe=new FileReader;Fe.onerror=function(){return p()},Fe.onload=function(){var Xe=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){p();return}s[xe]=Xe,p()},Fe.readAsText(Q)},m=0;m<n.length;m++)f(n[m],m);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var T=e.dataTransfer.getData("Text");if(T){var M;if(t.state.draggingText&&!t.state.draggingText.copy&&(M=t.listSelections()),eo(t.doc,Ri(i,i)),M)for(var re=0;re<M.length;++re)rr(t.doc,"",M[re].anchor,M[re].head,"drag");t.replaceSelection(T,"around","paste"),t.display.input.focus()}}catch(Q){}}}function Rl(e,t){if(j&&(!e.state.draggingText||+new Date-os<100)){E(t);return}if(Ee(e,t)||xi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!le){var i=b("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",I&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),I&&i.parentNode.removeChild(i)}}function Tl(e,t){var i=Ui(e,t);if(!i)return;var n=document.createDocumentFragment();ya(e,i,n),e.display.dragCursor||(e.display.dragCursor=b("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,n)}function as(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&i.push(r)}i.length&&i[0].operation(function(){for(var s=0;s<i.length;s++)e(i[s])})}var ls=!1;function Al(){if(ls)return;Ol(),ls=!0}function Ol(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Pl)},100))}),me(window,"blur",function(){return ss(Zi)})}function Pl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Pi={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Lr=0;Lr<10;Lr++)Pi[Lr+48]=Pi[Lr+96]=String(Lr);for(var io=65;io<=90;io++)Pi[io]=String.fromCharCode(io);for(var Mr=1;Mr<=12;Mr++)Pi[Mr+111]=Pi[Mr+63235]="F"+Mr;var _i={};_i.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},_i.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},_i.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},_i.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},_i.default=ne?_i.macDefault:_i.pcDefault;function Ll(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,n,r,s,l=0;l<t.length-1;l++){var p=t[l];if(/^(cmd|meta|m)$/i.test(p))s=!0;else if(/^a(lt)?$/i.test(p))i=!0;else if(/^(c|ctrl|control)$/i.test(p))n=!0;else if(/^s(hift)?$/i.test(p))r=!0;else throw new Error("Unrecognized modifier name: "+p)}return i&&(e="Alt-"+e),n&&(e="Ctrl-"+e),s&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Ml(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(n=="..."){delete e[i];continue}for(var r=ut(i.split(" "),Ll),s=0;s<r.length;s++){var l=void 0,p=void 0;s==r.length-1?(p=r.join(" "),l=n):(p=r.slice(0,s+1).join(" "),l="...");var f=t[p];if(!f)t[p]=l;else if(f!=l)throw new Error("Inconsistent bindings for "+p)}delete e[i]}for(var m in t)e[m]=t[m];return e}function ar(e,t,i,n){t=ro(t);var r=t.call?t.call(e,n):t[e];if(r===!1)return"nothing";if(r==="...")return"multi";if(r!=null&&i(r))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ar(e,t.fallthrough,i,n);for(var s=0;s<t.fallthrough.length;s++){var l=ar(e,t.fallthrough[s],i,n);if(l)return l}}}function us(e){var t=typeof e=="string"?e:Pi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,i){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(K?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(K?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(I&&e.keyCode==34&&e.char)return!1;var i=Pi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),cs(i,e,t))}function ro(e){return typeof e=="string"?_i[e]:e}function sr(e,t){for(var i=e.doc.sel.ranges,n=[],r=0;r<i.length;r++){for(var s=t(i[r]);n.length&&tt(s.from,Be(n).to)<=0;){var l=n.pop();if(tt(l.from,s.from)<0){s.from=l.from;break}}n.push(s)}oi(e,function(){for(var p=n.length-1;p>=0;p--)rr(e.doc,"",n[p].from,n[p].to,"+delete");Qi(e)})}function Bo(e,t,i){var n=Le(e.text,t+i,i);return n<0||n>e.text.length?null:n}function Fo(e,t,i){var n=Bo(e,t.ch,i);return n==null?null:new Ae(t.line,n,i<0?"after":"before")}function Wo(e,t,i,n,r){if(e){t.doc.direction=="rtl"&&(r=-r);var s=_t(i,t.doc.direction);if(s){var l=r<0?Be(s):s[0],p=r<0==(l.level==1),f=p?"after":"before",m;if(l.level>0||t.doc.direction=="rtl"){var T=Yi(t,i);m=r<0?i.text.length-1:0;var M=yi(t,T,m).top;m=Et(function(re){return yi(t,T,re).top==M},r<0==(l.level==1)?l.from:l.to-1,m),f=="before"&&(m=Bo(i,m,1))}else m=r<0?l.to:l.from;return new Ae(n,m,f)}}return new Ae(n,r<0?i.text.length:0,r<0?"before":"after")}function Nl(e,t,i,n){var r=_t(t,e.doc.direction);if(!r)return Fo(t,i,n);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var s=ct(r,i.ch,i.sticky),l=r[s];if(e.doc.direction=="ltr"&&l.level%2==0&&(n>0?l.to>i.ch:l.from<i.ch))return Fo(t,i,n);var p=function(it,ft){return Bo(t,it instanceof Ae?it.ch:it,ft)},f,m=function(it){return e.options.lineWrapping?(f=f||Yi(e,t),fa(e,t,f,it)):{begin:0,end:t.text.length}},T=m(i.sticky=="before"?p(i,-1):i.ch);if(e.doc.direction=="rtl"||l.level==1){var M=l.level==1==n<0,re=p(i,M?1:-1);if(re!=null&&(M?re<=l.to&&re<=T.end:re>=l.from&&re>=T.begin)){var Q=M?"before":"after";return new Ae(i.line,re,Q)}}var xe=function(it,ft,rt){for(var xt=function(mn,In){return In?new Ae(i.line,p(mn,1),"before"):new Ae(i.line,mn,"after")};it>=0&&it<r.length;it+=ft){var Ut=r[it],Dt=ft>0==(Ut.level!=1),Xt=Dt?rt.begin:p(rt.end,-1);if(Ut.from<=Xt&&Xt<Ut.to)return xt(Xt,Dt);if(Xt=Dt?Ut.from:p(Ut.to,-1),rt.begin<=Xt&&Xt<rt.end)return xt(Xt,Dt)}},Fe=xe(s+n,n,T);if(Fe)return Fe;var Xe=n>0?T.end:p(T.begin,-1);return Xe!=null&&!(n>0&&Xe==t.text.length)&&(Fe=xe(n>0?0:r.length-1,n,m(Xe)),Fe)?Fe:null}var Nr={selectAll:Ya,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return sr(e,function(t){if(t.empty()){var i=gt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ae(t.head.line+1,0)}:{from:t.head,to:Ae(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sr(e,function(t){return{from:Ae(t.from().line,0),to:o(e.doc,Ae(t.to().line+1,0))}})},delLineLeft:function(e){return sr(e,function(t){return{from:Ae(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return sr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ae(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ae(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Dl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Se)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return n.ch<e.getLine(n.line).search(/\S/)?ps(e,t.head):n},Se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),n=e.options.tabSize,r=0;r<i.length;r++){var s=i[r].from(),l=q(e.getLine(s.line),s.ch,n);t.push(w(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return oi(e,function(){for(var t=e.listSelections(),i=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var r=t[n].head,s=gt(e.doc,r.line).text;if(s){if(r.ch==s.length&&(r=new Ae(r.line,r.ch-1)),r.ch>0)r=new Ae(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),Ae(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var l=gt(e.doc,r.line-1).text;l&&(r=new Ae(r.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),Ae(r.line-1,l.length-1),r,"+transpose"))}}i.push(new sn(r,r))}e.setSelections(i)})},newlineAndIndent:function(e){return oi(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Qi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var i=gt(e.doc,t),n=Jn(i);return n!=i&&(t=Lt(n)),Wo(!0,e,n,t,1)}function Dl(e,t){var i=gt(e.doc,t),n=Xi(i);return n!=i&&(t=Lt(n)),Wo(!0,e,i,t,-1)}function ps(e,t){var i=ds(e,t.line),n=gt(e.doc,i.line),r=_t(n,e.doc.direction);if(!r||r[0].level==0){var s=Math.max(i.ch,n.text.search(/\S/)),l=t.line==i.line&&t.ch<=s&&t.ch;return Ae(i.line,l?0:s,i.sticky)}return i}function oo(e,t,i){if(typeof t=="string"&&(t=Nr[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),r=t(e)!=ot}finally{e.display.shift=n,e.state.suppressEdits=!1}return r}function Il(e,t,i){for(var n=0;n<e.state.keyMaps.length;n++){var r=ar(t,e.state.keyMaps[n],i,e);if(r)return r}return e.options.extraKeys&&ar(t,e.options.extraKeys,i,e)||ar(t,e.options.keyMap,i,e)}var jl=new Te;function Dr(e,t,i,n){var r=e.state.keySeq;if(r){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:jl.set(50,function(){e.state.keySeq==r&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,r+" "+t,i,n))return!0}return fs(e,t,i,n)}function fs(e,t,i,n){var r=Il(e,t,n);return r=="multi"&&(e.state.keySeq=t),r=="handled"&&Fn(e,"keyHandled",e,t,i),(r=="handled"||r=="multi")&&(y(i),wo(e)),!!r}function ms(e,t){var i=hs(t,!0);return i?t.shiftKey&&!e.state.keySeq?Dr(e,"Shift-"+i,t,function(n){return oo(e,n,!0)})||Dr(e,i,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return oo(e,n)}):Dr(e,i,t,function(n){return oo(e,n)}):!1}function Ul(e,t,i){return Dr(e,"'"+i+"'",t,function(n){return oo(e,n,!0)})}var zo=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=G(),Ee(t,e))return;j&&ee<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var n=ms(t,e);I&&(zo=n?i:null,!n&&i==88&&!Bt&&(ne?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),oe&&!ne&&!n&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;he(t,"CodeMirror-crosshair");function i(n){(n.keyCode==18||!n.altKey)&&(X(t,"CodeMirror-crosshair"),ht(document,"keyup",i),ht(document,"mouseover",i))}me(document,"keyup",i),me(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ee(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(xi(t.display,e)||Ee(t,e)||e.ctrlKey&&!e.altKey||ne&&e.metaKey)return;var i=e.keyCode,n=e.charCode;if(I&&i==zo){zo=null,y(e);return}if(I&&(!e.which||e.which<10)&&ms(t,e))return;var r=String.fromCharCode(n==null?i:n);if(r=="\b")return;if(Ul(t,e,r))return;t.display.input.onKeyPress(e)}var Fl=400,Ho=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ho.prototype.compare=function(e,t,i){return this.time+Fl>e&&tt(t,this.pos)==0&&i==this.button};var Ir,jr;function Wl(e,t){var i=+new Date;return jr&&jr.compare(i,e,t)?(Ir=jr=null,"triple"):Ir&&Ir.compare(i,e,t)?(jr=new Ho(i,e,t),Ir=null,"double"):(Ir=new Ho(i,e,t),jr=null,"single")}function bs(e){var t=this,i=t.display;if(Ee(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,xi(i,e)){W||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Go(t,e))return;var n=Ui(t,e),r=F(e),s=n?Wl(n,r):"single";if(window.focus(),r==1&&t.state.selectingText&&t.state.selectingText(e),n&&zl(t,r,n,s,e))return;r==1?n?Gl(t,n,s,e):te(e)==i.scroller&&y(e):r==2?(n&&Qr(t.doc,n),setTimeout(function(){return i.input.focus()},20)):r==3&&(v?t.display.input.onContextMenu(e):xa(t))}function zl(e,t,i,n,r){var s="Click";return n=="double"?s="Double"+s:n=="triple"&&(s="Triple"+s),s=(t==1?"Left":t==2?"Middle":"Right")+s,Dr(e,cs(s,r),r,function(l){if(typeof l=="string"&&(l=Nr[l]),!l)return!1;var p=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),p=l(e,i)!=ot}finally{e.state.suppressEdits=!1}return p})}function Hl(e,t,i){var n=e.getOption("configureMouse"),r=n?n(e,t,i):{};if(r.unit==null){var s=pe?i.shiftKey&&i.metaKey:i.altKey;r.unit=s?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(r.extend==null||e.doc.extend)&&(r.extend=e.doc.extend||i.shiftKey),r.addNew==null&&(r.addNew=ne?i.metaKey:i.ctrlKey),r.moveOnDrag==null&&(r.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),r}function Gl(e,t,i,n){j?setTimeout(S(ba,e),0):e.curOp.focus=G();var r=Hl(e,i,n),s=e.doc.sel,l;e.options.dragDrop&&ae&&!e.isReadOnly()&&i=="single"&&(l=s.contains(t))>-1&&(tt((l=s.ranges[l]).from(),t)<0||t.xRel>0)&&(tt(l.to(),t)>0||t.xRel<0)?Vl(e,n,t,r):Xl(e,n,t,r)}function Vl(e,t,i,n){var r=e.display,s=!1,l=Nn(e,function(m){W&&(r.scroller.draggable=!1),e.state.draggingText=!1,ht(r.wrapper.ownerDocument,"mouseup",l),ht(r.wrapper.ownerDocument,"mousemove",p),ht(r.scroller,"dragstart",f),ht(r.scroller,"drop",l),s||(y(m),n.addNew||Qr(e.doc,i,null,null,n.extend),W&&!le||j&&ee==9?setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()},20):r.input.focus())}),p=function(m){s=s||Math.abs(t.clientX-m.clientX)+Math.abs(t.clientY-m.clientY)>=10},f=function(){return s=!0};W&&(r.scroller.draggable=!0),e.state.draggingText=l,l.copy=!n.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),me(r.wrapper.ownerDocument,"mouseup",l),me(r.wrapper.ownerDocument,"mousemove",p),me(r.scroller,"dragstart",f),me(r.scroller,"drop",l),xa(e),setTimeout(function(){return r.input.focus()},20)}function xs(e,t,i){if(i=="char")return new sn(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new sn(Ae(t.line,0),o(e.doc,Ae(t.line+1,0)));var n=i(e,t);return new sn(n.from,n.to)}function Xl(e,t,i,n){var r=e.display,s=e.doc;y(t);var l,p,f=s.sel,m=f.ranges;if(n.addNew&&!n.extend?(p=s.sel.contains(i),p>-1?l=m[p]:l=new sn(i,i)):(l=s.sel.primary(),p=s.sel.primIndex),n.unit=="rectangle")n.addNew||(l=new sn(i,i)),i=Ui(e,t,!0,!0),p=-1;else{var T=xs(e,i,n.unit);n.extend?l=jo(l,T.anchor,T.head,n.extend):l=T}n.addNew?p==-1?(p=m.length,Gn(s,fi(e,m.concat([l]),p),{scroll:!1,origin:"*mouse"})):m.length>1&&m[p].empty()&&n.unit=="char"&&!n.extend?(Gn(s,fi(e,m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),f=s.sel):Uo(s,p,l,je):(p=0,Gn(s,new ui([l],0),je),f=s.sel);var M=i;function re(rt){if(tt(M,rt)==0)return;if(M=rt,n.unit=="rectangle"){for(var xt=[],Ut=e.options.tabSize,Dt=q(gt(s,i.line).text,i.ch,Ut),Xt=q(gt(s,rt.line).text,rt.ch,Ut),mn=Math.min(Dt,Xt),In=Math.max(Dt,Xt),xn=Math.min(i.line,rt.line),ai=Math.min(e.lastLine(),Math.max(i.line,rt.line));xn<=ai;xn++){var ti=gt(s,xn).text,Tn=Oe(ti,mn,Ut);mn==In?xt.push(new sn(Ae(xn,Tn),Ae(xn,Tn))):ti.length>Tn&&xt.push(new sn(Ae(xn,Tn),Ae(xn,Oe(ti,In,Ut))))}xt.length||xt.push(new sn(i,i)),Gn(s,fi(e,f.ranges.slice(0,p).concat(xt),p),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var ni=l,Wn=xs(e,rt,n.unit),Ln=ni.anchor,An;tt(Wn.anchor,Ln)>0?(An=Wn.head,Ln=_n(ni.from(),Wn.anchor)):(An=Wn.anchor,Ln=bn(ni.to(),Wn.head));var En=f.ranges.slice(0);En[p]=Kl(e,new sn(o(s,Ln),An)),Gn(s,fi(e,En,p),je)}}var Q=r.wrapper.getBoundingClientRect(),xe=0;function Fe(rt){var xt=++xe,Ut=Ui(e,rt,!0,n.unit=="rectangle");if(!Ut)return;if(tt(Ut,M)!=0){e.curOp.focus=G(),re(Ut);var Dt=Kr(r,s);(Ut.line>=Dt.to||Ut.line<Dt.from)&&setTimeout(Nn(e,function(){xe==xt&&Fe(rt)}),150)}else{var Xt=rt.clientY<Q.top?-20:rt.clientY>Q.bottom?20:0;Xt&&setTimeout(Nn(e,function(){if(xe!=xt)return;r.scroller.scrollTop+=Xt,Fe(rt)}),50)}}function Xe(rt){e.state.selectingText=!1,xe=Infinity,rt&&(y(rt),r.input.focus()),ht(r.wrapper.ownerDocument,"mousemove",it),ht(r.wrapper.ownerDocument,"mouseup",ft),s.history.lastSelOrigin=null}var it=Nn(e,function(rt){rt.buttons===0||!F(rt)?Xe(rt):Fe(rt)}),ft=Nn(e,Xe);e.state.selectingText=ft,me(r.wrapper.ownerDocument,"mousemove",it),me(r.wrapper.ownerDocument,"mouseup",ft)}function Kl(e,t){var i=t.anchor,n=t.head,r=gt(e.doc,i.line);if(tt(i,n)==0&&i.sticky==n.sticky)return t;var s=_t(r);if(!s)return t;var l=ct(s,i.ch,i.sticky),p=s[l];if(p.from!=i.ch&&p.to!=i.ch)return t;var f=l+(p.from==i.ch==(p.level!=1)?0:1);if(f==0||f==s.length)return t;var m;if(n.line!=i.line)m=(n.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var T=ct(s,n.ch,n.sticky),M=T-l||(n.ch-i.ch)*(p.level==1?-1:1);T==f-1||T==f?m=M<0:m=M>0}var re=s[f+(m?-1:0)],Q=m==(re.level==1),xe=Q?re.from:re.to,Fe=Q?"after":"before";return i.ch==xe&&i.sticky==Fe?t:new sn(new Ae(i.line,xe,Fe),n)}function _s(e,t,i,n){var r,s;if(t.touches)r=t.touches[0].clientX,s=t.touches[0].clientY;else try{r=t.clientX,s=t.clientY}catch(re){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&y(t);var l=e.display,p=l.lineDiv.getBoundingClientRect();if(s>p.bottom||!O(e,i))return C(t);s-=p.top-l.viewOffset;for(var f=0;f<e.display.gutterSpecs.length;++f){var m=l.gutters.childNodes[f];if(m&&m.getBoundingClientRect().right>=r){var T=gn(e.doc,s),M=e.display.gutterSpecs[f];return ye(e,i,e,T,M.className,t),C(t)}}}function Go(e,t){return _s(e,t,"gutterClick",!0)}function Cs(e,t){if(xi(e.display,t)||$l(e,t))return;if(Ee(e,t,"contextmenu"))return;v||e.display.input.onContextMenu(t)}function $l(e,t){return O(e,"gutterContextMenu")?_s(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vr(e)}var lr={toString:function(){return"CodeMirror.Init"}},ws={},ao={};function Yl(e){var t=e.optionHandlers;function i(n,r,s,l){e.defaults[n]=r,s&&(t[n]=l?function(p,f,m){m!=lr&&s(p,f,m)}:s)}e.defineOption=i,e.Init=lr,i("value","",function(n,r){return n.setValue(r)},!0),i("mode",null,function(n,r){n.doc.modeOption=r,No(n)},!0),i("indentUnit",2,No,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(n){Sr(n),vr(n),Qn(n)},!0),i("lineSeparator",null,function(n,r){if(n.doc.lineSep=r,!r)return;var s=[],l=n.doc.first;n.doc.iter(function(f){for(var m=0;;){var T=f.text.indexOf(r,m);if(T==-1)break;m=T+r.length,s.push(Ae(l,T))}l++});for(var p=s.length-1;p>=0;p--)rr(n.doc,r,s[p],Ae(s[p].line,s[p].ch+r.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,r,s){n.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),s!=lr&&n.refresh()}),i("specialCharPlaceholder",nn,function(n){return n.refresh()},!0),i("electricChars",!0),i("inputStyle",ce?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(n,r){return n.getInputField().spellcheck=r},!0),i("autocorrect",!1,function(n,r){return n.getInputField().autocorrect=r},!0),i("autocapitalize",!1,function(n,r){return n.getInputField().autocapitalize=r},!0),i("rtlMoveVisually",!Ne),i("wholeLineUpdateBefore",!0),i("theme","default",function(n){Es(n),wr(n)},!0),i("keyMap","default",function(n,r,s){var l=ro(r),p=s!=lr&&ro(s);p&&p.detach&&p.detach(n,l),l.attach&&l.attach(n,p||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(n,r){n.display.gutterSpecs=Lo(r,n.options.lineNumbers),wr(n)},!0),i("fixedGutter",!0,function(n,r){n.display.gutters.style.left=r?Co(n.display)+"px":"0",n.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(n){return er(n)},!0),i("scrollbarStyle","native",function(n){ka(n),er(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),i("lineNumbers",!1,function(n,r){n.display.gutterSpecs=Lo(n.options.gutters,r),wr(n)},!0),i("firstLineNumber",1,wr,!0),i("lineNumberFormatter",function(n){return n},wr,!0),i("showCursorWhenSelecting",!1,yr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(n,r){r=="nocursor"&&(Zi(n),n.display.input.blur()),n.display.input.readOnlyChanged(r)}),i("screenReaderLabel",null,function(n,r){r=r===""?null:r,n.display.input.screenReaderLabelChanged(r)}),i("disableInput",!1,function(n,r){r||n.display.input.reset()},!0),i("dragDrop",!0,ql),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yr,!0),i("singleCursorHeightPerLine",!0,yr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Sr,!0),i("addModeClass",!1,Sr,!0),i("pollInterval",100),i("undoDepth",200,function(n,r){return n.doc.history.undoDepth=r}),i("historyEventDelay",1250),i("viewportMargin",10,function(n){return n.refresh()},!0),i("maxHighlightLength",1e4,Sr,!0),i("moveInputWithCursor",!0,function(n,r){r||n.display.input.resetPosition()}),i("tabindex",null,function(n,r){return n.display.input.getField().tabIndex=r||""}),i("autofocus",null),i("direction","ltr",function(n,r){return n.doc.setDirection(r)},!0),i("phrases",null)}function ql(e,t,i){var n=i&&i!=lr;if(!t!=!n){var r=e.display.dragFunctions,s=t?me:ht;s(e.display.scroller,"dragstart",r.start),s(e.display.scroller,"dragenter",r.enter),s(e.display.scroller,"dragover",r.over),s(e.display.scroller,"dragleave",r.leave),s(e.display.scroller,"drop",r.drop)}}function Jl(e){e.options.lineWrapping?(he(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(X(e.display.wrapper,"CodeMirror-wrap"),Fr(e)),Eo(e),Qn(e),vr(e),setTimeout(function(){return er(e)},100)}function yn(e,t){var i=this;if(!(this instanceof yn))return new yn(e,t);this.options=t=t?g(t):{},g(ws,t,!1);var n=t.value;typeof n=="string"?n=new ei(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var r=new yn.inputStyles[t.inputStyle](this),s=this.display=new cl(e,n,r,t);s.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ka(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 Te,keySeq:null,specialChars:null},t.autofocus&&!ce&&s.input.focus(),j&&ee<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),Al(),zi(this),this.curOp.forceUpdate=!0,Ia(this,n),t.autofocus&&!ce||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&So(i)},20):Zi(this);for(var l in ao)ao.hasOwnProperty(l)&&ao[l](this,t[l],lr);Aa(this),t.finishInit&&t.finishInit(this);for(var p=0;p<Vo.length;++p)Vo[p](this);Hi(this),W&&t.lineWrapping&&getComputedStyle(s.lineDiv).textRendering=="optimizelegibility"&&(s.lineDiv.style.textRendering="auto")}yn.defaults=ws,yn.optionHandlers=ao;function Zl(e){var t=e.display;me(t.scroller,"mousedown",Nn(e,bs)),j&&ee<11?me(t.scroller,"dblclick",Nn(e,function(f){if(Ee(e,f))return;var m=Ui(e,f);if(!m||Go(e,f)||xi(e.display,f))return;y(f);var T=e.findWordAt(m);Qr(e.doc,T.anchor,T.head)})):me(t.scroller,"dblclick",function(f){return Ee(e,f)||y(f)}),me(t.scroller,"contextmenu",function(f){return Cs(e,f)}),me(t.input.getField(),"contextmenu",function(f){t.scroller.contains(f.target)||Cs(e,f)});var i,n={end:0};function r(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function s(f){if(f.touches.length!=1)return!1;var m=f.touches[0];return m.radiusX<=1&&m.radiusY<=1}function l(f,m){if(m.left==null)return!0;var T=m.left-f.left,M=m.top-f.top;return T*T+M*M>20*20}me(t.scroller,"touchstart",function(f){if(!Ee(e,f)&&!s(f)&&!Go(e,f)){t.input.ensurePolled(),clearTimeout(i);var m=+new Date;t.activeTouch={start:m,moved:!1,prev:m-n.end<=300?n:null},f.touches.length==1&&(t.activeTouch.left=f.touches[0].pageX,t.activeTouch.top=f.touches[0].pageY)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(f){var m=t.activeTouch;if(m&&!xi(t,f)&&m.left!=null&&!m.moved&&new Date-m.start<300){var T=e.coordsChar(t.activeTouch,"page"),M;!m.prev||l(m,m.prev)?M=new sn(T,T):!m.prev.prev||l(m,m.prev.prev)?M=e.findWordAt(T):M=new sn(Ae(T.line,0),o(e.doc,Ae(T.line+1,0))),e.setSelection(M.anchor,M.head),e.focus(),y(f)}r()}),me(t.scroller,"touchcancel",r),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xr(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),ye(e,"scroll",e))}),me(t.scroller,"mousewheel",function(f){return La(e,f)}),me(t.scroller,"DOMMouseScroll",function(f){return La(e,f)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(f){Ee(e,f)||E(f)},over:function(f){Ee(e,f)||(Tl(e,f),E(f))},start:function(f){return Rl(e,f)},drop:Nn(e,kl),leave:function(f){Ee(e,f)||as(e)}};var p=t.input.getField();me(p,"keyup",function(f){return vs.call(e,f)}),me(p,"keydown",Nn(e,gs)),me(p,"keypress",Nn(e,ys)),me(p,"focus",function(f){return So(e,f)}),me(p,"blur",function(f){return Zi(e,f)})}var Vo=[];yn.defineInitHook=function(e){return Vo.push(e)};function Ur(e,t,i,n){var r=e.doc,s;i==null&&(i="add"),i=="smart"&&(r.mode.indent?s=Ze(e,t).state:i="prev");var l=e.options.tabSize,p=gt(r,t),f=q(p.text,null,l);p.stateAfter&&(p.stateAfter=null);var m=p.text.match(/^\s*/)[0],T;if(!n&&!/\S/.test(p.text))T=0,i="not";else if(i=="smart"&&(T=r.mode.indent(s,p.text.slice(m.length),p.text),T==ot||T>150)){if(!n)return;i="prev"}i=="prev"?t>r.first?T=q(gt(r,t-1).text,null,l):T=0:i=="add"?T=f+e.options.indentUnit:i=="subtract"?T=f-e.options.indentUnit:typeof i=="number"&&(T=f+i),T=Math.max(0,T);var M="",re=0;if(e.options.indentWithTabs)for(var Q=Math.floor(T/l);Q;--Q)re+=l,M+=" ";if(re<T&&(M+=w(T-re)),M!=m)return rr(r,M,Ae(t,0),Ae(t,m.length),"+input"),p.stateAfter=null,!0;for(var xe=0;xe<r.sel.ranges.length;xe++){var Fe=r.sel.ranges[xe];if(Fe.head.line==t&&Fe.head.ch<m.length){var Xe=Ae(t,m.length);Uo(r,xe,new sn(Xe,Xe));break}}}var mi=null;function so(e){mi=e}function Xo(e,t,i,n,r){var s=e.doc;e.display.shift=!1,n||(n=s.sel);var l=+new Date-200,p=r=="paste"||e.state.pasteIncoming>l,f=Ot(t),m=null;if(p&&n.ranges.length>1)if(mi&&mi.text.join(`
|
|
`)==t){if(n.ranges.length%mi.text.length==0){m=[];for(var T=0;T<mi.text.length;T++)m.push(s.splitLines(mi.text[T]))}}else f.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(m=ut(f,function(it){return[it]}));for(var M=e.curOp.updateInput,re=n.ranges.length-1;re>=0;re--){var Q=n.ranges[re],xe=Q.from(),Fe=Q.to();Q.empty()&&(i&&i>0?xe=Ae(xe.line,xe.ch-i):e.state.overwrite&&!p?Fe=Ae(Fe.line,Math.min(gt(s,Fe.line).text.length,Fe.ch+Be(f).length)):p&&mi&&mi.lineWise&&mi.text.join(`
|
|
`)==f.join(`
|
|
`)&&(xe=Fe=Ae(xe.line,0)));var Xe={from:xe,to:Fe,text:m?m[re%m.length]:f,origin:r||(p?"paste":e.state.cutIncoming>l?"cut":"+input")};ir(e.doc,Xe),Fn(e,"inputRead",e,Xe)}t&&!p&&ks(e,t),Qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=M),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&oi(t,function(){return Xo(t,i,0,null,"paste")}),!0}function ks(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)continue;var s=e.getModeAt(r.head),l=!1;if(s.electricChars){for(var p=0;p<s.electricChars.length;p++)if(t.indexOf(s.electricChars.charAt(p))>-1){l=Ur(e,r.head.line,"smart");break}}else s.electricInput&&(s.electricInput.test(gt(e.doc,r.head.line).text.slice(0,r.head.ch))&&(l=Ur(e,r.head.line,"smart")));l&&Fn(e,"electricInput",e,r.head.line)}}function Rs(e){for(var t=[],i=[],n=0;n<e.doc.sel.ranges.length;n++){var r=e.doc.sel.ranges[n].head.line,s={anchor:Ae(r,0),head:Ae(r+1,0)};i.push(s),t.push(e.getRange(s.anchor,s.head))}return{text:t,ranges:i}}function Ts(e,t,i,n){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=b("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=b("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return W?e.style.width="1000px":e.setAttribute("wrap","off"),J&&(e.style.border="1px solid black"),Ts(e),t}function Ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,r){var s=this.options,l=s[n];if(s[n]==r&&n!="mode")return;s[n]=r,t.hasOwnProperty(n)&&Nn(this,t[n])(this,r,l),ye(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,r){this.state.keyMaps[r?"push":"unshift"](ro(n))},removeKeyMap:function(n){for(var r=this.state.keyMaps,s=0;s<r.length;++s)if(r[s]==n||r[s].name==n)return r.splice(s,1),!0},addOverlay:Xn(function(n,r){var s=n.token?n:e.getMode(this.options,n);if(s.startState)throw new Error("Overlays may not be stateful.");wt(this.state.overlays,{mode:s,modeSpec:n,opaque:r&&r.opaque,priority:r&&r.priority||0},function(l){return l.priority}),this.state.modeGen++,Qn(this)}),removeOverlay:Xn(function(n){for(var r=this.state.overlays,s=0;s<r.length;++s){var l=r[s].modeSpec;if(l==n||typeof n=="string"&&l.name==n){r.splice(s,1),this.state.modeGen++,Qn(this);return}}}),indentLine:Xn(function(n,r,s){typeof r!="string"&&typeof r!="number"&&(r==null?r=this.options.smartIndent?"smart":"prev":r=r?"add":"subtract"),$n(this.doc,n)&&Ur(this,n,r,s)}),indentSelection:Xn(function(n){for(var r=this.doc.sel.ranges,s=-1,l=0;l<r.length;l++){var p=r[l];if(p.empty())p.head.line>s&&(Ur(this,p.head.line,n,!0),s=p.head.line,l==this.doc.sel.primIndex&&Qi(this));else{var f=p.from(),m=p.to(),T=Math.max(s,f.line);s=Math.min(this.lastLine(),m.line-(m.ch?0:1))+1;for(var M=T;M<s;++M)Ur(this,M,n);var re=this.doc.sel.ranges;f.ch==0&&r.length==re.length&&re[l].from().ch>0&&Uo(this.doc,l,new sn(f,re[l].to()),_e)}}}),getTokenAt:function(n,r){return Ie(this,n,r)},getLineTokens:function(n,r){return Ie(this,Ae(n),r,!0)},getTokenTypeAt:function(n){n=o(this.doc,n);var r=Re(this,gt(this.doc,n.line)),s=0,l=(r.length-1)/2,p=n.ch,f;if(p==0)f=r[2];else for(;;){var m=s+l>>1;if((m?r[m*2-1]:0)>=p)l=m;else if(r[m*2+1]<p)s=m+1;else{f=r[m*2+2];break}}var T=f?f.indexOf("overlay "):-1;return T<0?f:T==0?null:f.slice(0,T-1)},getModeAt:function(n){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(n).state).mode:r},getHelper:function(n,r){return this.getHelpers(n,r)[0]},getHelpers:function(n,r){var s=[];if(!i.hasOwnProperty(r))return s;var l=i[r],p=this.getModeAt(n);if(typeof p[r]=="string")l[p[r]]&&s.push(l[p[r]]);else if(p[r])for(var f=0;f<p[r].length;f++){var m=l[p[r][f]];m&&s.push(m)}else p.helperType&&l[p.helperType]?s.push(l[p.helperType]):l[p.name]&&s.push(l[p.name]);for(var T=0;T<l._global.length;T++){var M=l._global[T];M.pred(p,this)&&we(s,M.val)==-1&&s.push(M.val)}return s},getStateAfter:function(n,r){var s=this.doc;return n=h(s,n==null?s.first+s.size-1:n),Ze(this,n+1,r).state},cursorCoords:function(n,r){var s,l=this.doc.sel.primary();return n==null?s=l.head:typeof n=="object"?s=o(this.doc,n):s=n?l.from():l.to(),pi(this,s,r||"page")},charCoords:function(n,r){return vo(this,o(this.doc,n),r||"page")},coordsChar:function(n,r){return n=ha(this,n,r||"page"),bo(this,n.left,n.top)},lineAtHeight:function(n,r){return n=ha(this,{top:n,left:0},r||"page").top,gn(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,r,s){var l=!1,p;if(typeof n=="number"){var f=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>f&&(n=f,l=!0),p=gt(this.doc,n)}else p=n;return Hr(this,p,{top:0,left:0},r||"page",s||l).top+(l?this.doc.height-di(p):0)},defaultTextHeight:function(){return qi(this.display)},defaultCharWidth:function(){return Ji(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,r,s,l,p){var f=this.display;n=pi(this,o(this.doc,n));var m=n.bottom,T=n.left;if(r.style.position="absolute",r.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(r),f.sizer.appendChild(r),l=="over")m=n.top;else if(l=="above"||l=="near"){var M=Math.max(f.wrapper.clientHeight,this.doc.height),re=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);(l=="above"||n.bottom+r.offsetHeight>M)&&n.top>r.offsetHeight?m=n.top-r.offsetHeight:n.bottom+r.offsetHeight<=M&&(m=n.bottom),T+r.offsetWidth>re&&(T=re-r.offsetWidth)}r.style.top=m+"px",r.style.left=r.style.right="",p=="right"?(T=f.sizer.clientWidth-r.offsetWidth,r.style.right="0px"):(p=="left"?T=0:p=="middle"&&(T=(f.sizer.clientWidth-r.offsetWidth)/2),r.style.left=T+"px"),s&&qs(this,{left:T,top:m,right:T+r.offsetWidth,bottom:m+r.offsetHeight})},triggerOnKeyDown:Xn(gs),triggerOnKeyPress:Xn(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Xn(bs),execCommand:function(n){if(Nr.hasOwnProperty(n))return Nr[n].call(null,this)},triggerElectric:Xn(function(n){ks(this,n)}),findPosH:function(n,r,s,l){var p=1;r<0&&(p=-1,r=-r);for(var f=o(this.doc,n),m=0;m<r&&!(f=Ko(this.doc,f,p,s,l),f.hitSide);++m);return f},moveH:Xn(function(n,r){var s=this;this.extendSelectionsBy(function(l){return s.display.shift||s.doc.extend||l.empty()?Ko(s.doc,l.head,n,r,s.options.rtlMoveVisually):n<0?l.from():l.to()},Se)}),deleteH:Xn(function(n,r){var s=this.doc.sel,l=this.doc;s.somethingSelected()?l.replaceSelection("",null,"+delete"):sr(this,function(p){var f=Ko(l,p.head,n,r,!1);return n<0?{from:f,to:p.head}:{from:p.head,to:f}})}),findPosV:function(n,r,s,l){var p=1,f=l;r<0&&(p=-1,r=-r);for(var m=o(this.doc,n),T=0;T<r;++T){var M=pi(this,m,"div");if(f==null?f=M.left:M.left=f,m=Os(this,M,p,s),m.hitSide)break}return m},moveV:Xn(function(n,r){var s=this,l=this.doc,p=[],f=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(T){if(f)return n<0?T.from():T.to();var M=pi(s,T.head,"div");T.goalColumn!=null&&(M.left=T.goalColumn),p.push(M.left);var re=Os(s,M,n,r);return r=="page"&&T==l.sel.primary()&&Ro(s,vo(s,re,"div").top-M.top),re},Se),p.length)for(var m=0;m<l.sel.ranges.length;m++)l.sel.ranges[m].goalColumn=p[m]}),findWordAt:function(n){var r=this.doc,s=gt(r,n.line).text,l=n.ch,p=n.ch;if(s){var f=this.getHelper(n,"wordChars");(n.sticky=="before"||p==s.length)&&l?--l:++p;for(var m=s.charAt(l),T=We(m,f)?function(M){return We(M,f)}:/\s/.test(m)?function(M){return/\s/.test(M)}:function(M){return!/\s/.test(M)&&!We(M)};l>0&&T(s.charAt(l-1));)--l;for(;p<s.length&&T(s.charAt(p));)++p}return new sn(Ae(n.line,l),Ae(n.line,p))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?he(this.display.cursorDiv,"CodeMirror-overwrite"):X(this.display.cursorDiv,"CodeMirror-overwrite"),ye(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==G()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Xn(function(n,r){br(this,n,r)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-vi(this)-this.display.barHeight,width:n.scrollWidth-vi(this)-this.display.barWidth,clientHeight:fo(this),clientWidth:Ii(this)}},scrollIntoView:Xn(function(n,r){n==null?(n={from:this.doc.sel.primary().head,to:null},r==null&&(r=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Ae(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=r||0,n.from.line!=null?Js(this,n):Ca(this,n.from,n.to,n.margin)}),setSize:Xn(function(n,r){var s=this,l=function(f){return typeof f=="number"||/^\d+$/.test(String(f))?f+"px":f};n!=null&&(this.display.wrapper.style.width=l(n)),r!=null&&(this.display.wrapper.style.height=l(r)),this.options.lineWrapping&&la(this);var p=this.display.viewFrom;this.doc.iter(p,this.display.viewTo,function(f){if(f.widgets){for(var m=0;m<f.widgets.length;m++)if(f.widgets[m].noHScroll){Si(s,p,"widget");break}}++p}),this.curOp.forceUpdate=!0,ye(this,"refresh",this)}),operation:function(n){return oi(this,n)},startOperation:function(){return zi(this)},endOperation:function(){return Hi(this)},refresh:Xn(function(){var n=this.display.cachedTextHeight;Qn(this),this.curOp.forceUpdate=!0,vr(this),br(this,this.doc.scrollLeft,this.doc.scrollTop),Oo(this.display),(n==null||Math.abs(n-qi(this.display))>.5||this.options.lineWrapping)&&Eo(this),ye(this,"refresh",this)}),swapDoc:Xn(function(n){var r=this.doc;return r.cm=null,this.state.selectingText&&this.state.selectingText(),Ia(this,n),vr(this),this.display.input.reset(),br(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Fn(this,"swapDoc",this,r),r}),phrase:function(n){var r=this.options.phrases;return r&&Object.prototype.hasOwnProperty.call(r,n)?r[n]:n},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}},P(e),e.registerHelper=function(n,r,s){i.hasOwnProperty(n)||(i[n]=e[n]={_global:[]}),i[n][r]=s},e.registerGlobalHelper=function(n,r,s,l){e.registerHelper(n,r,l),i[n]._global.push({pred:s,val:l})}}function Ko(e,t,i,n,r){var s=t,l=i,p=gt(e,t.line),f=r&&e.direction=="rtl"?-i:i;function m(){var ft=t.line+f;return ft<e.first||ft>=e.first+e.size?!1:(t=new Ae(ft,t.ch,t.sticky),p=gt(e,ft))}function T(ft){var rt;if(n=="codepoint"){var xt=p.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(xt)?rt=null:rt=new Ae(t.line,Math.max(0,Math.min(p.text.length,t.ch+i*(xt>=55296&&xt<56320?2:1))),-i)}else r?rt=Nl(e.cm,p,t,i):rt=Fo(p,t,i);if(rt==null)if(!ft&&m())t=Wo(r,e.cm,p,t.line,f);else return!1;else t=rt;return!0}if(n=="char"||n=="codepoint")T();else if(n=="column")T(!0);else if(n=="word"||n=="group")for(var M=null,re=n=="group",Q=e.cm&&e.cm.getHelper(t,"wordChars"),xe=!0;!(i<0&&!T(!xe));xe=!1){var Fe=p.text.charAt(t.ch)||`
|
|
`,Xe=We(Fe,Q)?"w":re&&Fe==`
|
|
`?"n":!re||/\s/.test(Fe)?null:"p";if(re&&!xe&&!Xe&&(Xe="s"),M&&M!=Xe){i<0&&(i=1,T(),t.sticky="after");break}if(Xe&&(M=Xe),i>0&&!T(!xe))break}var it=to(e,t,s,l,!0);return dn(s,it)&&(it.hitSide=!0),it}function Os(e,t,i,n){var r=e.doc,s=t.left,l;if(n=="page"){var p=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),f=Math.max(p-.5*qi(e.display),3);l=(i>0?t.bottom:t.top)+i*f}else n=="line"&&(l=i>0?t.bottom+3:t.top-3);for(var m;!(m=bo(e,s,l),!m.outside);){if(i<0?l<=0:l>=r.height){m.hitSide=!0;break}l+=i*5}return m}var hn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};hn.prototype.init=function(e){var t=this,i=this,n=i.cm,r=i.div=e.lineDiv;Ts(r,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function s(p){for(var f=p.target;f;f=f.parentNode){if(f==r)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(f.className))break}return!1}me(r,"paste",function(p){if(!s(p)||Ee(n,p)||Ss(p,n))return;ee<=11&&setTimeout(Nn(n,function(){return t.updateFromDOM()}),20)}),me(r,"compositionstart",function(p){t.composing={data:p.data,done:!1}}),me(r,"compositionupdate",function(p){t.composing||(t.composing={data:p.data,done:!1})}),me(r,"compositionend",function(p){t.composing&&(p.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(r,"touchstart",function(){return i.forceCompositionEnd()}),me(r,"input",function(){t.composing||t.readFromDOMSoon()});function l(p){if(!s(p)||Ee(n,p))return;if(n.somethingSelected())so({lineWise:!1,text:n.getSelections()}),p.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var f=Rs(n);so({lineWise:!0,text:f.text}),p.type=="cut"&&n.operation(function(){n.setSelections(f.ranges,0,_e),n.replaceSelection("",null,"cut")})}else return;if(p.clipboardData){p.clipboardData.clearData();var m=mi.text.join(`
|
|
`);if(p.clipboardData.setData("Text",m),p.clipboardData.getData("Text")==m){p.preventDefault();return}}var T=As(),M=T.firstChild;n.display.lineSpace.insertBefore(T,n.display.lineSpace.firstChild),M.value=mi.text.join(`
|
|
`);var re=document.activeElement;be(M),setTimeout(function(){n.display.lineSpace.removeChild(T),re.focus(),re==r&&i.showPrimarySelection()},50)}me(r,"copy",l),me(r,"cut",l)},hn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},hn.prototype.prepareSelection=function(){var e=va(this.cm,!1);return e.focus=document.activeElement==this.div,e},hn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},hn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},hn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),r=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||r.line<t.display.viewFrom){e.removeAllRanges();return}var s=lo(t,e.anchorNode,e.anchorOffset),l=lo(t,e.focusNode,e.focusOffset);if(s&&!s.bad&&l&&!l.bad&&tt(_n(s,l),n)==0&&tt(bn(s,l),r)==0)return;var p=t.display.view,f=n.line>=t.display.viewFrom&&Ps(t,n)||{node:p[0].measure.map[2],offset:0},m=r.line<t.display.viewTo&&Ps(t,r);if(!m){var T=p[p.length-1].measure,M=T.maps?T.maps[T.maps.length-1]:T.map;m={node:M[M.length-1],offset:M[M.length-2]-M[M.length-3]}}if(!f||!m){e.removeAllRanges();return}var re=e.rangeCount&&e.getRangeAt(0),Q;try{Q=D(f.node,f.offset,m.offset,m.node)}catch(xe){}Q&&(!oe&&t.state.focused?(e.collapse(f.node,f.offset),Q.collapsed||(e.removeAllRanges(),e.addRange(Q))):(e.removeAllRanges(),e.addRange(Q)),re&&e.anchorNode==null?e.addRange(re):oe&&this.startGracePeriod()),this.rememberSelection()},hn.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},hn.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},hn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},hn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return k(this.div,t)},hn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},hn.prototype.blur=function(){this.div.blur()},hn.prototype.getField=function(){return this.div},hn.prototype.supportsTouch=function(){return!0},hn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():oi(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},hn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},hn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(B&&L&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=lo(t,e.anchorNode,e.anchorOffset),n=lo(t,e.focusNode,e.focusOffset);i&&n&&oi(t,function(){Gn(t.doc,Ri(i,n),_e),(i.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},hn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),n=i.from(),r=i.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Ae(n.line-1,gt(e.doc,n.line-1).length)),r.ch==gt(e.doc,r.line).text.length&&r.line<e.lastLine()&&(r=Ae(r.line+1,0)),n.line<t.viewFrom||r.line>t.viewTo-1)return!1;var s,l,p;n.line==t.viewFrom||(s=Bi(e,n.line))==0?(l=Lt(t.view[0].line),p=t.view[0].node):(l=Lt(t.view[s].line),p=t.view[s-1].node.nextSibling);var f=Bi(e,r.line),m,T;if(f==t.view.length-1?(m=t.viewTo-1,T=t.lineDiv.lastChild):(m=Lt(t.view[f+1].line)-1,T=t.view[f+1].node.previousSibling),!p)return!1;for(var M=e.doc.splitLines(tu(e,p,T,l,m)),re=qt(e.doc,Ae(l,0),Ae(m,gt(e.doc,m).text.length));M.length>1&&re.length>1;)if(Be(M)==Be(re))M.pop(),re.pop(),m--;else if(M[0]==re[0])M.shift(),re.shift(),l++;else break;for(var Q=0,xe=0,Fe=M[0],Xe=re[0],it=Math.min(Fe.length,Xe.length);Q<it&&Fe.charCodeAt(Q)==Xe.charCodeAt(Q);)++Q;for(var ft=Be(M),rt=Be(re),xt=Math.min(ft.length-(M.length==1?Q:0),rt.length-(re.length==1?Q:0));xe<xt&&ft.charCodeAt(ft.length-xe-1)==rt.charCodeAt(rt.length-xe-1);)++xe;if(M.length==1&&re.length==1&&l==n.line)for(;Q&&Q>n.ch&&ft.charCodeAt(ft.length-xe-1)==rt.charCodeAt(rt.length-xe-1);)Q--,xe++;M[M.length-1]=ft.slice(0,ft.length-xe).replace(/^\u200b+/,""),M[0]=M[0].slice(Q).replace(/\u200b+$/,"");var Ut=Ae(l,Q),Dt=Ae(m,re.length?Be(re).length-xe:0);if(M.length>1||M[0]||tt(Ut,Dt))return rr(e.doc,M,Ut,Dt,"+input"),!0},hn.prototype.ensurePolled=function(){this.forceCompositionEnd()},hn.prototype.reset=function(){this.forceCompositionEnd()},hn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},hn.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},hn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&oi(this.cm,function(){return Qn(e.cm)})},hn.prototype.setUneditable=function(e){e.contentEditable="false"},hn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Nn(this.cm,Xo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},hn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},hn.prototype.onContextMenu=function(){},hn.prototype.resetPosition=function(){},hn.prototype.needsContentAttribute=!0;function Ps(e,t){var i=mo(e,t.line);if(!i||i.hidden)return null;var n=gt(e.doc,t.line),r=ia(i,n,t.line),s=_t(n,e.doc.direction),l="left";if(s){var p=ct(s,t.ch);l=p%2?"right":"left"}var f=aa(r.map,t.ch,l);return f.offset=f.collapse=="right"?f.end:f.start,f}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ur(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,n,r){var s="",l=!1,p=e.doc.lineSeparator(),f=!1;function m(Q){return function(xe){return xe.id==Q}}function T(){l&&(s+=p,f&&(s+=p),l=f=!1)}function M(Q){Q&&(T(),s+=Q)}function re(Q){if(Q.nodeType==1){var xe=Q.getAttribute("cm-text");if(xe){M(xe);return}var Fe=Q.getAttribute("cm-marker"),Xe;if(Fe){var it=e.findMarks(Ae(n,0),Ae(r+1,0),m(+Fe));it.length&&(Xe=it[0].find(0))&&M(qt(e.doc,Xe.from,Xe.to).join(p));return}if(Q.getAttribute("contenteditable")=="false")return;var ft=/^(pre|div|p|li|table|br)$/i.test(Q.nodeName);if(!/^br$/i.test(Q.nodeName)&&Q.textContent.length==0)return;ft&&T();for(var rt=0;rt<Q.childNodes.length;rt++)re(Q.childNodes[rt]);/^(pre|p)$/i.test(Q.nodeName)&&(f=!0),ft&&(l=!0)}else Q.nodeType==3&&M(Q.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(re(t),t==i);)t=t.nextSibling,f=!1;return s}function lo(e,t,i){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[i],!n)return ur(e.clipPos(Ae(e.display.viewTo-1)),!0);t=null,i=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var s=e.display.view[r];if(s.node==n)return nu(s,t,i)}}function nu(e,t,i){var n=e.text.firstChild,r=!1;if(!t||!k(n,t))return ur(Ae(Lt(e.line),0),!0);if(t==n&&(r=!0,t=n.childNodes[i],i=0,!t)){var s=e.rest?Be(e.rest):e.line;return ur(Ae(Lt(s),s.text.length),r)}var l=t.nodeType==3?t:null,p=t;for(!l&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(l=t.firstChild,i&&(i=l.nodeValue.length));p.parentNode!=n;)p=p.parentNode;var f=e.measure,m=f.maps;function T(Xe,it,ft){for(var rt=-1;rt<(m?m.length:0);rt++)for(var xt=rt<0?f.map:m[rt],Ut=0;Ut<xt.length;Ut+=3){var Dt=xt[Ut+2];if(Dt==Xe||Dt==it){var Xt=Lt(rt<0?e.line:e.rest[rt]),mn=xt[Ut]+ft;return(ft<0||Dt!=Xe)&&(mn=xt[Ut+(ft?1:0)]),Ae(Xt,mn)}}}var M=T(l,p,i);if(M)return ur(M,r);for(var re=p.nextSibling,Q=l?l.nodeValue.length-i:0;re;re=re.nextSibling){if(M=T(re,re.firstChild,0),M)return ur(Ae(M.line,M.ch-Q),r);Q+=re.textContent.length}for(var xe=p.previousSibling,Fe=i;xe;xe=xe.previousSibling){if(M=T(xe,xe.firstChild,-1),M)return ur(Ae(M.line,M.ch+Fe),r);Fe+=xe.textContent.length}}var Sn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Te,this.hasSelection=!1,this.composing=null};Sn.prototype.init=function(e){var t=this,i=this,n=this.cm;this.createField(e);var r=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),J&&(r.style.width="0px"),me(r,"input",function(){j&&ee>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),me(r,"paste",function(l){if(Ee(n,l)||Ss(l,n))return;n.state.pasteIncoming=+new Date,i.fastPoll()});function s(l){if(Ee(n,l))return;if(n.somethingSelected())so({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var p=Rs(n);so({lineWise:!0,text:p.text}),l.type=="cut"?n.setSelections(p.ranges,null,_e):(i.prevInput="",r.value=p.text.join(`
|
|
`),be(r))}else return;l.type=="cut"&&(n.state.cutIncoming=+new Date)}me(r,"cut",s),me(r,"copy",s),me(e.scroller,"paste",function(l){if(xi(e,l)||Ee(n,l))return;if(!r.dispatchEvent){n.state.pasteIncoming=+new Date,i.focus();return}var p=new Event("paste");p.clipboardData=l.clipboardData,r.dispatchEvent(p)}),me(e.lineSpace,"selectstart",function(l){xi(e,l)||y(l)}),me(r,"compositionstart",function(){var l=n.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:l,range:n.markText(l,n.getCursor("to"),{className:"CodeMirror-composing"})}}),me(r,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Sn.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Sn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Sn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,n=va(e);if(e.options.moveInputWithCursor){var r=pi(e,i.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+l.top-s.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+l.left-s.left))}return n},Sn.prototype.showSelection=function(e){var t=this.cm,i=t.display;A(i.cursorDiv,e.cursors),A(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Sn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&be(this.textarea),j&&ee>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",j&&ee>=9&&(this.hasSelection=null))},Sn.prototype.getField=function(){return this.textarea},Sn.prototype.supportsTouch=function(){return!1},Sn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!ce||G()!=this.textarea))try{this.textarea.focus()}catch(e){}},Sn.prototype.blur=function(){this.textarea.blur()},Sn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Sn.prototype.receivedFocus=function(){this.slowPoll()},Sn.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Sn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Sn.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ye(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=i.value;if(r==n&&!t.somethingSelected())return!1;if(j&&ee>=9&&this.hasSelection===r||ne&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=r.charCodeAt(0);if(s==8203&&!n&&(n="\u200B"),s==8666)return this.reset(),this.cm.execCommand("undo")}for(var l=0,p=Math.min(n.length,r.length);l<p&&n.charCodeAt(l)==r.charCodeAt(l);)++l;return oi(t,function(){Xo(t,r.slice(l),n.length-l,null,e.composing?"*compose":null),r.length>1e3||r.indexOf(`
|
|
`)>-1?i.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Sn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Sn.prototype.onKeyPress=function(){j&&ee>=9&&(this.hasSelection=null),this.fastPoll()},Sn.prototype.onContextMenu=function(e){var t=this,i=t.cm,n=i.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=Ui(i,e),l=n.scroller.scrollTop;if(!s||I)return;var p=i.options.resetSelectionOnContextMenu;p&&i.doc.sel.contains(s)==-1&&Nn(i,Gn)(i.doc,Ri(s),_e);var f=r.style.cssText,m=t.wrapper.style.cssText,T=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",r.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-T.top-5)+"px; left: "+(e.clientX-T.left-5)+`px;
|
|
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var M;W&&(M=window.scrollY),n.input.focus(),W&&window.scrollTo(null,M),n.input.reset(),i.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=Q,n.selForContextMenu=i.doc.sel,clearTimeout(n.detectingSelectAll);function re(){if(r.selectionStart!=null){var Fe=i.somethingSelected(),Xe="\u200B"+(Fe?r.value:"");r.value="\u21DA",r.value=Xe,t.prevInput=Fe?"":"\u200B",r.selectionStart=1,r.selectionEnd=Xe.length,n.selForContextMenu=i.doc.sel}}function Q(){if(t.contextMenuPending!=Q)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=m,r.style.cssText=f,j&&ee<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=l),r.selectionStart!=null){(!j||j&&ee<9)&&re();var Fe=0,Xe=function(){n.selForContextMenu==i.doc.sel&&r.selectionStart==0&&r.selectionEnd>0&&t.prevInput=="\u200B"?Nn(i,Ya)(i):Fe++<10?n.detectingSelectAll=setTimeout(Xe,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(Xe,200)}}if(j&&ee>=9&&re(),v){E(e);var xe=function(){ht(window,"mouseup",xe),setTimeout(Q,20)};me(window,"mouseup",xe)}else setTimeout(Q,50)},Sn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Sn.prototype.setUneditable=function(){},Sn.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?g(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 i=G();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function n(){e.value=p.getValue()}var r;if(e.form&&(me(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var s=e.form;r=s.submit;try{var l=s.submit=function(){n(),s.submit=r,s.submit(),s.submit=l}}catch(f){}}t.finishInit=function(f){f.save=n,f.getTextArea=function(){return e},f.toTextArea=function(){f.toTextArea=isNaN,n(),e.parentNode.removeChild(f.getWrapperElement()),e.style.display="",e.form&&(ht(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=r))}},e.style.display="none";var p=yn(function(f){return e.parentNode.insertBefore(f,e.nextSibling)},t);return p}function ru(e){e.off=ht,e.on=me,e.wheelEventPixels=hl,e.Doc=ei,e.splitLines=Ot,e.countColumn=q,e.findColumn=Oe,e.isWordChar=De,e.Pass=ot,e.signal=ye,e.Line=Di,e.changeEnd=Ti,e.scrollbarModel=Sa,e.Pos=Ae,e.cmpPos=tt,e.modes=Nt,e.mimeModes=vt,e.resolveMode=He,e.getMode=yt,e.modeExtensions=dt,e.extendMode=Ct,e.copyState=Yt,e.startState=ln,e.innerMode=Vt,e.commands=Nr,e.keyMap=_i,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ar,e.normalizeKeyMap=Ml,e.StringStream=Ht,e.SharedTextMarker=Pr,e.TextMarker=Oi,e.LineWidget=Or,e.e_preventDefault=y,e.e_stopPropagation=_,e.e_stop=E,e.addClass=he,e.contains=k,e.rmClass=X,e.keyNames=Pi}Yl(yn),Ql(yn);var ou="iter insert remove copy getEditor constructor".split(" ");for(var uo in ei.prototype)ei.prototype.hasOwnProperty(uo)&&we(ou,uo)<0&&(yn.prototype[uo]=function(e){return function(){return e.apply(this.doc,arguments)}}(ei.prototype[uo]));return P(ei),yn.inputStyles={textarea:Sn,contenteditable:hn},yn.defineMode=function(e){!yn.defaults.mode&&e!="null"&&(yn.defaults.mode=e),Gt.apply(this,arguments)},yn.defineMIME=Wt,yn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),yn.defineMIME("text/plain","null"),yn.defineExtension=function(e,t){yn.prototype[e]=t},yn.defineDocExtension=function(e,t){ei.prototype[e]=t},yn.fromTextArea=iu,ru(yn),yn.version="5.58.2",yn})},Y1PL:function(At,at,x){"use strict";x.r(at),x.d(at,"ResizableTextArea",function(){return we});var $=x("wx14"),Pe=x("1OyB"),oe=x("vuIU"),Ce=x("Ji7U"),ve=x("LK+K"),ge=x("q1tI"),j=x("VTBJ"),ee=x("rePB"),W=x("Zm9Q"),se=x("Kwbf"),L=x("c+Xe"),I=x("m+aA"),le=x("bdgK"),z=new Map;function V(_e){_e.forEach(function(je){var Se,Oe=je.target;(Se=z.get(Oe))===null||Se===void 0||Se.forEach(function(Z){return Z(Oe)})})}var J=new le.default(V),B=null,ce=null;function ne(_e,je){z.has(_e)||(z.set(_e,new Set),J.observe(_e)),z.get(_e).add(je)}function pe(_e,je){z.has(_e)&&(z.get(_e).delete(je),z.get(_e).size||(J.unobserve(_e),z.delete(_e)))}var Ne=function(_e){Object(Ce.a)(Se,_e);var je=Object(ve.a)(Se);function Se(){return Object(Pe.a)(this,Se),je.apply(this,arguments)}return Object(oe.a)(Se,[{key:"render",value:function(){return this.props.children}}]),Se}(ge.Component),ue=ge.createContext(null);function K(_e){var je=_e.children,Se=_e.onBatchResize,Oe=ge.useRef(0),Z=ge.useRef([]),w=ge.useContext(ue),Be=ge.useCallback(function(ut,wt,Je){Oe.current+=1;var qe=Oe.current;Z.current.push({size:ut,element:wt,data:Je}),Promise.resolve().then(function(){qe===Oe.current&&(Se==null||Se(Z.current),Z.current=[])}),w==null||w(ut,wt,Je)},[Se,w]);return ge.createElement(ue.Provider,{value:Be},je)}function v(_e){var je=_e.children,Se=_e.disabled,Oe=ge.useRef(null),Z=ge.useRef(null),w=ge.useContext(ue),Be=ge.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ut=ge.isValidElement(je)&&Object(L.c)(je),wt=ut?je.ref:null,Je=ge.useMemo(function(){return Object(L.a)(wt,Oe)},[wt,Oe]),qe=ge.useRef(_e);qe.current=_e;var fe=ge.useCallback(function(De){var We=qe.current,Ve=We.onResize,ze=We.data,Ue=De.getBoundingClientRect(),Le=Ue.width,Et=Ue.height,st=De.offsetWidth,nt=De.offsetHeight,ct=Math.floor(Le),St=Math.floor(Et);if(Be.current.width!==ct||Be.current.height!==St||Be.current.offsetWidth!==st||Be.current.offsetHeight!==nt){var _t={width:ct,height:St,offsetWidth:st,offsetHeight:nt};Be.current=_t;var pt=st===Math.round(Le)?Le:st,me=nt===Math.round(Et)?Et:nt,kt=Object(j.a)(Object(j.a)({},_t),{},{offsetWidth:pt,offsetHeight:me});w==null||w(kt,De,ze),Ve&&Promise.resolve().then(function(){Ve(kt,De)})}},[]);return ge.useEffect(function(){var De=Object(I.a)(Oe.current)||Object(I.a)(Z.current);return De&&!Se&&ne(De,fe),function(){return pe(De,fe)}},[Oe.current,Se]),ge.createElement(Ne,{ref:Z},ut?ge.cloneElement(je,{ref:Je}):je)}var ie="rc-observer-key";function X(_e){var je=_e.children,Se=Object(W.a)(je);return Se.map(function(Oe,Z){var w=(Oe==null?void 0:Oe.key)||"".concat(ie,"-").concat(Z);return ge.createElement(v,Object($.a)({},_e,{key:w}),Oe)})}X.Collection=K;var de=X,A=x("bT9E"),b=x("TSYQ"),U=x.n(b),D=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,k=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],G={},he;function Y(_e){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(je&&G[Se])return G[Se];var Oe=window.getComputedStyle(_e),Z=Oe.getPropertyValue("box-sizing")||Oe.getPropertyValue("-moz-box-sizing")||Oe.getPropertyValue("-webkit-box-sizing"),w=parseFloat(Oe.getPropertyValue("padding-bottom"))+parseFloat(Oe.getPropertyValue("padding-top")),Be=parseFloat(Oe.getPropertyValue("border-bottom-width"))+parseFloat(Oe.getPropertyValue("border-top-width")),ut=k.map(function(Je){return"".concat(Je,":").concat(Oe.getPropertyValue(Je))}).join(";"),wt={sizingStyle:ut,paddingSize:w,borderSize:Be,boxSizing:Z};return je&&Se&&(G[Se]=wt),wt}function be(_e){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;he||(he=document.createElement("textarea"),he.setAttribute("tab-index","-1"),he.setAttribute("aria-hidden","true"),document.body.appendChild(he)),_e.getAttribute("wrap")?he.setAttribute("wrap",_e.getAttribute("wrap")):he.removeAttribute("wrap");var Z=Y(_e,je),w=Z.paddingSize,Be=Z.borderSize,ut=Z.boxSizing,wt=Z.sizingStyle;he.setAttribute("style","".concat(wt,";").concat(D)),he.value=_e.value||_e.placeholder||"";var Je=Number.MIN_SAFE_INTEGER,qe=Number.MAX_SAFE_INTEGER,fe=he.scrollHeight,De;if(ut==="border-box"?fe+=Be:ut==="content-box"&&(fe-=w),Se!==null||Oe!==null){he.value=" ";var We=he.scrollHeight-w;Se!==null&&(Je=We*Se,ut==="border-box"&&(Je=Je+w+Be),fe=Math.max(Je,fe)),Oe!==null&&(qe=We*Oe,ut==="border-box"&&(qe=qe+w+Be),De=fe>qe?"":"hidden",fe=Math.min(qe,fe))}return{height:fe,minHeight:Je,maxHeight:qe,overflowY:De,resize:"none"}}var S=x("Gytx"),g=x.n(S),q;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(q||(q={}));var Te=function(_e){Object(Ce.a)(Se,_e);var je=Object(ve.a)(Se);function Se(Oe){var Z;return Object(Pe.a)(this,Se),Z=je.call(this,Oe),Z.nextFrameActionId=void 0,Z.resizeFrameId=void 0,Z.textArea=void 0,Z.saveTextArea=function(w){Z.textArea=w},Z.handleResize=function(w){var Be=Z.state.resizeStatus,ut=Z.props,wt=ut.autoSize,Je=ut.onResize;if(Be!==q.NONE)return;typeof Je=="function"&&Je(w),wt&&Z.resizeOnNextFrame()},Z.resizeOnNextFrame=function(){cancelAnimationFrame(Z.nextFrameActionId),Z.nextFrameActionId=requestAnimationFrame(Z.resizeTextarea)},Z.resizeTextarea=function(){var w=Z.props.autoSize;if(!w||!Z.textArea)return;var Be=w.minRows,ut=w.maxRows,wt=be(Z.textArea,!1,Be,ut);Z.setState({textareaStyles:wt,resizeStatus:q.RESIZING},function(){cancelAnimationFrame(Z.resizeFrameId),Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:q.RESIZED},function(){Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:q.NONE}),Z.fixFirefoxAutoScroll()})})})})},Z.renderTextArea=function(){var w=Z.props,Be=w.prefixCls,ut=Be===void 0?"rc-textarea":Be,wt=w.autoSize,Je=w.onResize,qe=w.className,fe=w.disabled,De=Z.state,We=De.textareaStyles,Ve=De.resizeStatus,ze=Object(A.a)(Z.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=U()(ut,qe,Object(ee.a)({},"".concat(ut,"-disabled"),fe));"value"in ze&&(ze.value=ze.value||"");var Le=Object(j.a)(Object(j.a)(Object(j.a)({},Z.props.style),We),Ve===q.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return ge.createElement(de,{onResize:Z.handleResize,disabled:!(wt||Je)},ge.createElement("textarea",Object($.a)({},ze,{className:Ue,style:Le,ref:Z.saveTextArea})))},Z.state={textareaStyles:{},resizeStatus:q.NONE},Z}return Object(oe.a)(Se,[{key:"componentDidUpdate",value:function(Z){(Z.value!==this.props.value||!g()(Z.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Z=this.textArea.selectionStart,w=this.textArea.selectionEnd;this.textArea.setSelectionRange(Z,w)}}catch(Be){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Se}(ge.Component),we=Te,$e=function(_e){Object(Ce.a)(Se,_e);var je=Object(ve.a)(Se);function Se(Oe){var Z;Object(Pe.a)(this,Se),Z=je.call(this,Oe),Z.resizableTextArea=void 0,Z.focus=function(){Z.resizableTextArea.textArea.focus()},Z.saveTextArea=function(Be){Z.resizableTextArea=Be},Z.handleChange=function(Be){var ut=Z.props.onChange;Z.setValue(Be.target.value,function(){Z.resizableTextArea.resizeTextarea()}),ut&&ut(Be)},Z.handleKeyDown=function(Be){var ut=Z.props,wt=ut.onPressEnter,Je=ut.onKeyDown;Be.keyCode===13&&wt&&wt(Be),Je&&Je(Be)};var w=typeof Oe.value=="undefined"||Oe.value===null?Oe.defaultValue:Oe.value;return Z.state={value:w},Z}return Object(oe.a)(Se,[{key:"setValue",value:function(Z,w){"value"in this.props||this.setState({value:Z},w)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return ge.createElement(we,Object($.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Z){return"value"in Z?{value:Z.value}:null}}]),Se}(ge.Component),ot=at.default=$e},ZW9T:function(At,at,x){"use strict";x.d(at,"a",function(){return Ne});var $=x("k1fw"),Pe=x("miYZ"),oe=x("tsqr"),Ce=x("rAM+"),ve=x("tJVT"),ge=x("PpiC"),j=x("q1tI"),ee=x.n(j),W=x("bdgK");function se(ue,K,v,ie,X){var de=K.getWordUntilPosition(v),A={startLineNumber:v.lineNumber,endLineNumber:v.lineNumber,startColumn:de.startColumn,endColumn:de.endColumn},b=ie.map(function(U){return{label:U,kind:ue.languages.CompletionItemKind.Keyword,insertText:U,insertTextRules:ue.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:A}});return X.map(function(U){b.push(Object($.a)(Object($.a)({},U),{},{range:A}))}),b}var L=function(ue){var K={label:"ifelse",kind:ue.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:ue.languages.CompletionItemInsertTextRule.InsertAsSnippet},v=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];ue.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(A,b){var U=se(ue,A,b,v,[K]);return{suggestions:U}}});var ie=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];ue.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(A,b){var U=[{label:"print",kind:ue.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:ue.languages.CompletionItemInsertTextRule.InsertAsSnippet}],D=se(ue,A,b,ie,U);return{suggestions:D}}});var X=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];ue.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(A,b){var U=[K,{label:"main",kind:ue.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:ue.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:ue.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:ue.languages.CompletionItemInsertTextRule.InsertAsSnippet}],D=se(ue,A,b,X,U);return{suggestions:D}}})},I="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",le=x("LvDl");function z(ue){return/^\d+$/.test(ue)?"".concat(ue,"px"):ue}function V(){}var J=!1,B={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function ce(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],K=ue;if(Array.isArray(ue)){for(var v=0;v<ue.length;v++){var ie=B[ue[v]];if(ie)return ie}return K[0]}return B[K]||K}var ne=null,pe=at.b=function(ue){var K=ue.width,v=K===void 0?"100%":K,ie=ue.height,X=ie===void 0?"100%":ie,de=ue.value,A=ue.language,b=A===void 0?"javascript":A,U=ue.style,D=U===void 0?{}:U,k=ue.options,G=k===void 0?{}:k,he=ue.overrideServices,Y=he===void 0?{}:he,be=ue.theme,S=be===void 0?"vs-dark":be,g=ue.onEditBlur,q=ue.onSave,Te=ue.autoHeight,we=Te===void 0?!1:Te,$e=ue.forbidCopy,ot=$e===void 0?!1:$e,_e=ue.onChange,je=_e===void 0?V:_e,Se=ue.editorDidMount,Oe=Se===void 0?V:Se,Z=ue.onFocus,w=Z===void 0?V:Z,Be=ue.filename,ut=Be===void 0?"educoder.txt":Be,wt=Object(ge.a)(ue,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Je=Object(j.useRef)(),qe=Object(j.useRef)({}),fe=Object(j.useRef)(),De=Object(j.useRef)(!1),We=Object(j.useRef)(),Ve=Object(j.useState)(!1),ze=Object(ve.a)(Ve,2),Ue=ze[0],Le=ze[1];function Et(){var C;return Je.current&&(C=new W.default(function(E){var te=Object(Ce.a)(E),F;try{for(te.s();!(F=te.n()).done;){var ae=F.value;(ae.target.offsetHeight>0||ae.target.offsetWidth>0)&&qe.current.instance.layout()}}catch(Ke){te.e(Ke)}finally{te.f()}}),C.observe(Je.current)),C}function st(){oe.b.warn(decodeURIComponent(I))}var nt=function(){var E=qe.current.instance;if(de!=null&&E&&Ue){var te=E.getModel();te&&de!==te.getValue()&&(J=!0,te.setValue(de),E.layout(),J=!1)}};Object(j.useEffect)(function(){fe.current&&clearTimeout(fe.current),fe.current=setTimeout(function(){nt()},500)},[de,Ue,qe.current]);function ct(){var C=qe.current.instance;if(C){var E=C.getSelection(),te=qe.current.pastePos||{},F=new ne.Range(te.startLineNumber||E.endLineNumber,te.startColumn||E.endColumn,te.endLineNumber||E.endLineNumber,te.endColumn||E.endColumn);setTimeout(function(){C.executeEdits("",[{range:F,text:""}])},300)}}function St(C){(window.navigator.platform.match("Mac")?C.metaKey:C.ctrlKey)&&C.keyCode==83&&(C.preventDefault(),q())}var _t=function(){if(we&&qe.current.instance){var E=qe.current.instance.getContentHeight();y(E<X?X:E)}else y(X)};function pt(C){var E=document.createEvent("MouseEvents");E.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),C.dispatchEvent(E)}function me(C,E){var te=window.URL||window.webkitURL||window,F=new Blob([E]),ae=document.createElementNS("http://www.w3.org/1999/xhtml","a");ae.href=te.createObjectURL(F),ae.download=C,pt(ae)}Object(j.useEffect)(function(){_t()},[_t]),Object(j.useEffect)(function(){Je.current&&!Ue&&x.e(27).then(x.t.bind(null,"M/lh",7)).then(function(C){try{ne=C,qe.current.instance=ne.editor.create(Je.current,{value:de,language:ce(b),theme:S,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Y);var E=qe.current.instance;if(Oe(E,ne),setTimeout(function(){_t(),qe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){me(ut||"educoder.txt",E.getValue())}})},500),qe.current.subscription=E.onDidChangeModelContent(function(F){De.current?clearTimeout(We.current):(_t(),je(E.getValue(),F)),We.current=setTimeout(function(){De.current=!1},500)}),window.Monaco||L(ne),ot&&(E.addCommand(ne.KeyMod.CtrlCmd|ne.KeyMod.Shift|ne.KeyCode.KEY_V,function(){return st(),null}),E.addCommand(ne.KeyMod.CtrlCmd|ne.KeyCode.KEY_C,function(){return st(),null})),window.Monaco=ne,g&&E.onDidBlurEditorWidget(function(){g(E.getValue())}),w&&E.onDidFocusEditorText(function(){w(E.getValue())}),ot){E.addCommand(ne.KeyMod.CtrlCmd|ne.KeyCode.KEY_V,function(){return st(),null}),E.onDidPaste(function(F){qe.current.pastePos=F});try{window.addEventListener("paste",ct)}catch(F){}}var te=Et();return Le(!0),function(){var F=qe.current.instance;F.dispose();var ae=F.getModel();ae&&ae.dispose(),qe.current.subscription&&qe.current.subscription.dispose(),ot&&window.removeEventListener("paste",ct),te.unobserve(Je.current)}}catch(F){}})},[]),Object(j.useEffect)(function(){var C=qe.current.instance;if(C&&Ue)return document.addEventListener("keydown",St,!1),function(){document.removeEventListener("keydown",St)}},[q,Ue]),Object(j.useEffect)(function(){var C=qe.current.instance;if(C&&Ue){var E=ce(b);ne.editor.setModelLanguage(C.getModel(),E),console.log("language:",b,C.getModel(),E)}},[b,Ue]),Object(j.useEffect)(function(){var C=qe.current.instance;C&&Ue&&ne.editor.setTheme(S)},[S,Ue]),Object(j.useEffect)(function(){var C=qe.current.instance;C&&Ue&&(C.updateOptions(Object($.a)({},G)),setTimeout(function(){C.getModel().updateOptions(Object($.a)({},G))},200))},[JSON.stringify(G),Ue]),Object(j.useEffect)(function(){var C=qe.current.instance;C&&Ue&&C.layout()},[v,X,Ue]);var kt=Object(j.useState)(z(v)),ht=Object(ve.a)(kt,2),ye=ht[0],Ee=ht[1],R=Object(j.useState)(z(X)),O=Object(ve.a)(R,2),P=O[0],y=O[1],_=Object($.a)(Object($.a)({},D),{},{width:ye,height:P});return ee.a.createElement("div",{className:"my-monaco-editor",ref:Je,style:_})};function Ne(ue){var K=ue.width,v=K===void 0?"100%":K,ie=ue.height,X=ie===void 0?"100%":ie,de=ue.original,A=ue.modified,b=ue.language,U=ue.options,D=U===void 0?{}:U,k=Object(j.useRef)(),G=Object(j.useState)(null),he=Object(ve.a)(G,2),Y=he[0],be=he[1];function S(we){var $e;return k.current&&($e=new W.default(function(ot){var _e=Object(Ce.a)(ot),je;try{for(_e.s();!(je=_e.n()).done;){var Se=je.value;(Se.target.offsetHeight>0||Se.target.offsetWidth>0)&&we.layout()}}catch(Oe){_e.e(Oe)}finally{_e.f()}}),$e.observe(k.current)),$e}Object(j.useEffect)(function(){k.current&&x.e(27).then(x.t.bind(null,"M/lh",7)).then(function(we){ne=we;var $e=ne.editor.createDiffEditor(k.current,Object($.a)(Object($.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},D),{},{wordWrap:!0}));be($e);var ot=S($e);return function(){$e.dispose();var _e=$e.getModel();_e&&_e.dispose(),ot.unobserve(k.current)}})},[]),Object(j.useEffect)(function(){Y&&Y.setModel({original:ne.editor.createModel(de,b),modified:ne.editor.createModel(A,b)})},[de,A,b,Y]);var g=z(v),q=z(X),Te={width:g,height:q};return ee.a.createElement("div",{className:"my-diff-editor",ref:k,style:Te})}},ZpRC:function(At,at,x){"use strict";function $(L){return typeof L=="object"&&L!=null&&L.nodeType===1}function Pe(L,I){return(!I||L!=="hidden")&&L!=="visible"&&L!=="clip"}function oe(L,I){if(L.clientHeight<L.scrollHeight||L.clientWidth<L.scrollWidth){var le=getComputedStyle(L,null);return Pe(le.overflowY,I)||Pe(le.overflowX,I)||function(z){var V=function(J){if(!J.ownerDocument||!J.ownerDocument.defaultView)return null;try{return J.ownerDocument.defaultView.frameElement}catch(B){return null}}(z);return!!V&&(V.clientHeight<z.scrollHeight||V.clientWidth<z.scrollWidth)}(L)}return!1}function Ce(L,I,le,z,V,J,B,ce){return J<L&&B>I||J>L&&B<I?0:J<=L&&ce<=le||B>=I&&ce>=le?J-L-z:B>I&&ce<le||J<L&&ce>le?B-I+V:0}var ve=function(L,I){var le=window,z=I.scrollMode,V=I.block,J=I.inline,B=I.boundary,ce=I.skipOverflowHiddenElements,ne=typeof B=="function"?B:function(We){return We!==B};if(!$(L))throw new TypeError("Invalid target");for(var pe=document.scrollingElement||document.documentElement,Ne=[],ue=L;$(ue)&&ne(ue);){if((ue=ue.parentElement)===pe){Ne.push(ue);break}ue!=null&&ue===document.body&&oe(ue)&&!oe(document.documentElement)||ue!=null&&oe(ue,ce)&&Ne.push(ue)}for(var K=le.visualViewport?le.visualViewport.width:innerWidth,v=le.visualViewport?le.visualViewport.height:innerHeight,ie=window.scrollX||pageXOffset,X=window.scrollY||pageYOffset,de=L.getBoundingClientRect(),A=de.height,b=de.width,U=de.top,D=de.right,k=de.bottom,G=de.left,he=V==="start"||V==="nearest"?U:V==="end"?k:U+A/2,Y=J==="center"?G+b/2:J==="end"?D:G,be=[],S=0;S<Ne.length;S++){var g=Ne[S],q=g.getBoundingClientRect(),Te=q.height,we=q.width,$e=q.top,ot=q.right,_e=q.bottom,je=q.left;if(z==="if-needed"&&U>=0&&G>=0&&k<=v&&D<=K&&U>=$e&&k<=_e&&G>=je&&D<=ot)return be;var Se=getComputedStyle(g),Oe=parseInt(Se.borderLeftWidth,10),Z=parseInt(Se.borderTopWidth,10),w=parseInt(Se.borderRightWidth,10),Be=parseInt(Se.borderBottomWidth,10),ut=0,wt=0,Je="offsetWidth"in g?g.offsetWidth-g.clientWidth-Oe-w:0,qe="offsetHeight"in g?g.offsetHeight-g.clientHeight-Z-Be:0;if(pe===g)ut=V==="start"?he:V==="end"?he-v:V==="nearest"?Ce(X,X+v,v,Z,Be,X+he,X+he+A,A):he-v/2,wt=J==="start"?Y:J==="center"?Y-K/2:J==="end"?Y-K:Ce(ie,ie+K,K,Oe,w,ie+Y,ie+Y+b,b),ut=Math.max(0,ut+X),wt=Math.max(0,wt+ie);else{ut=V==="start"?he-$e-Z:V==="end"?he-_e+Be+qe:V==="nearest"?Ce($e,_e,Te,Z,Be+qe,he,he+A,A):he-($e+Te/2)+qe/2,wt=J==="start"?Y-je-Oe:J==="center"?Y-(je+we/2)+Je/2:J==="end"?Y-ot+w+Je:Ce(je,ot,we,Oe,w+Je,Y,Y+b,b);var fe=g.scrollLeft,De=g.scrollTop;he+=De-(ut=Math.max(0,Math.min(De+ut,g.scrollHeight-Te+qe))),Y+=fe-(wt=Math.max(0,Math.min(fe+wt,g.scrollWidth-we+Je)))}be.push({el:g,top:ut,left:wt})}return be};function ge(L){return L===Object(L)&&Object.keys(L).length!==0}function j(L,I){I===void 0&&(I="auto");var le="scrollBehavior"in document.body.style;L.forEach(function(z){var V=z.el,J=z.top,B=z.left;V.scroll&&le?V.scroll({top:J,left:B,behavior:I}):(V.scrollTop=J,V.scrollLeft=B)})}function ee(L){return L===!1?{block:"end",inline:"nearest"}:ge(L)?L:{block:"start",inline:"nearest"}}function W(L,I){var le=!L.ownerDocument.documentElement.contains(L);if(ge(I)&&typeof I.behavior=="function")return I.behavior(le?[]:ve(L,I));if(le)return;var z=ee(I);return j(ve(L,z),z.behavior)}var se=at.a=W},bT9E:function(At,at,x){"use strict";x.d(at,"a",function(){return Pe});var $=x("VTBJ");function Pe(oe,Ce){var ve=Object($.a)({},oe);return Array.isArray(Ce)&&Ce.forEach(function(ge){delete ve[ge]}),ve}},c5Ni:function(At,at,x){},dejd:function(At,at,x){},dmUQ:function(At,at,x){"use strict";var $=x("Ff2n"),Pe=x("rePB"),oe=x("1OyB"),Ce=x("vuIU"),ve=x("Ji7U"),ge=x("md7G"),j=x("foSv"),ee=x("q1tI"),W=x.n(ee),se=x("TSYQ"),L=x.n(se),I=x("4IlW");function le(A,b){var U=Object.keys(A);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(A);b&&(D=D.filter(function(k){return Object.getOwnPropertyDescriptor(A,k).enumerable})),U.push.apply(U,D)}return U}function z(A){for(var b=1;b<arguments.length;b++){var U=arguments[b]!=null?arguments[b]:{};b%2?le(Object(U),!0).forEach(function(D){Object(Pe.a)(A,D,U[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(U)):le(Object(U)).forEach(function(D){Object.defineProperty(A,D,Object.getOwnPropertyDescriptor(U,D))})}return A}function V(A){var b=J();return function(){var D=Object(j.a)(A),k;if(b){var G=Object(j.a)(this).constructor;k=Reflect.construct(D,arguments,G)}else k=D.apply(this,arguments);return Object(ge.a)(this,k)}}function J(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(A){return!1}}function B(){}function ce(A){A.preventDefault()}var ne=function(b){return b.replace(/[^\w.-]+/g,"")},pe=200,Ne=600,ue=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,K=function(b){return b!=null},v=function(b,U){return U===b||typeof U=="number"&&typeof b=="number"&&isNaN(U)&&isNaN(b)},ie=function(A){Object(ve.a)(U,A);var b=V(U);function U(D){var k;Object(oe.a)(this,U),k=b.call(this,D),k.onKeyDown=function(Y){var be=k.props,S=be.onKeyDown,g=be.onPressEnter;if(Y.keyCode===I.a.UP){var q=k.getRatio(Y);k.up(Y,q,null),k.stop()}else if(Y.keyCode===I.a.DOWN){var Te=k.getRatio(Y);k.down(Y,Te,null),k.stop()}else Y.keyCode===I.a.ENTER&&g&&g(Y);if(k.recordCursorPosition(),k.lastKeyCode=Y.keyCode,S){for(var we=arguments.length,$e=new Array(we>1?we-1:0),ot=1;ot<we;ot++)$e[ot-1]=arguments[ot];S.apply(void 0,[Y].concat($e))}},k.onKeyUp=function(Y){var be=k.props.onKeyUp;if(k.stop(),k.recordCursorPosition(),be){for(var S=arguments.length,g=new Array(S>1?S-1:0),q=1;q<S;q++)g[q-1]=arguments[q];be.apply(void 0,[Y].concat(g))}},k.onChange=function(Y){var be=k.props.onChange;k.state.focused&&(k.inputting=!0),k.rawInput=k.props.parser(k.getValueFromEvent(Y)),k.setState({inputValue:k.rawInput}),be(k.toNumber(k.rawInput))},k.onMouseUp=function(){var Y=k.props.onMouseUp;k.recordCursorPosition(),Y&&Y.apply(void 0,arguments)},k.onFocus=function(){var Y;k.setState({focused:!0}),(Y=k.props).onFocus.apply(Y,arguments)},k.onBlur=function(){var Y=k.props.onBlur;k.inputting=!1,k.setState({focused:!1});var be=k.getCurrentValidValue(k.state.inputValue),S=k.setValue(be,B);if(Y){var g=k.input.value,q=k.getInputDisplayValue({focus:!1,value:S});k.input.value=q&&Number(q),Y.apply(void 0,arguments),k.input.value=g}},k.getRatio=function(Y){var be=1;return Y.metaKey||Y.ctrlKey?be=.1:Y.shiftKey&&(be=10),be},k.getFullNum=function(Y){return isNaN(Y)?Y:/e/i.test(String(Y))?Number(Y).toFixed(18).replace(/\.?0+$/,""):Y},k.getPrecision=function(Y){if(K(k.props.precision))return k.props.precision;var be=String(Y);if(be.indexOf("e-")>=0)return parseInt(be.slice(be.indexOf("e-")+2),10);var S=0;return be.indexOf(".")>=0&&(S=be.length-be.indexOf(".")-1),S},k.getInputDisplayValue=function(Y){var be=Y||k.state,S=be.focused,g=be.inputValue,q=be.value,Te;S?Te=g:Te=k.toPrecisionAsStep(q),Te==null&&(Te="");var we=k.formatWrapper(Te);return K(k.props.decimalSeparator)&&(we=we.toString().replace(".",k.props.decimalSeparator)),we},k.recordCursorPosition=function(){try{k.cursorStart=k.input.selectionStart,k.cursorEnd=k.input.selectionEnd,k.currentValue=k.input.value,k.cursorBefore=k.input.value.substring(0,k.cursorStart),k.cursorAfter=k.input.value.substring(k.cursorEnd)}catch(Y){}},k.restoreByAfter=function(Y){if(Y===void 0)return!1;var be=k.input.value,S=be.lastIndexOf(Y);if(S===-1)return!1;var g=k.cursorBefore.length;return k.lastKeyCode===I.a.DELETE&&k.cursorBefore.charAt(g-1)===Y[0]?(k.fixCaret(g,g),!0):S+Y.length===be.length?(k.fixCaret(S,S),!0):!1},k.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(be,S){var g=Y.substring(S);return k.restoreByAfter(g)})},k.isNotCompleteNumber=function(Y){return isNaN(Y)||Y===""||Y===null||Y&&Y.toString().indexOf(".")===Y.toString().length-1},k.stop=function(){k.autoStepTimer&&clearTimeout(k.autoStepTimer)},k.down=function(Y,be,S){k.pressingUpOrDown=!0,k.step("down",Y,be,S)},k.up=function(Y,be,S){k.pressingUpOrDown=!0,k.step("up",Y,be,S)},k.saveInput=function(Y){k.input=Y};var G=D.value;G===void 0&&(G=D.defaultValue),k.state={focused:D.autoFocus};var he=k.getValidValue(k.toNumber(G));return k.state=z(z({},k.state),{},{inputValue:k.toPrecisionAsStep(he),value:he}),k}return Object(Ce.a)(U,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(k){var G=this.props,he=G.value,Y=G.onChange,be=G.max,S=G.min,g=this.state.focused;if(k){if(!v(k.value,he)||!v(k.max,be)||!v(k.min,S)){var q=g?he:this.getValidValue(he),Te;this.pressingUpOrDown?Te=q:this.inputting?Te=this.rawInput:Te=this.toPrecisionAsStep(q),this.setState({value:q,inputValue:Te})}var we="value"in this.props?he:this.state.value;"max"in this.props&&k.max!==be&&typeof we=="number"&&we>be&&Y&&Y(be),"min"in this.props&&k.min!==S&&typeof we=="number"&&we<S&&Y&&Y(S)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var $e=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===I.a.BACKSPACE?$e=this.cursorStart-1:this.lastKeyCode===I.a.DELETE&&($e=this.cursorStart):$e=this.input.value.length,this.fixCaret($e,$e)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case I.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case I.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ot){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(k){var G=k;return G===""?G="":this.isNotCompleteNumber(parseFloat(G))?G=this.state.value:G=this.getValidValue(G),this.toNumber(G)}},{key:"getValueFromEvent",value:function(k){var G=k.target.value.trim().replace(/。/g,".");return K(this.props.decimalSeparator)&&(G=G.replace(this.props.decimalSeparator,".")),G}},{key:"getValidValue",value:function(k){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(k);return isNaN(Y)?k:(Y<G&&(Y=G),Y>he&&(Y=he),Y)}},{key:"setValue",value:function(k,G){var he=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(k))?null:parseFloat(k),be=this.state.value,S=be===void 0?null:be,g=this.state.inputValue,q=g===void 0?null:g,Te=typeof Y=="number"?Y.toFixed(he):"".concat(Y),we=Y!==S||Te!=="".concat(q);return"value"in this.props?(q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:q},G)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(k)},G),we&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(k){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=this.props,Y=he.precision,be=he.step;if(K(Y))return Y;var S=this.getPrecision(G),g=this.getPrecision(be),q=this.getPrecision(k);return k?Math.max(q,S+g):S+g}},{key:"getPrecisionFactor",value:function(k){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=this.getMaxPrecision(k,G);return Math.pow(10,he)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(k){return this.props.formatter?this.props.formatter(k):k}},{key:"toPrecisionAsStep",value:function(k){if(this.isNotCompleteNumber(k)||k==="")return k;var G=Math.abs(this.getMaxPrecision(k));return isNaN(G)?k.toString():Number(k).toFixed(G)}},{key:"toNumber",value:function(k){var G=this.props.precision,he=this.state.focused,Y=k&&k.length>16&&he;return this.isNotCompleteNumber(k)||Y?k:K(G)?Math.round(k*Math.pow(10,G))/Math.pow(10,G):Number(k)}},{key:"upStep",value:function(k,G){var he=this.props.step,Y=this.getPrecisionFactor(k,G),be=Math.abs(this.getMaxPrecision(k,G)),S=((Y*k+Y*he*G)/Y).toFixed(be);return this.toNumber(S)}},{key:"downStep",value:function(k,G){var he=this.props.step,Y=this.getPrecisionFactor(k,G),be=Math.abs(this.getMaxPrecision(k,G)),S=((Y*k-Y*he*G)/Y).toFixed(be);return this.toNumber(S)}},{key:"step",value:function(k,G){var he=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,be=arguments.length>3?arguments[3]:void 0;this.stop(),G&&(G.persist(),G.preventDefault());var S=this.props;if(S.disabled)return;var g=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(g))return;var q=this["".concat(k,"Step")](g,Y),Te=q>S.max||q<S.min;if(q>S.max?q=S.max:q<S.min&&(q=S.min),this.setValue(q,null),this.setState({focused:!0},function(){he.pressingUpOrDown=!1}),Te)return;this.autoStepTimer=setTimeout(function(){he[k](G,Y,!0)},be?pe:Ne)}},{key:"fixCaret",value:function(k,G){if(k===void 0||G===void 0||!this.input||!this.input.value)return;try{var he=this.input.selectionStart,Y=this.input.selectionEnd;(k!==he||G!==Y)&&this.input.setSelectionRange(k,G)}catch(be){}}},{key:"render",value:function(){var k,G=this.props,he=G.prefixCls,Y=G.disabled,be=G.readOnly,S=G.useTouch,g=G.autoComplete,q=G.upHandler,Te=G.downHandler,we=G.className,$e=G.max,ot=G.min,_e=G.style,je=G.title,Se=G.onMouseEnter,Oe=G.onMouseLeave,Z=G.onMouseOver,w=G.onMouseOut,Be=G.required,ut=G.onClick,wt=G.tabIndex,Je=G.type,qe=G.placeholder,fe=G.id,De=G.inputMode,We=G.pattern,Ve=G.step,ze=G.maxLength,Ue=G.autoFocus,Le=G.name,Et=G.onPaste,st=G.onInput,nt=Object($.a)(G,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),ct=this.state,St=ct.value,_t=ct.focused,pt=L()(he,(k={},Object(Pe.a)(k,we,!!we),Object(Pe.a)(k,"".concat(he,"-disabled"),Y),Object(Pe.a)(k,"".concat(he,"-focused"),_t),k)),me={};Object.keys(nt).forEach(function(E){(E.substr(0,5)==="data-"||E.substr(0,5)==="aria-"||E==="role")&&(me[E]=nt[E])});var kt=!be&&!Y,ht=this.getInputDisplayValue(null),ye=(St||St===0)&&(isNaN(St)||Number(St)>=$e),Ee=(St||St===0)&&(isNaN(St)||Number(St)<=ot),R=ye||Y||be,O=Ee||Y||be,P=L()("".concat(he,"-handler"),"".concat(he,"-handler-up"),Object(Pe.a)({},"".concat(he,"-handler-up-disabled"),R)),y=L()("".concat(he,"-handler"),"".concat(he,"-handler-down"),Object(Pe.a)({},"".concat(he,"-handler-down-disabled"),O)),_=S?{onTouchStart:R?B:this.up,onTouchEnd:this.stop}:{onMouseDown:R?B:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},C=S?{onTouchStart:O?B:this.down,onTouchEnd:this.stop}:{onMouseDown:O?B:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return W.a.createElement("div",{className:pt,style:_e,title:je,onMouseEnter:Se,onMouseLeave:Oe,onMouseOver:Z,onMouseOut:w,onFocus:function(){return null},onBlur:function(){return null}},W.a.createElement("div",{className:"".concat(he,"-handler-wrap")},W.a.createElement("span",Object.assign({unselectable:"on"},_,{role:"button","aria-label":"Increase Value","aria-disabled":R,className:P}),q||W.a.createElement("span",{unselectable:"on",className:"".concat(he,"-handler-up-inner"),onClick:ce})),W.a.createElement("span",Object.assign({unselectable:"on"},C,{role:"button","aria-label":"Decrease Value","aria-disabled":O,className:y}),Te||W.a.createElement("span",{unselectable:"on",className:"".concat(he,"-handler-down-inner"),onClick:ce}))),W.a.createElement("div",{className:"".concat(he,"-input-wrap")},W.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ot,"aria-valuemax":$e,"aria-valuenow":St,required:Be,type:Je,placeholder:qe,onPaste:Et,onClick:ut,onMouseUp:this.onMouseUp,className:"".concat(he,"-input"),tabIndex:wt,autoComplete:g,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:kt?this.onKeyDown:B,onKeyUp:kt?this.onKeyUp:B,autoFocus:Ue,maxLength:ze,readOnly:be,disabled:Y,max:$e,min:ot,step:Ve,name:Le,title:je,id:fe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ht),pattern:We,inputMode:De,onInput:st},me))))}}]),U}(W.a.Component);ie.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:ue,min:-ue,step:1,style:{},onChange:B,onKeyDown:B,onPressEnter:B,onFocus:B,onBlur:B,parser:ne,required:!1,autoComplete:"off"};var X=ie,de=at.a=X},kSUc:function(At,at,x){},kqOp:function(At,at,x){"use strict";x.d(at,"a",function(){return se});var $=x("0Owb"),Pe=x("fWQN"),oe=x("mtLc"),Ce=x("yKVA"),ve=x("879j"),ge=x("q1tI"),j=x.n(ge),ee=x("Ot1p"),W="\u2581",se=function(L){Object(Ce.a)(le,L);var I=Object(ve.a)(le);function le(){var z;Object(Pe.a)(this,le);for(var V=arguments.length,J=new Array(V),B=0;B<V;B++)J[B]=arguments[B];return z=I.call.apply(I,[this].concat(J)),z.getChCountBeforeCursor=function(ce,ne){for(var pe=ne.line,Ne=0,ue=0;ue<pe;ue++)Ne+=ce.getLine(ue).split(W).length-1;var K=ce.getLine(pe).substring(0,ne.ch);return Ne+=K.split(W).length-1,Ne},z.onCMBeforeChange=function(ce,ne){var pe=ce.getRange(ne.from,ne.to),Ne=0;if(ne.text.forEach(function(ie){Ne+=ie.split(W).length-1}),pe&&pe.indexOf(W)!=-1){var ue=pe.split(W).length-1,K=z.getChCountBeforeCursor(ce,ne.from);console.log("\u5220\u9664".concat(ue,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(K,"\u4E2A\uFF0C\u65B0\u589E").concat(Ne,"\u4E2A")),z.props.deleteEmptyDisabled?ne.cancel():z.props.onPlaceholderChange&&z.props.onPlaceholderChange(K,ue,Ne)}else if(Ne){var v=z.getChCountBeforeCursor(ce,ne.from);console.log("\u65B0\u589E".concat(Ne,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(v,"\u4E2A")),z.props.onPlaceholderChange&&z.props.onPlaceholderChange(v,0,Ne)}},z}return Object(oe.a)(le,[{key:"render",value:function(){return j.a.createElement(ee.a,Object($.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),le}(ge.Component)},lZu9:function(At,at,x){(function($){$(x("VrN/"),x("1eCo"),x("8EBN"))})(function($){"use strict";$.defineMode("markdown",function(Pe,oe){var Ce=$.getMode(Pe,"text/html"),ve=Ce.name=="null";function ge(S){if($.findModeByName){var g=$.findModeByName(S);g&&(S=g.mime||g.mimes[0])}var q=$.getMode(Pe,S);return q.name=="null"?null:q}oe.highlightFormatting===void 0&&(oe.highlightFormatting=!1),oe.maxBlockquoteDepth===void 0&&(oe.maxBlockquoteDepth=0),oe.taskLists===void 0&&(oe.taskLists=!1),oe.strikethrough===void 0&&(oe.strikethrough=!1),oe.emoji===void 0&&(oe.emoji=!1),oe.fencedCodeBlockHighlighting===void 0&&(oe.fencedCodeBlockHighlighting=!0),oe.fencedCodeBlockDefaultMode===void 0&&(oe.fencedCodeBlockDefaultMode="text/plain"),oe.xml===void 0&&(oe.xml=!0),oe.tokenTypeOverrides===void 0&&(oe.tokenTypeOverrides={});var j={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var ee in j)j.hasOwnProperty(ee)&&oe.tokenTypeOverrides[ee]&&(j[ee]=oe.tokenTypeOverrides[ee]);var W=/^([*\-_])(?:\s*\1){2,}\s*$/,se=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,L=/^\[(x| )\](?=\s)/i,I=oe.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,le=/^ {0,3}(?:\={1,}|-{2,})\s*$/,z=/^[^#!\[\]*_\\<>` "'(~:]+/,V=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,J=/^\s*\[[^\]]+?\]:.*$/,B=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,ce=" ";function ne(S,g,q){return g.f=g.inline=q,q(S,g)}function pe(S,g,q){return g.f=g.block=q,q(S,g)}function Ne(S){return!S||!/\S/.test(S.string)}function ue(S){if(S.linkTitle=!1,S.linkHref=!1,S.linkText=!1,S.em=!1,S.strong=!1,S.strikethrough=!1,S.quote=0,S.indentedCode=!1,S.f==v){var g=ve;if(!g){var q=$.innerMode(Ce,S.htmlState);g=q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText}g&&(S.f=A,S.block=K,S.htmlState=null)}return S.trailingSpace=0,S.trailingSpaceNewLine=!1,S.prevLine=S.thisLine,S.thisLine={stream:null},null}function K(S,g){var q=S.column()===g.indentation,Te=Ne(g.prevLine.stream),we=g.indentedCode,$e=g.prevLine.hr,ot=g.list!==!1,_e=(g.listStack[g.listStack.length-1]||0)+3;g.indentedCode=!1;var je=g.indentation;if(g.indentationDiff===null&&(g.indentationDiff=g.indentation,ot)){for(g.list=null;je<g.listStack[g.listStack.length-1];)g.listStack.pop(),g.listStack.length?g.indentation=g.listStack[g.listStack.length-1]:g.list=!1;g.list!==!1&&(g.indentationDiff=je-g.listStack[g.listStack.length-1])}var Se=!Te&&!$e&&!g.prevLine.header&&(!ot||!we)&&!g.prevLine.fencedCodeEnd,Oe=(g.list===!1||$e||Te)&&g.indentation<=_e&&S.match(W),Z=null;if(g.indentationDiff>=4&&(we||g.prevLine.fencedCodeEnd||g.prevLine.header||Te))return S.skipToEnd(),g.indentedCode=!0,j.code;if(S.eatSpace())return null;if(q&&g.indentation<=_e&&(Z=S.match(I))&&Z[1].length<=6)return g.quote=0,g.header=Z[1].length,g.thisLine.header=!0,oe.highlightFormatting&&(g.formatting="header"),g.f=g.inline,X(g);if(g.indentation<=_e&&S.eat(">"))return g.quote=q?1:g.quote+1,oe.highlightFormatting&&(g.formatting="quote"),S.eatSpace(),X(g);if(!Oe&&!g.setext&&q&&g.indentation<=_e&&(Z=S.match(se))){var w=Z[1]?"ol":"ul";return g.indentation=je+S.current().length,g.list=!0,g.quote=0,g.listStack.push(g.indentation),g.em=!1,g.strong=!1,g.code=!1,g.strikethrough=!1,oe.taskLists&&S.match(L,!1)&&(g.taskList=!0),g.f=g.inline,oe.highlightFormatting&&(g.formatting=["list","list-"+w]),X(g)}else{if(q&&g.indentation<=_e&&(Z=S.match(V,!0)))return g.quote=0,g.fencedEndRE=new RegExp(Z[1]+"+ *$"),g.localMode=oe.fencedCodeBlockHighlighting&&ge(Z[2]||oe.fencedCodeBlockDefaultMode),g.localMode&&(g.localState=$.startState(g.localMode)),g.f=g.block=ie,oe.highlightFormatting&&(g.formatting="code-block"),g.code=-1,X(g);if(g.setext||(!Se||!ot)&&!g.quote&&g.list===!1&&!g.code&&!Oe&&!J.test(S.string)&&(Z=S.lookAhead(1))&&(Z=Z.match(le)))return g.setext?(g.header=g.setext,g.setext=0,S.skipToEnd(),oe.highlightFormatting&&(g.formatting="header")):(g.header=Z[0].charAt(0)=="="?1:2,g.setext=g.header),g.thisLine.header=!0,g.f=g.inline,X(g);if(Oe)return S.skipToEnd(),g.hr=!0,g.thisLine.hr=!0,j.hr;if(S.peek()==="[")return ne(S,g,G)}return ne(S,g,g.inline)}function v(S,g){var q=Ce.token(S,g.htmlState);if(!ve){var Te=$.innerMode(Ce,g.htmlState);(Te.mode.name=="xml"&&Te.state.tagStart===null&&!Te.state.context&&Te.state.tokenize.isInText||g.md_inside&&S.current().indexOf(">")>-1)&&(g.f=A,g.block=K,g.htmlState=null)}return q}function ie(S,g){var q=g.listStack[g.listStack.length-1]||0,Te=g.indentation<q,we=q+3;if(g.fencedEndRE&&g.indentation<=we&&(Te||S.match(g.fencedEndRE))){oe.highlightFormatting&&(g.formatting="code-block");var $e;return Te||($e=X(g)),g.localMode=g.localState=null,g.block=K,g.f=A,g.fencedEndRE=null,g.code=0,g.thisLine.fencedCodeEnd=!0,Te?pe(S,g,g.block):$e}else return g.localMode?g.localMode.token(S,g.localState):(S.skipToEnd(),j.code)}function X(S){var g=[];if(S.formatting){g.push(j.formatting),typeof S.formatting=="string"&&(S.formatting=[S.formatting]);for(var q=0;q<S.formatting.length;q++)g.push(j.formatting+"-"+S.formatting[q]),S.formatting[q]==="header"&&g.push(j.formatting+"-"+S.formatting[q]+"-"+S.header),S.formatting[q]==="quote"&&(!oe.maxBlockquoteDepth||oe.maxBlockquoteDepth>=S.quote?g.push(j.formatting+"-"+S.formatting[q]+"-"+S.quote):g.push("error"))}if(S.taskOpen)return g.push("meta"),g.length?g.join(" "):null;if(S.taskClosed)return g.push("property"),g.length?g.join(" "):null;if(S.linkHref?g.push(j.linkHref,"url"):(S.strong&&g.push(j.strong),S.em&&g.push(j.em),S.strikethrough&&g.push(j.strikethrough),S.emoji&&g.push(j.emoji),S.linkText&&g.push(j.linkText),S.code&&g.push(j.code),S.image&&g.push(j.image),S.imageAltText&&g.push(j.imageAltText,"link"),S.imageMarker&&g.push(j.imageMarker)),S.header&&g.push(j.header,j.header+"-"+S.header),S.quote&&(g.push(j.quote),!oe.maxBlockquoteDepth||oe.maxBlockquoteDepth>=S.quote?g.push(j.quote+"-"+S.quote):g.push(j.quote+"-"+oe.maxBlockquoteDepth)),S.list!==!1){var Te=(S.listStack.length-1)%3;Te?Te===1?g.push(j.list2):g.push(j.list3):g.push(j.list1)}return S.trailingSpaceNewLine?g.push("trailing-space-new-line"):S.trailingSpace&&g.push("trailing-space-"+(S.trailingSpace%2?"a":"b")),g.length?g.join(" "):null}function de(S,g){return S.match(z,!0)?X(g):void 0}function A(S,g){var q=g.text(S,g);if(typeof q!="undefined")return q;if(g.list)return g.list=null,X(g);if(g.taskList){var Te=S.match(L,!0)[1]===" ";return Te?g.taskOpen=!0:g.taskClosed=!0,oe.highlightFormatting&&(g.formatting="task"),g.taskList=!1,X(g)}if(g.taskOpen=!1,g.taskClosed=!1,g.header&&S.match(/^#+$/,!0))return oe.highlightFormatting&&(g.formatting="header"),X(g);var we=S.next();if(g.linkTitle){g.linkTitle=!1;var $e=we;we==="("&&($e=")"),$e=($e+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ot="^\\s*(?:[^"+$e+"\\\\]+|\\\\\\\\|\\\\.)"+$e;if(S.match(new RegExp(ot),!0))return j.linkHref}if(we==="`"){var _e=g.formatting;oe.highlightFormatting&&(g.formatting="code"),S.eatWhile("`");var je=S.current().length;if(g.code==0&&(!g.quote||je==1))return g.code=je,X(g);if(je==g.code){var Se=X(g);return g.code=0,Se}else return g.formatting=_e,X(g)}else if(g.code)return X(g);if(we==="\\"&&(S.next(),oe.highlightFormatting)){var Oe=X(g),Z=j.formatting+"-escape";return Oe?Oe+" "+Z:Z}if(we==="!"&&S.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return g.imageMarker=!0,g.image=!0,oe.highlightFormatting&&(g.formatting="image"),X(g);if(we==="["&&g.imageMarker&&S.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return g.imageMarker=!1,g.imageAltText=!0,oe.highlightFormatting&&(g.formatting="image"),X(g);if(we==="]"&&g.imageAltText){oe.highlightFormatting&&(g.formatting="image");var Oe=X(g);return g.imageAltText=!1,g.image=!1,g.inline=g.f=U,Oe}if(we==="["&&!g.image)return g.linkText&&S.match(/^.*?\]/)||(g.linkText=!0,oe.highlightFormatting&&(g.formatting="link")),X(g);if(we==="]"&&g.linkText){oe.highlightFormatting&&(g.formatting="link");var Oe=X(g);return g.linkText=!1,g.inline=g.f=S.match(/\(.*?\)| ?\[.*?\]/,!1)?U:A,Oe}if(we==="<"&&S.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=b,oe.highlightFormatting&&(g.formatting="link");var Oe=X(g);return Oe?Oe+=" ":Oe="",Oe+j.linkInline}if(we==="<"&&S.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=b,oe.highlightFormatting&&(g.formatting="link");var Oe=X(g);return Oe?Oe+=" ":Oe="",Oe+j.linkEmail}if(oe.xml&&we==="<"&&S.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var w=S.string.indexOf(">",S.pos);if(w!=-1){var Be=S.string.substring(S.start,w);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Be)&&(g.md_inside=!0)}return S.backUp(1),g.htmlState=$.startState(Ce),pe(S,g,v)}if(oe.xml&&we==="<"&&S.match(/^\/\w*?>/))return g.md_inside=!1,"tag";if(we==="*"||we==="_"){for(var ut=1,wt=S.pos==1?" ":S.string.charAt(S.pos-2);ut<3&&S.eat(we);)ut++;var Je=S.peek()||" ",qe=!/\s/.test(Je)&&(!B.test(Je)||/\s/.test(wt)||B.test(wt)),fe=!/\s/.test(wt)&&(!B.test(wt)||/\s/.test(Je)||B.test(Je)),De=null,We=null;if(ut%2&&(!g.em&&qe&&(we==="*"||!fe||B.test(wt))?De=!0:g.em==we&&fe&&(we==="*"||!qe||B.test(Je))&&(De=!1)),ut>1&&(!g.strong&&qe&&(we==="*"||!fe||B.test(wt))?We=!0:g.strong==we&&fe&&(we==="*"||!qe||B.test(Je))&&(We=!1)),We!=null||De!=null){oe.highlightFormatting&&(g.formatting=De==null?"strong":We==null?"em":"strong em"),De===!0&&(g.em=we),We===!0&&(g.strong=we);var Se=X(g);return De===!1&&(g.em=!1),We===!1&&(g.strong=!1),Se}}else if(we===" "&&(S.eat("*")||S.eat("_"))){if(S.peek()===" ")return X(g);S.backUp(1)}if(oe.strikethrough){if(we==="~"&&S.eatWhile(we)){if(g.strikethrough){oe.highlightFormatting&&(g.formatting="strikethrough");var Se=X(g);return g.strikethrough=!1,Se}else if(S.match(/^[^\s]/,!1))return g.strikethrough=!0,oe.highlightFormatting&&(g.formatting="strikethrough"),X(g)}else if(we===" "&&S.match(/^~~/,!0)){if(S.peek()===" ")return X(g);S.backUp(2)}}if(oe.emoji&&we===":"&&S.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){g.emoji=!0,oe.highlightFormatting&&(g.formatting="emoji");var Ve=X(g);return g.emoji=!1,Ve}return we===" "&&(S.match(/^ +$/,!1)?g.trailingSpace++:g.trailingSpace&&(g.trailingSpaceNewLine=!0)),X(g)}function b(S,g){var q=S.next();if(q===">"){g.f=g.inline=A,oe.highlightFormatting&&(g.formatting="link");var Te=X(g);return Te?Te+=" ":Te="",Te+j.linkInline}return S.match(/^[^>]+/,!0),j.linkInline}function U(S,g){if(S.eatSpace())return null;var q=S.next();return q==="("||q==="["?(g.f=g.inline=k(q==="("?")":"]"),oe.highlightFormatting&&(g.formatting="link-string"),g.linkHref=!0,X(g)):"error"}var D={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function k(S){return function(g,q){var Te=g.next();if(Te===S){q.f=q.inline=A,oe.highlightFormatting&&(q.formatting="link-string");var we=X(q);return q.linkHref=!1,we}return g.match(D[S]),q.linkHref=!0,X(q)}}function G(S,g){return S.match(/^([^\]\\]|\\.)*\]:/,!1)?(g.f=he,S.next(),oe.highlightFormatting&&(g.formatting="link"),g.linkText=!0,X(g)):ne(S,g,A)}function he(S,g){if(S.match(/^\]:/,!0)){g.f=g.inline=Y,oe.highlightFormatting&&(g.formatting="link");var q=X(g);return g.linkText=!1,q}return S.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function Y(S,g){return S.eatSpace()?null:(S.match(/^[^\s]+/,!0),S.peek()===void 0?g.linkTitle=!0:S.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),g.f=g.inline=A,j.linkHref+" url")}var be={startState:function(){return{f:K,prevLine:{stream:null},thisLine:{stream:null},block:K,htmlState:null,indentation:0,inline:A,text:de,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(S){return{f:S.f,prevLine:S.prevLine,thisLine:S.thisLine,block:S.block,htmlState:S.htmlState&&$.copyState(Ce,S.htmlState),indentation:S.indentation,localMode:S.localMode,localState:S.localMode?$.copyState(S.localMode,S.localState):null,inline:S.inline,text:S.text,formatting:!1,linkText:S.linkText,linkTitle:S.linkTitle,linkHref:S.linkHref,code:S.code,em:S.em,strong:S.strong,strikethrough:S.strikethrough,emoji:S.emoji,header:S.header,setext:S.setext,hr:S.hr,taskList:S.taskList,list:S.list,listStack:S.listStack.slice(0),quote:S.quote,indentedCode:S.indentedCode,trailingSpace:S.trailingSpace,trailingSpaceNewLine:S.trailingSpaceNewLine,md_inside:S.md_inside,fencedEndRE:S.fencedEndRE}},token:function(S,g){if(g.formatting=!1,S!=g.thisLine.stream){if(g.header=0,g.hr=!1,S.match(/^\s*$/,!0))return ue(g),null;if(g.prevLine=g.thisLine,g.thisLine={stream:S},g.taskList=!1,g.trailingSpace=0,g.trailingSpaceNewLine=!1,!g.localState&&(g.f=g.block,g.f!=v)){var q=S.match(/^\s*/,!0)[0].replace(/\t/g,ce).length;if(g.indentation=q,g.indentationDiff=null,q>0)return null}}return g.f(S,g)},innerMode:function(S){return S.block==v?{state:S.htmlState,mode:Ce}:S.localState?{state:S.localState,mode:S.localMode}:{state:S,mode:be}},indent:function(S,g,q){return S.block==v&&Ce.indent?Ce.indent(S.htmlState,g,q):S.localState&&S.localMode.indent?S.localMode.indent(S.localState,g,q):$.Pass},blankLine:ue,getType:X,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return be},"xml"),$.defineMIME("text/markdown","markdown"),$.defineMIME("text/x-markdown","markdown")})},osHv:function(At,at,x){(function($){$(x("VrN/"))})(function($){"use strict";var Pe=$.Pos;function oe(B,ce){return B.line-ce.line||B.ch-ce.ch}var Ce="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ve=Ce+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ge=new RegExp("<(/?)(["+Ce+"]["+ve+"]*)","g");function j(B,ce,ne,pe){this.line=ce,this.ch=ne,this.cm=B,this.text=B.getLine(ce),this.min=pe?Math.max(pe.from,B.firstLine()):B.firstLine(),this.max=pe?Math.min(pe.to-1,B.lastLine()):B.lastLine()}function ee(B,ce){var ne=B.cm.getTokenTypeAt(Pe(B.line,ce));return ne&&/\btag\b/.test(ne)}function W(B){return B.line>=B.max?void 0:(B.ch=0,B.text=B.cm.getLine(++B.line),!0)}function se(B){return B.line<=B.min?void 0:(B.text=B.cm.getLine(--B.line),B.ch=B.text.length,!0)}function L(B){for(;;){var ce=B.text.indexOf(">",B.ch);if(ce==-1){if(W(B))continue;return}if(!ee(B,ce+1)){B.ch=ce+1;continue}var ne=B.text.lastIndexOf("/",ce),pe=ne>-1&&!/\S/.test(B.text.slice(ne+1,ce));return B.ch=ce+1,pe?"selfClose":"regular"}}function I(B){for(;;){var ce=B.ch?B.text.lastIndexOf("<",B.ch-1):-1;if(ce==-1){if(se(B))continue;return}if(!ee(B,ce+1)){B.ch=ce;continue}ge.lastIndex=ce,B.ch=ce;var ne=ge.exec(B.text);if(ne&&ne.index==ce)return ne}}function le(B){for(;;){ge.lastIndex=B.ch;var ce=ge.exec(B.text);if(!ce){if(W(B))continue;return}if(!ee(B,ce.index+1)){B.ch=ce.index+1;continue}return B.ch=ce.index+ce[0].length,ce}}function z(B){for(;;){var ce=B.ch?B.text.lastIndexOf(">",B.ch-1):-1;if(ce==-1){if(se(B))continue;return}if(!ee(B,ce+1)){B.ch=ce;continue}var ne=B.text.lastIndexOf("/",ce),pe=ne>-1&&!/\S/.test(B.text.slice(ne+1,ce));return B.ch=ce+1,pe?"selfClose":"regular"}}function V(B,ce){for(var ne=[];;){var pe=le(B),Ne,ue=B.line,K=B.ch-(pe?pe[0].length:0);if(!pe||!(Ne=L(B)))return;if(Ne=="selfClose")continue;if(pe[1]){for(var v=ne.length-1;v>=0;--v)if(ne[v]==pe[2]){ne.length=v;break}if(v<0&&(!ce||ce==pe[2]))return{tag:pe[2],from:Pe(ue,K),to:Pe(B.line,B.ch)}}else ne.push(pe[2])}}function J(B,ce){for(var ne=[];;){var pe=z(B);if(!pe)return;if(pe=="selfClose"){I(B);continue}var Ne=B.line,ue=B.ch,K=I(B);if(!K)return;if(K[1])ne.push(K[2]);else{for(var v=ne.length-1;v>=0;--v)if(ne[v]==K[2]){ne.length=v;break}if(v<0&&(!ce||ce==K[2]))return{tag:K[2],from:Pe(B.line,B.ch),to:Pe(Ne,ue)}}}}$.registerHelper("fold","xml",function(B,ce){for(var ne=new j(B,ce.line,0);;){var pe=le(ne);if(!pe||ne.line!=ce.line)return;var Ne=L(ne);if(!Ne)return;if(!pe[1]&&Ne!="selfClose"){var ue=Pe(ne.line,ne.ch),K=V(ne,pe[2]);return K&&oe(K.from,ue)>0?{from:ue,to:K.from}:null}}}),$.findMatchingTag=function(B,ce,ne){var pe=new j(B,ce.line,ce.ch,ne);if(pe.text.indexOf(">")==-1&&pe.text.indexOf("<")==-1)return;var Ne=L(pe),ue=Ne&&Pe(pe.line,pe.ch),K=Ne&&I(pe);if(!Ne||!K||oe(pe,ce)>0)return;var v={from:Pe(pe.line,pe.ch),to:ue,tag:K[2]};return Ne=="selfClose"?{open:v,close:null,at:"open"}:K[1]?{open:J(pe,K[2]),close:v,at:"close"}:(pe=new j(B,ue.line,ue.ch,ne),{open:v,close:V(pe,K[2]),at:"open"})},$.findEnclosingTag=function(B,ce,ne,pe){for(var Ne=new j(B,ce.line,ce.ch,ne);;){var ue=J(Ne,pe);if(!ue)break;var K=new j(B,ce.line,ce.ch,ne),v=V(K,ue.tag);if(v)return{open:ue,close:v}}},$.scanForClosingTag=function(B,ce,ne,pe){var Ne=new j(B,ce.line,ce.ch,pe?{from:0,to:pe}:null);return V(Ne,ne)}})},p5ED:function(At,at,x){"use strict";var $=x("+L6B"),Pe=x("2/Rp"),oe=x("5Dmo"),Ce=x("3S7+"),ve=x("k1fw"),ge=x("9og8"),j=x("tJVT"),ee=x("WmNS"),W=x.n(ee),se=x("q1tI"),L=x.n(se),I=x("vHTk"),le=x.n(I),z=x("yEEn"),V=x("ZW9T"),J=x("1vsH"),B=x("V0Rq"),ce=x("m3rI"),ne=function(Ne){var ue=Ne.name,K=Ne.data,v=Ne.theme,ie=Ne.type,X=Ne.filename,de=Ne.monacoEditor,A=Ne.className,b=Ne.style,U=Ne.close,D=Ne.onClose,k=Ne.hasMask,G=Ne.otherData,he=G===void 0?{}:G,Y=Object(se.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),be=Object(j.a)(Y,2),S=be[0],g=be[1],q=Object(se.useState)(""),Te=Object(j.a)(q,2),we=Te[0],$e=Te[1],ot=Object(se.useState)(),_e=Object(j.a)(ot,2),je=_e[0],Se=_e[1],Oe=window.ENV==="build"?"/react/build/office.html":"/office.html",Z,w=1024*1024,Be=10*w,ut=Object(se.useRef)();ie==="office"&&(Z=Object(J.P)(K).filesize,Z>Be&&(ie="other")),X&&(de.filename=X),Object(se.useEffect)(function(){var fe,De,We=(fe=document.cookie)===null||fe===void 0||((De=fe.replace(/\s/g,""))===null||De===void 0)?void 0:De.split(";");We==null||We.map(function(Ve){var ze=Ve.split("=");ze[0]==="_educoder_session"&&$e(ze[1])})},[]),Object(se.useEffect)(function(){ie==="office"&&wt()},[ie]);var wt=function(){var fe=Object(ge.a)(W.a.mark(function De(){var We,Ve,ze;return W.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return console.log("data:",K),We=K,K.startsWith("http")||(We=location.origin+We),Ve=new URL(We).pathname.split("/").pop(),Le.next=6,Object(B.U)({attachment_id:Ve});case 6:ze=Le.sent,Se(ze);case 8:case"end":return Le.stop()}},De)}));return function(){return fe.apply(this,arguments)}}(),Je=function(){if(K.startsWith("http")||K.startsWith("blob:")){qe();return}Object(J.x)(X||"educoder",K,X)},qe=function(){Object(J.v)(X||"educoder",decodeURIComponent(K))};return L.a.createElement("div",{style:Object(ve.a)({},b||{}),className:"".concat(k&&le.a.bgBlack," ").concat(ie?le.a.wrp:"hide")},U&&L.a.createElement("div",{className:le.a.close,ref:ut},L.a.createElement(Ce.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ut.current}},L.a.createElement("span",{onClick:qe},L.a.createElement("i",{className:"icon-quxiaozhiding"}))),L.a.createElement(Ce.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ut.current}},L.a.createElement("span",{className:"",onClick:function(){D(),Se(null)}},L.a.createElement("i",{className:"icon-guanbi1"})))),L.a.createElement("div",{className:"".concat(le.a[A]," ").concat(A," ").concat(le.a.monaco," ").concat(ie==="txt"?"show":"hide")},ie==="txt"&&L.a.createElement(V.b,de)),ie==="audio"&&L.a.createElement("audio",{src:"".concat((K==null?void 0:K.indexOf("http://"))>-1||(K==null?void 0:K.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(K),autoPlay:!0}),ie==="video"&&L.a.createElement(L.a.Fragment,null,(K==null?void 0:K.indexOf("/api"))>-1?L.a.createElement("video",{controls:!0,src:"".concat(K),autoPlay:!0}):L.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(K),autoPlay:!0})),ie==="office"&&je&&L.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(je.key,"&url=").concat(ce.a.API_SERVER+je.url,"&callbackUrl=").concat(ce.a.API_SERVER+je.callbackUrl,"&fileType=").concat(je.fileType,"&title=").concat(je.title,"&model=view")}),(ie==="xlsx"||ie==="doc"||ie==="pptx"||ie==="docx")&&L.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(he.key,"&url=").concat(ce.a.API_SERVER+he.url,"&callbackUrl=").concat(ce.a.API_SERVER+he.callbackUrl,"&fileType=").concat(he.fileType,"&title=").concat(he.title,"&model=").concat(he.model)}),ie==="html"&&L.a.createElement("iframe",{src:K+"&disposition=inline"}),ie==="pdf"&&L.a.createElement("embed",{className:le.a.embed,src:K,type:"application/pdf"}),ie==="image"&&L.a.createElement("img",{src:"".concat((K==null?void 0:K.indexOf("http://"))>-1||(K==null?void 0:K.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(K)}),ie==="other"&&L.a.createElement("div",null,L.a.createElement(Pe.a,{type:"primary",size:"large",onClick:Je},L.a.createElement(z.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),ie==="download"&&L.a.createElement(Pe.a,{type:"primary",size:"large",onClick:Je},L.a.createElement(z.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};at.a=ne},"p77/":function(At,at,x){},"rAM+":function(At,at,x){"use strict";x.d(at,"a",function(){return Pe});var $=x("Qw5x");function Pe(oe,Ce){var ve;if(typeof Symbol=="undefined"||oe[Symbol.iterator]==null){if(Array.isArray(oe)||(ve=Object($.a)(oe))||Ce&&oe&&typeof oe.length=="number"){ve&&(oe=ve);var ge=0,j=function(){};return{s:j,n:function(){return ge>=oe.length?{done:!0}:{done:!1,value:oe[ge++]}},e:function(I){throw I},f:j}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ee=!0,W=!1,se;return{s:function(){ve=oe[Symbol.iterator]()},n:function(){var I=ve.next();return ee=I.done,I},e:function(I){W=!0,se=I},f:function(){try{!ee&&ve.return!=null&&ve.return()}finally{if(W)throw se}}}}},rUJ1:function(At,at){const x=/[&<>"']/,$=/[&<>"']/g,Pe=/[<>"']|&(?!#?\w+;)/,oe=/[<>"']|&(?!#?\w+;)/g,Ce={"&":"&","<":"<",">":">",'"':""","'":"'"},ve=ie=>Ce[ie];function ge(ie,X){if(X){if(x.test(ie))return ie.replace($,ve)}else if(Pe.test(ie))return ie.replace(oe,ve);return ie}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ee(ie){return ie.replace(j,(X,de)=>(de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""))}const W=/(^|[^\[])\^/g;function se(ie,X){ie=ie.source||ie,X=X||"";const de={replace:(A,b)=>(b=b.source||b,b=b.replace(W,"$1"),ie=ie.replace(A,b),de),getRegex:()=>new RegExp(ie,X)};return de}const L=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function le(ie,X,de){if(ie){let A;try{A=decodeURIComponent(ee(de)).replace(L,"").toLowerCase()}catch(b){return null}if(A.indexOf("javascript:")===0||A.indexOf("vbscript:")===0||A.indexOf("data:")===0)return null}X&&!I.test(de)&&(de=ce(X,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(A){return null}return de}const z={},V=/^[^:]+:\/*[^/]*$/,J=/^([^:]+:)[\s\S]*$/,B=/^([^:]+:\/*[^/]*)[\s\S]*$/;function ce(ie,X){z[" "+ie]||(V.test(ie)?z[" "+ie]=ie+"/":z[" "+ie]=ue(ie,"/",!0)),ie=z[" "+ie];const de=ie.indexOf(":")===-1;return X.substring(0,2)==="//"?de?X:ie.replace(J,"$1")+X:X.charAt(0)==="/"?de?X:ie.replace(B,"$1")+X:ie+X}const ne={exec:function(){}};function pe(ie){let X=1,de,A;for(;X<arguments.length;X++){de=arguments[X];for(A in de)Object.prototype.hasOwnProperty.call(de,A)&&(ie[A]=de[A])}return ie}function Ne(ie,X){const de=ie.replace(/\|/g,(U,D,k)=>{let G=!1,he=D;for(;--he>=0&&k[he]==="\\";)G=!G;return G?"|":" |"}),A=de.split(/ \|/);let b=0;if(A.length>X)A.splice(X);else for(;A.length<X;)A.push("");for(;b<A.length;b++)A[b]=A[b].trim().replace(/\\\|/g,"|");return A}function ue(ie,X,de){const A=ie.length;if(A===0)return"";let b=0;for(;b<A;){const U=ie.charAt(A-b-1);if(U===X&&!de)b++;else if(U!==X&&de)b++;else break}return ie.substr(0,A-b)}function K(ie,X){if(ie.indexOf(X[1])===-1)return-1;const de=ie.length;let A=0,b=0;for(;b<de;b++)if(ie[b]==="\\")b++;else if(ie[b]===X[0])A++;else if(ie[b]===X[1]&&(A--,A<0))return b;return-1}function v(ie){ie&&ie.sanitize&&!ie.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}At.exports={escape:ge,unescape:ee,edit:se,cleanUrl:le,resolveUrl:ce,noopTest:ne,merge:pe,splitCells:Ne,rtrim:ue,findClosingBracket:K,checkSanitizeDeprecation:v}},sDPU:function(At,at,x){"use strict";x.r(at);var $=x("cWXX"),Pe=x("/ezw"),oe=x("k1fw"),Ce=x("9og8"),ve=x("tJVT"),ge=x("WmNS"),j=x.n(ge),ee=x("q1tI"),W=x.n(ee),se=x("Ty5D"),L=x("9kvl"),I=x("FIWC"),le=x.n(I),z=x("sbIO"),V=x("ErOA"),J=x("LvDl"),B=x.n(J),ce=function(pe){var Ne,ue,K,v,ie=pe.paperlibrary,X=pe.user,de=pe.globalSetting,A=pe.dispatch,b=pe.location,U=(b==null||((Ne=b.query)===null||Ne===void 0)?void 0:Ne.select)||0,D=Object(ee.useState)(!1),k=Object(ve.a)(D,2),G=k[0],he=k[1],Y=Object(ee.useState)(!0),be=Object(ve.a)(Y,2),S=be[0],g=be[1],q=Object(ee.useState)(Number(U)),Te=Object(ve.a)(q,2),we=Te[0],$e=Te[1],ot=Object(ee.useState)({}),_e=Object(ve.a)(ot,2),je=_e[0],Se=_e[1],Oe=Object(se.i)(),Z=X.userInfo;Object(ee.useEffect)(function(){return A({type:"globalSetting/footerToggle",payload:!1}),function(){A({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(ee.useEffect)(function(){return A({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),A({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){A({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),A({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(ee.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(ee.useEffect)(function(){w(we)},[]);var w=function(){var fe=Object(Ce.a)(j.a.mark(function De(){var We,Ve,ze=arguments;return j.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return We=ze.length>0&&ze[0]!==void 0?ze[0]:0,Le.next=3,Object(V.a)("/api/exercises/".concat(Oe.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:We}});case 3:Ve=Le.sent,g(!1),Se(Be(Ve));case 6:case"end":return Le.stop()}},De)}));return function(){return fe.apply(this,arguments)}}(),Be=function(De){var We={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!De)return;var Ve=De||{},ze=Ve.exam,Ue=Ve.single_questions,Le=Ve.multiple_questions,Et=Ve.judgement_questions,st=Ve.program_questions,nt=Ve.program_correction_questions,ct=Ve.program_completion_questions,St=Ve.completion_questions,_t=Ve.subjective_questions,pt=Ve.practical_questions,me=Ve.combination_questions,kt=[Object(oe.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},Ue),Object(oe.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Le),Object(oe.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},St),Object(oe.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},Et),Object(oe.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},_t),Object(oe.a)({type:"PROGRAM",name:"\u7A0B\u5E8F\u8BBE\u8BA1\u9898"},st),Object(oe.a)({type:"PROGRAM_CORRECTION",name:"\u7A0B\u5E8F\u6539\u9519\u9898"},nt),Object(oe.a)({type:"PROGRAM_COMPLETION",name:"\u7A0B\u5E8F\u586B\u7A7A\u9898"},ct),Object(oe.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},pt),Object(oe.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},me)],ht=[],ye=0,Ee=0,R=kt.filter(function(O){return O.questions_count>0}).map(function(O,P){var y;return(y=O.questions)===null||y===void 0||y.forEach(function(_){ht.push(_.id),ye=ye+_.score,Ee=Ee+1}),Object(oe.a)(Object(oe.a)({},O),{number:We[P+1]})});return{all_questions_count:Ee,all_score:ye,questionList:R,ids:ht,exam:ze}},ut=function(){L.d.push("/classrooms/".concat(Oe.coursesId,"/exercise"))},wt=function(){alert("\u4FDD\u5B58")},Je=function(){var fe=Object(Ce.a)(j.a.mark(function De(We,Ve){var ze,Ue,Le;return j.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:return st.next=2,Object(V.a)("/api/exercises/".concat(Oe.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:We==null?void 0:We.single_question_id}});case 2:ze=st.sent,ze!=null&&ze.question&&(Le=Object(J.cloneDeep)(je),Le.questionList=Le==null||((Ue=Le.questionList)===null||Ue===void 0)?void 0:Ue.map(function(nt){if(nt.type===Ve.type){var ct=Object(J.cloneDeep)(nt==null?void 0:nt.questions);return ct.splice(Ve.index,1,ze==null?void 0:ze.question),Object(oe.a)(Object(oe.a)({},nt),{},{questions:ct})}return nt}),Se(Le));case 4:case"end":return st.stop()}},De)}));return function(We,Ve){return fe.apply(this,arguments)}}(),qe=function(){var fe=Object(Ce.a)(j.a.mark(function De(We){return j.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:document.body.scrollIntoView(),w(We),$e(We);case 3:case"end":return ze.stop()}},De)}));return function(We){return fe.apply(this,arguments)}}();return W.a.createElement("section",{className:le.a.wrap},W.a.createElement(Pe.a,{loading:S,active:!0,paragraph:{rows:5}},((ue=Object(se.h)())===null||ue===void 0||((K=ue.pathname)===null||K===void 0)?void 0:K.includes("preview"))&&W.a.createElement("div",{className:le.a.crumbs},W.a.createElement("b",null),W.a.createElement("span",{className:"current",onClick:function(){return L.d.push("/classrooms/".concat(Oe.coursesId,"/exercise"))}},"".concat(Z==null||((v=Z.course)===null||v===void 0)?void 0:v.course_name,">")),W.a.createElement("span",{className:"current",onClick:function(){return L.d.push("/classrooms/".concat(Oe.coursesId,"/exercise"))}},"\u8BD5\u5377\u5217\u8868>"),W.a.createElement("span",{style:{color:"#bebebe"}},"\u9884\u89C8")),W.a.createElement(z.a,{loading:G,submit:wt,goBack:ut,data:je,selectValue:we,editPreview:!0,onExchange:Je,onSkipExamination:qe})))};at.default=Object(L.a)(function(ne){var pe=ne.paperlibrary,Ne=ne.user,ue=ne.globalSetting;return{paperlibrary:pe,user:Ne,globalSetting:ue}})(ce)},sbIO:function(At,at,x){"use strict";var $=x("DjyN"),Pe=x("NUBc"),oe=x("5Dmo"),Ce=x("3S7+"),ve=x("/zsF"),ge=x("PArb"),j=x("Q9mQ"),ee=x("diRs"),W=x("+L6B"),se=x("2/Rp"),L=x("5NDa"),I=x("5rEg"),le=x("miYZ"),z=x("tsqr"),V=x("9og8"),J=x("giR+"),B=x("fyUT"),ce=x("2qtc"),ne=x("kLXV"),pe=x("tJVT"),Ne=x("WmNS"),ue=x.n(Ne),K=x("q1tI"),v=x.n(K),ie=x("PsQE"),X=x.n(ie),de=x("0eGx"),A=x.n(de),b=x("9Bee"),U=x("Ty5D"),D=x("9kvl"),k=x("ErOA"),G=x("+yhJ"),he=x.n(G),Y=x("RZ/O"),be=x.n(Y),S=x("LvDl"),g=x("6K3P"),q=x.n(g),Te=x("sRBo"),we=x("kaz8"),$e=x("oBTY"),ot=x("PpiC"),_e=x("Ot1p"),je=x("kqOp"),Se=x("7qnI"),Oe=x("1vsH"),Z=x("PGNT"),w=x.n(Z),Be=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ut=function(R,O){var P=R.globalSetting,y=R.loading,_=R.dispatch,C=R.isEdit,E=R.editData,te=Object(ot.a)(R,["globalSetting","loading","dispatch","isEdit","editData"]),F=Object(K.useState)(""),ae=Object(pe.a)(F,2),Ke=ae[0],et=ae[1],Ge=Object(K.useState)(""),mt=Object(pe.a)(Ge,2),Ot=mt[0],Ye=mt[1],Bt=Object(K.useState)([]),Mt=Object(pe.a)(Bt,2),Ft=Mt[0],Nt=Mt[1],vt=Object(K.useState)(""),Gt=Object(pe.a)(vt,2),Wt=Gt[0],He=Gt[1],yt=Object(K.useState)(),dt=Object(pe.a)(yt,2),Ct=dt[0],Yt=dt[1],Vt=Object(K.useState)(!1),ln=Object(pe.a)(Vt,2),Ht=ln[0],gt=ln[1];Object(K.useEffect)(function(){if(!E||!C)return;et(E==null?void 0:E.name),Ye(E==null?void 0:E.analysis),Yt(E==null?void 0:E.is_ordered),gt(!0)},[E]),Object(K.useEffect)(function(){if(!Ht)return;var Ae=E==null?void 0:E.standard_answer.map(function(tt){return tt.answer_text});Nt(Ae),gt(!1)},[Ht]),Object(K.useImperativeHandle)(O,function(){return{onSave:qt,Clear:Pt}});var qt=function(){var tt=[],dn=!1;return Ke?(Ft.forEach(function(cn,bn){tt.push({position:bn+1,answer_text:[]}),cn.forEach(function(_n,h){tt[bn].answer_text.push(_n),(!_n||!Object(Oe.Z)(_n,1e4))&&(He("".concat(bn,"-").concat(h)),z.b.info(_n?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),dn=!0)})}),dn?!1:(tt==null?void 0:tt.length)>20?(z.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:Ke,analysis:Ot,standard_answers:tt,is_ordered:Ct}):(z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Pt=function(){et(""),Ye(""),Nt([]),Yt(!1)},Qt=function(tt,dn,cn){var bn=Ft.slice();if(dn&&bn.splice(tt,dn),cn)for(var _n=0;_n<cn;_n++)bn.splice(tt+_n,0,[""]);Nt(bn)},Lt=function(tt,dn,cn){He("");var bn=Ft.slice();bn[tt][dn]=cn,Nt(bn)},gn=function(tt){var dn=Ft.slice();dn[tt]=[].concat(Object($e.a)(dn[tt]),[""]),Nt(dn)},$n=function(tt,dn){var cn=Ft.slice();if(!cn[tt][dn]){cn[tt]=cn[tt].filter(function(bn,_n){return _n!==dn}),Nt(cn);return}ne.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:w.a.modal,onOk:function(){cn[tt]=cn[tt].filter(function(_n,h){return h!==dn}),Nt(cn)}})},si=function(tt){ne.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:w.a.modal,onOk:function(){var cn=Ft.slice();cn=Ft.filter(function(bn,_n){return tt!==_n}),Nt(cn)}})};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement("div",null,v.a.createElement(je.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Ke,onChange:function(tt){return et(tt)},showNullButton:!0,onPlaceholderChange:Qt})),v.a.createElement("div",{className:"mt20"},Ft.map(function(Ae,tt){return v.a.createElement(Se.a,{key:tt,answers:Ae,index:tt,flex:1,is_md:!0,activeOptionErrorIndex:Wt,onAnswerChange:Lt,addChildAnswer:gn,deleteChildAnswer:$n,deleteChildAnswermain:si})})),v.a.createElement("div",{className:"mt20"},Ft.length>1&&v.a.createElement("span",null,v.a.createElement(we.a,{checked:Ct,onChange:function(tt){return Yt(tt.target.checked)},className:"".concat(w.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),v.a.createElement("span",{className:"".concat(w.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ot,onChange:function(tt){return Ye(tt)}}))},wt=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(ut)),Je=x("7Kak"),qe=x("9yH6"),fe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],De=function(R,O){var P=R.globalSetting,y=R.loading,_=R.editData,C=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ae=Object(ot.a)(R,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),Ke=Object(K.useState)(),et=Object(pe.a)(Ke,2),Ge=et[0],mt=et[1],Ot=Object(K.useState)(""),Ye=Object(pe.a)(Ot,2),Bt=Ye[0],Mt=Ye[1],Ft=Object(K.useState)(""),Nt=Object(pe.a)(Ft,2),vt=Nt[0],Gt=Nt[1];Object(K.useEffect)(function(){if(!_||!F)return;Mt(_==null?void 0:_.name),Gt(_==null?void 0:_.analysis);var yt=_==null?void 0:_.choices.find(function(dt){return dt.is_answer});mt(yt.choice_text==="\u6B63\u786E"?"0":"1")},[_]),Object(K.useImperativeHandle)(O,function(){return{onSave:Wt,Clear:He}});var Wt=function(){if(!Bt)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Ge)return z.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var dt=[{choice_text:"\u6B63\u786E",is_answer:Ge==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Ge==="1"?1:0}];return{name:Bt,choices:dt,analysis:vt}},He=function(){Mt(""),Gt(""),mt("")};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Bt,onChange:function(dt){return Mt(dt)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",v.a.createElement("span",{className:w.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),v.a.createElement(qe.a.Group,{buttonStyle:"solid",value:Ge,onChange:function(dt){return mt(dt.target.value)}},v.a.createElement(qe.a.Button,{value:"0",className:"".concat(w.a.radio," mr40")},"\u6B63\u786E"),v.a.createElement(qe.a.Button,{value:"1",className:w.a.radio},"\u9519\u8BEF")),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:vt,onChange:function(dt){return Gt(dt)}}))},We=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(De)),Ve=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ze=function(R,O){var P=R.editData,y=R.globalSetting,_=R.loading,C=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ae=Object(ot.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ke=Object(K.useState)([]),et=Object(pe.a)(Ke,2),Ge=et[0],mt=et[1],Ot=Object(K.useState)(),Ye=Object(pe.a)(Ot,2),Bt=Ye[0],Mt=Ye[1],Ft=Object(K.useState)([]),Nt=Object(pe.a)(Ft,2),vt=Nt[0],Gt=Nt[1],Wt=Object(K.useState)(""),He=Object(pe.a)(Wt,2),yt=He[0],dt=He[1],Ct=Object(K.useState)(""),Yt=Object(pe.a)(Ct,2),Vt=Yt[0],ln=Yt[1];Object(K.useEffect)(function(){mt(["","","",""])},[]),Object(K.useEffect)(function(){if(!P||!F)return;dt(P==null?void 0:P.name),ln(P==null?void 0:P.analysis),mt(P==null?void 0:P.choices.map(function(Pt){return Pt.choice_text}));var qt=[];P==null||P.choices.map(function(Pt,Qt){Pt.is_answer&&qt.push(Qt)}),Gt(qt)},[P]),Object(K.useImperativeHandle)(O,function(){return{onSave:Ht,Clear:gt}});var Ht=function(){if(!yt)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Pt=Ge.findIndex(function(Lt){return!Lt});if(Pt>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Ve[Pt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!vt.length)return z.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(vt.length<2)return z.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Qt=Ge.map(function(Lt,gn){return{choice_text:Lt,is_answer:vt.includes(gn)?1:0}});return{name:yt,choices:Qt,analysis:Vt}},gt=function(){mt(["","","",""]),dt(""),ln(""),Gt("")};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:yt,onChange:function(Pt){return dt(Pt)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",v.a.createElement("span",{className:w.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ge.map(function(qt,Pt){return v.a.createElement("div",{className:w.a.choiceWrap,key:Pt},v.a.createElement(Ce.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},v.a.createElement("div",{className:"".concat(w.a.answer," ").concat(vt.includes(Pt)?w.a.activeAnswer:""),onClick:function(){vt.includes(Pt)?Gt(vt.filter(function(Lt){return Lt!==Pt})):Gt([].concat(Object($e.a)(vt),[Pt]))}},Ve[Pt])),v.a.createElement("div",{className:w.a.editorWrap},Bt===Pt?v.a.createElement(_e.a,{id:"single-question-option-".concat(Pt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:qt,onChange:function(Lt){Ge[Pt]=Lt,mt(Ge)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Mt(Pt)}},v.a.createElement(b.a,{value:qt}))),Pt>1&&v.a.createElement(Ce.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){mt(Ge.filter(function(Lt,gn){return gn!==Pt})),vt.includes(Pt)?Gt(vt.filter(function(Lt){return Lt!==Pt})):Gt([].concat(Object($e.a)(vt),[Pt]))}})),Pt<7&&Pt===Ge.length-1&&v.a.createElement(Ce.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},v.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return mt([].concat(Object($e.a)(Ge),[""]))}})))}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Vt,onChange:function(Pt){return ln(Pt)}}))},Ue=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(ze)),Le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Et=function(R,O){var P=R.editData,y=R.globalSetting,_=R.loading,C=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ae=Object(ot.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ke=Object(K.useState)([]),et=Object(pe.a)(Ke,2),Ge=et[0],mt=et[1],Ot=Object(K.useState)(),Ye=Object(pe.a)(Ot,2),Bt=Ye[0],Mt=Ye[1],Ft=Object(K.useState)(),Nt=Object(pe.a)(Ft,2),vt=Nt[0],Gt=Nt[1],Wt=Object(K.useState)(""),He=Object(pe.a)(Wt,2),yt=He[0],dt=He[1],Ct=Object(K.useState)(""),Yt=Object(pe.a)(Ct,2),Vt=Yt[0],ln=Yt[1];Object(K.useEffect)(function(){mt(["","","",""])},[]),Object(K.useEffect)(function(){if(!P||!F)return;dt(P==null?void 0:P.name),ln(P==null?void 0:P.analysis),mt(P==null?void 0:P.choices.map(function(qt){return qt.choice_text})),Gt(P==null?void 0:P.choices.findIndex(function(qt){return qt.is_answer}))},[P]),Object(K.useImperativeHandle)(O,function(){return{onSave:Ht,Clear:gt}});var Ht=function(){if(!yt)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Pt=Ge.findIndex(function(Lt){return!Lt});if(Pt>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Le[Pt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",vt),!(typeof vt=="number"))return z.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Qt=Ge.map(function(Lt,gn){return{choice_text:Lt,is_answer:vt===gn?1:0}});return{name:yt,choices:Qt,analysis:Vt}},gt=function(){mt(["","","",""]),dt(""),ln(""),Gt("")};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:yt,onChange:function(Pt){return dt(Pt)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",v.a.createElement("span",{className:w.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ge.map(function(qt,Pt){return v.a.createElement("div",{className:w.a.choiceWrap,key:Pt},v.a.createElement(Ce.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},v.a.createElement("div",{className:"".concat(w.a.answer," ").concat(vt===Pt?w.a.activeAnswer:""),onClick:function(){return Gt(Pt)}},Le[Pt])),v.a.createElement("div",{className:w.a.editorWrap},Bt===Pt?v.a.createElement(_e.a,{id:"single-question-option-".concat(Pt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:qt,onChange:function(Lt){Ge[Pt]=Lt,mt(Ge)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Mt(Pt)}},v.a.createElement(b.a,{value:qt}))),Pt>1&&v.a.createElement(Ce.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){mt(Ge.filter(function(Lt,gn){return gn!==Pt})),Pt===vt&&Gt(null)}})),Pt<7&&Pt===Ge.length-1&&v.a.createElement(Ce.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},v.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return mt([].concat(Object($e.a)(Ge),[""]))}})))}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Vt,onChange:function(Pt){return ln(Pt)}}))},st=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(Et)),nt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ct=function(R,O){var P=R.editData,y=R.globalSetting,_=R.loading,C=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ae=Object(ot.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ke=Object(K.useState)(""),et=Object(pe.a)(Ke,2),Ge=et[0],mt=et[1],Ot=Object(K.useState)(""),Ye=Object(pe.a)(Ot,2),Bt=Ye[0],Mt=Ye[1],Ft=Object(K.useState)(""),Nt=Object(pe.a)(Ft,2),vt=Nt[0],Gt=Nt[1];Object(K.useEffect)(function(){var yt;if(!P||!F)return;mt(P==null?void 0:P.name),Mt(P==null?void 0:P.analysis),Gt(P==null||((yt=P.answer_texts)===null||yt===void 0)?void 0:yt[0])},[P]),Object(K.useImperativeHandle)(O,function(){return{onSave:Wt,Clear:He}});var Wt=function(){return Ge?vt?{name:Ge,answer_texts:[vt],analysis:Bt}:(z.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},He=function(){mt(""),Mt(""),Gt("")};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ge,onChange:function(dt){return mt(dt)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),v.a.createElement(_e.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:vt,onChange:function(dt){return Gt(dt)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Bt,onChange:function(dt){return Mt(dt)}}))},St=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(ct)),_t=x("k1fw"),pt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],me=function(R,O){var P=R.globalSetting,y=R.loading,_=R.dispatch,C=R.editData,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ae=Object(ot.a)(R,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),Ke=Object(K.useState)(""),et=Object(pe.a)(Ke,2),Ge=et[0],mt=et[1],Ot=Object(K.useState)([]),Ye=Object(pe.a)(Ot,2),Bt=Ye[0],Mt=Ye[1];console.log(Bt),Object(K.useEffect)(function(){var Wt;if(!C||!F)return;mt(C==null?void 0:C.name);var He=C==null||((Wt=C.sub_item_banks)===null||Wt===void 0)?void 0:Wt.map(function(yt){var dt,Ct,Yt;return Object(_t.a)(Object(_t.a)({},yt),{},{id:yt.id,open:!1,qusList:yt==null||((dt=yt.choices)===null||dt===void 0)?void 0:dt.map(function(Vt){return Vt.choice_text}),activeQusEditor:null,qusAnswer:(Ct=[yt==null||((Yt=yt.choices)===null||Yt===void 0)?void 0:Yt.findIndex(function(Vt){return Vt.is_answer})])===null||Ct===void 0?void 0:Ct.filter(function(Vt){return Vt!==-1})})});Mt(He)},[C]),Object(K.useImperativeHandle)(O,function(){return{onSave:Ft,Clear:Nt}});var Ft=function(){if(!Ge)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Bt.length===0)return z.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var He=0;He<Bt.length;He++){var yt,dt=Bt[He];if(!(dt!=null&&dt.name))return z.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(He+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Ct=dt==null||((yt=dt.qusList)===null||yt===void 0)?void 0:yt.findIndex(function(Vt){return!Vt});if(Ct>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(He+1,"\u5C0F\u9898").concat(pt[Ct],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(dt!=null&&dt.qusAnswer.length))return z.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(He+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var Yt=Bt.map(function(Vt){return{id:Vt.id>1?Vt.id:null,name:Vt.name,item_type:Vt.item_type,analysis:Vt.analysis,choices:Vt.qusList.map(function(ln,Ht){return{choice_text:ln,is_answer:Vt.qusAnswer[0]===Ht?1:0}})}});return{name:Ge,sub_item_banks:Yt}},Nt=function(){mt(""),Mt([])},vt=function(){var He={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Mt(Bt.concat(He))},Gt=function(He,yt,dt){var Ct=Object(S.cloneDeep)(Bt);if(He==="open"&&(Ct[yt].open=!Ct[yt].open),He==="delete"&&Ct.splice(yt,1),He==="value"&&(Ct[yt].name=dt),He==="answer"&&(Ct[yt].qusAnswer=[dt]),He==="edit"&&(Ct[yt].activeQusEditor=dt),He==="details"&&(Ct[yt].qusList[Ct[yt].activeQusEditor]=dt),He==="addQus"&&(Ct[yt].qusList=Ct[yt].qusList.concat("")),He==="deleteQus"){var Yt;Ct[yt].qusList=Ct[yt].qusList.filter(function(Vt,ln){return ln!==dt}),Ct[yt].qusAnswer=(Yt=Ct[yt].qusAnswer)===null||Yt===void 0?void 0:Yt.filter(function(Vt){return Vt!==dt})}He==="analysis"&&(Ct[yt].analysis=dt),Mt(Ct)};return v.a.createElement("section",{className:w.a.wrap},v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u9898\u5E72\uFF1A")),v.a.createElement(_e.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ge,onChange:function(He){return mt(He)}}),Bt==null?void 0:Bt.map(function(Wt,He){var yt;return v.a.createElement("div",{className:w.a.fold,key:Wt.id},v.a.createElement("div",{onClick:function(){return Gt("open",He)},className:w.a.head},v.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Wt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),v.a.createElement("span",null,"\u7B2C",He+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),v.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Ct){Ct.stopPropagation(),Gt("delete",He)},className:"iconfont icon-shanchu8"})),v.a.createElement("div",{className:"mb10",style:{display:Wt.open?"block":"none"}},v.a.createElement(_e.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Wt==null?void 0:Wt.name,onChange:function(Ct){return Gt("value",He,Ct)}}),v.a.createElement("p",{className:w.a.titleWrap},v.a.createElement("span",{className:w.a.required},"*"),v.a.createElement("span",{className:w.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",v.a.createElement("span",{className:w.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Wt==null||((yt=Wt.qusList)===null||yt===void 0)?void 0:yt.map(function(dt,Ct){var Yt,Vt;return v.a.createElement("div",{className:w.a.choiceWrap,key:Ct},v.a.createElement(Ce.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},v.a.createElement("div",{className:"".concat(w.a.answer," ").concat(Wt!=null&&(Yt=Wt.qusAnswer)!==null&&Yt!==void 0&&Yt.includes(Ct)?w.a.activeAnswer:""),onClick:function(){return Gt("answer",He,Ct)}},pt[Ct])),v.a.createElement("div",{className:w.a.editorWrap},(Wt==null?void 0:Wt.activeQusEditor)===Ct?v.a.createElement(_e.a,{id:"single-question-option-".concat(Ct),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:dt,onChange:function(Ht){return Gt("details",He,Ht)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Gt("edit",He,Ct)}},v.a.createElement(b.a,{value:dt}))),Ct>1&&v.a.createElement(Ce.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Gt("deleteQus",He,Ct)}})),Ct<7&&Ct===(Wt==null||((Vt=Wt.qusList)===null||Vt===void 0)?void 0:Vt.length)-1&&v.a.createElement(Ce.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},v.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Gt("addQus",He)}})))}),v.a.createElement("p",{className:"mb10 mt10"},v.a.createElement("span",{className:w.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),v.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Wt.analysis,onChange:function(Ct){return Gt("analysis",He,Ct)}})))}))},kt=Object(D.a)(function(Ee){var R=Ee.loading,O=Ee.globalSetting;return{globalSetting:O,loading:R.effects}},null,null,{forwardRef:!0})(Object(K.forwardRef)(me)),ht=function(R){var O,P,y,_,C,E,te,F,ae=R.data,Ke=R.submit,et=R.goBack,Ge=R.loading,mt=R.onTypeScore,Ot=R.editPreview,Ye=Ot===void 0?!1:Ot,Bt=R.onSkipExamination,Mt=R.selectValue,Ft=R.onExchange,Nt=Object(K.useRef)(),vt=Object(K.useRef)(Object(S.debounce)(function(){return Qt()},100,{leading:!0,trailing:!0})),Gt=Object(K.useState)(null),Wt=Object(pe.a)(Gt,2),He=Wt[0],yt=Wt[1],dt=Object(K.useState)(!1),Ct=Object(pe.a)(dt,2),Yt=Ct[0],Vt=Ct[1],ln=Object(U.i)();Object(K.useEffect)(function(){return window.addEventListener("scroll",vt==null?void 0:vt.current),function(){window.removeEventListener("scroll",vt==null?void 0:vt.current)}},[]),Object(K.useEffect)(function(){Vt(!0)},[]),Object(K.useEffect)(function(){var ke,H,Ie,Rt,lt=(ke=document.getElementById("examName"))===null||ke===void 0||((H=ke.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||H===void 0||((Ie=H[0])===null||Ie===void 0||((Rt=Ie.childNodes)===null||Rt===void 0)))?void 0:Rt[2];lt&&(lt.nodeValue="\u4EFD")},[ae]),console.log(ae,"--------data");var Ht=function(H){var Ie=parseInt(H);return isNaN(Ie)?"":Ie};function gt(){var ke=0,H=0,Ie=0;return document.body&&(H=document.body.scrollTop),document.documentElement&&(Ie=document.documentElement.scrollTop),ke=H-Ie>0?H:Ie,ke}function qt(){var ke=0,H=0,Ie=0;return document.body&&(H=document.body.scrollHeight),document.documentElement&&(Ie=document.documentElement.scrollHeight),ke=H-Ie>0?H:Ie,ke}function Pt(){var ke=0;return document.compatMode=="CSS1Compat"?ke=document.documentElement.clientHeight:ke=document.body.clientHeight,ke}var Qt=function(){var H=document.getElementById("preview_btns"),Ie=document.getElementById("preview_btns_else");gt()+Pt()>=qt()-68?(H.style.visibility="hidden",Ie.style.visibility="visible"):(H.style.visibility="visible",Ie.style.visibility="hidden")},Lt=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],gn=function(H){var Ie,Rt=[];return v.a.createElement(v.a.Fragment,null,v.a.createElement("aside",{className:X.a.single},H==null||((Ie=H.choices)===null||Ie===void 0)?void 0:Ie.map(function(lt,Qe){return lt.is_answer&&Rt.push(cn[Qe]),v.a.createElement("ul",{key:Qe},v.a.createElement("li",null,cn[Qe],"\u3001"),v.a.createElement("li",null,v.a.createElement(b.a,{value:lt.choice_text})))})),v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Rt.join(""),v.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Lt[H.difficulty])),v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u89E3\u6790:"),v.a.createElement(b.a,{value:H.analysis?H.analysis:"\u6682\u65E0\u89E3\u6790"})),v.a.createElement("ul",null,v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(H==null?void 0:H.discipline_name,"/").concat(H==null?void 0:H.sub_discipline_name)),v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name))))},$n=function(H){var Ie,Rt=H==null||((Ie=H.standard_answer)===null||Ie===void 0)?void 0:Ie.map(function(lt){var Qe;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(lt.position,"\uFF09\uFF1A").concat(lt==null||((Qe=lt.answer_text)===null||Qe===void 0)?void 0:Qe.join("\u3001"))});return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Rt),v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u89E3\u6790:"),v.a.createElement(b.a,{value:H.analysis?H.analysis:"\u6682\u65E0\u89E3\u6790"})),v.a.createElement("ul",null,v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(H==null?void 0:H.discipline_name,"/").concat(H==null?void 0:H.sub_discipline_name)),v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name))))},si=function(H){var Ie;return v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",H==null||((Ie=H.answer_texts)===null||Ie===void 0)?void 0:Ie[0]),v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u89E3\u6790:"),v.a.createElement(b.a,{value:H.analysis?H.analysis:"\u6682\u65E0\u89E3\u6790"})),v.a.createElement("ul",null,v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(H==null?void 0:H.discipline_name,"/").concat(H==null?void 0:H.sub_discipline_name)),v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name)))},Ae=function(H){var Ie;return v.a.createElement("div",{className:X.a.analysis},v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u9884\u671F\u8F93\u51FA:"),v.a.createElement(b.a,{value:H==null||((Ie=H.program_attr)===null||Ie===void 0)?void 0:Ie.description})),v.a.createElement("ul",null,v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(H==null?void 0:H.discipline_name,"/").concat(H==null?void 0:H.sub_discipline_name)),v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name)))},tt=function(H,Ie){var Rt;return v.a.createElement("div",null,H==null||((Rt=H.sub_item_banks)===null||Rt===void 0)?void 0:Rt.map(function(lt,Qe){var jt,pn=[];return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},Ie+1+"."+(Qe+1),"\uFF08\u5355\u9009\u9898\uFF09",lt.name),v.a.createElement("aside",{className:X.a.single},lt==null||((jt=lt.choices)===null||jt===void 0)?void 0:jt.map(function(Jt,fn){return Jt.is_answer&&pn.push(cn[fn]),v.a.createElement("ul",{key:fn},v.a.createElement("li",null,cn[fn],"\u3001"),v.a.createElement("li",null,v.a.createElement(b.a,{value:Jt.choice_text})))})),v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",pn.join(""),v.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Lt[lt.difficulty])),v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u89E3\u6790:"),v.a.createElement(b.a,{value:lt.analysis?lt.analysis:"\u6682\u65E0\u89E3\u6790"})),v.a.createElement("ul",null,v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(H==null?void 0:H.discipline_name,"/").concat(H==null?void 0:H.sub_discipline_name)),v.a.createElement("li",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name))))}))},dn=function(H,Ie){return v.a.createElement("div",null,v.a.createElement("div",{style:{background:"#fafafa",padding:"26px 32px",marginTop:"8px",fontSize:"14px"}},H==null?void 0:H.description,v.a.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"12px"}},v.a.createElement("div",null,v.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat((H==null?void 0:H.discipline_name)||"\u6682\u65E0","/").concat((H==null?void 0:H.sub_discipline_name)||"\u6682\u65E0")),v.a.createElement("div",null,v.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),H==null?void 0:H.tag_discipline_name))))},cn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],bn=function(H){console.log("---",H);var Ie=[];H.questions.map(function(lt){return lt==null?void 0:lt.sub_item_banks.map(function(Qe){Ie.push(Qe)})});var Rt=0;H.type==="COMBINATION"?Rt=H.questions_score/Ie.length:Rt=H.questions_score/H.questions_count,ne.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:v.a.createElement("div",{className:X.a.modalColumn},v.a.createElement("div",{className:X.a.modalRow,style:{justifyContent:"flex-start"}},v.a.createElement("sup",{className:X.a.sup},"*"),v.a.createElement("span",null,H==null?void 0:H.name,(H==null?void 0:H.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),v.a.createElement(B.a,{min:1,parser:Ht,defaultValue:Rt,onChange:function(Qe){Rt=Qe}}),v.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var lt=Object(V.a)(ue.a.mark(function jt(){var pn,Jt;return ue.a.wrap(function(on){for(;;)switch(on.prev=on.next){case 0:if(Rt){on.next=3;break}return z.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),on.abrupt("return",Promise.reject());case 3:H.type==="COMBINATION"?(pn={type:H==null?void 0:H.type,score:Rt,scoreTotal:Rt*(Ie==null?void 0:Ie.length)},mt(pn)):(Jt={type:H==null?void 0:H.type,score:Rt,scoreTotal:Rt*H.questions_count},mt(Jt));case 4:case"end":return on.stop()}},jt)}));function Qe(){return lt.apply(this,arguments)}return Qe}()})},_n=function(){var H="";ne.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:v.a.createElement("div",{className:X.a.modalColumn},v.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},v.a.createElement("img",{style:{marginRight:5},src:q.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),v.a.createElement("div",{className:X.a.modalRow,style:{marginTop:20}},v.a.createElement("sup",{className:X.a.sup},"*"),v.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),v.a.createElement(I.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:H,onChange:function(Rt){H=Rt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Ie=Object(V.a)(ue.a.mark(function lt(){var Qe,jt,pn,Jt,fn;return ue.a.wrap(function(On){for(;;)switch(On.prev=On.next){case 0:if(H){On.next=3;break}return z.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),On.abrupt("return",Promise.reject());case 3:return jt=[],pn=[],Jt=[],ae==null||((Qe=ae.questionList)===null||Qe===void 0)||Qe.forEach(function(vn){var Un;(Un=vn.questions)===null||Un===void 0||Un.forEach(function(Yn){jt.push(Yn.id),pn.push(vn.questions_score/vn.questions_count),vn.type==="COMBINATION"&&Jt.push({id:Yn.id,sub_item_bank_ids:Yn.sub_item_banks.map(function(zn){return zn.id})})})}),console.log("-----",Jt),fn={item_bank_ids:jt,item_bank_scores:pn,name:H,combination_item_banks:Jt},On.next=11,Ke(fn);case 11:case"end":return On.stop()}},lt)}));function Rt(){return Ie.apply(this,arguments)}return Rt}()})},h=function(H,Ie,Rt,lt){var Qe,jt=(Qe=lt.questions)===null||Qe===void 0?void 0:Qe.map(function(Jt){return Jt.id}),pn=ne.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Jt=Object(V.a)(ue.a.mark(function on(){return ue.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:return pn.update({cancelButtonProps:{disabled:!0}}),vn.next=3,Ft({single_question_id:H,seleted_item_bank_ids:jt},{type:Ie,index:Rt});case 3:pn.update({cancelButtonProps:{disabled:!1}}),z.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return vn.stop()}},on)}));function fn(){return Jt.apply(this,arguments)}return fn}()})},o=function(H){var Ie,Rt=(Ie=H.questions)===null||Ie===void 0?void 0:Ie.map(function(jt){return jt.id}),lt=H.name,Qe=ne.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(lt,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var jt=Object(V.a)(ue.a.mark(function Jt(){return ue.a.wrap(function(on){for(;;)switch(on.prev=on.next){case 0:return Qe.update({cancelButtonProps:{disabled:!0}}),on.next=3,Ft({seleted_item_bank_ids:Rt},{type:H.type});case 3:Qe.update({cancelButtonProps:{disabled:!1}}),z.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(lt,"\u8BD5\u9898"));case 5:case"end":return on.stop()}},Jt)}));function pn(){return jt.apply(this,arguments)}return pn}()})},a=function(){var H=ne.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Ie=Object(V.a)(ue.a.mark(function lt(){return ue.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return H.update({cancelButtonProps:{disabled:!0}}),jt.next=3,Ft();case 3:H.update({cancelButtonProps:{disabled:!1}}),z.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return jt.stop()}},lt)}));function Rt(){return Ie.apply(this,arguments)}return Rt}()})},u=function(H){console.log(H,"key"),Bt(H-1)},d=function(){return v.a.createElement(v.a.Fragment,null,v.a.createElement(ee.a,{color:"#55575D",overlayClassName:X.a.popover,visible:Yt,getPopupContainer:function(Ie){return Ie==null?void 0:Ie.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},v.a.createElement(se.a,{onMouseEnter:function(){return Vt(!0)},onMouseLeave:function(){return Vt(!1)},onClick:function(){_n()}},"\u4FDD\u5B58")),v.a.createElement(se.a,{onClick:function(){document.body.scrollIntoView(),et()}},"\u8FD4\u56DE"),v.a.createElement(se.a,{loading:Ge,onClick:function(){return Ke()},type:"primary"},"\u63D0\u4EA4"))},c=function(){var H;return v.a.createElement(v.a.Fragment,null,v.a.createElement(se.a,{onClick:et},"\u8FD4\u56DE"),Mt>0&&v.a.createElement(se.a,{onClick:function(){return u(Mt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Mt<(ae==null||((H=ae.exam)===null||H===void 0)?void 0:H.total_num)-1&&v.a.createElement(se.a,{onClick:function(){return u(Mt+2)}},"\u4E0B\u4E00\u4EFD"))},N=function(H,Ie){if(console.log(H,222),Ie==="SINGLE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(st,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(Ie==="MULTIPLE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(Ue,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(Ie==="JUDGMENT")return v.a.createElement(v.a.Fragment,null,v.a.createElement(We,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(Ie==="COMPLETION")return v.a.createElement(v.a.Fragment,null,v.a.createElement(wt,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(Ie==="SUBJECTIVE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(St,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(Ie==="COMBINATION")return v.a.createElement(v.a.Fragment,null,v.a.createElement(kt,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ge.a,null));if(["PROGRAM","PROGRAM_CORRECTION","PROGRAM_COMPLETION"].includes(Ie)){var Rt;D.d.push("/problems/".concat(H==null||((Rt=H.program_attr)===null||Rt===void 0)?void 0:Rt.identifier,"/edit?type=exercises&express_id=").concat(ln.categoryId,"&question_id=").concat(H==null?void 0:H.id,"&score=").concat(H==null?void 0:H.score,"&callback_url=").concat(location.pathname,"&select=").concat(Mt,"&exercise=true"))}},Re=function(){var ke=Object(V.a)(ue.a.mark(function H(Ie,Rt){var lt,Qe,jt,pn,Jt,fn,on,On,vn,Un;return ue.a.wrap(function(zn){for(;;)switch(zn.prev=zn.next){case 0:return zn.next=2,(lt=Nt.current)===null||lt===void 0?void 0:lt.onSave();case 2:if(Qe=zn.sent,Qe){zn.next=5;break}return zn.abrupt("return");case 5:return jt={question_score:Rt.score,analysis:Qe.analysis},console.log(Qe,"editorData"),(Ie==="SINGLE"||Ie==="MULTIPLE"||Ie==="JUDGMENT")&&(Jt=[],fn=[],jt.question_type=Ie==="JUDGMENT"?2:1,jt.question_title=Qe==null?void 0:Qe.name,Qe==null||((pn=Qe.choices)===null||pn===void 0)||pn.forEach(function(Pn,qn){Jt.push(Pn.choice_text),Pn!=null&&Pn.is_answer&&fn.push(qn+1)}),jt.question_choices=Jt,jt.standard_answers=fn),Ie==="COMPLETION"&&(jt.is_ordered=Qe.is_ordered,jt.question_title=Qe==null?void 0:Qe.name,jt.question_type=3,On=[],Qe==null||((on=Qe.standard_answers)===null||on===void 0)||on.forEach(function(Pn,qn){On.push({choice_id:Pn.position,answer_text:Pn.answer_text})}),jt.standard_answers=On),Ie==="SUBJECTIVE"&&(jt.question_title=Qe==null?void 0:Qe.name,jt.question_type=3,jt.standard_answers=Qe==null?void 0:Qe.answer_texts),Ie==="COMBINATION"&&(jt.question_title=Qe==null?void 0:Qe.name,jt.question_type=7,jt.sub_questions=Qe==null||((vn=Qe.sub_item_banks)===null||vn===void 0)?void 0:vn.map(function(Pn,qn){return{id:Pn.id,question_title:Pn.name,question_type:1,question_choices:Pn.choices.map(function(Hn){return Hn.choice_text}),standard_answers:[Pn.choices.findIndex(function(Hn){return Hn.is_answer})+1],analysis:Pn.analysis}}),delete jt.analysis),zn.next=13,Object(k.a)("/api/exercise_questions/".concat(Rt.id,".json"),{method:"put",body:jt});case 13:Un=zn.sent,(Un==null?void 0:Un.status)===0&&(z.b.success("\u7F16\u8F91\u6210\u529F"),u(Mt+1)),yt(null);case 16:case"end":return zn.stop()}},H)}));return function(Ie,Rt){return ke.apply(this,arguments)}}(),Ze=function(){for(var H=[],Ie=0;Ie<(ae==null||((Rt=ae.exam)===null||Rt===void 0)?void 0:Rt.total_num);Ie++){var Rt;H.push({})}return H},bt=ae==null||((O=ae.questionList)===null||O===void 0)?void 0:O.reduce(function(ke,H){return ke+Number(H.questions_score)},0),Me=Ye&&(ae==null||((P=ae.exam)===null||P===void 0)?void 0:P.exercise_status)!==1;return v.a.createElement("section",{className:X.a.wrap},v.a.createElement("div",{id:"id_left_preview",className:X.a.left,onMouseEnter:function(H){var Ie=document.getElementById("id_left_preview");Ie.style.overflowY="auto"},onMouseLeave:function(H){var Ie=document.getElementById("id_left_preview");Ie.style.overflowY="hidden"}},v.a.createElement("div",{className:X.a.title},v.a.createElement("div",null,v.a.createElement("b",null),v.a.createElement("span",null,"\u7B54\u9898\u5361"))),v.a.createElement("div",{className:X.a.total},v.a.createElement("div",null,v.a.createElement("img",{src:he.a}),v.a.createElement("span",null,"\u9898\u6570(\u9053)"),v.a.createElement("aside",null,ae==null?void 0:ae.all_questions_count)),v.a.createElement("div",{className:"mr30 ml30"},v.a.createElement("img",{src:be.a}),v.a.createElement("span",null,"\u603B\u5206(\u5206)"),v.a.createElement("aside",null,bt)),v.a.createElement("div",null,v.a.createElement("img",{src:A.a}),v.a.createElement("span",null,"\u65F6\u957F(\u5206)"),v.a.createElement("aside",null,ae==null||((y=ae.exam)===null||y===void 0)?void 0:y.time))),ae==null||((_=ae.questionList)===null||_===void 0)?void 0:_.map(function(ke,H){var Ie;return v.a.createElement("div",{className:X.a.list,key:H},v.a.createElement("div",{className:X.a.name},v.a.createElement("b",null),v.a.createElement("span",null,ke.name)),v.a.createElement("aside",null,v.a.createElement("div",null,"\u5171",v.a.createElement("span",{className:X.a.b},ke.questions_count),"\u9898 ",v.a.createElement("span",{className:X.a.l},"|"),"\u5171",v.a.createElement("span",{className:X.a.r},Number(ke.questions_score)),"\u5206"),v.a.createElement("div",{className:X.a.answerSheet},ke==null||((Ie=ke.questions)===null||Ie===void 0)?void 0:Ie.map(function(Rt,lt){return v.a.createElement("div",{onClick:function(){var jt="Anchor_".concat(Rt.id),pn=document.getElementById(jt);pn&&setTimeout(function(){return pn.scrollIntoView({block:"center",behavior:"smooth"})})},key:Rt.id,className:X.a.tag},lt+1)}))))})),v.a.createElement("div",{className:X.a.right},v.a.createElement("div",{className:X.a.examName,id:"examName"},v.a.createElement("div",{className:X.a.name},v.a.createElement(Ce.a,{title:ae==null||((C=ae.exam)===null||C===void 0)?void 0:C.name,getPopupContainer:function(H){return H.parentNode}},v.a.createElement("span",{className:X.a.t},ae==null||((E=ae.exam)===null||E===void 0)?void 0:E.name))),Ye?v.a.createElement(Pe.a,{showTotal:function(H){return v.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",v.a.createElement("span",{className:"c-light-primary"},H),"\u4EFD\u8BD5\u5377")},total:ae==null||((te=ae.exam)===null||te===void 0)?void 0:te.total_num,pageSize:1,current:Mt+1,showSizeChanger:!1,onChange:u,showQuickJumper:!0,hideOnSinglePage:!1}):v.a.createElement(se.a,{onClick:a,type:"primary"},"\u968F\u673A\u66F4\u6362")),v.a.createElement("div",{className:X.a.topWarp},ae==null||((F=ae.questionList)===null||F===void 0)?void 0:F.map(function(ke,H){var Ie,Rt;return v.a.createElement(v.a.Fragment,{key:H},v.a.createElement("div",{className:X.a.head,style:H===0?{border:0,marginTop:-16}:{}},v.a.createElement("div",{className:X.a.name},v.a.createElement("b",null),v.a.createElement("span",null,ke.name)),v.a.createElement("div",{className:X.a.so},"\u5171",v.a.createElement("span",{className:X.a.b},ke.questions_count," "),"\u9898 ",ke.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(ke==null||((Ie=ke.questions)===null||Ie===void 0)?void 0:Ie.map(function(lt){var Qe;return lt==null||((Qe=lt.sub_item_banks)===null||Qe===void 0)?void 0:Qe.length}).reduce(function(lt,Qe){return lt+Qe}),"\u5C0F\u9898\uFF09"),v.a.createElement("span",{className:X.a.l},"|"),"\u5171",v.a.createElement("span",{className:X.a.r},Number(ke.questions_score)),"\u5206"),!Ye&&v.a.createElement("div",{className:X.a.btn},v.a.createElement(se.a,{onClick:function(){return o(ke)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),ke==null||((Rt=ke.questions)===null||Rt===void 0)?void 0:Rt.map(function(lt,Qe){return He===lt.id?v.a.createElement("div",{id:"Anchor_".concat(lt.id),className:X.a.content,style:{padding:0,marginTop:10},key:lt.id},v.a.createElement("div",{style:{float:"right",marginTop:-6}},v.a.createElement(se.a,{onClick:function(){return yt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),v.a.createElement(se.a,{onClick:function(){return Re(ke==null?void 0:ke.type,lt)},type:"primary"},"\u4FDD\u5B58")),N(lt,ke.type)):v.a.createElement("div",{id:"Anchor_".concat(lt.id),className:X.a.content,key:lt.id},v.a.createElement("div",{className:X.a.titleWrap},v.a.createElement(b.a,{style:{paddingRight:10},className:X.a.titleHtml,value:Qe+1+"\u3001"+"".concat((lt==null?void 0:lt.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+lt.name}),Ye&&ke.type!=="PRACTICAL"&&v.a.createElement(se.a,{disabled:Me,onClick:function(){if(He){z.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}yt(lt.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),v.a.createElement(se.a,{disabled:Me,onClick:function(){return h(lt.id,ke.type,Qe,ke)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(ke.type==="SINGLE"||ke.type==="JUDGMENT"||ke.type==="MULTIPLE")&&gn(lt),ke.type==="COMPLETION"&&$n(lt),ke.type==="SUBJECTIVE"&&si(lt),["PROGRAM","PROGRAM_CORRECTION","PROGRAM_COMPLETION"].includes(ke.type)&&Ae(lt),ke.type==="COMBINATION"&&tt(lt,Qe),ke.type==="PRACTICAL"&&dn(lt,Qe),v.a.createElement("div",null))}))})),v.a.createElement("div",{className:X.a.btnsElse,id:"preview_btns_else"},Ye?c():d()),v.a.createElement("div",{className:X.a.btnsWrap,id:"preview_btns"},v.a.createElement("div",{className:X.a.btns},Ye?c():d()))))},ye=at.a=ht},vHTk:function(At,at,x){At.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|