(window.webpackJsonp=window.webpackJsonp||[]).push([[218,7],{"+NIl":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(Z,D){"use strict";function Y(L,w){L.cmdState.push(w)}function N(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function M(L){var w=L.cmdState.pop();w&&w.closeBracket()}function H(L){for(var w=L.cmdState,b=w.length-1;b>=0;b--){var u=w[b];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function U(L,w,b){return function(){this.name=L,this.bracketNo=0,this.style=w,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=U("importmodule","tag",["string","builtin"]),P.documentclass=U("documentclass","tag",["","atom"]),P.usepackage=U("usepackage","tag",["atom"]),P.begin=U("begin","tag",["atom"]),P.end=U("end","tag",["atom"]),P.label=U("label","tag",["atom"]),P.ref=U("ref","tag",["atom"]),P.eqref=U("eqref","tag",["atom"]),P.cite=U("cite","tag",["atom"]),P.bibitem=U("bibitem","tag",["atom"]),P.Bibitem=U("Bibitem","tag",["atom"]),P.RBibitem=U("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(L,w){L.f=w}function y(L,w){var b;if(L.match(/^\\[a-zA-Z@]+/)){var u=L.current().slice(1);return b=P.hasOwnProperty(u)?P[u]:P.DEFAULT,b=new b,Y(w,b),_(w,R),b.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return _(w,function(l,h){return A(l,h,"\\]")}),"keyword";if(L.match("\\("))return _(w,function(l,h){return A(l,h,"\\)")}),"keyword";if(L.match("$$"))return _(w,function(l,h){return A(l,h,"$$")}),"keyword";if(L.match("$"))return _(w,function(l,h){return A(l,h,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=N(w),b)b.closeBracket(o),_(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(b=P.DEFAULT,b=new b,Y(w,b),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),b=H(w),b.name=="begin"&&(b.argument=L.current()),b.styleIdentifier())}function A(L,w,b){if(L.eatSpace())return null;if(b&&L.match(b))return _(w,y),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=L.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(L.skipToEnd(),"comment"):"error"}function R(L,w){var b=L.peek(),u;return b=="{"||b=="["?(u=N(w),u.openBracket(b),L.eat(b),_(w,y),"bracket"):/[ \t\r]/.test(b)?(L.eat(b),null):(_(w,y),M(w),y(L,w))}return{startState:function(){var L=D.inMathMode?function(w,b){return A(w,b)}:y;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,w){return w.f(L,w)},blankLine:function(L){L.f=y,L.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"19Vz":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,P,_){var y=_&&_!=re.Init;if(P&&!y)U.on("blur",N),U.on("change",M),U.on("swapDoc",M),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){Y(U)}),M(U);else if(!P&&y){U.off("blur",N),U.off("change",M),U.off("swapDoc",M),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),Z(U);var A=U.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}P&&!U.hasFocus()&&N(U)});function Z(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function D(U){Z(U);var P=U.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=U.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var _=U.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),P.appendChild(_),U.display.lineSpace.insertBefore(P,U.display.lineSpace.firstChild)}function Y(U){setTimeout(function(){var P=!1,_=U.getInputField();_.nodeName=="TEXTAREA"?P=!_.value:U.lineCount()==1&&(P=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),P?D(U):Z(U)},20)}function N(U){H(U)&&D(U)}function M(U){var P=U.getWrapperElement(),_=H(U);P.className=P.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?D(U):Z(U)}function H(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";var Z={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(Y,N){var M=Y.indentUnit,H={},U=N.htmlMode?Z:D;for(var P in U)H[P]=U[P];for(var P in N)H[P]=N[P];var _,y;function A(a,x){function v(G){return x.tokenize=G,G(a,x)}var T=a.next();if(T=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(w("atom","]]>")):null:a.match("--")?v(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=w("meta","?>"),"meta"):(_=a.eat("/")?"closeTag":"openTag",x.tokenize=R,"tag bracket");if(T=="&"){var I;return a.eat("#")?a.eat("x")?I=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):I=a.eatWhile(/[\d]/)&&a.eat(";"):I=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),I?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function R(a,x){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return x.tokenize=A,_=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return _="equals",null;if(v=="<"){x.tokenize=A,x.state=h,x.tagName=x.tagStart=null;var T=x.tokenize(a,x);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(v)?(x.tokenize=L(v),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var x=function(v,T){for(;!v.eol();)if(v.next()==a){T.tokenize=R;break}return"string"};return x.isInAttribute=!0,x}function w(a,x){return function(v,T){for(;!v.eol();){if(v.match(x)){T.tokenize=A;break}v.next()}return a}}function b(a){return function(x,v){for(var T;(T=x.next())!=null;){if(T=="<")return v.tokenize=b(a+1),v.tokenize(x,v);if(T==">")if(a==1){v.tokenize=A;break}else return v.tokenize=b(a-1),v.tokenize(x,v)}return"meta"}}function u(a,x,v){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=v,(H.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!H.contextGrabbers.hasOwnProperty(v)||!H.contextGrabbers[v].hasOwnProperty(x))return;o(a)}}function h(a,x,v){return a=="openTag"?(v.tagStart=x.column(),C):a=="closeTag"?g:h}function C(a,x,v){return a=="word"?(v.tagName=x.current(),y="tag",E):H.allowMissingTagName&&a=="endTag"?(y="tag bracket",E(a,x,v)):(y="error",C)}function g(a,x,v){if(a=="word"){var T=x.current();return v.context&&v.context.tagName!=T&&H.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==T||H.matchClosing===!1?(y="tag",p):(y="tag error",k)}else return H.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,x,v)):(y="error",k)}function p(a,x,v){return a!="endTag"?(y="error",p):(o(v),h)}function k(a,x,v){return y="error",p(a,x,v)}function E(a,x,v){if(a=="word")return y="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var T=v.tagName,I=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(T)?l(v,T):(l(v,T),v.context=new u(v,T,I==v.indented)),h}return y="error",E}function f(a,x,v){return a=="equals"?m:(H.allowMissing||(y="error"),E(a,x,v))}function m(a,x,v){return a=="string"?d:a=="word"&&H.allowUnquoted?(y="string",E):(y="error",E(a,x,v))}function d(a,x,v){return a=="string"?d:E(a,x,v)}return{startState:function(a){var x={tokenize:A,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;_=null;var v=x.tokenize(a,x);return(v||_)&&v!="comment"&&(y=null,x.state=x.state(_||v,a,x),y&&(v=y=="error"?v+" error":y)),v},indent:function(a,x,v){var T=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(T&&T.noIndent)return re.Pass;if(a.tokenize!=R&&a.tokenize!=A)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return H.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/$/,blockCommentStart:"",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(a){a.state==m&&(a.state=E)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],v=a.context;v;v=v.prev)v.tagName&&x.push(v.tagName);return x.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(wt,pt,se){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function D(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(Z)}var Y=/^(?:[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 N(R){return typeof R=="string"&&Y.test(R)}for(var M=N,H=[],U=0;U<256;++U)H.push((U+256).toString(16).substr(1));function P(R){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(H[R[L+0]]+H[R[L+1]]+H[R[L+2]]+H[R[L+3]]+"-"+H[R[L+4]]+H[R[L+5]]+"-"+H[R[L+6]]+H[R[L+7]]+"-"+H[R[L+8]]+H[R[L+9]]+"-"+H[R[L+10]]+H[R[L+11]]+H[R[L+12]]+H[R[L+13]]+H[R[L+14]]+H[R[L+15]]).toLowerCase();if(!M(w))throw TypeError("Stringified UUID is invalid");return w}var _=P;function y(R,L,w){R=R||{};var b=R.random||(R.rng||D)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,L){w=w||0;for(var u=0;u<16;++u)L[w+u]=b[u];return L}return _(b)}var A=pt.a=y},"7ahc":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return C});var re=se("k1fw"),Z=se("0Owb"),D=se("+L6B"),Y=se("2/Rp"),N=se("y8nQ"),M=se("Vl3Y"),H=se("tJVT"),U=se("OaEy"),P=se("2fM7"),_=se("q1tI"),y=se.n(_),A=se("VrN/"),R=se.n(A),L=se("p77/"),w=se.n(L),b=se("c5Ni"),u=se.n(b),o=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};pt.b=function(g){var p=g.callback,k=g.onCancel,E=Object(_.useState)("python"),f=Object(H.a)(E,2),m=f[0],d=f[1];function a(v){d(h[v][1])}function x(v){p(v)}return y.a.createElement(M.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(P.a,{onChange:a},Object.keys(h).map(function(v){return y.a.createElement(o,{key:v,value:v},h[v][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(C,{mode:m})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Y.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function C(g){var p=g.value,k=g.onChange,E=g.mode,f=g.options,m=f===void 0?{}:f,d=Object(_.useRef)(),a=Object(_.useState)(),x=Object(H.a)(a,2),v=x[0],T=x[1];return Object(_.useEffect)(function(){if(v){function I(G){var V=G.getValue();k&&k(V)}return v.on("change",I),function(){v.off("change",I)}}},[v,k]),Object(_.useEffect)(function(){v&&v.setOption("mode",E)},[v,E]),Object(_.useEffect)(function(){v&&((p!==v.getValue()||p==="")&&setTimeout(function(){v.setValue(p||" ")},300))},[v,p]),Object(_.useEffect)(function(){if(d.current&&!v){var I=R.a.fromTextArea(d.current,Object(re.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},m));T(I)}},[d.current,v]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:d}))}},"7ixt":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return D});var re={adjustX:1,adjustY:1},Z=[0,0],D={left:{points:["cr","cl"],overflow:re,offset:[-4,0],targetOffset:Z},right:{points:["cl","cr"],overflow:re,offset:[4,0],targetOffset:Z},top:{points:["bc","tc"],overflow:re,offset:[0,-4],targetOffset:Z},bottom:{points:["tc","bc"],overflow:re,offset:[0,4],targetOffset:Z},topLeft:{points:["bl","tl"],overflow:re,offset:[0,-4],targetOffset:Z},leftTop:{points:["tr","tl"],overflow:re,offset:[-4,0],targetOffset:Z},topRight:{points:["br","tr"],overflow:re,offset:[0,-4],targetOffset:Z},rightTop:{points:["tl","tr"],overflow:re,offset:[4,0],targetOffset:Z},bottomRight:{points:["tr","br"],overflow:re,offset:[0,4],targetOffset:Z},rightBottom:{points:["bl","br"],overflow:re,offset:[4,0],targetOffset:Z},bottomLeft:{points:["tl","bl"],overflow:re,offset:[0,4],targetOffset:Z},leftBottom:{points:["br","bl"],overflow:re,offset:[-4,0],targetOffset:Z}},Y=D},"8EBN":function(wt,pt,se){(function(re){re(se("VrN/"))})(function(re){"use strict";re.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 Z=0;Z-1&&Y.substring(H+1,Y.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(Y){Y=Y.toLowerCase();for(var N=0;N=O.length?$.slice(O.length):$}).join(`
`)}var u=[],o=[""],l=new L.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){u.length=0,o=[""]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(W,s,c,O){if(s>=W.length||W[s].level<=c)return s;var $=W[s];O.push("- "+$.text+""),s++;var F=[];return s=p(W,s,$.level,F),F.length>0&&(O.push("
"),F.forEach(function(he){O.push(he)}),O.push("
")),O.push(" "),s=p(W,s,c,O),s}function k(){return p(u,0,0,o),o.push("
"),o.join("")}var E={heading:function(s){var c=h.exec(s);if(c)return{type:"heading",raw:c[0],depth:c[1].length,text:c[2]}},fences:function(s){var c=this.rules.block.fences.exec(s);if(c){var O=c[0],$=b(O,c[3]||""),F=c[2]?c[2].trim():c[2];if(["latex","katex","math"].indexOf(F)>=0){var he=d(),Re=$;$=he,a[he]={type:"block",expression:Re}}return{type:"code",raw:O,lang:F,text:$}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,m=0,d=function(){return"__special_katext_id_".concat(m++,"__")},a={};function x(){return a}function v(){m=0,a={}}function T(W){return W=W.replace(f,function(s,c){var O=d();return a[O]={type:"inline",expression:c},O}),W}var I=l.listitem;l.listitem=function(W){return I(T(W))};var G=l.paragraph;l.paragraph=function(W){return G(T(W))};var V=l.tablecell;l.tablecell=function(W,s){return V(T(W),s)},l.code=function(W,s,c){var O=(s||"").match(/\S*/)[0];return O?["latex","katex","math"].indexOf(O)>=0?"".concat(W,"
"):'
').concat(c?W:Object(w.escape)(W,!0),`
`):''+(c?W:Object(w.escape)(W,!0))+"
"},l.heading=function(W,s,c){var O=this.options.headerPrefix+c.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:O,level:s,text:W}),"'+W+""},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:E,renderer:l});var Q=L.a,z=se("SJMd"),j=se("ulZh"),q=se.n(j),ie=se("m3rI"),ce=se("Oy/b"),ve=se("p5ED"),Oe=se("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 xe=function(W,s){return(xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,O){c.__proto__=O}||function(c,O){for(var $ in O)Object.prototype.hasOwnProperty.call(O,$)&&(c[$]=O[$])})(W,s)};function Te(W,s){function c(){this.constructor=W}xe(W,s),W.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function we(W,s,c,O){return new(c||(c=Promise))(function($,F){function he(ht){try{Ke(O.next(ht))}catch(Pe){F(Pe)}}function Re(ht){try{Ke(O.throw(ht))}catch(Pe){F(Pe)}}function Ke(ht){var Pe;ht.done?$(ht.value):(Pe=ht.value,Pe instanceof c?Pe:new c(function(vt){vt(Pe)})).then(he,Re)}Ke((O=O.apply(W,s||[])).next())})}function Se(W,s){var c,O,$,F,he={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return F={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Re(Ke){return function(ht){return function(Pe){if(c)throw new TypeError("Generator is already executing.");for(;he;)try{if(c=1,O&&($=2&Pe[0]?O.return:Pe[0]?O.throw||(($=O.return)&&$.call(O),0):O.next)&&!($=$.call(O,Pe[1])).done)return $;switch(O=0,$&&(Pe=[2&Pe[0],$.value]),Pe[0]){case 0:case 1:$=Pe;break;case 4:return he.label++,{value:Pe[1],done:!1};case 5:he.label++,O=Pe[1],Pe=[0];continue;case 7:Pe=he.ops.pop(),he.trys.pop();continue;default:if(!($=he.trys,($=$.length>0&&$[$.length-1])||Pe[0]!==6&&Pe[0]!==2)){he=0;continue}if(Pe[0]===3&&(!$||Pe[1]>$[0]&&Pe[1]<$[3])){he.label=Pe[1];break}if(Pe[0]===6&&he.label<$[1]){he.label=$[1],$=Pe;break}if($&&he.label<$[2]){he.label=$[2],he.ops.push(Pe);break}$[2]&&he.ops.pop(),he.trys.pop();continue}Pe=s.call(W,he)}catch(vt){Pe=[6,vt],O=0}finally{c=$=0}if(5&Pe[0])throw Pe[1];return{value:Pe[0]?Pe[1]:void 0,done:!0}}([Ke,ht])}}}function pe(){for(var W=0,s=0,c=arguments.length;s',"select"),this.addActionButton(O,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(O,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(O,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(O,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(O,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(O,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(O,'',"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(F){var he=document.createElement("div");he.className=""+c.toolbarButtonStyleClass.name,he.setAttribute("data-type-name",F.typeName),he.innerHTML=F.icon,he.addEventListener("click",function(){c.markerToolbarButtonClicked(he,F)}),c.buttons.push(he),c.markerButtons.push(he)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",$.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild($),this.addActionButton($,'',"render"),this.addActionButton($,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},W.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},W.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},W.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},W.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c0&&this.buttonClickListeners.forEach(function(O){return O("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},W.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(O){return O("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},W.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},W.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(O){return O.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},W.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(O){return/delete|notes/.test(O.getAttribute("data-action"))}).forEach(function(O){c.currentMarker===void 0?(O.style.fillOpacity="0.4",O.style.pointerEvents="none"):(O.style.fillOpacity="1",O.style.pointerEvents="all")})},W}(),He=function(){function W(s,c,O,$){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=O,this.styles=$,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return W.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new ke("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 ke("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ke("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ke("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ke("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 ke("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ke("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ke("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ke("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Je("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Je("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},W.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},W.prototype.setPanelButtons=function(s){var c,O,$=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((O=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&O!==void 0?O:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var he;F.uiStyleSettings=$.uiStyleSettings;var Re=document.createElement("div");Re.className=$.toolboxButtonStyleClass.name+" "+((he=$.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&he!==void 0?he:$.toolboxButtonStyleColorsClass.name),Re.innerHTML=F.icon,Re.title=F.title,Re.addEventListener("click",function(){$.panelButtonClick(F)}),$.panelButtons.push(Re),$.buttonRow.appendChild(Re)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},W.prototype.panelButtonClick=function(s){var c=this,O=-1;if(s!==this.activePanel){O=this.panels.indexOf(s),this.panelRow.innerHTML="";var $=s.getUi();$.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild($),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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(F,he){var Re,Ke;F.className=c.toolboxButtonStyleClass.name+" "+(he===O?""+((Re=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Re!==void 0?Re:c.toolboxActiveButtonStyleColorsClass.name):""+((Ke=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ke!==void 0?Ke:c.toolboxButtonStyleColorsClass.name))})},W}(),Ge=function(W,s){this.title=W,this.icon=s},je=function(W){function s(c,O,$,F){var he=W.call(this,c,F||'')||this;return he.colors=[],he.addTransparent=!1,he.colorBoxes=[],he.colors=O,he.currentColor=$,he.setCurrentColor=he.setCurrentColor.bind(he),he.getColorBox=he.getColorBox.bind(he),he}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");return O.style.overflow="hidden",O.style.whiteSpace="nowrap",this.colors.forEach(function($){var F=c.getColorBox($);O.appendChild(F),c.colorBoxes.push(F)}),O},s.prototype.getColorBox=function(c){var O=this,$=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-$,he=document.createElement("div");he.style.display="inline-block",he.style.boxSizing="content-box",he.style.width=F-2+"px",he.style.height=F-2+"px",he.style.padding="1px",he.style.marginRight="2px",he.style.marginBottom="2px",he.style.borderWidth="2px",he.style.borderStyle="solid",he.style.borderRadius=(F+2)/2+"px",he.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",he.addEventListener("click",function(){O.setCurrentColor(c,he)});var Re=document.createElement("div");return Re.style.display="inline-block",Re.style.width=F-2+"px",Re.style.height=F-2+"px",Re.style.backgroundColor=c,Re.style.borderRadius=F/2+"px",c==="transparent"&&(Re.style.fill=this.uiStyleSettings.toolboxAccentColor,Re.innerHTML=``),he.appendChild(Re),he},s.prototype.setCurrentColor=function(c,O){var $=this;this.currentColor=c,this.colorBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(Ge),_e=function(){function W(s,c,O){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=O,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(W.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),W.prototype.ownsTarget=function(s){return!1},Object.defineProperty(W.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),W.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},W.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},W.prototype.pointerDown=function(s,c){},W.prototype.dblClick=function(s,c){},W.prototype.manipulate=function(s){},W.prototype.pointerUp=function(s){this.stateChanged()},W.prototype.dispose=function(){},W.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},W.prototype.getState=function(){return{typeName:W.typeName,state:this.state,notes:this.notes}},W.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},W.prototype.scale=function(s,c){},W.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},W.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},W.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},W.typeName="MarkerBase",W}(),Be=function(){function W(){this.findGripByVisual=this.findGripByVisual.bind(this)}return W.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},W}(),$e=function(){function W(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W}(),qe=function(){function W(){}return W.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},W.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},W}(),Qe=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(oe.createTransform()),F.setupControlBox(),F}return Te(s,W),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var O=oe.createTransform();this._visual.transform.baseVal.appendItem(O)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!W.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var $=this.unrotatePoint(c);if(this.manipulationStartX=$.x,this.manipulationStartY=$.y,this.offsetX=$.x-this.left,this.offsetY=$.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(O),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(O)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var he=this.container.transform.baseVal.getItem(0);he.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(he,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var O=this.state;W.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",O==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var O=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(O.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(O.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(O):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var O=this.manipulationStartLeft,$=this.manipulationStartWidth,F=this.manipulationStartTop,he=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:O=this.manipulationStartLeft+c.x-this.manipulationStartX,$=this.manipulationStartWidth+this.manipulationStartLeft-O;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:$=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+c.y-this.manipulationStartY,he=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:he=this.manipulationStartHeight+c.y-this.manipulationStartY}$>=0?(this.left=O,this.width=$):(this.left=O+$,this.width=-$),he>=0?(this.top=F,this.height=he):(this.top=F+he,this.height=-he),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var O=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*O,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var O=this.container.getCTM(),$=oe.createPoint(c.x,c.y);return{x:($=$.matrixTransform(O)).x,y:$.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var O=this.container.getCTM();O=O.inverse();var $=oe.createPoint(c.x,c.y);return{x:($=$.matrixTransform(O)).x,y:$.y}},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var c=oe.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=oe.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=oe.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 Be,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,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()},s.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()},s.prototype.createGrip=function(){var c=new $e;return c.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,O=-c/2,$=O,F=(this.width+this.CB_DISTANCE)/2-c/2,he=(this.height+this.CB_DISTANCE)/2-c/2,Re=this.height+this.CB_DISTANCE-c/2,Ke=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,O,$),this.positionGrip(this.controlGrips.topCenter.visual,F,$),this.positionGrip(this.controlGrips.topRight.visual,Ke,$),this.positionGrip(this.controlGrips.centerLeft.visual,O,he),this.positionGrip(this.controlGrips.centerRight.visual,Ke,he),this.positionGrip(this.controlGrips.bottomLeft.visual,O,Re),this.positionGrip(this.controlGrips.bottomCenter.visual,F,Re),this.positionGrip(this.controlGrips.bottomRight.visual,Ke,Re),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,$-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,O,$){var F=c.transform.baseVal.getItem(0);F.setTranslate(O,$),c.transform.baseVal.replaceItem(F,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},W.prototype.getState.call(this))},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c);var O=c;this.left=O.left,this.top=O.top,this.width=O.width,this.height=O.height,this.rotationAngle=O.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,O.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,O.containerTransformMatrix))},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O);var $=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:$.x*c,y:$.y*O});this.left=F.x,this.top=F.y,this.width=this.width*c,this.height=this.height*O,this.adjustControlBox()},s}(_e),Ze=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=oe.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)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){W.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){W.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){W.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){W.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this))},s.prototype.restoreState=function(c){var O=c;this.fillColor=O.fillColor,this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.opacity=O.opacity,this.createVisual(),W.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O),this.setSize()},s.title="Rectangle marker",s}(Qe),ct=function(W){function s(c,O,$,F){var he=W.call(this,c,F||'')||this;return he.widths=[],he.widthBoxes=[],he.widths=O,he.currentWidth=$,he.setCurrentWidth=he.setCurrentWidth.bind(he),he}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",this.widths.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=$===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentWidth($,F)}),O.appendChild(F);var he=document.createElement("div");he.innerText=$.toString(),he.style.marginRight="5px",F.appendChild(he);var Re=document.createElement("div");Re.style.minHeight="20px",Re.style.flexGrow="2",Re.style.display="flex",Re.style.alignItems="center";var Ke=document.createElement("hr");Ke.style.minWidth="20px",Ke.style.border="0px",Ke.style.borderTop=$+"px solid "+c.uiStyleSettings.toolboxColor,Ke.style.flexGrow="2",Re.appendChild(Ke),F.appendChild(Re),c.widthBoxes.push(F)}),O},s.prototype.setCurrentWidth=function(c,O){var $=this;this.currentWidth=c,this.widthBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ge),it=function(W){function s(c,O,$,F){var he=W.call(this,c,F||'')||this;return he.styles=[],he.styleBoxes=[],he.styles=O,he.currentStyle=$,he.setCurrentStyle=he.setCurrentStyle.bind(he),he}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",this.styles.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/c.styles.length-5+"%",F.style.borderColor=$===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentStyle($,F)}),O.appendChild(F);var he=document.createElement("div");he.style.minHeight="20px",he.style.flexGrow="2",he.style.overflow="hidden";var Re=``;he.innerHTML=Re,F.appendChild(he),c.styleBoxes.push(F)}),O},s.prototype.setCurrentStyle=function(c,O){var $=this;this.currentStyle=c,this.styleBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ge),rt=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ct("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new it("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=W.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon='',s}(Ze),Ce=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},lt=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return Te(s,W),s.prototype.ownsTarget=function(c){return!!W.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.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(O)?this.activeGrip=this.grip1:this.grip2.ownsTarget(O)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var O=this.state;W.prototype.pointerUp.call(this,c),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(c),this._state="select",O==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=oe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var c=new $e;return c.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,O,$){var F=c.transform.baseVal.getItem(0);F.setTranslate(O,$),c.transform.baseVal.replaceItem(F,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},W.prototype.getState.call(this))},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c);var O=c;this.x1=O.x1,this.y1=O.y1,this.x2=O.x2,this.y2=O.y2},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O),this.x1=this.x1*c,this.y1=this.y1*O,this.x2=this.x2*c,this.y2=this.y2*O,this.adjustVisual(),this.adjustControlBox()},s}(_e),nt=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ct("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new it("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.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)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c);var O=c;this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='',s}(lt),Ae=function(W){function s(c,O,$,F){var he=W.call(this,c,F||'')||this;return he.fonts=[],he.fontBoxes=[],he.fonts=O,he.currentFont=$,he.setCurrentFont=he.setCurrentFont.bind(he),he}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");return O.style.overflow="hidden",O.style.flexGrow="2",this.fonts.forEach(function($){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/c.fonts.length-5+"%",F.style.borderColor=$===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentFont($,F)}),O.appendChild(F);var he=document.createElement("div");he.style.display="flex",he.style.minHeight="20px",he.style.flexGrow="2",he.style.fontFamily=$,he.style.overflow="hidden";var Re=document.createElement("div");Re.style.whiteSpace="nowrap",Re.style.overflow="hidden",Re.style.textOverflow="ellipsis",Re.innerHTML="The quick brown fox jumps over the lazy dog",he.appendChild(Re),F.appendChild(he),c.fontBoxes.push(F)}),O},s.prototype.setCurrentFont=function(c,O){var $=this;this.currentFont=c,this.fontBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ge),Fe=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=$.defaultColor,F.fontFamily=$.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new je("Color",$.defaultColorSet,$.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new Ae("Font",$.defaultFontFamilies,$.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return Te(s,W),s.prototype.ownsTarget=function(c){if(W.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var O=!1;return this.textElement.childNodes.forEach(function($){$===c&&(O=!0)}),O},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=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(O){c.textElement.appendChild(oe.createTSpan(O.trim()===""?" ":O.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),O=1;if(c.width>0&&c.height>0){var $=(1*this.width-this.width*this.padding*2/100)/c.width,F=(1*this.height-this.height*this.padding*2/100)/c.height;O=Math.min($,F)}return O},s.prototype.getTextPosition=function(c){var O=this.textElement.getBBox(),$=0,F=0;return O.width>0&&O.height>0&&($=(this.width-O.width*c)/2,F=this.height/2-O.height*c/2),{x:$,y:F}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),O=this.getTextScale(),$=this.getTextPosition(O);$.y-=c.y*O,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+$.x+"px, "+$.y+"px) scale("+O+", "+O+")":(this.textElement.transform.baseVal.getItem(0).setTranslate($.x,$.y),this.textElement.transform.baseVal.getItem(1).setScale(O,O))},s.prototype.manipulate=function(c){W.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){W.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){W.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var O=this.state;O==="creating"&&(this._suppressMarkerCreateEvent=!0),W.prototype.pointerUp.call(this,c),this.setSize(),(O==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=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(O){O.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var O=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&O>.9;)O-=.1,c.textEditor.style.fontSize=Math.max(O,.9)+"em"}),this.textEditor.addEventListener("keyup",function(O){O.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(O){if(O.clipboardData){var $=O.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode($)),O.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),O=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),$=this.textElement.getBBox(),F={x:$.width*c,y:$.height*c};O.x-=F.x/2,O.y-=F.y/2,this.textEditor.style.top=O.y+"px",this.textEditor.style.left=O.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-O.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){W.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),W.prototype.deselect.call(this)},s.prototype.dblClick=function(c,O){W.prototype.dblClick.call(this,c,O),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&oe.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&oe.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var O=c;this.color=O.color,this.fontFamily=O.fontFamily,this.padding=O.padding,this.text=O.text,this.createVisual(),W.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='',s}(Qe),ge=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=$.defaultColor,F.lineWidth=$.defaultStrokeWidth,F.pixelRatio=$.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new je("Color",$.defaultColorSet,$.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new ct("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var c=oe.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,O){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(c.x,c.y),this.drawing=!0):W.prototype.pointerDown.call(this,c,O)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):W.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){W.prototype.resize.call(this,c),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):W.prototype.pointerUp.call(this,c)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),W.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),W.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),O=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],$=O[0],F=O[1],he=O[2],Re=O[3],Ke=!1,ht=0;ht0&&(Ke=!0,htRe&&(Re=ht),Pe>he&&(he=Pe));if(Ke){this.left=$/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(he-$)/this.pixelRatio,this.height=(Re-F)/this.pixelRatio;var vt=document.createElement("canvas");vt.width=he-$,vt.height=Re-F,vt.getContext("2d").putImageData(this.canvasContext.getImageData($,F,he-$,Re-F),0,0),this.drawingImgUrl=vt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),W.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='',s}(Qe),de=function(W){function s(c,O,$){var F=W.call(this,c,$||'')||this;return F.typeBoxes=[],F.currentType=O,F.setCurrentType=F.setCurrentType.bind(F),F}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2";for(var $=function(Re){var Ke="both";switch(Re){case 0:Ke="both";break;case 1:Ke="start";break;case 2:Ke="end";break;case 3:Ke="none"}var ht=document.createElement("div");if(ht.style.display="flex",ht.style.flexGrow="2",ht.style.alignItems="center",ht.style.justifyContent="space-between",ht.style.padding="5px",ht.style.borderWidth="2px",ht.style.borderStyle="solid",ht.style.borderColor=Ke===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",ht.addEventListener("click",function(){c.setCurrentType(Ke,ht)}),O.appendChild(ht),Ke==="both"||Ke==="start"){var Pe=document.createElement("div");Pe.style.display="flex",Pe.style.alignItems="center",Pe.style.minHeight="20px",Pe.innerHTML=``,Pe.style.marginLeft="5px",ht.appendChild(Pe)}var vt=document.createElement("div");vt.style.display="flex",vt.style.alignItems="center",vt.style.minHeight="20px",vt.style.flexGrow="2";var Nt=document.createElement("hr");if(Nt.style.minWidth="20px",Nt.style.border="0px",Nt.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),Nt.style.flexGrow="2",vt.appendChild(Nt),ht.appendChild(vt),Ke==="both"||Ke==="end"){var Kt=document.createElement("div");Kt.style.display="flex",Kt.style.alignItems="center",Kt.style.minHeight="20px",Kt.innerHTML=``,Kt.style.marginRight="5px",ht.appendChild(Kt)}F.typeBoxes.push(ht)},F=this,he=0;he<4;he++)$(he);return O},s.prototype.setCurrentType=function(c,O){var $=this;this.currentType=c,this.typeBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ge),fe=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new de("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,O){var $=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return c-$/2+","+(O+F/2)+" "+c+","+(O-F/2)+" "+(c+$/2)+","+(O+F/2)},s.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.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",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),O=this.arrow1.transform.baseVal.getItem(0);O.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(O,0);var $=this.arrow2.transform.baseVal.getItem(0);$.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem($,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c);var O=c;this.arrowType=O.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='',s}(nt),ee=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.fillColor=$.defaultFillColor,F.strokeWidth=0,F.fillPanel=new je("Color",$.defaultColorSet,$.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return Te(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=W.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon='',s}(Ze),te=function(W){function s(c,O,$,F){var he=W.call(this,c,F||'')||this;return he.opacities=[],he.opacityBoxes=[],he.opacities=O,he.currentOpacity=$,he.setCurrentOpacity=he.setCurrentOpacity.bind(he),he}return Te(s,W),s.prototype.getUi=function(){var c=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",O.style.justifyContent="space-between",this.opacities.forEach(function($){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=$===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){c.setCurrentOpacity($,F)}),O.appendChild(F);var he=document.createElement("div");he.innerText=100*$+"%",F.appendChild(he),c.opacityBoxes.push(F)}),O},s.prototype.setCurrentOpacity=function(c,O){var $=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===O?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ge),ne=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=$.defaultHighlightColor,F.strokeWidth=0,F.opacity=$.defaultHighlightOpacity,F.fillPanel=new je("Color",$.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new te("Opacity",$.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Te(s,W),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=W.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='',s}(ee),ue='',me=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=$.defaultStrokeColor,F.bgColor=$.defaultFillColor,F.fontFamily=$.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new je("Text color",$.defaultColorSet,F.color,''),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new je("Fill color",$.defaultColorSet,F.bgColor,ue),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new Ae("Font",$.defaultFontFamilies,$.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new $e,F.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return Te(s,W),s.prototype.ownsTarget=function(c){return W.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,O){this.state==="new"&&W.prototype.pointerDown.call(this,c,O),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(O)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):W.prototype.pointerDown.call(this,c,O)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,W.prototype.pointerUp.call(this,c);else{var O=this.state==="creating";W.prototype.pointerUp.call(this,c),this.setTipPoints(O),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var O=this.unrotatePoint(c);this.tipPosition={x:O.x-this.manipulationStartLeft,y:O.y-this.manipulationStartTop},this.positionTip()}else W.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",c]]),oe.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},s.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},s.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var O=Math.min(this.height/2,15),$=this.height/5;c&&(this.tipPosition={x:O+$/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?F',s}(Fe),Ee=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.fillColor=$.defaultFillColor,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.setOpacity=F.setOpacity.bind(F),F.createVisual=F.createVisual.bind(F),F.strokePanel=new je("Line color",pe($.defaultColorSet,["transparent"]),$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.fillPanel=new je("Fill color",pe($.defaultColorSet,["transparent"]),F.fillColor,ue),F.fillPanel.onColorChanged=F.setFillColor,F.strokeWidthPanel=new ct("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new it("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F.opacityPanel=new te("Opacity",$.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=oe.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)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){W.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){W.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){W.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(c){W.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var O=c;this.fillColor=O.fillColor,this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.opacity=O.opacity,this.createVisual(),W.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,O){W.prototype.scale.call(this,c,O),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='',s}(Qe),Me=function(W){function s(c,O,$){return W.call(this,c,O,$)||this}return Te(s,W),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=oe.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(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.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(oe.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.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()]]),oe.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),O=this.tip1.transform.baseVal.getItem(0);O.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(O,0);var $=this.tip2.transform.baseVal.getItem(0);$.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem($,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=W.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='',s}(nt),tt=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.strokePanel.colors=$.defaultColorSet,F.fillColor="transparent",F}return Te(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=W.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='',s}(Ee),mt=function(){function W(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),W.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},W.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},W.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},W.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},W.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},W}(),dt=function(W){function s(c,O,$){var F=W.call(this,c,O,$)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=$.defaultColor,F.strokeWidth=$.defaultStrokeWidth,F.strokeDasharray=$.defaultStrokeDasharray,F.strokePanel=new je("Line color",$.defaultColorSet,$.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ct("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new it("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Te(s,W),s.prototype.ownsTarget=function(c){return!(!W.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.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)},s.prototype.pointerDown=function(c,O){W.prototype.pointerDown.call(this,c,O),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(O)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){W.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,W.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){W.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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()))},s.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),W.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),W.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,O){this.curveX=this.curveX*c,this.curveY=this.curveY*O,W.prototype.scale.call(this,c,O)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},W.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){W.prototype.restoreState.call(this,c);var O=c;this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.curveX=O.curveX,this.curveY=O.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='',s}(lt),Ct=function(){function W(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(W.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),W.prototype.preventDefault=function(){this._defaultPrevented=!0},W}(),St=function(W){function s(c,O,$){var F=W.call(this,c,!1)||this;return F.dataUrl=O,F.state=$,F}return Te(s,W),s}(Ct),st=function(W){function s(c,O,$){$===void 0&&($=!1);var F=W.call(this,c,$)||this;return F.marker=O,F}return Te(s,W),s}(Ct),Ft=function(){function W(){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 W.prototype.addEventListener=function(s,c){this[s].push(c)},W.prototype.removeEventListener=function(s,c){var O=this[s].indexOf(c);O>-1&&this[s].splice(O,1)},W}(),_t=function(){function W(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ce,this._isOpen=!1,this.undoRedoManager=new mt,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 Ft,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=W.instanceCounter++,this.styles=new et(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(W.prototype,"ALL_MARKER_TYPES",{get:function(){return[rt,ge,fe,Fe,tt,Ee,ne,me,Me,ee,nt,dt]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[rt,ge,fe,Fe,Ee,ne,me]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"BASIC_MARKER_TYPES",{get:function(){return[rt,ge,fe,Fe,ne]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(O){if(typeof O=="string"){var $=c.ALL_MARKER_TYPES.find(function(F){return F.typeName===O});$!==void 0&&c._availableMarkerTypes.push($)}else c._availableMarkerTypes.push(O)})},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),W.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),De.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},W.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ze.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ze.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new Ct(s))})},W.prototype.render=function(){return we(this,void 0,void 0,function(){var s;return Se(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new Ve).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},W.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var O=!1;s||this.eventListeners.beforeclose.forEach(function($){var F=new Ct(c,!0);$(F),F.defaultPrevented&&(O=!0)}),O||(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($){return $(new Ct(c))}),this.detachEvents(),this._isOpen=!1)}},W.prototype.addMarkersToToolbar=function(){for(var s,c=[],O=0;Othis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,O=c',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},W.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")},W.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"},W.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},W.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 Ie(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-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},W.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())},W.prototype.toolbarButtonClicked=function(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){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()}},W.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function($){var F=new st(s,s._currentMarker,!0);$(F),F.defaultPrevented&&(c=!0)}),!c){var O=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($){return $(new st(s,O))})}}},W.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(he){var Re=new st(s,void 0,!0);he(Re),Re.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var O=function(he){var Re=$.markers[he];$.setCurrentMarker($.markers[he]),$._currentMarker.dispose(),$.markerImage.removeChild($._currentMarker.container),$.markers.splice($.markers.indexOf($._currentMarker),1),$.eventListeners.markerdelete.forEach(function(Ke){return Ke(new st(s,Re))})},$=this,F=this.markers.length-1;F>=0;F--)O(F);this.addUndoStep()}},Object.defineProperty(W.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),W.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},W.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)},W.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},W.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),O=this.undoRedoManager.getLastUndoStep();if(!O||O.width===c.width&&O.height===c.height){var $=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),$1&&this.panTo({x:s.clientX,y:s.clientY}))},W.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},W.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},W.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},W.prototype.clientToLocalCoordinates=function(s,c){var O=this.markerImage.getBoundingClientRect();return{x:(s-O.left)/this.zoomLevel,y:(c-O.top)/this.zoomLevel}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},W.prototype.addLicenseKey=function(s){De.addKey(s)},W.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},W.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},W.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(W.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),W.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new Ct(s))}))},W.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new Ct(s))}))},W.instanceCounter=0,W}();/* **********************************
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 Zt=function(W,s){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,O){c.__proto__=O}||function(c,O){for(var $ in O)Object.prototype.hasOwnProperty.call(O,$)&&(c[$]=O[$])})(W,s)};function Xt(W,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=W}Zt(W,s),W.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function Ot(W,s,c,O){return new(c||(c=Promise))(function($,F){function he(ht){try{Ke(O.next(ht))}catch(Pe){F(Pe)}}function Re(ht){try{Ke(O.throw(ht))}catch(Pe){F(Pe)}}function Ke(ht){var Pe;ht.done?$(ht.value):(Pe=ht.value,Pe instanceof c?Pe:new c(function(vt){vt(Pe)})).then(he,Re)}Ke((O=O.apply(W,s||[])).next())})}function Ir(W,s){var c,O,$,F,he={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return F={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Re(Ke){return function(ht){return function(Pe){if(c)throw new TypeError("Generator is already executing.");for(;he;)try{if(c=1,O&&($=2&Pe[0]?O.return:Pe[0]?O.throw||(($=O.return)&&$.call(O),0):O.next)&&!($=$.call(O,Pe[1])).done)return $;switch(O=0,$&&(Pe=[2&Pe[0],$.value]),Pe[0]){case 0:case 1:$=Pe;break;case 4:return he.label++,{value:Pe[1],done:!1};case 5:he.label++,O=Pe[1],Pe=[0];continue;case 7:Pe=he.ops.pop(),he.trys.pop();continue;default:if(!($=he.trys,($=$.length>0&&$[$.length-1])||Pe[0]!==6&&Pe[0]!==2)){he=0;continue}if(Pe[0]===3&&(!$||Pe[1]>$[0]&&Pe[1]<$[3])){he.label=Pe[1];break}if(Pe[0]===6&&he.label<$[1]){he.label=$[1],$=Pe;break}if($&&he.label<$[2]){he.label=$[2],he.ops.push(Pe);break}$[2]&&he.ops.pop(),he.trys.pop();continue}Pe=s.call(W,he)}catch(vt){Pe=[6,vt],O=0}finally{c=$=0}if(5&Pe[0])throw Pe[1];return{value:Pe[0]?Pe[1]:void 0,done:!0}}([Ke,ht])}}}var Kr=function(){function W(){}return W.addKey=function(s){W.key=s},Object.defineProperty(W,"isLicensed",{get:function(){return!!W.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(W.key)},enumerable:!1,configurable:!0}),W}(),bt=function(){function W(){}return W.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},W.setAttributes=function(s,c){for(var O=0,$=c;O<$.length;O++){var F=$[O],he=F[0],Re=F[1];s.setAttribute(he,Re)}},W.createRect=function(s,c,O){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",s.toString()),$.setAttribute("height",c.toString()),O&&W.setAttributes($,O),$},W.createLine=function(s,c,O,$,F){var he=document.createElementNS("http://www.w3.org/2000/svg","line");return he.setAttribute("x1",s.toString()),he.setAttribute("y1",c.toString()),he.setAttribute("x2",O.toString()),he.setAttribute("y2",$.toString()),F&&W.setAttributes(he,F),he},W.createPolygon=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg","polygon");return O.setAttribute("points",s),c&&W.setAttributes(O,c),O},W.createCircle=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg","circle");return O.setAttribute("cx",(s/2).toString()),O.setAttribute("cy",(s/2).toString()),O.setAttribute("r",s.toString()),c&&W.setAttributes(O,c),O},W.createEllipse=function(s,c,O){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(s/2).toString()),$.setAttribute("cy",(c/2).toString()),$.setAttribute("rx",(s/2).toString()),$.setAttribute("ry",(c/2).toString()),O&&W.setAttributes($,O),$},W.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&W.setAttributes(c,s),c},W.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},W.createMarker=function(s,c,O,$,F,he,Re){var Ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return W.setAttributes(Ke,[["id",s],["orient",c],["markerWidth",O.toString()],["markerHeight",$.toString()],["refX",F.toString()],["refY",he.toString()]]),Ke.appendChild(Re),Ke},W.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&W.setAttributes(c,s),c},W.createTSpan=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg","tspan");return O.textContent=s,c&&W.setAttributes(O,c),O},W.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&W.setAttributes(c,s),c},W.createPoint=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return O.x=s,O.y=c,O},W.createPath=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg","path");return O.setAttribute("d",s),c&&W.setAttributes(O,c),O},W.createElement=function(s,c){var O=document.createElementNS("http://www.w3.org/2000/svg",s);return c&&W.setAttributes(O,c),O},W.getHollowRectanglePath=function(s,c,O,$,F,he,Re,Ke){return"M"+s+","+c+"V"+(c+$)+"H"+(s+O)+"V"+c+"H"+F+"V"+he+"H"+(F+Re)+"V"+(he+Ke)+"H"+F+"V"+c+"Z"},W}(),Nr=function(){function W(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(W.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(W.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(W.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),W.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},W.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},W.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new hr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new pr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new pr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},W.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},W}(),hr=function(W,s){this.selector=W,this.style=s},pr=function(W,s){this.localName=W,this.style=s},Br=function(){function W(){this.blocks=[],this.display=""}return W.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},W.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},W.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(c){return s.appendChild(c.getUI())}),s},W}(),ci=function(){function W(){}return W.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},W}(),qr=function(W){function s(){var c=W!==null&&W.apply(this,arguments)||this;return c.buttons=[],c}return Xt(s,W),s.prototype.addButton=function(c){c.className=this.buttonClassName,c.colorsClassName=this.buttonColorsClassName,c.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(c)},s.prototype.getUI=function(){var c=W.prototype.getUI.call(this);return this.buttons.forEach(function(O){return c.appendChild(O.getUI())}),c},s}(ci),It=function(){function W(s,c){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=c,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(W.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),W.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},W.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,"")))},W.prototype.hide=function(){this._isHidden=!0},W}(),ut=function(W){function s(){var c=W!==null&&W.apply(this,arguments)||this;return c.elements=[],c}return Xt(s,W),s.prototype.addElement=function(c){this.elements.push(c)},s.prototype.getUI=function(){var c=W.prototype.getUI.call(this);return this.elements.forEach(function(O){return c.appendChild(O)}),c},s}(ci),Hr=function(){function W(s,c){this.horizontal=s,this.vertical=c}return Object.defineProperty(W.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),W.prototype.getVerticalLength=function(s){return s/this.ratio},W.prototype.getHorizontalLength=function(s){return s*this.ratio},W}(),ei=function(){function W(){}return W.getIcon=function(s,c){if(s>0&&c>0){var O=new Hr(s,c),$=O.ratio>=1?20:O.getHorizontalLength(20),F=O.ratio<1?20:O.getVerticalLength(20),he=document.createElementNS("http://www.w3.org/2000/svg","svg");he.setAttribute("xmlns","http://www.w3.org/2000/svg"),he.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(he);var Re=bt.createDefs();he.appendChild(Re);var Ke=bt.createElement("clipPath",[["id","text-bg-clip"]]);Re.appendChild(Ke);var ht=bt.createPath(bt.getHollowRectanglePath((24-$)/2,(24-F)/2,$,F,(24-$)/2+2,(24-F)/2+2,$-4,F-4));he.appendChild(ht);var Pe=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Pe.appendChild(bt.createTSpan(s+":"+c)),he.appendChild(Pe);var vt=Pe.getBBox();bt.setAttributes(Pe,[["x",((24-vt.width)/2).toString()],["y",((24-vt.height)/2-vt.y).toString()]]);var Nt=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(vt.width))/2,(24-Math.ceil(vt.height))/2,Math.ceil(vt.width),Math.ceil(vt.height)));return Ke.appendChild(Nt),bt.setAttributes(ht,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(he),he.outerHTML}return''},W}(),mr=function(W){function s(c,O,$){var F=W.call(this,c,O)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=$,F}return Xt(s,W),s.prototype.setupDropdown=function(){var c=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(O){O.className=c.className,O.colorsClassName=c.colorsClassName,c.dropdownBlock.appendChild(O.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(It),kt=function(){function W(s,c){this.GRIP_SIZE=10,this.color=s,this.fillColor=c,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W.prototype.setCenter=function(s,c){this.visual.childNodes.forEach(function(O){return bt.setAttributes(O,[["cx",s.toString()],["cy",c.toString()]])})},W}(),Fr=function(){function W(s,c,O,$){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=c,this.margin=O,this.container=$,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(W.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),W.prototype.open=function(){var s=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var c=0;cthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-c.height/2),bt.setAttributes(this.cropRectElement,[["x",c.x.toString()],["y",c.y.toString()],["width",c.width.toString()],["height",c.height.toString()]]);var O=c.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,he){var Re=c.y+O*(he+1);bt.setAttributes(F,[["x1",""+c.x],["y1",""+Re],["x2",""+(c.x+c.width)],["y2",""+Re]])});var $=c.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,he){var Re=c.x+$*(he+1);bt.setAttributes(F,[["x1",""+Re],["y1",""+c.y],["x2",""+Re],["y2",""+(c.y+c.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,c.x,c.y,c.width,c.height)]]),this.topLeftGrip.setCenter(c.x,c.y),this.topRightGrip.setCenter(c.x+c.width,c.y),this.bottomLeftGrip.setCenter(c.x,c.y+c.height),this.bottomRightGrip.setCenter(c.x+c.width,c.y+c.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},W.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)},W.prototype.clientToLocalCoordinates=function(s,c){var O=this.container.getBoundingClientRect();return{x:s-O.left+this.margin,y:c-O.top+this.margin}},W.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},W.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var c=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(c)}s.preventDefault()},W.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},W.prototype.move=function(s){var c=s.x-this.previousPoint.x,O=s.y-this.previousPoint.y;this.zoomFactor!==1&&(c=-c/this.zoomFactor,O=-O/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+c),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+O),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},W.prototype.resize=function(s){var c=Object.assign({},this.cropRect),O=s.x-this.previousPoint.x,$=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:c.x+Othis.canvasWidth*this.zoomFactor&&(O=this.canvasWidth*this.zoomFactor-c.width),c.width+=O}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(c.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(O),c.height=this.aspectRatio.getVerticalLength(c.width)):(c.y+=$,c.height=this.cropRect.y+this.cropRect.height-c.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?c.height=this.aspectRatio.getVerticalLength(c.width):c.height+=$}c.width<10&&(c.x=this.cropRect.x,c.width=10),c.height<10&&(c.y=this.cropRect.y,c.height=10),this.previousPoint=s,c.x>=this.margin&&c.y>=this.margin&&c.x-this.margin+c.width<=this.canvasWidth&&c.y-this.margin+c.height<=this.canvasHeight&&(this.cropRect=c,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},W.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,c=this.cropRect.y+this.cropRect.height/2,O=this.aspectRatio.getHorizontalLength(this.cropRect.height),$=this.aspectRatio.getVerticalLength(this.cropRect.width);O/this.canvasWidth<$/this.canvasHeight?this.cropRect.width=O:this.cropRect.height=$,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=s-this.cropRect.width/2,this.cropRect.y=c-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)}},W.prototype.getRescaledRect=function(s,c,O,$,F,he){var Re=O/s,Ke=$/c;return{x:(F.x-he)*Re+he,y:(F.y-he)*Ke+he,width:F.width*Re,height:F.height*Ke}},W.prototype.scaleCanvas=function(s,c){var O=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,c,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=c,this.onCropChange&&this.onCropChange(O),this.setCropRectangle(O)},W}(),Vr=function(){function W(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(W.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),W.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},W.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},W.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},W.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},W.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},W.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},W.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var c="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,O=1;O<=this.width/5+10;O++){var $=O%5==0?this.height/3:this.height/6;c+="h4v"+-$+"h1v"+$}c+="v1H0Z",this.scaleShape=bt.createPath(c);var F=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(F),s.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var he=bt.createTSpan("");return he.innerHTML="°",this.angleLabelElement.appendChild(he),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},W}(),fi=function(){function W(){this.naturalSize=!1,this.imageType="image/png"}return W.prototype.rasterize=function(s,c,O,$,F,he,Re){var Ke=this;return new Promise(function(ht){var Pe=document.createElement("canvas");Pe.width=s.width.baseVal.value-2*$,Pe.height=s.height.baseVal.value-2*$;var vt=1,Nt=1;Ke.naturalSize===!0?(vt=c.naturalWidth/(s.width.baseVal.value-2*$)/he,Nt=c.naturalHeight/(s.height.baseVal.value-2*$)/Re,Pe.width=c.naturalWidth/he,Pe.height=c.naturalHeight/Re):Ke.width!==void 0&&Ke.height!==void 0&&(vt=Ke.width/O.width,Nt=Ke.height/O.height,Pe.width*=vt,Pe.height*=Nt);var Kt=Pe.getContext("2d");Kt.translate(Pe.width/2,Pe.height/2),Kt.rotate(F*Math.PI/180),Kt.scale(he,Re),Kt.translate(-Pe.width/2,-Pe.height/2),Kt.drawImage(c,0,0,Pe.width,Pe.height);var Or=document.createElement("canvas");Or.width=O.width*vt,Or.height=O.height*Nt,Or.getContext("2d").putImageData(Kt.getImageData((O.x-$)*vt,(O.y-$)*Nt,O.width*vt,O.height*Nt),0,0),ht(Or.toDataURL(Ke.imageType,Ke.imageQuality))})},W}(),Ue=function(){function W(s){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=W.instanceCounter++,this.styles=new Nr(this.instanceNo),this.target=s,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(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),W.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},W.prototype.show=function(){this.showUI(),this.open()},W.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(c){return c()}),this._isOpen=!1)},W.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},W.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},W.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},W.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},W.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},W.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,O=c+2*this.CANVAS_MARGINs+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=c+"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},W.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},W.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Br,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 c=new qr;c.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(c);var O=[];this.aspectRatios.forEach(function(Nt){var Kt=new It(ei.getIcon(Nt.horizontal,Nt.vertical),Nt.horizontal===0&&Nt.vertical===0?"FREE":Nt.horizontal+":"+Nt.vertical);Kt.onClick=function(){return s.ratioButtonClicked(Nt)},O.push(Kt)}),this.aspectRatioButton=new mr(ei.getIcon(0,0),"Aspect ratio",O),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,c.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var $=new It('',"Toggle grid");$.isActive=this.isGridVisible,$.onClick=function(){s.isGridVisible=!s.isGridVisible,$.isActive=s.isGridVisible},c.addButton($);var F=new It('',"Zoom to selection");if(F.isActive=this.zoomToCropEnabled,F.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,F.isActive=s.zoomToCropEnabled},c.addButton(F),!Kr.isLicensed){var he=new ut;this.topToolbar.addElementBlock(he);var Re=document.createElement("div");Re.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ke=document.createElement("a");Ke.style.color="currentColor",Ke.href="https://markerjs.com/products/cropro",Ke.target="_blank",Ke.innerHTML='',Re.appendChild(Ke),he.addElement(Re)}var ht=new qr;ht.minWidth=3*this.toolbarHeight+"px",ht.contentAlign="end",this.topToolbar.addButtonBlock(ht);var Pe=new It('',"OK");Pe.onClick=this.startRenderAndClose,ht.addButton(Pe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Pe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var vt=new It('',"Close");vt.onClick=this.close,ht.addButton(vt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(vt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},W.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Br,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 c=new qr;c.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(c);var O=new It('',"Rotate left");O.onClick=this.rotateLeftButtonClicked,c.addButton(O);var $=new It('',"Rotate right");$.onClick=this.rotateRightButtonClicked,c.addButton($);var F=new ut;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new Vr("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(ht){s.rotateBy(ht),s.straightener.angle=s.rotationAngle},F.addElement(this.straightener.getUI());var he=new qr;he.minWidth=2*this.toolbarHeight+"px",he.contentAlign="end",this.bottomToolbar.addButtonBlock(he);var Re=new It('',"Flip horizontal");Re.onClick=this.flipHorizontallyButtonClicked,he.addButton(Re);var Ke=new It('',"Flip vertical");Ke.onClick=this.flipVerticallyButtonClicked,he.addButton(Ke)},W.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},W.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ei.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},W.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Hr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},W.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},W.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},W.prototype.restoreState=function(s){if(s){var c=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(c),this.cropRectChanged(c),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},W.prototype.clientToLocalCoordinates=function(s,c){var O=this.cropImage.getBoundingClientRect();return{x:s-O.left,y:c-O.top}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},W.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},W.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},W.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var c=this.editingTargetRotationContainer.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(c,0);var O=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/O.width,this.imageHeight/O.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},W.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},W.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},W.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},W.prototype.startRenderAndClose=function(){return Ot(this,void 0,void 0,function(){var s,c;return Ir(this,function(O){switch(O.label){case 0:return[4,this.render()];case 1:return s=O.sent(),c=this.getState(),this.renderEventListeners.forEach(function($){return $(s,c)}),this.close(!0),[2]}})})},W.prototype.render=function(){return Ot(this,void 0,void 0,function(){var s;return Ir(this,function(c){switch(c.label){case 0:return(s=new fi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 c.sent(),[4,s.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,c.sent()]}})})},W.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new pr("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 pr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new pr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new pr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new pr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new pr("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 pr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new pr("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 pr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new pr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},W.instanceCounter=0,W}(),Et=se("8hTe"),pi=se.n(Et),mi=/]*>/g;function gi(W){var s=document.createElement("div");return s.innerHTML=W,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var vi=pt.a=function(W){var s=W.value,c=s===void 0?"":s,O=W.edit,$=O===void 0?!1:O,F=W.className,he=W.showTextOnly,Re=W.showLines,Ke=W.replaces,ht=W.zoomImg,Pe=W.hasMask,vt=W.style,Nt=vt===void 0?{}:vt,Kt=W.stylesPrev,Or=Kt===void 0?{}:Kt,gr=String(c),vr=Object(_.useRef)(),Xr=Object(_.useRef)(),Oi=Object(_.useState)(""),nr=Object(H.a)(Oi,2),Ur=nr[0],oi=nr[1],si=Object(_.useState)("office"),_r=Object(H.a)(si,2),_i=_r[0],yi=_r[1],zi=function(){var Bt=new Ue(Xr.current);Bt.displayMode="popup",Bt.addRenderEventListener(function(){var dr=Object(M.a)(P.a.mark(function Dt(qt){var Wt;return P.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return vr.current.style.display="none",ar.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt}});case 3:Wt=ar.sent,Wt!=null&&Wt.id&&Ke(Xr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 5:case"end":return ar.stop()}},Dt)}));return function(Dt){return dr.apply(this,arguments)}}()),Bt.show()},Ki=function(){var Bt=new _t(Xr.current);Bt.settings.displayMode="popup",Bt.addEventListener("render",function(){var dr=Object(M.a)(P.a.mark(function Dt(qt){var Wt;return P.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:if(vr.current.style.display="none",!Xr.current){ar.next=6;break}return ar.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt.dataUrl}});case 4:Wt=ar.sent,Wt!=null&&Wt.id&&Ke(Xr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Wt==null?void 0:Wt.id,"?type=").concat(Wt.content_type));case 6:case"end":return ar.stop()}},Dt)}));return function(Dt){return dr.apply(this,arguments)}}()),Bt.show(),window.markerArea=Bt},Yr=Object(_.useMemo)(function(){vr.current&&(vr.current.style.zIndex=-1);try{var Jt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Bt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,dr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;gr=gr.replace(Jt,"("+ie.a.API_SERVER+"/api/attachments/").replace(Bt,'"'+ie.a.API_SERVER+"/api/attachments/").replace(dr,'"'+ie.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,`
`)}catch(ti){}var Dt=Q(gr),qt=x();if(gr.match(/\[TOC\]/)&&(Dt=Dt.replace("[TOC]
",k()),C()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ti,ar){var Er=qt[ar],Vi=Er.type,Ei=Er.expression;return Object(ce.renderToString)(gi(Ei)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),v(),he){var Wt=document.createElement("div");return Wt.innerHTML=Dt,Wt.innerText}return setTimeout(function(){return dn()},500),Dt},[gr]),Gr=Object(_.useRef)();g.WebkitLineClamp=Re,Re&&(Nt=Object(N.a)(Object(N.a)({},Nt),g));function bi(Jt){var Bt=Jt.target;if(Bt.tagName.toUpperCase()==="IMG"){if(ht){var dr=Bt.getAttribute("src");oi(dr),yi("image")}}else if(Bt.tagName.toUpperCase()==="A"){var Dt=Bt.getAttribute("href");if(Dt.indexOf("office")>-1)Jt.preventDefault(),oi(Dt),yi("office");else if(Dt.indexOf("application/pdf")>-1)Jt.preventDefault(),oi(Dt),yi("pdf");else if(Dt.indexOf("text/html")>-1)Jt.preventDefault(),oi(Dt),yi("html");else if(Dt.startsWith("#")){Jt.preventDefault();var qt=document.getElementById(Dt.replace("#",""));qt&&qt.scrollIntoView(!0)}}}var dn=function(){var Bt,dr=(Bt=Gr.current)===null||Bt===void 0?void 0:Bt.querySelectorAll("video");dr==null||dr.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var qt=new q.a;qt.loadSource(Dt.src),qt.attachMedia(Dt)}}})};Object(_.useEffect)(function(){if(Gr.current&&Yr&&(Yr.match(mi)&&window.PR.prettyPrint()),Gr.current)return Gr.current.addEventListener("click",bi),function(){Gr.current.removeEventListener("click",bi),v(),C()}},[Yr,Gr.current,bi]);var xi=function(Bt){if(!$)return;Bt.target.nodeName==="IMG"?(vr.current.style.zIndex=1,vr.current.style.display="flex",vr.current.style.width=Bt.target.clientWidth+"px",vr.current.style.height=Bt.target.clientHeight+"px",vr.current.style.top=Bt.target.offsetTop+"px",vr.current.style.left=Bt.target.offsetLeft+"px",Xr.current.src=Bt.target.getAttribute("src")):vr.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Gr,style:Object(N.a)({},Nt),className:"".concat(F||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:xi,dangerouslySetInnerHTML:{__html:Yr}}),y.a.createElement("div",{ref:vr,className:pi.a.button},y.a.createElement(Z.a,null,y.a.createElement(Y.a,{onClick:function(){return zi()}},"\u88C1\u526A"),y.a.createElement(Y.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ve.a,{close:!0,data:Ur,type:Ur!=null&&Ur.length?_i:"",style:Object(N.a)({},Or),onClose:function(){return oi("")}}))}},"9VGf":function(wt,pt,se){"use strict";se.d(pt,"a",function(){return D});var re=se("q1tI"),Z=se.n(re);function D(Y,N){var M=Object(re.useRef)();Object(re.useEffect)(function(){M.current=Y}),Object(re.useEffect)(function(){function H(){M.current()}if(N!==null){var U=setInterval(H,N);return function(){return clearInterval(U)}}},[N])}},Bd2K:function(wt,pt,se){(function(re){re(se("VrN/"),se("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(P,_,y){if(y!=re.Init&&y&&P.removeKeyMap("autoCloseTags"),!_)return;var A={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(A["'/'"]=function(R){return M(R)}),(typeof _!="object"||_.whenOpening!==!1)&&(A["'>'"]=function(R){return Y(R)}),P.addKeyMap(A)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 Y(P){if(P.getOption("disableInput"))return re.Pass;for(var _=P.listSelections(),y=[],A=P.getOption("autoCloseTags"),R=0;R<_.length;R++){if(!_[R].empty())return re.Pass;var L=_[R].head,w=P.getTokenAt(L),b=re.innerMode(P.getMode(),w.state),u=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(u),l=o&&o.name;if(!l)return re.Pass;var h=b.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||h&&Z,g=typeof A=="object"&&A.indentTags||h&&D;w.end>L.ch&&(l=l.slice(0,l.length-w.end+L.ch));var p=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=L.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==L.ch-w.start-1||C&&H(C,p)>-1||U(P,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(u)||[],l,L,!0))return re.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&H(k,l)>-1){y[R]={text:"/>",newPos:re.Pos(L.line,L.ch+2)};continue}var E=g&&H(g,p)>-1;y[R]={indent:E,text:">"+(E?`
`:"")+""+l+">",newPos:E?re.Pos(L.line+1,0):re.Pos(L.line,L.ch+1)}}for(var f=typeof A=="object"&&A.dontIndentOnAutoClose,R=_.length-1;R>=0;R--){var m=y[R];P.replaceRange(m.text,_[R].head,_[R].anchor,"+insert");var d=P.listSelections().slice(0);d[R]={head:m.newPos,anchor:m.newPos},P.setSelections(d),!f&&m.indent&&(P.indentLine(m.newPos.line,null,!0),P.indentLine(m.newPos.line+1,null,!0))}}function N(P,_){for(var y=P.listSelections(),A=[],R=_?"/":"",L=P.getOption("autoCloseTags"),w=typeof L=="object"&&L.dontIndentOnSlash,b=0;b"&&(C+=">"),A[b]=C}if(P.replaceSelections(A),y=P.listSelections(),!w)for(var b=0;b=0&&_[u]==y;u--)++b;A=w.to;for(var u=1;u0){for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:"",_=[],y=0;yge.length)&&(de=ge.length);for(var fe=0,ee=new Array(de);fe=ge.length?{done:!0}:{done:!1,value:ge[ee++]}}}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 fe=ge[Symbol.iterator](),fe.next.bind(fe)}function M(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var H=M(function(ge){function de(){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 fe(ee){ge.exports.defaults=ee}ge.exports={defaults:de(),getDefaults:de,changeDefaults:fe}}),U=H.defaults,P=H.getDefaults,_=H.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(de){return w[de]};function u(ge,de){if(de){if(y.test(ge))return ge.replace(A,b)}else if(R.test(ge))return ge.replace(L,b);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ge){return ge.replace(o,function(de,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var h=/(^|[^\[])\^/g;function C(ge,de){ge=ge.source||ge,de=de||"";var fe={replace:function(te,ne){return ne=ne.source||ne,ne=ne.replace(h,"$1"),ge=ge.replace(te,ne),fe},getRegex:function(){return new RegExp(ge,de)}};return fe}var g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(ge,de,fe){if(ge){var ee;try{ee=decodeURIComponent(l(fe)).replace(g,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}de&&!p.test(fe)&&(fe=a(de,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(te){return null}return fe}var E={},f=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){E[" "+ge]||(f.test(ge)?E[" "+ge]=ge+"/":E[" "+ge]=I(ge,"/",!0)),ge=E[" "+ge];var fe=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?fe?de:ge.replace(m,"$1")+de:de.charAt(0)==="/"?fe?de:ge.replace(d,"$1")+de:ge+de}var x={exec:function(){}};function v(ge){for(var de=1,fe,ee;de=0&&me[Me]==="\\";)Ee=!Ee;return Ee?"|":" |"}),ee=fe.split(/ \|/),te=0;if(ee.length>de)ee.splice(de);else for(;ee.length=ee.length?te.slice(ee.length):te}).join(`
`)}var xe=function(){function ge(fe){this.options=fe||z}var de=ge.prototype;return de.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
`}},de.code=function(ee,te){var ne=this.rules.block.code.exec(ee);if(ne){var ue=te[te.length-1];if(ue&&ue.type==="paragraph")return{raw:ne[0],text:ne[0].trimRight()};var me=ne[0].replace(/^ {4}/gm,"");return{type:"code",raw:ne[0],codeBlockStyle:"indented",text:this.options.pedantic?me:j(me,`
`)}}},de.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var ne=te[0],ue=Oe(ne,te[3]||"");return{type:"code",raw:ne,lang:te[2]?te[2].trim():te[2],text:ue}}},de.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},de.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var ne={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[],raw:te[0]};if(ne.header.length===ne.align.length){var ue=ne.align.length,me;for(me=0;me ?/gm,"");return{type:"blockquote",raw:te[0],text:ne}}},de.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){for(var ne=te[0],ue=te[2],me=ue.length>1,Ee=ue[ue.length-1]===")",Me={type:"list",raw:ne,ordered:me,start:me?+ue.slice(0,-1):"",loose:!1,items:[]},tt=te[0].match(this.rules.block.item),mt=!1,dt,Ct,St,st,Ft,_t,Zt,Xt=tt.length,Ot=0;Ot1||this.options.smartLists&&St!==ue)&&(st=tt.slice(Ot+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-st.length),Ot=Xt-1)),Ft=mt||/\n\n(?!\s*$)/.test(dt),Ot!==Xt-1&&(mt=dt.charAt(dt.length-1)===`
`,Ft||(Ft=mt)),Ft&&(Me.loose=!0),_t=/^\[[ xX]\] /.test(dt),Zt=void 0,_t&&(Zt=dt[1]!==" ",dt=dt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:ne,task:_t,checked:Zt,loose:Ft,text:dt});return Me}},de.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):ie(te[0]):te[0]}},de.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ne=te[1].toLowerCase().replace(/\s+/g," ");return{tag:ne,raw:te[0],href:te[2],title:te[3]}}},de.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var ne={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[]};if(ne.header.length===ne.align.length){ne.raw=te[0];var ue=ne.align.length,me;for(me=0;me/i.test(ue[0])&&(te=!1),!ne&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?ne=!0:ne&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(ne=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:te,inRawBlock:ne,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ie(ue[0]):ue[0]}},de.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var ne=ce(te[2],"()");if(ne>-1){var ue=te[0].indexOf("!")===0?5:4,me=ue+te[1].length+ne;te[2]=te[2].substring(0,ne),te[0]=te[0].substring(0,me).trim(),te[3]=""}var Ee=te[2],Me="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);tt?(Ee=tt[1],Me=tt[3]):Me=""}else Me=te[3]?te[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var mt=ve(te,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},te[0]);return mt}},de.reflink=function(ee,te){var ne;if((ne=this.rules.inline.reflink.exec(ee))||(ne=this.rules.inline.nolink.exec(ee))){var ue=(ne[2]||ne[1]).replace(/\s+/g," ");if(ue=te[ue.toLowerCase()],!ue||!ue.href){var me=ne[0].charAt(0);return{type:"text",raw:me,text:me}}var Ee=ve(ne,ue,ne[0]);return Ee}},de.strong=function(ee,te,ne){ne===void 0&&(ne="");var ue=this.rules.inline.strong.start.exec(ee);if(ue&&(!ue[1]||ue[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){te=te.slice(-1*ee.length);var me=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var Ee;(ue=me.exec(te))!=null;)if(Ee=this.rules.inline.strong.middle.exec(te.slice(0,ue.index+3)),Ee)return{type:"strong",raw:ee.slice(0,Ee[0].length),text:ee.slice(2,Ee[0].length-2)}}},de.em=function(ee,te,ne){ne===void 0&&(ne="");var ue=this.rules.inline.em.start.exec(ee);if(ue&&(!ue[1]||ue[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){te=te.slice(-1*ee.length);var me=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var Ee;(ue=me.exec(te))!=null;)if(Ee=this.rules.inline.em.middle.exec(te.slice(0,ue.index+2)),Ee)return{type:"em",raw:ee.slice(0,Ee[0].length),text:ee.slice(1,Ee[0].length-1)}}},de.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var ne=te[2].replace(/\n/g," "),ue=/[^ ]/.test(ne),me=ne.startsWith(" ")&&ne.endsWith(" ");return ue&&me&&(ne=ne.substring(1,ne.length-1)),ne=ie(ne,!0),{type:"codespan",raw:te[0],text:ne}}},de.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},de.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[1]}},de.autolink=function(ee,te){var ne=this.rules.inline.autolink.exec(ee);if(ne){var ue,me;return ne[2]==="@"?(ue=ie(this.options.mangle?te(ne[1]):ne[1]),me="mailto:"+ue):(ue=ie(ne[1]),me=ue),{type:"link",raw:ne[0],text:ue,href:me,tokens:[{type:"text",raw:ue,text:ue}]}}},de.url=function(ee,te){var ne;if(ne=this.rules.inline.url.exec(ee)){var ue,me;if(ne[2]==="@")ue=ie(this.options.mangle?te(ne[0]):ne[0]),me="mailto:"+ue;else{var Ee;do Ee=ne[0],ne[0]=this.rules.inline._backpedal.exec(ne[0])[0];while(Ee!==ne[0]);ue=ie(ne[0]),ne[1]==="www."?me="http://"+ue:me=ue}return{type:"link",raw:ne[0],text:ue,href:me,tokens:[{type:"text",raw:ue,text:ue}]}}},de.inlineText=function(ee,te,ne){var ue=this.rules.inline.text.exec(ee);if(ue){var me;return te?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):ie(ue[0]):ue[0]:me=ie(this.options.smartypants?ne(ue[0]):ue[0]),{type:"text",raw:ue[0],text:me}}},ge}(),Te=Q.noopTest,we=Q.edit,Se=Q.merge,pe={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*|\\n*|\\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:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=we(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=we(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=we(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=//,pe.html=we(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=we(pe._paragraph).replace("hr",pe.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",pe._tag).getRegex(),pe.blockquote=we(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=Se({},pe),pe.gfm=Se({},pe.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*|$)"}),pe.gfm.nptable=we(pe.gfm.nptable).replace("hr",pe.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",pe._tag).getRegex(),pe.gfm.table=we(pe.gfm.table).replace("hr",pe.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",pe._tag).getRegex(),pe.pedantic=Se({},pe.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._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:Te,paragraph:we(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",oe.punctuation=we(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=we(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=we(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=we(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=we(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=we(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=we(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=we(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=we(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=we(oe._blockSkip,"g").getRegex(),oe.overlapSkip=we(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=we(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=we(oe.tag).replace("comment",pe._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=we(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=we(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=we(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=Se({},oe),oe.pedantic=Se({},oe.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:we(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=Se({},oe.normal,{escape:we(oe.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]*?(?:(?=[\\.5&&(ee="x"+ee.toString(16)),de+=""+ee+";";return de}var Ie=function(){function ge(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||Ve,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:ze.normal,inline:et.normal};this.options.pedantic?(ee.block=ze.pedantic,ee.inline=et.pedantic):this.options.gfm&&(ee.block=ze.gfm,this.options.breaks?ee.inline=et.breaks:ee.inline=et.gfm),this.tokenizer.rules=ee}ge.lex=function(ee,te){var ne=new ge(te);return ne.lex(ee)};var de=ge.prototype;return de.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(ee,te,ne){te===void 0&&(te=[]),ne===void 0&&(ne=!0),ee=ee.replace(/^ +$/gm,"");for(var ue,me,Ee,Me;ee;){if(ue=this.tokenizer.space(ee)){ee=ee.substring(ue.raw.length),ue.type&&te.push(ue);continue}if(ue=this.tokenizer.code(ee,te)){ee=ee.substring(ue.raw.length),ue.type?te.push(ue):(Me=te[te.length-1],Me.raw+=`
`+ue.raw,Me.text+=`
`+ue.text);continue}if(ue=this.tokenizer.fences(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.heading(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.nptable(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.hr(ee)){ee=ee.substring(ue.raw.length),te.push(ue);continue}if(ue=this.tokenizer.blockquote(ee)){ee=ee.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],ne),te.push(ue);continue}if(ue=this.tokenizer.list(ee)){for(ee=ee.substring(ue.raw.length),Ee=ue.items.length,me=0;me0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)mt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ee;){if(Ee=this.tokenizer.escape(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.tag(ee,ne,ue)){ee=ee.substring(Ee.raw.length),ne=Ee.inLink,ue=Ee.inRawBlock,te.push(Ee);continue}if(Ee=this.tokenizer.link(ee)){ee=ee.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ue)),te.push(Ee);continue}if(Ee=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ue)),te.push(Ee);continue}if(Ee=this.tokenizer.strong(ee,Me,me)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ne,ue),te.push(Ee);continue}if(Ee=this.tokenizer.em(ee,Me,me)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ne,ue),te.push(Ee);continue}if(Ee=this.tokenizer.codespan(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.br(ee)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.del(ee)){ee=ee.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ne,ue),te.push(Ee);continue}if(Ee=this.tokenizer.autolink(ee,ke)){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(!ne&&(Ee=this.tokenizer.url(ee,ke))){ee=ee.substring(Ee.raw.length),te.push(Ee);continue}if(Ee=this.tokenizer.inlineText(ee,ue,Je)){ee=ee.substring(Ee.raw.length),me=Ee.raw.slice(-1),te.push(Ee);continue}if(ee){var dt="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(dt);break}else throw new Error(dt)}}return te},Z(ge,null,[{key:"rules",get:function(){return{block:ze,inline:et}}}]),ge}(),He=H.defaults,Ge=Q.cleanUrl,je=Q.escape,_e=function(){function ge(fe){this.options=fe||He}var de=ge.prototype;return de.code=function(ee,te,ne){var ue=(te||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight(ee,ue);me!=null&&me!==ee&&(ne=!0,ee=me)}return ue?''+(ne?ee:je(ee,!0))+`
`:""+(ne?ee:je(ee,!0))+`
`},de.blockquote=function(ee){return`
`+ee+`
`},de.html=function(ee){return ee},de.heading=function(ee,te,ne,ue){return this.options.headerIds?"
`:""+ee+"
`},de.hr=function(){return this.options.xhtml?`
`:`
`},de.list=function(ee,te,ne){var ue=te?"ol":"ul",me=te&&ne!==1?' start="'+ne+'"':"";return"<"+ue+me+`>
`+ee+""+ue+`>
`},de.listitem=function(ee){return""+ee+`
`},de.checkbox=function(ee){return" "},de.paragraph=function(ee){return""+ee+`
`},de.table=function(ee,te){return te&&(te=""+te+""),`
`},de.tablerow=function(ee){return`
`+ee+`
`},de.tablecell=function(ee,te){var ne=te.header?"th":"td",ue=te.align?"<"+ne+' align="'+te.align+'">':"<"+ne+">";return ue+ee+""+ne+`>
`},de.strong=function(ee){return""+ee+""},de.em=function(ee){return""+ee+""},de.codespan=function(ee){return""+ee+""},de.br=function(){return this.options.xhtml?"
":"
"},de.del=function(ee){return""+ee+""},de.link=function(ee,te,ne){if(ee=Ge(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ne;var ue='"+ne+"",ue},de.image=function(ee,te,ne){if(ee=Ge(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ne;var ue='
":">",ue},de.text=function(ee){return ee},ge}(),Be=function(){function ge(){}var de=ge.prototype;return de.strong=function(ee){return ee},de.em=function(ee){return ee},de.codespan=function(ee){return ee},de.del=function(ee){return ee},de.html=function(ee){return ee},de.text=function(ee){return ee},de.link=function(ee,te,ne){return""+ne},de.image=function(ee,te,ne){return""+ne},de.br=function(){return""},ge}(),$e=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(ee){var te=ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(te)){var ne=te;do this.seen[ne]++,te=ne+"-"+this.seen[ne];while(this.seen.hasOwnProperty(te))}return this.seen[te]=0,te},ge}(),qe=H.defaults,Qe=Q.unescape,Ze=function(){function ge(fe){this.options=fe||qe,this.options.renderer=this.options.renderer||new _e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new $e}ge.parse=function(ee,te){var ne=new ge(te);return ne.parse(ee)};var de=ge.prototype;return de.parse=function(ee,te){te===void 0&&(te=!0);var ne="",ue,me,Ee,Me,tt,mt,dt,Ct,St,st,Ft,_t,Zt,Xt,Ot,Ir,Kr,bt,Nr=ee.length;for(ue=0;ue0&&Ot.tokens[0].type==="text"?(Ot.tokens[0].text=bt+" "+Ot.tokens[0].text,Ot.tokens[0].tokens&&Ot.tokens[0].tokens.length>0&&Ot.tokens[0].tokens[0].type==="text"&&(Ot.tokens[0].tokens[0].text=bt+" "+Ot.tokens[0].tokens[0].text)):Ot.tokens.unshift({type:"text",text:bt}):Xt+=bt),Xt+=this.parse(Ot.tokens,Zt),St+=this.renderer.listitem(Xt,Kr,Ir);ne+=this.renderer.list(St,Ft,_t);continue}case"html":{ne+=this.renderer.html(st.text);continue}case"paragraph":{ne+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(St=st.tokens?this.parseInline(st.tokens):st.text;ue+1An error occurred:
"+rt(Ee.message+"",!0)+"
";throw Ee}}Ae.options=Ae.setOptions=function(ge){return ct(Ae.defaults,ge),lt(Ae.defaults),Ae},Ae.getDefaults=Ce,Ae.defaults=nt,Ae.use=function(ge){var de=ct({},ge);if(ge.renderer&&function(){var ee=Ae.defaults.renderer||new _e,te=function(me){var Ee=ee[me];ee[me]=function(){for(var Me=arguments.length,tt=new Array(Me),mt=0;mt`,triples:"",explode:"[]{}"},D=re.Pos;re.defineOption("autoCloseBrackets",!1,function(w,b,u){u&&u!=re.Init&&(w.removeKeyMap(N),w.state.closeBrackets=null),b&&(M(Y(b,"pairs")),w.state.closeBrackets=b,w.addKeyMap(N))});function Y(w,b){return b=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[b]!=null?w[b]:Z[b]}var N={Backspace:P,Enter:_};function M(w){for(var b=0;b=0;l--){var C=o[l].head;w.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function _(w){var b=U(w),u=b&&Y(b,"explode");if(!u||w.getOption("disableInput"))return re.Pass;for(var o=w.listSelections(),l=0;l0;return{anchor:new D(w.anchor.line,w.anchor.ch+(b?-1:1)),head:new D(w.head.line,w.head.ch+(b?1:-1))}}function A(w,b){var u=U(w);if(!u||w.getOption("disableInput"))return re.Pass;var o=Y(u,"pairs"),l=o.indexOf(b);if(l==-1)return re.Pass;for(var h=Y(u,"closeBefore"),C=Y(u,"triples"),g=o.charAt(l+1)==b,p=w.listSelections(),k=l%2==0,E,f=0;f=0&&w.getRange(d,D(d.line,d.ch+3))==b+b+b?a="skipThree":a="skip";else if(g&&d.ch>1&&C.indexOf(b)>=0&&w.getRange(D(d.line,d.ch-2),d)==b+b){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(D(d.line,d.ch-2))))return re.Pass;a="addFour"}else if(g){var v=d.ch==0?" ":w.getRange(D(d.line,d.ch-1),d);if(!re.isWordChar(x)&&v!=b&&!re.isWordChar(v))a="both";else return re.Pass}else if(k&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))a="both";else return re.Pass;if(!E)E=a;else if(E!=a)return re.Pass}var T=l%2?o.charAt(l-1):b,I=l%2?b:o.charAt(l+1);w.operation(function(){if(E=="skip")w.execCommand("goCharRight");else if(E=="skipThree")for(var G=0;G<3;G++)w.execCommand("goCharRight");else if(E=="surround"){for(var V=w.getSelections(),G=0;G1&&arguments[1]!==void 0?arguments[1]:1,fe=Be.length,ee=0;ee1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(j).map(function(ie,ce){if(!N.isValidElement(ie)||!ie.type)return null;var ve=ie.type.isSelectOptGroup,Oe=ie.key,xe=ie.props,Te=xe.children,we=Object(H.a)(xe,["children"]);return q||!ve?E(ie):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?ce:Oe,"__"),label:Oe},we),{},{options:f(Te)})}).filter(function(ie){return ie})}var m=se("2Qr1"),d=se("qNPg"),a=se("U8pU"),x=se("Kwbf"),v=se("WKfj");function T(j){var q=j.mode,ie=j.options,ce=j.children,ve=j.backfill,Oe=j.allowClear,xe=j.placeholder,Te=j.getInputElement,we=j.showSearch,Se=j.onSearch,pe=j.defaultOpen,oe=j.autoFocus,De=j.labelInValue,Ve=j.value,ze=j.inputValue,et=j.optionLabelProp,Je=q==="multiple"||q==="tags",ke=we!==void 0?we:Je||q==="combobox",Ie=ie||f(ce);if(Object(x.a)(q!=="tags"||Ie.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),q==="tags"||q==="combobox"){var He=Ie.some(function(_e){return _e.options?_e.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in _e?_e.value:_e.key)=="number"});Object(x.a)(!He,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(q!=="combobox"||!et,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(q==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(x.a)(q==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(x.b)(q!=="combobox"||!Te||!Oe||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!ke&&q!=="combobox"&&q!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!pe||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ve!=null){var Ge=Object(v.d)(Ve);Object(x.a)(!De||Ge.every(function(_e){return Object(a.a)(_e)==="object"&&("key"in _e||"value"in _e)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Je||Array.isArray(Ve),"`value` should be array when `mode` is `multiple` or `tags`")}if(ce){var je=null;Object(k.a)(ce).some(function(_e){if(!N.isValidElement(_e)||!_e.type)return!1;var Be=_e.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var $e=Object(k.a)(_e.props.children).every(function(qe){return!N.isValidElement(qe)||!_e.type||qe.type.isSelectOption?!0:(je=qe.type,!1)});return!$e}return je=Be,!0}),je&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(x.a)(ze===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=T,G=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:m.d,getLabeledValue:m.e,filterOptions:m.b,isValueDisabled:m.g,findValueOption:m.c,warningProps:I,fillOptionsWithMissingValue:m.a}),V=function(j){Object(D.a)(ie,j);var q=Object(Y.a)(ie);function ie(){var ce;return Object(re.a)(this,ie),ce=q.apply(this,arguments),ce.selectRef=N.createRef(),ce.focus=function(){ce.selectRef.current.focus()},ce.blur=function(){ce.selectRef.current.blur()},ce}return Object(Z.a)(ie,[{key:"render",value:function(){return N.createElement(G,Object.assign({ref:this.selectRef},this.props))}}]),ie}(N.Component);V.Option=h,V.OptGroup=g;var Q=V,z=pt.c=Q},M8RZ:function(wt,pt,se){"use strict";se.d(pt,"a",function(){return P});var re=se("fWQN"),Z=se("mtLc"),D=se("yKVA"),Y=se("879j"),N=se("q1tI"),M=se.n(N),H=se("i8i4"),U=se.n(H),P=function(_){Object(D.a)(A,_);var y=Object(Y.a)(A);function A(R){var L;Object(re.a)(this,A),L=y.call(this,R);var w=window.document;return L.node=w.createElement("div"),w.body.appendChild(L.node),L}return Object(Z.a)(A,[{key:"render",value:function(){var L=this.props.children;return Object(H.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(M.a.Component)},OLES:function(wt,pt,se){"use strict";var re=se("U8pU"),Z=se("VTBJ"),D=se("Ff2n"),Y=se("q1tI"),N=se("uciX"),M=se("7ixt"),H=function(R){var L=R.overlay,w=R.prefixCls,b=R.id,u=R.overlayInnerStyle;return Y.createElement("div",{className:"".concat(w,"-inner"),id:b,role:"tooltip",style:u},typeof L=="function"?L():L)},U=H,P=function(R,L){var w=R.overlayClassName,b=R.trigger,u=b===void 0?["hover"]:b,o=R.mouseEnterDelay,l=o===void 0?0:o,h=R.mouseLeaveDelay,C=h===void 0?.1:h,g=R.overlayStyle,p=R.prefixCls,k=p===void 0?"rc-tooltip":p,E=R.children,f=R.onVisibleChange,m=R.afterVisibleChange,d=R.transitionName,a=R.animation,x=R.placement,v=x===void 0?"right":x,T=R.align,I=T===void 0?{}:T,G=R.destroyTooltipOnHide,V=G===void 0?!1:G,Q=R.defaultVisible,z=R.getTooltipContainer,j=R.overlayInnerStyle,q=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ie=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(L,function(){return ie.current});var ce=Object(Z.a)({},q);"visible"in R&&(ce.popupVisible=R.visible);var ve=function(){var Se=R.arrowContent,pe=Se===void 0?null:Se,oe=R.overlay,De=R.id;return[Y.createElement("div",{className:"".concat(k,"-arrow"),key:"arrow"},pe),Y.createElement(U,{key:"content",prefixCls:k,id:De,overlay:oe,overlayInnerStyle:j})]},Oe=!1,xe=!1;if(typeof V=="boolean")Oe=V;else if(V&&Object(re.a)(V)==="object"){var Te=V.keepParent;Oe=Te===!0,xe=Te===!1}return Y.createElement(N.a,Object.assign({popupClassName:w,prefixCls:k,popup:ve,action:u,builtinPlacements:M.a,popupPlacement:v,ref:ie,popupAlign:I,getPopupContainer:z,onPopupVisibleChange:f,afterPopupVisibleChange:m,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:Q,destroyPopupOnHide:Oe,autoDestroy:xe,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:l},ce),E)},_=Object(Y.forwardRef)(P),y=pt.a=_},Ot1p:function(wt,pt,se){"use strict";var re=se("2qtc"),Z=se("kLXV"),D=se("rAM+"),Y=se("miYZ"),N=se("tsqr"),M=se("9og8"),H=se("tJVT"),U=se("jrin"),P=se("WmNS"),_=se.n(P),y=se("q1tI"),A=se.n(y),R=se("VrN/"),L=se.n(R),w=se("bdgK"),b=se("p77/"),u=se("Bd2K"),o=se("ELLl"),l=se("19Vz"),h=se("lZu9"),C=se("+NIl"),g=se("kSUc"),p=se("9Bee"),k=function(me){var Ee=me.value,Me=Ee===void 0?"":Ee,tt=me.className,mt=me.showTextOnly,dt=me.showLines,Ct=me.style,St=Ct===void 0?{}:Ct,st=Object(y.useMemo)(function(){return""},[Me]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},E=se("0Owb"),f=se("dejd"),m=se("C+DQ"),d=se("1vsH"),a=se("m3rI"),x=[{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 v(me){var Ee=me.onActionCallback,Me=me.title,tt=me.icon,mt=me.actionName,dt=me.className,Ct=dt===void 0?"":dt,St=me.children;function st(){Ee(mt)}return A.a.createElement("a",{title:Me,className:Ct,onClick:st},A.a.createElement("i",{className:"md-iconfont ".concat(tt)}),St)}var T=function(me){var Ee=me.watch,Me=me.showNullButton,tt=me.onActionCallback,mt=me.fullScreen,dt=me.insertTemp,Ct=me.hidetoolBar,St=me.uuid,st=me.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.F)("_educoder_session"),"&key=").concat(St,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ft=[].concat(x,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ft.map(function(_t,Zt){return A.a.createElement("li",{key:Zt},_t.actionName?A.a.createElement(v,Object(E.a)({},_t,{onActionCallback:tt})):A.a.createElement("span",{className:"v-line"}))}),Me?A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:tt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,dt&&A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(dt),onActionCallback:tt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(v,{icon:"".concat(mt?"icon-shrink":"icon-enlarge"),title:mt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:tt})))},I=se("M8RZ"),G=se("+L6B"),V=se("2/Rp"),Q=se("y8nQ"),z=se("Vl3Y"),j=se("5NDa"),q=se("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},ce=function(me){var Ee=me.callback,Me=me.onCancel;function tt(mt){Ee(mt)}return A.a.createElement(z.a,Object(E.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:tt}),A.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(q.a,null)),A.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(q.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ve=se("7ahc"),Oe=se("HmJG"),xe=se("BjJ7"),Te=z.a.useForm,we={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},pe=function(me){var Ee=me.callback,Me=me.onCancel,tt=Te(),mt=Object(H.a)(tt,1),dt=mt[0];function Ct(Ft){Ee(Ft)}function St(Ft,_t){if(Ft.status===-1){N.b.error(Ft.message);return}dt.setFieldsValue({src:"/api/attachments/".concat(Ft.id),type:_t.type})}function st(Ft){var _t=Ft.target.files[0];De(_t,St)}return A.a.createElement(z.a,Object(E.a)({form:dt},Se,{className:"upload-image-panel",onFinish:Ct}),A.a.createElement(z.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(q.a,{style:we})),A.a.createElement(oe,{onFileChange:st}))),A.a.createElement(z.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(q.a,{style:{width:264}})),A.a.createElement(z.a.Item,{style:{textAlign:"right"}},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function oe(me){var Ee=me.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ee}))}function De(me,Ee){if(!me)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",me),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var tt=new window.XMLHttpRequest;tt.withCredentials=!0,tt.addEventListener("load",function(mt){Ee(JSON.parse(mt.target.responseText),me)},!1),tt.addEventListener("error",function(mt){console.error(mt)},!1),tt.open("POST","".concat(xe.a,"/api/attachments.json")),tt.send(Me)}var Ve=se("giR+"),ze=se("fyUT"),et=se("7Kak"),Je=se("9yH6"),ke=Je.a.Group,Ie={margin:"0 8px"},He=function(me){var Ee=me.callback,Me=me.onCancel;function tt(mt){Ee(mt)}return A.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:tt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Ie},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Ie},"\u884C\u6570"),A.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ze.a,null)),A.a.createElement("span",{style:Ie},"\u5217\u6570"),A.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ze.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Ie},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(z.a.Item,{name:"align"},A.a.createElement(ke,null,A.a.createElement(Je.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Je.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Je.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Je.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(V.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},Ge=se("ErOA"),je=se("7Cbv"),_e="link",Be="upload-image",$e="code-block",qe="add-table",Qe="------------",Ze={default:Qe,left:":".concat(Qe),center:":".concat(Qe,":"),right:"".concat(Qe,":")},ct=se("9VGf"),it,rt;function Ce(){}var lt=0,nt=1e4,Ae="\u2581",Fe=`
**\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 ge(me){return/^\d+$/.test(me)?"".concat(me,"px"):me}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=de?"Cmd":"Ctrl",ee=["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"],te=(it={},Object(U.a)(it,fe+"-B","bold"),Object(U.a)(it,fe+"-I","italic"),it),ne=(rt={},Object(U.a)(rt,_e,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(rt,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(rt,Be,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(rt,qe,"\u6DFB\u52A0\u8868\u683C"),rt),ue=pt.a=function(me){var Ee=me.defaultValue,Me=Ee===void 0?"":Ee,tt=me.onChange,mt=me.width,dt=mt===void 0?"100%":mt,Ct=me.height,St=Ct===void 0?400:Ct,st=me.miniToolbar,Ft=st===void 0?!1:st,_t=me.isFocus,Zt=_t===void 0?!1:_t,Xt=me.watch,Ot=me.insertTemp,Ir=me.mode,Kr=Ir===void 0?"markdown":Ir,bt=me.id,Nr=bt===void 0?"markdown-editor-id":bt,hr=me.showResizeBar,pr=hr===void 0?!1:hr,Br=me.noStorage,ci=Br===void 0?!1:Br,qr=me.showNullButton,It=qr===void 0?!1:qr,ut=me.hidetoolBar,Hr=ut===void 0?!1:ut,ei=me.fullScreen,mr=ei===void 0?!1:ei,kt=me.onBlur,Fr=me.onCMBeforeChange,Vr=me.onFullScreen,fi=me.className,Ue=fi===void 0?"":fi,Et=me.disablePaste,pi=Et===void 0?!1:Et,mi=me.placeholder,gi=mi===void 0?"":mi,vi=me.values,W=vi===void 0?"":vi,s=Object(y.useState)(null),c=Object(H.a)(s,2),O=c[0],$=c[1],F=Object(y.useState)(Me),he=Object(H.a)(F,2),Re=he[0],Ke=he[1],ht=Object(y.useState)(Xt),Pe=Object(H.a)(ht,2),vt=Pe[0],Nt=Pe[1],Kt=Object(y.useState)(mr),Or=Object(H.a)(Kt,2),gr=Or[0],vr=Or[1],Xr=Object(y.useState)(""),Oi=Object(H.a)(Xr,2),nr=Oi[0],Ur=Oi[1],oi=Object(y.useState)(0),si=Object(H.a)(oi,2),_r=si[0],_i=si[1],yi=Object(y.useState)(St),zi=Object(H.a)(yi,2),Ki=zi[0],Yr=zi[1],Gr=Object(y.useState)(!1),bi=Object(H.a)(Gr,2),dn=bi[0],xi=bi[1],Jt=Object(y.useRef)(Object(je.a)()),Bt=Object(y.useRef)(!1),dr=Object(y.useRef)(),Dt=Object(y.useRef)(),qt=Object(y.useRef)(),Wt=Object(y.useRef)(),ti=Object(y.useRef)(),ar=function(){var ft=Object(M.a)(_.a.mark(function Tt(){var yt,Lt;return _.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(Ge.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Jt.current}});case 2:Lt=Gt.sent,Lt!=null&&(yt=Lt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",O,Dt),Lt.attachments.map(function(Mt){Mt.content_type.indexOf("image")>-1?O.replaceSelection(".concat(Mt.content_type,")")):Mt.content_type.indexOf("video")>-1?O.replaceSelection('')):Mt.content_type.indexOf("pdf")>-1?O.replaceSelection('').concat(Mt.name,"")):O.replaceSelection("[".concat(Mt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Mt.id,"?type=").concat(Mt.content_type,")"))}));case 4:case"end":return Gt.stop()}},Tt)}));return function(){return ft.apply(this,arguments)}}();Object(y.useEffect)(function(){Ke(W),O==null||O.setValue(W)},[W]),Object(y.useEffect)(function(){Vr==null||Vr(gr)},[gr]),Object(y.useEffect)(function(){if(Dt.current){var ft=L.a.fromTextArea(Dt.current,{mode:Kr,lineNumbers:!Ft,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&ft.focus();function Tt(yt,Lt){if(pi){Lt.preventDefault();return}var Pt=Lt.clipboardData;if(Pt){var Gt=Pt.types.toString(),Mt=Pt.items;if(Gt==="Files"||Pt.types.indexOf("Files")>-1){if(Lt.preventDefault(),Kr=="stex")return;try{var rr,Cr=Mt[1];((rr=Mt[0])===null||rr===void 0?void 0:rr.kind)==="file"&&(Cr=Mt[0]);var Rt=Cr.getAsFile(),li=Rt.name.split(".").pop();De(Rt,function(Ut){if(Ut.id){var wr,yr,zr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?ft.replaceSelection(".concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?ft.replaceSelection('')):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?ft.replaceSelection('').concat(Rt.name,"")):ee.includes(li)?ft.replaceSelection('').concat(Rt.name,"")):ft.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ft.on("paste",Tt),ft.on("dragleave",function(yt,Lt){qt.current.classList.remove("mouse-hover-md")}),ft.on("dragover",function(yt,Lt){qt.current.classList.add("mouse-hover-md")}),ft.on("drop",function(yt,Lt){qt.current.classList.add("mouse-hover-md");var Pt;if(Pt=Lt.dataTransfer.files,Pt.length>0){Lt.preventDefault(),Lt.stopPropagation();for(var Gt=function(Cr){var Rt=Pt[Cr],li=Rt.name.split(".").pop();De(Rt,function(Ut){if(Ut.id){var wr,yr,zr;(Rt==null||((wr=Rt.type)===null||wr===void 0)?void 0:wr.indexOf("image"))>-1?ft.replaceSelection(".concat(Ut.content_type,")")):(Rt==null||((yr=Rt.type)===null||yr===void 0)?void 0:yr.indexOf("video"))>-1?ft.replaceSelection('')):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?ft.replaceSelection('').concat(Rt.name,"")):ee.includes(li)?ft.replaceSelection('').concat(Rt.name,"")):ft.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Mt=0;Mt0||Mt.target.offsetWidth>0)&&(Er(),O.setSize("100%","100%"),O.refresh())}}catch(rr){Pt.e(rr)}finally{Pt.f()}});return yt.observe(Dt.current.parentElement),yt}if(O){var Tt=ft();return function(){Tt.unobserve(Dt.current.parentElement)}}},[O,Er]),Object(y.useEffect)(function(){if(O){for(var ft=[],Tt=function(){var Mt=Lt[yt];Pt=Object(H.a)(Mt,2);var rr=Pt[0],Cr=Pt[1],Rt=Object(U.a)({},rr,function(){Vi(Cr)});ft.push(Rt),O.addKeyMap(Rt)},yt=0,Lt=Object.entries(te);yt0){var ft=new Date().getTime(),Tt=window.sessionStorage.getItem(Nr);ft>=_r+nt&&(!Tt||Tt!==Re)&&(window.sessionStorage.setItem(Nr,Re),xi(!0))}},nt),Object(y.useEffect)(function(){Nt(Xt)},[O,Xt]),Object(y.useEffect)(function(){O&&(Zt&&O.focus())},[O,Zt]),Object(y.useEffect)(function(){if(vt&&O){var ft=O.getScrollerElement();function Tt(yt){var Lt=yt.target;if(ti.current){var Pt=Lt.scrollTop/Lt.scrollHeight;ti.current.scrollTop=ti.current.scrollHeight*Pt}}return ft.addEventListener("scroll",Tt),function(){ft.removeEventListener("scroll",Tt)}}},[O,vt]),Object(y.useEffect)(function(){if(O&&Fr){function ft(Tt,yt){Fr(Tt,yt)}return O.on("beforeChange",ft),function(){O.off("beforeChange",ft)}}},[O,Fr]),Object(y.useEffect)(function(){if(O&&kt){function ft(){kt(O.getValue())}return O.on("blur",ft),function(){O.off("blur",ft)}}},[O,kt]),Object(y.useEffect)(function(){if(O){function ft(Tt){var yt=Tt.getValue();Ke(yt),_i(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),tt&&tt(yt)}return O.on("change",ft),function(){O.off("change",ft)}}},[O,tt]),Object(y.useEffect)(function(){O&&(Me==null?(O.setValue(""),Ke("")):Me!==O.getValue()&&(O.setValue(Me),Ke(Me),O.setCursor(O.lineCount(),0)))},[O,Me]);var Vi=Object(y.useCallback)(function(ft){var Tt=O.getCursor(),yt=O.getSelection(),Lt=yt.split(`
`);switch(ft){case"bold":return O.replaceSelection("**"+yt+"**"),yt===""&&O.setCursor(Tt.line,Tt.ch+2),O.focus();case"italic":return O.replaceSelection("*"+yt+"*"),yt===""&&O.setCursor(Tt.line,Tt.ch+1),O.focus();case"code":return O.replaceSelection("`"+yt+"`"),yt===""&&O.setCursor(Tt.line,Tt.ch+1),O.focus();case"inline-latex":return O.replaceSelection("`$$"+yt+"$$`"),yt===""&&O.setCursor(Tt.line,Tt.ch+3),O.focus();case"latex":return O.replaceSelection("```latex\n"+yt+"\n```"),O.setCursor(Tt.line+1,yt.length+1),O.focus();case"line-break":return O.replaceSelection(`
`),O.focus();case"list-ul":return yt===""?O.replaceSelection("- "+yt):O.replaceSelection(Lt.map(function(Pt){return Pt===""?"":"- ".concat(Pt)}).join(`
`)),O.focus();case"list-ol":return yt===""?O.replaceSelection("1. "+yt):O.replaceSelection(Lt.map(function(Pt,Gt){return Pt===""?"":"".concat(Gt+1,". ").concat(Pt)}).join(`
`)),O.focus();case"add-null-ch":return yt===""&&O.setCursor(Tt.line,Tt.ch+1),O.replaceSelection(Ae),O.focus();case"inster-template-1":return yt===""&&O.setCursor(Tt.line,Tt.ch),O.replaceSelection(Fe),O.focus();case"eraser":return O.setValue(""),O.focus();case"trigger-watch":return Nt(!vt),O.focus();case"trigger-full-screen":return vr(!gr),O.focus();case _e:Ur(_e);return;case $e:Ur($e);return;case Be:Ur(Be);return;case qe:Ur(qe);return;default:throw new Error}},[O,vt,gr]),Ei=Object(y.useCallback)(function(ft){Ur("");switch(nr){case _e:var Tt=ft.title,yt=ft.link;return O.replaceSelection("[".concat(Tt,"](").concat(yt,")")),O.focus();case $e:var Lt=ft.language,Pt=ft.content;return O.replaceSelection(["```"+Lt,Pt,"```"].join(`
`)),O.focus();case Be:var Gt=ft.src,Mt=ft.alt;return Mt?O.replaceSelection(".concat(Gt,' "').concat(Mt,'" )')):O.replaceSelection("")),O.focus();case qe:for(var rr=ft.row,Cr=ft.col,Rt=ft.align,li=`
`,Ut=0;Ut300&&(rr=300);var Cr=St+rr+"px";Yr(Cr)}}return ft.addEventListener("mousedown",Lt),document.addEventListener("mousemove",Gt),document.addEventListener("mouseup",Pt),function(){ft.removeEventListener("mousedown",Lt),document.removeEventListener("mousemove",Gt),document.removeEventListener("mouseup",Pt)}}},[O,Wt]),Object(y.useEffect)(function(){Yr(St)},[St]);var ri=ge(dt),fn=ge(Ki),$r={width:ri,height:fn},pn=Object(y.useMemo)(function(){if(_r){var ft=new Date(_r),Tt=ft.getHours(),yt=ft.getMinutes(),Lt=ft.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,yt=yt<10?"0"+yt:yt,Lt=Lt<10?"0"+Lt:Lt,"".concat(Tt,":").concat(yt,":").concat(Lt)}return 0},[_r]);function jn(){window.sessionStorage.removeItem(Nr),xi(!1),_i(0)}function Mi(){xi(!1),_i(0),O.setValue(window.sessionStorage.getItem(Nr))}function ua(ft,Tt){var yt=O.getValue();yt=yt.replace(ft,Tt),Ke(yt),O==null||O.setValue(yt)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:qt},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ue," ").concat(vt?"on-preview":""," ").concat(Ft?"mini":""," ").concat(gr?"full-screen":""),style:$r},A.a.createElement(T,{insertTemp:Ot,watch:vt,fullScreen:gr,showNullButton:It,onActionCallback:Vi,hidetoolBar:Hr,uuid:Jt.current,setOpenPhones:function(){Bt.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Dt,placeholder:gi})),vt?A.a.createElement("div",{ref:ti,className:"preview-container"},Kr==="stex"&&A.a.createElement(k,{value:Re}),Kr!=="stex"&&A.a.createElement(p.a,{edit:!0,value:Re,replaces:ua})):null))),pr?A.a.createElement("a",{ref:Wt,className:"editor-resize"}):null,A.a.createElement(I.a,null,ne[nr]?A.a.createElement(Z.a,{centered:!0,title:ne[nr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(wt,pt){/**
* @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 se,re,Z,D=!1,Y,N;window.PR_SHOULD_USE_CONTINUATION=!0;var M,H;(function(){var U=window,P=["break,continue,do,else,for,if,return,while"],_=[P,"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"],y=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"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"],R=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[y,"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"],w="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",b=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="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",o=[P,"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"],l=[P,"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"],h=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[A,L,R,b,u,o,l,h],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",k="kwd",E="com",f="typ",m="lit",d="pun",a="pln",x="tag",v="dec",T="src",I="atn",G="atv",V="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(ke){for(var Ie=0,He=!1,Ge=!1,je=0,_e=ke.length;je<_e;++je){var Be=ke[je];if(Be.ignoreCase)Ge=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){He=!0,Ge=!1;break}}var $e={b:8,t:9,n:10,v:11,f:12,r:13};function qe(rt){var Ce=rt.charCodeAt(0);if(Ce!==92)return Ce;var lt=rt.charAt(1);return Ce=$e[lt],Ce||("0"<=lt&<<="7"?parseInt(rt.substring(1),8):lt==="u"||lt==="x"?parseInt(rt.substring(2),16):rt.charCodeAt(1))}function Qe(rt){if(rt<32)return(rt<16?"\\x0":"\\x")+rt.toString(16);var Ce=String.fromCharCode(rt);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ze(rt){var Ce=rt.substring(1,rt.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")),lt=[],nt=Ce[0]==="^",Ae=["["];nt&&Ae.push("^");for(var Fe=nt?1:0,ge=Ce.length;Fe122||(ee<65||fe>90||lt.push([Math.max(65,fe)|32,Math.min(ee,90)|32]),ee<97||fe>122||lt.push([Math.max(97,fe)&~32,Math.min(ee,122)&~32]))}}lt.sort(function(me,Ee){return me[0]-Ee[0]||Ee[1]-me[1]});for(var te=[],ne=[],Fe=0;Feue[0]&&(ue[1]+1>ue[0]&&Ae.push("-"),Ae.push(Qe(ue[1])))}return Ae.push("]"),Ae.join("")}function ct(rt){for(var Ce=rt.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")),lt=Ce.length,nt=[],Ae=0,Fe=0;Ae=2&&fe==="["?Ce[Ae]=Ze(ge):fe!=="\\"&&(Ce[Ae]=ge.replace(/[a-zA-Z]/g,function(ne){var ue=ne.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return Ce.join("")}for(var it=[],je=0,_e=ke.length;je<_e;++je){var Be=ke[je];if(Be.global||Be.multiline)throw new Error(""+Be);it.push("(?:"+ct(Be)+")")}return new RegExp(it.join("|"),Ge?"gi":"g")}function j(ke,Ie){var He=/(?:^|\s)nocode(?:\s|$)/,Ge=[],je=0,_e=[],Be=0;function $e(qe){var Qe=qe.nodeType;if(Qe==1){if(He.test(qe.className))return;for(var Ze=qe.firstChild;Ze;Ze=Ze.nextSibling)$e(Ze);var ct=qe.nodeName.toLowerCase();(ct==="br"||ct==="li")&&(Ge[Be]=`
`,_e[Be<<1]=je++,_e[Be++<<1|1]=qe)}else if(Qe==3||Qe==4){var it=qe.nodeValue;it.length&&(Ie?it=it.replace(/\r\n?/g,`
`):it=it.replace(/[ \t\r\n]+/g," "),Ge[Be]=it,_e[Be<<1]=je,je+=it.length,_e[Be++<<1|1]=qe)}}return $e(ke),{sourceCode:Ge.join("").replace(/\n$/,""),spans:_e}}function q(ke,Ie,He,Ge,je){if(!He)return;var _e={sourceNode:ke,pre:1,langExtension:null,numberLines:null,sourceCode:He,spans:null,basePos:Ie,decorations:null};Ge(_e),je.push.apply(je,_e.decorations)}var ie=/\S/;function ce(ke){for(var Ie=void 0,He=ke.firstChild;He;He=He.nextSibling){var Ge=He.nodeType;Ie=Ge===1?Ie?ke:He:Ge===3&&ie.test(He.nodeValue)?ke:Ie}return Ie===ke?void 0:Ie}function ve(ke,Ie){var He={},Ge;(function(){for(var Be=ke.concat(Ie),$e=[],qe={},Qe=0,Ze=Be.length;Qe=0;)He[it.charAt(rt)]=ct;var Ce=ct[1],lt=""+Ce;qe.hasOwnProperty(lt)||($e.push(Ce),qe[lt]=null)}$e.push(/[\0-\uffff]/),Ge=z($e)})();var je=Ie.length,_e=function(Be){for(var $e=Be.sourceCode,qe=Be.basePos,Qe=Be.sourceNode,Ze=[qe,a],ct=0,it=$e.match(Ge)||[],rt={},Ce=0,lt=it.length;Ce=5&&Ae.substring(0,5)==="lang-",ge&&!(Fe&&typeof Fe[1]=="string")&&(ge=!1,Ae=T),ge||(rt[nt]=Ae)}var ee=ct;if(ct+=nt.length,!ge)Ze.push(qe+ee,Ae);else{var te=Fe[1],ne=nt.indexOf(te),ue=ne+te.length;Fe[2]&&(ue=nt.length-Fe[2].length,ne=ue-te.length);var me=Ae.substring(5);q(Qe,qe+ee,nt.substring(0,ne),_e,Ze),q(Qe,qe+ee+ne,te,oe(me,te),Ze),q(Qe,qe+ee+ue,nt.substring(ue),_e,Ze)}}Be.decorations=Ze};return _e}function Oe(ke){var Ie=[],He=[];ke.tripleQuotedStrings?Ie.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ke.multiLineStrings?Ie.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ie.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ke.verbatimStrings&&He.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=ke.hashComments;Ge&&(ke.cStyleComments?(Ge>1?Ie.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ie.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),He.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ie.push([E,/^#[^\r\n]*/,null,"#"])),ke.cStyleComments&&(He.push([E,/^\/\/[^\r\n]*/,null]),He.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=ke.regexLiterals;if(je){var _e=je>1?"":`
\r`,Be=_e?".":"[\\S\\s]",$e="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";He.push(["lang-regex",RegExp("^"+Q+"("+$e+")")])}var qe=ke.types;qe&&He.push([f,qe]);var Qe=(""+ke.keywords).replace(/^ | $/g,"");Qe.length&&He.push([k,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Ie.push([a,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return ke.regexLiterals&&(Ze+="(?!s*/)"),He.push([m,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[m,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(Ze),null]),ve(Ie,He)}var xe=Oe({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(ke,Ie,He){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,_e=ke.ownerDocument,Be=_e.createElement("li");ke.firstChild;)Be.appendChild(ke.firstChild);var $e=[Be];function qe(Ce){var lt=Ce.nodeType;if(lt==1&&!Ge.test(Ce.className))if(Ce.nodeName==="br")Qe(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var nt=Ce.firstChild;nt;nt=nt.nextSibling)qe(nt);else if((lt==3||lt==4)&&He){var Ae=Ce.nodeValue,Fe=Ae.match(je);if(Fe){var ge=Ae.substring(0,Fe.index);Ce.nodeValue=ge;var de=Ae.substring(Fe.index+Fe[0].length);if(de){var fe=Ce.parentNode;fe.insertBefore(_e.createTextNode(de),Ce.nextSibling)}Qe(Ce),ge||Ce.parentNode.removeChild(Ce)}}}function Qe(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function lt(Fe,ge){var de=ge?Fe.cloneNode(!1):Fe,fe=Fe.parentNode;if(fe){var ee=lt(fe,1),te=Fe.nextSibling;ee.appendChild(de);for(var ne=te;ne;ne=te)te=ne.nextSibling,ee.appendChild(ne)}return de}for(var nt=lt(Ce.nextSibling,0),Ae;(Ae=nt.parentNode)&&Ae.nodeType===1;)nt=Ae;$e.push(nt)}for(var Ze=0;Ze<$e.length;++Ze)qe($e[Ze]);Ie===(Ie|0)&&$e[0].setAttribute("value",Ie);var ct=_e.createElement("ol");ct.className="linenums";for(var it=Math.max(0,Ie-1|0)||0,Ze=0,rt=$e.length;Ze