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