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
622 KiB
345 lines
622 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[178,7,8],{"+NIl":function(At,rt,x){(function($){$(x("VrN/"))})(function($){"use strict";$.defineMode("stex",function(Pe,ae){"use strict";function we(z,V){z.cmdState.push(V)}function ye(z){return z.cmdState.length>0?z.cmdState[z.cmdState.length-1]:null}function ve(z){var V=z.cmdState.pop();V&&V.closeBracket()}function j(z){for(var V=z.cmdState,q=V.length-1;q>=0;q--){var B=V[q];if(B.name=="DEFAULT")continue;return B}return{styleIdentifier:function(){return null}}}function ee(z,V,q){return function(){this.name=z,this.bracketNo=0,this.style=V,this.styles=q,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 P(z,V){var q;if(z.match(/^\\[a-zA-Z@]+/)){var B=z.current().slice(1);return q=W.hasOwnProperty(B)?W[B]:W.DEFAULT,q=new q,we(V,q),se(V,le),q.style}if(z.match(/^\\[$&%#{}_]/))return"tag";if(z.match(/^\\[,;!\/\\]/))return"tag";if(z.match("\\["))return se(V,function(ie,pe){return I(ie,pe,"\\]")}),"keyword";if(z.match("\\("))return se(V,function(ie,pe){return I(ie,pe,"\\)")}),"keyword";if(z.match("$$"))return se(V,function(ie,pe){return I(ie,pe,"$$")}),"keyword";if(z.match("$"))return se(V,function(ie,pe){return I(ie,pe,"$")}),"keyword";var he=z.next();if(he=="%")return z.skipToEnd(),"comment";if(he=="}"||he=="]"){if(q=ye(V),q)q.closeBracket(he),se(V,le);else return"error";return"bracket"}else return he=="{"||he=="["?(q=W.DEFAULT,q=new q,we(V,q),"bracket"):/\d/.test(he)?(z.eatWhile(/[\w.%]/),"atom"):(z.eatWhile(/[\w\-_]/),q=j(V),q.name=="begin"&&(q.argument=z.current()),q.styleIdentifier())}function I(z,V,q){if(z.eatSpace())return null;if(q&&z.match(q))return se(V,P),"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 q=z.peek(),B;return q=="{"||q=="["?(B=ye(V),B.openBracket(q),z.eat(q),se(V,P),"bracket"):/[ \t\r]/.test(q)?(z.eat(q),null):(se(V,P),ve(V),P(z,V))}return{startState:function(){var z=ae.inMathMode?function(V,q){return I(V,q)}:P;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=P,z.cmdState.length=0},lineComment:"%"}}),$.defineMIME("text/x-stex","stex"),$.defineMIME("text/x-latex","stex")})},"+yhJ":function(At,rt,x){At.exports=x.p+"static/xixi.d492fb65.svg"},"0eGx":function(At,rt,x){At.exports=x.p+"static/zhong.c1924b73.svg"},"19Vz":function(At,rt,x){(function($){$(x("VrN/"))})(function($){$.defineOption("placeholder","",function(ee,W,se){var P=se&&se!=$.Init;if(W&&!P)ee.on("blur",ye),ee.on("change",ve),ee.on("swapDoc",ve),$.on(ee.getInputField(),"compositionupdate",ee.state.placeholderCompose=function(){we(ee)}),ve(ee);else if(!W&&P){ee.off("blur",ye),ee.off("change",ve),ee.off("swapDoc",ve),$.off(ee.getInputField(),"compositionupdate",ee.state.placeholderCompose),Pe(ee);var I=ee.getWrapperElement();I.className=I.className.replace(" CodeMirror-empty","")}W&&!ee.hasFocus()&&ye(ee)});function Pe(ee){ee.state.placeholder&&(ee.state.placeholder.parentNode.removeChild(ee.state.placeholder),ee.state.placeholder=null)}function ae(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 we(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?ae(ee):Pe(ee)},20)}function ye(ee){j(ee)&&ae(ee)}function ve(ee){var W=ee.getWrapperElement(),se=j(ee);W.className=W.className.replace(" CodeMirror-empty","")+(se?" CodeMirror-empty":""),se?ae(ee):Pe(ee)}function j(ee){return ee.lineCount()===1&&ee.getLine(0)===""}})},"1eCo":function(At,rt,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},ae={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};$.defineMode("xml",function(we,ye){var ve=we.indentUnit,j={},ee=ye.htmlMode?Pe:ae;for(var W in ee)j[W]=ee[W];for(var W in ye)j[W]=ye[W];var se,P;function I(b,U){function D(de){return U.tokenize=de,de(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(q(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 q(b){return function(U,D){for(var k;(k=U.next())!=null;){if(k=="<")return D.tokenize=q(b+1),D.tokenize(U,D);if(k==">")if(b==1){D.tokenize=I;break}else return D.tokenize=q(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 he(b){b.context&&(b.context=b.context.prev)}function ie(b,U){for(var D;;){if(!b.context)return;if(D=b.context.tagName,!j.contextGrabbers.hasOwnProperty(D)||!j.contextGrabbers[D].hasOwnProperty(U))return;he(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(),P="tag",re):j.allowMissingTagName&&b=="endTag"?(P="tag bracket",re(b,U,D)):(P="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)&&he(D),D.context&&D.context.tagName==k||j.matchClosing===!1?(P="tag",K):(P="tag error",v)}else return j.allowMissingTagName&&b=="endTag"?(P="tag bracket",K(b,U,D)):(P="error",v)}function K(b,U,D){return b!="endTag"?(P="error",K):(he(D),pe)}function v(b,U,D){return P="error",K(b,U,D)}function re(b,U,D){if(b=="word")return P="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)?ie(D,k):(ie(D,k),D.context=new B(D,k,G==D.indented)),pe}return P="error",re}function X(b,U,D){return b=="equals"?fe:(j.allowMissing||(P="error"),re(b,U,D))}function fe(b,U,D){return b=="string"?A:b=="word"&&j.allowUnquoted?(P="string",re):(P="error",re(b,U,D))}function A(b,U,D){return b=="string"?A:re(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"&&(P=null,U.state=U.state(se||D,b,U),P&&(D=P=="error"?D+" error":P)),D},indent:function(b,U,D){var k=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+ve;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+ve*(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 de=j.contextGrabbers[k.tagName];if(de&&de.hasOwnProperty(G[2]))k=k.prev;else break}for(;k&&k.prev&&!k.startOfLine;)k=k.prev;return k?k.indent+ve:b.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(b){b.state==fe&&(b.state=re)},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,rt,x){"use strict";x.d(rt,"a",function(){return K});var $=x("wx14"),Pe=x("rePB"),ae=x("VTBJ"),we=x("1OyB"),ye=x("vuIU"),ve=x("Ji7U"),j=x("LK+K"),ee=x("q1tI"),W=x.n(ee),se=x("TSYQ"),P=x.n(se),I=function(re){var X,fe="".concat(re.rootPrefixCls,"-item"),A=P()(fe,"".concat(fe,"-").concat(re.page),(X={},Object(Pe.a)(X,"".concat(fe,"-active"),re.active),Object(Pe.a)(X,re.className,!!re.className),Object(Pe.a)(X,"".concat(fe,"-disabled"),!re.page),X)),b=function(){re.onClick(re.page)},U=function(k){re.onKeyPress(k,re.onClick,re.page)};return W.a.createElement("li",{title:re.showTitle?re.page:null,className:A,onClick:b,onKeyPress:U,tabIndex:"0"},re.itemRender(re.page,"page",W.a.createElement("a",{rel:"nofollow"},re.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(ve.a)(X,v);var re=Object(j.a)(X);function X(){var fe;Object(we.a)(this,X);for(var A=arguments.length,b=new Array(A),U=0;U<A;U++)b[U]=arguments[U];return fe=re.call.apply(re,[this].concat(b)),fe.state={goInputText:""},fe.buildOptionText=function(D){return"".concat(D," ").concat(fe.props.locale.items_per_page)},fe.changeSize=function(D){fe.props.changeSize(Number(D))},fe.handleChange=function(D){fe.setState({goInputText:D.target.value})},fe.handleBlur=function(D){var k=fe.props,G=k.goButton,de=k.quickGo,Y=k.rootPrefixCls,xe=fe.state.goInputText;if(G||xe==="")return;if(D.relatedTarget&&(D.relatedTarget.className.indexOf("".concat(Y,"-prev"))>=0||D.relatedTarget.className.indexOf("".concat(Y,"-next"))>=0))return;fe.setState({goInputText:""}),de(fe.getValidValue())},fe.go=function(D){var k=fe.state.goInputText;if(k==="")return;(D.keyCode===z.ENTER||D.type==="click")&&(fe.setState({goInputText:""}),fe.props.quickGo(fe.getValidValue()))},fe}return Object(ye.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),de=isNaN(Number(k))?0:Number(k);return G-de})}},{key:"render",value:function(){var A=this,b=this.props,U=b.pageSize,D=b.locale,k=b.rootPrefixCls,G=b.changeSize,de=b.quickGo,Y=b.goButton,xe=b.selectComponentClass,S=b.buildOptionText,g=b.selectPrefixCls,J=b.disabled,Ae=this.state.goInputText,ke="".concat(k,"-options"),Ke=xe,it=null,_e=null,Ie=null;if(!G&&!de)return null;var Re=this.getPageSizeOptions();if(G&&Ke){var Oe=Re.map(function(Z,w){return W.a.createElement(Ke.Option,{key:w,value:Z.toString()},(S||A.buildOptionText)(Z))});it=W.a.createElement(Ke,{disabled:J,prefixCls:g,showSearch:!1,className:"".concat(ke,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(U||Re[0]).toString(),onChange:this.changeSize,getPopupContainer:function(w){return w.parentNode}},Oe)}return de&&(Y&&(Ie=typeof Y=="boolean"?W.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:J,className:"".concat(ke,"-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(ke,"-quick-jumper")},D.jump_to,W.a.createElement("input",{disabled:J,type:"text",value:Ae,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),D.page,Ie)),W.a.createElement("li",{className:"".concat(ke)},it,_e)}}]),X}(W.a.Component);V.defaultProps={pageSizeOptions:["10","20","50","100"]};var q=V,B=x("N2Kk");function he(){}function ie(v){return typeof v=="number"&&isFinite(v)&&Math.floor(v)===v}function pe(v,re,X){return X}function Ne(v,re,X){var fe=typeof v=="undefined"?re.pageSize:v;return Math.floor((X.total-1)/fe)+1}var ue=function(v){Object(ve.a)(X,v);var re=Object(j.a)(X);function X(fe){var A;Object(we.a)(this,X),A=re.call(this,fe),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,de){var Y=A.props.prefixCls,xe=G||W.a.createElement("button",{type:"button","aria-label":de,className:"".concat(Y,"-item-link")});return typeof G=="function"&&(xe=W.a.createElement(G,Object(ae.a)({},A.props))),xe},A.savePaginationNode=function(G){A.paginationNode=G},A.isValid=function(G){return ie(G)&&G!==A.state.current},A.shouldDisplayQuickJumper=function(){var G=A.props,de=G.showQuickJumper,Y=G.pageSize,xe=G.total;return xe<=Y?!1:de},A.handleKeyDown=function(G){(G.keyCode===z.ARROW_UP||G.keyCode===z.ARROW_DOWN)&&G.preventDefault()},A.handleKeyUp=function(G){var de=A.getValidValue(G),Y=A.state.currentInputValue;de!==Y&&A.setState({currentInputValue:de}),G.keyCode===z.ENTER?A.handleChange(de):G.keyCode===z.ARROW_UP?A.handleChange(de-1):G.keyCode===z.ARROW_DOWN&&A.handleChange(de+1)},A.changePageSize=function(G){var de=A.state.current,Y=Ne(G,A.state,A.props);de=de>Y?Y:de,Y===0&&(de=A.state.current),typeof G=="number"&&("pageSize"in A.props||A.setState({pageSize:G}),"current"in A.props||A.setState({current:de,currentInputValue:de})),A.props.onShowSizeChange(de,G),"onChange"in A.props&&A.props.onChange&&A.props.onChange(de,G)},A.handleChange=function(G){var de=A.props.disabled,Y=G;if(A.isValid(Y)&&!de){var xe=Ne(void 0,A.state,A.props);Y>xe?Y=xe: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,de){if(G.key==="Enter"||G.charCode===13){for(var Y=arguments.length,xe=new Array(Y>2?Y-2:0),S=2;S<Y;S++)xe[S-2]=arguments[S];de.apply(void 0,xe)}},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=fe.onChange!==he,U="current"in fe;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=fe.defaultCurrent;"current"in fe&&(D=fe.current);var k=fe.defaultPageSize;return"pageSize"in fe&&(k=fe.pageSize),D=Math.min(D,Ne(k,void 0,fe)),A.state={current:D,currentInputValue:D,pageSize:k},A}return Object(ye.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,de=b.hideOnSinglePage,Y=b.total,xe=b.locale,S=b.showQuickJumper,g=b.showLessItems,J=b.showTitle,Ae=b.showTotal,ke=b.simple,Ke=b.itemRender,it=b.showPrevNextJumpers,_e=b.jumpPrevIcon,Ie=b.jumpNextIcon,Re=b.selectComponentClass,Oe=b.selectPrefixCls,Z=b.pageSizeOptions,w=this.state,Ue=w.current,lt=w.pageSize,St=w.currentInputValue;if(de===!0&&Y<=lt)return null;var qe=Ne(void 0,this.state,this.props),Ye=[],me=null,De=null,Fe=null,Xe=null,We=null,je=S&&S.goButton,Me=g?1:2,Et=Ue-1>0?Ue-1:0,ot=Ue+1<qe?Ue+1:qe,et=Object.keys(this.props).reduce(function(y,C){return(C.substr(0,5)==="data-"||C.substr(0,5)==="aria-"||C==="role")&&(y[C]=A.props[C]),y},{});if(ke)return je&&(typeof je=="boolean"?We=W.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},xe.jump_to_confirm):We=W.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},je),We=W.a.createElement("li",{title:J?"".concat(xe.jump_to).concat(Ue,"/").concat(qe):null,className:"".concat(U,"-simple-pager")},We)),W.a.createElement("ul",Object($.a)({className:P()(U,"".concat(U,"-simple"),Object(Pe.a)({},"".concat(U,"-disabled"),G),D),style:k,ref:this.savePaginationNode},et),W.a.createElement("li",{title:J?xe.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:P()("".concat(U,"-prev"),Object(Pe.a)({},"".concat(U,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Et)),W.a.createElement("li",{title:J?"".concat(Ue,"/").concat(qe):null,className:"".concat(U,"-simple-pager")},W.a.createElement("input",{type:"text",value:St,disabled:G,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),W.a.createElement("span",{className:"".concat(U,"-slash")},"/"),qe),W.a.createElement("li",{title:J?xe.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:P()("".concat(U,"-next"),Object(Pe.a)({},"".concat(U,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(ot)),We);if(qe<=3+Me*2){var ut={locale:xe,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:J,itemRender:Ke};qe||Ye.push(W.a.createElement(le,Object($.a)({},ut,{key:"noPager",page:qe,className:"".concat(U,"-disabled")})));for(var kt=1;kt<=qe;kt+=1){var Ct=Ue===kt;Ye.push(W.a.createElement(le,Object($.a)({},ut,{key:kt,page:kt,active:Ct})))}}else{var ft=g?xe.prev_3:xe.prev_5,ge=g?xe.next_3:xe.next_5;it&&(me=W.a.createElement("li",{title:J?ft:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:P()("".concat(U,"-jump-prev"),Object(Pe.a)({},"".concat(U,"-jump-prev-custom-icon"),!!_e))},Ke(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(_e,"prev page"))),De=W.a.createElement("li",{title:J?ge:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:P()("".concat(U,"-jump-next"),Object(Pe.a)({},"".concat(U,"-jump-next-custom-icon"),!!Ie))},Ke(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ie,"next page")))),Xe=W.a.createElement(le,{locale:xe,last:!0,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:qe,page:qe,active:!1,showTitle:J,itemRender:Ke}),Fe=W.a.createElement(le,{locale:xe,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:J,itemRender:Ke});var wt=Math.max(1,Ue-Me),ct=Math.min(Ue+Me,qe);Ue-1<=Me&&(ct=1+Me*2),qe-Ue<=Me&&(wt=qe-Me*2);for(var be=wt;be<=ct;be+=1){var Ee=Ue===be;Ye.push(W.a.createElement(le,{locale:xe,rootPrefixCls:U,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:be,page:be,active:Ee,showTitle:J,itemRender:Ke}))}Ue-1>=Me*2&&Ue!==1+2&&(Ye[0]=Object(ee.cloneElement)(Ye[0],{className:"".concat(U,"-item-after-jump-prev")}),Ye.unshift(me)),qe-Ue>=Me*2&&Ue!==qe-2&&(Ye[Ye.length-1]=Object(ee.cloneElement)(Ye[Ye.length-1],{className:"".concat(U,"-item-before-jump-next")}),Ye.push(De)),wt!==1&&Ye.unshift(Fe),ct!==qe&&Ye.push(Xe)}var R=null;Ae&&(R=W.a.createElement("li",{className:"".concat(U,"-total-text")},Ae(Y,[Y===0?0:(Ue-1)*lt+1,Ue*lt>Y?Y:Ue*lt])));var O=!this.hasPrev()||!qe,L=!this.hasNext()||!qe;return W.a.createElement("ul",Object($.a)({className:P()(U,D,Object(Pe.a)({},"".concat(U,"-disabled"),G)),style:k,unselectable:"unselectable",ref:this.savePaginationNode},et),R,W.a.createElement("li",{title:J?xe.prev_page:null,onClick:this.prev,tabIndex:O?null:0,onKeyPress:this.runIfEnterPrev,className:P()("".concat(U,"-prev"),Object(Pe.a)({},"".concat(U,"-disabled"),O)),"aria-disabled":O},this.renderPrev(Et)),Ye,W.a.createElement("li",{title:J?xe.next_page:null,onClick:this.next,tabIndex:L?null:0,onKeyPress:this.runIfEnterNext,className:P()("".concat(U,"-next"),Object(Pe.a)({},"".concat(U,"-disabled"),L)),"aria-disabled":L},this.renderNext(ot)),W.a.createElement(q,{disabled:G,locale:xe,rootPrefixCls:U,selectComponentClass:Re,selectPrefixCls:Oe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ue,pageSize:lt,pageSizeOptions:Z,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:je}))}}],[{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:he,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:he,locale:B.a,style:{},itemRender:pe,totalBoundaryShowSizeChanger:50};var K=ue},"6K3P":function(At,rt,x){At.exports=x.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(At,rt,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 ae(){if(!$)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $(Pe)}var we=/^(?:[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 ye(le){return typeof le=="string"&&we.test(le)}for(var ve=ye,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(!ve(V))throw TypeError("Stringified UUID is invalid");return V}var se=W;function P(le,z,V){le=le||{};var q=le.random||(le.rng||ae)();if(q[6]=q[6]&15|64,q[8]=q[8]&63|128,z){V=V||0;for(var B=0;B<16;++B)z[V+B]=q[B];return z}return se(q)}var I=rt.a=P},"7ahc":function(At,rt,x){"use strict";x.d(rt,"a",function(){return Ne});var $=x("k1fw"),Pe=x("0Owb"),ae=x("+L6B"),we=x("2/Rp"),ye=x("y8nQ"),ve=x("Vl3Y"),j=x("tJVT"),ee=x("OaEy"),W=x("2fM7"),se=x("q1tI"),P=x.n(se),I=x("VrN/"),le=x.n(I),z=x("p77/"),V=x.n(z),q=x("c5Ni"),B=x.n(q),he=W.a.Option,ie={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"]};rt.b=function(ue){var K=ue.callback,v=ue.onCancel,re=Object(se.useState)("python"),X=Object(j.a)(re,2),fe=X[0],A=X[1];function b(D){A(pe[D][1])}function U(D){K(D)}return P.a.createElement(ve.a,Object(Pe.a)({},ie,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:U}),P.a.createElement(ve.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},P.a.createElement(W.a,{onChange:b},Object.keys(pe).map(function(D){return P.a.createElement(he,{key:D,value:D},pe[D][0])}))),P.a.createElement(ve.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},P.a.createElement(Ne,{mode:fe})),P.a.createElement("div",{className:"flex-container flex-end"},P.a.createElement(we.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),P.a.createElement(we.a,{type:"ghost",onClick:v},"\u53D6\u6D88")))};function Ne(ue){var K=ue.value,v=ue.onChange,re=ue.mode,X=ue.options,fe=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(de){var Y=de.getValue();v&&v(Y)}return D.on("change",G),function(){D.off("change",G)}}},[D,v]),Object(se.useEffect)(function(){D&&D.setOption("mode",re)},[D,re]),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:re,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},fe));k(G)}},[A.current,D]),P.a.createElement("div",{className:"my-codemirror-container"},P.a.createElement("textarea",{ref:A}))}},"7ixt":function(At,rt,x){"use strict";x.d(rt,"a",function(){return ae});var $={adjustX:1,adjustY:1},Pe=[0,0],ae={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}},we=ae},"7qnI":function(At,rt,x){"use strict";var $=x("5Dmo"),Pe=x("3S7+"),ae=x("fWQN"),we=x("mtLc"),ye=x("yKVA"),ve=x("879j"),j=x("5NDa"),ee=x("5rEg"),W=x("q1tI"),se=x.n(W),P=x("O2Wb"),I=x.n(P),le=ee.a.TextArea,z=function(V){Object(ye.a)(B,V);var q=Object(ve.a)(B);function B(){return Object(ae.a)(this,B),q.apply(this,arguments)}return Object(we.a)(B,[{key:"render",value:function(){var ie=this,pe=this.props,Ne=pe.index,ue=pe.onAnswerChange,K=pe.addChildAnswer,v=pe.exerciseIsPublish,re=pe.answers,X=pe.activeOptionErrorIndex,fe=pe.flex,A=fe===void 0?"0 0 1000px":fe;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"}},re.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 ie.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 ie.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==re.length-1?"":"hidden"}}))))})))}}]),B}(W.Component);rt.a=z},"8EBN":function(At,rt,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 ae=$.modeInfo[Pe];ae.mimes&&(ae.mime=ae.mimes[0])}$.findModeByMIME=function(we){we=we.toLowerCase();for(var ye=0;ye<$.modeInfo.length;ye++){var ve=$.modeInfo[ye];if(ve.mime==we)return ve;if(ve.mimes){for(var j=0;j<ve.mimes.length;j++)if(ve.mimes[j]==we)return ve}}if(/\+xml$/.test(we))return $.findModeByMIME("application/xml");if(/\+json$/.test(we))return $.findModeByMIME("application/json")},$.findModeByExtension=function(we){we=we.toLowerCase();for(var ye=0;ye<$.modeInfo.length;ye++){var ve=$.modeInfo[ye];if(ve.ext){for(var j=0;j<ve.ext.length;j++)if(ve.ext[j]==we)return ve}}},$.findModeByFileName=function(we){for(var ye=0;ye<$.modeInfo.length;ye++){var ve=$.modeInfo[ye];if(ve.file&&ve.file.test(we))return ve}var j=we.lastIndexOf("."),ee=j>-1&&we.substring(j+1,we.length);if(ee)return $.findModeByExtension(ee)},$.findModeByName=function(we){we=we.toLowerCase();for(var ye=0;ye<$.modeInfo.length;ye++){var ve=$.modeInfo[ye];if(ve.name.toLowerCase()==we)return ve;if(ve.alias){for(var j=0;j<ve.alias.length;j++)if(ve.alias[j].toLowerCase()==we)return ve}}}})},"8hTe":function(At,rt,x){At.exports={button:"button___1wy9m"}},"9Bee":function(At,rt,x){"use strict";var $=x("DYRE"),Pe=x("zeV3"),ae=x("+L6B"),we=x("2/Rp"),ye=x("k1fw"),ve=x("9og8"),j=x("tJVT"),ee=x("WmNS"),W=x.n(ee),se=x("q1tI"),P=x.n(se),I=x("vg9a"),le=x("DlQD"),z=x.n(le),V=x("rUJ1");function q(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),Te=N[0];return Te.length>=u.length?d.slice(u.length):d}).join(`
|
|
`)}var B=[],he=["<ul>"],ie=new z.a.Renderer,pe=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function Ne(){B.length=0,he=["<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,he),he.push("</ul>"),he.join("")}var re={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=q(u,a[3]||""),c=a[2]?a[2].trim():a[2];if(["latex","katex","math"].indexOf(c)>=0){var N=A(),Te=d;d=N,b[N]={type:"block",expression:Te}}return{type:"code",raw:u,lang:c,text:d}}}},X=/(?:\${2})([^\n`]+?)(?:\${2})/gi,fe=0,A=function(){return"__special_katext_id_".concat(fe++,"__")},b={};function U(){return b}function D(){fe=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=ie.listitem;ie.listitem=function(h){return G(k(h))};var de=ie.paragraph;ie.paragraph=function(h){return de(k(h))};var Y=ie.tablecell;ie.tablecell=function(h,o){return Y(k(h),o)},ie.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>"},ie.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:re,renderer:ie});var xe=z.a,S=x("SJMd"),g=x("ulZh"),J=x.n(g),Ae=x("m3rI"),ke=x("Oy/b"),Ke=x("p5ED"),it=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 Ie(h,o){function a(){this.constructor=h}_e(h,o),h.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function Re(h,o,a,u){return new(a||(a=Promise))(function(d,c){function N(bt){try{Je(u.next(bt))}catch(ne){c(ne)}}function Te(bt){try{Je(u.throw(bt))}catch(ne){c(ne)}}function Je(bt){var ne;bt.done?d(bt.value):(ne=bt.value,ne instanceof a?ne:new a(function(H){H(ne)})).then(N,Te)}Je((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:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function Te(Je){return function(bt){return function(ne){if(a)throw new TypeError("Generator is already executing.");for(;N;)try{if(a=1,u&&(d=2&ne[0]?u.return:ne[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,ne[1])).done)return d;switch(u=0,d&&(ne=[2&ne[0],d.value]),ne[0]){case 0:case 1:d=ne;break;case 4:return N.label++,{value:ne[1],done:!1};case 5:N.label++,u=ne[1],ne=[0];continue;case 7:ne=N.ops.pop(),N.trys.pop();continue;default:if(!(d=N.trys,(d=d.length>0&&d[d.length-1])||ne[0]!==6&&ne[0]!==2)){N=0;continue}if(ne[0]===3&&(!d||ne[1]>d[0]&&ne[1]<d[3])){N.label=ne[1];break}if(ne[0]===6&&N.label<d[1]){N.label=d[1],d=ne;break}if(d&&N.label<d[2]){N.label=d[2],N.ops.push(ne);break}d[2]&&N.ops.pop(),N.trys.pop();continue}ne=o.call(h,N)}catch(H){ne=[6,H],u=0}finally{a=d=0}if(5&ne[0])throw ne[1];return{value:ne[0]?ne[1]:void 0,done:!0}}([Je,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,Te=c.length;N<Te;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],Te=c[1];o.setAttribute(N,Te)}},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,Te){var Je=document.createElementNS("http://www.w3.org/2000/svg","marker");return h.setAttributes(Je,[["id",o],["orient",a],["markerWidth",u.toString()],["markerHeight",d.toString()],["refX",c.toString()],["refY",N.toString()]]),Je.appendChild(Te),Je},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}(),Ue=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}(),lt=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 Te=document.createElementNS("http://www.w3.org/2000/svg","svg");Te.setAttribute("xmlns","http://www.w3.org/2000/svg"),Te.setAttribute("width",a.width.baseVal.valueAsString),Te.setAttribute("height",a.height.baseVal.valueAsString),Te.setAttribute("viewBox","0 0 "+a.viewBox.baseVal.width.toString()+" "+a.viewBox.baseVal.height.toString()),Te.innerHTML=a.innerHTML,d.naturalSize===!0?(Te.width.baseVal.value=o.naturalWidth,Te.height.baseVal.value=o.naturalHeight):d.width!==void 0&&d.height!==void 0&&(Te.width.baseVal.value=d.width,Te.height.baseVal.value=d.height),N.width=Te.width.baseVal.value,N.height=Te.height.baseVal.value;var Je=Te.outerHTML,bt=N.getContext("2d");d.markersOnly!==!0&&bt.drawImage(o,0,0,N.width,N.height);var ne=window.URL,H=new Image(N.width,N.height);H.setAttribute("crossOrigin","anonymous");var Se=new Blob([Je],{type:"image/svg+xml"}),ht=ne.createObjectURL(Se);H.onload=function(){bt.drawImage(H,0,0),ne.revokeObjectURL(ht);var st=N.toDataURL(d.imageType,d.imageQuality);c(st)},H.src=ht})},h}(),St=function(){},qe=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 Ye("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ye("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Ye("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new me("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new me("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}(),Ye=function(h,o){this.selector=h,this.style=o},me=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 me("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 me("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new me("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new me("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 me("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var o=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new me("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 me("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new me("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Ye("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Ye("."+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}(),Fe=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 me("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 me("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new me("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new me("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new me("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 me("toolbox-panel-row_colors",`
|
|
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new me("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 me("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new me("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Ye("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Ye("."+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 Te=document.createElement("div");Te.className=d.toolboxButtonStyleClass.name+" "+((N=d.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&N!==void 0?N:d.toolboxButtonStyleColorsClass.name),Te.innerHTML=c.icon,Te.title=c.title,Te.addEventListener("click",function(){d.panelButtonClick(c)}),d.panelButtons.push(Te),d.buttonRow.appendChild(Te)}),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 Te,Je;c.className=a.toolboxButtonStyleClass.name+" "+(N===u?""+((Te=a.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Te!==void 0?Te:a.toolboxActiveButtonStyleColorsClass.name):""+((Je=a.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Je!==void 0?Je:a.toolboxButtonStyleColorsClass.name))})},h}(),Xe=function(h,o){this.title=h,this.icon=o},We=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 Ie(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 Te=document.createElement("div");return Te.style.display="inline-block",Te.style.width=c-2+"px",Te.style.height=c-2+"px",Te.style.backgroundColor=a,Te.style.borderRadius=c/2+"px",a==="transparent"&&(Te.style.fill=this.uiStyleSettings.toolboxAccentColor,Te.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(Te),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}(Xe),je=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}(),Me=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}(),ot=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}(),et=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 Ie(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 Me,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,Te=this.height+this.CB_DISTANCE-a/2,Je=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,Je,d),this.positionGrip(this.controlGrips.centerLeft.visual,u,N),this.positionGrip(this.controlGrips.centerRight.visual,Je,N),this.positionGrip(this.controlGrips.bottomLeft.visual,u,Te),this.positionGrip(this.controlGrips.bottomCenter.visual,c,Te),this.positionGrip(this.controlGrips.bottomRight.visual,Je,Te),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:ot.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ot.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(ot.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,u.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ot.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}(je),ut=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 Ie(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}(et),kt=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 Ie(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 Te=document.createElement("div");Te.style.minHeight="20px",Te.style.flexGrow="2",Te.style.display="flex",Te.style.alignItems="center";var Je=document.createElement("hr");Je.style.minWidth="20px",Je.style.border="0px",Je.style.borderTop=d+"px solid "+a.uiStyleSettings.toolboxColor,Je.style.flexGrow="2",Te.appendChild(Je),c.appendChild(Te),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}(Xe),Ct=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 Ie(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 Te=`<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=Te,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}(Xe),ft=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 We("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new kt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new Ct("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return Ie(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}(ut),ge=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},wt=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 Ie(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}(je),ct=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 We("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new kt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new Ct("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return Ie(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}(wt),be=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 Ie(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 Te=document.createElement("div");Te.style.whiteSpace="nowrap",Te.style.overflow="hidden",Te.style.textOverflow="ellipsis",Te.innerHTML="The quick brown fox jumps over the lazy dog",N.appendChild(Te),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}(Xe),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 We("Color",d.defaultColorSet,d.defaultColor),c.colorPanel.onColorChanged=c.setColor,c.fontFamilyPanel=new be("Font",d.defaultFontFamilies,d.defaultFontFamily),c.fontFamilyPanel.onFontChanged=c.setFont,c}return Ie(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}(et),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 We("Color",d.defaultColorSet,d.defaultColor),c.colorPanel.onColorChanged=c.setColor,c.lineWidthPanel=new kt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.lineWidthPanel.onWidthChanged=c.setLineWidth,c}return Ie(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],Te=u[3],Je=!1,bt=0;bt<this.canvasElement.height;bt++)for(var ne=0;ne<this.canvasElement.width;ne++)a.data[bt*this.canvasElement.width*4+4*ne+3]>0&&(Je=!0,bt<c&&(c=bt),ne<d&&(d=ne),bt>Te&&(Te=bt),ne>N&&(N=ne));if(Je){this.left=d/this.pixelRatio,this.top=c/this.pixelRatio,this.width=(N-d)/this.pixelRatio,this.height=(Te-c)/this.pixelRatio;var H=document.createElement("canvas");H.width=N-d,H.height=Te-c,H.getContext("2d").putImageData(this.canvasContext.getImageData(d,c,N-d,Te-c),0,0),this.drawingImgUrl=H.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}(et),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 Ie(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(Te){var Je="both";switch(Te){case 0:Je="both";break;case 1:Je="start";break;case 2:Je="end";break;case 3:Je="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=Je===c.currentType?c.uiStyleSettings.toolboxAccentColor:"transparent",bt.addEventListener("click",function(){a.setCurrentType(Je,bt)}),u.appendChild(bt),Je==="both"||Je==="start"){var ne=document.createElement("div");ne.style.display="flex",ne.style.alignItems="center",ne.style.minHeight="20px",ne.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>`,ne.style.marginLeft="5px",bt.appendChild(ne)}var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.minHeight="20px",H.style.flexGrow="2";var Se=document.createElement("hr");if(Se.style.minWidth="20px",Se.style.border="0px",Se.style.borderTop="3px solid "+(c.uiStyleSettings!==void 0?c.uiStyleSettings.toolboxColor:"#eeeeee"),Se.style.flexGrow="2",H.appendChild(Se),bt.appendChild(H),Je==="both"||Je==="end"){var ht=document.createElement("div");ht.style.display="flex",ht.style.alignItems="center",ht.style.minHeight="20px",ht.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>`,ht.style.marginRight="5px",bt.appendChild(ht)}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}(Xe),L=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 Ie(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}(ct),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 We("Color",d.defaultColorSet,d.defaultFillColor),c.fillPanel.onColorChanged=c.setFillColor,c}return Ie(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}(ut),C=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 Ie(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}(Xe),_=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 We("Color",d.defaultColorSet,c.fillColor),c.fillPanel.onColorChanged=c.setFillColor,c.opacityPanel=new C("Opacity",d.defaultOpacitySteps,c.opacity),c.opacityPanel.onOpacityChanged=c.setOpacity,c}return Ie(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 We("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 We("Fill color",d.defaultColorSet,c.bgColor,E),c.bgColorPanel.onColorChanged=c.setBgColor,c.fontFamilyPanel=new be("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 Ie(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 We("Line color",Z(d.defaultColorSet,["transparent"]),d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.fillPanel=new We("Fill color",Z(d.defaultColorSet,["transparent"]),c.fillColor,E),c.fillPanel.onColorChanged=c.setFillColor,c.strokeWidthPanel=new kt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new Ct("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c.opacityPanel=new C("Opacity",d.defaultOpacitySteps,c.opacity),c.opacityPanel.onOpacityChanged=c.setOpacity,c}return Ie(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}(et),ce=function(h){function o(a,u,d){return h.call(this,a,u,d)||this}return Ie(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}(ct),Ve=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 Ie(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),Ze=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}(),He=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 We("Line color",d.defaultColorSet,d.defaultColor),c.strokePanel.onColorChanged=c.setStrokeColor,c.strokeWidthPanel=new kt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),c.strokeWidthPanel.onWidthChanged=c.setStrokeWidth,c.strokeStylePanel=new Ct("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),c.strokeStylePanel.onStyleChanged=c.setStrokeDasharray,c}return Ie(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}(wt),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 Ie(o,h),o}(mt),$e=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 Ie(o,h),o}(mt),Ut=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 ge,this._isOpen=!1,this.undoRedoManager=new Ze,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 Ut,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=h.instanceCounter++,this.styles=new qe(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[ft,R,L,Ee,Ve,F,_,te,ce,y,ct,He]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ft,R,L,Ee,F,_,te]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ft,R,L,Ee,_]},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(),Ue.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},h.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&St.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=St.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(a){return a(new mt(o))})},h.prototype.render=function(){return Re(this,void 0,void 0,function(){var o;return Oe(this,function(a){switch(a.label){case 0:return this.setCurrentMarker(),(o=new lt).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 Fe(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 $e(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 $e(o,u))})}}},h.prototype.clear=function(){var o=this,a=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(N){var Te=new $e(o,void 0,!0);N(Te),Te.defaultPrevented&&(a=!0)}),!a)){this.setCurrentMarker();for(var u=function(N){var Te=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(Je){return Je(new $e(o,Te))})},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 Re(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 $e(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 $e(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 $e(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 $e(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 $e(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){Ue.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 Bt=function(h,o){return(Bt=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}Bt(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{Je(u.next(bt))}catch(ne){c(ne)}}function Te(bt){try{Je(u.throw(bt))}catch(ne){c(ne)}}function Je(bt){var ne;bt.done?d(bt.value):(ne=bt.value,ne instanceof a?ne:new a(function(H){H(ne)})).then(N,Te)}Je((u=u.apply(h,o||[])).next())})}function Ht(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:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function Te(Je){return function(bt){return function(ne){if(a)throw new TypeError("Generator is already executing.");for(;N;)try{if(a=1,u&&(d=2&ne[0]?u.return:ne[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,ne[1])).done)return d;switch(u=0,d&&(ne=[2&ne[0],d.value]),ne[0]){case 0:case 1:d=ne;break;case 4:return N.label++,{value:ne[1],done:!1};case 5:N.label++,u=ne[1],ne=[0];continue;case 7:ne=N.ops.pop(),N.trys.pop();continue;default:if(!(d=N.trys,(d=d.length>0&&d[d.length-1])||ne[0]!==6&&ne[0]!==2)){N=0;continue}if(ne[0]===3&&(!d||ne[1]>d[0]&&ne[1]<d[3])){N.label=ne[1];break}if(ne[0]===6&&N.label<d[1]){N.label=d[1],d=ne;break}if(d&&N.label<d[2]){N.label=d[2],N.ops.push(ne);break}d[2]&&N.ops.pop(),N.trys.pop();continue}ne=o.call(h,N)}catch(H){ne=[6,H],u=0}finally{a=d=0}if(5&ne[0])throw ne[1];return{value:ne[0]?ne[1]:void 0,done:!0}}([Je,bt])}}}var Ft=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}(),ze=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],Te=c[1];o.setAttribute(N,Te)}},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,Te){var Je=document.createElementNS("http://www.w3.org/2000/svg","marker");return h.setAttributes(Je,[["id",o],["orient",a],["markerWidth",u.toString()],["markerHeight",d.toString()],["refX",c.toString()],["refY",N.toString()]]),Je.appendChild(Te),Je},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,Te,Je){return"M"+o+","+a+"V"+(a+d)+"H"+(o+u)+"V"+a+"H"+c+"V"+N+"H"+(c+Te)+"V"+(N+Je)+"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 _t("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new _t("_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},_t=function(h,o){this.localName=h,this.style=o},$t=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}(),Gt=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}(),an=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}(Gt),zt=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}(Gt),Yt=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}(),Lt=function(){function h(){}return h.getIcon=function(o,a){if(o>0&&a>0){var u=new Yt(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 Te=ze.createDefs();N.appendChild(Te);var Je=ze.createElement("clipPath",[["id","text-bg-clip"]]);Te.appendChild(Je);var bt=ze.createPath(ze.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 ne=ze.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ne.appendChild(ze.createTSpan(o+":"+a)),N.appendChild(ne);var H=ne.getBBox();ze.setAttributes(ne,[["x",((24-H.width)/2).toString()],["y",((24-H.height)/2-H.y).toString()]]);var Se=ze.createPath(ze.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(H.width))/2,(24-Math.ceil(H.height))/2,Math.ceil(H.width),Math.ceil(H.height)));return Je.appendChild(Se),ze.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}(zt),Pt=function(){function h(o,a){this.GRIP_SIZE=10,this.color=o,this.fillColor=a,this.visual=ze.createGroup(),this.visual.appendChild(ze.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ze.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 ze.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&&ze.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=ze.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=ze.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var a=0;a<this.numberOfGridLines;a++)this.horizontalGridLines.push(ze.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(ze.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=ze.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(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),ze.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 Te=a.y+u*(N+1);ze.setAttributes(c,[["x1",""+a.x],["y1",""+Te],["x2",""+(a.x+a.width)],["y2",""+Te]])});var d=a.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(c,N){var Te=a.x+d*(N+1);ze.setAttributes(c,[["x1",""+Te],["y1",""+a.y],["x2",""+Te],["y2",""+(a.y+a.height)]])}),ze.setAttributes(this.cropShadeElement,[["d",ze.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 Te=u/o,Je=d/a;return{x:(c.x-N)*Te+N,y:(c.y-N)*Je+N,width:c.width*Te,height:c.height*Je}},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}(),Xn=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();ze.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=ze.createPath(a);var c=ze.createTransform();this.scaleShape.transform.baseVal.appendItem(c),o.appendChild(this.scaleShape),this.angleLabelElement=ze.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=ze.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var N=ze.createTSpan("");return N.innerHTML="°",this.angleLabelElement.appendChild(N),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},h}(),oi=function(){function h(){this.naturalSize=!1,this.imageType="image/png"}return h.prototype.rasterize=function(o,a,u,d,c,N,Te){var Je=this;return new Promise(function(bt){var ne=document.createElement("canvas");ne.width=o.width.baseVal.value-2*d,ne.height=o.height.baseVal.value-2*d;var H=1,Se=1;Je.naturalSize===!0?(H=a.naturalWidth/(o.width.baseVal.value-2*d)/N,Se=a.naturalHeight/(o.height.baseVal.value-2*d)/Te,ne.width=a.naturalWidth/N,ne.height=a.naturalHeight/Te):Je.width!==void 0&&Je.height!==void 0&&(H=Je.width/u.width,Se=Je.height/u.height,ne.width*=H,ne.height*=Se);var ht=ne.getContext("2d");ht.translate(ne.width/2,ne.height/2),ht.rotate(c*Math.PI/180),ht.scale(N,Te),ht.translate(-ne.width/2,-ne.height/2),ht.drawImage(a,0,0,ne.width,ne.height);var st=document.createElement("canvas");st.width=u.width*H,st.height=u.height*Se,st.getContext("2d").putImageData(ht.getImageData((u.x-d)*H,(u.y-d)*Se,u.width*H,u.height*Se),0,0),bt(st.toDataURL(Je.imageType,Je.imageQuality))})},h}(),Le=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",ze.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();ze.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=ze.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=ze.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=ze.createGroup(),this.editingTargetRotationScaleContainer=ze.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var o=ze.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(o);var a=ze.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(a),this.editingTargetContainer=ze.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=ze.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 $t,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 an;a.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(a);var u=[];this.aspectRatios.forEach(function(Se){var ht=new zt(Lt.getIcon(Se.horizontal,Se.vertical),Se.horizontal===0&&Se.vertical===0?"FREE":Se.horizontal+":"+Se.vertical);ht.onClick=function(){return o.ratioButtonClicked(Se)},u.push(ht)}),this.aspectRatioButton=new qt(Lt.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 zt('<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 zt('<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),!Ft.isLicensed){var N=new gt;this.topToolbar.addElementBlock(N);var Te=document.createElement("div");Te.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Je=document.createElement("a");Je.style.color="currentColor",Je.href="https://markerjs.com/products/cropro",Je.target="_blank",Je.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>',Te.appendChild(Je),N.addElement(Te)}var bt=new an;bt.minWidth=3*this.toolbarHeight+"px",bt.contentAlign="end",this.topToolbar.addButtonBlock(bt);var ne=new zt('<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");ne.onClick=this.startRenderAndClose,bt.addButton(ne),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ne.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var H=new zt('<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");H.onClick=this.close,bt.addButton(H),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(H.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},h.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new $t,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 an;a.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(a);var u=new zt('<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 zt('<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 Xn("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 an;N.minWidth=2*this.toolbarHeight+"px",N.contentAlign="end",this.bottomToolbar.addButtonBlock(N);var Te=new zt('<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");Te.onClick=this.flipHorizontallyButtonClicked,N.addButton(Te);var Je=new zt('<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");Je.onClick=this.flipVerticallyButtonClicked,N.addButton(Je)},h.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},h.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Lt.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 Yt(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 Ht(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 Ht(this,function(a){switch(a.label){case 0:return(o=new oi).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),ze.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 _t("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 _t("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new _t("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new _t("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 _t("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new _t("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 _t("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 _t("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new _t("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 _t("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 _t("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},h.instanceCounter=0,h}(),Qe=x("8hTe"),sn=x.n(Qe),fn=/<pre[^>]*>/g;function vn(h){var o=document.createElement("div");return o.innerHTML=h,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var xn=rt.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,Te=h.showLines,Je=h.replaces,bt=h.zoomImg,ne=h.hasMask,H=h.style,Se=H===void 0?{}:H,ht=h.stylesPrev,st=ht===void 0?{}:ht,at=String(a),Rt=Object(se.useRef)(),Qt=Object(se.useRef)(),pn=Object(se.useState)(""),cn=Object(j.a)(pn,2),ln=cn[0],mn=cn[1],En=Object(se.useState)("office"),Ln=Object(j.a)(En,2),ti=Ln[0],wn=Ln[1],Mn=function(){var en=new Le(Qt.current);en.displayMode="popup",en.addRenderEventListener(function(){var Bn=Object(ve.a)(W.a.mark(function Zt(Rn){var rn;return W.a.wrap(function(Sn){for(;;)switch(Sn.prev=Sn.next){case 0:return Rt.current.style.display="none",Sn.next=3,Object(it.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Rn}});case 3:rn=Sn.sent,rn!=null&&rn.id&&Je(Qt.current.getAttribute("src").replace(Ae.a.API_SERVER,""),"/api/attachments/".concat(rn==null?void 0:rn.id,"?type=").concat(rn.content_type));case 5:case"end":return Sn.stop()}},Zt)}));return function(Zt){return Bn.apply(this,arguments)}}()),en.show()},mi=function(){var en=new Mt(Qt.current);en.settings.displayMode="popup",en.addEventListener("render",function(){var Bn=Object(ve.a)(W.a.mark(function Zt(Rn){var rn;return W.a.wrap(function(Sn){for(;;)switch(Sn.prev=Sn.next){case 0:if(Rt.current.style.display="none",!Qt.current){Sn.next=6;break}return Sn.next=4,Object(it.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Rn.dataUrl}});case 4:rn=Sn.sent,rn!=null&&rn.id&&Je(Qt.current.getAttribute("src").replace(Ae.a.API_SERVER,""),"/api/attachments/".concat(rn==null?void 0:rn.id,"?type=").concat(rn.content_type));case 6:case"end":return Sn.stop()}},Zt)}));return function(Zt){return Bn.apply(this,arguments)}}()),en.show(),window.markerArea=en},Kn=Object(se.useMemo)(function(){try{var Cn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,en=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Bn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;at=at.replace(Cn,"("+Ae.a.API_SERVER+"/api/attachments/").replace(en,'"'+Ae.a.API_SERVER+"/api/attachments/").replace(Bn,'"'+Ae.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,`
|
|
`),at=at.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(gi){}var Zt=xe(at),Rn=U();if(at.match(/\[TOC\]/)&&(Zt=Zt.replace("<p>[TOC]</p>",v()),Ne()),Zt=Zt.replace(/(__special_katext_id_\d+__)/g,function(gi,Sn){var $n=Rn[Sn],Xi=$n.type,Ki=$n.expression;return Object(ke.renderToString)(vn(Ki)||"",{displayMode:Xi==="block",throwOnError:!1,output:"html"})}),Zt=Zt.replace(/▁/g,"\u2581\u2581\u2581"),D(),N){var rn=document.createElement("div");return rn.innerHTML=Zt,rn.innerText}return setTimeout(function(){return Ni()},500),Zt},[at]),ai=Object(se.useRef)();ue.WebkitLineClamp=Te,Te&&(Se=Object(ye.a)(Object(ye.a)({},Se),ue));function Mi(Cn){var en=Cn.target;if(en.tagName.toUpperCase()==="IMG"){if(bt){var Bn=en.getAttribute("src");mn(Bn),wn("image")}}else if(en.tagName.toUpperCase()==="A"){var Zt=en.getAttribute("href");if(Zt.indexOf("office")>-1)Cn.preventDefault(),mn(Zt),wn("office");else if(Zt.indexOf("application/pdf")>-1)Cn.preventDefault(),mn(Zt),wn("pdf");else if(Zt.indexOf("type=text")>-1)Cn.preventDefault(),mn(Zt),wn("html");else if(Zt.startsWith("#")){Cn.preventDefault();var Rn=document.getElementById(Zt.replace("#",""));Rn&&Rn.scrollIntoView(!0)}}}var Ni=function(){var en,Bn=(en=ai.current)===null||en===void 0?void 0:en.querySelectorAll("video");Bn==null||Bn.forEach(function(Zt){if(Zt.oncontextmenu=function(){return!1},Zt.src.indexOf(".m3u8")>-1&&!Zt.canPlayType("application/vnd.apple.mpegurl")){if(J.a.isSupported()){var Rn=new J.a;Rn.loadSource(Zt.src),Rn.attachMedia(Zt)}}})};Object(se.useEffect)(function(){if(ai.current&&Kn&&(Kn.match(fn)&&window.PR.prettyPrint()),ai.current)return ai.current.addEventListener("click",Mi),function(){ai.current.removeEventListener("click",Mi),D(),Ne()}},[Kn,ai.current,Mi]);var dr=function(en){if(!d)return;en.target.nodeName==="IMG"?(Rt.current.style.display="flex",Rt.current.style.width=en.target.clientWidth+"px",Rt.current.style.height=en.target.clientHeight+"px",Rt.current.style.top=en.target.offsetTop+"px",Rt.current.style.left=en.target.offsetLeft+"px",Qt.current.src=en.target.getAttribute("src")):Rt.current.style.display="none"};return P.a.createElement("div",{style:{position:"relative"}},P.a.createElement("div",{ref:ai,style:Object(ye.a)({},Se),className:"".concat(c||""," markdown-body ").concat(sn.a.mdBody),onMouseOver:dr,dangerouslySetInnerHTML:{__html:Kn}}),P.a.createElement("div",{ref:Rt,className:sn.a.button},P.a.createElement(Pe.a,null,P.a.createElement(we.a,{onClick:function(){return Mn()}},"\u88C1\u526A"),P.a.createElement(we.a,{onClick:function(){return mi()}},"\u7F16\u8F91"))),P.a.createElement("img",{ref:Qt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),P.a.createElement(Ke.a,{close:!0,data:ln,hasMask:ne,type:ln!=null&&ln.length?ti:"",style:Object(ye.a)({},st),onClose:function(){return mn("")}}))}},"9VGf":function(At,rt,x){"use strict";x.d(rt,"a",function(){return ae});var $=x("q1tI"),Pe=x.n($);function ae(we,ye){var ve=Object($.useRef)();Object($.useEffect)(function(){ve.current=we}),Object($.useEffect)(function(){function j(){ve.current()}if(ye!==null){var ee=setInterval(j,ye);return function(){return clearInterval(ee)}}},[ye])}},Bd2K:function(At,rt,x){(function($){$(x("VrN/"),x("osHv"))})(function($){$.defineOption("autoCloseTags",!1,function(W,se,P){if(P!=$.Init&&P&&W.removeKeyMap("autoCloseTags"),!se)return;var I={name:"autoCloseTags"};(typeof se!="object"||se.whenClosing!==!1)&&(I["'/'"]=function(le){return ve(le)}),(typeof se!="object"||se.whenOpening!==!1)&&(I["'>'"]=function(le){return we(le)}),W.addKeyMap(I)});var Pe=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],ae=["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 we(W){if(W.getOption("disableInput"))return $.Pass;for(var se=W.listSelections(),P=[],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),q=$.innerMode(W.getMode(),V.state),B=q.state,he=q.mode.xmlCurrentTag&&q.mode.xmlCurrentTag(B),ie=he&&he.name;if(!ie)return $.Pass;var pe=q.mode.configuration=="html",Ne=typeof I=="object"&&I.dontCloseTags||pe&&Pe,ue=typeof I=="object"&&I.indentTags||pe&&ae;V.end>z.ch&&(ie=ie.slice(0,ie.length-V.end+z.ch));var K=ie.toLowerCase();if(!ie||V.type=="string"&&(V.end!=z.ch||!/[\"\']/.test(V.string.charAt(V.string.length-1))||V.string.length==1)||V.type=="tag"&&he.close||V.string.indexOf("/")==z.ch-V.start-1||Ne&&j(Ne,K)>-1||ee(W,q.mode.xmlCurrentContext&&q.mode.xmlCurrentContext(B)||[],ie,z,!0))return $.Pass;var v=typeof I=="object"&&I.emptyTags;if(v&&j(v,ie)>-1){P[le]={text:"/>",newPos:$.Pos(z.line,z.ch+2)};continue}var re=ue&&j(ue,K)>-1;P[le]={indent:re,text:">"+(re?`
|
|
|
|
`:"")+"</"+ie+">",newPos:re?$.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 fe=P[le];W.replaceRange(fe.text,se[le].head,se[le].anchor,"+insert");var A=W.listSelections().slice(0);A[le]={head:fe.newPos,anchor:fe.newPos},W.setSelections(A),!X&&fe.indent&&(W.indentLine(fe.newPos.line,null,!0),W.indentLine(fe.newPos.line+1,null,!0))}}function ye(W,se){for(var P=W.listSelections(),I=[],le=se?"/":"</",z=W.getOption("autoCloseTags"),V=typeof z=="object"&&z.dontIndentOnSlash,q=0;q<P.length;q++){if(!P[q].empty())return $.Pass;var B=P[q].head,he=W.getTokenAt(B),ie=$.innerMode(W.getMode(),he.state),pe=ie.state;if(se&&(he.type=="string"||he.string.charAt(0)!="<"||he.start!=B.ch-1))return $.Pass;var Ne,ue=ie.mode.name!="xml"&&W.getMode().name=="htmlmixed";if(ue&&ie.mode.name=="javascript")Ne=le+"script";else if(ue&&ie.mode.name=="css")Ne=le+"style";else{var K=ie.mode.xmlCurrentContext&&ie.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(he.end)!=">"&&(Ne+=">"),I[q]=Ne}if(W.replaceSelections(I),P=W.listSelections(),!V)for(var q=0;q<P.length;q++)(q==P.length-1||P[q].head.line<P[q+1].head.line)&&W.indentLine(P[q].head.line)}function ve(W){return W.getOption("disableInput")?$.Pass:ye(W,!0)}$.commands.closeTag=function(W){return ye(W)};function j(W,se){if(W.indexOf)return W.indexOf(se);for(var P=0,I=W.length;P<I;++P)if(W[P]==se)return P;return-1}function ee(W,se,P,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!=P)return!1;for(var q=le?1:0,B=se.length-1;B>=0&&se[B]==P;B--)++q;I=V.to;for(var B=1;B<q;B++){var he=$.scanForClosingTag(W,I,null,z);if(!he||he.tag!=P)return!1;I=he.to}return!0}})},BjJ7:function(At,rt,x){"use strict";x.d(rt,"d",function(){return Pe}),x.d(rt,"c",function(){return ae}),x.d(rt,"e",function(){return we}),x.d(rt,"b",function(){return ye}),x.d(rt,"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 ae(ee){for(var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",se=[],P=0;P<ee.length;P++){var I=ee[P],le=W?"".concat(W,"/").concat(I.name):"".concat(I.name);se.push({title:I.name,isLeaf:!(I.type==="tree"),key:le})}return se}function we(ee,W,se){for(var P=0;P<ee.length;P++){var I=ee[P];if(I.key===W){I.children=se;break}I.children&&we(I.children,W,se)}return ee}function ye(ee,W,se){var P;return function(){var I=this,le=arguments,z=function(){P=null,se||ee.apply(I,le)},V=se&&!P;clearTimeout(P),P=setTimeout(z,W),V&&ee.apply(I,le)}}var ve=!0,j=$.a.API_SERVER},"C+DQ":function(At,rt,x){},DlQD:function(At,rt,x){(function($,Pe){At.exports=Pe()})(this,function(){"use strict";function $(R,O){for(var L=0;L<O.length;L++){var y=O[L];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(R,y.key,y)}}function Pe(R,O,L){return O&&$(R.prototype,O),L&&$(R,L),R}function ae(R,O){if(!R)return;if(typeof R=="string")return we(R,O);var L=Object.prototype.toString.call(R).slice(8,-1);if(L==="Object"&&R.constructor&&(L=R.constructor.name),L==="Map"||L==="Set")return Array.from(R);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return we(R,O)}function we(R,O){(O==null||O>R.length)&&(O=R.length);for(var L=0,y=new Array(O);L<O;L++)y[L]=R[L];return y}function ye(R,O){var L;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(L=ae(R))||O&&R&&typeof R.length=="number"){L&&(R=L);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 L=R[Symbol.iterator](),L.next.bind(L)}function ve(R,O){return O={exports:{}},R(O,O.exports),O.exports}var j=ve(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 L(y){R.exports.defaults=y}R.exports={defaults:O(),getDefaults:O,changeDefaults:L}}),ee=j.defaults,W=j.getDefaults,se=j.changeDefaults,P=/[&<>"']/,I=/[&<>"']/g,le=/[<>"']|&(?!#?\w+;)/,z=/[<>"']|&(?!#?\w+;)/g,V={"&":"&","<":"<",">":">",'"':""","'":"'"},q=function(O){return V[O]};function B(R,O){if(O){if(P.test(R))return R.replace(I,q)}else if(le.test(R))return R.replace(z,q);return R}var he=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ie(R){return R.replace(he,function(O,L){return L=L.toLowerCase(),L==="colon"?":":L.charAt(0)==="#"?L.charAt(1)==="x"?String.fromCharCode(parseInt(L.substring(2),16)):String.fromCharCode(+L.substring(1)):""})}var pe=/(^|[^\[])\^/g;function Ne(R,O){R=R.source||R,O=O||"";var L={replace:function(C,_){return _=_.source||_,_=_.replace(pe,"$1"),R=R.replace(C,_),L},getRegex:function(){return new RegExp(R,O)}};return L}var ue=/[^\w:]/g,K=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function v(R,O,L){if(R){var y;try{y=decodeURIComponent(ie(L)).replace(ue,"").toLowerCase()}catch(C){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}O&&!K.test(L)&&(L=b(O,L));try{L=encodeURI(L).replace(/%25/g,"%")}catch(C){return null}return L}var re={},X=/^[^:]+:\/*[^/]*$/,fe=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(R,O){re[" "+R]||(X.test(R)?re[" "+R]=R+"/":re[" "+R]=G(R,"/",!0)),R=re[" "+R];var L=R.indexOf(":")===-1;return O.substring(0,2)==="//"?L?O:R.replace(fe,"$1")+O:O.charAt(0)==="/"?L?O:R.replace(A,"$1")+O:R+O}var U={exec:function(){}};function D(R){for(var O=1,L,y;O<arguments.length;O++){L=arguments[O];for(y in L)Object.prototype.hasOwnProperty.call(L,y)&&(R[y]=L[y])}return R}function k(R,O){var L=R.replace(/\|/g,function(_,E,te){for(var F=!1,ce=E;--ce>=0&&te[ce]==="\\";)F=!F;return F?"|":" |"}),y=L.split(/ \|/),C=0;if(y.length>O)y.splice(O);else for(;y.length<O;)y.push("");for(;C<y.length;C++)y[C]=y[C].trim().replace(/\\\|/g,"|");return y}function G(R,O,L){var y=R.length;if(y===0)return"";for(var C=0;C<y;){var _=R.charAt(y-C-1);if(_===O&&!L)C++;else if(_!==O&&L)C++;else break}return R.substr(0,y-C)}function de(R,O){if(R.indexOf(O[1])===-1)return-1;for(var L=R.length,y=0,C=0;C<L;C++)if(R[C]==="\\")C++;else if(R[C]===O[0])y++;else if(R[C]===O[1]&&(y--,y<0))return C;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 xe={escape:B,unescape:ie,edit:Ne,cleanUrl:v,resolveUrl:b,noopTest:U,merge:D,splitCells:k,rtrim:G,findClosingBracket:de,checkSanitizeDeprecation:Y},S=j.defaults,g=xe.rtrim,J=xe.splitCells,Ae=xe.escape,ke=xe.findClosingBracket;function Ke(R,O,L){var y=O.href,C=O.title?Ae(O.title):null,_=R[1].replace(/\\([\[\]])/g,"$1");return R[0].charAt(0)!=="!"?{type:"link",raw:L,href:y,title:C,text:_}:{type:"image",raw:L,href:y,title:C,text:Ae(_)}}function it(R,O){var L=R.match(/^(\s+)(?:```)/);if(L===null)return O;var y=L[1];return O.split(`
|
|
`).map(function(C){var _=C.match(/^\s+/);if(_===null)return C;var E=_[0];return E.length>=y.length?C.slice(y.length):C}).join(`
|
|
`)}var _e=function(){function R(L){this.options=L||S}var O=R.prototype;return O.space=function(y){var C=this.rules.block.newline.exec(y);if(C)return C[0].length>1?{type:"space",raw:C[0]}:{raw:`
|
|
`}},O.code=function(y,C){var _=this.rules.block.code.exec(y);if(_){var E=C[C.length-1];if(E&&E.type==="paragraph")return{raw:_[0],text:_[0].trimRight()};var te=_[0].replace(/^ {4}/gm,"");return{type:"code",raw:_[0],codeBlockStyle:"indented",text:this.options.pedantic?te:g(te,`
|
|
`)}}},O.fences=function(y){var C=this.rules.block.fences.exec(y);if(C){var _=C[0],E=it(_,C[3]||"");return{type:"code",raw:_,lang:C[2]?C[2].trim():C[2],text:E}}},O.heading=function(y){var C=this.rules.block.heading.exec(y);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},O.nptable=function(y){var C=this.rules.block.nptable.exec(y);if(C){var _={type:"table",header:J(C[1].replace(/^ *| *\| *$/g,"")),align:C[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:C[3]?C[3].replace(/\n$/,"").split(`
|
|
`):[],raw:C[0]};if(_.header.length===_.align.length){var E=_.align.length,te;for(te=0;te<E;te++)/^ *-+: *$/.test(_.align[te])?_.align[te]="right":/^ *:-+: *$/.test(_.align[te])?_.align[te]="center":/^ *:-+ *$/.test(_.align[te])?_.align[te]="left":_.align[te]=null;for(E=_.cells.length,te=0;te<E;te++)_.cells[te]=J(_.cells[te],_.header.length);return _}}},O.hr=function(y){var C=this.rules.block.hr.exec(y);if(C)return{type:"hr",raw:C[0]}},O.blockquote=function(y){var C=this.rules.block.blockquote.exec(y);if(C){var _=C[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:C[0],text:_}}},O.list=function(y){var C=this.rules.block.list.exec(y);if(C){for(var _=C[0],E=C[2],te=E.length>1,F=E[E.length-1]===")",ce={type:"list",raw:_,ordered:te,start:te?+E.slice(0,-1):"",loose:!1,items:[]},Ve=C[0].match(this.rules.block.item),Ze=!1,He,mt,Ot,$e,Ut,Mt,Bt,Nt=Ve.length,vt=0;vt<Nt;vt++)He=Ve[vt],_=He,mt=He.length,He=He.replace(/^ *([*+-]|\d+[.)]) */,""),~He.indexOf(`
|
|
`)&&(mt-=He.length,He=this.options.pedantic?He.replace(/^ {1,4}/gm,""):He.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),vt!==Nt-1&&(Ot=this.rules.block.bullet.exec(Ve[vt+1])[0],(te?Ot.length===1||!F&&Ot[Ot.length-1]===")":Ot.length>1||this.options.smartLists&&Ot!==E)&&($e=Ve.slice(vt+1).join(`
|
|
`),ce.raw=ce.raw.substring(0,ce.raw.length-$e.length),vt=Nt-1)),Ut=Ze||/\n\n(?!\s*$)/.test(He),vt!==Nt-1&&(Ze=He.charAt(He.length-1)===`
|
|
`,Ut||(Ut=Ze)),Ut&&(ce.loose=!0),Mt=/^\[[ xX]\] /.test(He),Bt=void 0,Mt&&(Bt=He[1]!==" ",He=He.replace(/^\[[ xX]\] +/,"")),ce.items.push({type:"list_item",raw:_,task:Mt,checked:Bt,loose:Ut,text:He});return ce}},O.html=function(y){var C=this.rules.block.html.exec(y);if(C)return{type:this.options.sanitize?"paragraph":"html",raw:C[0],pre:!this.options.sanitizer&&(C[1]==="pre"||C[1]==="script"||C[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(C[0]):Ae(C[0]):C[0]}},O.def=function(y){var C=this.rules.block.def.exec(y);if(C){C[3]&&(C[3]=C[3].substring(1,C[3].length-1));var _=C[1].toLowerCase().replace(/\s+/g," ");return{tag:_,raw:C[0],href:C[2],title:C[3]}}},O.table=function(y){var C=this.rules.block.table.exec(y);if(C){var _={type:"table",header:J(C[1].replace(/^ *| *\| *$/g,"")),align:C[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:C[3]?C[3].replace(/\n$/,"").split(`
|
|
`):[]};if(_.header.length===_.align.length){_.raw=C[0];var E=_.align.length,te;for(te=0;te<E;te++)/^ *-+: *$/.test(_.align[te])?_.align[te]="right":/^ *:-+: *$/.test(_.align[te])?_.align[te]="center":/^ *:-+ *$/.test(_.align[te])?_.align[te]="left":_.align[te]=null;for(E=_.cells.length,te=0;te<E;te++)_.cells[te]=J(_.cells[te].replace(/^ *\| *| *\| *$/g,""),_.header.length);return _}}},O.lheading=function(y){var C=this.rules.block.lheading.exec(y);if(C)return{type:"heading",raw:C[0],depth:C[2].charAt(0)==="="?1:2,text:C[1]}},O.paragraph=function(y){var C=this.rules.block.paragraph.exec(y);if(C)return{type:"paragraph",raw:C[0],text:C[1].charAt(C[1].length-1)===`
|
|
`?C[1].slice(0,-1):C[1]}},O.text=function(y,C){var _=this.rules.block.text.exec(y);if(_){var E=C[C.length-1];return E&&E.type==="text"?{raw:_[0],text:_[0]}:{type:"text",raw:_[0],text:_[0]}}},O.escape=function(y){var C=this.rules.inline.escape.exec(y);if(C)return{type:"escape",raw:C[0],text:Ae(C[1])}},O.tag=function(y,C,_){var E=this.rules.inline.tag.exec(y);if(E)return!C&&/^<a /i.test(E[0])?C=!0:C&&/^<\/a>/i.test(E[0])&&(C=!1),!_&&/^<(pre|code|kbd|script)(\s|>)/i.test(E[0])?_=!0:_&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(E[0])&&(_=!1),{type:this.options.sanitize?"text":"html",raw:E[0],inLink:C,inRawBlock:_,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):Ae(E[0]):E[0]}},O.link=function(y){var C=this.rules.inline.link.exec(y);if(C){var _=ke(C[2],"()");if(_>-1){var E=C[0].indexOf("!")===0?5:4,te=E+C[1].length+_;C[2]=C[2].substring(0,_),C[0]=C[0].substring(0,te).trim(),C[3]=""}var F=C[2],ce="";if(this.options.pedantic){var Ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(F);Ve?(F=Ve[1],ce=Ve[3]):ce=""}else ce=C[3]?C[3].slice(1,-1):"";F=F.trim().replace(/^<([\s\S]*)>$/,"$1");var Ze=Ke(C,{href:F&&F.replace(this.rules.inline._escapes,"$1"),title:ce&&ce.replace(this.rules.inline._escapes,"$1")},C[0]);return Ze}},O.reflink=function(y,C){var _;if((_=this.rules.inline.reflink.exec(y))||(_=this.rules.inline.nolink.exec(y))){var E=(_[2]||_[1]).replace(/\s+/g," ");if(E=C[E.toLowerCase()],!E||!E.href){var te=_[0].charAt(0);return{type:"text",raw:te,text:te}}var F=Ke(_,E,_[0]);return F}},O.strong=function(y,C,_){_===void 0&&(_="");var E=this.rules.inline.strong.start.exec(y);if(E&&(!E[1]||E[1]&&(_===""||this.rules.inline.punctuation.exec(_)))){C=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(C))!=null;)if(F=this.rules.inline.strong.middle.exec(C.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,_){_===void 0&&(_="");var E=this.rules.inline.em.start.exec(y);if(E&&(!E[1]||E[1]&&(_===""||this.rules.inline.punctuation.exec(_)))){C=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(C))!=null;)if(F=this.rules.inline.em.middle.exec(C.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 C=this.rules.inline.code.exec(y);if(C){var _=C[2].replace(/\n/g," "),E=/[^ ]/.test(_),te=_.startsWith(" ")&&_.endsWith(" ");return E&&te&&(_=_.substring(1,_.length-1)),_=Ae(_,!0),{type:"codespan",raw:C[0],text:_}}},O.br=function(y){var C=this.rules.inline.br.exec(y);if(C)return{type:"br",raw:C[0]}},O.del=function(y){var C=this.rules.inline.del.exec(y);if(C)return{type:"del",raw:C[0],text:C[1]}},O.autolink=function(y,C){var _=this.rules.inline.autolink.exec(y);if(_){var E,te;return _[2]==="@"?(E=Ae(this.options.mangle?C(_[1]):_[1]),te="mailto:"+E):(E=Ae(_[1]),te=E),{type:"link",raw:_[0],text:E,href:te,tokens:[{type:"text",raw:E,text:E}]}}},O.url=function(y,C){var _;if(_=this.rules.inline.url.exec(y)){var E,te;if(_[2]==="@")E=Ae(this.options.mangle?C(_[0]):_[0]),te="mailto:"+E;else{var F;do F=_[0],_[0]=this.rules.inline._backpedal.exec(_[0])[0];while(F!==_[0]);E=Ae(_[0]),_[1]==="www."?te="http://"+E:te=E}return{type:"link",raw:_[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 C?te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):Ae(E[0]):E[0]:te=Ae(this.options.smartypants?_(E[0]):E[0]),{type:"text",raw:E[0],text:te}}},R}(),Ie=xe.noopTest,Re=xe.edit,Oe=xe.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:Ie,table:Ie,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=Re(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=Re(Z.item,"gm").replace(/bull/g,Z.bullet).getRegex(),Z.list=Re(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=Re(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=Re(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=Re(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=Re(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=Re(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:Re(`^ *(?: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:Ie,paragraph:Re(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:Ie,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:Ie,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};w._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",w.punctuation=Re(w.punctuation).replace(/punctuation/g,w._punctuation).getRegex(),w._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",w._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",w.em.start=Re(w.em.start).replace(/punctuation/g,w._punctuation).getRegex(),w.em.middle=Re(w.em.middle).replace(/punctuation/g,w._punctuation).replace(/overlapSkip/g,w._overlapSkip).getRegex(),w.em.endAst=Re(w.em.endAst,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.em.endUnd=Re(w.em.endUnd,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.strong.start=Re(w.strong.start).replace(/punctuation/g,w._punctuation).getRegex(),w.strong.middle=Re(w.strong.middle).replace(/punctuation/g,w._punctuation).replace(/blockSkip/g,w._blockSkip).getRegex(),w.strong.endAst=Re(w.strong.endAst,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.strong.endUnd=Re(w.strong.endUnd,"g").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=Re(w._blockSkip,"g").getRegex(),w.overlapSkip=Re(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=Re(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=Re(w.tag).replace("comment",Z._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=Re(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=Re(w.reflink).replace("label",w._label).getRegex(),w.reflinkSearch=Re(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:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()}),w.gfm=Oe({},w.normal,{escape:Re(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=Re(w.gfm.url,"i").replace("email",w.gfm._extended_email).getRegex(),w.breaks=Oe({},w.gfm,{br:Re(w.br).replace("{2,}","*").getRegex(),text:Re(w.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ue={block:Z,inline:w},lt=j.defaults,St=Ue.block,qe=Ue.inline;function Ye(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 me(R){var O="",L,y,C=R.length;for(L=0;L<C;L++)y=R.charCodeAt(L),Math.random()>.5&&(y="x"+y.toString(16)),O+="&#"+y+";";return O}var De=function(){function R(L){this.tokens=[],this.tokens.links=Object.create(null),this.options=L||lt,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var y={block:St.normal,inline:qe.normal};this.options.pedantic?(y.block=St.pedantic,y.inline=qe.pedantic):this.options.gfm&&(y.block=St.gfm,this.options.breaks?y.inline=qe.breaks:y.inline=qe.gfm),this.tokenizer.rules=y}R.lex=function(y,C){var _=new R(C);return _.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,_){C===void 0&&(C=[]),_===void 0&&(_=!0),y=y.replace(/^ +$/gm,"");for(var E,te,F,ce;y;){if(E=this.tokenizer.space(y)){y=y.substring(E.raw.length),E.type&&C.push(E);continue}if(E=this.tokenizer.code(y,C)){y=y.substring(E.raw.length),E.type?C.push(E):(ce=C[C.length-1],ce.raw+=`
|
|
`+E.raw,ce.text+=`
|
|
`+E.text);continue}if(E=this.tokenizer.fences(y)){y=y.substring(E.raw.length),C.push(E);continue}if(E=this.tokenizer.heading(y)){y=y.substring(E.raw.length),C.push(E);continue}if(E=this.tokenizer.nptable(y)){y=y.substring(E.raw.length),C.push(E);continue}if(E=this.tokenizer.hr(y)){y=y.substring(E.raw.length),C.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);C.push(E);continue}if(E=this.tokenizer.html(y)){y=y.substring(E.raw.length),C.push(E);continue}if(_&&(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),C.push(E);continue}if(E=this.tokenizer.lheading(y)){y=y.substring(E.raw.length),C.push(E);continue}if(_&&(E=this.tokenizer.paragraph(y))){y=y.substring(E.raw.length),C.push(E);continue}if(E=this.tokenizer.text(y,C)){y=y.substring(E.raw.length),E.type?C.push(E):(ce=C[C.length-1],ce.raw+=`
|
|
`+E.raw,ce.text+=`
|
|
`+E.text);continue}if(y){var Ve="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return C},O.inline=function(y){var C,_,E,te,F,ce,Ve=y.length;for(C=0;C<Ve;C++){ce=y[C];switch(ce.type){case"paragraph":case"text":case"heading":{ce.tokens=[],this.inlineTokens(ce.text,ce.tokens);break}case"table":{for(ce.tokens={header:[],cells:[]},te=ce.header.length,_=0;_<te;_++)ce.tokens.header[_]=[],this.inlineTokens(ce.header[_],ce.tokens.header[_]);for(te=ce.cells.length,_=0;_<te;_++)for(F=ce.cells[_],ce.tokens.cells[_]=[],E=0;E<F.length;E++)ce.tokens.cells[_][E]=[],this.inlineTokens(F[E],ce.tokens.cells[_][E]);break}case"blockquote":{this.inline(ce.tokens);break}case"list":{for(te=ce.items.length,_=0;_<te;_++)this.inline(ce.items[_].tokens);break}}}return y},O.inlineTokens=function(y,C,_,E,te){C===void 0&&(C=[]),_===void 0&&(_=!1),E===void 0&&(E=!1),te===void 0&&(te="");var F,ce=y,Ve;if(this.tokens.links){var Ze=Object.keys(this.tokens.links);if(Ze.length>0)for(;(Ve=this.tokenizer.rules.inline.reflinkSearch.exec(ce))!=null;)Ze.includes(Ve[0].slice(Ve[0].lastIndexOf("[")+1,-1))&&(ce=ce.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+ce.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ve=this.tokenizer.rules.inline.blockSkip.exec(ce))!=null;)ce=ce.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+ce.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;y;){if(F=this.tokenizer.escape(y)){y=y.substring(F.raw.length),C.push(F);continue}if(F=this.tokenizer.tag(y,_,E)){y=y.substring(F.raw.length),_=F.inLink,E=F.inRawBlock,C.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)),C.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)),C.push(F);continue}if(F=this.tokenizer.strong(y,ce,te)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],_,E),C.push(F);continue}if(F=this.tokenizer.em(y,ce,te)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],_,E),C.push(F);continue}if(F=this.tokenizer.codespan(y)){y=y.substring(F.raw.length),C.push(F);continue}if(F=this.tokenizer.br(y)){y=y.substring(F.raw.length),C.push(F);continue}if(F=this.tokenizer.del(y)){y=y.substring(F.raw.length),F.tokens=this.inlineTokens(F.text,[],_,E),C.push(F);continue}if(F=this.tokenizer.autolink(y,me)){y=y.substring(F.raw.length),C.push(F);continue}if(!_&&(F=this.tokenizer.url(y,me))){y=y.substring(F.raw.length),C.push(F);continue}if(F=this.tokenizer.inlineText(y,E,Ye)){y=y.substring(F.raw.length),te=F.raw.slice(-1),C.push(F);continue}if(y){var He="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(He);break}else throw new Error(He)}}return C},Pe(R,null,[{key:"rules",get:function(){return{block:St,inline:qe}}}]),R}(),Fe=j.defaults,Xe=xe.cleanUrl,We=xe.escape,je=function(){function R(L){this.options=L||Fe}var O=R.prototype;return O.code=function(y,C,_){var E=(C||"").match(/\S*/)[0];if(this.options.highlight){var te=this.options.highlight(y,E);te!=null&&te!==y&&(_=!0,y=te)}return E?'<pre><code class="'+this.options.langPrefix+We(E,!0)+'">'+(_?y:We(y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(_?y:We(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"+C+' id="'+this.options.headerPrefix+E.slug(_)+'">'+y+"</h"+C+`>
|
|
`:"<h"+C+">"+y+"</h"+C+`>
|
|
`},O.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},O.list=function(y,C,_){var E=C?"ol":"ul",te=C&&_!==1?' start="'+_+'"':"";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,C){return C&&(C="<tbody>"+C+"</tbody>"),`<table>
|
|
<thead>
|
|
`+y+`</thead>
|
|
`+C+`</table>
|
|
`},O.tablerow=function(y){return`<tr>
|
|
`+y+`</tr>
|
|
`},O.tablecell=function(y,C){var _=C.header?"th":"td",E=C.align?"<"+_+' align="'+C.align+'">':"<"+_+">";return E+y+"</"+_+`>
|
|
`},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=Xe(this.options.sanitize,this.options.baseUrl,y),y===null)return _;var E='<a href="'+We(y)+'"';return C&&(E+=' title="'+C+'"'),E+=">"+_+"</a>",E},O.image=function(y,C,_){if(y=Xe(this.options.sanitize,this.options.baseUrl,y),y===null)return _;var E='<img src="'+y+'" alt="'+_+'"';return C&&(E+=' title="'+C+'"'),E+=this.options.xhtml?"/>":">",E},O.text=function(y){return y},R}(),Me=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""+_},O.image=function(y,C,_){return""+_},O.br=function(){return""},R}(),Et=function(){function R(){this.seen={}}var O=R.prototype;return O.slug=function(y){var C=y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(C)){var _=C;do this.seen[_]++,C=_+"-"+this.seen[_];while(this.seen.hasOwnProperty(C))}return this.seen[C]=0,C},R}(),ot=j.defaults,et=xe.unescape,ut=function(){function R(L){this.options=L||ot,this.options.renderer=this.options.renderer||new je,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Me,this.slugger=new Et}R.parse=function(y,C){var _=new R(C);return _.parse(y)};var O=R.prototype;return O.parse=function(y,C){C===void 0&&(C=!0);var _="",E,te,F,ce,Ve,Ze,He,mt,Ot,$e,Ut,Mt,Bt,Nt,vt,Ht,Ft,ze,yt=y.length;for(E=0;E<yt;E++){$e=y[E];switch($e.type){case"space":continue;case"hr":{_+=this.renderer.hr();continue}case"heading":{_+=this.renderer.heading(this.parseInline($e.tokens),$e.depth,et(this.parseInline($e.tokens,this.textRenderer)),this.slugger);continue}case"code":{_+=this.renderer.code($e.text,$e.lang,$e.escaped);continue}case"table":{for(mt="",He="",ce=$e.header.length,te=0;te<ce;te++)He+=this.renderer.tablecell(this.parseInline($e.tokens.header[te]),{header:!0,align:$e.align[te]});for(mt+=this.renderer.tablerow(He),Ot="",ce=$e.cells.length,te=0;te<ce;te++){for(Ze=$e.tokens.cells[te],He="",Ve=Ze.length,F=0;F<Ve;F++)He+=this.renderer.tablecell(this.parseInline(Ze[F]),{header:!1,align:$e.align[F]});Ot+=this.renderer.tablerow(He)}_+=this.renderer.table(mt,Ot);continue}case"blockquote":{Ot=this.parse($e.tokens),_+=this.renderer.blockquote(Ot);continue}case"list":{for(Ut=$e.ordered,Mt=$e.start,Bt=$e.loose,ce=$e.items.length,Ot="",te=0;te<ce;te++)vt=$e.items[te],Ht=vt.checked,Ft=vt.task,Nt="",vt.task&&(ze=this.renderer.checkbox(Ht),Bt?vt.tokens.length>0&&vt.tokens[0].type==="text"?(vt.tokens[0].text=ze+" "+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=ze+" "+vt.tokens[0].tokens[0].text)):vt.tokens.unshift({type:"text",text:ze}):Nt+=ze),Nt+=this.parse(vt.tokens,Bt),Ot+=this.renderer.listitem(Nt,Ft,Ht);_+=this.renderer.list(Ot,Ut,Mt);continue}case"html":{_+=this.renderer.html($e.text);continue}case"paragraph":{_+=this.renderer.paragraph(this.parseInline($e.tokens));continue}case"text":{for(Ot=$e.tokens?this.parseInline($e.tokens):$e.text;E+1<yt&&y[E+1].type==="text";)$e=y[++E],Ot+=`
|
|
`+($e.tokens?this.parseInline($e.tokens):$e.text);_+=C?this.renderer.paragraph(Ot):Ot;continue}default:{var dt='Token with "'+$e.type+'" type was not found.';if(this.options.silent){console.error(dt);return}else throw new Error(dt)}}}return _},O.parseInline=function(y,C){C=C||this.renderer;var _="",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,C));break}case"image":{_+=C.image(te.href,te.title,te.text);break}case"strong":{_+=C.strong(this.parseInline(te.tokens,C));break}case"em":{_+=C.em(this.parseInline(te.tokens,C));break}case"codespan":{_+=C.codespan(te.text);break}case"br":{_+=C.br();break}case"del":{_+=C.del(this.parseInline(te.tokens,C));break}case"text":{_+=C.text(te.text);break}default:{var ce='Token with "'+te.type+'" type was not found.';if(this.options.silent){console.error(ce);return}else throw new Error(ce)}}}return _},R}(),kt=xe.merge,Ct=xe.checkSanitizeDeprecation,ft=xe.escape,ge=j.getDefaults,wt=j.changeDefaults,ct=j.defaults;function be(R,O,L){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"&&(L=O,O=null),O=kt({},be.defaults,O||{}),Ct(O),L){var y=O.highlight,C;try{C=De.lex(R,O)}catch(F){return L(F)}var _=function(ce){var Ve;if(!ce)try{Ve=ut.parse(C,O)}catch(Ze){ce=Ze}return O.highlight=y,ce?L(ce):L(null,Ve)};if(!y||y.length<3)return _();if(delete O.highlight,!C.length)return _();var E=0;be.walkTokens(C,function(F){F.type==="code"&&(E++,setTimeout(function(){y(F.text,F.lang,function(ce,Ve){if(ce)return _(ce);Ve!=null&&Ve!==F.text&&(F.text=Ve,F.escaped=!0),E--,E===0&&_()})},0))}),E===0&&_();return}try{var te=De.lex(R,O);return O.walkTokens&&be.walkTokens(te,O.walkTokens),ut.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>"+ft(F.message+"",!0)+"</pre>";throw F}}be.options=be.setOptions=function(R){return kt(be.defaults,R),wt(be.defaults),be},be.getDefaults=ge,be.defaults=ct,be.use=function(R){var O=kt({},R);if(R.renderer&&function(){var y=be.defaults.renderer||new je,C=function(te){var F=y[te];y[te]=function(){for(var ce=arguments.length,Ve=new Array(ce),Ze=0;Ze<ce;Ze++)Ve[Ze]=arguments[Ze];var He=R.renderer[te].apply(y,Ve);return He===!1&&(He=F.apply(y,Ve)),He}};for(var _ in R.renderer)C(_);O.renderer=y}(),R.tokenizer&&function(){var y=be.defaults.tokenizer||new _e,C=function(te){var F=y[te];y[te]=function(){for(var ce=arguments.length,Ve=new Array(ce),Ze=0;Ze<ce;Ze++)Ve[Ze]=arguments[Ze];var He=R.tokenizer[te].apply(y,Ve);return He===!1&&(He=F.apply(y,Ve)),He}};for(var _ in R.tokenizer)C(_);O.tokenizer=y}(),R.walkTokens){var L=be.defaults.walkTokens;O.walkTokens=function(y){R.walkTokens(y),L&&L(y)}}be.setOptions(O)},be.walkTokens=function(R,O){for(var L=ye(R),y;!(y=L()).done;){var C=y.value;O(C);switch(C.type){case"table":{for(var _=ye(C.tokens.header),E;!(E=_()).done;){var te=E.value;be.walkTokens(te,O)}for(var F=ye(C.tokens.cells),ce;!(ce=F()).done;)for(var Ve=ce.value,Ze=ye(Ve),He;!(He=Ze()).done;){var mt=He.value;be.walkTokens(mt,O)}break}case"list":{be.walkTokens(C.items,O);break}default:C.tokens&&be.walkTokens(C.tokens,O)}}},be.Parser=ut,be.parser=ut.parse,be.Renderer=je,be.TextRenderer=Me,be.Lexer=De,be.lexer=De.lex,be.Tokenizer=_e,be.Slugger=Et,be.parse=be;var Ee=be;return Ee})},ELLl:function(At,rt,x){(function($){$(x("VrN/"))})(function($){var Pe={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},ae=$.Pos;$.defineOption("autoCloseBrackets",!1,function(V,q,B){B&&B!=$.Init&&(V.removeKeyMap(ye),V.state.closeBrackets=null),q&&(ve(we(q,"pairs")),V.state.closeBrackets=q,V.addKeyMap(ye))});function we(V,q){return q=="pairs"&&typeof V=="string"?V:typeof V=="object"&&V[q]!=null?V[q]:Pe[q]}var ye={Backspace:W,Enter:se};function ve(V){for(var q=0;q<V.length;q++){var B=V.charAt(q),he="'"+B+"'";ye[he]||(ye[he]=j(B))}}ve(Pe.pairs+"`");function j(V){return function(q){return I(q,V)}}function ee(V){var q=V.state.closeBrackets;if(!q||q.override)return q;var B=V.getModeAt(V.getCursor());return B.closeBrackets||q}function W(V){var q=ee(V);if(!q||V.getOption("disableInput"))return $.Pass;for(var B=we(q,"pairs"),he=V.listSelections(),ie=0;ie<he.length;ie++){if(!he[ie].empty())return $.Pass;var pe=le(V,he[ie].head);if(!pe||B.indexOf(pe)%2!=0)return $.Pass}for(var ie=he.length-1;ie>=0;ie--){var Ne=he[ie].head;V.replaceRange("",ae(Ne.line,Ne.ch-1),ae(Ne.line,Ne.ch+1),"+delete")}}function se(V){var q=ee(V),B=q&&we(q,"explode");if(!B||V.getOption("disableInput"))return $.Pass;for(var he=V.listSelections(),ie=0;ie<he.length;ie++){if(!he[ie].empty())return $.Pass;var pe=le(V,he[ie].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"),he=V.listSelections();for(var ue=0;ue<he.length;ue++){var K=he[ue].head.line;V.indentLine(K,null,!0),V.indentLine(K+1,null,!0)}})}function P(V){var q=$.cmpPos(V.anchor,V.head)>0;return{anchor:new ae(V.anchor.line,V.anchor.ch+(q?-1:1)),head:new ae(V.head.line,V.head.ch+(q?1:-1))}}function I(V,q){var B=ee(V);if(!B||V.getOption("disableInput"))return $.Pass;var he=we(B,"pairs"),ie=he.indexOf(q);if(ie==-1)return $.Pass;for(var pe=we(B,"closeBefore"),Ne=we(B,"triples"),ue=he.charAt(ie+1)==q,K=V.listSelections(),v=ie%2==0,re,X=0;X<K.length;X++){var fe=K[X],A=fe.head,b,U=V.getRange(A,ae(A.line,A.ch+1));if(v&&!fe.empty())b="surround";else if((ue||!v)&&U==q)ue&&z(V,A)?b="both":Ne.indexOf(q)>=0&&V.getRange(A,ae(A.line,A.ch+3))==q+q+q?b="skipThree":b="skip";else if(ue&&A.ch>1&&Ne.indexOf(q)>=0&&V.getRange(ae(A.line,A.ch-2),A)==q+q){if(A.ch>2&&/\bstring/.test(V.getTokenTypeAt(ae(A.line,A.ch-2))))return $.Pass;b="addFour"}else if(ue){var D=A.ch==0?" ":V.getRange(ae(A.line,A.ch-1),A);if(!$.isWordChar(U)&&D!=q&&!$.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(!re)re=b;else if(re!=b)return $.Pass}var k=ie%2?he.charAt(ie-1):q,G=ie%2?q:he.charAt(ie+1);V.operation(function(){if(re=="skip")V.execCommand("goCharRight");else if(re=="skipThree")for(var de=0;de<3;de++)V.execCommand("goCharRight");else if(re=="surround"){for(var Y=V.getSelections(),de=0;de<Y.length;de++)Y[de]=k+Y[de]+G;V.replaceSelections(Y,"around"),Y=V.listSelections().slice();for(var de=0;de<Y.length;de++)Y[de]=P(Y[de]);V.setSelections(Y)}else re=="both"?(V.replaceSelection(k+G,null),V.triggerElectric(k+G),V.execCommand("goCharLeft")):re=="addFour"&&(V.replaceSelection(k+k+k+k,"before"),V.execCommand("goCharRight"))})}function le(V,q){var B=V.getRange(ae(q.line,q.ch-1),ae(q.line,q.ch+1));return B.length==2?B:null}function z(V,q){var B=V.getTokenAt(ae(q.line,q.ch+1));return/\bstring/.test(B.type)&&B.start==q.ch&&(q.ch==0||!/\bstring/.test(V.getTokenTypeAt(q)))}})},FIWC:function(At,rt,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,rt){At.exports=function($,Pe,ae,we){var ye=ae?ae.call(we,$,Pe):void 0;if(ye!==void 0)return!!ye;if($===Pe)return!0;if(typeof $!="object"||!$||typeof Pe!="object"||!Pe)return!1;var ve=Object.keys($),j=Object.keys(Pe);if(ve.length!==j.length)return!1;for(var ee=Object.prototype.hasOwnProperty.bind(Pe),W=0;W<ve.length;W++){var se=ve[W];if(!ee(se))return!1;var P=$[se],I=Pe[se];if(ye=ae?ae.call(we,P,I,se):void 0,ye===!1||ye===void 0&&P!==I)return!1}return!0}},HmJG:function(At,rt,x){},LdHM:function(At,rt,x){"use strict";x.d(rt,"b",function(){return pe}),x.d(rt,"a",function(){return ue});var $=x("1OyB"),Pe=x("vuIU"),ae=x("Ji7U"),we=x("LK+K"),ye=x("q1tI"),ve=x("rePB"),j=x("Ff2n"),ee=x("ODXe"),W=x("4IlW"),se=x("bX4T"),P=x("YrtM"),I=x("TSYQ"),le=x.n(I),z=x("+nKL"),V=x("8OUc"),q=function(J,Ae){var ke=J.prefixCls,Ke=J.id,it=J.flattenOptions,_e=J.childrenAsData,Ie=J.values,Re=J.searchValue,Oe=J.multiple,Z=J.defaultActiveFirstOption,w=J.height,Ue=J.itemHeight,lt=J.notFoundContent,St=J.open,qe=J.menuItemSelectedIcon,Ye=J.virtual,me=J.onSelect,De=J.onToggleOpen,Fe=J.onActiveValue,Xe=J.onScroll,We=J.onMouseEnter,je="".concat(ke,"-item"),Me=Object(P.a)(function(){return it},[St,it],function(Ee,R){return R[0]&&Ee[1]!==R[1]}),Et=ye.useRef(null),ot=function(R){R.preventDefault()},et=function(R){Et.current&&Et.current.scrollTo({index:R})},ut=function(R){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,L=Me.length,y=0;y<L;y+=1){var C=(R+y*O+L)%L,_=Me[C],E=_.group,te=_.data;if(!E&&!te.disabled)return C}return-1},kt=ye.useState(function(){return ut(0)}),Ct=Object(ee.a)(kt,2),ft=Ct[0],ge=Ct[1],wt=function(R){ge(R);var O=Me[R];if(!O){Fe(null,-1);return}Fe(O.data.value,R)};ye.useEffect(function(){wt(Z!==!1?ut(0):-1)},[Me.length,Re]),ye.useEffect(function(){var Ee=setTimeout(function(){if(!Oe&&St&&Ie.size===1){var R=Array.from(Ie)[0],O=Me.findIndex(function(L){var y=L.data;return y.value===R});wt(O),et(O)}});return function(){return clearTimeout(Ee)}},[St]);var ct=function(R){R!==void 0&&me(R,{selected:!Ie.has(R)}),Oe||De(!1)};if(ye.useImperativeHandle(Ae,function(){return{onKeyDown:function(R){var O=R.which;switch(O){case W.a.UP:case W.a.DOWN:{var L=0;if(O===W.a.UP?L=-1:O===W.a.DOWN&&(L=1),L!==0){var y=ut(ft+L,L);et(y),wt(y)}break}case W.a.ENTER:{var C=Me[ft];C&&!C.data.disabled?ct(C.data.value):ct(void 0),St&&R.preventDefault();break}case W.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(R){et(R)}}}),Me.length===0)return ye.createElement("div",{role:"listbox",id:"".concat(Ke,"_list"),className:"".concat(je,"-empty"),onMouseDown:ot},lt);function be(Ee){var R=Me[Ee];if(!R)return null;var O=R.data||{},L=O.value,y=O.label,C=O.children,_=Object(se.a)(O,!0),E=_e?C:y;return R?ye.createElement("div",Object.assign({"aria-label":typeof E=="string"?E:null},_,{key:Ee,role:"option",id:"".concat(Ke,"_list_").concat(Ee),"aria-selected":Ie.has(L)}),L):null}return ye.createElement(ye.Fragment,null,ye.createElement("div",{role:"listbox",id:"".concat(Ke,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(ft-1),be(ft),be(ft+1)),ye.createElement(z.a,{itemKey:"key",ref:Et,data:Me,height:w,itemHeight:Ue,fullHeight:!1,onMouseDown:ot,onScroll:Xe,virtual:Ye,onMouseEnter:We},function(Ee,R){var O,L=Ee.group,y=Ee.groupOption,C=Ee.data,_=C.label,E=C.key;if(L)return ye.createElement("div",{className:le()(je,"".concat(je,"-group"))},_!==void 0?_:E);var te=C.disabled,F=C.value,ce=C.title,Ve=C.children,Ze=C.style,He=C.className,mt=Object(j.a)(C,["disabled","value","title","children","style","className"]),Ot=Ie.has(F),$e="".concat(je,"-option"),Ut=le()(je,$e,He,(O={},Object(ve.a)(O,"".concat($e,"-grouped"),y),Object(ve.a)(O,"".concat($e,"-active"),ft===R&&!te),Object(ve.a)(O,"".concat($e,"-disabled"),te),Object(ve.a)(O,"".concat($e,"-selected"),Ot),O)),Mt=_e?Ve:_,Bt=!qe||typeof qe=="function"||Ot;return ye.createElement("div",Object.assign({},mt,{"aria-selected":Ot,className:Ut,title:ce,onMouseMove:function(){if(ft===R||te)return;wt(R)},onClick:function(){te||ct(F)},style:Ze}),ye.createElement("div",{className:"".concat($e,"-content")},Mt||F),ye.isValidElement(qe)||Ot,Bt&&ye.createElement(V.a,{className:"".concat(je,"-option-state"),customizeIcon:qe,customizeIconProps:{isSelected:Ot}},Ot?"\u2713":null))}))},B=ye.forwardRef(q);B.displayName="OptionList";var he=B,ie=function(){return null};ie.isSelectOption=!0;var pe=ie,Ne=function(){return null};Ne.isSelectOptGroup=!0;var ue=Ne,K=x("VTBJ"),v=x("Zm9Q");function re(g){var J=g.key,Ae=g.props,ke=Ae.children,Ke=Ae.value,it=Object(j.a)(Ae,["children","value"]);return Object(K.a)({key:J,value:Ke!==void 0?Ke:J,children:ke},it)}function X(g){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(v.a)(g).map(function(Ae,ke){if(!ye.isValidElement(Ae)||!Ae.type)return null;var Ke=Ae.type.isSelectOptGroup,it=Ae.key,_e=Ae.props,Ie=_e.children,Re=Object(j.a)(_e,["children"]);return J||!Ke?re(Ae):Object(K.a)(Object(K.a)({key:"__RC_SELECT_GRP__".concat(it===null?ke:it,"__"),label:it},Re),{},{options:X(Ie)})}).filter(function(Ae){return Ae})}var fe=x("2Qr1"),A=x("qNPg"),b=x("U8pU"),U=x("Kwbf"),D=x("WKfj");function k(g){var J=g.mode,Ae=g.options,ke=g.children,Ke=g.backfill,it=g.allowClear,_e=g.placeholder,Ie=g.getInputElement,Re=g.showSearch,Oe=g.onSearch,Z=g.defaultOpen,w=g.autoFocus,Ue=g.labelInValue,lt=g.value,St=g.inputValue,qe=g.optionLabelProp,Ye=J==="multiple"||J==="tags",me=Re!==void 0?Re:Ye||J==="combobox",De=Ae||X(ke);if(Object(U.a)(J!=="tags"||De.every(function(je){return!je.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),J==="tags"||J==="combobox"){var Fe=De.some(function(je){return je.options?je.options.some(function(Me){return typeof("value"in Me?Me.value:Me.key)=="number"}):typeof("value"in je?je.value:je.key)=="number"});Object(U.a)(!Fe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(U.a)(J!=="combobox"||!qe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(U.a)(J==="combobox"||!Ke,"`backfill` only works with `combobox` mode."),Object(U.a)(J==="combobox"||!Ie,"`getInputElement` only work with `combobox` mode."),Object(U.b)(J!=="combobox"||!Ie||!it||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Oe&&!me&&J!=="combobox"&&J!=="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."),lt!=null){var Xe=Object(D.d)(lt);Object(U.a)(!Ue||Xe.every(function(je){return Object(b.a)(je)==="object"&&("key"in je||"value"in je)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(U.a)(!Ye||Array.isArray(lt),"`value` should be array when `mode` is `multiple` or `tags`")}if(ke){var We=null;Object(v.a)(ke).some(function(je){if(!ye.isValidElement(je)||!je.type)return!1;var Me=je.type;if(Me.isSelectOption)return!1;if(Me.isSelectOptGroup){var Et=Object(v.a)(je.props.children).every(function(ot){return!ye.isValidElement(ot)||!je.type||ot.type.isSelectOption?!0:(We=ot.type,!1)});return!Et}return We=Me,!0}),We&&Object(U.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(U.a)(St===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var G=k,de=Object(A.a)({prefixCls:"rc-select",components:{optionList:he},convertChildrenToData:X,flattenOptions:fe.d,getLabeledValue:fe.e,filterOptions:fe.b,isValueDisabled:fe.g,findValueOption:fe.c,warningProps:G,fillOptionsWithMissingValue:fe.a}),Y=function(g){Object(ae.a)(Ae,g);var J=Object(we.a)(Ae);function Ae(){var ke;return Object($.a)(this,Ae),ke=J.apply(this,arguments),ke.selectRef=ye.createRef(),ke.focus=function(){ke.selectRef.current.focus()},ke.blur=function(){ke.selectRef.current.blur()},ke}return Object(Pe.a)(Ae,[{key:"render",value:function(){return ye.createElement(de,Object.assign({ref:this.selectRef},this.props))}}]),Ae}(ye.Component);Y.Option=pe,Y.OptGroup=ue;var xe=Y,S=rt.c=xe},M8RZ:function(At,rt,x){"use strict";x.d(rt,"a",function(){return W});var $=x("fWQN"),Pe=x("mtLc"),ae=x("yKVA"),we=x("879j"),ye=x("q1tI"),ve=x.n(ye),j=x("i8i4"),ee=x.n(j),W=function(se){Object(ae.a)(I,se);var P=Object(we.a)(I);function I(le){var z;Object($.a)(this,I),z=P.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}(ve.a.Component)},O2Wb:function(At,rt,x){At.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(At,rt,x){"use strict";var $=x("U8pU"),Pe=x("VTBJ"),ae=x("Ff2n"),we=x("q1tI"),ye=x("uciX"),ve=x("7ixt"),j=function(le){var z=le.overlay,V=le.prefixCls,q=le.id,B=le.overlayInnerStyle;return we.createElement("div",{className:"".concat(V,"-inner"),id:q,role:"tooltip",style:B},typeof z=="function"?z():z)},ee=j,W=function(le,z){var V=le.overlayClassName,q=le.trigger,B=q===void 0?["hover"]:q,he=le.mouseEnterDelay,ie=he===void 0?0:he,pe=le.mouseLeaveDelay,Ne=pe===void 0?.1:pe,ue=le.overlayStyle,K=le.prefixCls,v=K===void 0?"rc-tooltip":K,re=le.children,X=le.onVisibleChange,fe=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,de=le.destroyTooltipOnHide,Y=de===void 0?!1:de,xe=le.defaultVisible,S=le.getTooltipContainer,g=le.overlayInnerStyle,J=Object(ae.a)(le,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Ae=Object(we.useRef)(null);Object(we.useImperativeHandle)(z,function(){return Ae.current});var ke=Object(Pe.a)({},J);"visible"in le&&(ke.popupVisible=le.visible);var Ke=function(){var Oe=le.arrowContent,Z=Oe===void 0?null:Oe,w=le.overlay,Ue=le.id;return[we.createElement("div",{className:"".concat(v,"-arrow"),key:"arrow"},Z),we.createElement(ee,{key:"content",prefixCls:v,id:Ue,overlay:w,overlayInnerStyle:g})]},it=!1,_e=!1;if(typeof Y=="boolean")it=Y;else if(Y&&Object($.a)(Y)==="object"){var Ie=Y.keepParent;it=Ie===!0,_e=Ie===!1}return we.createElement(ye.a,Object.assign({popupClassName:V,prefixCls:v,popup:Ke,action:B,builtinPlacements:ve.a,popupPlacement:D,ref:Ae,popupAlign:G,getPopupContainer:S,onPopupVisibleChange:X,afterPopupVisibleChange:fe,popupTransitionName:A,popupAnimation:b,defaultPopupVisible:xe,destroyPopupOnHide:it,autoDestroy:_e,mouseLeaveDelay:Ne,popupStyle:ue,mouseEnterDelay:ie},ke),re)},se=Object(we.forwardRef)(W),P=rt.a=se},Ot1p:function(At,rt,x){"use strict";var $=x("2qtc"),Pe=x("kLXV"),ae=x("rAM+"),we=x("miYZ"),ye=x("tsqr"),ve=x("9og8"),j=x("tJVT"),ee=x("jrin"),W=x("WmNS"),se=x.n(W),P=x("q1tI"),I=x.n(P),le=x("VrN/"),z=x.n(le),V=x("bdgK"),q=x("p77/"),B=x("Bd2K"),he=x("ELLl"),ie=x("19Vz"),pe=x("lZu9"),Ne=x("+NIl"),ue=x("kSUc"),K=x("9Bee"),v=function(F){var ce=F.value,Ve=ce===void 0?"":ce,Ze=F.className,He=F.showTextOnly,mt=F.showLines,Ot=F.style,$e=Ot===void 0?{}:Ot,Ut=Object(P.useMemo)(function(){return""},[Ve]);return I.a.createElement(I.a.Fragment,null,I.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ut}}))},re=x("0Owb"),X=x("dejd"),fe=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 ce=F.onActionCallback,Ve=F.title,Ze=F.icon,He=F.actionName,mt=F.className,Ot=mt===void 0?"":mt,$e=F.children;function Ut(){ce(He)}return I.a.createElement("a",{title:Ve,className:Ot,onClick:Ut},I.a.createElement("i",{className:"md-iconfont ".concat(Ze)}),$e)}var k=function(F){var ce=F.watch,Ve=F.showNullButton,Ze=F.onActionCallback,He=F.fullScreen,mt=F.insertTemp,Ot=F.hidetoolBar,$e=F.uuid,Ut=F.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(A.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(A.E)("_educoder_session"),"&key=").concat($e,"&api=").concat(encodeURIComponent(b.a.PROXY_SERVER)));var Mt=[].concat(U,[{title:"".concat(ce?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ce?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return I.a.createElement("ul",{className:"markdown-toolbar-container"},!Ot&&Mt.map(function(Bt,Nt){return I.a.createElement("li",{key:Nt},Bt.actionName?I.a.createElement(D,Object(re.a)({},Bt,{onActionCallback:Ze})):I.a.createElement("span",{className:"v-line"}))}),Ve?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:Ze},I.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\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:Ze},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(He?"icon-shrink":"icon-enlarge"),title:He?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ze})))},G=x("M8RZ"),de=x("+L6B"),Y=x("2/Rp"),xe=x("y8nQ"),S=x("Vl3Y"),g=x("5NDa"),J=x("5rEg"),Ae={labelCol:{span:4},wrapperCol:{span:20}},ke=function(F){var ce=F.callback,Ve=F.onCancel;function Ze(He){ce(He)}return I.a.createElement(S.a,Object(re.a)({},Ae,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ze}),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(J.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(J.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:Ve},"\u53D6\u6D88")))},Ke=x("7ahc"),it=x("k1fw"),_e=x("HmJG"),Ie=x("BjJ7"),Re=S.a.useForm,Oe={width:280,marginRight:10},Z={labelCol:{span:5},wrapperCol:{span:19}},w=function(F){var ce=F.callback,Ve=F.onCancel,Ze=Re(),He=Object(j.a)(Ze,1),mt=He[0],Ot=Object(P.useRef)();function $e(Bt){ce(Object(it.a)(Object(it.a)({},Bt),{},{name:Ot.current}))}function Ut(Bt,Nt){mt.setFieldsValue({src:"/api/attachments/".concat(Bt.id,"?type=").concat(Bt.content_type),type:Nt.type})}function Mt(Bt){var Nt=Bt.target.files[0];Ot.current=Nt.name,lt(Nt,Ut)}return I.a.createElement(S.a,Object(re.a)({form:mt},Z,{className:"upload-image-panel",onFinish:$e}),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(J.a,{style:Oe})),I.a.createElement(Ue,{onFileChange:Mt}))),I.a.createElement(S.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},I.a.createElement(J.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:Ve},"\u53D6\u6D88")))};function Ue(F){var ce=F.onFileChange;return I.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",I.a.createElement("input",{type:"file",onChange:ce}))}function lt(F,ce){if(!F)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ve=new FormData;Ve.append("editormd-image-file",F),Ve.append("file_param_name","editormd-image-file"),Ve.append("byxhr","true");var Ze=new window.XMLHttpRequest;Ze.withCredentials=!0,Ze.addEventListener("load",function(He){ce(JSON.parse(He.target.responseText),F)},!1),Ze.addEventListener("error",function(He){console.error(He)},!1),Ze.open("POST","".concat(Ie.a,"/api/attachments.json")),Ze.send(Ve)}var St=x("giR+"),qe=x("fyUT"),Ye=x("7Kak"),me=x("9yH6"),De=me.a.Group,Fe={margin:"0 8px"},Xe=function(F){var ce=F.callback,Ve=F.onCancel;function Ze(He){ce(He)}return I.a.createElement(S.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ze},I.a.createElement("div",{className:"flex-container"},I.a.createElement("span",{style:Fe},"\u5355\u5143\u683C\u6570\uFF1A"),I.a.createElement("span",{style:Fe},"\u884C\u6570"),I.a.createElement(S.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},I.a.createElement(qe.a,null)),I.a.createElement("span",{style:Fe},"\u5217\u6570"),I.a.createElement(S.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},I.a.createElement(qe.a,null))),I.a.createElement("div",{className:"flex-container",style:{marginTop:12}},I.a.createElement("span",{style:Fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),I.a.createElement(S.a.Item,{name:"align"},I.a.createElement(De,null,I.a.createElement(me.a,{value:"default"},I.a.createElement("i",{className:"fa fa-align-justify"})),I.a.createElement(me.a,{value:"left"},I.a.createElement("i",{className:"fa fa-align-left"})),I.a.createElement(me.a,{value:"center"},I.a.createElement("i",{className:"fa fa-align-center"})),I.a.createElement(me.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:Ve},"\u53D6\u6D88")))},We=x("ErOA"),je=x("7Cbv"),Me="link",Et="upload-image",ot="code-block",et="add-table",ut="------------",kt={default:ut,left:":".concat(ut),center:":".concat(ut,":"),right:"".concat(ut,":")},Ct=x("9VGf"),ft,ge;function wt(){}var ct=0,be=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 L=navigator.platform.toUpperCase().indexOf("MAC")>=0,y=L?"Cmd":"Ctrl",C=["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"],_=(ft={},Object(ee.a)(ft,y+"-B","bold"),Object(ee.a)(ft,y+"-I","italic"),ft),E=(ge={},Object(ee.a)(ge,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(ee.a)(ge,ot,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(ee.a)(ge,Et,"\u6DFB\u52A0\u6587\u4EF6"),Object(ee.a)(ge,et,"\u6DFB\u52A0\u8868\u683C"),ge),te=rt.a=function(F){var ce=F.defaultValue,Ve=ce===void 0?"":ce,Ze=F.onChange,He=F.width,mt=He===void 0?"100%":He,Ot=F.height,$e=Ot===void 0?400:Ot,Ut=F.miniToolbar,Mt=Ut===void 0?!1:Ut,Bt=F.isFocus,Nt=Bt===void 0?!1:Bt,vt=F.watch,Ht=F.insertTemp,Ft=F.mode,ze=Ft===void 0?"markdown":Ft,yt=F.id,dt=yt===void 0?"markdown-editor-id":yt,_t=F.showResizeBar,$t=_t===void 0?!1:_t,Gt=F.noStorage,an=Gt===void 0?!1:Gt,zt=F.showNullButton,gt=zt===void 0?!1:zt,Yt=F.hidetoolBar,Lt=Yt===void 0?!1:Yt,qt=F.fullScreen,Pt=qt===void 0?!1:qt,gn=F.onBlur,Xn=F.onCMBeforeChange,oi=F.onFullScreen,Le=F.className,Qe=Le===void 0?"":Le,sn=F.disablePaste,fn=sn===void 0?!1:sn,vn=F.placeholder,xn=vn===void 0?"":vn,h=F.values,o=h===void 0?"":h,a=Object(P.useState)(null),u=Object(j.a)(a,2),d=u[0],c=u[1],N=Object(P.useState)(Ve),Te=Object(j.a)(N,2),Je=Te[0],bt=Te[1],ne=Object(P.useState)(vt),H=Object(j.a)(ne,2),Se=H[0],ht=H[1],st=Object(P.useState)(Pt),at=Object(j.a)(st,2),Rt=at[0],Qt=at[1],pn=Object(P.useState)(""),cn=Object(j.a)(pn,2),ln=cn[0],mn=cn[1],En=Object(P.useState)(0),Ln=Object(j.a)(En,2),ti=Ln[0],wn=Ln[1],Mn=Object(P.useState)($e),mi=Object(j.a)(Mn,2),Kn=mi[0],ai=mi[1],Mi=Object(P.useState)(!1),Ni=Object(j.a)(Mi,2),dr=Ni[0],Cn=Ni[1],en=Object(P.useRef)(Object(je.a)()),Bn=Object(P.useRef)(!1),Zt=Object(P.useRef)(),Rn=Object(P.useRef)(),rn=Object(P.useRef)(),gi=Object(P.useRef)(),Sn=Object(P.useRef)(),$n=function(){var Tt=Object(ve.a)(se.a.mark(function Wt(){var It,Xt;return se.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:return un.next=2,Object(We.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:Xt=un.sent,Xt!=null&&(It=Xt.attachments)!==null&&It!==void 0&&It.length&&(console.log("cm:",d,Rn),Xt.attachments.map(function(Jt){Jt.content_type.indexOf("image")>-1?d.replaceSelection(".concat(Jt.content_type,")")):Jt.content_type.indexOf("video")>-1?d.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Jt.content_type.indexOf("pdf")>-1?d.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,'&disposition=inline" target="_blank">').concat(Jt.name,"</a>")):d.replaceSelection("[".concat(Jt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,")"))}));case 4:case"end":return un.stop()}},Wt)}));return function(){return Tt.apply(this,arguments)}}();Object(P.useEffect)(function(){bt(o),d==null||d.setValue(o)},[o]),Object(P.useEffect)(function(){oi==null||oi(Rt)},[Rt]),Object(P.useEffect)(function(){if(Rn.current){var Tt=z.a.fromTextArea(Rn.current,{mode:ze,lineNumbers:!Mt,lineWrapping:!0,value:Ve,autoCloseTags:!0,autoCloseBrackets:!0});Nt&&Tt.focus();function Wt(It,Xt){if(fn){Xt.preventDefault();return}var tn=Xt.clipboardData;if(tn){var un=tn.types.toString(),Jt=tn.items;if(un==="Files"||tn.types.indexOf("Files")>-1){if(Xt.preventDefault(),ze=="stex")return;try{var Tn,Yn=Jt[1];((Tn=Jt[0])===null||Tn===void 0?void 0:Tn.kind)==="file"&&(Yn=Jt[0]);var Kt=Yn.getAsFile(),wi=Kt.name.split(".").pop();lt(Kt,function(nn){if(nn.id){var Nn,ui,ci;(Kt==null||((Nn=Kt.type)===null||Nn===void 0)?void 0:Nn.indexOf("image"))>-1?Tt.replaceSelection(".concat(nn.content_type,")")):(Kt==null||((ui=Kt.type)===null||ui===void 0)?void 0:ui.indexOf("video"))>-1?Tt.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,'"></video>')):(Kt==null||((ci=Kt.type)===null||ci===void 0)?void 0:ci.indexOf("pdf"))>-1?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,"?type=").concat(Kt.type,'&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):C.includes(wi)?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,'?type=office&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):Tt.replaceSelection("[".concat(Kt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,"?type=").concat(nn.content_type,")"))}else(nn==null?void 0:nn.status)===401&&(document.location.href="/user/login")})}catch(nn){ye.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Tt.on("paste",Wt),Tt.on("dragleave",function(It,Xt){rn.current.classList.remove("mouse-hover-md")}),Tt.on("dragover",function(It,Xt){rn.current.classList.add("mouse-hover-md")}),Tt.on("drop",function(It,Xt){rn.current.classList.add("mouse-hover-md");var tn;if(tn=Xt.dataTransfer.files,tn.length>0){Xt.preventDefault(),Xt.stopPropagation();for(var un=function(Yn){var Kt=tn[Yn],wi=Kt.name.split(".").pop();lt(Kt,function(nn){if(nn.id){var Nn,ui,ci;(Kt==null||((Nn=Kt.type)===null||Nn===void 0)?void 0:Nn.indexOf("image"))>-1?Tt.replaceSelection(".concat(nn.content_type,")")):(Kt==null||((ui=Kt.type)===null||ui===void 0)?void 0:ui.indexOf("video"))>-1?Tt.replaceSelection('<video width="100%" controls src="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,'"></video>')):(Kt==null||((ci=Kt.type)===null||ci===void 0)?void 0:ci.indexOf("pdf"))>-1?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,"?type=").concat(Kt.type,'&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):C.includes(wi)?Tt.replaceSelection('<a href="'.concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,'?type=office&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):Tt.replaceSelection("[".concat(Kt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(nn.id,"?type=").concat(nn.content_type,")"))}else(nn==null?void 0:nn.status)===401&&(document.location.href="/user/login")})},Jt=0;Jt<tn.length;Jt++)un(Jt)}}),c(Tt),function(){Tt.off("paste",Wt)}}},[]);var Xi=Object(P.useCallback)(function(){if(rn.current)try{}catch(Tt){console.log(Tt,"---- to set md editor body height")}},[Kn,rn,Rt]);Object(P.useEffect)(function(){function Tt(){var It=new V.default(function(Xt){var tn=Object(ae.a)(Xt),un;try{for(tn.s();!(un=tn.n()).done;){var Jt=un.value;(Jt.target.offsetHeight>0||Jt.target.offsetWidth>0)&&(Xi(),d.setSize("100%","100%"),d.refresh())}}catch(Tn){tn.e(Tn)}finally{tn.f()}});return It.observe(Rn.current.parentElement),It}if(d){var Wt=Tt();return function(){Wt.unobserve(Rn.current.parentElement)}}},[d,Xi]),Object(P.useEffect)(function(){if(d){for(var Tt=[],Wt=function(){var Jt=Xt[It];tn=Object(j.a)(Jt,2);var Tn=tn[0],Yn=tn[1],Kt=Object(ee.a)({},Tn,function(){Ki(Yn)});Tt.push(Kt),d.addKeyMap(Kt)},It=0,Xt=Object.entries(_);It<Xt.length;It++){var tn;Wt()}return Zt.current=setInterval(function(){Bn.current&&$n()},4e3),function(){clearInterval(Zt.current);var un=Object(ae.a)(Tt),Jt;try{for(un.s();!(Jt=un.n()).done;){var Tn=Jt.value;d.removeKeyMap(Tn)}}catch(Yn){un.e(Yn)}finally{un.f()}}}},[d]),Object(P.useEffect)(function(){Pt!==Rt&&Qt(Pt)},[Pt]),Object(Ct.a)(function(){if(!an&&ti>0){var Tt=new Date().getTime(),Wt=window.sessionStorage.getItem(dt);Tt>=ti+be&&(!Wt||Wt!==Je)&&(window.sessionStorage.setItem(dt,Je),Cn(!0))}},be),Object(P.useEffect)(function(){ht(vt)},[d,vt]),Object(P.useEffect)(function(){d&&(Nt&&d.focus())},[d,Nt]),Object(P.useEffect)(function(){if(Se&&d){var Tt=d.getScrollerElement();function Wt(It){var Xt=It.target;if(Sn.current){var tn=Xt.scrollTop/Xt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*tn}}return Tt.addEventListener("scroll",Wt),function(){Tt.removeEventListener("scroll",Wt)}}},[d,Se]),Object(P.useEffect)(function(){if(d&&Xn){function Tt(Wt,It){Xn(Wt,It)}return d.on("beforeChange",Tt),function(){d.off("beforeChange",Tt)}}},[d,Xn]),Object(P.useEffect)(function(){if(d&&gn){function Tt(){gn(d.getValue())}return d.on("blur",Tt),function(){d.off("blur",Tt)}}},[d,gn]),Object(P.useEffect)(function(){if(d){function Tt(Wt){var It=Wt.getValue();bt(It),wn(new Date().getTime()),Wt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ze&&Ze(It)}return d.on("change",Tt),function(){d.off("change",Tt)}}},[d,Ze]),Object(P.useEffect)(function(){d&&(Ve==null?(d.setValue(""),bt("")):Ve!==d.getValue()&&(d.setValue(Ve),bt(Ve),d.setCursor(d.lineCount(),0)))},[d,Ve]);var Ki=Object(P.useCallback)(function(Tt){var Wt=d.getCursor(),It=d.getSelection(),Xt=It.split(`
|
|
`);switch(Tt){case"bold":return d.replaceSelection("**"+It+"**"),It===""&&d.setCursor(Wt.line,Wt.ch+2),d.focus();case"italic":return d.replaceSelection("*"+It+"*"),It===""&&d.setCursor(Wt.line,Wt.ch+1),d.focus();case"code":return d.replaceSelection("`"+It+"`"),It===""&&d.setCursor(Wt.line,Wt.ch+1),d.focus();case"inline-latex":return d.replaceSelection("`$$"+It+"$$`"),It===""&&d.setCursor(Wt.line,Wt.ch+3),d.focus();case"latex":return d.replaceSelection("```latex\n"+It+"\n```"),d.setCursor(Wt.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(Xt.map(function(tn){return tn===""?"":"- ".concat(tn)}).join(`
|
|
`)),d.focus();case"list-ol":return It===""?d.replaceSelection("1. "+It):d.replaceSelection(Xt.map(function(tn,un){return tn===""?"":"".concat(un+1,". ").concat(tn)}).join(`
|
|
`)),d.focus();case"add-null-ch":return It===""&&d.setCursor(Wt.line,Wt.ch+1),d.replaceSelection(Ee),d.focus();case"inster-template-1":return It===""&&d.setCursor(Wt.line,Wt.ch),d.replaceSelection(R),d.focus();case"eraser":return d.setValue(""),d.focus();case"trigger-watch":return ht(!Se),d.focus();case"trigger-full-screen":return Qt(!Rt),d.focus();case Me:mn(Me);return;case ot:mn(ot);return;case Et:mn(Et);return;case et:mn(et);return;default:throw new Error}},[d,Se,Rt]),Ei=Object(P.useCallback)(function(Tt){mn("");switch(ln){case Me:var Wt=Tt.title,It=Tt.link;return d.replaceSelection("[".concat(Wt,"](").concat(It,")")),d.focus();case ot:var Xt=Tt.language,tn=Tt.content;return d.replaceSelection(["```"+Xt,tn,"```"].join(`
|
|
`)),d.focus();case Et:var un=Tt.src,Jt=Tt.alt,Tn=Tt.name;return un.indexOf("type=image")>-1?d.replaceSelection(".concat(un,' "').concat(Jt||"",'" )')):un.indexOf("type=application/pdf")>-1?d.replaceSelection('<a href="'.concat(un,'&disposition=inline" target="_blank">').concat(Tn,"</a>")):d.replaceSelection('<a href="'.concat(un,'" target="_blank">').concat(Tn,"</a>")),d.focus();case et:for(var Yn=Tt.row,Kt=Tt.col,wi=Tt.align,nn=`
|
|
`,Nn=0;Nn<Yn;Nn++){for(var ui=[],ci=[],Wr=0;Wr<Kt;Wr++)Nn===1&&ci.push(kt[wi]),ui.push(" ");Nn===1&&(nn+="| ".concat(ci.join(" | "),` |
|
|
`)),nn+="| ".concat(ui.join(Kt===1?"":" | "),` |
|
|
`)}return d.replaceSelection(nn+`
|
|
`),d.focus();default:throw new Error}},[d,ln]),Br=Object(P.useMemo)(function(){switch(ln){case Me:return I.a.createElement(ke,{callback:Ei,onCancel:ni});case ot:return I.a.createElement(Ke.b,{callback:Ei,onCancel:ni});case Et:return I.a.createElement(w,{callback:Ei,onCancel:ni});case et:return I.a.createElement(Xe,{callback:Ei,onCancel:ni});default:return null}},[ln]);function ni(){mn("")}Object(P.useEffect)(function(){if(gi.current){var Tt=gi.current,Wt=!1,It=0;function Xt(Jt){Wt=!0,It=Jt.pageY}function tn(){Wt=!1}function un(Jt){if(Wt){var Tn=Jt.pageY-It;Tn<0&&(Tn=0),Tn>300&&(Tn=300);var Yn=$e+Tn+"px";ai(Yn)}}return Tt.addEventListener("mousedown",Xt),document.addEventListener("mousemove",un),document.addEventListener("mouseup",tn),function(){Tt.removeEventListener("mousedown",Xt),document.removeEventListener("mousemove",un),document.removeEventListener("mouseup",tn)}}},[d,gi]),Object(P.useEffect)(function(){ai($e)},[$e]);var fr=O(mt),hi=O(Kn),$i={width:fr,height:hi},Fr=Object(P.useMemo)(function(){if(ti){var Tt=new Date(ti),Wt=Tt.getHours(),It=Tt.getMinutes(),Xt=Tt.getSeconds();return Wt=Wt<10?"0"+Wt:Wt,It=It<10?"0"+It:It,Xt=Xt<10?"0"+Xt:Xt,"".concat(Wt,":").concat(It,":").concat(Xt)}return 0},[ti]);function Di(){window.sessionStorage.removeItem(dt),Cn(!1),wn(0)}function Jo(){Cn(!1),wn(0),d.setValue(window.sessionStorage.getItem(dt))}function co(Tt,Wt){var It=d.getValue();It=It.replace(Tt,Wt),bt(It),d==null||d.setValue(It)}return I.a.createElement(P.Fragment,null,I.a.createElement("div",{className:"markdown-editor-wrapper",ref:rn},I.a.createElement("div",{className:"markdown-editor-container ".concat(Qe," ").concat(Se?"on-preview":""," ").concat(Mt?"mini":""," ").concat(Rt?"full-screen":""),style:$i},I.a.createElement(k,{insertTemp:Ht,watch:Se,fullScreen:Rt,showNullButton:gt,onActionCallback:Ki,hidetoolBar:Lt,uuid:en.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:Rn,placeholder:xn})),Se?I.a.createElement("div",{ref:Sn,className:"preview-container"},ze==="stex"&&I.a.createElement(v,{value:Je}),ze!=="stex"&&I.a.createElement(K.a,{edit:!0,value:Je,replaces:co})):null))),$t?I.a.createElement("a",{ref:gi,className:"editor-resize"}):null,I.a.createElement(G.a,null,E[ln]?I.a.createElement(Pe.a,{centered:!0,title:E[ln],visible:!0,onCancel:ni,footer:null},Br):null))}},PGNT:function(At,rt,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,rt,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,rt,x){At.exports=x.p+"static/bi.9c9b0364.svg"},SJMd:function(At,rt){/**
|
|
* @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,ae=!1,we,ye;window.PR_SHOULD_USE_CONTINUATION=!0;var ve,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"],P=[se,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],I=[P,"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=[P,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],z=[P,"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",q=[P,"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",he=[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"],ie=[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,q,B,he,ie,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",re="com",X="typ",fe="lit",A="pun",b="pln",U="tag",D="dec",k="src",G="atn",de="atv",Y="nocode",xe="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function S(me){for(var De=0,Fe=!1,Xe=!1,We=0,je=me.length;We<je;++We){var Me=me[We];if(Me.ignoreCase)Xe=!0;else if(/[a-z]/i.test(Me.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Fe=!0,Xe=!1;break}}var Et={b:8,t:9,n:10,v:11,f:12,r:13};function ot(ft){var ge=ft.charCodeAt(0);if(ge!==92)return ge;var wt=ft.charAt(1);return ge=Et[wt],ge||("0"<=wt&&wt<="7"?parseInt(ft.substring(1),8):wt==="u"||wt==="x"?parseInt(ft.substring(2),16):ft.charCodeAt(1))}function et(ft){if(ft<32)return(ft<16?"\\x0":"\\x")+ft.toString(16);var ge=String.fromCharCode(ft);return ge==="\\"||ge==="-"||ge==="]"||ge==="^"?"\\"+ge:ge}function ut(ft){var ge=ft.substring(1,ft.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")),wt=[],ct=ge[0]==="^",be=["["];ct&&be.push("^");for(var Ee=ct?1:0,R=ge.length;Ee<R;++Ee){var O=ge[Ee];if(/\\[bdsw]/i.test(O))be.push(O);else{var L=ot(O),y;Ee+2<R&&ge[Ee+1]==="-"?(y=ot(ge[Ee+2]),Ee+=2):y=L,wt.push([L,y]),y<65||L>122||(y<65||L>90||wt.push([Math.max(65,L)|32,Math.min(y,90)|32]),y<97||L>122||wt.push([Math.max(97,L)&~32,Math.min(y,122)&~32]))}}wt.sort(function(te,F){return te[0]-F[0]||F[1]-te[1]});for(var C=[],_=[],Ee=0;Ee<wt.length;++Ee){var E=wt[Ee];E[0]<=_[1]+1?_[1]=Math.max(_[1],E[1]):C.push(_=E)}for(var Ee=0;Ee<C.length;++Ee){var E=C[Ee];be.push(et(E[0])),E[1]>E[0]&&(E[1]+1>E[0]&&be.push("-"),be.push(et(E[1])))}return be.push("]"),be.join("")}function kt(ft){for(var ge=ft.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")),wt=ge.length,ct=[],be=0,Ee=0;be<wt;++be){var R=ge[be];if(R==="(")++Ee;else if(R.charAt(0)==="\\"){var O=+R.substring(1);O&&(O<=Ee?ct[O]=-1:ge[be]=et(O))}}for(var be=1;be<ct.length;++be)ct[be]===-1&&(ct[be]=++De);for(var be=0,Ee=0;be<wt;++be){var R=ge[be];if(R==="(")++Ee,ct[Ee]||(ge[be]="(?:");else if(R.charAt(0)==="\\"){var O=+R.substring(1);O&&O<=Ee&&(ge[be]="\\"+ct[O])}}for(var be=0;be<wt;++be)ge[be]==="^"&&ge[be+1]!=="^"&&(ge[be]="");if(ft.ignoreCase&&Fe)for(var be=0;be<wt;++be){var R=ge[be],L=R.charAt(0);R.length>=2&&L==="["?ge[be]=ut(R):L!=="\\"&&(ge[be]=R.replace(/[a-zA-Z]/g,function(_){var E=_.charCodeAt(0);return"["+String.fromCharCode(E&~32,E|32)+"]"}))}return ge.join("")}for(var Ct=[],We=0,je=me.length;We<je;++We){var Me=me[We];if(Me.global||Me.multiline)throw new Error(""+Me);Ct.push("(?:"+kt(Me)+")")}return new RegExp(Ct.join("|"),Xe?"gi":"g")}function g(me,De){var Fe=/(?:^|\s)nocode(?:\s|$)/,Xe=[],We=0,je=[],Me=0;function Et(ot){var et=ot.nodeType;if(et==1){if(Fe.test(ot.className))return;for(var ut=ot.firstChild;ut;ut=ut.nextSibling)Et(ut);var kt=ot.nodeName.toLowerCase();(kt==="br"||kt==="li")&&(Xe[Me]=`
|
|
`,je[Me<<1]=We++,je[Me++<<1|1]=ot)}else if(et==3||et==4){var Ct=ot.nodeValue;Ct.length&&(De?Ct=Ct.replace(/\r\n?/g,`
|
|
`):Ct=Ct.replace(/[ \t\r\n]+/g," "),Xe[Me]=Ct,je[Me<<1]=We,We+=Ct.length,je[Me++<<1|1]=ot)}}return Et(me),{sourceCode:Xe.join("").replace(/\n$/,""),spans:je}}function J(me,De,Fe,Xe,We){if(!Fe)return;var je={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:Fe,spans:null,basePos:De,decorations:null};Xe(je),We.push.apply(We,je.decorations)}var Ae=/\S/;function ke(me){for(var De=void 0,Fe=me.firstChild;Fe;Fe=Fe.nextSibling){var Xe=Fe.nodeType;De=Xe===1?De?me:Fe:Xe===3&&Ae.test(Fe.nodeValue)?me:De}return De===me?void 0:De}function Ke(me,De){var Fe={},Xe;(function(){for(var Me=me.concat(De),Et=[],ot={},et=0,ut=Me.length;et<ut;++et){var kt=Me[et],Ct=kt[3];if(Ct)for(var ft=Ct.length;--ft>=0;)Fe[Ct.charAt(ft)]=kt;var ge=kt[1],wt=""+ge;ot.hasOwnProperty(wt)||(Et.push(ge),ot[wt]=null)}Et.push(/[\0-\uffff]/),Xe=S(Et)})();var We=De.length,je=function(Me){for(var Et=Me.sourceCode,ot=Me.basePos,et=Me.sourceNode,ut=[ot,b],kt=0,Ct=Et.match(Xe)||[],ft={},ge=0,wt=Ct.length;ge<wt;++ge){var ct=Ct[ge],be=ft[ct],Ee=void 0,R;if(typeof be=="string")R=!1;else{var O=Fe[ct.charAt(0)];if(O)Ee=ct.match(O[1]),be=O[0];else{for(var L=0;L<We;++L)if(O=De[L],Ee=ct.match(O[1]),Ee){be=O[0];break}Ee||(be=b)}R=be.length>=5&&be.substring(0,5)==="lang-",R&&!(Ee&&typeof Ee[1]=="string")&&(R=!1,be=k),R||(ft[ct]=be)}var y=kt;if(kt+=ct.length,!R)ut.push(ot+y,be);else{var C=Ee[1],_=ct.indexOf(C),E=_+C.length;Ee[2]&&(E=ct.length-Ee[2].length,_=E-C.length);var te=be.substring(5);J(et,ot+y,ct.substring(0,_),je,ut),J(et,ot+y+_,C,w(te,C),ut),J(et,ot+y+E,ct.substring(E),je,ut)}}Me.decorations=ut};return je}function it(me){var De=[],Fe=[];me.tripleQuotedStrings?De.push([K,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?De.push([K,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([K,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&Fe.push([K,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Xe=me.hashComments;Xe&&(me.cStyleComments?(Xe>1?De.push([re,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([re,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Fe.push([K,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([re,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(Fe.push([re,/^\/\/[^\r\n]*/,null]),Fe.push([re,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=me.regexLiterals;if(We){var je=We>1?"":`
|
|
\r`,Me=je?".":"[\\S\\s]",Et="/(?=[^/*"+je+"])(?:[^/\\x5B\\x5C"+je+"]|\\x5C"+Me+"|\\x5B(?:[^\\x5C\\x5D"+je+"]|\\x5C"+Me+")*(?:\\x5D|$))+/";Fe.push(["lang-regex",RegExp("^"+xe+"("+Et+")")])}var ot=me.types;ot&&Fe.push([X,ot]);var et=(""+me.keywords).replace(/^ | $/g,"");et.length&&Fe.push([v,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([b,/^\s+/,null,` \r
|
|
\xA0`]);var ut="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(ut+="(?!s*/)"),Fe.push([fe,/^@[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],[fe,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(ut),null]),Ke(De,Fe)}var _e=it({keywords:Ne,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(me,De,Fe){for(var Xe=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,je=me.ownerDocument,Me=je.createElement("li");me.firstChild;)Me.appendChild(me.firstChild);var Et=[Me];function ot(ge){var wt=ge.nodeType;if(wt==1&&!Xe.test(ge.className))if(ge.nodeName==="br")et(ge),ge.parentNode&&ge.parentNode.removeChild(ge);else for(var ct=ge.firstChild;ct;ct=ct.nextSibling)ot(ct);else if((wt==3||wt==4)&&Fe){var be=ge.nodeValue,Ee=be.match(We);if(Ee){var R=be.substring(0,Ee.index);ge.nodeValue=R;var O=be.substring(Ee.index+Ee[0].length);if(O){var L=ge.parentNode;L.insertBefore(je.createTextNode(O),ge.nextSibling)}et(ge),R||ge.parentNode.removeChild(ge)}}}function et(ge){for(;!ge.nextSibling;)if(ge=ge.parentNode,!ge)return;function wt(Ee,R){var O=R?Ee.cloneNode(!1):Ee,L=Ee.parentNode;if(L){var y=wt(L,1),C=Ee.nextSibling;y.appendChild(O);for(var _=C;_;_=C)C=_.nextSibling,y.appendChild(_)}return O}for(var ct=wt(ge.nextSibling,0),be;(be=ct.parentNode)&&be.nodeType===1;)ct=be;Et.push(ct)}for(var ut=0;ut<Et.length;++ut)ot(Et[ut]);De===(De|0)&&Et[0].setAttribute("value",De);var kt=je.createElement("ol");kt.className="linenums";for(var Ct=Math.max(0,De-1|0)||0,ut=0,ft=Et.length;ut<ft;++ut)Me=Et[ut],Me.className="L"+(ut+Ct)%10,Me.firstChild||Me.appendChild(je.createTextNode("\xA0")),kt.appendChild(Me);me.appendChild(kt)}function Re(me){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Fe=/\n/g,Xe=me.sourceCode,We=Xe.length,je=0,Me=me.spans,Et=Me.length,ot=0,et=me.decorations,ut=et.length,kt=0;et[ut]=We;var Ct,ft;for(ft=Ct=0;ft<ut;)et[ft]!==et[ft+2]?(et[Ct++]=et[ft++],et[Ct++]=et[ft++]):ft+=2;for(ut=Ct,ft=Ct=0;ft<ut;){for(var ge=et[ft],wt=et[ft+1],ct=ft+2;ct+2<=ut&&et[ct+1]===wt;)ct+=2;et[Ct++]=ge,et[Ct++]=wt,ft=ct}ut=et.length=Ct;var be=me.sourceNode,Ee="";be&&(Ee=be.style.display,be.style.display="none");try{for(var R=null;ot<Et;){var O=Me[ot],L=Me[ot+2]||We,y=et[kt+2]||We,ct=Math.min(L,y),C=Me[ot+1],_;if(C.nodeType!==1&&(_=Xe.substring(je,ct))){De&&(_=_.replace(Fe,"\r")),C.nodeValue=_;var E=C.ownerDocument,te=E.createElement("span");te.className=et[kt+1];var F=C.parentNode;F.replaceChild(te,C),te.appendChild(C),je<L&&(Me[ot+1]=C=E.createTextNode(Xe.substring(ct,L)),F.insertBefore(C,te.nextSibling))}je=ct,je>=L&&(ot+=2),je>=y&&(kt+=2)}}finally{be&&(be.style.display=Ee)}}var Oe={};function Z(me,De){for(var Fe=De.length;--Fe>=0;){var Xe=De[Fe];Oe.hasOwnProperty(Xe)?ee.console&&console.warn("cannot override language handler %s",Xe):Oe[Xe]=me}}function w(me,De){return me&&Oe.hasOwnProperty(me)||(me=/^\s*</.test(De)?"default-markup":"default-code"),Oe[me]}Z(_e,["default-code"]),Z(Ke([],[[b,/^[^<?]+/],[D,/^<!\w[^>]*(?:>|$)/],[re,/^<\!--[\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(Ke([[b,/^[\s]+/,null,` \r
|
|
`],[de,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,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(Ke([],[[de,/^[\s\S]+/]]),["uq.val"]),Z(it({keywords:I,hashComments:!0,cStyleComments:!0,types:ue}),["c","cc","cpp","cxx","cyc","m"]),Z(it({keywords:"null,true,false"}),["json"]),Z(it({keywords:z,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:ue}),["cs"]),Z(it({keywords:le,cStyleComments:!0}),["java"]),Z(it({keywords:pe,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Z(it({keywords:he,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Z(it({keywords:B,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Z(it({keywords:ie,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Z(it({keywords:q,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Z(it({keywords:V,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Z(Ke([],[[K,/^[\s\S]+/]]),["regex"]);function Ue(me){var De=me.langExtension;try{var Fe=g(me.sourceNode,me.pre),Xe=Fe.sourceCode;me.sourceCode=Xe,me.spans=Fe.spans,me.basePos=0,w(De,Xe)(me),Re(me)}catch(We){ee.console&&console.log(We&&We.stack||We)}}function lt(me,De,Fe){var Xe=Fe||!1,We=De||null,je=document.createElement("div");je.innerHTML="<pre>"+me+"</pre>",je=je.firstChild,Xe&&Ie(je,Xe,!0);var Me={langExtension:We,numberLines:Xe,sourceNode:je,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ue(Me),je.innerHTML}function St(me,De){var Fe=De||document.body,Xe=Fe.ownerDocument||document;function We(O){return Fe.getElementsByTagName(O)}for(var je=[We("pre"),We("code"),We("xmp")],Me=[],Et=0;Et<je.length;++Et)for(var ot=0,et=je[Et].length;ot<et;++ot)Me.push(je[Et][ot]);je=null;var ut=Date;ut.now||(ut={now:function(){return+new Date}});var kt=0,Ct=/\blang(?:uage)?-([\w.]+)(?!\S)/,ft=/\bprettyprint\b/,ge=/\bprettyprinted\b/,wt=/pre|xmp/i,ct=/^code$/i,be=/^(?:pre|code|xmp)$/i,Ee={};function R(){for(var O=ee.PR_SHOULD_USE_CONTINUATION?ut.now()+250:Infinity;kt<Me.length&&ut.now()<O;kt++){for(var L=Me[kt],y=Ee,C=L;C=C.previousSibling;){var _=C.nodeType,E=(_===7||_===8)&&C.nodeValue;if(E?!/^\??prettify\b/.test(E):_!==3||/\S/.test(C.nodeValue))break;if(E){y={},E.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Nt,vt,Ht){y[vt]=Ht});break}}var te=L.className;if((y!==Ee||ft.test(te))&&!ge.test(te)){for(var F=!1,ce=L.parentNode;ce;ce=ce.parentNode){var Ve=ce.tagName;if(be.test(Ve)&&ce.className&&ft.test(ce.className)){F=!0;break}}if(!F){L.className+=" prettyprinted";var Ze=y.lang;if(!Ze){Ze=te.match(Ct);var He;!Ze&&(He=ke(L))&&ct.test(He.tagName)&&(Ze=He.className.match(Ct)),Ze&&(Ze=Ze[1])}var mt;if(wt.test(L.tagName))mt=1;else{var Ot=L.currentStyle,$e=Xe.defaultView,Ut=Ot?Ot.whiteSpace:$e&&$e.getComputedStyle?$e.getComputedStyle(L,null).getPropertyValue("white-space"):0;mt=Ut&&Ut.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&&Ie(L,Mt,mt);var Bt={langExtension:Ze,sourceNode:L,numberLines:Mt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};Ue(Bt)}}}kt<Me.length?ee.setTimeout(R,250):typeof me=="function"&&me()}R()}var qe=ee.PR={createSimpleLexer:Ke,registerLangHandler:Z,sourceDecorator:it,PR_ATTRIB_NAME:G,PR_ATTRIB_VALUE:de,PR_COMMENT:re,PR_DECLARATION:D,PR_KEYWORD:v,PR_LITERAL:fe,PR_NOCODE:Y,PR_PLAIN:b,PR_PUNCTUATION:A,PR_SOURCE:k,PR_STRING:K,PR_TAG:U,PR_TYPE:X,prettyPrintOne:ae?ee.prettyPrintOne=lt:ve=lt,prettyPrint:j=ae?ee.prettyPrint=St:j=St},Ye=ee.define;typeof Ye=="function"&&Ye.amd&&Ye("google-code-prettify",[],function(){return qe})})()},"VrN/":function(At,rt,x){(function($,Pe){At.exports=Pe()})(this,function(){"use strict";var $=navigator.userAgent,Pe=navigator.platform,ae=/gecko\/\d/i.test($),we=/MSIE \d/.test($),ye=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($),ve=/Edge\/(\d+)/.exec($),j=we||ye||ve,ee=j&&(we?document.documentMode||6:+(ve||ye)[1]),W=!ve&&/WebKit\//.test($),se=W&&/Qt\/\d+\.\d+/.test($),P=!ve&&/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($),q=!ve&&/AppleWebKit/.test($)&&/Mobile\/\w+/.test($),B=/Android/.test($),he=q||B||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test($),ie=q||/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=ie&&(se||I&&(ue==null||ue<12.11)),v=ae||j&&ee>=9;function re(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var X=function(e,t){var i=e.className,n=re(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 fe(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return fe(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 de(e,t){var i=e.className;re(t).test(i)||(e.className+=(i?" ":"")+t)}function Y(e,t){for(var i=e.split(" "),n=0;n<i.length;n++)i[n]&&!re(i[n]).test(t)&&(t+=" "+i[n]);return t}var xe=function(e){e.select()};q?xe=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(xe=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 J(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 f=e.indexOf(" ",s);if(f<0||f>=t)return l+(t-s);l+=f-s,l+=i-l%i,s=f+1}}var Ae=function(){this.id=null,this.f=null,this.time=0,this.handler=S(this.onTimeout,this)};Ae.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ae.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 ke(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Ke=50,it={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},Ie={origin:"*mouse"},Re={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(Ue(Z)+" ");return Z[e]}function Ue(e){return e[e.length-1]}function lt(e,t){for(var i=[],n=0;n<e.length;n++)i[n]=t(e[n],n);return i}function St(e,t,i){for(var n=0,r=i(t);n<e.length&&i(e[n])<=r;)n++;e.splice(n,0,t)}function qe(){}function Ye(e,t){var i;return Object.create?i=Object.create(e):(qe.prototype=e,i=new qe),t&&g(t,i),i}var me=/[\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()||me.test(e))}function Fe(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Xe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 je(e){return e.charCodeAt(0)>=768&&We.test(e)}function Me(e,t,i){for(;(i<0?t>0:t<e.length)&&je(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 ot(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 et=null;function ut(e,t,i){var n;et=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:et=r),s.from==t&&(s.from!=s.to&&i!="before"?n=r:et=r)}return n!=null?n:et}var kt=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]/,f=/[1n]/;function p(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 oe=m.length,Q=[],Ce=0;Ce<oe;++Ce)Q.push(i(m.charCodeAt(Ce)));for(var Be=0,Ge=M;Be<oe;++Be){var tt=Q[Be];tt=="m"?Q[Be]=Ge:Ge=tt}for(var pt=0,nt=M;pt<oe;++pt){var xt=Q[pt];xt=="1"&&nt=="r"?Q[pt]="n":s.test(xt)&&(nt=xt,xt=="r"&&(Q[pt]="R"))}for(var jt=1,Dt=Q[0];jt<oe-1;++jt){var Vt=Q[jt];Vt=="+"&&Dt=="1"&&Q[jt+1]=="1"?Q[jt]="1":Vt==","&&Dt==Q[jt+1]&&(Dt=="1"||Dt=="n")&&(Q[jt]=Dt),Dt=Vt}for(var dn=0;dn<oe;++dn){var jn=Q[dn];if(jn==",")Q[dn]="N";else if(jn=="%"){var bn=void 0;for(bn=dn+1;bn<oe&&Q[bn]=="%";++bn);for(var ri=dn&&Q[dn-1]=="!"||bn<oe&&Q[bn]=="1"?"1":"N",Zn=dn;Zn<bn;++Zn)Q[Zn]=ri;dn=bn-1}}for(var An=0,Qn=M;An<oe;++An){var Wn=Q[An];Qn=="L"&&Wn=="1"?Q[An]="L":s.test(Wn)&&(Qn=Wn)}for(var Pn=0;Pn<oe;++Pn)if(r.test(Q[Pn])){var On=void 0;for(On=Pn+1;On<oe&&r.test(Q[On]);++On);for(var _n=(Pn?Q[Pn-1]:M)=="L",ei=(On<oe?Q[On]:M)=="L",cr=_n==ei?_n?"L":"R":M,Pi=Pn;Pi<On;++Pi)Q[Pi]=cr;Pn=On-1}for(var Hn=[],bi,Un=0;Un<oe;)if(l.test(Q[Un])){var $o=Un;for(++Un;Un<oe&&l.test(Q[Un]);++Un);Hn.push(new p(0,$o,Un))}else{var _i=Un,Gi=Hn.length,Vi=T=="rtl"?1:0;for(++Un;Un<oe&&Q[Un]!="L";++Un);for(var Vn=_i;Vn<Un;)if(f.test(Q[Vn])){_i<Vn&&(Hn.splice(Gi,0,new p(1,_i,Vn)),Gi+=Vi);var hr=Vn;for(++Vn;Vn<Un&&f.test(Q[Vn]);++Vn);Hn.splice(Gi,0,new p(2,hr,Vn)),Gi+=Vi,_i=Vn}else++Vn;_i<Un&&Hn.splice(Gi,0,new p(1,_i,Un))}return T=="ltr"&&(Hn[0].level==1&&(bi=m.match(/^\s+/))&&(Hn[0].from=bi[0].length,Hn.unshift(new p(0,0,bi[0].length))),Ue(Hn).level==1&&(bi=m.match(/\s+$/))&&(Ue(Hn).to-=bi[0].length,Hn.push(new p(0,oe-bi[0].length,oe)))),T=="rtl"?Hn.reverse():Hn}}();function Ct(e,t){var i=e.order;return i==null&&(i=e.order=kt(e.text,t)),i}var ft=[],ge=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]||ft).concat(i)}};function wt(e,t){return e._handlers&&e._handlers[t]||ft}function ct(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=ke(r,i);s>-1&&(n[t]=r.slice(0,s).concat(r.slice(s+1)))}}}function be(e,t){var i=wt(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}}),be(e,i||t.type,e,t),_(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)ke(i,t[n])==-1&&i.push(t[n])}function O(e,t){return wt(e,t).length>0}function L(e){e.prototype.on=function(t,i){ge(this,t,i)},e.prototype.off=function(t,i){ct(this,t,i)}}function y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function C(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function _(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function E(e){y(e),C(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)),ie&&e.ctrlKey&&t==1&&(t=3),t}var ce=function(){if(j&&ee<9)return!1;var e=b("div");return"draggable"in e||"dragDrop"in e}(),Ve;function Ze(e){if(Ve==null){var t=b("span","\u200B");A(e,b("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&ee<8))}var i=Ve?b("span","\u200B"):b("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var He;function mt(e){if(He!=null)return He;var t=A(e,document.createTextNode("A\u062EA")),i=D(t,0,1).getBoundingClientRect(),n=D(t,1,2).getBoundingClientRect();return fe(e),!i||i.left==i.right?!1:He=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/)},$e=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},Ut=function(){var e=b("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Bt(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 Ht(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Nt[e]=t}function Ft(e,t){vt[e]=t}function ze(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=Ye(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ze("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ze("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function yt(e,t){t=ze(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 _t(e,t){var i=dt.hasOwnProperty(e)?dt[e]:dt[e]={};g(t,i)}function $t(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 Gt(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 an(e,t,i){return e.startState?e.startState(t,i):!0}var zt=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};zt.prototype.eol=function(){return this.pos>=this.string.length},zt.prototype.sol=function(){return this.pos==this.lineStart},zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},zt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},zt.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},zt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},zt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},zt.prototype.skipToEnd=function(){this.pos=this.string.length},zt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},zt.prototype.backUp=function(e){this.pos-=e},zt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=J(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?J(this.string,this.lineStart,this.tabSize):0)},zt.prototype.indentation=function(){return J(this.string,null,this.tabSize)-(this.lineStart?J(this.string,this.lineStart,this.tabSize):0)},zt.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)}},zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},zt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},zt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},zt.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 Yt(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 Lt(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 Pt(e){if(e.parent==null)return null;for(var t=e.parent,i=ke(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 f=e.lines[l],p=f.height;if(t<p)break;t-=p}return i+l}function Xn(e,t){return t>=e.first&&t<e.first+e.size}function oi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Le(e,t,i){if(i===void 0&&(i=null),!(this instanceof Le))return new Le(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Qe(e,t){return e.line-t.line||e.ch-t.ch}function sn(e,t){return e.sticky==t.sticky&&Qe(e,t)==0}function fn(e){return Le(e.line,e.ch)}function vn(e,t){return Qe(e,t)<0?t:e}function xn(e,t){return Qe(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 Le(e.first,0);var i=e.first+e.size-1;return t.line>i?Le(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?Le(e.line,t):i<0?Le(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,$t(e.mode,t.state),i,t.lookAhead):new c(e,$t(e.mode,t),i)},c.prototype.save=function(e){var t=e!==!1?$t(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={};at(e,t.text,e.doc.mode,i,function(m,T){return r.push(m,T)},s,n);for(var l=i.state,f=function(m){i.baseTokens=r;var T=e.state.overlays[m],M=1,oe=0;i.state=!0,at(e,t.text,T.mode,i,function(Q,Ce){for(var Be=M;oe<Q;){var Ge=r[M];Ge>Q&&r.splice(M,1,Q,r[M+1],Ge),M+=2,oe=Math.min(Q,Ge)}if(!Ce)return;if(T.opaque)r.splice(Be,M-Be,Q,"overlay "+Ce),M=Be+2;else for(;Be<M;Be+=2){var tt=r[Be+1];r[Be+1]=(tt?tt+" ":"")+"overlay "+Ce}},s),i.state=l,i.baseTokens=null,i.baseTokenPos=1},p=0;p<e.state.overlays.length;++p)f(p);return{styles:r,classes:s.bgClass||s.textClass?s:null}}function Te(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Je(e,Pt(t)),r=t.text.length>e.options.maxHighlightLength&&$t(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 Je(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState)return new c(n,!0,t);var s=Rt(e,t,i),l=s>n.first&>(n,s-1).stateAfter,f=l?c.fromSaved(n,l,s):new c(n,an(n.mode),s);return n.iter(s,t,function(p){bt(e,p.text,f);var m=f.line;p.stateAfter=m==t-1||m%5==0||m>=r.viewFrom&&m<r.viewTo?f.save():null,f.nextLine()}),i&&(n.modeFrontier=f.line),f}function bt(e,t,i,n){var r=e.doc.mode,s=new zt(t,e.options.tabSize,i);for(s.start=s.pos=n||0,t==""&&ne(r,i.state);!s.eol();)H(r,s,i.state),s.start=s.pos}function ne(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Gt(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function H(e,t,i,n){for(var r=0;r<10;r++){n&&(n[0]=Gt(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 Se=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ht(e,t,i,n){var r=e.doc,s=r.mode,l;t=o(r,t);var f=gt(r,t.line),p=Je(e,t.line,i),m=new zt(f.text,e.options.tabSize,p),T;for(n&&(T=[]);(n||m.pos<t.ch)&&!m.eol();)m.start=m.pos,l=H(s,m,p.state),n&&T.push(new Se(m,l,$t(r.mode,p.state)));return n?T:new Se(m,l,p.state)}function st(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 at(e,t,i,n,r,s,l){var f=i.flattenSpans;f==null&&(f=e.options.flattenSpans);var p=0,m=null,T=new zt(t,e.options.tabSize,n),M,oe=e.options.addModeClass&&[null];for(t==""&&st(ne(i,n.state),s);!T.eol();){if(T.pos>e.options.maxHighlightLength?(f=!1,l&&bt(e,t,n,T.pos),T.pos=t.length,M=null):M=st(H(i,T,n.state,oe),s),oe){var Q=oe[0].name;Q&&(M="m-"+(M?Q+" "+M:Q))}if(!f||m!=M){for(;p<T.start;)p=Math.min(T.start,p+5e3),r(p,m);m=M}T.start=T.pos}for(;p<T.pos;){var Ce=Math.min(T.pos,p+5e3);r(Ce,m),p=Ce}}function Rt(e,t,i){for(var n,r,s=e.doc,l=i?-1:t-(e.doc.mode.innerMode?1e3:100),f=t;f>l;--f){if(f<=s.first)return s.first;var p=gt(s,f-1),m=p.stateAfter;if(m&&(!i||f+(m instanceof d?m.lookAhead:0)<=s.modeFrontier))return f;var T=J(p.text,null,e.options.tabSize);(r==null||n>T)&&(r=f-1,n=T)}return r}function Qt(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,cn=!1;function ln(){pn=!0}function mn(){cn=!0}function En(e,t,i){this.marker=e,this.from=t,this.to=i}function Ln(e,t){if(e)for(var i=0;i<e.length;++i){var n=e[i];if(n.marker==t)return n}}function ti(e,t){for(var i,n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i}function wn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Mn(e,t,i){var n;if(e)for(var r=0;r<e.length;++r){var s=e[r],l=s.marker,f=s.from==null||(l.inclusiveLeft?s.from<=t:s.from<t);if(f||s.from==t&&l.type=="bookmark"&&(!i||!s.marker.insertLeft)){var p=s.to==null||(l.inclusiveRight?s.to>=t:s.to>t);(n||(n=[])).push(new En(l,s.from,p?null:s.to))}}return n}function mi(e,t,i){var n;if(e)for(var r=0;r<e.length;++r){var s=e[r],l=s.marker,f=s.to==null||(l.inclusiveRight?s.to>=t:s.to>t);if(f||s.from==t&&l.type=="bookmark"&&(!i||s.marker.insertLeft)){var p=s.from==null||(l.inclusiveLeft?s.from<=t:s.from<t);(n||(n=[])).push(new En(l,p?null:s.from-t,s.to==null?null:s.to-t))}}return n}function Kn(e,t){if(t.full)return null;var i=Xn(e,t.from.line)&>(e,t.from.line).markedSpans,n=Xn(e,t.to.line)&>(e,t.to.line).markedSpans;if(!i&&!n)return null;var r=t.from.ch,s=t.to.ch,l=Qe(t.from,t.to)==0,f=Mn(i,r,l),p=mi(n,s,l),m=t.text.length==1,T=Ue(t.text).length+(m?r:0);if(f)for(var M=0;M<f.length;++M){var oe=f[M];if(oe.to==null){var Q=Ln(p,oe.marker);Q?m&&(oe.to=Q.to==null?null:Q.to+T):oe.to=r}}if(p)for(var Ce=0;Ce<p.length;++Ce){var Be=p[Ce];if(Be.to!=null&&(Be.to+=T),Be.from==null){var Ge=Ln(f,Be.marker);Ge||(Be.from=T,m&&(f||(f=[])).push(Be))}else Be.from+=T,m&&(f||(f=[])).push(Be)}f&&(f=ai(f)),p&&p!=f&&(p=ai(p));var tt=[f];if(!m){var pt=t.text.length-2,nt;if(pt>0&&f)for(var xt=0;xt<f.length;++xt)f[xt].to==null&&(nt||(nt=[])).push(new En(f[xt].marker,null,null));for(var jt=0;jt<pt;++jt)tt.push(nt);tt.push(p)}return tt}function ai(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 Ce=0;Ce<Q.markedSpans.length;++Ce){var Be=Q.markedSpans[Ce].marker;Be.readOnly&&(!n||ke(n,Be)==-1)&&(n||(n=[])).push(Be)}}),!n)return null;for(var r=[{from:t,to:i}],s=0;s<n.length;++s)for(var l=n[s],f=l.find(0),p=0;p<r.length;++p){var m=r[p];if(Qe(m.to,f.from)<0||Qe(m.from,f.to)>0)continue;var T=[p,1],M=Qe(m.from,f.from),oe=Qe(m.to,f.to);(M<0||!l.inclusiveLeft&&!M)&&T.push({from:m.from,to:f.from}),(oe>0||!l.inclusiveRight&&!oe)&&T.push({from:f.to,to:m.to}),r.splice.apply(r,T),p+=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 en(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=Qe(n.from,r.from)||Cn(e)-Cn(t);if(s)return-s;var l=Qe(n.to,r.to)||en(e)-en(t);return l||t.id-e.id}function Zt(e,t){var i=cn&&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 Rn(e){return Zt(e,!0)}function rn(e){return Zt(e,!1)}function gi(e,t){var i=cn&&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 Sn(e,t,i,n,r){var s=gt(e,t),l=cn&&s.markedSpans;if(l)for(var f=0;f<l.length;++f){var p=l[f];if(!p.marker.collapsed)continue;var m=p.marker.find(0),T=Qe(m.from,i)||Cn(p.marker)-Cn(r),M=Qe(m.to,n)||en(p.marker)-en(r);if(T>=0&&M<=0||T<=0&&M>=0)continue;if(T<=0&&(p.marker.inclusiveRight&&r.inclusiveLeft?Qe(m.to,i)>=0:Qe(m.to,i)>0)||T>=0&&(p.marker.inclusiveRight&&r.inclusiveLeft?Qe(m.from,n)<=0:Qe(m.from,n)<0))return!0}}function $n(e){for(var t;t=Rn(e);)e=t.find(-1,!0).line;return e}function Xi(e){for(var t;t=rn(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=rn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Ei(e,t){var i=gt(e,t),n=$n(i);return i==n?t:Pt(n)}function Br(e,t){if(t>e.lastLine())return t;var i=gt(e,t),n;if(!ni(e,i))return t;for(;n=rn(i);)i=n.find(1,!0).line;return Pt(i)+1}function ni(e,t){var i=cn&&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&&fr(e,t,n))return!0}}function fr(e,t,i){if(i.to==null){var n=i.marker.find(1,!0);return fr(e,n.line,Ln(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)&&fr(e,t,r))return!0}function hi(e){e=$n(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 f=s.children[l];if(f==i)break;t+=f.height}return t}function $i(e){if(e.height==0)return 0;for(var t=e.text.length,i,n=e;i=Rn(n);){var r=i.find(0,!0);n=r.from.line,t+=r.from.ch-r.to.ch}for(n=e;i=rn(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 Pt(this)},L(Di);function Jo(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={},Wt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Wt:Tt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(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=Ct(s,e.doc.direction))&&(n.addToken=Tn(n.addToken,l)),n.map=[];var f=t!=e.display.externalMeasured&&Pt(s);Kt(s,n,Te(e,s,f)),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(Ze(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 p=n.content.lastChild;(/\bcm-tab\b/.test(p.className)||p.querySelector&&p.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Y(n.pre.className,n.textClass||"")),n}function tn(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 f=e.splitSpaces?Jt(t,e.trailingSpace):t,p=e.cm.state.specialChars,m=!1,T;if(!p.test(t))e.col+=t.length,T=document.createTextNode(f),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;;){p.lastIndex=M;var oe=p.exec(t),Q=oe?oe.index-M:t.length-M;if(Q){var Ce=document.createTextNode(f.slice(M,M+Q));j&&ee<9?T.appendChild(b("span",[Ce])):T.appendChild(Ce),e.map.push(e.pos,e.pos+Q,Ce),e.col+=Q,e.pos+=Q}if(!oe)break;M+=Q+1;var Be=void 0;if(oe[0]==" "){var Ge=e.cm.options.tabSize,tt=Ge-e.col%Ge;Be=T.appendChild(b("span",w(tt),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=tt}else oe[0]=="\r"||oe[0]==`
|
|
`?(Be=T.appendChild(b("span",oe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",oe[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(oe[0]),Be.setAttribute("cm-text",oe[0]),j&&ee<9?T.appendChild(b("span",[Be])):T.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=f.charCodeAt(t.length-1)==32,i||n||r||m||s||l){var pt=i||"";n&&(pt+=n),r&&(pt+=r);var nt=b("span",[T],pt,s);if(l)for(var xt in l)l.hasOwnProperty(xt)&&xt!="style"&&xt!="class"&&nt.setAttribute(xt,l[xt]);return e.content.appendChild(nt)}e.content.appendChild(T)}function Jt(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 Tn(e,t){return function(i,n,r,s,l,f,p){r=r?r+" cm-force-border":"cm-force-border";for(var m=i.pos,T=m+n.length;;){for(var M=void 0,oe=0;oe<t.length&&!(M=t[oe],M.to>m&&M.from<=m);oe++);if(M.to>=T)return e(i,n,r,s,l,f,p);e(i,n.slice(0,M.to-m),r,s,null,f,p),s=null,n=n.slice(M.to-m),m=M.to}}}function Yn(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 Kt(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 f=r.length,p=0,m=1,T="",M,oe,Q=0,Ce,Be,Ge,tt,pt;;){if(Q==p){Ce=Be=Ge=oe="",pt=null,tt=null,Q=Infinity;for(var nt=[],xt=void 0,jt=0;jt<n.length;++jt){var Dt=n[jt],Vt=Dt.marker;if(Vt.type=="bookmark"&&Dt.from==p&&Vt.widgetNode)nt.push(Vt);else if(Dt.from<=p&&(Dt.to==null||Dt.to>p||Vt.collapsed&&Dt.to==p&&Dt.from==p)){if(Dt.to!=null&&Dt.to!=p&&Q>Dt.to&&(Q=Dt.to,Be=""),Vt.className&&(Ce+=" "+Vt.className),Vt.css&&(oe=(oe?oe+";":"")+Vt.css),Vt.startStyle&&Dt.from==p&&(Ge+=" "+Vt.startStyle),Vt.endStyle&&Dt.to==Q&&(xt||(xt=[])).push(Vt.endStyle,Dt.to),Vt.title&&((pt||(pt={})).title=Vt.title),Vt.attributes)for(var dn in Vt.attributes)(pt||(pt={}))[dn]=Vt.attributes[dn];Vt.collapsed&&(!tt||Bn(tt.marker,Vt)<0)&&(tt=Dt)}else Dt.from>p&&Q>Dt.from&&(Q=Dt.from)}if(xt)for(var jn=0;jn<xt.length;jn+=2)xt[jn+1]==Q&&(Be+=" "+xt[jn]);if(!tt||tt.from==p)for(var bn=0;bn<nt.length;++bn)Yn(t,0,nt[bn]);if(tt&&(tt.from||0)==p){if(Yn(t,(tt.to==null?f+1:tt.to)-p,tt.marker,tt.from==null),tt.to==null)return;tt.to==p&&(tt=!1)}}if(p>=f)break;for(var ri=Math.min(f,Q);;){if(T){var Zn=p+T.length;if(!tt){var An=Zn>ri?T.slice(0,ri-p):T;t.addToken(t,An,M?M+Ce:Ce,Ge,p+An.length==Q?Be:"",oe,pt)}if(Zn>=ri){T=T.slice(ri-p),p=ri;break}p=Zn,Ge=""}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?Pt(Ue(this.rest))-i+1:1,this.node=this.text=null,this.hidden=ni(e,t)}function nn(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 Nn=null;function ui(e){Nn?Nn.ops.push(e):e.ownsGroup=Nn={ops:[e],delayedCallbacks:[]}}function ci(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{ci(i)}finally{Nn=null,t(i)}}var pr=null;function Fn(e,t){var i=wt(e,t);if(!i.length)return;var n=Array.prototype.slice.call(arguments,2),r;Nn?r=Nn.delayedCallbacks:pr?r=pr:(r=pr=[],setTimeout(Ps,0));for(var s=function(f){r.push(function(){return i[f].apply(null,n)})},l=0;l<i.length;++l)s(l)}function Ps(){var e=pr;pr=null;for(var t=0;t<e.length;++t)e[t]()}function qo(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):Xt(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),f=t.gutter=b("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(f),l.insertBefore(f,t.text),t.line.gutterClass&&(f.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!s||!s["CodeMirror-linenumbers"])&&(t.lineNumber=f.appendChild(b("div",oi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),s)for(var p=0;p<e.display.gutterSpecs.length;++p){var m=e.display.gutterSpecs[p].className,T=s.hasOwnProperty(m)&&s[m];T&&f.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=re("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,f=t.widgets;l<f.length;++l){var p=f[l],m=b("div",[p.node],"CodeMirror-linewidget"+(p.className?" "+p.className:""));p.handleMouseEvents||m.setAttribute("cm-ignore-events","true"),js(p,m,i,n),e.display.input.setUneditable(m),r&&p.above?s.insertBefore(m,i.gutter||i.text):s.appendChild(m),Fn(p,"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 fo(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 Ke-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-vi(e)-e.display.barWidth}function po(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(),f=0;f<l.length-1;f++){var p=l[f],m=l[f+1];Math.abs(p.bottom-m.bottom)>2&&s.push((p.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(Pt(e.rest[r])>i)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Bs(e,t){t=$n(t);var i=Pt(t),n=e.display.externalMeasured=new wi(e.doc,t,i);n.lineN=i;var r=n.built=Xt(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=Pt(t),n=mo(e,i);n&&!n.text?n=null:n&&n.changes&&(qo(e,n,i,Co(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,f,p,m=0;m<e.length;m+=3)if(f=e[m],p=e[m+1],t<f?(r=0,s=1,l="left"):t<p?(r=t-f,s=r+1):(m==e.length-3||t==p&&e[m+3]>t)&&(s=p-f,r=s-1,t>=p&&(l="right")),r!=null){if(n=e[m+2],f==p&&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==p-f)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:f,coverEnd:p}}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,f=r.end,p=r.collapse,m;if(s.nodeType==3){for(var T=0;T<4;T++){for(;l&&je(t.line.text.charAt(r.coverStart+l));)--l;for(;r.coverStart+f<r.coverEnd&&je(t.line.text.charAt(r.coverStart+f));)++f;if(j&&ee<9&&l==0&&f==r.coverEnd-r.coverStart?m=s.parentNode.getBoundingClientRect():m=Fs(D(s,l,f).getClientRects(),n),m.left||m.right||l==0)break;f=l,l=l-1,p="right"}j&&ee<11&&(m=zs(e.display.measure,m))}else{l>0&&(p=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 oe=s.parentNode.getClientRects()[0];oe?m={left:oe.left,right:oe.left+qi(e.display),top:oe.top,bottom:oe.bottom}:m=oa}for(var Q=m.top-t.rect.top,Ce=m.bottom-t.rect.top,Be=(Q+Ce)/2,Ge=t.view.measure.heights,tt=0;tt<Ge.length-1&&!(Be<Ge[tt]);tt++);var pt=tt?Ge[tt-1]:0,nt=Ge[tt],xt={left:(p=="right"?m.right:m.left)-t.rect.left,right:(p=="left"?m.left:m.right)-t.rect.left,top:pt,bottom:nt};return!m.left&&!m.right&&(xt.bogus=!0),e.options.singleCursorHeightPerLine||(xt.rtop=Q,xt.rbottom=Ce),xt}function zs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(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,fe(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 P&&B?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ca(){return P&&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=hi(t);if(n=="local"?l+=zr(e.display):l-=e.display.viewOffset,n=="page"||n=="window"){var f=e.display.lineSpace.getBoundingClientRect();l+=f.top+(n=="window"?0:ca());var p=f.left+(n=="window"?0:ua());i.left+=p,i.right+=p}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 di(e,t,i,n,r,s){n=n||gt(e.doc,t.line),r||(r=Yi(e,n));function l(Ce,Be){var Ge=yi(e,r,Ce,Be?"right":"left",s);return Be?Ge.left=Ge.right:Ge.right=Ge.left,Hr(e,n,Ge,i)}var f=Ct(n,e.doc.direction),p=t.ch,m=t.sticky;if(p>=n.text.length?(p=n.text.length,m="before"):p<=0&&(p=0,m="after"),!f)return l(m=="before"?p-1:p,m=="before");function T(Ce,Be,Ge){var tt=f[Be],pt=tt.level==1;return l(Ge?Ce-1:Ce,pt!=Ge)}var M=ut(f,p,m),oe=et,Q=T(p,M,m=="before");return oe!=null&&(Q.other=T(p,oe,m!="before")),Q}function da(e,t){var i=0;t=o(e.doc,t),e.options.lineWrapping||(i=qi(e.display)*t.ch);var n=gt(e.doc,t.line),r=hi(n)+zr(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function yo(e,t,i,n,r){var s=Le(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 f=Hs(e,l,r,t,i),p=gi(l,f.ch+(f.xRel>0||f.outside>0?1:0));if(!p)return f;var m=p.find(1);if(m.line==r)return m;l=gt(n,r=m.line)}}function fa(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 pa(e,t,i,n){i||(i=Yi(e,t));var r=Hr(e,t,yi(e,i,n),"line").top;return fa(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-=hi(t);var s=Yi(e,t),l=go(t),f=0,p=t.text.length,m=!0,T=Ct(t,e.doc.direction);if(T){var M=(e.options.lineWrapping?Vs:Gs)(e,t,i,s,T,n,r);m=M.level!=1,f=m?M.from:M.to-1,p=m?M.to:M.from-1}var oe=null,Q=null,Ce=Et(function(jt){var Dt=yi(e,s,jt);return Dt.top+=l,Dt.bottom+=l,xo(Dt,n,r,!1)?(Dt.top<=r&&Dt.left<=n&&(oe=jt,Q=Dt),!0):!1},f,p),Be,Ge,tt=!1;if(Q){var pt=n-Q.left<Q.right-n,nt=pt==m;Ce=oe+(nt?0:1),Ge=nt?"after":"before",Be=pt?Q.left:Q.right}else{!m&&(Ce==p||Ce==f)&&Ce++,Ge=Ce==0?"after":Ce==t.text.length?"before":yi(e,s,Ce-(m?1:0)).bottom+l<=r==m?"after":"before";var xt=di(e,Le(i,Ce,Ge),"line",t,s);Be=xt.left,tt=r<xt.top?-1:r>=xt.bottom?1:0}return Ce=Me(t.text,Ce,1),yo(i,Ce,Ge,tt,n-Be)}function Gs(e,t,i,n,r,s,l){var f=Et(function(M){var oe=r[M],Q=oe.level!=1;return xo(di(e,Le(i,Q?oe.to:oe.from,Q?"before":"after"),"line",t,n),s,l,!0)},0,r.length-1),p=r[f];if(f>0){var m=p.level!=1,T=di(e,Le(i,m?p.from:p.to,m?"after":"before"),"line",t,n);xo(T,s,l,!0)&&T.top>l&&(p=r[f-1])}return p}function Vs(e,t,i,n,r,s,l){var f=fa(e,t,n,l),p=f.begin,m=f.end;/\s/.test(t.text.charAt(m-1))&&m--;for(var T=null,M=null,oe=0;oe<r.length;oe++){var Q=r[oe];if(Q.from>=m||Q.to<=p)continue;var Ce=Q.level!=1,Be=yi(e,n,Ce?Math.min(m,Q.to)-1:Math.max(p,Q.from)).right,Ge=Be<s?s-Be+1e9:Be-s;(!T||M>Ge)&&(T=Q,M=Ge)}return T||(T=r[r.length-1]),T.from<p&&(T={from:p,to:T.to,level:T.level}),T.to>m&&(T={from:T.from,to:m,level:T.level}),T}var ji;function Ji(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),fe(e.measure),i||1}function qi(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 Co(e){for(var t=e.display,i={},n={},r=t.gutters.clientLeft,s=t.gutters.firstChild,l=0;s;s=s.nextSibling,++l){var f=e.display.gutterSpecs[l].className;i[f]=s.offsetLeft+s.clientLeft+r,n[f]=s.clientWidth}return{fixedPos:_o(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function _o(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ma(e){var t=Ji(e.display),i=e.options.lineWrapping,n=i&&Math.max(5,e.display.scroller.clientWidth/qi(e.display)-3);return function(r){if(ni(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,f=r.lineSpace.getBoundingClientRect();try{s=t.clientX-f.left,l=t.clientY-f.top}catch(M){return null}var p=bo(e,s,l),m;if(n&&p.xRel>0&&(m=gt(e.doc,p.line).text).length==p.ch){var T=J(m,m.length,e.options.tabSize)-m.length;p=Le(p.line,Math.max(0,Math.round((s-na(e.display).left)/qi(e.display))-T))}return p}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 Jn(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)cn&&Ei(e.doc,t)<r.viewTo&&ki(e);else if(i<=r.viewFrom)cn&&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 f=Gr(e,t,t,-1),p=Gr(e,i,i+n,1);f&&p?(r.view=r.view.slice(0,f.index).concat(nn(e,f.lineN,p.lineN)).concat(r.view.slice(p.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=[]);ke(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(!cn||i==e.doc.first+e.doc.size)return{index:r,lineN:i};for(var f=e.display.viewFrom,p=0;p<r;p++)f+=l[p].size;if(f!=t){if(n>0){if(r==l.length-1)return null;s=f+l[r].size-t,r++}else s=f-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=nn(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=nn(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(nn(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 f=i.sel.ranges[l];if(f.from().line>=e.display.viewTo||f.to().line<e.display.viewFrom)continue;var p=f.empty();(p||e.options.showCursorWhenSelecting)&&ya(e,f.head,r),p||Ks(e,f,s)}return n}function ya(e,t,i){var n=di(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),f=l.left,p=Math.max(n.sizerWidth,Ii(e)-n.sizer.offsetLeft)-l.right,m=r.direction=="ltr";function T(nt,xt,jt,Dt){xt<0&&(xt=0),xt=Math.round(xt),Dt=Math.round(Dt),s.appendChild(b("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
|
|
top: `+xt+"px; width: "+(jt==null?p-nt:jt)+`px;
|
|
height: `+(Dt-xt)+"px"))}function M(nt,xt,jt){var Dt=gt(r,nt),Vt=Dt.text.length,dn,jn;function bn(An,Qn){return vo(e,Le(nt,An),"div",Dt,Qn)}function ri(An,Qn,Wn){var Pn=pa(e,Dt,null,An),On=Qn=="ltr"==(Wn=="after")?"left":"right",_n=Wn=="after"?Pn.begin:Pn.end-(/\s/.test(Dt.text.charAt(Pn.end-1))?2:1);return bn(_n,On)[On]}var Zn=Ct(Dt,r.direction);return ot(Zn,xt||0,jt==null?Vt:jt,function(An,Qn,Wn,Pn){var On=Wn=="ltr",_n=bn(An,On?"left":"right"),ei=bn(Qn-1,On?"right":"left"),cr=xt==null&&An==0,Pi=jt==null&&Qn==Vt,Hn=Pn==0,bi=!Zn||Pn==Zn.length-1;if(ei.top-_n.top<=3){var Un=(m?cr:Pi)&&Hn,$o=(m?Pi:cr)&&bi,_i=Un?f:(On?_n:ei).left,Gi=$o?p:(On?ei:_n).right;T(_i,_n.top,Gi-_i,_n.bottom)}else{var Vi,Vn,hr,Yo;On?(Vi=m&&cr&&Hn?f:_n.left,Vn=m?p:ri(An,Wn,"before"),hr=m?f:ri(Qn,Wn,"after"),Yo=m&&Pi&&bi?p:ei.right):(Vi=m?ri(An,Wn,"before"):f,Vn=!m&&cr&&Hn?p:_n.right,hr=!m&&Pi&&bi?f:ei.left,Yo=m?ri(Qn,Wn,"after"):p),T(Vi,_n.top,Vn-Vi,_n.bottom),_n.bottom<ei.top&&T(f,_n.bottom,null,ei.top),T(hr,ei.top,Yo-hr,ei.bottom)}(!dn||Vr(_n,dn)<0)&&(dn=_n),Vr(ei,dn)<0&&(dn=ei),(!jn||Vr(_n,jn)<0)&&(jn=_n),Vr(ei,jn)<0&&(jn=ei)}),{start:dn,end:jn}}var oe=t.from(),Q=t.to();if(oe.line==Q.line)M(oe.line,oe.ch,Q.ch);else{var Ce=gt(r,oe.line),Be=gt(r,Q.line),Ge=$n(Ce)==$n(Be),tt=M(oe.line,oe.ch,Ge?Ce.text.length+1:null).end,pt=M(Q.line,Ge?0:null,Q.ch).start;Ge&&(tt.top<pt.top-2?(T(tt.right,tt.top,null,tt.bottom),T(f,pt.top,pt.left,pt.bottom)):T(tt.right,tt.top,pt.left-tt.right,tt.bottom)),tt.bottom<pt.top&&T(f,tt.bottom,null,pt.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||(be(e,"focus",e,t),e.state.focused=!0,de(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),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&&(be(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,f=0;if(r.hidden)continue;if(j&&ee<8){var p=r.node.offsetTop+r.node.offsetHeight;l=p-i,i=p}else{var m=r.node.getBoundingClientRect();l=m.bottom-m.top,!s&&r.text.firstChild&&(f=r.text.firstChild.getBoundingClientRect().right-m.left-1)}var T=r.line.height-l;if((T>.005||T<-.005)&&(qt(r.line,l),Ca(r.line),r.rest))for(var M=0;M<r.rest.length;M++)Ca(r.rest[M]);if(f>e.display.sizerWidth){var oe=Math.ceil(f/qi(e.display));oe>e.display.maxLineLength&&(e.display.maxLineLength=oe,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}function Ca(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 f=i.ensure.from.line,p=i.ensure.to.line;f<s?(s=f,l=gn(t,hi(gt(t,f))+e.wrapper.clientHeight)):Math.min(p,t.lastLine())>=l&&(s=gn(t,hi(gt(t,p))-e.wrapper.clientHeight),l=p)}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?Le(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Le(t.line,t.ch+1,"before"):t);for(var s=0;s<5;s++){var l=!1,f=di(e,t),p=!i||i==t?f:di(e,i);r={left:Math.min(f.left,p.left),top:Math.min(f.top,p.top)-n,right:Math.max(f.left,p.left),bottom:Math.max(f.bottom,p.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 Js(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=Ji(e.display);t.top<0&&(t.top=0);var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,s=po(e),l={};t.bottom-t.top>s&&(t.bottom=t.top+s);var f=e.doc.height+fo(i),p=t.top<n,m=t.bottom>f-n;if(t.top<r)l.scrollTop=p?0:t.top;else if(t.bottom>r+s){var T=Math.min(t.top,(m?f:t.bottom)-s);T!=r&&(l.scrollTop=T)}var M=e.options.fixedGutter?0:i.gutters.offsetWidth,oe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-M,Q=Ii(e)-i.gutters.offsetWidth,Ce=t.right-t.left>Q;return Ce&&(t.right=t.left+Q),t.left<10?l.scrollLeft=0:t.left<oe?l.scrollLeft=Math.max(0,t.left+M-(Ce?0:10)):t.right>Q+oe-3&&(l.scrollLeft=t.right+(Ce?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 qs(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);_a(e,i,n,t.margin)}}function _a(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;ae||Ao(e,{top:t}),Ea(e,t,!0),ae&&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 Cr(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+fo(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),ge(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ge(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=ie&&!z?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ae,this.disableVert=new Ae},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 _r=function(){};_r.prototype.update=function(){return{bottom:0,right:0}},_r.prototype.setScrollLeft=function(){},_r.prototype.setScrollTop=function(){},_r.prototype.clear=function(){};function er(e,t){t||(t=Cr(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,Cr(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:_r};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),ge(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&&de(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},ui(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=Cr(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&&Lo(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 f=0;f<s.length;++f)s[f].lines.length||be(s[f],"hide");if(l)for(var p=0;p<l.length;++p)l[p].lines.length&&be(l[p],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ii(e,t){if(e.curOp)return t();zi(e);try{return t()}finally{Hi(e)}}function Dn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);zi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Gn(e){return function(){if(this.curOp)return e.apply(this,arguments);zi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function In(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=Je(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,f=s.text.length>e.options.maxHighlightLength?$t(t.mode,n.state):null,p=N(e,s,n,!0);f&&(n.state=f),s.styles=p.styles;var m=s.styleClasses,T=p.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),oe=0;!M&&oe<l.length;++oe)M=l[oe]!=s.styles[oe];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&&ii(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=Co(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++)be.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=Co(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)),cn&&(s=Ei(e.doc,s),l=Br(e.doc,l));var f=s!=i.viewFrom||l!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Xs(e,s,l),i.viewOffset=hi(gt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var p=ga(e);if(!f&&p==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var m=sl(e);return p>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),p>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(m),fe(i.cursorDiv),fe(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,f&&(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+fo(e.display)-po(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=Cr(e);yr(e),er(e,r),Lo(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=Cr(e);yr(e),er(e,n),Lo(e,n),i.finish()}}function ul(e,t,i){var n=e.display,r=e.options.lineNumbers,s=n.lineDiv,l=s.firstChild;function f(Ce){var Be=Ce.nextSibling;return W&&ie&&e.display.currentWheelTarget==Ce?Ce.style.display="none":Ce.parentNode.removeChild(Ce),Be}for(var p=n.view,m=n.viewFrom,T=0;T<p.length;T++){var M=p[T];if(!M.hidden)if(!M.node||M.node.parentNode!=s){var oe=Is(e,M,m,i);s.insertBefore(oe,l)}else{for(;l!=M.node;)l=f(l);var Q=r&&t!=null&&t<=m&&M.lineNumber;M.changes&&(ke(M.changes,"gutter")>-1&&(Q=!1),qo(e,M,m,i)),Q&&(fe(M.lineNumber),M.lineNumber.appendChild(document.createTextNode(oi(e.options,m)))),l=M.node.nextSibling}m+=M.size}for(;l;)l=f(l)}function Oo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Lo(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+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=_o(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 f=i[l].alignable;if(f)for(var p=0;p<f.length;p++)f[p].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=oi(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 Po(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;fe(t),e.lineGutter=null;for(var n=0;n<i.length;++n){var r=i[n],s=r.className,l=r.style,f=t.appendChild(b("div",null,"CodeMirror-gutter "+s));l&&(f.style.cssText=l),s=="CodeMirror-linenumbers"&&(e.lineGutter=f,f.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Oo(e)}function wr(e){Oa(e.display),Jn(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: "+Ke+"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&&!(ae&&he)&&(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=Po(n.gutters,n.lineNumbers),Oa(r),i.init(r)}var Jr=0,si=null;j?si=-.53:ae?si=15:P?si=-.7:le&&(si=-1/3);function La(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=La(e);return t.x*=si,t.y*=si,t}function Pa(e,t){var i=La(t),n=i.x,r=i.y,s=e.display,l=s.scroller,f=l.scrollWidth>l.clientWidth,p=l.scrollHeight>l.clientHeight;if(!(n&&f||r&&p))return;if(r&&ie&&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&&!ae&&!I&&si!=null){r&&p&&xr(e,Math.max(0,l.scrollTop+r*si)),Fi(e,Math.max(0,l.scrollLeft+n*si)),(!r||r&&p)&&y(t),s.wheelStartX=null;return}if(r&&si!=null){var oe=r*si,Q=e.doc.scrollTop,Ce=Q+s.wrapper.clientHeight;oe<0?Q=Math.max(0,Q+oe-50):Ce=Math.min(e.doc.height,Ce+oe+50),Ao(e,{top:Q,bottom:Ce})}Jr<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 Be=l.scrollLeft-s.wheelStartX,Ge=l.scrollTop-s.wheelStartY,tt=Ge&&s.wheelDY&&Ge/s.wheelDY||Be&&s.wheelDX&&Be/s.wheelDX;if(s.wheelStartX=s.wheelStartY=null,!tt)return;si=(si*Jr+tt)/(Jr+1),++Jr},200)):(s.wheelDX+=n,s.wheelDY+=r))}var li=function(e,t){this.ranges=e,this.primIndex=t};li.prototype.primary=function(){return this.ranges[this.primIndex]},li.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(!sn(i.anchor,n.anchor)||!sn(i.head,n.head))return!1}return!0},li.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new on(fn(this.ranges[t].anchor),fn(this.ranges[t].head));return new li(e,this.primIndex)},li.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},li.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(Qe(t,n.from())>=0&&Qe(e,n.to())<=0)return i}return-1};var on=function(e,t){this.anchor=e,this.head=t};on.prototype.from=function(){return xn(this.anchor,this.head)},on.prototype.to=function(){return vn(this.anchor,this.head)},on.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(oe,Q){return Qe(oe.from(),Q.from())}),i=ke(t,r);for(var s=1;s<t.length;s++){var l=t[s],f=t[s-1],p=Qe(f.to(),l.from());if(n&&!l.empty()?p>0:p>=0){var m=xn(f.from(),l.from()),T=vn(f.to(),l.to()),M=f.empty()?l.from()==l.head:f.from()==f.head;s<=i&&--i,t.splice(--s,2,new on(M?T:m,M?m:T))}}return new li(t,i)}function Ri(e,t){return new li([new on(e,t||e)],0)}function Ti(e){return e.text?Le(e.from.line+e.text.length-1,Ue(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ma(e,t){if(Qe(e,t.from)<0)return e;if(Qe(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),Le(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 on(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?Le(i.line,e.ch-t.ch+i.ch):Le(i.line+(e.line-t.line),e.ch)}function dl(e,t,i){for(var n=[],r=Le(e.first,0),s=r,l=0;l<t.length;l++){var f=t[l],p=Na(f.from,r,s),m=Na(Ti(f),r,s);if(r=f.to,s=m,i=="around"){var T=e.sel.ranges[l],M=Qe(T.head,T.anchor)<0;n[l]=new on(M?m:p,M?p:m)}else n[l]=new on(p,p)}return new li(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&&Jn(e)}function Da(e,t){return t.from.ch==0&&t.to.ch==0&&Ue(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Do(e,t,i,n){function r(pt){return i?i[pt]:null}function s(pt,nt,xt){Jo(pt,nt,xt,n),Fn(pt,"change",pt,t)}function l(pt,nt){for(var xt=[],jt=pt;jt<nt;++jt)xt.push(new Di(m[jt],r(jt),n));return xt}var f=t.from,p=t.to,m=t.text,T=gt(e,f.line),M=gt(e,p.line),oe=Ue(m),Q=r(m.length-1),Ce=p.line-f.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 Be=l(0,m.length-1);s(M,M.text,Q),Ce&&e.remove(f.line,Ce),Be.length&&e.insert(f.line,Be)}else if(T==M)if(m.length==1)s(T,T.text.slice(0,f.ch)+oe+T.text.slice(p.ch),Q);else{var Ge=l(1,m.length-1);Ge.push(new Di(oe+T.text.slice(p.ch),Q,n)),s(T,T.text.slice(0,f.ch)+m[0],r(0)),e.insert(f.line+1,Ge)}else if(m.length==1)s(T,T.text.slice(0,f.ch)+m[0]+M.text.slice(p.ch),r(0)),e.remove(f.line+1,Ce);else{s(T,T.text.slice(0,f.ch)+m[0],r(0)),s(M,oe+M.text.slice(p.ch),Q);var tt=l(1,m.length-1);Ce>1&&e.remove(f.line+1,Ce-1),e.insert(f.line+1,tt)}Fn(e,"change",e,t)}function Ai(e,t,i){function n(r,s,l){if(r.linked)for(var f=0;f<r.linked.length;++f){var p=r.linked[f];if(p.doc==s)continue;var m=l&&p.sharedHist;if(i&&!m)continue;t(p.doc,m),n(p.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,Jn(e)}function ja(e){(e.doc.direction=="rtl"?de:X)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){ii(e,function(){ja(e),Jn(e)})}function qr(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:fn(t.from),to:Ti(t),text:Yt(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=Ue(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ua(e.done),Ue(e.done);if(e.done.length&&!Ue(e.done).ranges)return Ue(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ue(e.done)}function Ba(e,t,i,n){var r=e.history;r.undone.length=0;var s=+new Date,l,f;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=pl(r,r.lastOp==n)))f=Ue(l.changes),Qe(t.from,t.to)==0&&Qe(t.from,f.to)==0?f.to=Ti(t):l.changes.push(Io(e,t));else{var p=Ue(r.done);for((!p||!p.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,f||be(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,Ue(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=Ue(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=Kn(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 f=0;f<l.length;++f){for(var p=l[f],m=0;m<s.length;++m)if(s[m].marker==p.marker)continue e;s.push(p)}}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?li.prototype.deepCopy.call(s):s);continue}var l=s.changes,f=[];n.push({changes:f});for(var p=0;p<l.length;++p){var m=l[p],T=void 0;if(f.push({from:m.from,to:m.to,text:m.text}),t)for(var M in m)(T=M.match(/^spans_(\d+)$/))&&(ke(t,Number(T[1]))>-1&&(Ue(f)[M]=m[M],delete m[M]))}}return n}function jo(e,t,i,n){if(n){var r=e.anchor;if(i){var s=Qe(t,r)<0;s!=Qe(i,r)<0?(r=t,t=i):s!=Qe(t,i)<0&&(t=i)}return new on(r,t)}else return new on(i||t,t)}function Qr(e,t,i,n,r){r==null&&(r=e.cm&&(e.cm.display.shift||e.extend)),zn(e,new li([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);zn(e,l,i)}function Uo(e,t,i,n){var r=e.sel.ranges.slice(0);r[t]=i,zn(e,fi(e.cm,r,e.sel.primIndex),n)}function Ha(e,t,i,n){zn(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 on(o(e,r[s].anchor),o(e,r[s].head))},origin:i&&i.origin};return be(e,"beforeSelectionChange",e,n),e.cm&&be(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=Ue(n);r&&r.ranges?(n[n.length-1]=t,eo(e,t,i)):zn(e,t,i)}function zn(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||(Qe(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],f=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[s],p=to(e,l.anchor,f&&f.anchor,i,n),m=to(e,l.head,f&&f.head,i,n);(r||p!=l.anchor||m!=l.head)&&(r||(r=t.ranges.slice(0,s)),r[s]=new on(p,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 f=s.markedSpans[l],p=f.marker,m="selectLeft"in p?!p.selectLeft:p.inclusiveLeft,T="selectRight"in p?!p.selectRight:p.inclusiveRight;if((f.from==null||(m?f.from<=t.ch:f.from<t.ch))&&(f.to==null||(T?f.to>=t.ch:f.to>t.ch))){if(r&&(be(p,"beforeCursorEnter"),p.explicitlyCleared))if(s.markedSpans){--l;continue}else break;if(!p.atomic)continue;if(i){var M=p.find(n<0?1:-1),oe=void 0;if((n<0?T:m)&&(M=$a(e,M,-n,M&&M.line==t.line?s:null)),M&&M.line==t.line&&(oe=Qe(M,i))&&(n<0?oe<0:oe>0))return nr(e,M,t,n,r)}var Q=p.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,Le(e.first,0))}function $a(e,t,i,n){return i<0&&t.ch==0?t.line>e.first?o(e,Le(t.line-1)):null:i>0&&t.ch==(n||gt(e,t.line)).text.length?t.line<e.first+e.size-1?Le(t.line+1,0):null:new Le(t.line,t.ch+i)}function Ya(e){e.setSelection(Le(e.firstLine(),0),Le(e.lastLine()),_e)}function Ja(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,f){r&&(n.from=o(e,r)),s&&(n.to=o(e,s)),l&&(n.text=l),f!==void 0&&(n.origin=f)}),be(e,"beforeChange",e,n),e.cm&&be(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 Dn(e.cm,ir)(e,t,i);if(e.cm.state.suppressEdits)return}if((O(e,"beforeChange")||e.cm&&O(e.cm,"beforeChange"))&&(t=Ja(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)qa(e,{from:n[r].from,to:n[r].to,text:r?[""]:t.text,origin:t.origin});else qa(e,t)}function qa(e,t){if(t.text.length==1&&t.text[0]==""&&Qe(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,Kn(e,t));var n=[];Ai(e,function(r,s){!s&&ke(n,r.history)==-1&&(ts(r.history,t),n.push(r.history)),kr(r,t,null,Kn(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,f=t=="undo"?r.done:r.undone,p=t=="undo"?r.undone:r.done,m=0;m<f.length&&!(s=f[m],i?s.ranges&&!s.equals(e.sel):!s.ranges);m++);if(m==f.length)return;for(r.lastOrigin=r.lastSelOrigin=null;;)if(s=f.pop(),s.ranges){if(Zr(s,p),i&&!s.equals(e.sel)){zn(e,s,{clearRedo:!1});return}l=s}else if(n){f.push(s);return}else break;var T=[];Zr(l,p),p.push({changes:T,generation:r.generation}),r.generation=s.generation||++r.maxGeneration;for(var M=O(e,"beforeChange")||e.cm&&O(e.cm,"beforeChange"),oe=function(Be){var Ge=s.changes[Be];if(Ge.origin=t,M&&!Ja(e,Ge,!1))return f.length=0,{};T.push(Io(e,Ge));var tt=Be?Mo(e,Ge):Ue(f);kr(e,Ge,tt,Wa(e,Ge)),!Be&&e.cm&&e.cm.scrollIntoView({from:Ge.from,to:Ti(Ge)});var pt=[];Ai(e,function(nt,xt){!xt&&ke(pt,nt.history)==-1&&(ts(nt.history,Ge),pt.push(nt.history)),kr(nt,Ge,null,Wa(nt,Ge))})},Q=s.changes.length-1;Q>=0;--Q){var Ce=oe(Q);if(Ce)return Ce.v}}function Za(e,t){if(t==0)return;if(e.first+=t,e.sel=new li(lt(e.sel.ranges,function(r){return new on(Le(r.anchor.line+t,r.anchor.ch),Le(r.head.line+t,r.head.ch))}),e.sel.primIndex),e.cm){Jn(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 Dn(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:Le(e.first,0),to:Le(t.to.line+r,t.to.ch),text:[Ue(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:Le(s,gt(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Yt(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,Le(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var n=e.doc,r=e.display,s=t.from,l=t.to,f=!1,p=s.line;e.options.lineWrapping||(p=Pt($n(gt(n,s.line))),n.iter(p,l.line+1,function(Q){if(Q==r.maxLine)return f=!0,!0})),n.sel.contains(t.from,t.to)>-1&&R(e),Do(n,t,i,ma(e)),e.options.lineWrapping||(n.iter(p,s.line+t.text.length,function(Q){var Ce=$i(Q);Ce>r.maxLineLength&&(r.maxLine=Q,r.maxLineLength=Ce,r.maxLineChanged=!0,f=!1)}),f&&(e.curOp.updateMaxLine=!0)),Qt(n,s.line),Er(e,400);var m=t.text.length-(l.line-s.line)-1;t.full?Jn(e):s.line==l.line&&t.text.length==1&&!Da(e.doc,t)?Si(e,s.line,"text"):Jn(e,s.line,l.line+1,m);var T=O(e,"changes"),M=O(e,"change");if(M||T){var oe={from:s,to:l,text:t.text,removed:t.removed,origin:t.origin};M&&Fn(e,"change",e,oe),T&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(oe)}e.display.selForContextMenu=null}function rr(e,t,i,n,r){var s;n||(n=i),Qe(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 f=0;f<s.ranges.length;f++)Qa(s.ranges[f].anchor,t,i,n),Qa(s.ranges[f].head,t,i,n);continue}for(var p=0;p<s.changes.length;++p){var m=s.changes[p];if(i<m.from.line)m.from=Le(m.from.line+n,m.from.ch),m.to=Le(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=Pt(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 f=[];this.collapse(f),this.children=[new Tr(f)],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,f=l;f<r.lines.length;){var p=new Tr(r.lines.slice(f,f+=25));r.height-=p.height,this.children.splice(++n,0,p),p.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=ke(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=Pt(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&&(ii(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;ni(this.doc,n)||qt(n,n.height+r),i&&ii(i,function(){i.curOp.forceUpdate=!0,ns(i,n,r),Fn(i,"lineWidgetChanged",i,e,Pt(n))})},L(Or);function ns(e,t,i){hi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ro(e,i)}function Cl(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 f=l.widgets||(l.widgets=[]);if(r.insertAt==null?f.push(r):f.splice(Math.min(f.length-1,Math.max(0,r.insertAt)),0,r),r.line=l,s&&!ni(e,l)){var p=hi(l)<e.scrollTop;qt(l,l.height+gr(r)),p&&Ro(s,r.height),s.curOp.forceUpdate=!0}return!0}),s&&Fn(s,"lineWidgetAdded",s,r,typeof t=="number"?t:Pt(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],f=Ln(l.markedSpans,this);e&&!this.collapsed?Si(e,Pt(l),"text"):e&&(f.to!=null&&(r=Pt(l)),f.from!=null&&(n=Pt(l))),l.markedSpans=ti(l.markedSpans,f),f.from==null&&this.collapsed&&!ni(this.doc,l)&&e&&qt(l,Ji(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var p=0;p<this.lines.length;++p){var m=$n(this.lines[p]),T=$i(m);T>e.display.maxLineLength&&(e.display.maxLine=m,e.display.maxLineLength=T,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Jn(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=Ln(s.markedSpans,this);if(l.from!=null&&(i=Le(t?s:Pt(s),l.from),e==-1))return i;if(l.to!=null&&(n=Le(t?s:Pt(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;ii(n,function(){var r=t.line,s=Pt(t.line),l=mo(n,s);if(l&&(sa(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!ni(i.doc,r)&&i.height!=null){var f=i.height;i.height=null;var p=gr(i)-f;p&&qt(r,r.height+p)}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||ke(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Oi.prototype.detachLine=function(e){if(this.lines.splice(ke(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},L(Oi);function or(e,t,i,n,r){if(n&&n.shared)return _l(e,t,i,n,r);if(e.cm&&!e.cm.curOp)return Dn(e.cm,or)(e,t,i,n,r);var s=new Oi(e,r),l=Qe(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(Sn(e,t.line,t,i,s)||t.line!=i.line&&Sn(e,i.line,t,i,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");mn()}s.addToHistory&&Ba(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var f=t.line,p=e.cm,m;if(e.iter(f,i.line+1,function(M){p&&s.collapsed&&!p.options.lineWrapping&&$n(M)==p.display.maxLine&&(m=!0),s.collapsed&&f!=t.line&&qt(M,0),wn(M,new En(s,f==t.line?t.ch:null,f==i.line?i.ch:null)),++f}),s.collapsed&&e.iter(t.line,i.line+1,function(M){ni(e,M)&&qt(M,0)}),s.clearOnEnter&&ge(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(ln(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++is,s.atomic=!0),p){if(m&&(p.curOp.updateMaxLine=!0),s.collapsed)Jn(p,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(p,T,"text");s.atomic&&Xa(p.doc),Fn(p,"markerAdded",p,s)}return s}var Lr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Lr.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")},Lr.prototype.find=function(e,t){return this.primary.find(e,t)},L(Lr);function _l(e,t,i,n,r){n=g(n),n.shared=!1;var s=[or(e,t,i,n,r)],l=s[0],f=n.widgetNode;return Ai(e,function(p){f&&(n.widgetNode=f.cloneNode(!0)),s.push(or(p,o(p,t),o(p,i),n,r));for(var m=0;m<p.linked.length;++m)if(p.linked[m].isParent)return;l=Ue(s)}),new Lr(s,l)}function rs(e){return e.findMarks(Le(e.first,0),e.clipPos(Le(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(Qe(s,l)){var f=or(e,s,l,n.primary,n.primary.type);n.markers.push(f),f.parent=n}}}function wl(e){for(var t=function(n){var r=e[n],s=[r.primary.doc];Ai(r.primary.doc,function(p){return s.push(p)});for(var l=0;l<r.markers.length;l++){var f=r.markers[l];ke(s,f.doc)==-1&&(f.parent=null,r.markers.splice(l--,1))}},i=0;i<e.length;i++)t(i)}var Sl=0,qn=function(e,t,i,n,r){if(!(this instanceof qn))return new qn(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=Le(i,0);this.sel=Ri(s),this.history=new qr(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}),zn(this,Ri(s),_e)};qn.prototype=Ye(Ar.prototype,{constructor:qn,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=Lt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:In(function(e){var t=Le(this.first,0),i=this.first+this.size-1;ir(this,{from:t,to:Le(i,gt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&br(this.cm,0,0),zn(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=Yt(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(Xn(this,e))return gt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),$n(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:In(function(e,t,i){Ha(this,o(this,typeof e=="number"?Le(e,t||0):e),null,i)}),setSelection:In(function(e,t,i){Ha(this,o(this,e),o(this,t||e),i)}),extendSelection:In(function(e,t,i){Qr(this,o(this,e),t&&o(this,t),i)}),extendSelections:In(function(e,t){za(this,u(this,e),t)}),extendSelectionsBy:In(function(e,t){var i=lt(this.sel.ranges,e);za(this,u(this,i),t)}),setSelections:In(function(e,t,i){if(!e.length)return;for(var n=[],r=0;r<e.length;r++)n[r]=new on(o(this,e[r].anchor),o(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),zn(this,fi(this.cm,n,t),i)}),addSelection:In(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new on(o(this,e),o(this,t||e))),zn(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=Yt(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=Yt(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:In(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 f=t&&t!="end"&&dl(this,n,t),p=n.length-1;p>=0;p--)ir(this,n[p]);f?Ga(this,f):this.cm&&Qi(this.cm)}),undo:In(function(){no(this,"undo")}),redo:In(function(){no(this,"redo")}),undoSelection:In(function(){no(this,"undo",!0)}),redoSelection:In(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 qr(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 qr(this.history.maxGeneration);t.done=tr(e.done.slice(0),null,!0),t.undone=tr(e.undone.slice(0),null,!0)},setGutterMarker:In(function(e,t,i){return Rr(this,e,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&Xe(r)&&(n.gutterMarkers=null),!0})}),clearGutter:In(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Rr(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Xe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xn(this,e))return null;if(t=e,e=gt(this,e),!e)return null}else if(t=Pt(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:In(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(re(i).test(n[r]))return!1;n[r]+=" "+i}return!0})}),removeLineClass:In(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(re(i));if(!l)return!1;var f=l.index+l[0].length;n[r]=s.slice(0,l.index)+(!l.index||f==s.length?"":" ")+s.slice(f)||null}else return!1;return!0})}),addLineWidget:In(function(e,t,i){return Cl(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 f=0;f<l.length;f++){var p=l[f];!(p.to!=null&&r==e.line&&e.ch>=p.to||p.from==null&&r!=e.line||p.from!=null&&r==t.line&&p.from>=t.ch)&&(!i||i(p.marker))&&n.push(p.marker.parent||p.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,Le(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 qn(Lt(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 qn(Lt(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 qr(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:In(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),qn.prototype.eachLine=qn.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,f=function(){++l==r&&Dn(t,function(){i=o(t.doc,i);var Q={from:i,to:i,text:t.doc.splitLines(s.filter(function(Ce){return Ce!=null}).join(t.doc.lineSeparator())),origin:"paste"};ir(t.doc,Q),Ga(t.doc,Ri(o(t.doc,i),o(t.doc,Ti(Q))))})()},p=function(Q,Ce){if(t.options.allowDropFileTypes&&ke(t.options.allowDropFileTypes,Q.type)==-1){f();return}var Be=new FileReader;Be.onerror=function(){return f()},Be.onload=function(){var Ge=Be.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ge)){f();return}s[Ce]=Ge,f()},Be.readAsText(Q)},m=0;m<n.length;m++)p(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 oe=0;oe<M.length;++oe)rr(t.doc,"",M[oe].anchor,M[oe].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;ge(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ll)},100))}),ge(window,"blur",function(){return ss(Zi)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Li={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"},Pr=0;Pr<10;Pr++)Li[Pr+48]=Li[Pr+96]=String(Pr);for(var io=65;io<=90;io++)Li[io]=String.fromCharCode(io);for(var Mr=1;Mr<=12;Mr++)Li[Mr+111]=Li[Mr+63235]="F"+Mr;var Ci={};Ci.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"},Ci.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"},Ci.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"},Ci.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"]},Ci.default=ie?Ci.macDefault:Ci.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,n,r,s,l=0;l<t.length-1;l++){var f=t[l];if(/^(cmd|meta|m)$/i.test(f))s=!0;else if(/^a(lt)?$/i.test(f))i=!0;else if(/^(c|ctrl|control)$/i.test(f))n=!0;else if(/^s(hift)?$/i.test(f))r=!0;else throw new Error("Unrecognized modifier name: "+f)}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=lt(i.split(" "),Pl),s=0;s<r.length;s++){var l=void 0,f=void 0;s==r.length-1?(f=r.join(" "),l=n):(f=r.slice(0,s+1).join(" "),l="...");var p=t[f];if(!p)t[f]=l;else if(p!=l)throw new Error("Inconsistent bindings for "+f)}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:Li[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=Li[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"?Ci[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&&Qe(s.from,Ue(n).to)<=0;){var l=n.pop();if(Qe(l.from,s.from)<0){s.from=l.from;break}}n.push(s)}ii(e,function(){for(var f=n.length-1;f>=0;f--)rr(e.doc,"",n[f].from,n[f].to,"+delete");Qi(e)})}function Bo(e,t,i){var n=Me(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 Le(t.line,n,i<0?"after":"before")}function Wo(e,t,i,n,r){if(e){t.doc.direction=="rtl"&&(r=-r);var s=Ct(i,t.doc.direction);if(s){var l=r<0?Ue(s):s[0],f=r<0==(l.level==1),p=f?"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(oe){return yi(t,T,oe).top==M},r<0==(l.level==1)?l.from:l.to-1,m),p=="before"&&(m=Bo(i,m,1))}else m=r<0?l.to:l.from;return new Le(n,m,p)}}return new Le(n,r<0?i.text.length:0,r<0?"before":"after")}function Nl(e,t,i,n){var r=Ct(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=ut(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 f=function(tt,pt){return Bo(t,tt instanceof Le?tt.ch:tt,pt)},p,m=function(tt){return e.options.lineWrapping?(p=p||Yi(e,t),pa(e,t,p,tt)):{begin:0,end:t.text.length}},T=m(i.sticky=="before"?f(i,-1):i.ch);if(e.doc.direction=="rtl"||l.level==1){var M=l.level==1==n<0,oe=f(i,M?1:-1);if(oe!=null&&(M?oe<=l.to&&oe<=T.end:oe>=l.from&&oe>=T.begin)){var Q=M?"before":"after";return new Le(i.line,oe,Q)}}var Ce=function(tt,pt,nt){for(var xt=function(dn,jn){return jn?new Le(i.line,f(dn,1),"before"):new Le(i.line,dn,"after")};tt>=0&&tt<r.length;tt+=pt){var jt=r[tt],Dt=pt>0==(jt.level!=1),Vt=Dt?nt.begin:f(nt.end,-1);if(jt.from<=Vt&&Vt<jt.to)return xt(Vt,Dt);if(Vt=Dt?jt.from:f(jt.to,-1),nt.begin<=Vt&&Vt<nt.end)return xt(Vt,Dt)}},Be=Ce(s+n,n,T);if(Be)return Be;var Ge=n>0?T.end:f(T.begin,-1);return Ge!=null&&!(n>0&&Ge==t.text.length)&&(Be=Ce(n>0?0:r.length-1,n,m(Ge)),Be)?Be: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:Le(t.head.line+1,0)}:{from:t.head,to:Le(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sr(e,function(t){return{from:Le(t.from().line,0),to:o(e.doc,Le(t.to().line+1,0))}})},delLineLeft:function(e){return sr(e,function(t){return{from:Le(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(Le(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Le(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 fs(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")},Re)},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")},Re)},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/)?fs(e,t.head):n},Re)},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=J(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 ii(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 Le(r.line,r.ch-1)),r.ch>0)r=new Le(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),Le(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 Le(r.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),Le(r.line-1,l.length-1),r,"+transpose"))}}i.push(new on(r,r))}e.setSelections(i)})},newlineAndIndent:function(e){return ii(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=$n(i);return n!=i&&(t=Pt(n)),Wo(!0,e,n,t,1)}function Dl(e,t){var i=gt(e.doc,t),n=Xi(i);return n!=i&&(t=Pt(n)),Wo(!0,e,i,t,-1)}function fs(e,t){var i=ds(e,t.line),n=gt(e.doc,i.line),r=Ct(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 Le(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)!=it}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 Ae;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())}),ps(e,r+" "+t,i,n))return!0}return ps(e,t,i,n)}function ps(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&&!Ut&&(ie?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),ae&&!ie&&!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;de(t,"CodeMirror-crosshair");function i(n){(n.keyCode==18||!n.altKey)&&(X(t,"CodeMirror-crosshair"),ct(document,"keyup",i),ct(document,"mouseover",i))}ge(document,"keyup",i),ge(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||ie&&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&&Qe(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 f=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),f=l(e,i)!=it}finally{e.state.suppressEdits=!1}return f})}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=ie?i.metaKey:i.ctrlKey),r.moveOnDrag==null&&(r.moveOnDrag=!(ie?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&&ce&&!e.isReadOnly()&&i=="single"&&(l=s.contains(t))>-1&&(Qe((l=s.ranges[l]).from(),t)<0||t.xRel>0)&&(Qe(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=Dn(e,function(m){W&&(r.scroller.draggable=!1),e.state.draggingText=!1,ct(r.wrapper.ownerDocument,"mouseup",l),ct(r.wrapper.ownerDocument,"mousemove",f),ct(r.scroller,"dragstart",p),ct(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())}),f=function(m){s=s||Math.abs(t.clientX-m.clientX)+Math.abs(t.clientY-m.clientY)>=10},p=function(){return s=!0};W&&(r.scroller.draggable=!0),e.state.draggingText=l,l.copy=!n.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),ge(r.wrapper.ownerDocument,"mouseup",l),ge(r.wrapper.ownerDocument,"mousemove",f),ge(r.scroller,"dragstart",p),ge(r.scroller,"drop",l),xa(e),setTimeout(function(){return r.input.focus()},20)}function xs(e,t,i){if(i=="char")return new on(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new on(Le(t.line,0),o(e.doc,Le(t.line+1,0)));var n=i(e,t);return new on(n.from,n.to)}function Xl(e,t,i,n){var r=e.display,s=e.doc;y(t);var l,f,p=s.sel,m=p.ranges;if(n.addNew&&!n.extend?(f=s.sel.contains(i),f>-1?l=m[f]:l=new on(i,i)):(l=s.sel.primary(),f=s.sel.primIndex),n.unit=="rectangle")n.addNew||(l=new on(i,i)),i=Ui(e,t,!0,!0),f=-1;else{var T=xs(e,i,n.unit);n.extend?l=jo(l,T.anchor,T.head,n.extend):l=T}n.addNew?f==-1?(f=m.length,zn(s,fi(e,m.concat([l]),f),{scroll:!1,origin:"*mouse"})):m.length>1&&m[f].empty()&&n.unit=="char"&&!n.extend?(zn(s,fi(e,m.slice(0,f).concat(m.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),p=s.sel):Uo(s,f,l,Ie):(f=0,zn(s,new li([l],0),Ie),p=s.sel);var M=i;function oe(nt){if(Qe(M,nt)==0)return;if(M=nt,n.unit=="rectangle"){for(var xt=[],jt=e.options.tabSize,Dt=J(gt(s,i.line).text,i.ch,jt),Vt=J(gt(s,nt.line).text,nt.ch,jt),dn=Math.min(Dt,Vt),jn=Math.max(Dt,Vt),bn=Math.min(i.line,nt.line),ri=Math.min(e.lastLine(),Math.max(i.line,nt.line));bn<=ri;bn++){var Zn=gt(s,bn).text,An=Oe(Zn,dn,jt);dn==jn?xt.push(new on(Le(bn,An),Le(bn,An))):Zn.length>An&&xt.push(new on(Le(bn,An),Le(bn,Oe(Zn,jn,jt))))}xt.length||xt.push(new on(i,i)),zn(s,fi(e,p.ranges.slice(0,f).concat(xt),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var Qn=l,Wn=xs(e,nt,n.unit),Pn=Qn.anchor,On;Qe(Wn.anchor,Pn)>0?(On=Wn.head,Pn=xn(Qn.from(),Wn.anchor)):(On=Wn.anchor,Pn=vn(Qn.to(),Wn.head));var _n=p.ranges.slice(0);_n[f]=Kl(e,new on(o(s,Pn),On)),zn(s,fi(e,_n,f),Ie)}}var Q=r.wrapper.getBoundingClientRect(),Ce=0;function Be(nt){var xt=++Ce,jt=Ui(e,nt,!0,n.unit=="rectangle");if(!jt)return;if(Qe(jt,M)!=0){e.curOp.focus=G(),oe(jt);var Dt=Kr(r,s);(jt.line>=Dt.to||jt.line<Dt.from)&&setTimeout(Dn(e,function(){Ce==xt&&Be(nt)}),150)}else{var Vt=nt.clientY<Q.top?-20:nt.clientY>Q.bottom?20:0;Vt&&setTimeout(Dn(e,function(){if(Ce!=xt)return;r.scroller.scrollTop+=Vt,Be(nt)}),50)}}function Ge(nt){e.state.selectingText=!1,Ce=Infinity,nt&&(y(nt),r.input.focus()),ct(r.wrapper.ownerDocument,"mousemove",tt),ct(r.wrapper.ownerDocument,"mouseup",pt),s.history.lastSelOrigin=null}var tt=Dn(e,function(nt){nt.buttons===0||!F(nt)?Ge(nt):Be(nt)}),pt=Dn(e,Ge);e.state.selectingText=pt,ge(r.wrapper.ownerDocument,"mousemove",tt),ge(r.wrapper.ownerDocument,"mouseup",pt)}function Kl(e,t){var i=t.anchor,n=t.head,r=gt(e.doc,i.line);if(Qe(i,n)==0&&i.sticky==n.sticky)return t;var s=Ct(r);if(!s)return t;var l=ut(s,i.ch,i.sticky),f=s[l];if(f.from!=i.ch&&f.to!=i.ch)return t;var p=l+(f.from==i.ch==(f.level!=1)?0:1);if(p==0||p==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=ut(s,n.ch,n.sticky),M=T-l||(n.ch-i.ch)*(f.level==1?-1:1);T==p-1||T==p?m=M<0:m=M>0}var oe=s[p+(m?-1:0)],Q=m==(oe.level==1),Ce=Q?oe.from:oe.to,Be=Q?"after":"before";return i.ch==Ce&&i.sticky==Be?t:new on(new Le(i.line,Ce,Be),n)}function Cs(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(oe){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&y(t);var l=e.display,f=l.lineDiv.getBoundingClientRect();if(s>f.bottom||!O(e,i))return _(t);s-=f.top-l.viewOffset;for(var p=0;p<e.display.gutterSpecs.length;++p){var m=l.gutters.childNodes[p];if(m&&m.getBoundingClientRect().right>=r){var T=gn(e.doc,s),M=e.display.gutterSpecs[p];return be(e,i,e,T,M.className,t),_(t)}}}function Go(e,t){return Cs(e,t,"gutterClick",!0)}function _s(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")?Cs(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(f,p,m){m!=lr&&s(f,p,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),Jn(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(p){for(var m=0;;){var T=p.text.indexOf(r,m);if(T==-1)break;m=T+r.length,s.push(Le(l,T))}l++});for(var f=s.length-1;f>=0;f--)rr(n.doc,r,s[f],Le(s[f].line,s[f].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",tn,function(n){return n.refresh()},!0),i("electricChars",!0),i("inputStyle",he?"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),f=s!=lr&&ro(s);f&&f.detach&&f.detach(n,l),l.attach&&l.attach(n,f||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,ql,!0),i("gutters",[],function(n,r){n.display.gutterSpecs=Po(r,n.options.lineNumbers),wr(n)},!0),i("fixedGutter",!0,function(n,r){n.display.gutters.style.left=r?_o(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=Po(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,Jl),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 Jl(e,t,i){var n=i&&i!=lr;if(!t!=!n){var r=e.display.dragFunctions,s=t?ge:ct;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 ql(e){e.options.lineWrapping?(de(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(X(e.display.wrapper,"CodeMirror-wrap"),Fr(e)),Eo(e),Jn(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 qn(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 Ae,keySeq:null,specialChars:null},t.autofocus&&!he&&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&&!he||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 f=0;f<Vo.length;++f)Vo[f](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;ge(t.scroller,"mousedown",Dn(e,bs)),j&&ee<11?ge(t.scroller,"dblclick",Dn(e,function(p){if(Ee(e,p))return;var m=Ui(e,p);if(!m||Go(e,p)||xi(e.display,p))return;y(p);var T=e.findWordAt(m);Qr(e.doc,T.anchor,T.head)})):ge(t.scroller,"dblclick",function(p){return Ee(e,p)||y(p)}),ge(t.scroller,"contextmenu",function(p){return _s(e,p)}),ge(t.input.getField(),"contextmenu",function(p){t.scroller.contains(p.target)||_s(e,p)});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(p){if(p.touches.length!=1)return!1;var m=p.touches[0];return m.radiusX<=1&&m.radiusY<=1}function l(p,m){if(m.left==null)return!0;var T=m.left-p.left,M=m.top-p.top;return T*T+M*M>20*20}ge(t.scroller,"touchstart",function(p){if(!Ee(e,p)&&!s(p)&&!Go(e,p)){t.input.ensurePolled(),clearTimeout(i);var m=+new Date;t.activeTouch={start:m,moved:!1,prev:m-n.end<=300?n:null},p.touches.length==1&&(t.activeTouch.left=p.touches[0].pageX,t.activeTouch.top=p.touches[0].pageY)}}),ge(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ge(t.scroller,"touchend",function(p){var m=t.activeTouch;if(m&&!xi(t,p)&&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 on(T,T):!m.prev.prev||l(m,m.prev.prev)?M=e.findWordAt(T):M=new on(Le(T.line,0),o(e.doc,Le(T.line+1,0))),e.setSelection(M.anchor,M.head),e.focus(),y(p)}r()}),ge(t.scroller,"touchcancel",r),ge(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xr(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ge(t.scroller,"mousewheel",function(p){return Pa(e,p)}),ge(t.scroller,"DOMMouseScroll",function(p){return Pa(e,p)}),ge(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(p){Ee(e,p)||E(p)},over:function(p){Ee(e,p)||(Tl(e,p),E(p))},start:function(p){return Rl(e,p)},drop:Dn(e,kl),leave:function(p){Ee(e,p)||as(e)}};var f=t.input.getField();ge(f,"keyup",function(p){return vs.call(e,p)}),ge(f,"keydown",Dn(e,gs)),ge(f,"keypress",Dn(e,ys)),ge(f,"focus",function(p){return So(e,p)}),ge(f,"blur",function(p){return Zi(e,p)})}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=Je(e,t).state:i="prev");var l=e.options.tabSize,f=gt(r,t),p=J(f.text,null,l);f.stateAfter&&(f.stateAfter=null);var m=f.text.match(/^\s*/)[0],T;if(!n&&!/\S/.test(f.text))T=0,i="not";else if(i=="smart"&&(T=r.mode.indent(s,f.text.slice(m.length),f.text),T==it||T>150)){if(!n)return;i="prev"}i=="prev"?t>r.first?T=J(gt(r,t-1).text,null,l):T=0:i=="add"?T=p+e.options.indentUnit:i=="subtract"?T=p-e.options.indentUnit:typeof i=="number"&&(T=p+i),T=Math.max(0,T);var M="",oe=0;if(e.options.indentWithTabs)for(var Q=Math.floor(T/l);Q;--Q)oe+=l,M+=" ";if(oe<T&&(M+=w(T-oe)),M!=m)return rr(r,M,Le(t,0),Le(t,m.length),"+input"),f.stateAfter=null,!0;for(var Ce=0;Ce<r.sel.ranges.length;Ce++){var Be=r.sel.ranges[Ce];if(Be.head.line==t&&Be.head.ch<m.length){var Ge=Le(t,m.length);Uo(r,Ce,new on(Ge,Ge));break}}}var pi=null;function so(e){pi=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,f=r=="paste"||e.state.pasteIncoming>l,p=Ot(t),m=null;if(f&&n.ranges.length>1)if(pi&&pi.text.join(`
|
|
`)==t){if(n.ranges.length%pi.text.length==0){m=[];for(var T=0;T<pi.text.length;T++)m.push(s.splitLines(pi.text[T]))}}else p.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(m=lt(p,function(tt){return[tt]}));for(var M=e.curOp.updateInput,oe=n.ranges.length-1;oe>=0;oe--){var Q=n.ranges[oe],Ce=Q.from(),Be=Q.to();Q.empty()&&(i&&i>0?Ce=Le(Ce.line,Ce.ch-i):e.state.overwrite&&!f?Be=Le(Be.line,Math.min(gt(s,Be.line).text.length,Be.ch+Ue(p).length)):f&&pi&&pi.lineWise&&pi.text.join(`
|
|
`)==p.join(`
|
|
`)&&(Ce=Be=Le(Ce.line,0)));var Ge={from:Ce,to:Be,text:m?m[oe%m.length]:p,origin:r||(f?"paste":e.state.cutIncoming>l?"cut":"+input")};ir(e.doc,Ge),Fn(e,"inputRead",e,Ge)}t&&!f&&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&&ii(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 f=0;f<s.electricChars.length;f++)if(t.indexOf(s.electricChars.charAt(f))>-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:Le(r,0),head:Le(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"),q&&(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)&&Dn(this,t[n])(this,r,l),be(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:Gn(function(n,r){var s=n.token?n:e.getMode(this.options,n);if(s.startState)throw new Error("Overlays may not be stateful.");St(this.state.overlays,{mode:s,modeSpec:n,opaque:r&&r.opaque,priority:r&&r.priority||0},function(l){return l.priority}),this.state.modeGen++,Jn(this)}),removeOverlay:Gn(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++,Jn(this);return}}}),indentLine:Gn(function(n,r,s){typeof r!="string"&&typeof r!="number"&&(r==null?r=this.options.smartIndent?"smart":"prev":r=r?"add":"subtract"),Xn(this.doc,n)&&Ur(this,n,r,s)}),indentSelection:Gn(function(n){for(var r=this.doc.sel.ranges,s=-1,l=0;l<r.length;l++){var f=r[l];if(f.empty())f.head.line>s&&(Ur(this,f.head.line,n,!0),s=f.head.line,l==this.doc.sel.primIndex&&Qi(this));else{var p=f.from(),m=f.to(),T=Math.max(s,p.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 oe=this.doc.sel.ranges;p.ch==0&&r.length==oe.length&&oe[l].from().ch>0&&Uo(this.doc,l,new on(p,oe[l].to()),_e)}}}),getTokenAt:function(n,r){return ht(this,n,r)},getLineTokens:function(n,r){return ht(this,Le(n),r,!0)},getTokenTypeAt:function(n){n=o(this.doc,n);var r=Te(this,gt(this.doc,n.line)),s=0,l=(r.length-1)/2,f=n.ch,p;if(f==0)p=r[2];else for(;;){var m=s+l>>1;if((m?r[m*2-1]:0)>=f)l=m;else if(r[m*2+1]<f)s=m+1;else{p=r[m*2+2];break}}var T=p?p.indexOf("overlay "):-1;return T<0?p:T==0?null:p.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],f=this.getModeAt(n);if(typeof f[r]=="string")l[f[r]]&&s.push(l[f[r]]);else if(f[r])for(var p=0;p<f[r].length;p++){var m=l[f[r][p]];m&&s.push(m)}else f.helperType&&l[f.helperType]?s.push(l[f.helperType]):l[f.name]&&s.push(l[f.name]);for(var T=0;T<l._global.length;T++){var M=l._global[T];M.pred(f,this)&&ke(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),Je(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(),di(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,f;if(typeof n=="number"){var p=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>p&&(n=p,l=!0),f=gt(this.doc,n)}else f=n;return Hr(this,f,{top:0,left:0},r||"page",s||l).top+(l?this.doc.height-hi(f):0)},defaultTextHeight:function(){return Ji(this.display)},defaultCharWidth:function(){return qi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,r,s,l,f){var p=this.display;n=di(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),p.sizer.appendChild(r),l=="over")m=n.top;else if(l=="above"||l=="near"){var M=Math.max(p.wrapper.clientHeight,this.doc.height),oe=Math.max(p.sizer.clientWidth,p.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>oe&&(T=oe-r.offsetWidth)}r.style.top=m+"px",r.style.left=r.style.right="",f=="right"?(T=p.sizer.clientWidth-r.offsetWidth,r.style.right="0px"):(f=="left"?T=0:f=="middle"&&(T=(p.sizer.clientWidth-r.offsetWidth)/2),r.style.left=T+"px"),s&&Js(this,{left:T,top:m,right:T+r.offsetWidth,bottom:m+r.offsetHeight})},triggerOnKeyDown:Gn(gs),triggerOnKeyPress:Gn(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Gn(bs),execCommand:function(n){if(Nr.hasOwnProperty(n))return Nr[n].call(null,this)},triggerElectric:Gn(function(n){ks(this,n)}),findPosH:function(n,r,s,l){var f=1;r<0&&(f=-1,r=-r);for(var p=o(this.doc,n),m=0;m<r&&!(p=Ko(this.doc,p,f,s,l),p.hitSide);++m);return p},moveH:Gn(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()},Re)}),deleteH:Gn(function(n,r){var s=this.doc.sel,l=this.doc;s.somethingSelected()?l.replaceSelection("",null,"+delete"):sr(this,function(f){var p=Ko(l,f.head,n,r,!1);return n<0?{from:p,to:f.head}:{from:f.head,to:p}})}),findPosV:function(n,r,s,l){var f=1,p=l;r<0&&(f=-1,r=-r);for(var m=o(this.doc,n),T=0;T<r;++T){var M=di(this,m,"div");if(p==null?p=M.left:M.left=p,m=Os(this,M,f,s),m.hitSide)break}return m},moveV:Gn(function(n,r){var s=this,l=this.doc,f=[],p=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(T){if(p)return n<0?T.from():T.to();var M=di(s,T.head,"div");T.goalColumn!=null&&(M.left=T.goalColumn),f.push(M.left);var oe=Os(s,M,n,r);return r=="page"&&T==l.sel.primary()&&Ro(s,vo(s,oe,"div").top-M.top),oe},Re),f.length)for(var m=0;m<l.sel.ranges.length;m++)l.sel.ranges[m].goalColumn=f[m]}),findWordAt:function(n){var r=this.doc,s=gt(r,n.line).text,l=n.ch,f=n.ch;if(s){var p=this.getHelper(n,"wordChars");(n.sticky=="before"||f==s.length)&&l?--l:++f;for(var m=s.charAt(l),T=Fe(m,p)?function(M){return Fe(M,p)}:/\s/.test(m)?function(M){return/\s/.test(M)}:function(M){return!/\s/.test(M)&&!Fe(M)};l>0&&T(s.charAt(l-1));)--l;for(;f<s.length&&T(s.charAt(f));)++f}return new on(Le(n.line,l),Le(n.line,f))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?de(this.display.cursorDiv,"CodeMirror-overwrite"):X(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==G()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Gn(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:po(this),clientWidth:Ii(this)}},scrollIntoView:Gn(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:Le(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?qs(this,n):_a(this,n.from,n.to,n.margin)}),setSize:Gn(function(n,r){var s=this,l=function(p){return typeof p=="number"||/^\d+$/.test(String(p))?p+"px":p};n!=null&&(this.display.wrapper.style.width=l(n)),r!=null&&(this.display.wrapper.style.height=l(r)),this.options.lineWrapping&&la(this);var f=this.display.viewFrom;this.doc.iter(f,this.display.viewTo,function(p){if(p.widgets){for(var m=0;m<p.widgets.length;m++)if(p.widgets[m].noHScroll){Si(s,f,"widget");break}}++f}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(n){return ii(this,n)},startOperation:function(){return zi(this)},endOperation:function(){return Hi(this)},refresh:Gn(function(){var n=this.display.cachedTextHeight;Jn(this),this.curOp.forceUpdate=!0,vr(this),br(this,this.doc.scrollLeft,this.doc.scrollTop),Oo(this.display),(n==null||Math.abs(n-Ji(this.display))>.5||this.options.lineWrapping)&&Eo(this),be(this,"refresh",this)}),swapDoc:Gn(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}},L(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,f=gt(e,t.line),p=r&&e.direction=="rtl"?-i:i;function m(){var pt=t.line+p;return pt<e.first||pt>=e.first+e.size?!1:(t=new Le(pt,t.ch,t.sticky),f=gt(e,pt))}function T(pt){var nt;if(n=="codepoint"){var xt=f.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(xt)?nt=null:nt=new Le(t.line,Math.max(0,Math.min(f.text.length,t.ch+i*(xt>=55296&&xt<56320?2:1))),-i)}else r?nt=Nl(e.cm,f,t,i):nt=Fo(f,t,i);if(nt==null)if(!pt&&m())t=Wo(r,e.cm,f,t.line,p);else return!1;else t=nt;return!0}if(n=="char"||n=="codepoint")T();else if(n=="column")T(!0);else if(n=="word"||n=="group")for(var M=null,oe=n=="group",Q=e.cm&&e.cm.getHelper(t,"wordChars"),Ce=!0;!(i<0&&!T(!Ce));Ce=!1){var Be=f.text.charAt(t.ch)||`
|
|
`,Ge=Fe(Be,Q)?"w":oe&&Be==`
|
|
`?"n":!oe||/\s/.test(Be)?null:"p";if(oe&&!Ce&&!Ge&&(Ge="s"),M&&M!=Ge){i<0&&(i=1,T(),t.sticky="after");break}if(Ge&&(M=Ge),i>0&&!T(!Ce))break}var tt=to(e,t,s,l,!0);return sn(s,tt)&&(tt.hitSide=!0),tt}function Os(e,t,i,n){var r=e.doc,s=t.left,l;if(n=="page"){var f=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),p=Math.max(f-.5*Ji(e.display),3);l=(i>0?t.bottom:t.top)+i*p}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 Ae,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(f){for(var p=f.target;p;p=p.parentNode){if(p==r)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(p.className))break}return!1}ge(r,"paste",function(f){if(!s(f)||Ee(n,f)||Ss(f,n))return;ee<=11&&setTimeout(Dn(n,function(){return t.updateFromDOM()}),20)}),ge(r,"compositionstart",function(f){t.composing={data:f.data,done:!1}}),ge(r,"compositionupdate",function(f){t.composing||(t.composing={data:f.data,done:!1})}),ge(r,"compositionend",function(f){t.composing&&(f.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ge(r,"touchstart",function(){return i.forceCompositionEnd()}),ge(r,"input",function(){t.composing||t.readFromDOMSoon()});function l(f){if(!s(f)||Ee(n,f))return;if(n.somethingSelected())so({lineWise:!1,text:n.getSelections()}),f.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var p=Rs(n);so({lineWise:!0,text:p.text}),f.type=="cut"&&n.operation(function(){n.setSelections(p.ranges,0,_e),n.replaceSelection("",null,"cut")})}else return;if(f.clipboardData){f.clipboardData.clearData();var m=pi.text.join(`
|
|
`);if(f.clipboardData.setData("Text",m),f.clipboardData.getData("Text")==m){f.preventDefault();return}}var T=As(),M=T.firstChild;n.display.lineSpace.insertBefore(T,n.display.lineSpace.firstChild),M.value=pi.text.join(`
|
|
`);var oe=document.activeElement;xe(M),setTimeout(function(){n.display.lineSpace.removeChild(T),oe.focus(),oe==r&&i.showPrimarySelection()},50)}ge(r,"copy",l),ge(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&&Qe(xn(s,l),n)==0&&Qe(vn(s,l),r)==0)return;var f=t.display.view,p=n.line>=t.display.viewFrom&&Ls(t,n)||{node:f[0].measure.map[2],offset:0},m=r.line<t.display.viewTo&&Ls(t,r);if(!m){var T=f[f.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(!p||!m){e.removeAllRanges();return}var oe=e.rangeCount&&e.getRangeAt(0),Q;try{Q=D(p.node,p.offset,m.offset,m.node)}catch(Ce){}Q&&(!ae&&t.state.focused?(e.collapse(p.node,p.offset),Q.collapsed||(e.removeAllRanges(),e.addRange(Q))):(e.removeAllRanges(),e.addRange(Q)),oe&&e.anchorNode==null?e.addRange(oe):ae&&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():ii(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&&P&&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&&ii(t,function(){zn(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=Le(n.line-1,gt(e.doc,n.line-1).length)),r.ch==gt(e.doc,r.line).text.length&&r.line<e.lastLine()&&(r=Le(r.line+1,0)),n.line<t.viewFrom||r.line>t.viewTo-1)return!1;var s,l,f;n.line==t.viewFrom||(s=Bi(e,n.line))==0?(l=Pt(t.view[0].line),f=t.view[0].node):(l=Pt(t.view[s].line),f=t.view[s-1].node.nextSibling);var p=Bi(e,r.line),m,T;if(p==t.view.length-1?(m=t.viewTo-1,T=t.lineDiv.lastChild):(m=Pt(t.view[p+1].line)-1,T=t.view[p+1].node.previousSibling),!f)return!1;for(var M=e.doc.splitLines(tu(e,f,T,l,m)),oe=Yt(e.doc,Le(l,0),Le(m,gt(e.doc,m).text.length));M.length>1&&oe.length>1;)if(Ue(M)==Ue(oe))M.pop(),oe.pop(),m--;else if(M[0]==oe[0])M.shift(),oe.shift(),l++;else break;for(var Q=0,Ce=0,Be=M[0],Ge=oe[0],tt=Math.min(Be.length,Ge.length);Q<tt&&Be.charCodeAt(Q)==Ge.charCodeAt(Q);)++Q;for(var pt=Ue(M),nt=Ue(oe),xt=Math.min(pt.length-(M.length==1?Q:0),nt.length-(oe.length==1?Q:0));Ce<xt&&pt.charCodeAt(pt.length-Ce-1)==nt.charCodeAt(nt.length-Ce-1);)++Ce;if(M.length==1&&oe.length==1&&l==n.line)for(;Q&&Q>n.ch&&pt.charCodeAt(pt.length-Ce-1)==nt.charCodeAt(nt.length-Ce-1);)Q--,Ce++;M[M.length-1]=pt.slice(0,pt.length-Ce).replace(/^\u200b+/,""),M[0]=M[0].slice(Q).replace(/\u200b+$/,"");var jt=Le(l,Q),Dt=Le(m,oe.length?Ue(oe).length-Ce:0);if(M.length>1||M[0]||Qe(jt,Dt))return rr(e.doc,M,jt,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())&&ii(this.cm,function(){return Jn(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()||Dn(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 Ls(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=Ct(n,e.doc.direction),l="left";if(s){var f=ut(s,t.ch);l=f%2?"right":"left"}var p=aa(r.map,t.ch,l);return p.offset=p.collapse=="right"?p.end:p.start,p}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,f=e.doc.lineSeparator(),p=!1;function m(Q){return function(Ce){return Ce.id==Q}}function T(){l&&(s+=f,p&&(s+=f),l=p=!1)}function M(Q){Q&&(T(),s+=Q)}function oe(Q){if(Q.nodeType==1){var Ce=Q.getAttribute("cm-text");if(Ce){M(Ce);return}var Be=Q.getAttribute("cm-marker"),Ge;if(Be){var tt=e.findMarks(Le(n,0),Le(r+1,0),m(+Be));tt.length&&(Ge=tt[0].find(0))&&M(Yt(e.doc,Ge.from,Ge.to).join(f));return}if(Q.getAttribute("contenteditable")=="false")return;var pt=/^(pre|div|p|li|table|br)$/i.test(Q.nodeName);if(!/^br$/i.test(Q.nodeName)&&Q.textContent.length==0)return;pt&&T();for(var nt=0;nt<Q.childNodes.length;nt++)oe(Q.childNodes[nt]);/^(pre|p)$/i.test(Q.nodeName)&&(p=!0),pt&&(l=!0)}else Q.nodeType==3&&M(Q.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(oe(t),t==i);)t=t.nextSibling,p=!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(Le(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(Le(Pt(e.line),0),!0);if(t==n&&(r=!0,t=n.childNodes[i],i=0,!t)){var s=e.rest?Ue(e.rest):e.line;return ur(Le(Pt(s),s.text.length),r)}var l=t.nodeType==3?t:null,f=t;for(!l&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(l=t.firstChild,i&&(i=l.nodeValue.length));f.parentNode!=n;)f=f.parentNode;var p=e.measure,m=p.maps;function T(Ge,tt,pt){for(var nt=-1;nt<(m?m.length:0);nt++)for(var xt=nt<0?p.map:m[nt],jt=0;jt<xt.length;jt+=3){var Dt=xt[jt+2];if(Dt==Ge||Dt==tt){var Vt=Pt(nt<0?e.line:e.rest[nt]),dn=xt[jt]+pt;return(pt<0||Dt!=Ge)&&(dn=xt[jt+(pt?1:0)]),Le(Vt,dn)}}}var M=T(l,f,i);if(M)return ur(M,r);for(var oe=f.nextSibling,Q=l?l.nodeValue.length-i:0;oe;oe=oe.nextSibling){if(M=T(oe,oe.firstChild,0),M)return ur(Le(M.line,M.ch-Q),r);Q+=oe.textContent.length}for(var Ce=f.previousSibling,Be=i;Ce;Ce=Ce.previousSibling){if(M=T(Ce,Ce.firstChild,-1),M)return ur(Le(M.line,M.ch+Be),r);Be+=Ce.textContent.length}}var kn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ae,this.hasSelection=!1,this.composing=null};kn.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),q&&(r.style.width="0px"),ge(r,"input",function(){j&&ee>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ge(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 f=Rs(n);so({lineWise:!0,text:f.text}),l.type=="cut"?n.setSelections(f.ranges,null,_e):(i.prevInput="",r.value=f.text.join(`
|
|
`),xe(r))}else return;l.type=="cut"&&(n.state.cutIncoming=+new Date)}ge(r,"cut",s),ge(r,"copy",s),ge(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 f=new Event("paste");f.clipboardData=l.clipboardData,r.dispatchEvent(f)}),ge(e.lineSpace,"selectstart",function(l){xi(e,l)||y(l)}),ge(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"})}}),ge(r,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},kn.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},kn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},kn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,n=va(e);if(e.options.moveInputWithCursor){var r=di(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},kn.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")},kn.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&&xe(this.textarea),j&&ee>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",j&&ee>=9&&(this.hasSelection=null))},kn.prototype.getField=function(){return this.textarea},kn.prototype.supportsTouch=function(){return!1},kn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!he||G()!=this.textarea))try{this.textarea.focus()}catch(e){}},kn.prototype.blur=function(){this.textarea.blur()},kn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},kn.prototype.receivedFocus=function(){this.slowPoll()},kn.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()})},kn.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)},kn.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||$e(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||ie&&/[\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,f=Math.min(n.length,r.length);l<f&&n.charCodeAt(l)==r.charCodeAt(l);)++l;return ii(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},kn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},kn.prototype.onKeyPress=function(){j&&ee>=9&&(this.hasSelection=null),this.fastPoll()},kn.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 f=i.options.resetSelectionOnContextMenu;f&&i.doc.sel.contains(s)==-1&&Dn(i,zn)(i.doc,Ri(s),_e);var p=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 oe(){if(r.selectionStart!=null){var Be=i.somethingSelected(),Ge="\u200B"+(Be?r.value:"");r.value="\u21DA",r.value=Ge,t.prevInput=Be?"":"\u200B",r.selectionStart=1,r.selectionEnd=Ge.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=p,j&&ee<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=l),r.selectionStart!=null){(!j||j&&ee<9)&&oe();var Be=0,Ge=function(){n.selForContextMenu==i.doc.sel&&r.selectionStart==0&&r.selectionEnd>0&&t.prevInput=="\u200B"?Dn(i,Ya)(i):Be++<10?n.detectingSelectAll=setTimeout(Ge,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(Ge,200)}}if(j&&ee>=9&&oe(),v){E(e);var Ce=function(){ct(window,"mouseup",Ce),setTimeout(Q,20)};ge(window,"mouseup",Ce)}else setTimeout(Q,50)},kn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},kn.prototype.setUneditable=function(){},kn.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=f.getValue()}var r;if(e.form&&(ge(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(p){}}t.finishInit=function(p){p.save=n,p.getTextArea=function(){return e},p.toTextArea=function(){p.toTextArea=isNaN,n(),e.parentNode.removeChild(p.getWrapperElement()),e.style.display="",e.form&&(ct(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=r))}},e.style.display="none";var f=yn(function(p){return e.parentNode.insertBefore(p,e.nextSibling)},t);return f}function ru(e){e.off=ct,e.on=ge,e.wheelEventPixels=hl,e.Doc=qn,e.splitLines=Ot,e.countColumn=J,e.findColumn=Oe,e.isWordChar=De,e.Pass=it,e.signal=be,e.Line=Di,e.changeEnd=Ti,e.scrollbarModel=Sa,e.Pos=Le,e.cmpPos=Qe,e.modes=Nt,e.mimeModes=vt,e.resolveMode=ze,e.getMode=yt,e.modeExtensions=dt,e.extendMode=_t,e.copyState=$t,e.startState=an,e.innerMode=Gt,e.commands=Nr,e.keyMap=Ci,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ar,e.normalizeKeyMap=Ml,e.StringStream=zt,e.SharedTextMarker=Lr,e.TextMarker=Oi,e.LineWidget=Or,e.e_preventDefault=y,e.e_stopPropagation=C,e.e_stop=E,e.addClass=de,e.contains=k,e.rmClass=X,e.keyNames=Li}Yl(yn),Ql(yn);var ou="iter insert remove copy getEditor constructor".split(" ");for(var uo in qn.prototype)qn.prototype.hasOwnProperty(uo)&&ke(ou,uo)<0&&(yn.prototype[uo]=function(e){return function(){return e.apply(this.doc,arguments)}}(qn.prototype[uo]));return L(qn),yn.inputStyles={textarea:kn,contenteditable:hn},yn.defineMode=function(e){!yn.defaults.mode&&e!="null"&&(yn.defaults.mode=e),Ht.apply(this,arguments)},yn.defineMIME=Ft,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){qn.prototype[e]=t},yn.fromTextArea=iu,ru(yn),yn.version="5.58.2",yn})},Y1PL:function(At,rt,x){"use strict";x.r(rt),x.d(rt,"ResizableTextArea",function(){return ke});var $=x("wx14"),Pe=x("1OyB"),ae=x("vuIU"),we=x("Ji7U"),ye=x("LK+K"),ve=x("q1tI"),j=x("VTBJ"),ee=x("rePB"),W=x("Zm9Q"),se=x("Kwbf"),P=x("c+Xe"),I=x("m+aA"),le=x("bdgK"),z=new Map;function V(_e){_e.forEach(function(Ie){var Re,Oe=Ie.target;(Re=z.get(Oe))===null||Re===void 0||Re.forEach(function(Z){return Z(Oe)})})}var q=new le.default(V),B=null,he=null;function ie(_e,Ie){z.has(_e)||(z.set(_e,new Set),q.observe(_e)),z.get(_e).add(Ie)}function pe(_e,Ie){z.has(_e)&&(z.get(_e).delete(Ie),z.get(_e).size||(q.unobserve(_e),z.delete(_e)))}var Ne=function(_e){Object(we.a)(Re,_e);var Ie=Object(ye.a)(Re);function Re(){return Object(Pe.a)(this,Re),Ie.apply(this,arguments)}return Object(ae.a)(Re,[{key:"render",value:function(){return this.props.children}}]),Re}(ve.Component),ue=ve.createContext(null);function K(_e){var Ie=_e.children,Re=_e.onBatchResize,Oe=ve.useRef(0),Z=ve.useRef([]),w=ve.useContext(ue),Ue=ve.useCallback(function(lt,St,qe){Oe.current+=1;var Ye=Oe.current;Z.current.push({size:lt,element:St,data:qe}),Promise.resolve().then(function(){Ye===Oe.current&&(Re==null||Re(Z.current),Z.current=[])}),w==null||w(lt,St,qe)},[Re,w]);return ve.createElement(ue.Provider,{value:Ue},Ie)}function v(_e){var Ie=_e.children,Re=_e.disabled,Oe=ve.useRef(null),Z=ve.useRef(null),w=ve.useContext(ue),Ue=ve.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),lt=ve.isValidElement(Ie)&&Object(P.c)(Ie),St=lt?Ie.ref:null,qe=ve.useMemo(function(){return Object(P.a)(St,Oe)},[St,Oe]),Ye=ve.useRef(_e);Ye.current=_e;var me=ve.useCallback(function(De){var Fe=Ye.current,Xe=Fe.onResize,We=Fe.data,je=De.getBoundingClientRect(),Me=je.width,Et=je.height,ot=De.offsetWidth,et=De.offsetHeight,ut=Math.floor(Me),kt=Math.floor(Et);if(Ue.current.width!==ut||Ue.current.height!==kt||Ue.current.offsetWidth!==ot||Ue.current.offsetHeight!==et){var Ct={width:ut,height:kt,offsetWidth:ot,offsetHeight:et};Ue.current=Ct;var ft=ot===Math.round(Me)?Me:ot,ge=et===Math.round(Et)?Et:et,wt=Object(j.a)(Object(j.a)({},Ct),{},{offsetWidth:ft,offsetHeight:ge});w==null||w(wt,De,We),Xe&&Promise.resolve().then(function(){Xe(wt,De)})}},[]);return ve.useEffect(function(){var De=Object(I.a)(Oe.current)||Object(I.a)(Z.current);return De&&!Re&&ie(De,me),function(){return pe(De,me)}},[Oe.current,Re]),ve.createElement(Ne,{ref:Z},lt?ve.cloneElement(Ie,{ref:qe}):Ie)}var re="rc-observer-key";function X(_e){var Ie=_e.children,Re=Object(W.a)(Ie);return Re.map(function(Oe,Z){var w=(Oe==null?void 0:Oe.key)||"".concat(re,"-").concat(Z);return ve.createElement(v,Object($.a)({},_e,{key:w}),Oe)})}X.Collection=K;var fe=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={},de;function Y(_e){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(Ie&&G[Re])return G[Re];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")),Ue=parseFloat(Oe.getPropertyValue("border-bottom-width"))+parseFloat(Oe.getPropertyValue("border-top-width")),lt=k.map(function(qe){return"".concat(qe,":").concat(Oe.getPropertyValue(qe))}).join(";"),St={sizingStyle:lt,paddingSize:w,borderSize:Ue,boxSizing:Z};return Ie&&Re&&(G[Re]=St),St}function xe(_e){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;de||(de=document.createElement("textarea"),de.setAttribute("tab-index","-1"),de.setAttribute("aria-hidden","true"),document.body.appendChild(de)),_e.getAttribute("wrap")?de.setAttribute("wrap",_e.getAttribute("wrap")):de.removeAttribute("wrap");var Z=Y(_e,Ie),w=Z.paddingSize,Ue=Z.borderSize,lt=Z.boxSizing,St=Z.sizingStyle;de.setAttribute("style","".concat(St,";").concat(D)),de.value=_e.value||_e.placeholder||"";var qe=Number.MIN_SAFE_INTEGER,Ye=Number.MAX_SAFE_INTEGER,me=de.scrollHeight,De;if(lt==="border-box"?me+=Ue:lt==="content-box"&&(me-=w),Re!==null||Oe!==null){de.value=" ";var Fe=de.scrollHeight-w;Re!==null&&(qe=Fe*Re,lt==="border-box"&&(qe=qe+w+Ue),me=Math.max(qe,me)),Oe!==null&&(Ye=Fe*Oe,lt==="border-box"&&(Ye=Ye+w+Ue),De=me>Ye?"":"hidden",me=Math.min(Ye,me))}return{height:me,minHeight:qe,maxHeight:Ye,overflowY:De,resize:"none"}}var S=x("Gytx"),g=x.n(S),J;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(J||(J={}));var Ae=function(_e){Object(we.a)(Re,_e);var Ie=Object(ye.a)(Re);function Re(Oe){var Z;return Object(Pe.a)(this,Re),Z=Ie.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 Ue=Z.state.resizeStatus,lt=Z.props,St=lt.autoSize,qe=lt.onResize;if(Ue!==J.NONE)return;typeof qe=="function"&&qe(w),St&&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 Ue=w.minRows,lt=w.maxRows,St=xe(Z.textArea,!1,Ue,lt);Z.setState({textareaStyles:St,resizeStatus:J.RESIZING},function(){cancelAnimationFrame(Z.resizeFrameId),Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:J.RESIZED},function(){Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:J.NONE}),Z.fixFirefoxAutoScroll()})})})})},Z.renderTextArea=function(){var w=Z.props,Ue=w.prefixCls,lt=Ue===void 0?"rc-textarea":Ue,St=w.autoSize,qe=w.onResize,Ye=w.className,me=w.disabled,De=Z.state,Fe=De.textareaStyles,Xe=De.resizeStatus,We=Object(A.a)(Z.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),je=U()(lt,Ye,Object(ee.a)({},"".concat(lt,"-disabled"),me));"value"in We&&(We.value=We.value||"");var Me=Object(j.a)(Object(j.a)(Object(j.a)({},Z.props.style),Fe),Xe===J.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return ve.createElement(fe,{onResize:Z.handleResize,disabled:!(St||qe)},ve.createElement("textarea",Object($.a)({},We,{className:je,style:Me,ref:Z.saveTextArea})))},Z.state={textareaStyles:{},resizeStatus:J.NONE},Z}return Object(ae.a)(Re,[{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(Ue){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Re}(ve.Component),ke=Ae,Ke=function(_e){Object(we.a)(Re,_e);var Ie=Object(ye.a)(Re);function Re(Oe){var Z;Object(Pe.a)(this,Re),Z=Ie.call(this,Oe),Z.resizableTextArea=void 0,Z.focus=function(){Z.resizableTextArea.textArea.focus()},Z.saveTextArea=function(Ue){Z.resizableTextArea=Ue},Z.handleChange=function(Ue){var lt=Z.props.onChange;Z.setValue(Ue.target.value,function(){Z.resizableTextArea.resizeTextarea()}),lt&<(Ue)},Z.handleKeyDown=function(Ue){var lt=Z.props,St=lt.onPressEnter,qe=lt.onKeyDown;Ue.keyCode===13&&St&&St(Ue),qe&&qe(Ue)};var w=typeof Oe.value=="undefined"||Oe.value===null?Oe.defaultValue:Oe.value;return Z.state={value:w},Z}return Object(ae.a)(Re,[{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 ve.createElement(ke,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}}]),Re}(ve.Component),it=rt.default=Ke},ZW9T:function(At,rt,x){"use strict";x.d(rt,"a",function(){return Ne});var $=x("k1fw"),Pe=x("miYZ"),ae=x("tsqr"),we=x("rAM+"),ye=x("tJVT"),ve=x("PpiC"),j=x("q1tI"),ee=x.n(j),W=x("bdgK");function se(ue,K,v,re,X){var fe=K.getWordUntilPosition(v),A={startLineNumber:v.lineNumber,endLineNumber:v.lineNumber,startColumn:fe.startColumn,endColumn:fe.endColumn},b=re.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 P=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 re=["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,re,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 q=!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 he(){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 re=B[ue[v]];if(re)return re}return K[0]}return B[K]||K}var ie=null,pe=rt.b=function(ue){var K=ue.width,v=K===void 0?"100%":K,re=ue.height,X=re===void 0?"100%":re,fe=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,de=ue.overrideServices,Y=de===void 0?{}:de,xe=ue.theme,S=xe===void 0?"vs-dark":xe,g=ue.onEditBlur,J=ue.onSave,Ae=ue.autoHeight,ke=Ae===void 0?!1:Ae,Ke=ue.forbidCopy,it=Ke===void 0?!1:Ke,_e=ue.onChange,Ie=_e===void 0?V:_e,Re=ue.editorDidMount,Oe=Re===void 0?V:Re,Z=ue.onFocus,w=Z===void 0?V:Z,Ue=ue.filename,lt=Ue===void 0?"educoder.txt":Ue,St=Object(ve.a)(ue,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),qe=Object(j.useRef)(),Ye=Object(j.useRef)({}),me=Object(j.useRef)(),De=Object(j.useRef)(!1),Fe=Object(j.useRef)(),Xe=Object(j.useState)(!1),We=Object(ye.a)(Xe,2),je=We[0],Me=We[1];function Et(){var _;return qe.current&&(_=new W.default(function(E){var te=Object(we.a)(E),F;try{for(te.s();!(F=te.n()).done;){var ce=F.value;(ce.target.offsetHeight>0||ce.target.offsetWidth>0)&&Ye.current.instance.layout()}}catch(Ve){te.e(Ve)}finally{te.f()}}),_.observe(qe.current)),_}function ot(){ae.b.warn(decodeURIComponent(I))}var et=function(){var E=Ye.current.instance;if(fe!=null&&E&&je){var te=E.getModel();te&&fe!==te.getValue()&&(q=!0,te.setValue(fe),E.layout(),q=!1)}};Object(j.useEffect)(function(){me.current&&clearTimeout(me.current),me.current=setTimeout(function(){et()},500)},[fe,je,Ye.current]);function ut(){var _=Ye.current.instance;if(_){var E=_.getSelection(),te=Ye.current.pastePos||{},F=new ie.Range(te.startLineNumber||E.endLineNumber,te.startColumn||E.endColumn,te.endLineNumber||E.endLineNumber,te.endColumn||E.endColumn);setTimeout(function(){_.executeEdits("",[{range:F,text:""}])},300)}}function kt(_){(window.navigator.platform.match("Mac")?_.metaKey:_.ctrlKey)&&_.keyCode==83&&(_.preventDefault(),J())}var Ct=function(){if(ke&&Ye.current.instance){var E=Ye.current.instance.getContentHeight();y(E<X?X:E)}else y(X)};function ft(_){var E=document.createEvent("MouseEvents");E.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),_.dispatchEvent(E)}function ge(_,E){var te=window.URL||window.webkitURL||window,F=new Blob([E]),ce=document.createElementNS("http://www.w3.org/1999/xhtml","a");ce.href=te.createObjectURL(F),ce.download=_,ft(ce)}Object(j.useEffect)(function(){Ct()},[Ct]),Object(j.useEffect)(function(){qe.current&&!je&&x.e(27).then(x.t.bind(null,"M/lh",7)).then(function(_){try{ie=_,Ye.current.instance=ie.editor.create(qe.current,{value:fe,language:he(b),theme:S,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Y);var E=Ye.current.instance;if(Oe(E,ie),setTimeout(function(){Ct(),Ye.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ge(lt||"educoder.txt",E.getValue())}})},500),Ye.current.subscription=E.onDidChangeModelContent(function(F){De.current?clearTimeout(Fe.current):(Ct(),Ie(E.getValue(),F)),Fe.current=setTimeout(function(){De.current=!1},500)}),window.Monaco||P(ie),it&&(E.addCommand(ie.KeyMod.CtrlCmd|ie.KeyMod.Shift|ie.KeyCode.KEY_V,function(){return ot(),null}),E.addCommand(ie.KeyMod.CtrlCmd|ie.KeyCode.KEY_C,function(){return ot(),null})),window.Monaco=ie,g&&E.onDidBlurEditorWidget(function(){g(E.getValue())}),w&&E.onDidFocusEditorText(function(){w(E.getValue())}),it){E.addCommand(ie.KeyMod.CtrlCmd|ie.KeyCode.KEY_V,function(){return ot(),null}),E.onDidPaste(function(F){Ye.current.pastePos=F});try{window.addEventListener("paste",ut)}catch(F){}}var te=Et();return Me(!0),function(){var F=Ye.current.instance;F.dispose();var ce=F.getModel();ce&&ce.dispose(),Ye.current.subscription&&Ye.current.subscription.dispose(),it&&window.removeEventListener("paste",ut),te.unobserve(qe.current)}}catch(F){}})},[]),Object(j.useEffect)(function(){var _=Ye.current.instance;if(_&&je)return document.addEventListener("keydown",kt,!1),function(){document.removeEventListener("keydown",kt)}},[J,je]),Object(j.useEffect)(function(){var _=Ye.current.instance;if(_&&je){var E=he(b);ie.editor.setModelLanguage(_.getModel(),E),console.log("language:",b,_.getModel(),E)}},[b,je]),Object(j.useEffect)(function(){var _=Ye.current.instance;_&&je&&ie.editor.setTheme(S)},[S,je]),Object(j.useEffect)(function(){var _=Ye.current.instance;_&&je&&(_.updateOptions(Object($.a)({},G)),setTimeout(function(){_.getModel().updateOptions(Object($.a)({},G))},200))},[JSON.stringify(G),je]),Object(j.useEffect)(function(){var _=Ye.current.instance;_&&je&&_.layout()},[v,X,je]);var wt=Object(j.useState)(z(v)),ct=Object(ye.a)(wt,2),be=ct[0],Ee=ct[1],R=Object(j.useState)(z(X)),O=Object(ye.a)(R,2),L=O[0],y=O[1],C=Object($.a)(Object($.a)({},D),{},{width:be,height:L});return ee.a.createElement("div",{className:"my-monaco-editor",ref:qe,style:C})};function Ne(ue){var K=ue.width,v=K===void 0?"100%":K,re=ue.height,X=re===void 0?"100%":re,fe=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),de=Object(ye.a)(G,2),Y=de[0],xe=de[1];function S(ke){var Ke;return k.current&&(Ke=new W.default(function(it){var _e=Object(we.a)(it),Ie;try{for(_e.s();!(Ie=_e.n()).done;){var Re=Ie.value;(Re.target.offsetHeight>0||Re.target.offsetWidth>0)&&ke.layout()}}catch(Oe){_e.e(Oe)}finally{_e.f()}}),Ke.observe(k.current)),Ke}Object(j.useEffect)(function(){k.current&&x.e(27).then(x.t.bind(null,"M/lh",7)).then(function(ke){ie=ke;var Ke=ie.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}));xe(Ke);var it=S(Ke);return function(){Ke.dispose();var _e=Ke.getModel();_e&&_e.dispose(),it.unobserve(k.current)}})},[]),Object(j.useEffect)(function(){Y&&Y.setModel({original:ie.editor.createModel(fe,b),modified:ie.editor.createModel(A,b)})},[fe,A,b,Y]);var g=z(v),J=z(X),Ae={width:g,height:J};return ee.a.createElement("div",{className:"my-diff-editor",ref:k,style:Ae})}},ZpRC:function(At,rt,x){"use strict";function $(P){return typeof P=="object"&&P!=null&&P.nodeType===1}function Pe(P,I){return(!I||P!=="hidden")&&P!=="visible"&&P!=="clip"}function ae(P,I){if(P.clientHeight<P.scrollHeight||P.clientWidth<P.scrollWidth){var le=getComputedStyle(P,null);return Pe(le.overflowY,I)||Pe(le.overflowX,I)||function(z){var V=function(q){if(!q.ownerDocument||!q.ownerDocument.defaultView)return null;try{return q.ownerDocument.defaultView.frameElement}catch(B){return null}}(z);return!!V&&(V.clientHeight<z.scrollHeight||V.clientWidth<z.scrollWidth)}(P)}return!1}function we(P,I,le,z,V,q,B,he){return q<P&&B>I||q>P&&B<I?0:q<=P&&he<=le||B>=I&&he>=le?q-P-z:B>I&&he<le||q<P&&he>le?B-I+V:0}var ye=function(P,I){var le=window,z=I.scrollMode,V=I.block,q=I.inline,B=I.boundary,he=I.skipOverflowHiddenElements,ie=typeof B=="function"?B:function(Fe){return Fe!==B};if(!$(P))throw new TypeError("Invalid target");for(var pe=document.scrollingElement||document.documentElement,Ne=[],ue=P;$(ue)&&ie(ue);){if((ue=ue.parentElement)===pe){Ne.push(ue);break}ue!=null&&ue===document.body&&ae(ue)&&!ae(document.documentElement)||ue!=null&&ae(ue,he)&&Ne.push(ue)}for(var K=le.visualViewport?le.visualViewport.width:innerWidth,v=le.visualViewport?le.visualViewport.height:innerHeight,re=window.scrollX||pageXOffset,X=window.scrollY||pageYOffset,fe=P.getBoundingClientRect(),A=fe.height,b=fe.width,U=fe.top,D=fe.right,k=fe.bottom,G=fe.left,de=V==="start"||V==="nearest"?U:V==="end"?k:U+A/2,Y=q==="center"?G+b/2:q==="end"?D:G,xe=[],S=0;S<Ne.length;S++){var g=Ne[S],J=g.getBoundingClientRect(),Ae=J.height,ke=J.width,Ke=J.top,it=J.right,_e=J.bottom,Ie=J.left;if(z==="if-needed"&&U>=0&&G>=0&&k<=v&&D<=K&&U>=Ke&&k<=_e&&G>=Ie&&D<=it)return xe;var Re=getComputedStyle(g),Oe=parseInt(Re.borderLeftWidth,10),Z=parseInt(Re.borderTopWidth,10),w=parseInt(Re.borderRightWidth,10),Ue=parseInt(Re.borderBottomWidth,10),lt=0,St=0,qe="offsetWidth"in g?g.offsetWidth-g.clientWidth-Oe-w:0,Ye="offsetHeight"in g?g.offsetHeight-g.clientHeight-Z-Ue:0;if(pe===g)lt=V==="start"?de:V==="end"?de-v:V==="nearest"?we(X,X+v,v,Z,Ue,X+de,X+de+A,A):de-v/2,St=q==="start"?Y:q==="center"?Y-K/2:q==="end"?Y-K:we(re,re+K,K,Oe,w,re+Y,re+Y+b,b),lt=Math.max(0,lt+X),St=Math.max(0,St+re);else{lt=V==="start"?de-Ke-Z:V==="end"?de-_e+Ue+Ye:V==="nearest"?we(Ke,_e,Ae,Z,Ue+Ye,de,de+A,A):de-(Ke+Ae/2)+Ye/2,St=q==="start"?Y-Ie-Oe:q==="center"?Y-(Ie+ke/2)+qe/2:q==="end"?Y-it+w+qe:we(Ie,it,ke,Oe,w+qe,Y,Y+b,b);var me=g.scrollLeft,De=g.scrollTop;de+=De-(lt=Math.max(0,Math.min(De+lt,g.scrollHeight-Ae+Ye))),Y+=me-(St=Math.max(0,Math.min(me+St,g.scrollWidth-ke+qe)))}xe.push({el:g,top:lt,left:St})}return xe};function ve(P){return P===Object(P)&&Object.keys(P).length!==0}function j(P,I){I===void 0&&(I="auto");var le="scrollBehavior"in document.body.style;P.forEach(function(z){var V=z.el,q=z.top,B=z.left;V.scroll&&le?V.scroll({top:q,left:B,behavior:I}):(V.scrollTop=q,V.scrollLeft=B)})}function ee(P){return P===!1?{block:"end",inline:"nearest"}:ve(P)?P:{block:"start",inline:"nearest"}}function W(P,I){var le=!P.ownerDocument.documentElement.contains(P);if(ve(I)&&typeof I.behavior=="function")return I.behavior(le?[]:ye(P,I));if(le)return;var z=ee(I);return j(ye(P,z),z.behavior)}var se=rt.a=W},bT9E:function(At,rt,x){"use strict";x.d(rt,"a",function(){return Pe});var $=x("VTBJ");function Pe(ae,we){var ye=Object($.a)({},ae);return Array.isArray(we)&&we.forEach(function(ve){delete ye[ve]}),ye}},c5Ni:function(At,rt,x){},dejd:function(At,rt,x){},dmUQ:function(At,rt,x){"use strict";var $=x("Ff2n"),Pe=x("rePB"),ae=x("1OyB"),we=x("vuIU"),ye=x("Ji7U"),ve=x("md7G"),j=x("foSv"),ee=x("q1tI"),W=x.n(ee),se=x("TSYQ"),P=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=q();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(ve.a)(this,k)}}function q(){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 he(A){A.preventDefault()}var ie=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)},re=function(A){Object(ye.a)(U,A);var b=V(U);function U(D){var k;Object(ae.a)(this,U),k=b.call(this,D),k.onKeyDown=function(Y){var xe=k.props,S=xe.onKeyDown,g=xe.onPressEnter;if(Y.keyCode===I.a.UP){var J=k.getRatio(Y);k.up(Y,J,null),k.stop()}else if(Y.keyCode===I.a.DOWN){var Ae=k.getRatio(Y);k.down(Y,Ae,null),k.stop()}else Y.keyCode===I.a.ENTER&&g&&g(Y);if(k.recordCursorPosition(),k.lastKeyCode=Y.keyCode,S){for(var ke=arguments.length,Ke=new Array(ke>1?ke-1:0),it=1;it<ke;it++)Ke[it-1]=arguments[it];S.apply(void 0,[Y].concat(Ke))}},k.onKeyUp=function(Y){var xe=k.props.onKeyUp;if(k.stop(),k.recordCursorPosition(),xe){for(var S=arguments.length,g=new Array(S>1?S-1:0),J=1;J<S;J++)g[J-1]=arguments[J];xe.apply(void 0,[Y].concat(g))}},k.onChange=function(Y){var xe=k.props.onChange;k.state.focused&&(k.inputting=!0),k.rawInput=k.props.parser(k.getValueFromEvent(Y)),k.setState({inputValue:k.rawInput}),xe(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 xe=k.getCurrentValidValue(k.state.inputValue),S=k.setValue(xe,B);if(Y){var g=k.input.value,J=k.getInputDisplayValue({focus:!1,value:S});k.input.value=J&&Number(J),Y.apply(void 0,arguments),k.input.value=g}},k.getRatio=function(Y){var xe=1;return Y.metaKey||Y.ctrlKey?xe=.1:Y.shiftKey&&(xe=10),xe},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 xe=String(Y);if(xe.indexOf("e-")>=0)return parseInt(xe.slice(xe.indexOf("e-")+2),10);var S=0;return xe.indexOf(".")>=0&&(S=xe.length-xe.indexOf(".")-1),S},k.getInputDisplayValue=function(Y){var xe=Y||k.state,S=xe.focused,g=xe.inputValue,J=xe.value,Ae;S?Ae=g:Ae=k.toPrecisionAsStep(J),Ae==null&&(Ae="");var ke=k.formatWrapper(Ae);return K(k.props.decimalSeparator)&&(ke=ke.toString().replace(".",k.props.decimalSeparator)),ke},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 xe=k.input.value,S=xe.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===xe.length?(k.fixCaret(S,S),!0):!1},k.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(xe,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,xe,S){k.pressingUpOrDown=!0,k.step("down",Y,xe,S)},k.up=function(Y,xe,S){k.pressingUpOrDown=!0,k.step("up",Y,xe,S)},k.saveInput=function(Y){k.input=Y};var G=D.value;G===void 0&&(G=D.defaultValue),k.state={focused:D.autoFocus};var de=k.getValidValue(k.toNumber(G));return k.state=z(z({},k.state),{},{inputValue:k.toPrecisionAsStep(de),value:de}),k}return Object(we.a)(U,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(k){var G=this.props,de=G.value,Y=G.onChange,xe=G.max,S=G.min,g=this.state.focused;if(k){if(!v(k.value,de)||!v(k.max,xe)||!v(k.min,S)){var J=g?de:this.getValidValue(de),Ae;this.pressingUpOrDown?Ae=J:this.inputting?Ae=this.rawInput:Ae=this.toPrecisionAsStep(J),this.setState({value:J,inputValue:Ae})}var ke="value"in this.props?de:this.state.value;"max"in this.props&&k.max!==xe&&typeof ke=="number"&&ke>xe&&Y&&Y(xe),"min"in this.props&&k.min!==S&&typeof ke=="number"&&ke<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 Ke=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===I.a.BACKSPACE?Ke=this.cursorStart-1:this.lastKeyCode===I.a.DELETE&&(Ke=this.cursorStart):Ke=this.input.value.length,this.fixCaret(Ke,Ke)}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(it){}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,de=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(k);return isNaN(Y)?k:(Y<G&&(Y=G),Y>de&&(Y=de),Y)}},{key:"setValue",value:function(k,G){var de=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(k))?null:parseFloat(k),xe=this.state.value,S=xe===void 0?null:xe,g=this.state.inputValue,J=g===void 0?null:g,Ae=typeof Y=="number"?Y.toFixed(de):"".concat(Y),ke=Y!==S||Ae!=="".concat(J);return"value"in this.props?(J=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:J},G)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(k)},G),ke&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(k){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=this.props,Y=de.precision,xe=de.step;if(K(Y))return Y;var S=this.getPrecision(G),g=this.getPrecision(xe),J=this.getPrecision(k);return k?Math.max(J,S+g):S+g}},{key:"getPrecisionFactor",value:function(k){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=this.getMaxPrecision(k,G);return Math.pow(10,de)}},{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,de=this.state.focused,Y=k&&k.length>16&&de;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 de=this.props.step,Y=this.getPrecisionFactor(k,G),xe=Math.abs(this.getMaxPrecision(k,G)),S=((Y*k+Y*de*G)/Y).toFixed(xe);return this.toNumber(S)}},{key:"downStep",value:function(k,G){var de=this.props.step,Y=this.getPrecisionFactor(k,G),xe=Math.abs(this.getMaxPrecision(k,G)),S=((Y*k-Y*de*G)/Y).toFixed(xe);return this.toNumber(S)}},{key:"step",value:function(k,G){var de=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,xe=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 J=this["".concat(k,"Step")](g,Y),Ae=J>S.max||J<S.min;if(J>S.max?J=S.max:J<S.min&&(J=S.min),this.setValue(J,null),this.setState({focused:!0},function(){de.pressingUpOrDown=!1}),Ae)return;this.autoStepTimer=setTimeout(function(){de[k](G,Y,!0)},xe?pe:Ne)}},{key:"fixCaret",value:function(k,G){if(k===void 0||G===void 0||!this.input||!this.input.value)return;try{var de=this.input.selectionStart,Y=this.input.selectionEnd;(k!==de||G!==Y)&&this.input.setSelectionRange(k,G)}catch(xe){}}},{key:"render",value:function(){var k,G=this.props,de=G.prefixCls,Y=G.disabled,xe=G.readOnly,S=G.useTouch,g=G.autoComplete,J=G.upHandler,Ae=G.downHandler,ke=G.className,Ke=G.max,it=G.min,_e=G.style,Ie=G.title,Re=G.onMouseEnter,Oe=G.onMouseLeave,Z=G.onMouseOver,w=G.onMouseOut,Ue=G.required,lt=G.onClick,St=G.tabIndex,qe=G.type,Ye=G.placeholder,me=G.id,De=G.inputMode,Fe=G.pattern,Xe=G.step,We=G.maxLength,je=G.autoFocus,Me=G.name,Et=G.onPaste,ot=G.onInput,et=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"]),ut=this.state,kt=ut.value,Ct=ut.focused,ft=P()(de,(k={},Object(Pe.a)(k,ke,!!ke),Object(Pe.a)(k,"".concat(de,"-disabled"),Y),Object(Pe.a)(k,"".concat(de,"-focused"),Ct),k)),ge={};Object.keys(et).forEach(function(E){(E.substr(0,5)==="data-"||E.substr(0,5)==="aria-"||E==="role")&&(ge[E]=et[E])});var wt=!xe&&!Y,ct=this.getInputDisplayValue(null),be=(kt||kt===0)&&(isNaN(kt)||Number(kt)>=Ke),Ee=(kt||kt===0)&&(isNaN(kt)||Number(kt)<=it),R=be||Y||xe,O=Ee||Y||xe,L=P()("".concat(de,"-handler"),"".concat(de,"-handler-up"),Object(Pe.a)({},"".concat(de,"-handler-up-disabled"),R)),y=P()("".concat(de,"-handler"),"".concat(de,"-handler-down"),Object(Pe.a)({},"".concat(de,"-handler-down-disabled"),O)),C=S?{onTouchStart:R?B:this.up,onTouchEnd:this.stop}:{onMouseDown:R?B:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},_=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:ft,style:_e,title:Ie,onMouseEnter:Re,onMouseLeave:Oe,onMouseOver:Z,onMouseOut:w,onFocus:function(){return null},onBlur:function(){return null}},W.a.createElement("div",{className:"".concat(de,"-handler-wrap")},W.a.createElement("span",Object.assign({unselectable:"on"},C,{role:"button","aria-label":"Increase Value","aria-disabled":R,className:L}),J||W.a.createElement("span",{unselectable:"on",className:"".concat(de,"-handler-up-inner"),onClick:he})),W.a.createElement("span",Object.assign({unselectable:"on"},_,{role:"button","aria-label":"Decrease Value","aria-disabled":O,className:y}),Ae||W.a.createElement("span",{unselectable:"on",className:"".concat(de,"-handler-down-inner"),onClick:he}))),W.a.createElement("div",{className:"".concat(de,"-input-wrap")},W.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":it,"aria-valuemax":Ke,"aria-valuenow":kt,required:Ue,type:qe,placeholder:Ye,onPaste:Et,onClick:lt,onMouseUp:this.onMouseUp,className:"".concat(de,"-input"),tabIndex:St,autoComplete:g,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:wt?this.onKeyDown:B,onKeyUp:wt?this.onKeyUp:B,autoFocus:je,maxLength:We,readOnly:xe,disabled:Y,max:Ke,min:it,step:Xe,name:Me,title:Ie,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ct),pattern:Fe,inputMode:De,onInput:ot},ge))))}}]),U}(W.a.Component);re.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:ie,required:!1,autoComplete:"off"};var X=re,fe=rt.a=X},kSUc:function(At,rt,x){},kqOp:function(At,rt,x){"use strict";x.d(rt,"a",function(){return se});var $=x("0Owb"),Pe=x("fWQN"),ae=x("mtLc"),we=x("yKVA"),ye=x("879j"),ve=x("q1tI"),j=x.n(ve),ee=x("Ot1p"),W="\u2581",se=function(P){Object(we.a)(le,P);var I=Object(ye.a)(le);function le(){var z;Object(Pe.a)(this,le);for(var V=arguments.length,q=new Array(V),B=0;B<V;B++)q[B]=arguments[B];return z=I.call.apply(I,[this].concat(q)),z.getChCountBeforeCursor=function(he,ie){for(var pe=ie.line,Ne=0,ue=0;ue<pe;ue++)Ne+=he.getLine(ue).split(W).length-1;var K=he.getLine(pe).substring(0,ie.ch);return Ne+=K.split(W).length-1,Ne},z.onCMBeforeChange=function(he,ie){var pe=he.getRange(ie.from,ie.to),Ne=0;if(ie.text.forEach(function(re){Ne+=re.split(W).length-1}),pe&&pe.indexOf(W)!=-1){var ue=pe.split(W).length-1,K=z.getChCountBeforeCursor(he,ie.from);console.log("\u5220\u9664".concat(ue,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(K,"\u4E2A\uFF0C\u65B0\u589E").concat(Ne,"\u4E2A")),z.props.deleteEmptyDisabled?ie.cancel():z.props.onPlaceholderChange&&z.props.onPlaceholderChange(K,ue,Ne)}else if(Ne){var v=z.getChCountBeforeCursor(he,ie.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(ae.a)(le,[{key:"render",value:function(){return j.a.createElement(ee.a,Object($.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),le}(ve.Component)},lZu9:function(At,rt,x){(function($){$(x("VrN/"),x("1eCo"),x("8EBN"))})(function($){"use strict";$.defineMode("markdown",function(Pe,ae){var we=$.getMode(Pe,"text/html"),ye=we.name=="null";function ve(S){if($.findModeByName){var g=$.findModeByName(S);g&&(S=g.mime||g.mimes[0])}var J=$.getMode(Pe,S);return J.name=="null"?null:J}ae.highlightFormatting===void 0&&(ae.highlightFormatting=!1),ae.maxBlockquoteDepth===void 0&&(ae.maxBlockquoteDepth=0),ae.taskLists===void 0&&(ae.taskLists=!1),ae.strikethrough===void 0&&(ae.strikethrough=!1),ae.emoji===void 0&&(ae.emoji=!1),ae.fencedCodeBlockHighlighting===void 0&&(ae.fencedCodeBlockHighlighting=!0),ae.fencedCodeBlockDefaultMode===void 0&&(ae.fencedCodeBlockDefaultMode="text/plain"),ae.xml===void 0&&(ae.xml=!0),ae.tokenTypeOverrides===void 0&&(ae.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)&&ae.tokenTypeOverrides[ee]&&(j[ee]=ae.tokenTypeOverrides[ee]);var W=/^([*\-_])(?:\s*\1){2,}\s*$/,se=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,P=/^\[(x| )\](?=\s)/i,I=ae.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,le=/^ {0,3}(?:\={1,}|-{2,})\s*$/,z=/^[^#!\[\]*_\\<>` "'(~:]+/,V=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,q=/^\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]/,he=" ";function ie(S,g,J){return g.f=g.inline=J,J(S,g)}function pe(S,g,J){return g.f=g.block=J,J(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=ye;if(!g){var J=$.innerMode(we,S.htmlState);g=J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.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 J=S.column()===g.indentation,Ae=Ne(g.prevLine.stream),ke=g.indentedCode,Ke=g.prevLine.hr,it=g.list!==!1,_e=(g.listStack[g.listStack.length-1]||0)+3;g.indentedCode=!1;var Ie=g.indentation;if(g.indentationDiff===null&&(g.indentationDiff=g.indentation,it)){for(g.list=null;Ie<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=Ie-g.listStack[g.listStack.length-1])}var Re=!Ae&&!Ke&&!g.prevLine.header&&(!it||!ke)&&!g.prevLine.fencedCodeEnd,Oe=(g.list===!1||Ke||Ae)&&g.indentation<=_e&&S.match(W),Z=null;if(g.indentationDiff>=4&&(ke||g.prevLine.fencedCodeEnd||g.prevLine.header||Ae))return S.skipToEnd(),g.indentedCode=!0,j.code;if(S.eatSpace())return null;if(J&&g.indentation<=_e&&(Z=S.match(I))&&Z[1].length<=6)return g.quote=0,g.header=Z[1].length,g.thisLine.header=!0,ae.highlightFormatting&&(g.formatting="header"),g.f=g.inline,X(g);if(g.indentation<=_e&&S.eat(">"))return g.quote=J?1:g.quote+1,ae.highlightFormatting&&(g.formatting="quote"),S.eatSpace(),X(g);if(!Oe&&!g.setext&&J&&g.indentation<=_e&&(Z=S.match(se))){var w=Z[1]?"ol":"ul";return g.indentation=Ie+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,ae.taskLists&&S.match(P,!1)&&(g.taskList=!0),g.f=g.inline,ae.highlightFormatting&&(g.formatting=["list","list-"+w]),X(g)}else{if(J&&g.indentation<=_e&&(Z=S.match(V,!0)))return g.quote=0,g.fencedEndRE=new RegExp(Z[1]+"+ *$"),g.localMode=ae.fencedCodeBlockHighlighting&&ve(Z[2]||ae.fencedCodeBlockDefaultMode),g.localMode&&(g.localState=$.startState(g.localMode)),g.f=g.block=re,ae.highlightFormatting&&(g.formatting="code-block"),g.code=-1,X(g);if(g.setext||(!Re||!it)&&!g.quote&&g.list===!1&&!g.code&&!Oe&&!q.test(S.string)&&(Z=S.lookAhead(1))&&(Z=Z.match(le)))return g.setext?(g.header=g.setext,g.setext=0,S.skipToEnd(),ae.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 ie(S,g,G)}return ie(S,g,g.inline)}function v(S,g){var J=we.token(S,g.htmlState);if(!ye){var Ae=$.innerMode(we,g.htmlState);(Ae.mode.name=="xml"&&Ae.state.tagStart===null&&!Ae.state.context&&Ae.state.tokenize.isInText||g.md_inside&&S.current().indexOf(">")>-1)&&(g.f=A,g.block=K,g.htmlState=null)}return J}function re(S,g){var J=g.listStack[g.listStack.length-1]||0,Ae=g.indentation<J,ke=J+3;if(g.fencedEndRE&&g.indentation<=ke&&(Ae||S.match(g.fencedEndRE))){ae.highlightFormatting&&(g.formatting="code-block");var Ke;return Ae||(Ke=X(g)),g.localMode=g.localState=null,g.block=K,g.f=A,g.fencedEndRE=null,g.code=0,g.thisLine.fencedCodeEnd=!0,Ae?pe(S,g,g.block):Ke}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 J=0;J<S.formatting.length;J++)g.push(j.formatting+"-"+S.formatting[J]),S.formatting[J]==="header"&&g.push(j.formatting+"-"+S.formatting[J]+"-"+S.header),S.formatting[J]==="quote"&&(!ae.maxBlockquoteDepth||ae.maxBlockquoteDepth>=S.quote?g.push(j.formatting+"-"+S.formatting[J]+"-"+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),!ae.maxBlockquoteDepth||ae.maxBlockquoteDepth>=S.quote?g.push(j.quote+"-"+S.quote):g.push(j.quote+"-"+ae.maxBlockquoteDepth)),S.list!==!1){var Ae=(S.listStack.length-1)%3;Ae?Ae===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 fe(S,g){return S.match(z,!0)?X(g):void 0}function A(S,g){var J=g.text(S,g);if(typeof J!="undefined")return J;if(g.list)return g.list=null,X(g);if(g.taskList){var Ae=S.match(P,!0)[1]===" ";return Ae?g.taskOpen=!0:g.taskClosed=!0,ae.highlightFormatting&&(g.formatting="task"),g.taskList=!1,X(g)}if(g.taskOpen=!1,g.taskClosed=!1,g.header&&S.match(/^#+$/,!0))return ae.highlightFormatting&&(g.formatting="header"),X(g);var ke=S.next();if(g.linkTitle){g.linkTitle=!1;var Ke=ke;ke==="("&&(Ke=")"),Ke=(Ke+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var it="^\\s*(?:[^"+Ke+"\\\\]+|\\\\\\\\|\\\\.)"+Ke;if(S.match(new RegExp(it),!0))return j.linkHref}if(ke==="`"){var _e=g.formatting;ae.highlightFormatting&&(g.formatting="code"),S.eatWhile("`");var Ie=S.current().length;if(g.code==0&&(!g.quote||Ie==1))return g.code=Ie,X(g);if(Ie==g.code){var Re=X(g);return g.code=0,Re}else return g.formatting=_e,X(g)}else if(g.code)return X(g);if(ke==="\\"&&(S.next(),ae.highlightFormatting)){var Oe=X(g),Z=j.formatting+"-escape";return Oe?Oe+" "+Z:Z}if(ke==="!"&&S.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return g.imageMarker=!0,g.image=!0,ae.highlightFormatting&&(g.formatting="image"),X(g);if(ke==="["&&g.imageMarker&&S.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return g.imageMarker=!1,g.imageAltText=!0,ae.highlightFormatting&&(g.formatting="image"),X(g);if(ke==="]"&&g.imageAltText){ae.highlightFormatting&&(g.formatting="image");var Oe=X(g);return g.imageAltText=!1,g.image=!1,g.inline=g.f=U,Oe}if(ke==="["&&!g.image)return g.linkText&&S.match(/^.*?\]/)||(g.linkText=!0,ae.highlightFormatting&&(g.formatting="link")),X(g);if(ke==="]"&&g.linkText){ae.highlightFormatting&&(g.formatting="link");var Oe=X(g);return g.linkText=!1,g.inline=g.f=S.match(/\(.*?\)| ?\[.*?\]/,!1)?U:A,Oe}if(ke==="<"&&S.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=b,ae.highlightFormatting&&(g.formatting="link");var Oe=X(g);return Oe?Oe+=" ":Oe="",Oe+j.linkInline}if(ke==="<"&&S.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){g.f=g.inline=b,ae.highlightFormatting&&(g.formatting="link");var Oe=X(g);return Oe?Oe+=" ":Oe="",Oe+j.linkEmail}if(ae.xml&&ke==="<"&&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 Ue=S.string.substring(S.start,w);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ue)&&(g.md_inside=!0)}return S.backUp(1),g.htmlState=$.startState(we),pe(S,g,v)}if(ae.xml&&ke==="<"&&S.match(/^\/\w*?>/))return g.md_inside=!1,"tag";if(ke==="*"||ke==="_"){for(var lt=1,St=S.pos==1?" ":S.string.charAt(S.pos-2);lt<3&&S.eat(ke);)lt++;var qe=S.peek()||" ",Ye=!/\s/.test(qe)&&(!B.test(qe)||/\s/.test(St)||B.test(St)),me=!/\s/.test(St)&&(!B.test(St)||/\s/.test(qe)||B.test(qe)),De=null,Fe=null;if(lt%2&&(!g.em&&Ye&&(ke==="*"||!me||B.test(St))?De=!0:g.em==ke&&me&&(ke==="*"||!Ye||B.test(qe))&&(De=!1)),lt>1&&(!g.strong&&Ye&&(ke==="*"||!me||B.test(St))?Fe=!0:g.strong==ke&&me&&(ke==="*"||!Ye||B.test(qe))&&(Fe=!1)),Fe!=null||De!=null){ae.highlightFormatting&&(g.formatting=De==null?"strong":Fe==null?"em":"strong em"),De===!0&&(g.em=ke),Fe===!0&&(g.strong=ke);var Re=X(g);return De===!1&&(g.em=!1),Fe===!1&&(g.strong=!1),Re}}else if(ke===" "&&(S.eat("*")||S.eat("_"))){if(S.peek()===" ")return X(g);S.backUp(1)}if(ae.strikethrough){if(ke==="~"&&S.eatWhile(ke)){if(g.strikethrough){ae.highlightFormatting&&(g.formatting="strikethrough");var Re=X(g);return g.strikethrough=!1,Re}else if(S.match(/^[^\s]/,!1))return g.strikethrough=!0,ae.highlightFormatting&&(g.formatting="strikethrough"),X(g)}else if(ke===" "&&S.match(/^~~/,!0)){if(S.peek()===" ")return X(g);S.backUp(2)}}if(ae.emoji&&ke===":"&&S.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){g.emoji=!0,ae.highlightFormatting&&(g.formatting="emoji");var Xe=X(g);return g.emoji=!1,Xe}return ke===" "&&(S.match(/^ +$/,!1)?g.trailingSpace++:g.trailingSpace&&(g.trailingSpaceNewLine=!0)),X(g)}function b(S,g){var J=S.next();if(J===">"){g.f=g.inline=A,ae.highlightFormatting&&(g.formatting="link");var Ae=X(g);return Ae?Ae+=" ":Ae="",Ae+j.linkInline}return S.match(/^[^>]+/,!0),j.linkInline}function U(S,g){if(S.eatSpace())return null;var J=S.next();return J==="("||J==="["?(g.f=g.inline=k(J==="("?")":"]"),ae.highlightFormatting&&(g.formatting="link-string"),g.linkHref=!0,X(g)):"error"}var D={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function k(S){return function(g,J){var Ae=g.next();if(Ae===S){J.f=J.inline=A,ae.highlightFormatting&&(J.formatting="link-string");var ke=X(J);return J.linkHref=!1,ke}return g.match(D[S]),J.linkHref=!0,X(J)}}function G(S,g){return S.match(/^([^\]\\]|\\.)*\]:/,!1)?(g.f=de,S.next(),ae.highlightFormatting&&(g.formatting="link"),g.linkText=!0,X(g)):ie(S,g,A)}function de(S,g){if(S.match(/^\]:/,!0)){g.f=g.inline=Y,ae.highlightFormatting&&(g.formatting="link");var J=X(g);return g.linkText=!1,J}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 xe={startState:function(){return{f:K,prevLine:{stream:null},thisLine:{stream:null},block:K,htmlState:null,indentation:0,inline:A,text:fe,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(we,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 J=S.match(/^\s*/,!0)[0].replace(/\t/g,he).length;if(g.indentation=J,g.indentationDiff=null,J>0)return null}}return g.f(S,g)},innerMode:function(S){return S.block==v?{state:S.htmlState,mode:we}:S.localState?{state:S.localState,mode:S.localMode}:{state:S,mode:xe}},indent:function(S,g,J){return S.block==v&&we.indent?we.indent(S.htmlState,g,J):S.localState&&S.localMode.indent?S.localMode.indent(S.localState,g,J):$.Pass},blankLine:ue,getType:X,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return xe},"xml"),$.defineMIME("text/markdown","markdown"),$.defineMIME("text/x-markdown","markdown")})},osHv:function(At,rt,x){(function($){$(x("VrN/"))})(function($){"use strict";var Pe=$.Pos;function ae(B,he){return B.line-he.line||B.ch-he.ch}var we="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",ye=we+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ve=new RegExp("<(/?)(["+we+"]["+ye+"]*)","g");function j(B,he,ie,pe){this.line=he,this.ch=ie,this.cm=B,this.text=B.getLine(he),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,he){var ie=B.cm.getTokenTypeAt(Pe(B.line,he));return ie&&/\btag\b/.test(ie)}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 P(B){for(;;){var he=B.text.indexOf(">",B.ch);if(he==-1){if(W(B))continue;return}if(!ee(B,he+1)){B.ch=he+1;continue}var ie=B.text.lastIndexOf("/",he),pe=ie>-1&&!/\S/.test(B.text.slice(ie+1,he));return B.ch=he+1,pe?"selfClose":"regular"}}function I(B){for(;;){var he=B.ch?B.text.lastIndexOf("<",B.ch-1):-1;if(he==-1){if(se(B))continue;return}if(!ee(B,he+1)){B.ch=he;continue}ve.lastIndex=he,B.ch=he;var ie=ve.exec(B.text);if(ie&&ie.index==he)return ie}}function le(B){for(;;){ve.lastIndex=B.ch;var he=ve.exec(B.text);if(!he){if(W(B))continue;return}if(!ee(B,he.index+1)){B.ch=he.index+1;continue}return B.ch=he.index+he[0].length,he}}function z(B){for(;;){var he=B.ch?B.text.lastIndexOf(">",B.ch-1):-1;if(he==-1){if(se(B))continue;return}if(!ee(B,he+1)){B.ch=he;continue}var ie=B.text.lastIndexOf("/",he),pe=ie>-1&&!/\S/.test(B.text.slice(ie+1,he));return B.ch=he+1,pe?"selfClose":"regular"}}function V(B,he){for(var ie=[];;){var pe=le(B),Ne,ue=B.line,K=B.ch-(pe?pe[0].length:0);if(!pe||!(Ne=P(B)))return;if(Ne=="selfClose")continue;if(pe[1]){for(var v=ie.length-1;v>=0;--v)if(ie[v]==pe[2]){ie.length=v;break}if(v<0&&(!he||he==pe[2]))return{tag:pe[2],from:Pe(ue,K),to:Pe(B.line,B.ch)}}else ie.push(pe[2])}}function q(B,he){for(var ie=[];;){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])ie.push(K[2]);else{for(var v=ie.length-1;v>=0;--v)if(ie[v]==K[2]){ie.length=v;break}if(v<0&&(!he||he==K[2]))return{tag:K[2],from:Pe(B.line,B.ch),to:Pe(Ne,ue)}}}}$.registerHelper("fold","xml",function(B,he){for(var ie=new j(B,he.line,0);;){var pe=le(ie);if(!pe||ie.line!=he.line)return;var Ne=P(ie);if(!Ne)return;if(!pe[1]&&Ne!="selfClose"){var ue=Pe(ie.line,ie.ch),K=V(ie,pe[2]);return K&&ae(K.from,ue)>0?{from:ue,to:K.from}:null}}}),$.findMatchingTag=function(B,he,ie){var pe=new j(B,he.line,he.ch,ie);if(pe.text.indexOf(">")==-1&&pe.text.indexOf("<")==-1)return;var Ne=P(pe),ue=Ne&&Pe(pe.line,pe.ch),K=Ne&&I(pe);if(!Ne||!K||ae(pe,he)>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:q(pe,K[2]),close:v,at:"close"}:(pe=new j(B,ue.line,ue.ch,ie),{open:v,close:V(pe,K[2]),at:"open"})},$.findEnclosingTag=function(B,he,ie,pe){for(var Ne=new j(B,he.line,he.ch,ie);;){var ue=q(Ne,pe);if(!ue)break;var K=new j(B,he.line,he.ch,ie),v=V(K,ue.tag);if(v)return{open:ue,close:v}}},$.scanForClosingTag=function(B,he,ie,pe){var Ne=new j(B,he.line,he.ch,pe?{from:0,to:pe}:null);return V(Ne,ie)}})},p5ED:function(At,rt,x){"use strict";var $=x("+L6B"),Pe=x("2/Rp"),ae=x("5Dmo"),we=x("3S7+"),ye=x("k1fw"),ve=x("9og8"),j=x("tJVT"),ee=x("WmNS"),W=x.n(ee),se=x("q1tI"),P=x.n(se),I=x("vHTk"),le=x.n(I),z=x("yEEn"),V=x("ZW9T"),q=x("1vsH"),B=x("V0Rq"),he=x("m3rI"),ie=function(Ne){var ue=Ne.name,K=Ne.data,v=Ne.theme,re=Ne.type,X=Ne.filename,fe=Ne.monacoEditor,A=Ne.className,b=Ne.style,U=Ne.close,D=Ne.onClose,k=Ne.hasMask,G=Ne.otherData,de=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"),xe=Object(j.a)(Y,2),S=xe[0],g=xe[1],J=Object(se.useState)(""),Ae=Object(j.a)(J,2),ke=Ae[0],Ke=Ae[1],it=Object(se.useState)(),_e=Object(j.a)(it,2),Ie=_e[0],Re=_e[1],Oe=window.ENV==="build"?"/react/build/office.html":"/office.html",Z,w=1024*1024,Ue=10*w,lt=Object(se.useRef)();re==="office"&&(Z=Object(q.R)(K).filesize,Z>Ue&&(re="other")),X&&(fe.filename=X),Object(se.useEffect)(function(){var me,De,Fe=(me=document.cookie)===null||me===void 0||((De=me.replace(/\s/g,""))===null||De===void 0)?void 0:De.split(";");Fe==null||Fe.map(function(Xe){var We=Xe.split("=");We[0]==="_educoder_session"&&Ke(We[1])})},[]),Object(se.useEffect)(function(){re==="office"&&St()},[re]);var St=function(){var me=Object(ve.a)(W.a.mark(function De(){var Fe,Xe,We;return W.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return console.log("data:",K),Fe=K,K.startsWith("http")||(Fe=location.origin+Fe),Xe=new URL(Fe).pathname.split("/").pop(),Me.next=6,Object(B.U)({attachment_id:Xe});case 6:We=Me.sent,Re(We);case 8:case"end":return Me.stop()}},De)}));return function(){return me.apply(this,arguments)}}(),qe=function(){if(K.startsWith("http")||K.startsWith("/api")||K.startsWith("blob:")){Ye();return}Object(q.x)(X||"educoder",K,X||"educoder")},Ye=function(){Object(q.v)(X||"educoder",decodeURIComponent(K))};return P.a.createElement("div",{style:Object(ye.a)({},b||{}),className:"".concat(k&&le.a.bgBlack," ").concat(re?le.a.wrp:"hide")},U&&P.a.createElement("div",{className:le.a.close,ref:lt},P.a.createElement(we.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return lt.current}},P.a.createElement("span",{onClick:Ye},P.a.createElement("i",{className:"icon-quxiaozhiding"}))),P.a.createElement(we.a,{title:"\u5173\u95ED",getPopupContainer:function(){return lt.current}},P.a.createElement("span",{className:"",onClick:function(){D(),Re(null)}},P.a.createElement("i",{className:"icon-guanbi1"})))),P.a.createElement("div",{className:"".concat(le.a[A]," ").concat(A," ").concat(le.a.monaco," ").concat(re==="txt"?"show":"hide")},re==="txt"&&P.a.createElement(V.b,fe)),re==="audio"&&P.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}),re==="video"&&P.a.createElement(P.a.Fragment,null,(K==null?void 0:K.indexOf("/api"))>-1?P.a.createElement("video",{controls:!0,src:"".concat(K),autoPlay:!0}):P.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(K),autoPlay:!0})),re==="office"&&Ie&&P.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(Ie.key,"&url=").concat(he.a.API_SERVER+Ie.url,"&callbackUrl=").concat(he.a.API_SERVER+Ie.callbackUrl,"&fileType=").concat(Ie.fileType,"&title=").concat(Ie.title,"&model=view")}),(re==="xlsx"||re==="doc"||re==="pptx"||re==="docx")&&P.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(de.key,"&url=").concat(he.a.API_SERVER+de.url,"&callbackUrl=").concat(he.a.API_SERVER+de.callbackUrl,"&fileType=").concat(de.fileType,"&title=").concat(de.title,"&model=").concat(de.model)}),re==="html"&&P.a.createElement("iframe",{src:K+"&disposition=inline"}),re==="pdf"&&P.a.createElement("embed",{className:le.a.embed,src:K,type:"application/pdf"}),re==="image"&&P.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)}),re==="other"&&P.a.createElement("div",null,P.a.createElement(Pe.a,{type:"primary",size:"large",onClick:qe},P.a.createElement(z.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),re==="download"&&P.a.createElement(Pe.a,{type:"primary",size:"large",onClick:qe},P.a.createElement(z.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};rt.a=ie},"p77/":function(At,rt,x){},"rAM+":function(At,rt,x){"use strict";x.d(rt,"a",function(){return Pe});var $=x("Qw5x");function Pe(ae,we){var ye;if(typeof Symbol=="undefined"||ae[Symbol.iterator]==null){if(Array.isArray(ae)||(ye=Object($.a)(ae))||we&&ae&&typeof ae.length=="number"){ye&&(ae=ye);var ve=0,j=function(){};return{s:j,n:function(){return ve>=ae.length?{done:!0}:{done:!1,value:ae[ve++]}},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(){ye=ae[Symbol.iterator]()},n:function(){var I=ye.next();return ee=I.done,I},e:function(I){W=!0,se=I},f:function(){try{!ee&&ye.return!=null&&ye.return()}finally{if(W)throw se}}}}},rUJ1:function(At,rt){const x=/[&<>"']/,$=/[&<>"']/g,Pe=/[<>"']|&(?!#?\w+;)/,ae=/[<>"']|&(?!#?\w+;)/g,we={"&":"&","<":"<",">":">",'"':""","'":"'"},ye=re=>we[re];function ve(re,X){if(X){if(x.test(re))return re.replace($,ye)}else if(Pe.test(re))return re.replace(ae,ye);return re}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ee(re){return re.replace(j,(X,fe)=>(fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""))}const W=/(^|[^\[])\^/g;function se(re,X){re=re.source||re,X=X||"";const fe={replace:(A,b)=>(b=b.source||b,b=b.replace(W,"$1"),re=re.replace(A,b),fe),getRegex:()=>new RegExp(re,X)};return fe}const P=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function le(re,X,fe){if(re){let A;try{A=decodeURIComponent(ee(fe)).replace(P,"").toLowerCase()}catch(b){return null}if(A.indexOf("javascript:")===0||A.indexOf("vbscript:")===0||A.indexOf("data:")===0)return null}X&&!I.test(fe)&&(fe=he(X,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(A){return null}return fe}const z={},V=/^[^:]+:\/*[^/]*$/,q=/^([^:]+:)[\s\S]*$/,B=/^([^:]+:\/*[^/]*)[\s\S]*$/;function he(re,X){z[" "+re]||(V.test(re)?z[" "+re]=re+"/":z[" "+re]=ue(re,"/",!0)),re=z[" "+re];const fe=re.indexOf(":")===-1;return X.substring(0,2)==="//"?fe?X:re.replace(q,"$1")+X:X.charAt(0)==="/"?fe?X:re.replace(B,"$1")+X:re+X}const ie={exec:function(){}};function pe(re){let X=1,fe,A;for(;X<arguments.length;X++){fe=arguments[X];for(A in fe)Object.prototype.hasOwnProperty.call(fe,A)&&(re[A]=fe[A])}return re}function Ne(re,X){const fe=re.replace(/\|/g,(U,D,k)=>{let G=!1,de=D;for(;--de>=0&&k[de]==="\\";)G=!G;return G?"|":" |"}),A=fe.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(re,X,fe){const A=re.length;if(A===0)return"";let b=0;for(;b<A;){const U=re.charAt(A-b-1);if(U===X&&!fe)b++;else if(U!==X&&fe)b++;else break}return re.substr(0,A-b)}function K(re,X){if(re.indexOf(X[1])===-1)return-1;const fe=re.length;let A=0,b=0;for(;b<fe;b++)if(re[b]==="\\")b++;else if(re[b]===X[0])A++;else if(re[b]===X[1]&&(A--,A<0))return b;return-1}function v(re){re&&re.sanitize&&!re.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:ve,unescape:ee,edit:se,cleanUrl:le,resolveUrl:he,noopTest:ie,merge:pe,splitCells:Ne,rtrim:ue,findClosingBracket:K,checkSanitizeDeprecation:v}},sDPU:function(At,rt,x){"use strict";x.r(rt);var $=x("cWXX"),Pe=x("/ezw"),ae=x("k1fw"),we=x("9og8"),ye=x("tJVT"),ve=x("WmNS"),j=x.n(ve),ee=x("q1tI"),W=x.n(ee),se=x("Ty5D"),P=x("9kvl"),I=x("FIWC"),le=x.n(I),z=x("sbIO"),V=x("ErOA"),q=x("LvDl"),B=x.n(q),he=function(pe){var Ne,ue,K,v,re=pe.paperlibrary,X=pe.user,fe=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(ye.a)(D,2),G=k[0],de=k[1],Y=Object(ee.useState)(!0),xe=Object(ye.a)(Y,2),S=xe[0],g=xe[1],J=Object(ee.useState)(Number(U)),Ae=Object(ye.a)(J,2),ke=Ae[0],Ke=Ae[1],it=Object(ee.useState)({}),_e=Object(ye.a)(it,2),Ie=_e[0],Re=_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(ke)},[]);var w=function(){var me=Object(we.a)(j.a.mark(function De(){var Fe,Xe,We=arguments;return j.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Fe=We.length>0&&We[0]!==void 0?We[0]:0,console.log(Oe),Me.next=4,Object(V.a)("/api/exercises/".concat(Oe.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:Fe}});case 4:Xe=Me.sent,g(!1),Re(Ue(Xe));case 7:case"end":return Me.stop()}},De)}));return function(){return me.apply(this,arguments)}}(),Ue=function(De){var Fe={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!De)return;var Xe=De||{},We=Xe.exam,je=Xe.single_questions,Me=Xe.multiple_questions,Et=Xe.judgement_questions,ot=Xe.program_questions,et=Xe.completion_questions,ut=Xe.subjective_questions,kt=Xe.practical_questions,Ct=Xe.combination_questions,ft=[Object(ae.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},je),Object(ae.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Me),Object(ae.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},et),Object(ae.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},Et),Object(ae.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},ut),Object(ae.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},ot),Object(ae.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},kt),Object(ae.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},Ct)],ge=[],wt=0,ct=0,be=ft.filter(function(Ee){return Ee.questions_count>0}).map(function(Ee,R){var O;return(O=Ee.questions)===null||O===void 0||O.forEach(function(L){ge.push(L.id),wt=wt+L.score,ct=ct+1}),Object(ae.a)(Object(ae.a)({},Ee),{number:Fe[R+1]})});return{all_questions_count:ct,all_score:wt,questionList:be,ids:ge,exam:We}},lt=function(){P.d.push("/classrooms/".concat(Oe.coursesId,"/exercise"))},St=function(){alert("\u4FDD\u5B58")},qe=function(){var me=Object(we.a)(j.a.mark(function De(Fe,Xe){var We,je,Me;return j.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return ot.next=2,Object(V.a)("/api/exercises/".concat(Oe.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:Fe==null?void 0:Fe.single_question_id}});case 2:We=ot.sent,We!=null&&We.question&&(Me=Object(q.cloneDeep)(Ie),Me.questionList=Me==null||((je=Me.questionList)===null||je===void 0)?void 0:je.map(function(et){if(et.type===Xe.type){var ut=Object(q.cloneDeep)(et==null?void 0:et.questions);return ut.splice(Xe.index,1,We==null?void 0:We.question),Object(ae.a)(Object(ae.a)({},et),{},{questions:ut})}return et}),Re(Me));case 4:case"end":return ot.stop()}},De)}));return function(Fe,Xe){return me.apply(this,arguments)}}(),Ye=function(){var me=Object(we.a)(j.a.mark(function De(Fe){return j.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:document.body.scrollIntoView(),w(Fe),Ke(Fe);case 3:case"end":return We.stop()}},De)}));return function(Fe){return me.apply(this,arguments)}}();return console.log(Object(se.h)(),"location333"),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 P.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 P.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:St,goBack:lt,data:Ie,selectValue:ke,editPreview:!0,onExchange:qe,onSkipExamination:Ye})))};rt.default=Object(P.a)(function(ie){var pe=ie.paperlibrary,Ne=ie.user,ue=ie.globalSetting;return{paperlibrary:pe,user:Ne,globalSetting:ue}})(he)},sbIO:function(At,rt,x){"use strict";var $=x("DjyN"),Pe=x("NUBc"),ae=x("5Dmo"),we=x("3S7+"),ye=x("/zsF"),ve=x("PArb"),j=x("Q9mQ"),ee=x("diRs"),W=x("+L6B"),se=x("2/Rp"),P=x("5NDa"),I=x("5rEg"),le=x("miYZ"),z=x("tsqr"),V=x("9og8"),q=x("giR+"),B=x("fyUT"),he=x("2qtc"),ie=x("kLXV"),pe=x("tJVT"),Ne=x("WmNS"),ue=x.n(Ne),K=x("q1tI"),v=x.n(K),re=x("PsQE"),X=x.n(re),fe=x("0eGx"),A=x.n(fe),b=x("9Bee"),U=x("Ty5D"),D=x("9kvl"),k=x("ErOA"),G=x("+yhJ"),de=x.n(G),Y=x("RZ/O"),xe=x.n(Y),S=x("LvDl"),g=x("6K3P"),J=x.n(g),Ae=x("sRBo"),ke=x("kaz8"),Ke=x("oBTY"),it=x("PpiC"),_e=x("Ot1p"),Ie=x("kqOp"),Re=x("7qnI"),Oe=x("1vsH"),Z=x("PGNT"),w=x.n(Z),Ue=["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"],lt=function(R,O){var L=R.globalSetting,y=R.loading,C=R.dispatch,_=R.isEdit,E=R.editData,te=Object(it.a)(R,["globalSetting","loading","dispatch","isEdit","editData"]),F=Object(K.useState)(""),ce=Object(pe.a)(F,2),Ve=ce[0],Ze=ce[1],He=Object(K.useState)(""),mt=Object(pe.a)(He,2),Ot=mt[0],$e=mt[1],Ut=Object(K.useState)([]),Mt=Object(pe.a)(Ut,2),Bt=Mt[0],Nt=Mt[1],vt=Object(K.useState)(""),Ht=Object(pe.a)(vt,2),Ft=Ht[0],ze=Ht[1],yt=Object(K.useState)(),dt=Object(pe.a)(yt,2),_t=dt[0],$t=dt[1],Gt=Object(K.useState)(!1),an=Object(pe.a)(Gt,2),zt=an[0],gt=an[1];Object(K.useEffect)(function(){if(!E||!_)return;Ze(E==null?void 0:E.name),$e(E==null?void 0:E.analysis),$t(E==null?void 0:E.is_ordered),gt(!0)},[E]),Object(K.useEffect)(function(){if(!zt)return;var Le=E==null?void 0:E.standard_answer.map(function(Qe){return Qe.answer_text});Nt(Le),gt(!1)},[zt]),Object(K.useImperativeHandle)(O,function(){return{onSave:Yt,Clear:Lt}});var Yt=function(){var Qe=[],sn=!1;return Ve?(Bt.forEach(function(fn,vn){Qe.push({position:vn+1,answer_text:[]}),fn.forEach(function(xn,h){Qe[vn].answer_text.push(xn),(!xn||!Object(Oe.bb)(xn,1e4))&&(ze("".concat(vn,"-").concat(h)),z.b.info(xn?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),sn=!0)})}),sn?!1:(Qe==null?void 0:Qe.length)>20?(z.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:Ve,analysis:Ot,standard_answers:Qe,is_ordered:_t}):(z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Lt=function(){Ze(""),$e(""),Nt([]),$t(!1)},qt=function(Qe,sn,fn){var vn=Bt.slice();if(sn&&vn.splice(Qe,sn),fn)for(var xn=0;xn<fn;xn++)vn.splice(Qe+xn,0,[""]);Nt(vn)},Pt=function(Qe,sn,fn){ze("");var vn=Bt.slice();vn[Qe][sn]=fn,Nt(vn)},gn=function(Qe){var sn=Bt.slice();sn[Qe]=[].concat(Object(Ke.a)(sn[Qe]),[""]),Nt(sn)},Xn=function(Qe,sn){var fn=Bt.slice();if(!fn[Qe][sn]){fn[Qe]=fn[Qe].filter(function(vn,xn){return xn!==sn}),Nt(fn);return}ie.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(){fn[Qe]=fn[Qe].filter(function(xn,h){return h!==sn}),Nt(fn)}})},oi=function(Qe){ie.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 fn=Bt.slice();fn=Bt.filter(function(vn,xn){return Qe!==xn}),Nt(fn)}})};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(Ie.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Ve,onChange:function(Qe){return Ze(Qe)},showNullButton:!0,onPlaceholderChange:qt})),v.a.createElement("div",{className:"mt20"},Bt.map(function(Le,Qe){return v.a.createElement(Re.a,{key:Qe,answers:Le,index:Qe,flex:1,is_md:!0,activeOptionErrorIndex:Ft,onAnswerChange:Pt,addChildAnswer:gn,deleteChildAnswer:Xn,deleteChildAnswermain:oi})})),v.a.createElement("div",{className:"mt20"},Bt.length>1&&v.a.createElement("span",null,v.a.createElement(ke.a,{checked:_t,onChange:function(Qe){return $t(Qe.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(Qe){return $e(Qe)}}))},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)(lt)),qe=x("7Kak"),Ye=x("9yH6"),me=["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 L=R.globalSetting,y=R.loading,C=R.editData,_=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ce=Object(it.a)(R,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),Ve=Object(K.useState)(),Ze=Object(pe.a)(Ve,2),He=Ze[0],mt=Ze[1],Ot=Object(K.useState)(""),$e=Object(pe.a)(Ot,2),Ut=$e[0],Mt=$e[1],Bt=Object(K.useState)(""),Nt=Object(pe.a)(Bt,2),vt=Nt[0],Ht=Nt[1];Object(K.useEffect)(function(){if(!C||!F)return;Mt(C==null?void 0:C.name),Ht(C==null?void 0:C.analysis);var yt=C==null?void 0:C.choices.find(function(dt){return dt.is_answer});mt(yt.choice_text==="\u6B63\u786E"?"0":"1")},[C]),Object(K.useImperativeHandle)(O,function(){return{onSave:Ft,Clear:ze}});var Ft=function(){if(!Ut)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!He)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:He==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:He==="1"?1:0}];return{name:Ut,choices:dt,analysis:vt}},ze=function(){Mt(""),Ht(""),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:Ut,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(Ye.a.Group,{buttonStyle:"solid",value:He,onChange:function(dt){return mt(dt.target.value)}},v.a.createElement(Ye.a.Button,{value:"0",className:"".concat(w.a.radio," mr40")},"\u6B63\u786E"),v.a.createElement(Ye.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 Ht(dt)}}))},Fe=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)),Xe=["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"],We=function(R,O){var L=R.editData,y=R.globalSetting,C=R.loading,_=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ce=Object(it.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(K.useState)([]),Ze=Object(pe.a)(Ve,2),He=Ze[0],mt=Ze[1],Ot=Object(K.useState)(),$e=Object(pe.a)(Ot,2),Ut=$e[0],Mt=$e[1],Bt=Object(K.useState)([]),Nt=Object(pe.a)(Bt,2),vt=Nt[0],Ht=Nt[1],Ft=Object(K.useState)(""),ze=Object(pe.a)(Ft,2),yt=ze[0],dt=ze[1],_t=Object(K.useState)(""),$t=Object(pe.a)(_t,2),Gt=$t[0],an=$t[1];Object(K.useEffect)(function(){mt(["","","",""])},[]),Object(K.useEffect)(function(){if(!L||!F)return;dt(L==null?void 0:L.name),an(L==null?void 0:L.analysis),mt(L==null?void 0:L.choices.map(function(Lt){return Lt.choice_text}));var Yt=[];L==null||L.choices.map(function(Lt,qt){Lt.is_answer&&Yt.push(qt)}),Ht(Yt)},[L]),Object(K.useImperativeHandle)(O,function(){return{onSave:zt,Clear:gt}});var zt=function(){if(!yt)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Lt=He.findIndex(function(Pt){return!Pt});if(Lt>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Xe[Lt]," \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=He.map(function(Pt,gn){return{choice_text:Pt,is_answer:vt.includes(gn)?1:0}});return{name:yt,choices:qt,analysis:Gt}},gt=function(){mt(["","","",""]),dt(""),an(""),Ht("")};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(Lt){return dt(Lt)}}),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"))),He.map(function(Yt,Lt){return v.a.createElement("div",{className:w.a.choiceWrap,key:Lt},v.a.createElement(we.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(Lt)?w.a.activeAnswer:""),onClick:function(){vt.includes(Lt)?Ht(vt.filter(function(Pt){return Pt!==Lt})):Ht([].concat(Object(Ke.a)(vt),[Lt]))}},Xe[Lt])),v.a.createElement("div",{className:w.a.editorWrap},Ut===Lt?v.a.createElement(_e.a,{id:"single-question-option-".concat(Lt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Yt,onChange:function(Pt){He[Lt]=Pt,mt(He)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Mt(Lt)}},v.a.createElement(b.a,{value:Yt}))),Lt>1&&v.a.createElement(we.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){mt(He.filter(function(Pt,gn){return gn!==Lt})),vt.includes(Lt)?Ht(vt.filter(function(Pt){return Pt!==Lt})):Ht([].concat(Object(Ke.a)(vt),[Lt]))}})),Lt<7&&Lt===He.length-1&&v.a.createElement(we.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(Ke.a)(He),[""]))}})))}),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:Gt,onChange:function(Lt){return an(Lt)}}))},je=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)(We)),Me=["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 L=R.editData,y=R.globalSetting,C=R.loading,_=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ce=Object(it.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(K.useState)([]),Ze=Object(pe.a)(Ve,2),He=Ze[0],mt=Ze[1],Ot=Object(K.useState)(),$e=Object(pe.a)(Ot,2),Ut=$e[0],Mt=$e[1],Bt=Object(K.useState)(),Nt=Object(pe.a)(Bt,2),vt=Nt[0],Ht=Nt[1],Ft=Object(K.useState)(""),ze=Object(pe.a)(Ft,2),yt=ze[0],dt=ze[1],_t=Object(K.useState)(""),$t=Object(pe.a)(_t,2),Gt=$t[0],an=$t[1];Object(K.useEffect)(function(){mt(["","","",""])},[]),Object(K.useEffect)(function(){if(!L||!F)return;dt(L==null?void 0:L.name),an(L==null?void 0:L.analysis),mt(L==null?void 0:L.choices.map(function(Yt){return Yt.choice_text})),Ht(L==null?void 0:L.choices.findIndex(function(Yt){return Yt.is_answer}))},[L]),Object(K.useImperativeHandle)(O,function(){return{onSave:zt,Clear:gt}});var zt=function(){if(!yt)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Lt=He.findIndex(function(Pt){return!Pt});if(Lt>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Me[Lt]," \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=He.map(function(Pt,gn){return{choice_text:Pt,is_answer:vt===gn?1:0}});return{name:yt,choices:qt,analysis:Gt}},gt=function(){mt(["","","",""]),dt(""),an(""),Ht("")};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(Lt){return dt(Lt)}}),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"))),He.map(function(Yt,Lt){return v.a.createElement("div",{className:w.a.choiceWrap,key:Lt},v.a.createElement(we.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},v.a.createElement("div",{className:"".concat(w.a.answer," ").concat(vt===Lt?w.a.activeAnswer:""),onClick:function(){return Ht(Lt)}},Me[Lt])),v.a.createElement("div",{className:w.a.editorWrap},Ut===Lt?v.a.createElement(_e.a,{id:"single-question-option-".concat(Lt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Yt,onChange:function(Pt){He[Lt]=Pt,mt(He)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Mt(Lt)}},v.a.createElement(b.a,{value:Yt}))),Lt>1&&v.a.createElement(we.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){mt(He.filter(function(Pt,gn){return gn!==Lt})),Lt===vt&&Ht(null)}})),Lt<7&&Lt===He.length-1&&v.a.createElement(we.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(Ke.a)(He),[""]))}})))}),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:Gt,onChange:function(Lt){return an(Lt)}}))},ot=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)),et=["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 L=R.editData,y=R.globalSetting,C=R.loading,_=R.dispatch,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ce=Object(it.a)(R,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(K.useState)(""),Ze=Object(pe.a)(Ve,2),He=Ze[0],mt=Ze[1],Ot=Object(K.useState)(""),$e=Object(pe.a)(Ot,2),Ut=$e[0],Mt=$e[1],Bt=Object(K.useState)(""),Nt=Object(pe.a)(Bt,2),vt=Nt[0],Ht=Nt[1];Object(K.useEffect)(function(){var yt;if(!L||!F)return;mt(L==null?void 0:L.name),Mt(L==null?void 0:L.analysis),Ht(L==null||((yt=L.answer_texts)===null||yt===void 0)?void 0:yt[0])},[L]),Object(K.useImperativeHandle)(O,function(){return{onSave:Ft,Clear:ze}});var Ft=function(){return He?vt?{name:He,answer_texts:[vt],analysis:Ut}:(z.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},ze=function(){mt(""),Mt(""),Ht("")};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:He,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 Ht(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:Ut,onChange:function(dt){return Mt(dt)}}))},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)(ut)),Ct=x("k1fw"),ft=["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"],ge=function(R,O){var L=R.globalSetting,y=R.loading,C=R.dispatch,_=R.editData,E=R.onRef,te=E===void 0?function(){}:E,F=R.isEdit,ce=Object(it.a)(R,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),Ve=Object(K.useState)(""),Ze=Object(pe.a)(Ve,2),He=Ze[0],mt=Ze[1],Ot=Object(K.useState)([]),$e=Object(pe.a)(Ot,2),Ut=$e[0],Mt=$e[1];console.log(Ut),Object(K.useEffect)(function(){var Ft;if(!_||!F)return;mt(_==null?void 0:_.name);var ze=_==null||((Ft=_.sub_item_banks)===null||Ft===void 0)?void 0:Ft.map(function(yt){var dt,_t,$t;return Object(Ct.a)(Object(Ct.a)({},yt),{},{id:yt.id,open:!1,qusList:yt==null||((dt=yt.choices)===null||dt===void 0)?void 0:dt.map(function(Gt){return Gt.choice_text}),activeQusEditor:null,qusAnswer:(_t=[yt==null||(($t=yt.choices)===null||$t===void 0)?void 0:$t.findIndex(function(Gt){return Gt.is_answer})])===null||_t===void 0?void 0:_t.filter(function(Gt){return Gt!==-1})})});Mt(ze)},[_]),Object(K.useImperativeHandle)(O,function(){return{onSave:Bt,Clear:Nt}});var Bt=function(){if(!He)return z.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Ut.length===0)return z.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var ze=0;ze<Ut.length;ze++){var yt,dt=Ut[ze];if(!(dt!=null&&dt.name))return z.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(ze+1,"\u5C0F\u9898\u9898\u5E72")),!1;var _t=dt==null||((yt=dt.qusList)===null||yt===void 0)?void 0:yt.findIndex(function(Gt){return!Gt});if(_t>-1)return z.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(ze+1,"\u5C0F\u9898").concat(ft[_t],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(dt!=null&&dt.qusAnswer.length))return z.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(ze+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var $t=Ut.map(function(Gt){return{id:Gt.id>1?Gt.id:null,name:Gt.name,item_type:Gt.item_type,analysis:Gt.analysis,choices:Gt.qusList.map(function(an,zt){return{choice_text:an,is_answer:Gt.qusAnswer[0]===zt?1:0}})}});return{name:He,sub_item_banks:$t}},Nt=function(){mt(""),Mt([])},vt=function(){var ze={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Mt(Ut.concat(ze))},Ht=function(ze,yt,dt){var _t=Object(S.cloneDeep)(Ut);if(ze==="open"&&(_t[yt].open=!_t[yt].open),ze==="delete"&&_t.splice(yt,1),ze==="value"&&(_t[yt].name=dt),ze==="answer"&&(_t[yt].qusAnswer=[dt]),ze==="edit"&&(_t[yt].activeQusEditor=dt),ze==="details"&&(_t[yt].qusList[_t[yt].activeQusEditor]=dt),ze==="addQus"&&(_t[yt].qusList=_t[yt].qusList.concat("")),ze==="deleteQus"){var $t;_t[yt].qusList=_t[yt].qusList.filter(function(Gt,an){return an!==dt}),_t[yt].qusAnswer=($t=_t[yt].qusAnswer)===null||$t===void 0?void 0:$t.filter(function(Gt){return Gt!==dt})}ze==="analysis"&&(_t[yt].analysis=dt),Mt(_t)};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:He,onChange:function(ze){return mt(ze)}}),Ut==null?void 0:Ut.map(function(Ft,ze){var yt;return v.a.createElement("div",{className:w.a.fold,key:Ft.id},v.a.createElement("div",{onClick:function(){return Ht("open",ze)},className:w.a.head},v.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Ft.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),v.a.createElement("span",null,"\u7B2C",ze+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),v.a.createElement("b",{style:{visibility:"hidden"},onClick:function(_t){_t.stopPropagation(),Ht("delete",ze)},className:"iconfont icon-shanchu8"})),v.a.createElement("div",{className:"mb10",style:{display:Ft.open?"block":"none"}},v.a.createElement(_e.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ft==null?void 0:Ft.name,onChange:function(_t){return Ht("value",ze,_t)}}),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"))),Ft==null||((yt=Ft.qusList)===null||yt===void 0)?void 0:yt.map(function(dt,_t){var $t,Gt;return v.a.createElement("div",{className:w.a.choiceWrap,key:_t},v.a.createElement(we.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},v.a.createElement("div",{className:"".concat(w.a.answer," ").concat(Ft!=null&&($t=Ft.qusAnswer)!==null&&$t!==void 0&&$t.includes(_t)?w.a.activeAnswer:""),onClick:function(){return Ht("answer",ze,_t)}},ft[_t])),v.a.createElement("div",{className:w.a.editorWrap},(Ft==null?void 0:Ft.activeQusEditor)===_t?v.a.createElement(_e.a,{id:"single-question-option-".concat(_t),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:dt,onChange:function(zt){return Ht("details",ze,zt)}}):v.a.createElement("div",{className:w.a.htmlWrap,onClick:function(){return Ht("edit",ze,_t)}},v.a.createElement(b.a,{value:dt}))),_t>1&&v.a.createElement(we.a,{title:"\u5220\u9664"},v.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Ht("deleteQus",ze,_t)}})),_t<7&&_t===(Ft==null||((Gt=Ft.qusList)===null||Gt===void 0)?void 0:Gt.length)-1&&v.a.createElement(we.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},v.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Ht("addQus",ze)}})))}),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:Ft.analysis,onChange:function(_t){return Ht("analysis",ze,_t)}})))}))},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)(ge)),ct=function(R){var O,L,y,C,_,E,te,F,ce=R.data,Ve=R.submit,Ze=R.goBack,He=R.loading,mt=R.onTypeScore,Ot=R.editPreview,$e=Ot===void 0?!1:Ot,Ut=R.onSkipExamination,Mt=R.selectValue,Bt=R.onExchange,Nt=Object(K.useRef)(),vt=Object(K.useRef)(Object(S.debounce)(function(){return qt()},100,{leading:!0,trailing:!0})),Ht=Object(K.useState)(null),Ft=Object(pe.a)(Ht,2),ze=Ft[0],yt=Ft[1],dt=Object(K.useState)(!1),_t=Object(pe.a)(dt,2),$t=_t[0],Gt=_t[1],an=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(){Gt(!0)},[]),Object(K.useEffect)(function(){var ne,H,Se,ht,st=(ne=document.getElementById("examName"))===null||ne===void 0||((H=ne.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||H===void 0||((Se=H[0])===null||Se===void 0||((ht=Se.childNodes)===null||ht===void 0)))?void 0:ht[2];st&&(st.nodeValue="\u4EFD")},[ce]);var zt=function(H){var Se=parseInt(H);return isNaN(Se)?"":Se};function gt(){var ne=0,H=0,Se=0;return document.body&&(H=document.body.scrollTop),document.documentElement&&(Se=document.documentElement.scrollTop),ne=H-Se>0?H:Se,ne}function Yt(){var ne=0,H=0,Se=0;return document.body&&(H=document.body.scrollHeight),document.documentElement&&(Se=document.documentElement.scrollHeight),ne=H-Se>0?H:Se,ne}function Lt(){var ne=0;return document.compatMode=="CSS1Compat"?ne=document.documentElement.clientHeight:ne=document.body.clientHeight,ne}var qt=function(){var H=document.getElementById("preview_btns"),Se=document.getElementById("preview_btns_else");gt()+Lt()>=Yt()-68?(H.style.visibility="hidden",Se.style.visibility="visible"):(H.style.visibility="visible",Se.style.visibility="hidden")},Pt=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],gn=function(H){var Se,ht=[];return v.a.createElement(v.a.Fragment,null,v.a.createElement("aside",{className:X.a.single},H==null||((Se=H.choices)===null||Se===void 0)?void 0:Se.map(function(st,at){return st.is_answer&&ht.push(sn[at]),v.a.createElement("ul",{key:at},v.a.createElement("li",null,sn[at],"\u3001"),v.a.createElement("li",null,v.a.createElement(b.a,{value:st.choice_text})))})),v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",ht.join(""),v.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Pt[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))))},Xn=function(H){var Se,ht=H==null||((Se=H.standard_answer)===null||Se===void 0)?void 0:Se.map(function(st){var at;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(st.position,"\uFF09\uFF1A").concat(st==null||((at=st.answer_text)===null||at===void 0)?void 0:at.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",ht),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))))},oi=function(H){var Se;return v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",H==null||((Se=H.answer_texts)===null||Se===void 0)?void 0:Se[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)))},Le=function(H){var Se;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||((Se=H.program_attr)===null||Se===void 0)?void 0:Se.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)))},Qe=function(H,Se){var ht;return v.a.createElement("div",null,H==null||((ht=H.sub_item_banks)===null||ht===void 0)?void 0:ht.map(function(st,at){var Rt,Qt=[];return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},Se+1+"."+(at+1),"\uFF08\u5355\u9009\u9898\uFF09",st.name),v.a.createElement("aside",{className:X.a.single},st==null||((Rt=st.choices)===null||Rt===void 0)?void 0:Rt.map(function(pn,cn){return pn.is_answer&&Qt.push(sn[cn]),v.a.createElement("ul",{key:cn},v.a.createElement("li",null,sn[cn],"\u3001"),v.a.createElement("li",null,v.a.createElement(b.a,{value:pn.choice_text})))})),v.a.createElement("div",{className:X.a.analysis},v.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Qt.join(""),v.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Pt[st.difficulty])),v.a.createElement("aside",null,v.a.createElement("span",{className:X.a.text},"\u89E3\u6790:"),v.a.createElement(b.a,{value:st.analysis?st.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))))}))},sn=["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"],fn=function(H){console.log("---",H);var Se=[];H.questions.map(function(st){return st==null?void 0:st.sub_item_banks.map(function(at){Se.push(at)})});var ht=0;H.type==="COMBINATION"?ht=H.questions_score/Se.length:ht=H.questions_score/H.questions_count,ie.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:zt,defaultValue:ht,onChange:function(at){ht=at}}),v.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var st=Object(V.a)(ue.a.mark(function Rt(){var Qt,pn;return ue.a.wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:if(ht){ln.next=3;break}return z.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),ln.abrupt("return",Promise.reject());case 3:H.type==="COMBINATION"?(Qt={type:H==null?void 0:H.type,score:ht,scoreTotal:ht*(Se==null?void 0:Se.length)},mt(Qt)):(pn={type:H==null?void 0:H.type,score:ht,scoreTotal:ht*H.questions_count},mt(pn));case 4:case"end":return ln.stop()}},Rt)}));function at(){return st.apply(this,arguments)}return at}()})},vn=function(){var H="";ie.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:J.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(ht){H=ht.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Se=Object(V.a)(ue.a.mark(function st(){var at,Rt,Qt,pn,cn;return ue.a.wrap(function(mn){for(;;)switch(mn.prev=mn.next){case 0:if(H){mn.next=3;break}return z.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),mn.abrupt("return",Promise.reject());case 3:return Rt=[],Qt=[],pn=[],ce==null||((at=ce.questionList)===null||at===void 0)||at.forEach(function(En){var Ln;(Ln=En.questions)===null||Ln===void 0||Ln.forEach(function(ti){Rt.push(ti.id),Qt.push(En.questions_score/En.questions_count),En.type==="COMBINATION"&&pn.push({id:ti.id,sub_item_bank_ids:ti.sub_item_banks.map(function(wn){return wn.id})})})}),console.log("-----",pn),cn={item_bank_ids:Rt,item_bank_scores:Qt,name:H,combination_item_banks:pn},mn.next=11,Ve(cn);case 11:case"end":return mn.stop()}},st)}));function ht(){return Se.apply(this,arguments)}return ht}()})},xn=function(H,Se,ht,st){var at,Rt=(at=st.questions)===null||at===void 0?void 0:at.map(function(pn){return pn.id}),Qt=ie.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 pn=Object(V.a)(ue.a.mark(function ln(){return ue.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:return Qt.update({cancelButtonProps:{disabled:!0}}),En.next=3,Bt({single_question_id:H,seleted_item_bank_ids:Rt},{type:Se,index:ht});case 3:Qt.update({cancelButtonProps:{disabled:!1}}),z.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return En.stop()}},ln)}));function cn(){return pn.apply(this,arguments)}return cn}()})},h=function(H){var Se,ht=(Se=H.questions)===null||Se===void 0?void 0:Se.map(function(Rt){return Rt.id}),st=H.name,at=ie.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(st,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Rt=Object(V.a)(ue.a.mark(function pn(){return ue.a.wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return at.update({cancelButtonProps:{disabled:!0}}),ln.next=3,Bt({seleted_item_bank_ids:ht},{type:H.type});case 3:at.update({cancelButtonProps:{disabled:!1}}),z.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(st,"\u8BD5\u9898"));case 5:case"end":return ln.stop()}},pn)}));function Qt(){return Rt.apply(this,arguments)}return Qt}()})},o=function(){var H=ie.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 Se=Object(V.a)(ue.a.mark(function st(){return ue.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return H.update({cancelButtonProps:{disabled:!0}}),Rt.next=3,Bt();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 Rt.stop()}},st)}));function ht(){return Se.apply(this,arguments)}return ht}()})},a=function(H){console.log(H,"key"),Ut(H-1)},u=function(){return v.a.createElement(v.a.Fragment,null,v.a.createElement(ee.a,{color:"#55575D",overlayClassName:X.a.popover,visible:$t,getPopupContainer:function(Se){return Se==null?void 0:Se.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 Gt(!0)},onMouseLeave:function(){return Gt(!1)},onClick:function(){vn()}},"\u4FDD\u5B58")),v.a.createElement(se.a,{onClick:function(){document.body.scrollIntoView(),Ze()}},"\u8FD4\u56DE"),v.a.createElement(se.a,{loading:He,onClick:function(){return Ve()},type:"primary"},"\u63D0\u4EA4"))},d=function(){var H;return v.a.createElement(v.a.Fragment,null,v.a.createElement(se.a,{onClick:Ze},"\u8FD4\u56DE"),Mt>0&&v.a.createElement(se.a,{onClick:function(){return a(Mt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Mt<(ce==null||((H=ce.exam)===null||H===void 0)?void 0:H.total_num)-1&&v.a.createElement(se.a,{onClick:function(){return a(Mt+2)}},"\u4E0B\u4E00\u4EFD"))},c=function(H,Se){if(console.log(H,222),Se==="SINGLE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(ot,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="MULTIPLE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(je,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="JUDGMENT")return v.a.createElement(v.a.Fragment,null,v.a.createElement(Fe,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="COMPLETION")return v.a.createElement(v.a.Fragment,null,v.a.createElement(St,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="SUBJECTIVE")return v.a.createElement(v.a.Fragment,null,v.a.createElement(kt,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="COMBINATION")return v.a.createElement(v.a.Fragment,null,v.a.createElement(wt,{ref:Nt,editData:H,isEdit:!0}),v.a.createElement(ve.a,null));if(Se==="PROGRAM"){var ht;D.d.push("/problems/".concat(H==null||((ht=H.program_attr)===null||ht===void 0)?void 0:ht.identifier,"/edit?type=exercises&express_id=").concat(an.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"))}},N=function(){var ne=Object(V.a)(ue.a.mark(function H(Se,ht){var st,at,Rt,Qt,pn,cn,ln,mn,En,Ln;return ue.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,(st=Nt.current)===null||st===void 0?void 0:st.onSave();case 2:if(at=wn.sent,at){wn.next=5;break}return wn.abrupt("return");case 5:return Rt={question_score:ht.score,analysis:at.analysis},console.log(at,"editorData"),(Se==="SINGLE"||Se==="MULTIPLE"||Se==="JUDGMENT")&&(pn=[],cn=[],Rt.question_type=Se==="JUDGMENT"?2:1,Rt.question_title=at==null?void 0:at.name,at==null||((Qt=at.choices)===null||Qt===void 0)||Qt.forEach(function(Mn,mi){pn.push(Mn.choice_text),Mn!=null&&Mn.is_answer&&cn.push(mi+1)}),Rt.question_choices=pn,Rt.standard_answers=cn),Se==="COMPLETION"&&(Rt.is_ordered=at.is_ordered,Rt.question_title=at==null?void 0:at.name,Rt.question_type=3,mn=[],at==null||((ln=at.standard_answers)===null||ln===void 0)||ln.forEach(function(Mn,mi){mn.push({choice_id:Mn.position,answer_text:Mn.answer_text})}),Rt.standard_answers=mn),Se==="SUBJECTIVE"&&(Rt.question_title=at==null?void 0:at.name,Rt.question_type=3,Rt.standard_answers=at==null?void 0:at.answer_texts),Se==="COMBINATION"&&(Rt.question_title=at==null?void 0:at.name,Rt.question_type=7,Rt.sub_questions=at==null||((En=at.sub_item_banks)===null||En===void 0)?void 0:En.map(function(Mn,mi){return{id:Mn.id,question_title:Mn.name,question_type:1,question_choices:Mn.choices.map(function(Kn){return Kn.choice_text}),standard_answers:[Mn.choices.findIndex(function(Kn){return Kn.is_answer})+1],analysis:Mn.analysis}}),delete Rt.analysis),wn.next=13,Object(k.a)("/api/exercise_questions/".concat(ht.id,".json"),{method:"put",body:Rt});case 13:Ln=wn.sent,(Ln==null?void 0:Ln.status)===0&&(z.b.success("\u7F16\u8F91\u6210\u529F"),a(Mt+1)),yt(null);case 16:case"end":return wn.stop()}},H)}));return function(Se,ht){return ne.apply(this,arguments)}}(),Te=function(){for(var H=[],Se=0;Se<(ce==null||((ht=ce.exam)===null||ht===void 0)?void 0:ht.total_num);Se++){var ht;H.push({})}return H};console.log(Te(),"data");var Je=ce==null||((O=ce.questionList)===null||O===void 0)?void 0:O.reduce(function(ne,H){return ne+H.questions_score},0),bt=$e&&(ce==null||((L=ce.exam)===null||L===void 0)?void 0:L.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 Se=document.getElementById("id_left_preview");Se.style.overflowY="auto"},onMouseLeave:function(H){var Se=document.getElementById("id_left_preview");Se.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:de.a}),v.a.createElement("span",null,"\u9898\u6570(\u9053)"),v.a.createElement("aside",null,ce==null?void 0:ce.all_questions_count)),v.a.createElement("div",{className:"mr30 ml30"},v.a.createElement("img",{src:xe.a}),v.a.createElement("span",null,"\u603B\u5206(\u5206)"),v.a.createElement("aside",null,Je)),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,ce==null||((y=ce.exam)===null||y===void 0)?void 0:y.time))),ce==null||((C=ce.questionList)===null||C===void 0)?void 0:C.map(function(ne,H){var Se;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,ne.name)),v.a.createElement("aside",null,v.a.createElement("div",null,"\u5171",v.a.createElement("span",{className:X.a.b},ne.questions_count),"\u9898 ",v.a.createElement("span",{className:X.a.l},"|"),"\u5171",v.a.createElement("span",{className:X.a.r},ne.questions_score),"\u5206"),v.a.createElement("div",{className:X.a.answerSheet},ne==null||((Se=ne.questions)===null||Se===void 0)?void 0:Se.map(function(ht,st){return v.a.createElement("div",{onClick:function(){var Rt="Anchor_".concat(ht.id),Qt=document.getElementById(Rt);Qt&&setTimeout(function(){return Qt.scrollIntoView({block:"center",behavior:"smooth"})})},key:ht.id,className:X.a.tag},st+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(we.a,{title:ce==null||((_=ce.exam)===null||_===void 0)?void 0:_.name,getPopupContainer:function(H){return H.parentNode}},v.a.createElement("span",{className:X.a.t},ce==null||((E=ce.exam)===null||E===void 0)?void 0:E.name))),$e?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:ce==null||((te=ce.exam)===null||te===void 0)?void 0:te.total_num,pageSize:1,current:Mt+1,showSizeChanger:!1,onChange:a,showQuickJumper:!0,hideOnSinglePage:!1}):v.a.createElement(se.a,{onClick:o,type:"primary"},"\u968F\u673A\u66F4\u6362")),v.a.createElement("div",{className:X.a.topWarp},ce==null||((F=ce.questionList)===null||F===void 0)?void 0:F.map(function(ne,H){var Se,ht;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,ne.name)),v.a.createElement("div",{className:X.a.so},"\u5171",v.a.createElement("span",{className:X.a.b},ne.questions_count," "),"\u9898 ",ne.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(ne==null||((Se=ne.questions)===null||Se===void 0)?void 0:Se.map(function(st){var at;return st==null||((at=st.sub_item_banks)===null||at===void 0)?void 0:at.length}).reduce(function(st,at){return st+at}),"\u5C0F\u9898\uFF09"),v.a.createElement("span",{className:X.a.l},"|"),"\u5171",v.a.createElement("span",{className:X.a.r},ne.questions_score),"\u5206"),!$e&&v.a.createElement("div",{className:X.a.btn},v.a.createElement(se.a,{onClick:function(){fn(ne)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),v.a.createElement(se.a,{onClick:function(){return h(ne)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),ne==null||((ht=ne.questions)===null||ht===void 0)?void 0:ht.map(function(st,at){return ze===st.id?v.a.createElement("div",{id:"Anchor_".concat(st.id),className:X.a.content,style:{padding:0,marginTop:10},key:st.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 N(ne==null?void 0:ne.type,st)},type:"primary"},"\u4FDD\u5B58")),c(st,ne.type)):v.a.createElement("div",{id:"Anchor_".concat(st.id),className:X.a.content,key:st.id},v.a.createElement("div",{className:X.a.titleWrap},v.a.createElement(b.a,{style:{paddingRight:10},className:X.a.titleHtml,value:at+1+"\u3001"+"".concat((st==null?void 0:st.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+st.name}),$e&&v.a.createElement(se.a,{disabled:bt,onClick:function(){if(ze){z.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}yt(st.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),v.a.createElement(se.a,{disabled:bt,onClick:function(){return xn(st.id,ne.type,at,ne)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(ne.type==="SINGLE"||ne.type==="JUDGMENT"||ne.type==="MULTIPLE")&&gn(st),ne.type==="COMPLETION"&&Xn(st),ne.type==="SUBJECTIVE"&&oi(st),ne.type==="PROGRAM"&&Le(st),ne.type==="COMBINATION"&&Qe(st,at),v.a.createElement("div",null))}))})),v.a.createElement("div",{className:X.a.btnsElse,id:"preview_btns_else"},$e?d():u()),v.a.createElement("div",{className:X.a.btnsWrap,id:"preview_btns"},v.a.createElement("div",{className:X.a.btns},$e?d():u()))))},be=rt.a=ct},vHTk:function(At,rt,x){At.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|