(window.webpackJsonp=window.webpackJsonp||[]).push([[166,5,7,8],{"30zm":function(Je,Xe,ee){"use strict";var de=ee("jCWc"),F=ee("kPKH"),S=ee("k1fw"),B=ee("tJVT"),_=ee("PpiC"),R=ee("B9cy"),N=ee("Ol7k"),M=ee("lUTK"),O=ee("BvKs"),w=ee("q1tI"),m=ee.n(w),T=ee("Ty5D"),C=ee("55Ip"),b=ee("9kvl"),E=ee("m3rI"),y=ee("kzJb"),c=ee.n(y),r=O.a.SubMenu,a=N.a.Sider,o=N.a.Content,g=function(d){var v=d.messages,h=d.globalSetting,u=d.loading,n=d.user,e=d.dispatch,t=Object(_.a)(d,["messages","globalSetting","loading","user","dispatch"]),f=Object(T.i)(),p=n.userInfo,x=Object(T.h)(),A=v.tidingsList,I=v.privateMessage,U=v.unreadInfo,j=Object(w.useState)({per_page:10,page:1}),z=Object(B.a)(j,2),V=z[0],G=z[1];Object(w.useEffect)(function(){Q()},[f.userId]);var Q=function(){e({type:"messages/unreadMessageInfo",payload:Object(S.a)(Object(S.a)({},V),f)})};return m.a.createElement(F.a,{flex:"264px"},m.a.createElement("aside",{className:c.a.userInfo},m.a.createElement("img",{className:"mt40",src:E.a.IMG_SERVER+"/images/"+(p==null?void 0:p.image_url)}),m.a.createElement("p",{className:"font24 mt10"},p==null?void 0:p.username),m.a.createElement("p",{className:"mt20"},p==null?void 0:p.user_identity)),m.a.createElement("ul",{className:c.a.navInfo},m.a.createElement(C.a,{to:"/messages/".concat(p==null?void 0:p.login,"/user_tidings")},m.a.createElement("li",{className:x.pathname.indexOf("user_tidings")>-1&&c.a.actived},"\u6D88\u606F",!!(U!=null&&U.unread_tiding_count)&&m.a.createElement("span",{className:c.a.newTip},U==null?void 0:U.unread_tiding_count))),m.a.createElement(C.a,{to:"/messages/".concat(p==null?void 0:p.login,"/private_messages")},m.a.createElement("li",{className:(x.pathname.indexOf("private_messages")>-1||x.pathname.indexOf("message_detail")>-1)&&c.a.actived},"\u79C1\u4FE1",!!(U!=null&&U.unread_message_count)&&m.a.createElement("span",{className:c.a.newTip},U==null?void 0:U.unread_message_count)))))};Xe.a=Object(b.a)(function(l){var d=l.messages,v=l.loading,h=l.user,u=l.globalSetting;return{messages:d,globalSetting:u,user:h,loading:v.effects}})(g)},"55Ip":function(Je,Xe,ee){"use strict";ee.d(Xe,"a",function(){return a}),ee.d(Xe,"b",function(){return h});var de=ee("Ty5D"),F=ee("dI71"),S=ee("q1tI"),B=ee.n(S),_=ee("YS25"),R=ee("17x9"),N=ee.n(R),M=ee("wx14"),O=ee("zLVn"),w=ee("9R94"),m=function(n){Object(F.a)(e,n);function e(){for(var f,p=arguments.length,x=new Array(p),A=0;A
=0||p.relatedTarget.className.indexOf("".concat(U,"-next"))>=0))return;n.setState({goInputText:""}),I(n.getValidValue())},n.go=function(p){var x=n.state.goInputText;if(x==="")return;(p.keyCode===b.ENTER||p.type==="click")&&(n.setState({goInputText:""}),n.props.quickGo(n.getValidValue()))},n}return Object(_.a)(u,[{key:"getValidValue",value:function(){var e=this.state,t=e.goInputText,f=e.current;return!t||isNaN(t)?f:Number(t)}},{key:"getPageSizeOptions",value:function(){var e=this.props,t=e.pageSize,f=e.pageSizeOptions;return f.some(function(p){return p.toString()===t.toString()})?f:f.concat([t.toString()]).sort(function(p,x){var A=isNaN(Number(p))?0:Number(p),I=isNaN(Number(x))?0:Number(x);return A-I})}},{key:"render",value:function(){var e=this,t=this.props,f=t.pageSize,p=t.locale,x=t.rootPrefixCls,A=t.changeSize,I=t.quickGo,U=t.goButton,j=t.selectComponentClass,z=t.buildOptionText,V=t.selectPrefixCls,G=t.disabled,Q=this.state.goInputText,ne="".concat(x,"-options"),re=j,be=null,se=null,oe=null;if(!A&&!I)return null;var ue=this.getPageSizeOptions();if(A&&re){var he=ue.map(function(te,Y){return O.a.createElement(re.Option,{key:Y,value:te.toString()},(z||e.buildOptionText)(te))});be=O.a.createElement(re,{disabled:G,prefixCls:V,showSearch:!1,className:"".concat(ne,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(f||ue[0]).toString(),onChange:this.changeSize,getPopupContainer:function(Y){return Y.parentNode}},he)}return I&&(U&&(oe=typeof U=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:G,className:"".concat(ne,"-quick-jumper-button")},p.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},U)),se=O.a.createElement("div",{className:"".concat(ne,"-quick-jumper")},p.jump_to,O.a.createElement("input",{disabled:G,type:"text",value:Q,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),p.page,oe)),O.a.createElement("li",{className:"".concat(ne)},be,se)}}]),u}(O.a.Component);E.defaultProps={pageSizeOptions:["10","20","50","100"]};var y=E,c=ee("N2Kk");function r(){}function a(v){return typeof v=="number"&&isFinite(v)&&Math.floor(v)===v}function o(v,h,u){return u}function g(v,h,u){var n=typeof v=="undefined"?h.pageSize:v;return Math.floor((u.total-1)/n)+1}var l=function(v){Object(R.a)(u,v);var h=Object(N.a)(u);function u(n){var e;Object(B.a)(this,u),e=h.call(this,n),e.getJumpPrevPage=function(){return Math.max(1,e.state.current-(e.props.showLessItems?3:5))},e.getJumpNextPage=function(){return Math.min(g(void 0,e.state,e.props),e.state.current+(e.props.showLessItems?3:5))},e.getItemIcon=function(A,I){var U=e.props.prefixCls,j=A||O.a.createElement("button",{type:"button","aria-label":I,className:"".concat(U,"-item-link")});return typeof A=="function"&&(j=O.a.createElement(A,Object(S.a)({},e.props))),j},e.savePaginationNode=function(A){e.paginationNode=A},e.isValid=function(A){return a(A)&&A!==e.state.current},e.shouldDisplayQuickJumper=function(){var A=e.props,I=A.showQuickJumper,U=A.pageSize,j=A.total;return j<=U?!1:I},e.handleKeyDown=function(A){(A.keyCode===b.ARROW_UP||A.keyCode===b.ARROW_DOWN)&&A.preventDefault()},e.handleKeyUp=function(A){var I=e.getValidValue(A),U=e.state.currentInputValue;I!==U&&e.setState({currentInputValue:I}),A.keyCode===b.ENTER?e.handleChange(I):A.keyCode===b.ARROW_UP?e.handleChange(I-1):A.keyCode===b.ARROW_DOWN&&e.handleChange(I+1)},e.changePageSize=function(A){var I=e.state.current,U=g(A,e.state,e.props);I=I>U?U:I,U===0&&(I=e.state.current),typeof A=="number"&&("pageSize"in e.props||e.setState({pageSize:A}),"current"in e.props||e.setState({current:I,currentInputValue:I})),e.props.onShowSizeChange(I,A),"onChange"in e.props&&e.props.onChange&&e.props.onChange(I,A)},e.handleChange=function(A){var I=e.props.disabled,U=A;if(e.isValid(U)&&!I){var j=g(void 0,e.state,e.props);U>j?U=j:U<1&&(U=1),"current"in e.props||e.setState({current:U,currentInputValue:U});var z=e.state.pageSize;return e.props.onChange(U,z),U}return e.state.current},e.prev=function(){e.hasPrev()&&e.handleChange(e.state.current-1)},e.next=function(){e.hasNext()&&e.handleChange(e.state.current+1)},e.jumpPrev=function(){e.handleChange(e.getJumpPrevPage())},e.jumpNext=function(){e.handleChange(e.getJumpNextPage())},e.hasPrev=function(){return e.state.current>1},e.hasNext=function(){return e.state.current2?U-2:0),z=2;z=f?x=f:x=Number(t),x}},{key:"getShowSizeChanger",value:function(){var e=this.props,t=e.showSizeChanger,f=e.total,p=e.totalBoundaryShowSizeChanger;return typeof t!="undefined"?t:f>p}},{key:"renderPrev",value:function(e){var t=this.props,f=t.prevIcon,p=t.itemRender,x=p(e,"prev",this.getItemIcon(f,"prev page")),A=!this.hasPrev();return Object(M.isValidElement)(x)?Object(M.cloneElement)(x,{disabled:A}):x}},{key:"renderNext",value:function(e){var t=this.props,f=t.nextIcon,p=t.itemRender,x=p(e,"next",this.getItemIcon(f,"next page")),A=!this.hasNext();return Object(M.isValidElement)(x)?Object(M.cloneElement)(x,{disabled:A}):x}},{key:"render",value:function(){var e=this,t=this.props,f=t.prefixCls,p=t.className,x=t.style,A=t.disabled,I=t.hideOnSinglePage,U=t.total,j=t.locale,z=t.showQuickJumper,V=t.showLessItems,G=t.showTitle,Q=t.showTotal,ne=t.simple,re=t.itemRender,be=t.showPrevNextJumpers,se=t.jumpPrevIcon,oe=t.jumpNextIcon,ue=t.selectComponentClass,he=t.selectPrefixCls,te=t.pageSizeOptions,Y=this.state,fe=Y.current,Re=Y.pageSize,Le=Y.currentInputValue;if(I===!0&&U<=Re)return null;var xe=g(void 0,this.state,this.props),Te=[],le=null,ye=null,we=null,De=null,Se=null,pe=z&&z.goButton,me=V?1:2,Fe=fe-1>0?fe-1:0,Pe=fe+1=me*2&&fe!==1+2&&(Te[0]=Object(M.cloneElement)(Te[0],{className:"".concat(f,"-item-after-jump-prev")}),Te.unshift(le)),xe-fe>=me*2&&fe!==xe-2&&(Te[Te.length-1]=Object(M.cloneElement)(Te[Te.length-1],{className:"".concat(f,"-item-before-jump-next")}),Te.push(ye)),Be!==1&&Te.unshift(we),_e!==xe&&Te.push(De)}var q=null;Q&&(q=O.a.createElement("li",{className:"".concat(f,"-total-text")},Q(U,[U===0?0:(fe-1)*Re+1,fe*Re>U?U:fe*Re])));var J=!this.hasPrev()||!xe,Z=!this.hasNext()||!xe;return O.a.createElement("ul",Object(de.a)({className:m()(f,p,Object(F.a)({},"".concat(f,"-disabled"),A)),style:x,unselectable:"unselectable",ref:this.savePaginationNode},Me),q,O.a.createElement("li",{title:G?j.prev_page:null,onClick:this.prev,tabIndex:J?null:0,onKeyPress:this.runIfEnterPrev,className:m()("".concat(f,"-prev"),Object(F.a)({},"".concat(f,"-disabled"),J)),"aria-disabled":J},this.renderPrev(Fe)),Te,O.a.createElement("li",{title:G?j.next_page:null,onClick:this.next,tabIndex:Z?null:0,onKeyPress:this.runIfEnterNext,className:m()("".concat(f,"-next"),Object(F.a)({},"".concat(f,"-disabled"),Z)),"aria-disabled":Z},this.renderNext(Pe)),O.a.createElement(y,{disabled:A,locale:j,rootPrefixCls:f,selectComponentClass:ue,selectPrefixCls:he,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:fe,pageSize:Re,pageSizeOptions:te,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:pe}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var f={};if("current"in e&&(f.current=e.current,e.current!==t.current&&(f.currentInputValue=f.current)),"pageSize"in e&&e.pageSize!==t.pageSize){var p=t.current,x=g(e.pageSize,t,e);p=p>x?x:p,"current"in e||(f.current=p,f.currentInputValue=p),f.pageSize=e.pageSize}return f}}]),u}(O.a.Component);l.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:r,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:r,locale:c.a,style:{},itemRender:o,totalBoundaryShowSizeChanger:50};var d=l},"8hTe":function(Je,Xe,ee){Je.exports={button:"button___1wy9m"}},"9Bee":function(Je,Xe,ee){"use strict";var de=ee("DYRE"),F=ee("zeV3"),S=ee("+L6B"),B=ee("2/Rp"),_=ee("k1fw"),R=ee("9og8"),N=ee("tJVT"),M=ee("WmNS"),O=ee.n(M),w=ee("q1tI"),m=ee.n(w),T=ee("vg9a"),C=ee("DlQD"),b=ee.n(C),E=ee("rUJ1");function y(P,i){var s=P.match(/^(\s+)(?:```)/);if(s===null)return i;var L=s[1];return i.split(`
`).map(function(k){var D=k.match(/^\s+/);if(D===null)return k;var $=Object(N.a)(D,1),ve=$[0];return ve.length>=L.length?k.slice(L.length):k}).join(`
`)}var c=[],r=[""],a=new b.a.Renderer,o=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function g(){c.length=0,r=[""]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function d(P,i,s,L){if(i>=P.length||P[i].level<=s)return i;var k=P[i];L.push(""+k.text+" "),i++;var D=[];return i=d(P,i,k.level,D),D.length>0&&(L.push(""),D.forEach(function($){L.push($)}),L.push(" ")),L.push(" "),i=d(P,i,s,L),i}function v(){return d(c,0,0,r),r.push(" "),r.join("")}var h={heading:function(i){var s=o.exec(i);if(s)return{type:"heading",raw:s[0],depth:s[1].length,text:s[2]}},fences:function(i){var s=this.rules.block.fences.exec(i);if(s){var L=s[0],k=y(L,s[3]||""),D=s[2]?s[2].trim():s[2];if(["latex","katex","math"].indexOf(D)>=0){var $=e(),ve=k;k=$,t[$]={type:"block",expression:ve}}return{type:"code",raw:L,lang:D,text:k}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,n=0,e=function(){return"__special_katext_id_".concat(n++,"__")},t={};function f(){return t}function p(){n=0,t={}}function x(P){return P=P.replace(u,function(i,s){var L=e();return t[L]={type:"inline",expression:s},L}),P}var A=a.listitem;a.listitem=function(P){return A(x(P))};var I=a.paragraph;a.paragraph=function(P){return I(x(P))};var U=a.tablecell;a.tablecell=function(P,i){return U(x(P),i)},a.code=function(P,i,s){var L=(i||"").match(/\S*/)[0];return L?["latex","katex","math"].indexOf(L)>=0?"".concat(P,"
"):' ').concat(s?P:Object(E.escape)(P,!0),`
`):''+(s?P:Object(E.escape)(P,!0))+" "},a.heading=function(P,i,s){var L=this.options.headerPrefix+s.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:L,level:i,text:P}),"'+P+" "},b.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),b.a.use({tokenizer:h,renderer:a});var j=b.a,z=ee("SJMd"),V=ee("ulZh"),G=ee.n(V),Q=ee("m3rI"),ne=ee("Oy/b"),re=ee("p5ED"),be=ee("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 se=function(P,i){return(se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,L){s.__proto__=L}||function(s,L){for(var k in L)Object.prototype.hasOwnProperty.call(L,k)&&(s[k]=L[k])})(P,i)};function oe(P,i){function s(){this.constructor=P}se(P,i),P.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}function ue(P,i,s,L){return new(s||(s=Promise))(function(k,D){function $(He){try{Oe(L.next(He))}catch(Ee){D(Ee)}}function ve(He){try{Oe(L.throw(He))}catch(Ee){D(Ee)}}function Oe(He){var Ee;He.done?k(He.value):(Ee=He.value,Ee instanceof s?Ee:new s(function(Ve){Ve(Ee)})).then($,ve)}Oe((L=L.apply(P,i||[])).next())})}function he(P,i){var s,L,k,D,$={label:0,sent:function(){if(1&k[0])throw k[1];return k[1]},trys:[],ops:[]};return D={next:ve(0),throw:ve(1),return:ve(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function ve(Oe){return function(He){return function(Ee){if(s)throw new TypeError("Generator is already executing.");for(;$;)try{if(s=1,L&&(k=2&Ee[0]?L.return:Ee[0]?L.throw||((k=L.return)&&k.call(L),0):L.next)&&!(k=k.call(L,Ee[1])).done)return k;switch(L=0,k&&(Ee=[2&Ee[0],k.value]),Ee[0]){case 0:case 1:k=Ee;break;case 4:return $.label++,{value:Ee[1],done:!1};case 5:$.label++,L=Ee[1],Ee=[0];continue;case 7:Ee=$.ops.pop(),$.trys.pop();continue;default:if(!(k=$.trys,(k=k.length>0&&k[k.length-1])||Ee[0]!==6&&Ee[0]!==2)){$=0;continue}if(Ee[0]===3&&(!k||Ee[1]>k[0]&&Ee[1] ',"select"),this.addActionButton(L,' ',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(L,' ',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(L,' ',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(L,' ',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(L,' ',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(L,' ',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(L,' ',"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(D){var $=document.createElement("div");$.className=""+s.toolbarButtonStyleClass.name,$.setAttribute("data-type-name",D.typeName),$.innerHTML=D.icon,$.addEventListener("click",function(){s.markerToolbarButtonClicked($,D)}),s.buttons.push($),s.markerButtons.push($)}),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 k=document.createElement("div");k.className=this.toolbarBlockStyleClass.name,k.style.whiteSpace="nowrap",k.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(k),this.addActionButton(k,' ',"render"),this.addActionButton(k,' ',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},P.prototype.addButtonClickListener=function(i){this.buttonClickListeners.push(i)},P.prototype.removeButtonClickListener=function(i){this.buttonClickListeners.indexOf(i)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(i),1)},P.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},P.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var i=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var s=0;s0&&this.buttonClickListeners.forEach(function(L){return L("marker",s)}),this.markerButtonOverflowBlock.style.display="none"},P.prototype.actionToolbarButtonClicked=function(i,s){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(L){return L("action",s)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},P.prototype.setActiveButton=function(i){this.resetButtonStyles(),i.className=i.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),i.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},P.prototype.setActiveMarkerButton=function(i){var s=this.markerButtons.find(function(L){return L.getAttribute("data-type-name")===i});s&&this.setActiveButton(s)},P.prototype.setCurrentMarker=function(i){var s=this;this.currentMarker=i,this.buttons.filter(function(L){return/delete|notes/.test(L.getAttribute("data-action"))}).forEach(function(L){s.currentMarker===void 0?(L.style.fillOpacity="0.4",L.style.pointerEvents="none"):(L.style.fillOpacity="1",L.style.pointerEvents="all")})},P}(),we=function(){function P(i,s,L,k){this.panels=[],this.panelButtons=[],this.markerjsContainer=i,this.displayMode=s,this.uiStyleSettings=L,this.styles=k,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return P.prototype.addStyles=function(){var i;this.toolboxStyleClass=this.styles.addClass(new le("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 le("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new le("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new le("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new le("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 le("toolbox-panel-row_colors",`
background-color: `+((i=this.uiStyleSettings.toolboxBackgroundColor)!==null&&i!==void 0?i:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new le("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new le("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new le("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Te("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Te("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},P.prototype.show=function(i){var s;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=i,this.uiContainer.className=this.toolboxStyleClass.name+" "+((s=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&s!==void 0?s:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},P.prototype.setPanelButtons=function(i){var s,L,k=this;this.panels=i,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((s=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&s!==void 0?s:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((L=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(D){var $;D.uiStyleSettings=k.uiStyleSettings;var ve=document.createElement("div");ve.className=k.toolboxButtonStyleClass.name+" "+(($=k.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&$!==void 0?$:k.toolboxButtonStyleColorsClass.name),ve.innerHTML=D.icon,ve.title=D.title,ve.addEventListener("click",function(){k.panelButtonClick(D)}),k.panelButtons.push(ve),k.buttonRow.appendChild(ve)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},P.prototype.panelButtonClick=function(i){var s=this,L=-1;if(i!==this.activePanel){L=this.panels.indexOf(i),this.panelRow.innerHTML="";var k=i.getUi();k.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(k),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=i}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){s.displayMode==="inline"?s.panelRow.style.display="none":s.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(D,$){var ve,Oe;D.className=s.toolboxButtonStyleClass.name+" "+($===L?""+((ve=s.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ve!==void 0?ve:s.toolboxActiveButtonStyleColorsClass.name):""+((Oe=s.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:s.toolboxButtonStyleColorsClass.name))})},P}(),De=function(P,i){this.title=P,this.icon=i},Se=function(P){function i(s,L,k,D){var $=P.call(this,s,D||' ')||this;return $.colors=[],$.addTransparent=!1,$.colorBoxes=[],$.colors=L,$.currentColor=k,$.setCurrentColor=$.setCurrentColor.bind($),$.getColorBox=$.getColorBox.bind($),$}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");return L.style.overflow="hidden",L.style.whiteSpace="nowrap",this.colors.forEach(function(k){var D=s.getColorBox(k);L.appendChild(D),s.colorBoxes.push(D)}),L},i.prototype.getColorBox=function(s){var L=this,k=this.uiStyleSettings.toolbarHeight/4,D=this.uiStyleSettings.toolbarHeight-k,$=document.createElement("div");$.style.display="inline-block",$.style.boxSizing="content-box",$.style.width=D-2+"px",$.style.height=D-2+"px",$.style.padding="1px",$.style.marginRight="2px",$.style.marginBottom="2px",$.style.borderWidth="2px",$.style.borderStyle="solid",$.style.borderRadius=(D+2)/2+"px",$.style.borderColor=s===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",$.addEventListener("click",function(){L.setCurrentColor(s,$)});var ve=document.createElement("div");return ve.style.display="inline-block",ve.style.width=D-2+"px",ve.style.height=D-2+"px",ve.style.backgroundColor=s,ve.style.borderRadius=D/2+"px",s==="transparent"&&(ve.style.fill=this.uiStyleSettings.toolboxAccentColor,ve.innerHTML=`
`),$.appendChild(ve),$},i.prototype.setCurrentColor=function(s,L){var k=this;this.currentColor=s,this.colorBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(s)},i}(De),pe=function(){function P(i,s,L){this._state="new",this._isSelected=!1,this._container=i,this._overlayContainer=s,this.globalSettings=L,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(P.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(i){return!1},Object.defineProperty(P.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),P.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},P.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},P.prototype.pointerDown=function(i,s){},P.prototype.dblClick=function(i,s){},P.prototype.manipulate=function(i){},P.prototype.pointerUp=function(i){this.stateChanged()},P.prototype.dispose=function(){},P.prototype.addMarkerVisualToContainer=function(i){this.container.childNodes.length>0?this.container.insertBefore(i,this.container.childNodes[0]):this.container.appendChild(i)},P.prototype.getState=function(){return{typeName:P.typeName,state:this.state,notes:this.notes}},P.prototype.restoreState=function(i){this._state=i.state,this.notes=i.notes},P.prototype.scale=function(i,s){},P.prototype.colorChanged=function(i){this.onColorChanged&&this.onColorChanged(i),this.stateChanged()},P.prototype.fillColorChanged=function(i){this.onFillColorChanged&&this.onFillColorChanged(i),this.stateChanged()},P.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var i=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),i.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(i)&&this.onStateChanged(this)}},P.typeName="MarkerBase",P}(),me=function(){function P(){this.findGripByVisual=this.findGripByVisual.bind(this)}return P.prototype.findGripByVisual=function(i){return this.topLeft.ownsTarget(i)?this.topLeft:this.topCenter.ownsTarget(i)?this.topCenter:this.topRight.ownsTarget(i)?this.topRight:this.centerLeft.ownsTarget(i)?this.centerLeft:this.centerRight.ownsTarget(i)?this.centerRight:this.bottomLeft.ownsTarget(i)?this.bottomLeft:this.bottomCenter.ownsTarget(i)?this.bottomCenter:this.bottomRight.ownsTarget(i)?this.bottomRight:void 0},P}(),Fe=function(){function P(){this.GRIP_SIZE=10,this.visual=Y.createGroup(),this.visual.appendChild(Y.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Y.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(i){return i===this.visual||i===this.visual.childNodes[0]||i===this.visual.childNodes[1]},P}(),Pe=function(){function P(){}return P.toITransformMatrix=function(i){return{a:i.a,b:i.b,c:i.c,d:i.d,e:i.e,f:i.f}},P.toSVGMatrix=function(i,s){return i.a=s.a,i.b=s.b,i.c=s.c,i.d=s.d,i.e=s.e,i.f=s.f,i},P}(),Me=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.left=0,D.top=0,D.width=0,D.height=0,D.defaultSize={x:50,y:20},D.offsetX=0,D.offsetY=0,D.rotationAngle=0,D.CB_DISTANCE=10,D._suppressMarkerCreateEvent=!1,D.container.transform.baseVal.appendItem(Y.createTransform()),D.setupControlBox(),D}return oe(i,P),Object.defineProperty(i.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"visual",{get:function(){return this._visual},set:function(s){this._visual=s;var L=Y.createTransform();this._visual.transform.baseVal.appendItem(L)},enumerable:!1,configurable:!0}),i.prototype.ownsTarget=function(s){return!!P.prototype.ownsTarget.call(this,s)||!!(this.controlGrips.findGripByVisual(s)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(s))},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="new"&&(this.left=s.x,this.top=s.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var k=this.unrotatePoint(s);if(this.manipulationStartX=k.x,this.manipulationStartY=k.y,this.offsetX=k.x-this.left,this.offsetY=k.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(L),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(L)){this.activeGrip=this.rotatorGrip;var D=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=D.x-this.width/2,this.top=D.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var $=this.container.transform.baseVal.getItem(0);$.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem($,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},i.prototype.pointerUp=function(s){var L=this.state;P.prototype.pointerUp.call(this,s),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(s),this._state="select",L==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},i.prototype.moveVisual=function(s){this.visual.style.transform="translate("+s.x+"px, "+s.y+"px)"},i.prototype.manipulate=function(s){var L=this.unrotatePoint(s);this.state==="creating"?this.resize(s):this.state==="move"?(this.left=this.manipulationStartLeft+(L.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(L.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(L):this.state==="rotate"&&this.rotate(s)},i.prototype.resize=function(s){var L=this.manipulationStartLeft,k=this.manipulationStartWidth,D=this.manipulationStartTop,$=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:L=this.manipulationStartLeft+s.x-this.manipulationStartX,k=this.manipulationStartWidth+this.manipulationStartLeft-L;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:k=this.manipulationStartWidth+s.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:D=this.manipulationStartTop+s.y-this.manipulationStartY,$=this.manipulationStartHeight+this.manipulationStartTop-D;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:$=this.manipulationStartHeight+s.y-this.manipulationStartY}k>=0?(this.left=L,this.width=k):(this.left=L+k,this.width=-k),$>=0?(this.top=D,this.height=$):(this.top=D+$,this.height=-$),this.setSize()},i.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},i.prototype.rotate=function(s){if(Math.abs(s.x-this.centerX)>.1){var L=Math.sign(s.x-this.centerX);this.rotationAngle=180*Math.atan((s.y-this.centerY)/(s.x-this.centerX))/Math.PI+90*L,this.applyRotation()}},i.prototype.applyRotation=function(){var s=this.container.transform.baseVal.getItem(0);s.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(s,0)},i.prototype.rotatePoint=function(s){if(this.rotationAngle===0)return s;var L=this.container.getCTM(),k=Y.createPoint(s.x,s.y);return{x:(k=k.matrixTransform(L)).x,y:k.y}},i.prototype.unrotatePoint=function(s){if(this.rotationAngle===0)return s;var L=this.container.getCTM();L=L.inverse();var k=Y.createPoint(s.x,s.y);return{x:(k=k.matrixTransform(L)).x,y:k.y}},i.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},i.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},i.prototype.setupControlBox=function(){this.controlBox=Y.createGroup();var s=Y.createTransform();s.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(s),this.container.appendChild(this.controlBox),this.controlRect=Y.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=Y.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new me,this.addControlGrips(),this.controlBox.style.display="none"},i.prototype.adjustControlBox=function(){var s=this.controlBox.transform.baseVal.getItem(0);s.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(s,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()},i.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()},i.prototype.createGrip=function(){var s=new Fe;return s.visual.transform.baseVal.appendItem(Y.createTransform()),this.controlBox.appendChild(s.visual),s},i.prototype.positionGrips=function(){var s=this.controlGrips.topLeft.GRIP_SIZE,L=-s/2,k=L,D=(this.width+this.CB_DISTANCE)/2-s/2,$=(this.height+this.CB_DISTANCE)/2-s/2,ve=this.height+this.CB_DISTANCE-s/2,Oe=this.width+this.CB_DISTANCE-s/2;this.positionGrip(this.controlGrips.topLeft.visual,L,k),this.positionGrip(this.controlGrips.topCenter.visual,D,k),this.positionGrip(this.controlGrips.topRight.visual,Oe,k),this.positionGrip(this.controlGrips.centerLeft.visual,L,$),this.positionGrip(this.controlGrips.centerRight.visual,Oe,$),this.positionGrip(this.controlGrips.bottomLeft.visual,L,ve),this.positionGrip(this.controlGrips.bottomCenter.visual,D,ve),this.positionGrip(this.controlGrips.bottomRight.visual,Oe,ve),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,D,k-3*this.CB_DISTANCE)},i.prototype.positionGrip=function(s,L,k){var D=s.transform.baseVal.getItem(0);D.setTranslate(L,k),s.transform.baseVal.replaceItem(D,0)},i.prototype.hideControlBox=function(){this.controlBox.style.display="none"},i.prototype.showControlBox=function(){this.controlBox.style.display=""},i.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Pe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Pe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},P.prototype.getState.call(this))},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s);var L=s;this.left=L.left,this.top=L.top,this.width=L.width,this.height=L.height,this.rotationAngle=L.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Pe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,L.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Pe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,L.containerTransformMatrix))},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L);var k=this.rotatePoint({x:this.left,y:this.top}),D=this.unrotatePoint({x:k.x*s,y:k.y*L});this.left=D.x,this.top=D.y,this.width=this.width*s,this.height=this.height*L,this.adjustControlBox()},i}(pe),Ie=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.createVisual=D.createVisual.bind(D),D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.visual)},i.prototype.createVisual=function(){this.visual=Y.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)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="new"&&(this.createVisual(),this.moveVisual(s),this._state="creating")},i.prototype.manipulate=function(s){P.prototype.manipulate.call(this,s)},i.prototype.resize=function(s){P.prototype.resize.call(this,s),this.setSize()},i.prototype.setSize=function(){P.prototype.setSize.call(this),Y.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},i.prototype.pointerUp=function(s){P.prototype.pointerUp.call(this,s),this.setSize()},i.prototype.setStrokeColor=function(s){this.strokeColor=s,this.visual&&Y.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(s),this.stateChanged()},i.prototype.setFillColor=function(s){this.fillColor=s,this.visual&&Y.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},i.prototype.setStrokeWidth=function(s){this.strokeWidth=s,this.visual&&Y.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},i.prototype.setStrokeDasharray=function(s){this.strokeDasharray=s,this.visual&&Y.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},i.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this))},i.prototype.restoreState=function(s){var L=s;this.fillColor=L.fillColor,this.strokeColor=L.strokeColor,this.strokeWidth=L.strokeWidth,this.strokeDasharray=L.strokeDasharray,this.opacity=L.opacity,this.createVisual(),P.prototype.restoreState.call(this,s),this.setSize()},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L),this.setSize()},i.title="Rectangle marker",i}(Me),Ne=function(P){function i(s,L,k,D){var $=P.call(this,s,D||' ')||this;return $.widths=[],$.widthBoxes=[],$.widths=L,$.currentWidth=k,$.setCurrentWidth=$.setCurrentWidth.bind($),$}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");return L.style.display="flex",L.style.overflow="hidden",L.style.flexGrow="2",this.widths.forEach(function(k){var D=document.createElement("div");D.style.display="flex",D.style.flexGrow="2",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=k===s.currentWidth?s.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){s.setCurrentWidth(k,D)}),L.appendChild(D);var $=document.createElement("div");$.innerText=k.toString(),$.style.marginRight="5px",D.appendChild($);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.display="flex",ve.style.alignItems="center";var Oe=document.createElement("hr");Oe.style.minWidth="20px",Oe.style.border="0px",Oe.style.borderTop=k+"px solid "+s.uiStyleSettings.toolboxColor,Oe.style.flexGrow="2",ve.appendChild(Oe),D.appendChild(ve),s.widthBoxes.push(D)}),L},i.prototype.setCurrentWidth=function(s,L){var k=this;this.currentWidth=s,this.widthBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},i}(De),Ue=function(P){function i(s,L,k,D){var $=P.call(this,s,D||' ')||this;return $.styles=[],$.styleBoxes=[],$.styles=L,$.currentStyle=k,$.setCurrentStyle=$.setCurrentStyle.bind($),$}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");return L.style.display="flex",L.style.overflow="hidden",L.style.flexGrow="2",this.styles.forEach(function(k){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/s.styles.length-5+"%",D.style.borderColor=k===s.currentStyle?s.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){s.setCurrentStyle(k,D)}),L.appendChild(D);var $=document.createElement("div");$.style.minHeight="20px",$.style.flexGrow="2",$.style.overflow="hidden";var ve=`
`;$.innerHTML=ve,D.appendChild($),s.styleBoxes.push(D)}),L},i.prototype.setCurrentStyle=function(s,L){var k=this;this.currentStyle=s,this.styleBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},i}(De),ke=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.strokeColor=k.defaultColor,D.strokeWidth=k.defaultStrokeWidth,D.strokeDasharray=k.defaultStrokeDasharray,D.strokePanel=new Se("Line color",k.defaultColorSet,k.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Ne("Line width",k.defaultStrokeWidths,k.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Ue("Line style",k.defaultStrokeDasharrays,k.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return oe(i,P),Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=P.prototype.getState.call(this);return s.typeName=i.typeName,s},i.typeName="FrameMarker",i.title="Frame marker",i.icon=' ',i}(Ie),Ae=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},Be=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.x1=0,D.y1=0,D.x2=0,D.y2=0,D.defaultLength=50,D.manipulationStartX=0,D.manipulationStartY=0,D.manipulationStartX1=0,D.manipulationStartY1=0,D.manipulationStartX2=0,D.manipulationStartY2=0,D.setupControlBox(),D}return oe(i,P),i.prototype.ownsTarget=function(s){return!!P.prototype.ownsTarget.call(this,s)||!(!this.grip1.ownsTarget(s)&&!this.grip2.ownsTarget(s))},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.manipulationStartX=s.x,this.manipulationStartY=s.y,this.state==="new"&&(this.x1=s.x,this.y1=s.y,this.x2=s.x,this.y2=s.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(L)?this.activeGrip=this.grip1:this.grip2.ownsTarget(L)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},i.prototype.pointerUp=function(s){var L=this.state;P.prototype.pointerUp.call(this,s),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(s),this._state="select",L==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},i.prototype.adjustVisual=function(){},i.prototype.manipulate=function(s){this.state==="creating"?this.resize(s):this.state==="move"?(this.x1=this.manipulationStartX1+s.x-this.manipulationStartX,this.y1=this.manipulationStartY1+s.y-this.manipulationStartY,this.x2=this.manipulationStartX2+s.x-this.manipulationStartX,this.y2=this.manipulationStartY2+s.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(s)},i.prototype.resize=function(s){switch(this.activeGrip){case this.grip1:this.x1=s.x,this.y1=s.y;break;case this.grip2:case void 0:this.x2=s.x,this.y2=s.y}this.adjustVisual(),this.adjustControlBox()},i.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},i.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},i.prototype.setupControlBox=function(){this.controlBox=Y.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},i.prototype.adjustControlBox=function(){this.positionGrips()},i.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},i.prototype.createGrip=function(){var s=new Fe;return s.visual.transform.baseVal.appendItem(Y.createTransform()),this.controlBox.appendChild(s.visual),s},i.prototype.positionGrips=function(){var s=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-s/2,this.y1-s/2),this.positionGrip(this.grip2.visual,this.x2-s/2,this.y2-s/2)},i.prototype.positionGrip=function(s,L,k){var D=s.transform.baseVal.getItem(0);D.setTranslate(L,k),s.transform.baseVal.replaceItem(D,0)},i.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},P.prototype.getState.call(this))},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s);var L=s;this.x1=L.x1,this.y1=L.y1,this.x2=L.x2,this.y2=L.y2},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L),this.x1=this.x1*s,this.y1=this.y1*L,this.x2=this.x2*s,this.y2=this.y2*L,this.adjustVisual(),this.adjustControlBox()},i}(pe),_e=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.strokeColor=k.defaultColor,D.strokeWidth=k.defaultStrokeWidth,D.strokeDasharray=k.defaultStrokeDasharray,D.strokePanel=new Se("Line color",k.defaultColorSet,k.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Ne("Line width",k.defaultStrokeWidths,k.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Ue("Line style",k.defaultStrokeDasharrays,k.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.visual&&s!==this.selectorLine&&s!==this.visibleLine)},i.prototype.createVisual=function(){this.visual=Y.createGroup(),this.selectorLine=Y.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=Y.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)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},i.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()),Y.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),Y.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),Y.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},i.prototype.setStrokeColor=function(s){this.strokeColor=s,this.adjustVisual(),this.colorChanged(s)},i.prototype.setStrokeWidth=function(s){this.strokeWidth=s,this.adjustVisual()},i.prototype.setStrokeDasharray=function(s){this.strokeDasharray=s,this.adjustVisual(),this.stateChanged()},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s);var L=s;this.strokeColor=L.strokeColor,this.strokeWidth=L.strokeWidth,this.strokeDasharray=L.strokeDasharray,this.createVisual(),this.adjustVisual()},i.typeName="LineMarker",i.title="Line marker",i.icon=' ',i}(Be),ce=function(P){function i(s,L,k,D){var $=P.call(this,s,D||' ')||this;return $.fonts=[],$.fontBoxes=[],$.fonts=L,$.currentFont=k,$.setCurrentFont=$.setCurrentFont.bind($),$}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");return L.style.overflow="hidden",L.style.flexGrow="2",this.fonts.forEach(function(k){var D=document.createElement("div");D.style.display="inline-block",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/s.fonts.length-5+"%",D.style.borderColor=k===s.currentFont?s.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){s.setCurrentFont(k,D)}),L.appendChild(D);var $=document.createElement("div");$.style.display="flex",$.style.minHeight="20px",$.style.flexGrow="2",$.style.fontFamily=k,$.style.overflow="hidden";var ve=document.createElement("div");ve.style.whiteSpace="nowrap",ve.style.overflow="hidden",ve.style.textOverflow="ellipsis",ve.innerHTML="The quick brown fox jumps over the lazy dog",$.appendChild(ve),D.appendChild($),s.fontBoxes.push(D)}),L},i.prototype.setCurrentFont=function(s,L){var k=this;this.currentFont=s,this.fontBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},i}(De),Ce=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.color="transparent",D.padding=5,D.DEFAULT_TEXT="your text here",D.text=D.DEFAULT_TEXT,D.isMoved=!1,D.color=k.defaultColor,D.fontFamily=k.defaultFontFamily,D.defaultSize={x:100,y:30},D.setColor=D.setColor.bind(D),D.setFont=D.setFont.bind(D),D.renderText=D.renderText.bind(D),D.sizeText=D.sizeText.bind(D),D.textEditDivClicked=D.textEditDivClicked.bind(D),D.showTextEditor=D.showTextEditor.bind(D),D.setSize=D.setSize.bind(D),D.positionTextEditor=D.positionTextEditor.bind(D),D.colorPanel=new Se("Color",k.defaultColorSet,k.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.fontFamilyPanel=new ce("Font",k.defaultFontFamilies,k.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D}return oe(i,P),i.prototype.ownsTarget=function(s){if(P.prototype.ownsTarget.call(this,s)||s===this.visual||s===this.textElement||s===this.bgRectangle)return!0;var L=!1;return this.textElement.childNodes.forEach(function(k){k===s&&(L=!0)}),L},i.prototype.createVisual=function(){this.visual=Y.createGroup(),this.bgRectangle=Y.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=Y.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(Y.createTransform()),this.textElement.transform.baseVal.appendItem(Y.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.isMoved=!1,this.pointerDownPoint=s,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(s),this._state="creating")},i.prototype.renderText=function(){var s=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(L){s.textElement.appendChild(Y.createTSpan(L.trim()===""?" ":L.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},i.prototype.getTextScale=function(){var s=this.textElement.getBBox(),L=1;if(s.width>0&&s.height>0){var k=(1*this.width-this.width*this.padding*2/100)/s.width,D=(1*this.height-this.height*this.padding*2/100)/s.height;L=Math.min(k,D)}return L},i.prototype.getTextPosition=function(s){var L=this.textElement.getBBox(),k=0,D=0;return L.width>0&&L.height>0&&(k=(this.width-L.width*s)/2,D=this.height/2-L.height*s/2),{x:k,y:D}},i.prototype.sizeText=function(){var s=this.textElement.getBBox(),L=this.getTextScale(),k=this.getTextPosition(L);k.y-=s.y*L,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+k.x+"px, "+k.y+"px) scale("+L+", "+L+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(k.x,k.y),this.textElement.transform.baseVal.getItem(1).setScale(L,L))},i.prototype.manipulate=function(s){P.prototype.manipulate.call(this,s),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(s.x-this.pointerDownPoint.x)>5||Math.abs(s.y-this.pointerDownPoint.y)>5)},i.prototype.resize=function(s){P.prototype.resize.call(this,s),this.isMoved=!0,this.setSize(),this.sizeText()},i.prototype.setSize=function(){P.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(Y.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Y.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},i.prototype.pointerUp=function(s){var L=this.state;L==="creating"&&(this._suppressMarkerCreateEvent=!0),P.prototype.pointerUp.call(this,s),this.setSize(),(L==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},i.prototype.showTextEditor=function(){var s=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(L){L.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var L=Number.parseFloat(s.textEditor.style.fontSize);s.textEditor.clientWidth>=Number.parseInt(s.textEditor.style.maxWidth)&&L>.9;)L-=.1,s.textEditor.style.fontSize=Math.max(L,.9)+"em"}),this.textEditor.addEventListener("keyup",function(L){L.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(L){if(L.clipboardData){var k=L.clipboardData.getData("text"),D=window.getSelection();if(!D.rangeCount)return!1;D.deleteFromDocument(),D.getRangeAt(0).insertNode(document.createTextNode(k)),L.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){s.textEditDivClicked(s.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},i.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var s=this.getTextScale(),L=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),k=this.textElement.getBBox(),D={x:k.width*s,y:k.height*s};L.x-=D.x/2,L.y-=D.y/2,this.textEditor.style.top=L.y+"px",this.textEditor.style.left=L.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-L.x+"px",this.textEditor.style.fontSize=Math.max(16*s,12)+"px",this.textElement.style.display="none"}},i.prototype.textEditDivClicked=function(s){this.text=s.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},i.prototype.select=function(){P.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},i.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),P.prototype.deselect.call(this)},i.prototype.dblClick=function(s,L){P.prototype.dblClick.call(this,s,L),this.showTextEditor()},i.prototype.setColor=function(s){this.textElement&&Y.setAttributes(this.textElement,[["fill",s]]),this.color=s,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(s)},i.prototype.setFont=function(s){this.textElement&&Y.setAttributes(this.textElement,[["font-family",s]]),this.fontFamily=s,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},i.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},i.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){var L=s;this.color=L.color,this.fontFamily=L.fontFamily,this.padding=L.padding,this.text=L.text,this.createVisual(),P.prototype.restoreState.call(this,s),this.setSize()},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L),this.setSize(),this.sizeText(),this.positionTextEditor()},i.typeName="TextMarker",i.title="Text marker",i.icon=' ',i}(Me),q=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.color="transparent",D.lineWidth=3,D.drawing=!1,D.pixelRatio=1,D.color=k.defaultColor,D.lineWidth=k.defaultStrokeWidth,D.pixelRatio=k.freehandPixelRatio,D.setColor=D.setColor.bind(D),D.addCanvas=D.addCanvas.bind(D),D.finishCreation=D.finishCreation.bind(D),D.setLineWidth=D.setLineWidth.bind(D),D.colorPanel=new Se("Color",k.defaultColorSet,k.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.lineWidthPanel=new Ne("Line width",k.defaultStrokeWidths,k.defaultStrokeWidth),D.lineWidthPanel.onWidthChanged=D.setLineWidth,D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.visual&&s!==this.drawingImage)},i.prototype.createVisual=function(){this.visual=Y.createGroup(),this.drawingImage=Y.createImage(),this.visual.appendChild(this.drawingImage);var s=Y.createTransform();this.visual.transform.baseVal.appendItem(s),this.addMarkerVisualToContainer(this.visual)},i.prototype.pointerDown=function(s,L){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(s.x,s.y),this.drawing=!0):P.prototype.pointerDown.call(this,s,L)},i.prototype.manipulate=function(s){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(s.x,s.y),this.canvasContext.stroke()):P.prototype.manipulate.call(this,s)},i.prototype.resize=function(s){P.prototype.resize.call(this,s),Y.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Y.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},i.prototype.pointerUp=function(s){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):P.prototype.pointerUp.call(this,s)},i.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)},i.prototype.select=function(){this.state==="creating"&&this.finishCreation(),P.prototype.select.call(this)},i.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),P.prototype.deselect.call(this)},i.prototype.finishCreation=function(){for(var s=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),L=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],k=L[0],D=L[1],$=L[2],ve=L[3],Oe=!1,He=0;He0&&(Oe=!0,Heve&&(ve=He),Ee>$&&($=Ee));if(Oe){this.left=k/this.pixelRatio,this.top=D/this.pixelRatio,this.width=($-k)/this.pixelRatio,this.height=(ve-D)/this.pixelRatio;var Ve=document.createElement("canvas");Ve.width=$-k,Ve.height=ve-D,Ve.getContext("2d").putImageData(this.canvasContext.getImageData(k,D,$-k,ve-D),0,0),this.drawingImgUrl=Ve.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},i.prototype.setDrawingImage=function(){Y.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),Y.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},i.prototype.setColor=function(s){this.color=s,this.colorChanged(s)},i.prototype.setLineWidth=function(s){this.lineWidth=s},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({drawingImgUrl:this.drawingImgUrl},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){this.createVisual(),P.prototype.restoreState.call(this,s),this.drawingImgUrl=s.drawingImgUrl,this.setDrawingImage()},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L),this.setDrawingImage()},i.typeName="FreehandMarker",i.title="Freehand marker",i.icon=' ',i}(Me),J=function(P){function i(s,L,k){var D=P.call(this,s,k||' ')||this;return D.typeBoxes=[],D.currentType=L,D.setCurrentType=D.setCurrentType.bind(D),D}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");L.style.display="flex",L.style.overflow="hidden",L.style.flexGrow="2";for(var k=function(ve){var Oe="both";switch(ve){case 0:Oe="both";break;case 1:Oe="start";break;case 2:Oe="end";break;case 3:Oe="none"}var He=document.createElement("div");if(He.style.display="flex",He.style.flexGrow="2",He.style.alignItems="center",He.style.justifyContent="space-between",He.style.padding="5px",He.style.borderWidth="2px",He.style.borderStyle="solid",He.style.borderColor=Oe===D.currentType?D.uiStyleSettings.toolboxAccentColor:"transparent",He.addEventListener("click",function(){s.setCurrentType(Oe,He)}),L.appendChild(He),Oe==="both"||Oe==="start"){var Ee=document.createElement("div");Ee.style.display="flex",Ee.style.alignItems="center",Ee.style.minHeight="20px",Ee.innerHTML=`
`,Ee.style.marginLeft="5px",He.appendChild(Ee)}var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.style.flexGrow="2";var qe=document.createElement("hr");if(qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop="3px solid "+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee"),qe.style.flexGrow="2",Ve.appendChild(qe),He.appendChild(Ve),Oe==="both"||Oe==="end"){var it=document.createElement("div");it.style.display="flex",it.style.alignItems="center",it.style.minHeight="20px",it.innerHTML=`
`,it.style.marginRight="5px",He.appendChild(it)}D.typeBoxes.push(He)},D=this,$=0;$<4;$++)k($);return L},i.prototype.setCurrentType=function(s,L){var k=this;this.currentType=s,this.typeBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},i}(De),Z=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.arrowType="end",D.arrowBaseHeight=10,D.arrowBaseWidth=10,D.getArrowPoints=D.getArrowPoints.bind(D),D.setArrowType=D.setArrowType.bind(D),D.arrowTypePanel=new J("Arrow type","end"),D.arrowTypePanel.onArrowTypeChanged=D.setArrowType,D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.arrow1&&s!==this.arrow2)},i.prototype.getArrowPoints=function(s,L){var k=this.arrowBaseWidth+2*this.strokeWidth,D=this.arrowBaseHeight+2*this.strokeWidth;return s-k/2+","+(L+D/2)+" "+s+","+(L-D/2)+" "+(s+k/2)+","+(L+D/2)},i.prototype.createTips=function(){this.arrow1=Y.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(Y.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=Y.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(Y.createTransform()),this.visual.appendChild(this.arrow2)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="creating"&&this.createTips()},i.prototype.adjustVisual=function(){if(P.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",Y.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),Y.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var s=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),L=this.arrow1.transform.baseVal.getItem(0);L.setRotate(s,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(L,0);var k=this.arrow2.transform.baseVal.getItem(0);k.setRotate(s+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(k,0)}},i.prototype.setArrowType=function(s){this.arrowType=s,this.adjustVisual(),this.stateChanged()},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({arrowType:this.arrowType},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s);var L=s;this.arrowType=L.arrowType,this.createTips(),this.adjustVisual()},i.typeName="ArrowMarker",i.title="Arrow marker",i.icon=' ',i}(_e),W=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.fillColor=k.defaultFillColor,D.strokeWidth=0,D.fillPanel=new Se("Color",k.defaultColorSet,k.defaultFillColor),D.fillPanel.onColorChanged=D.setFillColor,D}return oe(i,P),Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=P.prototype.getState.call(this);return s.typeName=i.typeName,s},i.typeName="CoverMarker",i.title="Cover marker",i.icon=' ',i}(Ie),H=function(P){function i(s,L,k,D){var $=P.call(this,s,D||' ')||this;return $.opacities=[],$.opacityBoxes=[],$.opacities=L,$.currentOpacity=k,$.setCurrentOpacity=$.setCurrentOpacity.bind($),$}return oe(i,P),i.prototype.getUi=function(){var s=this,L=document.createElement("div");return L.style.display="flex",L.style.overflow="hidden",L.style.flexGrow="2",L.style.justifyContent="space-between",this.opacities.forEach(function(k){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="center",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=k===s.currentOpacity?s.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){s.setCurrentOpacity(k,D)}),L.appendChild(D);var $=document.createElement("div");$.innerText=100*k+"%",D.appendChild($),s.opacityBoxes.push(D)}),L},i.prototype.setCurrentOpacity=function(s,L){var k=this;this.currentOpacity=s,this.opacityBoxes.forEach(function(D){D.style.borderColor=D===L?k.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},i}(De),K=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.setOpacity=D.setOpacity.bind(D),D.fillColor=k.defaultHighlightColor,D.strokeWidth=0,D.opacity=k.defaultHighlightOpacity,D.fillPanel=new Se("Color",k.defaultColorSet,D.fillColor),D.fillPanel.onColorChanged=D.setFillColor,D.opacityPanel=new H("Opacity",k.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return oe(i,P),i.prototype.setOpacity=function(s){this.opacity=s,this.visual&&Y.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=P.prototype.getState.call(this);return s.typeName=i.typeName,s},i.typeName="HighlightMarker",i.title="Highlight marker",i.icon=' ',i}(W),X=' ',ie=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.bgColor="transparent",D.tipPosition={x:0,y:0},D.tipBase1Position={x:0,y:0},D.tipBase2Position={x:0,y:0},D.tipMoving=!1,D.color=k.defaultStrokeColor,D.bgColor=k.defaultFillColor,D.fontFamily=k.defaultFontFamily,D.defaultSize={x:100,y:30},D.setBgColor=D.setBgColor.bind(D),D.getTipPoints=D.getTipPoints.bind(D),D.positionTip=D.positionTip.bind(D),D.setTipPoints=D.setTipPoints.bind(D),D.colorPanel=new Se("Text color",k.defaultColorSet,D.color,' '),D.colorPanel.onColorChanged=D.setColor,D.bgColorPanel=new Se("Fill color",k.defaultColorSet,D.bgColor,X),D.bgColorPanel.onColorChanged=D.setBgColor,D.fontFamilyPanel=new ce("Font",k.defaultFontFamilies,k.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D.tipGrip=new Fe,D.tipGrip.visual.transform.baseVal.appendItem(Y.createTransform()),D.controlBox.appendChild(D.tipGrip.visual),D}return oe(i,P),i.prototype.ownsTarget=function(s){return P.prototype.ownsTarget.call(this,s)||this.tipGrip.ownsTarget(s)||this.tip===s},i.prototype.createTip=function(){Y.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=Y.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},i.prototype.pointerDown=function(s,L){this.state==="new"&&P.prototype.pointerDown.call(this,s,L),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(L)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):P.prototype.pointerDown.call(this,s,L)},i.prototype.pointerUp=function(s){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,P.prototype.pointerUp.call(this,s);else{var L=this.state==="creating";P.prototype.pointerUp.call(this,s),this.setTipPoints(L),this.positionTip()}},i.prototype.manipulate=function(s){if(this.tipMoving){var L=this.unrotatePoint(s);this.tipPosition={x:L.x-this.manipulationStartLeft,y:L.y-this.manipulationStartTop},this.positionTip()}else P.prototype.manipulate.call(this,s)},i.prototype.setBgColor=function(s){this.bgRectangle&&this.tip&&(Y.setAttributes(this.bgRectangle,[["fill",s]]),Y.setAttributes(this.tip,[["fill",s]])),this.bgColor=s,this.fillColorChanged(s)},i.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},i.prototype.setTipPoints=function(s){s===void 0&&(s=!1);var L=Math.min(this.height/2,15),k=this.height/5;s&&(this.tipPosition={x:L+k/2,y:this.height+20});var D=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?D ',i}(Ce),ae=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.strokeColor=k.defaultColor,D.strokeWidth=k.defaultStrokeWidth,D.strokeDasharray=k.defaultStrokeDasharray,D.fillColor=k.defaultFillColor,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.setOpacity=D.setOpacity.bind(D),D.createVisual=D.createVisual.bind(D),D.strokePanel=new Se("Line color",te(k.defaultColorSet,["transparent"]),k.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.fillPanel=new Se("Fill color",te(k.defaultColorSet,["transparent"]),D.fillColor,X),D.fillPanel.onColorChanged=D.setFillColor,D.strokeWidthPanel=new Ne("Line width",k.defaultStrokeWidths,k.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Ue("Line style",k.defaultStrokeDasharrays,k.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D.opacityPanel=new H("Opacity",k.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.visual)},i.prototype.createVisual=function(){this.visual=Y.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)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="new"&&(this.createVisual(),this.moveVisual(s),this._state="creating")},i.prototype.manipulate=function(s){P.prototype.manipulate.call(this,s)},i.prototype.resize=function(s){P.prototype.resize.call(this,s),this.setSize()},i.prototype.setSize=function(){P.prototype.setSize.call(this),Y.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},i.prototype.pointerUp=function(s){P.prototype.pointerUp.call(this,s),this.setSize()},i.prototype.setStrokeColor=function(s){this.strokeColor=s,this.visual&&Y.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(s),this.stateChanged()},i.prototype.setFillColor=function(s){this.fillColor=s,this.visual&&Y.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(s),this.stateChanged()},i.prototype.setStrokeWidth=function(s){this.strokeWidth=s,this.visual&&Y.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},i.prototype.setStrokeDasharray=function(s){this.strokeDasharray=s,this.visual&&Y.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},i.prototype.setOpacity=function(s){this.opacity=s,this.visual&&Y.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){var L=s;this.fillColor=L.fillColor,this.strokeColor=L.strokeColor,this.strokeWidth=L.strokeWidth,this.strokeDasharray=L.strokeDasharray,this.opacity=L.opacity,this.createVisual(),P.prototype.restoreState.call(this,s),this.setSize()},i.prototype.scale=function(s,L){P.prototype.scale.call(this,s,L),this.setSize()},i.typeName="EllipseMarker",i.title="Ellipse marker",i.icon=' ',i}(Me),ge=function(P){function i(s,L,k){return P.call(this,s,L,k)||this}return oe(i,P),Object.defineProperty(i.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.tip1&&s!==this.tip2)},i.prototype.createTips=function(){this.tip1=Y.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(Y.createTransform()),this.visual.appendChild(this.tip1),this.tip2=Y.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(Y.createTransform()),this.visual.appendChild(this.tip2)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.state==="creating"&&this.createTips()},i.prototype.adjustVisual=function(){if(P.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(Y.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()]]),Y.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 s=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),L=this.tip1.transform.baseVal.getItem(0);L.setRotate(s,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(L,0);var k=this.tip2.transform.baseVal.getItem(0);k.setRotate(s+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(k,0)}},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=P.prototype.getState.call(this);return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s),this.createTips(),this.adjustVisual()},i.typeName="MeasurementMarker",i.title="Measurement marker",i.icon=' ',i}(_e),je=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.strokePanel.colors=k.defaultColorSet,D.fillColor="transparent",D}return oe(i,P),Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=P.prototype.getState.call(this);return s.typeName=i.typeName,s},i.typeName="EllipseFrameMarker",i.title="Ellipse frame marker",i.icon=' ',i}(ae),ze=function(){function P(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),P.prototype.addUndoStep=function(i){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(i)||(this.undoStack.push(i),JSON.stringify(this.lastRedoStep)!==JSON.stringify(i)&&this.redoStack.splice(0,this.redoStack.length))},P.prototype.replaceLastUndoStep=function(i){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=i)},P.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},P.prototype.undo=function(){if(this.undoStack.length>1){var i=this.undoStack.pop();return i!==void 0&&this.redoStack.push(i),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},P.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},P}(),We=function(P){function i(s,L,k){var D=P.call(this,s,L,k)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.curveX=0,D.curveY=0,D.manipulationStartCurveX=0,D.manipulationStartCurveY=0,D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.positionGrips=D.positionGrips.bind(D),D.addControlGrips=D.addControlGrips.bind(D),D.adjustVisual=D.adjustVisual.bind(D),D.setupControlBox=D.setupControlBox.bind(D),D.resize=D.resize.bind(D),D.strokeColor=k.defaultColor,D.strokeWidth=k.defaultStrokeWidth,D.strokeDasharray=k.defaultStrokeDasharray,D.strokePanel=new Se("Line color",k.defaultColorSet,k.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Ne("Line width",k.defaultStrokeWidths,k.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Ue("Line style",k.defaultStrokeDasharrays,k.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return oe(i,P),i.prototype.ownsTarget=function(s){return!(!P.prototype.ownsTarget.call(this,s)&&s!==this.visual&&s!==this.selectorCurve&&s!==this.visibleCurve&&!this.curveGrip.ownsTarget(s))},i.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},i.prototype.createVisual=function(){this.visual=Y.createGroup(),this.selectorCurve=Y.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=Y.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)},i.prototype.pointerDown=function(s,L){P.prototype.pointerDown.call(this,s,L),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=s.x,this.curveY=s.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(L)&&(this.activeGrip=this.curveGrip,this._state="resize")},i.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),Y.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),Y.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),Y.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},i.prototype.setupControlBox=function(){P.prototype.setupControlBox.call(this),this.curveControlLine1=Y.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=Y.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)},i.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,P.prototype.addControlGrips.call(this)},i.prototype.positionGrips=function(){P.prototype.positionGrips.call(this);var s=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-s/2,this.curveY-s/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()))},i.prototype.manipulate=function(s){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+s.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+s.y-this.manipulationStartY),P.prototype.manipulate.call(this,s)},i.prototype.resize=function(s){this.activeGrip===this.curveGrip&&(this.curveX=s.x,this.curveY=s.y),P.prototype.resize.call(this,s),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},i.prototype.setStrokeColor=function(s){this.strokeColor=s,this.adjustVisual(),this.colorChanged(s)},i.prototype.setStrokeWidth=function(s){this.strokeWidth=s,this.adjustVisual()},i.prototype.setStrokeDasharray=function(s){this.strokeDasharray=s,this.adjustVisual()},i.prototype.scale=function(s,L){this.curveX=this.curveX*s,this.curveY=this.curveY*L,P.prototype.scale.call(this,s,L)},Object.defineProperty(i.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),i.prototype.getState=function(){var s=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},P.prototype.getState.call(this));return s.typeName=i.typeName,s},i.prototype.restoreState=function(s){P.prototype.restoreState.call(this,s);var L=s;this.strokeColor=L.strokeColor,this.strokeWidth=L.strokeWidth,this.strokeDasharray=L.strokeDasharray,this.curveX=L.curveX,this.curveY=L.curveY,this.createVisual(),this.adjustVisual()},i.typeName="CurveMarker",i.title="Curve marker",i.icon=' ',i}(Be),Ye=function(){function P(i,s){s===void 0&&(s=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=i,this.cancelable=s}return Object.defineProperty(P.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),P.prototype.preventDefault=function(){this._defaultPrevented=!0},P}(),$e=function(P){function i(s,L,k){var D=P.call(this,s,!1)||this;return D.dataUrl=L,D.state=k,D}return oe(i,P),i}(Ye),Ge=function(P){function i(s,L,k){k===void 0&&(k=!1);var D=P.call(this,s,k)||this;return D.marker=L,D}return oe(i,P),i}(Ye),tt=function(){function P(){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 P.prototype.addEventListener=function(i,s){this[i].push(s)},P.prototype.removeEventListener=function(i,s){var L=this[i].indexOf(s);L>-1&&this[i].splice(L,1)},P}(),rt=function(){function P(i){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ae,this._isOpen=!1,this.undoRedoManager=new ze,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new tt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=P.instanceCounter++,this.styles=new xe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=i,this.targetRoot=document.body,this.width=i.clientWidth,this.height=i.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(P.prototype,"ALL_MARKER_TYPES",{get:function(){return[ke,q,Z,Ce,je,ae,K,ie,ge,W,_e,We]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ke,q,Z,Ce,ae,K,ie]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ke,q,Z,Ce,K]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(i){var s=this;this._availableMarkerTypes.splice(0),i.forEach(function(L){if(typeof L=="string"){var k=s.ALL_MARKER_TYPES.find(function(D){return D.typeName===L});k!==void 0&&s._availableMarkerTypes.push(k)}else s._availableMarkerTypes.push(L)})},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(i){this._zoomLevel=i,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),P.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),fe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},P.prototype.show=function(){var i=this;this.styles.styleSheetRoot===void 0&&Le.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Le.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(s){return s(new Ye(i))})},P.prototype.render=function(){return ue(this,void 0,void 0,function(){var i;return he(this,function(s){switch(s.label){case 0:return this.setCurrentMarker(),(i=new Re).naturalSize=this.renderAtNaturalSize,i.imageType=this.renderImageType,i.imageQuality=this.renderImageQuality,i.markersOnly=this.renderMarkersOnly,i.width=this.renderWidth,i.height=this.renderHeight,[4,i.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return s.sent(),[4,i.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,s.sent()]}})})},P.prototype.close=function(i){var s=this;if(i===void 0&&(i=!1),this.isOpen){var L=!1;i||this.eventListeners.beforeclose.forEach(function(k){var D=new Ye(s,!0);k(D),D.defaultPrevented&&(L=!0)}),L||(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(k){return k(new Ye(s))}),this.detachEvents(),this._isOpen=!1)}},P.prototype.addMarkersToToolbar=function(){for(var i,s=[],L=0;Lthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*i:this.editorCanvas.clientWidth,L=s ',i.title="Powered by marker.js",i.style.display="grid",i.style.alignItems="center",i.style.justifyItems="center",i.style.padding="3px",i.style.width="20px",i.style.height="20px",this.logoUI.appendChild(i),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},P.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")},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.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 i=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=i+"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(i),1),i.dispose()},P.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())},P.prototype.toolbarButtonClicked=function(i,s){if(i==="marker"&&s!==void 0)this.createNewMarker(s);else if(i==="action")switch(s){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()}},P.prototype.deleteSelectedMarker=function(){var i=this;if(this._currentMarker!==void 0){var s=!1;if(this.eventListeners.markerbeforedelete.forEach(function(k){var D=new Ge(i,i._currentMarker,!0);k(D),D.defaultPrevented&&(s=!0)}),!s){var L=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(k){return k(new Ge(i,L))})}}},P.prototype.clear=function(){var i=this,s=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function($){var ve=new Ge(i,void 0,!0);$(ve),ve.defaultPrevented&&(s=!0)}),!s)){this.setCurrentMarker();for(var L=function($){var ve=k.markers[$];k.setCurrentMarker(k.markers[$]),k._currentMarker.dispose(),k.markerImage.removeChild(k._currentMarker.container),k.markers.splice(k.markers.indexOf(k._currentMarker),1),k.eventListeners.markerdelete.forEach(function(Oe){return Oe(new Ge(i,ve))})},k=this,D=this.markers.length-1;D>=0;D--)L(D);this.addUndoStep()}},Object.defineProperty(P.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),P.prototype.showNotesEditor=function(){var i;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=(i=this._currentMarker.notes)!==null&&i!==void 0?i:"",this.overlayContainer.appendChild(this.notesArea))},P.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)},P.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},P.prototype.addUndoStep=function(){var i=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var s=this.getState(),L=this.undoRedoManager.getLastUndoStep();if(!L||L.width===s.width&&L.height===s.height){var k=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(s),k1&&this.panTo({x:i.clientX,y:i.clientY}))},P.prototype.onPointerUp=function(i){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(i.clientX,i.clientY)),this.isDragging=!1,this.addUndoStep()},P.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},P.prototype.onKeyUp=function(i){this._currentMarker===void 0||this.notesArea!==void 0||i.key!=="Delete"&&i.key!=="Backspace"||this.deleteSelectedMarker()},P.prototype.clientToLocalCoordinates=function(i,s){var L=this.markerImage.getBoundingClientRect();return{x:(i-L.left)/this.zoomLevel,y:(s-L.top)/this.zoomLevel}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var i=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=i+"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()},P.prototype.addLicenseKey=function(i){fe.addKey(i)},P.prototype.addEventListener=function(i,s){this.eventListeners.addEventListener(i,s)},P.prototype.removeEventListener=function(i,s){this.eventListeners.removeEventListener(i,s)},P.prototype.renderState=function(i){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(i),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(P.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),P.prototype.focus=function(){var i=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(s){return s(new Ye(i))}))},P.prototype.blur=function(){var i=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(s){return s(new Ye(i))}))},P.instanceCounter=0,P}();/* **********************************
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 st=function(P,i){return(st=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,L){s.__proto__=L}||function(s,L){for(var k in L)Object.prototype.hasOwnProperty.call(L,k)&&(s[k]=L[k])})(P,i)};function at(P,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=P}st(P,i),P.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}function Qe(P,i,s,L){return new(s||(s=Promise))(function(k,D){function $(He){try{Oe(L.next(He))}catch(Ee){D(Ee)}}function ve(He){try{Oe(L.throw(He))}catch(Ee){D(Ee)}}function Oe(He){var Ee;He.done?k(He.value):(Ee=He.value,Ee instanceof s?Ee:new s(function(Ve){Ve(Ee)})).then($,ve)}Oe((L=L.apply(P,i||[])).next())})}function pt(P,i){var s,L,k,D,$={label:0,sent:function(){if(1&k[0])throw k[1];return k[1]},trys:[],ops:[]};return D={next:ve(0),throw:ve(1),return:ve(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function ve(Oe){return function(He){return function(Ee){if(s)throw new TypeError("Generator is already executing.");for(;$;)try{if(s=1,L&&(k=2&Ee[0]?L.return:Ee[0]?L.throw||((k=L.return)&&k.call(L),0):L.next)&&!(k=k.call(L,Ee[1])).done)return k;switch(L=0,k&&(Ee=[2&Ee[0],k.value]),Ee[0]){case 0:case 1:k=Ee;break;case 4:return $.label++,{value:Ee[1],done:!1};case 5:$.label++,L=Ee[1],Ee=[0];continue;case 7:Ee=$.ops.pop(),$.trys.pop();continue;default:if(!(k=$.trys,(k=k.length>0&&k[k.length-1])||Ee[0]!==6&&Ee[0]!==2)){$=0;continue}if(Ee[0]===3&&(!k||Ee[1]>k[0]&&Ee[1]0&&s>0){var L=new Mt(i,s),k=L.ratio>=1?20:L.getHorizontalLength(20),D=L.ratio<1?20:L.getVerticalLength(20),$=document.createElementNS("http://www.w3.org/2000/svg","svg");$.setAttribute("xmlns","http://www.w3.org/2000/svg"),$.setAttribute("viewBox","0 0 24 24"),document.body.appendChild($);var ve=Ke.createDefs();$.appendChild(ve);var Oe=Ke.createElement("clipPath",[["id","text-bg-clip"]]);ve.appendChild(Oe);var He=Ke.createPath(Ke.getHollowRectanglePath((24-k)/2,(24-D)/2,k,D,(24-k)/2+2,(24-D)/2+2,k-4,D-4));$.appendChild(He);var Ee=Ke.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(Ke.createTSpan(i+":"+s)),$.appendChild(Ee);var Ve=Ee.getBBox();Ke.setAttributes(Ee,[["x",((24-Ve.width)/2).toString()],["y",((24-Ve.height)/2-Ve.y).toString()]]);var qe=Ke.createPath(Ke.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ve.width))/2,(24-Math.ceil(Ve.height))/2,Math.ceil(Ve.width),Math.ceil(Ve.height)));return Oe.appendChild(qe),Ke.setAttributes(He,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild($),$.outerHTML}return' '},P}(),Ft=function(P){function i(s,L,k){var D=P.call(this,s,L)||this;return D.isDropdownOpen=!1,D.onClick=D.dropdownButtonClicked,D.dropdownButtons=k,D}return at(i,P),i.prototype.setupDropdown=function(){var s=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(L){L.className=s.className,L.colorsClassName=s.colorsClassName,s.dropdownBlock.appendChild(L.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},i.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},i.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},i.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},i.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},i.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},i}(ct),Ct=function(){function P(i,s){this.GRIP_SIZE=10,this.color=i,this.fillColor=s,this.visual=Ke.createGroup(),this.visual.appendChild(Ke.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ke.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(i){return i===this.visual||i===this.visual.childNodes[0]||i===this.visual.childNodes[1]},P.prototype.setCenter=function(i,s){this.visual.childNodes.forEach(function(L){return Ke.setAttributes(L,[["cx",i.toString()],["cy",s.toString()]])})},P}(),jt=function(){function P(i,s,L,k){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=i,this.canvasHeight=s,this.margin=L,this.container=k,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(P.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(i){this._aspectRatio=i,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(i){this._isGridVisible=i,this.gridContainer&&Ke.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(i){this._zoomFactor=i,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),P.prototype.open=function(){var i=this;this.cropShadeElement=Ke.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ke.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var s=0;sthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-s.height/2),Ke.setAttributes(this.cropRectElement,[["x",s.x.toString()],["y",s.y.toString()],["width",s.width.toString()],["height",s.height.toString()]]);var L=s.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(D,$){var ve=s.y+L*($+1);Ke.setAttributes(D,[["x1",""+s.x],["y1",""+ve],["x2",""+(s.x+s.width)],["y2",""+ve]])});var k=s.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(D,$){var ve=s.x+k*($+1);Ke.setAttributes(D,[["x1",""+ve],["y1",""+s.y],["x2",""+ve],["y2",""+(s.y+s.height)]])}),Ke.setAttributes(this.cropShadeElement,[["d",Ke.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,s.x,s.y,s.width,s.height)]]),this.topLeftGrip.setCenter(s.x,s.y),this.topRightGrip.setCenter(s.x+s.width,s.y),this.bottomLeftGrip.setCenter(s.x,s.y+s.height),this.bottomRightGrip.setCenter(s.x+s.width,s.y+s.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},P.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)},P.prototype.clientToLocalCoordinates=function(i,s){var L=this.container.getBoundingClientRect();return{x:i-L.left+this.margin,y:s-L.top+this.margin}},P.prototype.onPointerDown=function(i){this.container.setPointerCapture(i.pointerId),this.previousPoint=this.clientToLocalCoordinates(i.clientX,i.clientY),this.cropRectElement===i.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(i.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(i.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(i.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(i.target)&&(this.activeGrip=this.bottomRightGrip)},P.prototype.onPointerMove=function(i){if(this.isMoving)this.move(this.clientToLocalCoordinates(i.clientX,i.clientY));else if(this.activeGrip){var s=this.clientToLocalCoordinates(i.clientX,i.clientY);this.resize(s)}i.preventDefault()},P.prototype.onPointerUp=function(i){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(i.pointerId)},P.prototype.move=function(i){var s=i.x-this.previousPoint.x,L=i.y-this.previousPoint.y;this.zoomFactor!==1&&(s=-s/this.zoomFactor,L=-L/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+s),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+L),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=i},P.prototype.resize=function(i){var s=Object.assign({},this.cropRect),L=i.x-this.previousPoint.x,k=i.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:s.x+Lthis.canvasWidth*this.zoomFactor&&(L=this.canvasWidth*this.zoomFactor-s.width),s.width+=L}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(s.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(L),s.height=this.aspectRatio.getVerticalLength(s.width)):(s.y+=k,s.height=this.cropRect.y+this.cropRect.height-s.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?s.height=this.aspectRatio.getVerticalLength(s.width):s.height+=k}s.width<10&&(s.x=this.cropRect.x,s.width=10),s.height<10&&(s.y=this.cropRect.y,s.height=10),this.previousPoint=i,s.x>=this.margin&&s.y>=this.margin&&s.x-this.margin+s.width<=this.canvasWidth&&s.y-this.margin+s.height<=this.canvasHeight&&(this.cropRect=s,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},P.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var i=this.cropRect.x+this.cropRect.width/2,s=this.cropRect.y+this.cropRect.height/2,L=this.aspectRatio.getHorizontalLength(this.cropRect.height),k=this.aspectRatio.getVerticalLength(this.cropRect.width);L/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=i-this.cropRect.width/2,this.cropRect.y=s-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)}},P.prototype.getRescaledRect=function(i,s,L,k,D,$){var ve=L/i,Oe=k/s;return{x:(D.x-$)*ve+$,y:(D.y-$)*Oe+$,width:D.width*ve,height:D.height*Oe}},P.prototype.scaleCanvas=function(i,s){var L=this.getRescaledRect(this.canvasWidth,this.canvasHeight,i,s,this.cropRect,this.margin);this.canvasWidth=i,this.canvasHeight=s,this.onCropChange&&this.onCropChange(L),this.setCropRectangle(L)},P}(),Wt=function(){function P(i){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=i,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(P.prototype,"angle",{get:function(){return this._angle},set:function(i){this._angle=i,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),P.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},P.prototype.onPointerDown=function(i){this.controlContainer.setPointerCapture(i.pointerId),this.isDragging=!0,this.previousPoint={x:i.clientX,y:i.clientY}},P.prototype.onPointerMove=function(i){this.isDragging&&(this.onAngleChange&&this.onAngleChange((i.clientX-this.previousPoint.x)/5),this.previousPoint.x=i.clientX)},P.prototype.onPointerUp=function(i){this.isDragging&&this.onAngleChange&&this.onAngleChange((i.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(i.pointerId)},P.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var i=this.angleLabelText.getBBox();Ke.setAttributes(this.angleLabelElement,[["x",((this.width-i.width)/2).toString()],["y",(this.height/2).toString()]])}},P.prototype.positionScaleShape=function(){if(this.scaleShape){var i=this.scaleShape.transform.baseVal.getItem(0);i.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(i,0)}},P.prototype.getVisual=function(){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width",this.width+"px"),i.setAttribute("height",this.height+"px"),i.setAttribute("viewBox","0 0 "+this.width+" "+this.height),i.style.flexShrink="0",document.body.appendChild(i);for(var s="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,L=1;L<=this.width/5+10;L++){var k=L%5==0?this.height/3:this.height/6;s+="h4v"+-k+"h1v"+k}s+="v1H0Z",this.scaleShape=Ke.createPath(s);var D=Ke.createTransform();this.scaleShape.transform.baseVal.appendItem(D),i.appendChild(this.scaleShape),this.angleLabelElement=Ke.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ke.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var $=Ke.createTSpan("");return $.innerHTML="°",this.angleLabelElement.appendChild($),i.appendChild(this.angleLabelElement),document.body.removeChild(i),i},P}(),Ht=function(){function P(){this.naturalSize=!1,this.imageType="image/png"}return P.prototype.rasterize=function(i,s,L,k,D,$,ve){var Oe=this;return new Promise(function(He){var Ee=document.createElement("canvas");Ee.width=i.width.baseVal.value-2*k,Ee.height=i.height.baseVal.value-2*k;var Ve=1,qe=1;Oe.naturalSize===!0?(Ve=s.naturalWidth/(i.width.baseVal.value-2*k)/$,qe=s.naturalHeight/(i.height.baseVal.value-2*k)/ve,Ee.width=s.naturalWidth/$,Ee.height=s.naturalHeight/ve):Oe.width!==void 0&&Oe.height!==void 0&&(Ve=Oe.width/L.width,qe=Oe.height/L.height,Ee.width*=Ve,Ee.height*=qe);var it=Ee.getContext("2d");it.translate(Ee.width/2,Ee.height/2),it.rotate(D*Math.PI/180),it.scale($,ve),it.translate(-Ee.width/2,-Ee.height/2),it.drawImage(s,0,0,Ee.width,Ee.height);var gt=document.createElement("canvas");gt.width=L.width*Ve,gt.height=L.height*qe,gt.getContext("2d").putImageData(it.getImageData((L.x-k)*Ve,(L.y-k)*qe,L.width*Ve,L.height*qe),0,0),He(gt.toDataURL(Oe.imageType,Oe.imageQuality))})},P}(),Gt=function(){function P(i){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=P.instanceCounter++,this.styles=new Tt(this.instanceNo),this.target=i,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(i){this._zoomToCropEnabled=i,i?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(i){this._isGridVisible=i,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"gridLines",{get:function(){return this._gridLines},set:function(i){this._gridLines=i,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(i){this._rotationAngle=i,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"aspectRatio",{get:function(){var i;return(i=this._aspectRatio)!==null&&i!==void 0?i:this.aspectRatios[0]},set:function(i){this._aspectRatio=i},enumerable:!1,configurable:!0}),P.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},P.prototype.show=function(){this.showUI(),this.open()},P.prototype.close=function(i){i===void 0&&(i=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),i||this.closeEventListeners.forEach(function(s){return s()}),this._isOpen=!1)},P.prototype.addRenderEventListener=function(i){this.renderEventListeners.push(i)},P.prototype.removeRenderEventListener=function(i){this.renderEventListeners.indexOf(i)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(i),1)},P.prototype.addCloseEventListener=function(i){this.closeEventListeners.push(i)},P.prototype.removeCloseEventListener=function(i){this.closeEventListeners.indexOf(i)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(i),1)},P.prototype.setupResizeObserver=function(){var i=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){i.resize(i.target.clientWidth,i.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))},P.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var i=1*this.target.clientWidth/this.target.clientHeight,s=this.contentDiv.clientWidth/i>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*i:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,L=s+2*this.CANVAS_MARGINi+this.CANVAS_MARGIN?this.target.offsetTop-(i+this.CANVAS_MARGIN):0;this.coverDiv.style.top=s+"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},P.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},P.prototype.addTopToolbar=function(){var i=this;this.topToolbar=new Pt,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 s=new St;s.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(s);var L=[];this.aspectRatios.forEach(function(qe){var it=new ct(Lt.getIcon(qe.horizontal,qe.vertical),qe.horizontal===0&&qe.vertical===0?"FREE":qe.horizontal+":"+qe.vertical);it.onClick=function(){return i.ratioButtonClicked(qe)},L.push(it)}),this.aspectRatioButton=new Ft(Lt.getIcon(0,0),"Aspect ratio",L),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,s.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var k=new ct(' ',"Toggle grid");k.isActive=this.isGridVisible,k.onClick=function(){i.isGridVisible=!i.isGridVisible,k.isActive=i.isGridVisible},s.addButton(k);var D=new ct(' ',"Zoom to selection");if(D.isActive=this.zoomToCropEnabled,D.onClick=function(){i.zoomToCropEnabled=!i.zoomToCropEnabled,D.isActive=i.zoomToCropEnabled},s.addButton(D),!xt.isLicensed){var $=new It;this.topToolbar.addElementBlock($);var ve=document.createElement("div");ve.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Oe=document.createElement("a");Oe.style.color="currentColor",Oe.href="https://markerjs.com/products/cropro",Oe.target="_blank",Oe.innerHTML=' ',ve.appendChild(Oe),$.addElement(ve)}var He=new St;He.minWidth=3*this.toolbarHeight+"px",He.contentAlign="end",this.topToolbar.addButtonBlock(He);var Ee=new ct(' ',"OK");Ee.onClick=this.startRenderAndClose,He.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ve=new ct(' ',"Close");Ve.onClick=this.close,He.addButton(Ve),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},P.prototype.addBottomToolbar=function(){var i=this;this.bottomToolbar=new Pt,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 s=new St;s.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(s);var L=new ct(' ',"Rotate left");L.onClick=this.rotateLeftButtonClicked,s.addButton(L);var k=new ct(' ',"Rotate right");k.onClick=this.rotateRightButtonClicked,s.addButton(k);var D=new It;D.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(D),this.straightener=new Wt("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(He){i.rotateBy(He),i.straightener.angle=i.rotationAngle},D.addElement(this.straightener.getUI());var $=new St;$.minWidth=2*this.toolbarHeight+"px",$.contentAlign="end",this.bottomToolbar.addButtonBlock($);var ve=new ct(' ',"Flip horizontal");ve.onClick=this.flipHorizontallyButtonClicked,$.addButton(ve);var Oe=new ct(' ',"Flip vertical");Oe.onClick=this.flipVerticallyButtonClicked,$.addButton(Oe)},P.prototype.ratioButtonClicked=function(i){this.aspectRatio=i,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},P.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Lt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},P.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},P.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},P.prototype.restoreState=function(i){if(i){var s=this.cropLayer.getRescaledRect(i.width,i.height,this.imageWidth,this.imageHeight,i.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(s),this.cropRectChanged(s),this.flippedHorizontally=i.flippedHorizontally,this.flippedVertically=i.flippedVertically,this.applyFlip(),this.rotationAngle=i.rotationAngle,this.applyRotation()}},P.prototype.clientToLocalCoordinates=function(i,s){var L=this.cropImage.getBoundingClientRect();return{x:i-L.left,y:s-L.top}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var i=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=i+"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()},P.prototype.rotateLeftButtonClicked=function(){var i=this.rotationAngle-90;this.rotationAngle%90!=0&&(i+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(i)},P.prototype.rotateRightButtonClicked=function(){var i=this.rotationAngle+90;this.rotationAngle%90!=0&&(i-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(i)},P.prototype.rotateTo=function(i){i=(i=i>180?i-360:i)<=-180?i+360:i,this.rotationAngle=i,this.applyRotation()},P.prototype.rotateBy=function(i){this.rotateTo((this.rotationAngle+i)%360)},P.prototype.applyRotation=function(){var i=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var s=this.editingTargetRotationContainer.transform.baseVal.getItem(0);s.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(s,0);var L=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/L.width,this.imageHeight/L.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=i},P.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},P.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},P.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},P.prototype.startRenderAndClose=function(){return Qe(this,void 0,void 0,function(){var i,s;return pt(this,function(L){switch(L.label){case 0:return[4,this.render()];case 1:return i=L.sent(),s=this.getState(),this.renderEventListeners.forEach(function(k){return k(i,s)}),this.close(!0),[2]}})})},P.prototype.render=function(){return Qe(this,void 0,void 0,function(){var i;return pt(this,function(s){switch(s.label){case 0:return(i=new Ht).naturalSize=this.renderAtNaturalSize,i.imageType=this.renderImageType,i.imageQuality=this.renderImageQuality,i.width=this.renderWidth,i.height=this.renderHeight,this.unzoomFromCrop(),Ke.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,i.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 s.sent(),[4,i.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,s.sent()]}})})},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ut("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 ut("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ut("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var i=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ut("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*i)+`px;
height: `+(this.toolbarHeight-2*i)+`px;
padding: `+i+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ut("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ut("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new mt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new mt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new ut("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 ut("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new ut("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 ut("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*i)+`px;
padding: `+i+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new ut("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},P.instanceCounter=0,P}(),Kt=ee("8hTe"),kt=ee.n(Kt),zt=/]*>/g;function Vt(P){var i=document.createElement("div");return i.innerHTML=P,i.childNodes.length===0?"":i.childNodes[0].nodeValue}var rr=Xe.a=function(P){var i=P.value,s=i===void 0?"":i,L=P.edit,k=L===void 0?!1:L,D=P.className,$=P.showTextOnly,ve=P.showLines,Oe=P.replaces,He=P.zoomImg,Ee=P.hasMask,Ve=P.style,qe=Ve===void 0?{}:Ve,it=P.stylesPrev,gt=it===void 0?{}:it,vt=String(s),ft=Object(w.useRef)(),yt=Object(w.useRef)(),Xt=Object(w.useState)(""),Nt=Object(N.a)(Xt,2),wt=Nt[0],Et=Nt[1],Yt=Object(w.useState)("office"),Bt=Object(N.a)(Yt,2),$t=Bt[0],At=Bt[1],Jt=function(){var et=new Gt(yt.current);et.displayMode="popup",et.addRenderEventListener(function(){var dt=Object(R.a)(O.a.mark(function Ze(ht){var nt;return O.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:return ft.current.style.display="none",lt.next=3,Object(be.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ht}});case 3:nt=lt.sent,nt!=null&&nt.id&&Oe(yt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(nt==null?void 0:nt.id,"?type=").concat(nt.content_type));case 5:case"end":return lt.stop()}},Ze)}));return function(Ze){return dt.apply(this,arguments)}}()),et.show()},Qt=function(){var et=new rt(yt.current);et.settings.displayMode="popup",et.addEventListener("render",function(){var dt=Object(R.a)(O.a.mark(function Ze(ht){var nt;return O.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:if(ft.current.style.display="none",!yt.current){lt.next=6;break}return lt.next=4,Object(be.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ht.dataUrl}});case 4:nt=lt.sent,nt!=null&&nt.id&&Oe(yt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(nt==null?void 0:nt.id,"?type=").concat(nt.content_type));case 6:case"end":return lt.stop()}},Ze)}));return function(Ze){return dt.apply(this,arguments)}}()),et.show(),window.markerArea=et},Rt=Object(w.useMemo)(function(){try{var ot=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,et=/\"\/api\/attachments\/|\"\/attachments\/download\//g,dt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;vt=vt.replace(ot,"("+Q.a.API_SERVER+"/api/attachments/").replace(et,'"'+Q.a.API_SERVER+"/api/attachments/").replace(dt,'"'+Q.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,`
`),vt=vt.replace(new RegExp("(?[TOC]
",v()),g()),Ze=Ze.replace(/(__special_katext_id_\d+__)/g,function(Dt,lt){var Ut=ht[lt],er=Ut.type,tr=Ut.expression;return Object(ne.renderToString)(Vt(tr)||"",{displayMode:er==="block",throwOnError:!1,output:"html"})}),Ze=Ze.replace(/▁/g,"\u2581\u2581\u2581"),p(),$){var nt=document.createElement("div");return nt.innerHTML=Ze,nt.innerText}return setTimeout(function(){return Zt()},500),Ze},[vt]),bt=Object(w.useRef)();l.WebkitLineClamp=ve,ve&&(qe=Object(_.a)(Object(_.a)({},qe),l));function _t(ot){var et=ot.target;if(et.tagName.toUpperCase()==="IMG"){if(He){var dt=et.getAttribute("src");Et(dt),At("image")}}else if(et.tagName.toUpperCase()==="A"){var Ze=et.getAttribute("href");if(Ze.indexOf("office")>-1)ot.preventDefault(),Et(Ze),At("office");else if(Ze.indexOf("application/pdf")>-1)ot.preventDefault(),Et(Ze),At("pdf");else if(Ze.indexOf("type=text")>-1)ot.preventDefault(),Et(Ze),At("html");else if(Ze.startsWith("#")){ot.preventDefault();var ht=document.getElementById(Ze.replace("#",""));ht&&ht.scrollIntoView(!0)}}}var Zt=function(){var et,dt=(et=bt.current)===null||et===void 0?void 0:et.querySelectorAll("video");dt==null||dt.forEach(function(Ze){if(Ze.oncontextmenu=function(){return!1},Ze.src.indexOf(".m3u8")>-1&&!Ze.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var ht=new G.a;ht.loadSource(Ze.src),ht.attachMedia(Ze)}}})};Object(w.useEffect)(function(){if(bt.current&&Rt&&(Rt.match(zt)&&window.PR.prettyPrint()),bt.current)return bt.current.addEventListener("click",_t),function(){bt.current.removeEventListener("click",_t),p(),g()}},[Rt,bt.current,_t]);var qt=function(et){if(!k)return;et.target.nodeName==="IMG"?(ft.current.style.display="flex",ft.current.style.width=et.target.clientWidth+"px",ft.current.style.height=et.target.clientHeight+"px",ft.current.style.top=et.target.offsetTop+"px",ft.current.style.left=et.target.offsetLeft+"px",yt.current.src=et.target.getAttribute("src")):ft.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:bt,style:Object(_.a)({},qe),className:"".concat(D||""," markdown-body ").concat(kt.a.mdBody),onMouseOver:qt,dangerouslySetInnerHTML:{__html:Rt}}),m.a.createElement("div",{ref:ft,className:kt.a.button},m.a.createElement(F.a,null,m.a.createElement(B.a,{onClick:function(){return Jt()}},"\u88C1\u526A"),m.a.createElement(B.a,{onClick:function(){return Qt()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:yt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(re.a,{close:!0,data:wt,hasMask:Ee,type:wt!=null&&wt.length?$t:"",style:Object(_.a)({},gt),onClose:function(){return Et("")}}))}},BU3w:function(Je,Xe,ee){"use strict";ee.d(Xe,"a",function(){return R});var de=ee("MNnm"),F="rc-util-key";function S(N){if(N.attachTo)return N.attachTo;var M=document.querySelector("head");return M||document.body}function B(N){var M,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(de.a)())return null;var w=document.createElement("style");if((M=O.csp)===null||M===void 0?void 0:M.nonce){var m;w.nonce=(m=O.csp)===null||m===void 0?void 0:m.nonce}w.innerHTML=N;var T=S(O),C=T.firstChild;return O.prepend&&T.prepend?T.prepend(w):O.prepend&&C?T.insertBefore(w,C):T.appendChild(w),w}var _=new Map;function R(N,M){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=S(O);if(!_.has(w)){var m=B("",O),T=m.parentNode;_.set(w,T),T.removeChild(m)}var C=Array.from(_.get(w).children).find(function(r){return r.tagName==="STYLE"&&r[F]===M});if(C){var b,E;if(((b=O.csp)===null||b===void 0?void 0:b.nonce)&&C.nonce!==((E=O.csp)===null||E===void 0?void 0:E.nonce)){var y;C.nonce=(y=O.csp)===null||y===void 0?void 0:y.nonce}return C.innerHTML!==N&&(C.innerHTML=N),C}var c=B(N,O);return c[F]=M,c}},BdwD:function(Je,Xe,ee){"use strict";var de=ee("+L6B"),F=ee("2/Rp"),S=ee("0Owb"),B=ee("k1fw"),_=ee("q1tI"),R=ee.n(_),N=ee("FOrL"),M=ee.n(N),O=function(m){var T=m.buttonProps,C=T===void 0?{}:T,b=m.styles,E=b===void 0?{}:b,y=m.customText,c=m.ButtonText,r=m.ButtonClick,a=m.Buttonclass,o=m.ButtonTwo;return R.a.createElement("section",{className:"tc animated fadeIn",style:Object(B.a)(Object(B.a)({},{color:"#999",margin:"200px auto"}),E)},R.a.createElement("img",{src:M.a}),R.a.createElement("p",{className:"mt20 font14"},y||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),c&&R.a.createElement(F.a,Object(S.a)({className:a,onClick:r},C),c),o&&o)};Xe.a=O},DlQD:function(Je,Xe,ee){(function(de,F){Je.exports=F()})(this,function(){"use strict";function de(q,J){for(var Z=0;Zq.length)&&(J=q.length);for(var Z=0,W=new Array(J);Z=q.length?{done:!0}:{done:!1,value:q[W++]}}}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 Z=q[Symbol.iterator](),Z.next.bind(Z)}function R(q,J){return J={exports:{}},q(J,J.exports),J.exports}var N=R(function(q){function J(){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 Z(W){q.exports.defaults=W}q.exports={defaults:J(),getDefaults:J,changeDefaults:Z}}),M=N.defaults,O=N.getDefaults,w=N.changeDefaults,m=/[&<>"']/,T=/[&<>"']/g,C=/[<>"']|&(?!#?\w+;)/,b=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(J){return E[J]};function c(q,J){if(J){if(m.test(q))return q.replace(T,y)}else if(C.test(q))return q.replace(b,y);return q}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function a(q){return q.replace(r,function(J,Z){return Z=Z.toLowerCase(),Z==="colon"?":":Z.charAt(0)==="#"?Z.charAt(1)==="x"?String.fromCharCode(parseInt(Z.substring(2),16)):String.fromCharCode(+Z.substring(1)):""})}var o=/(^|[^\[])\^/g;function g(q,J){q=q.source||q,J=J||"";var Z={replace:function(H,K){return K=K.source||K,K=K.replace(o,"$1"),q=q.replace(H,K),Z},getRegex:function(){return new RegExp(q,J)}};return Z}var l=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function v(q,J,Z){if(q){var W;try{W=decodeURIComponent(a(Z)).replace(l,"").toLowerCase()}catch(H){return null}if(W.indexOf("javascript:")===0||W.indexOf("vbscript:")===0||W.indexOf("data:")===0)return null}J&&!d.test(Z)&&(Z=t(J,Z));try{Z=encodeURI(Z).replace(/%25/g,"%")}catch(H){return null}return Z}var h={},u=/^[^:]+:\/*[^/]*$/,n=/^([^:]+:)[\s\S]*$/,e=/^([^:]+:\/*[^/]*)[\s\S]*$/;function t(q,J){h[" "+q]||(u.test(q)?h[" "+q]=q+"/":h[" "+q]=A(q,"/",!0)),q=h[" "+q];var Z=q.indexOf(":")===-1;return J.substring(0,2)==="//"?Z?J:q.replace(n,"$1")+J:J.charAt(0)==="/"?Z?J:q.replace(e,"$1")+J:q+J}var f={exec:function(){}};function p(q){for(var J=1,Z,W;J=0&&ie[ge]==="\\";)ae=!ae;return ae?"|":" |"}),W=Z.split(/ \|/),H=0;if(W.length>J)W.splice(J);else for(;W.length=W.length?H.slice(W.length):H}).join(`
`)}var se=function(){function q(Z){this.options=Z||z}var J=q.prototype;return J.space=function(W){var H=this.rules.block.newline.exec(W);if(H)return H[0].length>1?{type:"space",raw:H[0]}:{raw:`
`}},J.code=function(W,H){var K=this.rules.block.code.exec(W);if(K){var X=H[H.length-1];if(X&&X.type==="paragraph")return{raw:K[0],text:K[0].trimRight()};var ie=K[0].replace(/^ {4}/gm,"");return{type:"code",raw:K[0],codeBlockStyle:"indented",text:this.options.pedantic?ie:V(ie,`
`)}}},J.fences=function(W){var H=this.rules.block.fences.exec(W);if(H){var K=H[0],X=be(K,H[3]||"");return{type:"code",raw:K,lang:H[2]?H[2].trim():H[2],text:X}}},J.heading=function(W){var H=this.rules.block.heading.exec(W);if(H)return{type:"heading",raw:H[0],depth:H[1].length,text:H[2]}},J.nptable=function(W){var H=this.rules.block.nptable.exec(W);if(H){var K={type:"table",header:G(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[],raw:H[0]};if(K.header.length===K.align.length){var X=K.align.length,ie;for(ie=0;ie ?/gm,"");return{type:"blockquote",raw:H[0],text:K}}},J.list=function(W){var H=this.rules.block.list.exec(W);if(H){for(var K=H[0],X=H[2],ie=X.length>1,ae=X[X.length-1]===")",ge={type:"list",raw:K,ordered:ie,start:ie?+X.slice(0,-1):"",loose:!1,items:[]},je=H[0].match(this.rules.block.item),ze=!1,We,Ye,$e,Ge,tt,rt,st,at=je.length,Qe=0;Qe1||this.options.smartLists&&$e!==X)&&(Ge=je.slice(Qe+1).join(`
`),ge.raw=ge.raw.substring(0,ge.raw.length-Ge.length),Qe=at-1)),tt=ze||/\n\n(?!\s*$)/.test(We),Qe!==at-1&&(ze=We.charAt(We.length-1)===`
`,tt||(tt=ze)),tt&&(ge.loose=!0),rt=/^\[[ xX]\] /.test(We),st=void 0,rt&&(st=We[1]!==" ",We=We.replace(/^\[[ xX]\] +/,"")),ge.items.push({type:"list_item",raw:K,task:rt,checked:st,loose:tt,text:We});return ge}},J.html=function(W){var H=this.rules.block.html.exec(W);if(H)return{type:this.options.sanitize?"paragraph":"html",raw:H[0],pre:!this.options.sanitizer&&(H[1]==="pre"||H[1]==="script"||H[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(H[0]):Q(H[0]):H[0]}},J.def=function(W){var H=this.rules.block.def.exec(W);if(H){H[3]&&(H[3]=H[3].substring(1,H[3].length-1));var K=H[1].toLowerCase().replace(/\s+/g," ");return{tag:K,raw:H[0],href:H[2],title:H[3]}}},J.table=function(W){var H=this.rules.block.table.exec(W);if(H){var K={type:"table",header:G(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[]};if(K.header.length===K.align.length){K.raw=H[0];var X=K.align.length,ie;for(ie=0;ie/i.test(X[0])&&(H=!1),!K&&/^<(pre|code|kbd|script)(\s|>)/i.test(X[0])?K=!0:K&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(X[0])&&(K=!1),{type:this.options.sanitize?"text":"html",raw:X[0],inLink:H,inRawBlock:K,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(X[0]):Q(X[0]):X[0]}},J.link=function(W){var H=this.rules.inline.link.exec(W);if(H){var K=ne(H[2],"()");if(K>-1){var X=H[0].indexOf("!")===0?5:4,ie=X+H[1].length+K;H[2]=H[2].substring(0,K),H[0]=H[0].substring(0,ie).trim(),H[3]=""}var ae=H[2],ge="";if(this.options.pedantic){var je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ae);je?(ae=je[1],ge=je[3]):ge=""}else ge=H[3]?H[3].slice(1,-1):"";ae=ae.trim().replace(/^<([\s\S]*)>$/,"$1");var ze=re(H,{href:ae&&ae.replace(this.rules.inline._escapes,"$1"),title:ge&&ge.replace(this.rules.inline._escapes,"$1")},H[0]);return ze}},J.reflink=function(W,H){var K;if((K=this.rules.inline.reflink.exec(W))||(K=this.rules.inline.nolink.exec(W))){var X=(K[2]||K[1]).replace(/\s+/g," ");if(X=H[X.toLowerCase()],!X||!X.href){var ie=K[0].charAt(0);return{type:"text",raw:ie,text:ie}}var ae=re(K,X,K[0]);return ae}},J.strong=function(W,H,K){K===void 0&&(K="");var X=this.rules.inline.strong.start.exec(W);if(X&&(!X[1]||X[1]&&(K===""||this.rules.inline.punctuation.exec(K)))){H=H.slice(-1*W.length);var ie=X[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ie.lastIndex=0;for(var ae;(X=ie.exec(H))!=null;)if(ae=this.rules.inline.strong.middle.exec(H.slice(0,X.index+3)),ae)return{type:"strong",raw:W.slice(0,ae[0].length),text:W.slice(2,ae[0].length-2)}}},J.em=function(W,H,K){K===void 0&&(K="");var X=this.rules.inline.em.start.exec(W);if(X&&(!X[1]||X[1]&&(K===""||this.rules.inline.punctuation.exec(K)))){H=H.slice(-1*W.length);var ie=X[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ie.lastIndex=0;for(var ae;(X=ie.exec(H))!=null;)if(ae=this.rules.inline.em.middle.exec(H.slice(0,X.index+2)),ae)return{type:"em",raw:W.slice(0,ae[0].length),text:W.slice(1,ae[0].length-1)}}},J.codespan=function(W){var H=this.rules.inline.code.exec(W);if(H){var K=H[2].replace(/\n/g," "),X=/[^ ]/.test(K),ie=K.startsWith(" ")&&K.endsWith(" ");return X&&ie&&(K=K.substring(1,K.length-1)),K=Q(K,!0),{type:"codespan",raw:H[0],text:K}}},J.br=function(W){var H=this.rules.inline.br.exec(W);if(H)return{type:"br",raw:H[0]}},J.del=function(W){var H=this.rules.inline.del.exec(W);if(H)return{type:"del",raw:H[0],text:H[1]}},J.autolink=function(W,H){var K=this.rules.inline.autolink.exec(W);if(K){var X,ie;return K[2]==="@"?(X=Q(this.options.mangle?H(K[1]):K[1]),ie="mailto:"+X):(X=Q(K[1]),ie=X),{type:"link",raw:K[0],text:X,href:ie,tokens:[{type:"text",raw:X,text:X}]}}},J.url=function(W,H){var K;if(K=this.rules.inline.url.exec(W)){var X,ie;if(K[2]==="@")X=Q(this.options.mangle?H(K[0]):K[0]),ie="mailto:"+X;else{var ae;do ae=K[0],K[0]=this.rules.inline._backpedal.exec(K[0])[0];while(ae!==K[0]);X=Q(K[0]),K[1]==="www."?ie="http://"+X:ie=X}return{type:"link",raw:K[0],text:X,href:ie,tokens:[{type:"text",raw:X,text:X}]}}},J.inlineText=function(W,H,K){var X=this.rules.inline.text.exec(W);if(X){var ie;return H?ie=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(X[0]):Q(X[0]):X[0]:ie=Q(this.options.smartypants?K(X[0]):X[0]),{type:"text",raw:X[0],text:ie}}},q}(),oe=j.noopTest,ue=j.edit,he=j.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:oe,table:oe,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=he({},te),te.gfm=he({},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=he({},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:oe,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 Y={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:oe,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:oe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",Y.punctuation=ue(Y.punctuation).replace(/punctuation/g,Y._punctuation).getRegex(),Y._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Y._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Y.em.start=ue(Y.em.start).replace(/punctuation/g,Y._punctuation).getRegex(),Y.em.middle=ue(Y.em.middle).replace(/punctuation/g,Y._punctuation).replace(/overlapSkip/g,Y._overlapSkip).getRegex(),Y.em.endAst=ue(Y.em.endAst,"g").replace(/punctuation/g,Y._punctuation).getRegex(),Y.em.endUnd=ue(Y.em.endUnd,"g").replace(/punctuation/g,Y._punctuation).getRegex(),Y.strong.start=ue(Y.strong.start).replace(/punctuation/g,Y._punctuation).getRegex(),Y.strong.middle=ue(Y.strong.middle).replace(/punctuation/g,Y._punctuation).replace(/blockSkip/g,Y._blockSkip).getRegex(),Y.strong.endAst=ue(Y.strong.endAst,"g").replace(/punctuation/g,Y._punctuation).getRegex(),Y.strong.endUnd=ue(Y.strong.endUnd,"g").replace(/punctuation/g,Y._punctuation).getRegex(),Y.blockSkip=ue(Y._blockSkip,"g").getRegex(),Y.overlapSkip=ue(Y._overlapSkip,"g").getRegex(),Y._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Y._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Y._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])?)+(?![-_])/,Y.autolink=ue(Y.autolink).replace("scheme",Y._scheme).replace("email",Y._email).getRegex(),Y._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Y.tag=ue(Y.tag).replace("comment",te._comment).replace("attribute",Y._attribute).getRegex(),Y._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Y._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Y._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Y.link=ue(Y.link).replace("label",Y._label).replace("href",Y._href).replace("title",Y._title).getRegex(),Y.reflink=ue(Y.reflink).replace("label",Y._label).getRegex(),Y.reflinkSearch=ue(Y.reflinkSearch,"g").replace("reflink",Y.reflink).replace("nolink",Y.nolink).getRegex(),Y.normal=he({},Y),Y.pedantic=he({},Y.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",Y._label).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Y._label).getRegex()}),Y.gfm=he({},Y.normal,{escape:ue(Y.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&&(W="x"+W.toString(16)),J+=""+W+";";return J}var ye=function(){function q(Z){this.tokens=[],this.tokens.links=Object.create(null),this.options=Z||Re,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var W={block:Le.normal,inline:xe.normal};this.options.pedantic?(W.block=Le.pedantic,W.inline=xe.pedantic):this.options.gfm&&(W.block=Le.gfm,this.options.breaks?W.inline=xe.breaks:W.inline=xe.gfm),this.tokenizer.rules=W}q.lex=function(W,H){var K=new q(H);return K.lex(W)};var J=q.prototype;return J.lex=function(W){return W=W.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(W,this.tokens,!0),this.inline(this.tokens),this.tokens},J.blockTokens=function(W,H,K){H===void 0&&(H=[]),K===void 0&&(K=!0),W=W.replace(/^ +$/gm,"");for(var X,ie,ae,ge;W;){if(X=this.tokenizer.space(W)){W=W.substring(X.raw.length),X.type&&H.push(X);continue}if(X=this.tokenizer.code(W,H)){W=W.substring(X.raw.length),X.type?H.push(X):(ge=H[H.length-1],ge.raw+=`
`+X.raw,ge.text+=`
`+X.text);continue}if(X=this.tokenizer.fences(W)){W=W.substring(X.raw.length),H.push(X);continue}if(X=this.tokenizer.heading(W)){W=W.substring(X.raw.length),H.push(X);continue}if(X=this.tokenizer.nptable(W)){W=W.substring(X.raw.length),H.push(X);continue}if(X=this.tokenizer.hr(W)){W=W.substring(X.raw.length),H.push(X);continue}if(X=this.tokenizer.blockquote(W)){W=W.substring(X.raw.length),X.tokens=this.blockTokens(X.text,[],K),H.push(X);continue}if(X=this.tokenizer.list(W)){for(W=W.substring(X.raw.length),ae=X.items.length,ie=0;ie0)for(;(je=this.tokenizer.rules.inline.reflinkSearch.exec(ge))!=null;)ze.includes(je[0].slice(je[0].lastIndexOf("[")+1,-1))&&(ge=ge.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+ge.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(je=this.tokenizer.rules.inline.blockSkip.exec(ge))!=null;)ge=ge.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+ge.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;W;){if(ae=this.tokenizer.escape(W)){W=W.substring(ae.raw.length),H.push(ae);continue}if(ae=this.tokenizer.tag(W,K,X)){W=W.substring(ae.raw.length),K=ae.inLink,X=ae.inRawBlock,H.push(ae);continue}if(ae=this.tokenizer.link(W)){W=W.substring(ae.raw.length),ae.type==="link"&&(ae.tokens=this.inlineTokens(ae.text,[],!0,X)),H.push(ae);continue}if(ae=this.tokenizer.reflink(W,this.tokens.links)){W=W.substring(ae.raw.length),ae.type==="link"&&(ae.tokens=this.inlineTokens(ae.text,[],!0,X)),H.push(ae);continue}if(ae=this.tokenizer.strong(W,ge,ie)){W=W.substring(ae.raw.length),ae.tokens=this.inlineTokens(ae.text,[],K,X),H.push(ae);continue}if(ae=this.tokenizer.em(W,ge,ie)){W=W.substring(ae.raw.length),ae.tokens=this.inlineTokens(ae.text,[],K,X),H.push(ae);continue}if(ae=this.tokenizer.codespan(W)){W=W.substring(ae.raw.length),H.push(ae);continue}if(ae=this.tokenizer.br(W)){W=W.substring(ae.raw.length),H.push(ae);continue}if(ae=this.tokenizer.del(W)){W=W.substring(ae.raw.length),ae.tokens=this.inlineTokens(ae.text,[],K,X),H.push(ae);continue}if(ae=this.tokenizer.autolink(W,le)){W=W.substring(ae.raw.length),H.push(ae);continue}if(!K&&(ae=this.tokenizer.url(W,le))){W=W.substring(ae.raw.length),H.push(ae);continue}if(ae=this.tokenizer.inlineText(W,X,Te)){W=W.substring(ae.raw.length),ie=ae.raw.slice(-1),H.push(ae);continue}if(W){var We="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return H},F(q,null,[{key:"rules",get:function(){return{block:Le,inline:xe}}}]),q}(),we=N.defaults,De=j.cleanUrl,Se=j.escape,pe=function(){function q(Z){this.options=Z||we}var J=q.prototype;return J.code=function(W,H,K){var X=(H||"").match(/\S*/)[0];if(this.options.highlight){var ie=this.options.highlight(W,X);ie!=null&&ie!==W&&(K=!0,W=ie)}return X?''+(K?W:Se(W,!0))+`
`:""+(K?W:Se(W,!0))+`
`},J.blockquote=function(W){return`
`+W+`
`},J.html=function(W){return W},J.heading=function(W,H,K,X){return this.options.headerIds?"
`:""+W+"
`},J.hr=function(){return this.options.xhtml?`
`:`
`},J.list=function(W,H,K){var X=H?"ol":"ul",ie=H&&K!==1?' start="'+K+'"':"";return"<"+X+ie+`>
`+W+""+X+`>
`},J.listitem=function(W){return""+W+`
`},J.checkbox=function(W){return" "},J.paragraph=function(W){return""+W+`
`},J.table=function(W,H){return H&&(H=""+H+" "),`
`},J.tablerow=function(W){return`
`+W+`
`},J.tablecell=function(W,H){var K=H.header?"th":"td",X=H.align?"<"+K+' align="'+H.align+'">':"<"+K+">";return X+W+""+K+`>
`},J.strong=function(W){return""+W+" "},J.em=function(W){return""+W+" "},J.codespan=function(W){return""+W+""},J.br=function(){return this.options.xhtml?" ":" "},J.del=function(W){return""+W+""},J.link=function(W,H,K){if(W=De(this.options.sanitize,this.options.baseUrl,W),W===null)return K;var X='"+K+" ",X},J.image=function(W,H,K){if(W=De(this.options.sanitize,this.options.baseUrl,W),W===null)return K;var X=' ":">",X},J.text=function(W){return W},q}(),me=function(){function q(){}var J=q.prototype;return J.strong=function(W){return W},J.em=function(W){return W},J.codespan=function(W){return W},J.del=function(W){return W},J.html=function(W){return W},J.text=function(W){return W},J.link=function(W,H,K){return""+K},J.image=function(W,H,K){return""+K},J.br=function(){return""},q}(),Fe=function(){function q(){this.seen={}}var J=q.prototype;return J.slug=function(W){var H=W.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(H)){var K=H;do this.seen[K]++,H=K+"-"+this.seen[K];while(this.seen.hasOwnProperty(H))}return this.seen[H]=0,H},q}(),Pe=N.defaults,Me=j.unescape,Ie=function(){function q(Z){this.options=Z||Pe,this.options.renderer=this.options.renderer||new pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new me,this.slugger=new Fe}q.parse=function(W,H){var K=new q(H);return K.parse(W)};var J=q.prototype;return J.parse=function(W,H){H===void 0&&(H=!0);var K="",X,ie,ae,ge,je,ze,We,Ye,$e,Ge,tt,rt,st,at,Qe,pt,xt,Ke,Tt=W.length;for(X=0;X0&&Qe.tokens[0].type==="text"?(Qe.tokens[0].text=Ke+" "+Qe.tokens[0].text,Qe.tokens[0].tokens&&Qe.tokens[0].tokens.length>0&&Qe.tokens[0].tokens[0].type==="text"&&(Qe.tokens[0].tokens[0].text=Ke+" "+Qe.tokens[0].tokens[0].text)):Qe.tokens.unshift({type:"text",text:Ke}):at+=Ke),at+=this.parse(Qe.tokens,st),$e+=this.renderer.listitem(at,xt,pt);K+=this.renderer.list($e,tt,rt);continue}case"html":{K+=this.renderer.html(Ge.text);continue}case"paragraph":{K+=this.renderer.paragraph(this.parseInline(Ge.tokens));continue}case"text":{for($e=Ge.tokens?this.parseInline(Ge.tokens):Ge.text;X+1An error occurred:"+ke(ae.message+"",!0)+" ";throw ae}}ce.options=ce.setOptions=function(q){return Ne(ce.defaults,q),Be(ce.defaults),ce},ce.getDefaults=Ae,ce.defaults=_e,ce.use=function(q){var J=Ne({},q);if(q.renderer&&function(){var W=ce.defaults.renderer||new pe,H=function(ie){var ae=W[ie];W[ie]=function(){for(var ge=arguments.length,je=new Array(ge),ze=0;ze1&&arguments[1]!==void 0?arguments[1]:1,Z=me.length,W=0;W1&&arguments[1]!==void 0?arguments[1]:!1;return Object(v.a)(V).map(function(Q,ne){if(!_.isValidElement(Q)||!Q.type)return null;var re=Q.type.isSelectOptGroup,be=Q.key,se=Q.props,oe=se.children,ue=Object(N.a)(se,["children"]);return G||!re?h(Q):Object(d.a)(Object(d.a)({key:"__RC_SELECT_GRP__".concat(be===null?ne:be,"__"),label:be},ue),{},{options:u(oe)})}).filter(function(Q){return Q})}var n=ee("2Qr1"),e=ee("qNPg"),t=ee("U8pU"),f=ee("Kwbf"),p=ee("WKfj");function x(V){var G=V.mode,Q=V.options,ne=V.children,re=V.backfill,be=V.allowClear,se=V.placeholder,oe=V.getInputElement,ue=V.showSearch,he=V.onSearch,te=V.defaultOpen,Y=V.autoFocus,fe=V.labelInValue,Re=V.value,Le=V.inputValue,xe=V.optionLabelProp,Te=G==="multiple"||G==="tags",le=ue!==void 0?ue:Te||G==="combobox",ye=Q||u(ne);if(Object(f.a)(G!=="tags"||ye.every(function(pe){return!pe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var we=ye.some(function(pe){return pe.options?pe.options.some(function(me){return typeof("value"in me?me.value:me.key)=="number"}):typeof("value"in pe?pe.value:pe.key)=="number"});Object(f.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(f.a)(G!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(f.a)(G==="combobox"||!re,"`backfill` only works with `combobox` mode."),Object(f.a)(G==="combobox"||!oe,"`getInputElement` only work with `combobox` mode."),Object(f.b)(G!=="combobox"||!oe||!be||!se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),he&&!le&&G!=="combobox"&&G!=="tags"&&Object(f.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(f.b)(!te||Y,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Re!=null){var De=Object(p.d)(Re);Object(f.a)(!fe||De.every(function(pe){return Object(t.a)(pe)==="object"&&("key"in pe||"value"in pe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(f.a)(!Te||Array.isArray(Re),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var Se=null;Object(v.a)(ne).some(function(pe){if(!_.isValidElement(pe)||!pe.type)return!1;var me=pe.type;if(me.isSelectOption)return!1;if(me.isSelectOptGroup){var Fe=Object(v.a)(pe.props.children).every(function(Pe){return!_.isValidElement(Pe)||!pe.type||Pe.type.isSelectOption?!0:(Se=Pe.type,!1)});return!Fe}return Se=me,!0}),Se&&Object(f.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Se.displayName||Se.name||Se,"`.")),Object(f.a)(Le===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var A=x,I=Object(e.a)({prefixCls:"rc-select",components:{optionList:r},convertChildrenToData:u,flattenOptions:n.d,getLabeledValue:n.e,filterOptions:n.b,isValueDisabled:n.g,findValueOption:n.c,warningProps:A,fillOptionsWithMissingValue:n.a}),U=function(V){Object(S.a)(Q,V);var G=Object(B.a)(Q);function Q(){var ne;return Object(de.a)(this,Q),ne=G.apply(this,arguments),ne.selectRef=_.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(F.a)(Q,[{key:"render",value:function(){return _.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),Q}(_.Component);U.Option=o,U.OptGroup=l;var j=U,z=Xe.c=j},NDqe:function(Je,Xe,ee){Je.exports={flex_box_center:"flex_box_center___3oYZ2",flex_space_between:"flex_space_between___1FifH",flex_box_vertical_center:"flex_box_vertical_center___2iDXN",flex_box_center_end:"flex_box_center_end___2rJ_G",flex_box_column:"flex_box_column___3ucki",tabs:"tabs___3aVAD",active:"active___1eCl8",list:"list___2weuP",tags:"tags___10O8v",searchWrp:"searchWrp___xsrqM",newlight:"newlight___1S7Yv"}},SJMd:function(Je,Xe){/**
* @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 ee,de,F,S=!1,B,_;window.PR_SHOULD_USE_CONTINUATION=!0;var R,N;(function(){var M=window,O=["break,continue,do,else,for,if,return,while"],w=[O,"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"],m=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[m,"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"],C=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],b=[m,"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"],E="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",y=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="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",r=[O,"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"],a=[O,"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"],o=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],g=[T,b,C,y,c,r,a,o],l=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,d="str",v="kwd",h="com",u="typ",n="lit",e="pun",t="pln",f="tag",p="dec",x="src",A="atn",I="atv",U="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(le){for(var ye=0,we=!1,De=!1,Se=0,pe=le.length;Se122||(W<65||Z>90||Be.push([Math.max(65,Z)|32,Math.min(W,90)|32]),W<97||Z>122||Be.push([Math.max(97,Z)&~32,Math.min(W,122)&~32]))}}Be.sort(function(ie,ae){return ie[0]-ae[0]||ae[1]-ie[1]});for(var H=[],K=[],Ce=0;CeX[0]&&(X[1]+1>X[0]&&ce.push("-"),ce.push(Me(X[1])))}return ce.push("]"),ce.join("")}function Ne(ke){for(var Ae=ke.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")),Be=Ae.length,_e=[],ce=0,Ce=0;ce=2&&Z==="["?Ae[ce]=Ie(q):Z!=="\\"&&(Ae[ce]=q.replace(/[a-zA-Z]/g,function(K){var X=K.charCodeAt(0);return"["+String.fromCharCode(X&~32,X|32)+"]"}))}return Ae.join("")}for(var Ue=[],Se=0,pe=le.length;Se=0;)we[Ue.charAt(ke)]=Ne;var Ae=Ne[1],Be=""+Ae;Pe.hasOwnProperty(Be)||(Fe.push(Ae),Pe[Be]=null)}Fe.push(/[\0-\uffff]/),De=z(Fe)})();var Se=ye.length,pe=function(me){for(var Fe=me.sourceCode,Pe=me.basePos,Me=me.sourceNode,Ie=[Pe,t],Ne=0,Ue=Fe.match(De)||[],ke={},Ae=0,Be=Ue.length;Ae=5&&ce.substring(0,5)==="lang-",q&&!(Ce&&typeof Ce[1]=="string")&&(q=!1,ce=x),q||(ke[_e]=ce)}var W=Ne;if(Ne+=_e.length,!q)Ie.push(Pe+W,ce);else{var H=Ce[1],K=_e.indexOf(H),X=K+H.length;Ce[2]&&(X=_e.length-Ce[2].length,K=X-H.length);var ie=ce.substring(5);G(Me,Pe+W,_e.substring(0,K),pe,Ie),G(Me,Pe+W+K,H,Y(ie,H),Ie),G(Me,Pe+W+X,_e.substring(X),pe,Ie)}}me.decorations=Ie};return pe}function be(le){var ye=[],we=[];le.tripleQuotedStrings?ye.push([d,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):le.multiLineStrings?ye.push([d,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ye.push([d,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),le.verbatimStrings&&we.push([d,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var De=le.hashComments;De&&(le.cStyleComments?(De>1?ye.push([h,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ye.push([h,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([d,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ye.push([h,/^#[^\r\n]*/,null,"#"])),le.cStyleComments&&(we.push([h,/^\/\/[^\r\n]*/,null]),we.push([h,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Se=le.regexLiterals;if(Se){var pe=Se>1?"":`
\r`,me=pe?".":"[\\S\\s]",Fe="/(?=[^/*"+pe+"])(?:[^/\\x5B\\x5C"+pe+"]|\\x5C"+me+"|\\x5B(?:[^\\x5C\\x5D"+pe+"]|\\x5C"+me+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+j+"("+Fe+")")])}var Pe=le.types;Pe&&we.push([u,Pe]);var Me=(""+le.keywords).replace(/^ | $/g,"");Me.length&&we.push([v,new RegExp("^(?:"+Me.replace(/[\s,]+/g,"|")+")\\b"),null]),ye.push([t,/^\s+/,null,` \r
\xA0`]);var Ie="^.[^\\s\\w.$@'\"`/\\\\]*";return le.regexLiterals&&(Ie+="(?!s*/)"),we.push([n,/^@[a-z_$][a-z_$@0-9]*/i,null],[u,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[t,/^[a-z_$][a-z_$@0-9]*/i,null],[n,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[t,/^\\[\s\S]?/,null],[e,new RegExp(Ie),null]),re(ye,we)}var se=be({keywords:g,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function oe(le,ye,we){for(var De=/(?:^|\s)nocode(?:\s|$)/,Se=/\r\n?|\n/,pe=le.ownerDocument,me=pe.createElement("li");le.firstChild;)me.appendChild(le.firstChild);var Fe=[me];function Pe(Ae){var Be=Ae.nodeType;if(Be==1&&!De.test(Ae.className))if(Ae.nodeName==="br")Me(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var _e=Ae.firstChild;_e;_e=_e.nextSibling)Pe(_e);else if((Be==3||Be==4)&&we){var ce=Ae.nodeValue,Ce=ce.match(Se);if(Ce){var q=ce.substring(0,Ce.index);Ae.nodeValue=q;var J=ce.substring(Ce.index+Ce[0].length);if(J){var Z=Ae.parentNode;Z.insertBefore(pe.createTextNode(J),Ae.nextSibling)}Me(Ae),q||Ae.parentNode.removeChild(Ae)}}}function Me(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function Be(Ce,q){var J=q?Ce.cloneNode(!1):Ce,Z=Ce.parentNode;if(Z){var W=Be(Z,1),H=Ce.nextSibling;W.appendChild(J);for(var K=H;K;K=H)H=K.nextSibling,W.appendChild(K)}return J}for(var _e=Be(Ae.nextSibling,0),ce;(ce=_e.parentNode)&&ce.nodeType===1;)_e=ce;Fe.push(_e)}for(var Ie=0;Ie=Z&&(Pe+=2),pe>=W&&(Ne+=2)}}finally{ce&&(ce.style.display=Ce)}}var he={};function te(le,ye){for(var we=ye.length;--we>=0;){var De=ye[we];he.hasOwnProperty(De)?M.console&&console.warn("cannot override language handler %s",De):he[De]=le}}function Y(le,ye){return le&&he.hasOwnProperty(le)||(le=/^\s*]*(?:>|$)/],[h,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[e,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^