").append(t.title);l||y.append(n),t.list||Ir.each(t.events,(function(e,n){"click"===e&&"mode"===t.type?(H()&&"click"===e&&(e="mousedown"),t.includeWith?y.bind(e,n):y.bind(e,(function(){Y(y)&&n()})),t.key&&(Ir(document).bind("keydown",t.key,n),t.title&&y.attr("title",t.title+" ["+t.key+"]"))):y.bind(e,n)})),fe(f)})),Ir.each(s,(function(){me(this.elem,this.list,this.callback,{seticon:!0})})),!l){e.next=24;break}return e.abrupt("return",new Promise((function(e,t){Ir.svgIcons(l,{w:24,h:24,id_match:!1,no_img:!R(),fallback:d,placement:p,callback:function(t){"m"!==Ir.pref("iconsize")&&i(),o(),e()}})})));case 24:return e.abrupt("return",o());case 25:case"end":return e.stop()}}))})),Nr.textActions.setInputElem(Ir("#text")[0]);var ye='
';Ir.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff","#aaaaff","#d4aaff","#ffaaff","#ffaad4"],(function(e,t){ye+='
'})),Ir("#palette").append(ye);ye="",Ir.each(["#FFF","#888","#000"],(function(){ye+='
'})),Ir("#bg_blocks").append(ye);var _e=Ir("#bg_blocks div"),be="cur_background";_e.each((function(){Ir(this).click((function(){_e.removeClass(be),Ir(this).addClass(be)}))})),Q(Ir.pref("bkgd_color"),Ir.pref("bkgd_url")),Ir("#image_save_opts input").val([Ir.pref("img_save")]);var xe=function(e,t){on(t)&&(t=e.value),Ir("#group_opacity").val(t),e&&e.handle||Ir("#opac_slider").slider("option","value",t),Nr.setOpacity(t/100)},we=function(e,t,n){on(t)&&(t=e.value),Ir("#blur").val(t);var r=!1;e&&e.handle||(Ir("#blur_slider").slider("option","value",t),r=!0),n?Nr.setBlurNoUndo(t):Nr.setBlur(t,r)};Ir("#stroke_style").change((function(){Nr.setStrokeAttr("stroke-dasharray",Ir(this).val()),z()})),Ir("#stroke_linejoin").change((function(){Nr.setStrokeAttr("stroke-linejoin",Ir(this).val()),z()})),Ir("select").change((function(){Ir(this).blur()}));var Se,ke,Ce,Ae,Ee,Ge=!1;Ir("#selLayerNames").change((function(){var e,t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=this.options[this.selectedIndex].value,t=Vr.notification.QmoveElemsToLayer.replace("%s",e),n=function(t){t&&(Ge=!0,Nr.moveSelectedToLayer(e),Nr.clearSelection(),T())},!e){r.next=14;break}if(!Ge){r.next=8;break}n(!0),r.next=14;break;case 8:return r.next=10,regeneratorRuntime.awrap(Ir.confirm(t));case 10:if(r.sent){r.next=13;break}return r.abrupt("return");case 13:n(!0);case 14:case"end":return r.stop()}}),null,this)})),Ir("#font_family").change((function(){Nr.setFontFamily(this.value)})),Ir("#seg_type").change((function(){Nr.setSegType(Ir(this).val())})),Ir("#text").bind("keyup input",(function(){Nr.setTextContent(this.value)})),Ir("#image_url").change((function(){X(this.value)})),Ir("#link_url").change((function(){this.value.length?Nr.setLinkURL(this.value):Nr.removeHyperlink()})),Ir("#g_title").change((function(){Nr.setGroupTitle(this.value)})),Ir(".attr_changer").change((function(){var e=this.getAttribute("data-attr"),t=this.value;if(!ce(e,t,j))return this.value=j.getAttribute(e),Ir.alert(Vr.notification.invalidAttrValGiven),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=Nr.convertToNum(e,t);else if("px"!==Ur.baseUnit){var n=ae();(j[e]||"pathedit"===Nr.getMode()||"x"===e||"y"===e)&&(t*=n[Ur.baseUnit])}if("id"===e){var r=j;Nr.clearSelection(),r.id=t,Nr.addToSelection([r],!0)}else Nr.changeSelectedAttribute(e,t);return this.blur(),!0})),Ir("#palette").mouseover((function(){var e=Ir('
');Ir(this).append(e),e.focus().remove()})),Ir(".palette_item").mousedown((function(e){var t,n=e.shiftKey||2===e.button?"stroke":"fill",r=Ir(this).data("rgb");"none"===r||"transparent"===r||"initial"===r?(r="none",t=new Ir.jGraduate.Paint):t=new Ir.jGraduate.Paint({alpha:100,solidColor:r.substr(1)}),x[n].setPaint(t),Nr.setColor(n,r),"none"!==r&&1!==Nr.getPaintOpacity(n)&&Nr.setPaintOpacity(n,1),J()})).bind("contextmenu",(function(e){e.preventDefault()})),Ir("#toggle_stroke_tools").on("click",(function(){Ir("#tools_bottom").toggleClass("expanded")})),Se=_[0],ke=null,Ce=null,Ae=!1,Ee=!1,Ir("#svgcanvas").bind("mousemove mouseup",(function(e){return!1===Ae||(Se.scrollLeft-=e.clientX-ke,Se.scrollTop-=e.clientY-Ce,ke=e.clientX,Ce=e.clientY,"mouseup"===e.type&&(Ae=!1),!1)})).mousedown((function(e){return 1!==e.button&&!0!==Ee||(Ae=!0,ke=e.clientX,Ce=e.clientY,!1)})),Ir(window).mouseup((function(){Ae=!1})),Ir(document).bind("keydown","space",(function(e){Nr.spaceKey=Ee=!0,e.preventDefault()})).bind("keyup","space",(function(e){e.preventDefault(),Nr.spaceKey=Ee=!1})).bind("keydown","shift",(function(e){"zoom"===Nr.getMode()&&_.css("cursor",C)})).bind("keyup","shift",(function(e){"zoom"===Nr.getMode()&&_.css("cursor",k)})),Pr.setPanning=function(e){Nr.spaceKey=Ee=e},function(){var e=Ir("#main_icon"),t=Ir("#main_icon span"),n=Ir("#main_menu"),r=!1,a=0,i=!0,o=!1;Ir(window).mouseup((function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,Ir(t.target).click((function(){n.css("margin-left","-9999px").show()})))),r=!1})).mousedown((function(e){Ir(e.target).closest("div.tools_flyout, .contextMenu").length||Ir(".tools_flyout:visible,.contextMenu").fadeOut(250)})),t.bind("mousedown",(function(){e.hasClass("buttondown")?n.fadeOut(200):(n.css("margin-left",0).show(),a||(a=n.height()),n.css("height",0).animate({height:a},200),r=!0),e.toggleClass("buttondown buttonup")})).hover((function(){r=!0})).mouseout((function(){r=!1}));var s=Ir("#main_menu li");s.mouseover((function(){i="rgba(0, 0, 0, 0)"===Ir(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover((function(){this.style.backgroundColor="#FFC"})).mouseout((function(){return this.style.backgroundColor="transparent",!0}))}))}(),Pr.addDropDown=function(e,t,n){if(Ir(e).length){var r=Ir(e).find("button"),a=Ir(e).find("ul").attr("id",Ir(e)[0].id+"-list");n?Ir(e).addClass("dropup"):Ir("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;Ir(window).mouseup((function(e){i||(r.removeClass("down"),a.hide()),i=!1})),r.bind("mousedown",(function(){if(r.hasClass("down"))a.hide();else{if(!n){var t=Ir(e).position();a.css({top:t.top+24,left:t.left-10})}a.show(),i=!0}r.toggleClass("down")})).hover((function(){i=!0})).mouseout((function(){i=!1}))}},Pr.addDropDown("#font_family_dropdown",(function(){Ir("#font_family").val(Ir(this).text()).change()})),Pr.addDropDown("#opacity_dropdown",(function(){if(!Ir(this).find("div").length){var e=parseInt(Ir(this).text().split("%")[0]);xe(!1,e)}}),!0),Ir("#opac_slider").slider({start:function(){Ir("#opacity_dropdown li:not(.special)").hide()},stop:function(){Ir("#opacity_dropdown li").show(),Ir(window).mouseup()},slide:function(e,t){xe(t)}}),Pr.addDropDown("#blur_dropdown",Ir.noop);var Pe,Ie,Ne=!1;Ir("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Ne=!1,we(t),Ir("#blur_dropdown li").show(),Ir(window).mouseup()},start:function(){Ne=!0},slide:function(e,t){we(t,null,Ne)}}),Pr.addDropDown("#zoom_dropdown",(function(){var e=Ir(this),t=e.data("val");t?se(window,t):le({value:parseFloat(e.text())})}),!0),me("#stroke_linecap","#linecap_opts",(function(){q(this,!0)}),{dropUp:!0}),me("#stroke_linejoin","#linejoin_opts",(function(){q(this,!0)}),{dropUp:!0}),me("#tool_position","#position_opts",(function(){var e=this.id.replace("tool_pos","").charAt(0);Nr.alignSelectedElements(e,"page")}),{multiclick:!0}),Ie=function(){Ir(Pe).blur()},Ir("#svg_editor").find("button, select, input:not(#text)").focus((function(){Pe=this,A="toolbars",_.mousedown(Ie)})).blur((function(){A="canvas",_.unbind("mousedown",Ie),"textedit"===Nr.getMode()&&Ir("#text").focus()}));var Te,Le=function(){Y("#tool_fhpath")&&Nr.setMode("fhpath")},Me=function(){Y("#tool_line")&&Nr.setMode("line")},Oe=function(){Y("#tool_square")&&Nr.setMode("square")},je=function(){Y("#tool_rect")&&Nr.setMode("rect")},Ve=function(){Y("#tool_fhrect")&&Nr.setMode("fhrect")},Re=function(){Y("#tool_circle")&&Nr.setMode("circle")},Be=function(){Y("#tool_ellipse")&&Nr.setMode("ellipse")},Fe=function(){Y("#tool_fhellipse")&&Nr.setMode("fhellipse")},De=function(){Y("#tool_image")&&Nr.setMode("image")},Ue=function(){Y("#tool_zoom")&&(Nr.setMode("zoom"),_.css("cursor",k))},He=function(e){var t=Nr.getResolution();e=e?t.zoom*e:1,Ir("#zoom").val(100*e),Nr.setZoom(e),ie(),$(!0)},ze=function(){Y("#tool_zoom")&&(He(),E())},qe=function(){Y("#tool_text")&&Nr.setMode("text")},Ye=function(){Y("#tool_path")&&Nr.setMode("path")},We=function(){on(j)&&!V||Nr.deleteSelectedElements()},Xe=function(){on(j)&&!V||Nr.cutSelectedElements()},Qe=function(){on(j)&&!V||Nr.copySelectedElements()},Ke=function(){var e=Nr.getZoom(),t=(_[0].scrollLeft+_.width()/2)/e-Nr.contentW,n=(_[0].scrollTop+_.height()/2)/e-Nr.contentH;Nr.pasteElements("point",t,n)},Ze=function(){on(j)||Nr.moveToTopSelectedElement()},$e=function(){on(j)||Nr.moveToBottomSelectedElement()},Je=function(e){on(j)||Nr.moveUpDownSelected(e)},et=function(){on(j)||Nr.convertToPath()},tt=function(){on(j)||v.reorient()},nt=function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(on(j)&&!V){t.next=5;break}return t.next=3,regeneratorRuntime.awrap(Ir.prompt(Vr.notification.enterNewLinkURL,"http://"));case 3:(e=t.sent)&&Nr.makeHyperlink(e);case 5:case"end":return t.stop()}}))},rt=function(e,t){if(!on(j)||V){if(Ur.gridSnapping){var n=Nr.getZoom()*Ur.snappingStep;e*=n,t*=n}Nr.moveSelectedElements(e,t)}},at=function(){Ir("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=Ir("#tool_node_link").hasClass("push_button_pressed");v.linkControlPoints(e)},it=function(){v.getNodePoint()&&v.clonePathNode()},ot=function(){v.getNodePoint()&&v.deletePathNode()},st=function(){var e=Ir("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),v.addSubPath(t)},lt=function(){v.opencloseSubPath()},ct=function(){Nr.cycleElement(1)},ut=function(){Nr.cycleElement(0)},dt=function(e,t){if(!on(j)&&!V){e||(t*=-1);var n=parseFloat(Ir("#angle").val())+t;Nr.setRotationAngle(n),ee()}},ht=function(){var e,t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return e=d(Ur.dimensions,2),t=e[0],n=e[1],r.next=3,regeneratorRuntime.awrap(Ir.confirm(Vr.notification.QwantToClear));case 3:if(r.sent){r.next=6;break}return r.abrupt("return");case 6:E(),Nr.clear(),Nr.setResolution(t,n),$(!0),He(),T(),ee(),ue(),Nr.runExtensions("onNewDocument");case 15:case"end":return r.stop()}}))},pt=function(){return Nr.setBold(!Nr.getBold()),ee(),!1},ft=function(){return Nr.setItalic(!Nr.getItalic()),ee(),!1},gt=function(){var e,t,n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return n=function(){var e,n,r=Vr.notification.loadingImage;if("new"===Ur.exportWindowType&&Pr.exportWindowCt++,t=Ur.canvasName+Pr.exportWindowCt,Te)n=Te;else{if(e='\n \n
\n
'.concat(r,"\n \n
").concat(r,"
\n "),"undefined"!=typeof URL&&URL.createObjectURL){var a=new Blob([e],{type:"text/html"});n=URL.createObjectURL(a)}else n="data:text/html;base64;charset=utf-8,"+At(e);Te=n}w=window.open(n,t)},i.next=3,regeneratorRuntime.awrap(Ir.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],(function(){var e=Ir(this);"JPEG"===e.val()||"WEBP"===e.val()?Ir("#image-slider").length||Ir("
')).appendTo(e.parent()):Ir("#image-slider").parent().remove()})));case 3:if(e=i.sent){i.next=6;break}return i.abrupt("return");case 6:if(r=D(),"PDF"!==e){i.next=12;break}Fr||r||n(),Nr.exportPDF(t),i.next=16;break;case 12:return Br||n(),a=parseInt(Ir("#image-slider").val())/100,i.next=16,regeneratorRuntime.awrap(Nr.rasterExport(e,a,t));case 16:case"end":return i.stop()}}))},mt=function(){Nr.open()},vt=function(){},yt=function(){y.getUndoStackSize()>0&&(y.undo(),T())},_t=function(){y.getRedoStackSize()>0&&(y.redo(),T())},bt=function(){V?Nr.groupSelectedElements():j&&Nr.ungroupSelectedElement()},xt=function(){Nr.cloneSelectedElements(20,20)},wt=function(){var e=this.id.replace("tool_align","").charAt(0);Nr.alignSelectedElements(e,Ir("#align_relative_to").val())},St=function(){if(Ir("#tool_wireframe").toggleClass("push_button_pressed tool_button"),_.toggleClass("wireframe"),!Xt){var e=Ir("#wireframe_rules");e.length?e.empty():Ir('').appendTo("head"),te()}};Ir("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var kt,Ct,Et=!1,Gt=!1,Pt=function(){if(!Et){Et=!0,Ir("#image_save_opts input").val([Ir.pref("img_save")]);var e=Nr.getResolution();"px"!==Ur.baseUnit&&(e.w=oe(e.w)+Ur.baseUnit,e.h=oe(e.h)+Ur.baseUnit),Ir("#canvas_width").val(e.w),Ir("#canvas_height").val(e.h),Ir("#canvas_title").val(Nr.getDocumentTitle()),Ir("#svg_docprops").show()}},It=function(){Ir("#svg_source_editor").hide(),L=!1,Ir("#svg_source_textarea").blur()},Nt=function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(L){t.next=2;break}return t.abrupt("return");case 2:if(e=function(){Nr.clearSelection(),It(),He(),T(),re(),ue()},Nr.setSvgString(Ir("#svg_source_textarea").val())){t.next=11;break}return t.next=6,regeneratorRuntime.awrap(Ir.confirm(Vr.notification.QerrorsRevertToSource));case 6:if(t.sent){t.next=9;break}return t.abrupt("return");case 9:return e(),t.abrupt("return");case 11:e(),E();case 13:case"end":return t.stop()}}))},Lt=function(){Ir("#svg_docprops").hide(),Ir("#canvas_width,#canvas_height").removeAttr("disabled"),Ir("#resolution")[0].selectedIndex=0,Ir("#image_save_opts input").val([Ir.pref("img_save")]),Et=!1},Mt=function(){Ir("#svg_prefs").hide(),Gt=!1},Ot=function(){var e=Ir("#canvas_title").val();re(e),Nr.setDocumentTitle(e);var t=Ir("#canvas_width"),n=t.val(),r=Ir("#canvas_height"),a=r.val();return"fit"===n||ce("width",n)?(t.parent().removeClass("error"),"fit"===a||ce("height",a)?(r.parent().removeClass("error"),Nr.setResolution(n,a)?(Ir.pref("img_save",Ir("#image_save_opts :checked").val()),$(),Lt(),!0):(Ir.alert(Vr.notification.noContentToFitTo),!1)):(r.parent().addClass("error"),Ir.alert(Vr.notification.invalidAttrValGiven),!1)):(t.parent().addClass("error"),Ir.alert(Vr.notification.invalidAttrValGiven),!1)},jt=Pr.savePreferences=function(){var t,n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:if(Q(Ir("#bg_blocks div.cur_background").css("background-color")||"#FFF",Ir("#canvas_bg_url").val()),(t=Ir("#lang_select").val())===Ir.pref("lang")){i.next=11;break}return i.next=6,regeneratorRuntime.awrap(Pr.putLocale(t,e,Ur));case 6:return n=i.sent,r=n.langParam,a=n.langData,i.next=11,regeneratorRuntime.awrap(wn(r,a));case 11:c(Ir("#iconsize").val()),Ur.gridSnapping=Ir("#grid_snapping_on")[0].checked,Ur.snappingStep=Ir("#grid_snapping_step").val(),Ur.gridColor=Ir("#grid_color").val(),Ur.showRulers=Ir("#show_rulers")[0].checked,Ir("#rulers").toggle(Ur.showRulers),Ur.showRulers&&Z(),Ur.baseUnit=Ir("#base_unit").val(),Nr.setConfig(Ur),$(),Mt();case 22:case"end":return i.stop()}}))},Vt=Ir.noop,Rt=function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ir("#dialog_box").hide(),L||Et||Gt){e.next=4;break}return ne&&Nr.leaveContext(),e.abrupt("return");case 4:if(!L){e.next=15;break}if(M===Ir("#svg_source_textarea").val()){e.next=12;break}return e.next=8,regeneratorRuntime.awrap(Ir.confirm(Vr.notification.QignoreSourceChanges));case 8:e.sent&&It(),e.next=13;break;case 12:It();case 13:e.next=16;break;case 15:Et?Lt():Gt&&Mt();case 16:Vt();case 17:case"end":return e.stop()}}))},Bt={width:Ir(window).width(),height:Ir(window).height()};if(F()&&(Vt=function(){0===_[0].scrollLeft&&0===_[0].scrollTop&&(_[0].scrollLeft=f.left,_[0].scrollTop=f.top)},f={left:_[0].scrollLeft,top:_[0].scrollTop},Ir(window).resize(Vt),Pr.ready((function(){return new Promise((function(e,t){setTimeout((function(){Vt(),e()}),500)}))})),_.scroll((function(){f={left:_[0].scrollLeft,top:_[0].scrollTop}}))),Ir(window).resize((function(e){Ir.each(Bt,(function(e,t){var n=Ir(window)[e]();_[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Bt[e]=n})),s()})),_.scroll((function(){Ir("#ruler_x").length&&(Ir("#ruler_x")[0].scrollLeft=_[0].scrollLeft),Ir("#ruler_y").length&&(Ir("#ruler_y")[0].scrollTop=_[0].scrollTop)})),Ir("#url_notice").click((function(){Ir.alert(this.title)})),Ir("#change_image_url").click(K),kt="tool_button_current",Ct="",Ir.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],(function(e,t){Ct+=(e?",":"")+"#tool_"+t})),Ir(Ct).mousedown((function(){Ir(this).addClass(kt)})).bind("mousedown mouseout",(function(){Ir(this).removeClass(kt)})),Ir("#tool_undo, #tool_redo").mousedown((function(){Ir(this).hasClass("disabled")||Ir(this).addClass(kt)})).bind("mousedown mouseout",(function(){Ir(this).removeClass(kt)})),U()&&!window.opera)for(var Ft=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Dt=Ft.length;Dt--;){var Ut=document.getElementById(Ft[Dt]);if(Ut){var Ht=Ut.title,zt=Ht.indexOf("Ctrl+");Ut.title=[Ht.substr(0,zt),"Cmd+",Ht.substr(zt+5)].join("")}}var qt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?Vr.ui.pick_stroke_paint_opacity:Vr.ui.pick_fill_paint_opacity,r=e.offset(),a=x[t].paint;Ir("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(Ur.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:Ur.jGraduatePath},newstop:"inverse"},(function(e){a=new Ir.jGraduate.Paint(e),x[t].setPaint(a),Nr.setPaint(t,a),Ir("#color_picker").hide()}),(function(){Ir("#color_picker").hide()}))},Yt=function(){function e(n,r){t(this,e);var a=Ur["fill"===r?"initFill":"initStroke"],i=(new DOMParser).parseFromString('
'),"text/xml").documentElement;(i=Ir(n)[0].appendChild(document.importNode(i,!0))).setAttribute("width",16.5),this.rect=i.firstElementChild,this.defs=i.getElementsByTagName("defs")[0],this.grad=this.defs.firstElementChild,this.paint=new Ir.jGraduate.Paint({solidColor:a.color}),this.type=r}return r(e,[{key:"setPaint",value:function(e,t){this.paint=e;var n=e.type,r=e.alpha/100,a="none";switch(n){case"solidColor":a="none"!==e[n]?"#"+e[n]:e[n];break;case"linearGradient":case"radialGradient":this.grad.remove(),this.grad=this.defs.appendChild(e[n]),a="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",a),this.rect.setAttribute("opacity",r),t&&(Nr.setColor(this.type,this._paintColor,!0),Nr.setPaintOpacity(this.type,this._paintOpacity,!0))}},{key:"update",value:function(e){if(j){var t=this.type;switch(j.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var n=j.getElementsByTagName("*"),r=null,a=0,i=n.length;a
0||n300?t=300-n:n+t<2&&(t=2-n),0!==t&&(en-=t,rn(t))}},sn=function(e){var t=window.devicePixelRatio||1,n=Ir("#sidepanels").width();rn(((t<1?n:n/t)>2||e?0:150*(t<1?1:t))-n)};Ir("#sidepanel_handle").mousedown((function(e){en=e.pageX,Ir(window).mousemove(an),nn=!1,setTimeout((function(){nn=!0}),20)})).mouseup((function(e){tn||sn(),en=-1,tn=!1})),Ir(window).mouseup((function(){en=-1,tn=!1,Ir("#svg_editor").unbind("mousemove",an)})),T();Ir(window).bind("load resize",(function(){_.css("line-height",_.height()+"px")})),Ir("#resolution").change((function(){var e=Ir("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");Ir("#canvas_width").val(t[0]),Ir("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===Ir("#canvas_width").val()&&e.removeAttr("disabled").val(100)})),Ir("input,select").attr("autocomplete","off");var cn,un,hn=["#tool_source_cancel","#tool_docprops_cancel","#tool_prefs_cancel",".overlay"],pn=(cn=[{sel:"#tool_select",fn:W,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:Le,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Me,evt:"click",key:["L",!0],parent:"#tools_line",prepend:!0},{sel:"#tool_rect",fn:je,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:Oe,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:Ve,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Be,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Re,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:Fe,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:Ye,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:qe,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:De,evt:"mouseup"},{sel:"#tool_zoom",fn:Ue,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:ht,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;L?Nt():(e={images:Ir.pref("img_save"),round_digits:6},Nr.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:gt,evt:"mouseup"},{sel:"#tool_open",fn:mt,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:vt,evt:"mouseup"},{sel:"#tool_source",fn:O,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:St,evt:"click",key:["F",!0]},{key:["esc",!1,!1],fn:function(){hn.every((function(e){return Ir(e+":hidden").length}))&&Nr.clearSelection()},hidekey:!0},{sel:hn.join(","),fn:Rt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Nt,evt:"click"},{sel:"#tool_docprops_save",fn:Ot,evt:"click"},{sel:"#tool_docprops",fn:Pt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:jt,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!Gt){Gt=!0,Ir("#main_menu").hide();var e=Dr.bkgd_color,t=Ir.pref("bkgd_url");_e.each((function(){var t=Ir(this),n=t.css("background-color")===e;t.toggleClass(be,n),n&&Ir("#canvas_bg_url").removeClass(be)})),e||_e.eq(0).addClass(be),t&&Ir("#canvas_bg_url").val(t),Ir("#grid_snapping_on").prop("checked",Ur.gridSnapping),Ir("#grid_snapping_step").attr("value",Ur.snappingStep),Ir("#grid_color").attr("value",Ur.gridColor),Ir("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:We,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:tt,evt:"click"},{sel:"#tool_node_link",fn:at,evt:"click"},{sel:"#tool_node_clone",fn:it,evt:"click"},{sel:"#tool_node_delete",fn:ot,evt:"click"},{sel:"#tool_openclose_path",fn:lt,evt:"click"},{sel:"#tool_add_subpath",fn:st,evt:"click"},{sel:"#tool_move_top",fn:Ze,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:$e,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:et,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:nt,evt:"click"},{sel:"#tool_undo",fn:yt,evt:"click"},{sel:"#tool_redo",fn:_t,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:xt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:bt,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:bt,evt:"click"},{sel:"#tool_unlink_use",fn:bt,evt:"click"},{sel:"[id^=tool_align]",fn:wt,evt:"click"},{sel:"#tool_bold",fn:pt,evt:"mousedown"},{sel:"#tool_italic",fn:ft,evt:"mousedown"},{sel:"#sidepanel_handle",fn:sn,key:["X"]},{sel:"#copy_save_done",fn:Rt,evt:"click"},{key:"ctrl+left",fn:function(){dt(0,1)}},{key:"ctrl+right",fn:function(){dt(1,1)}},{key:"ctrl+shift+left",fn:function(){dt(0,5)}},{key:"ctrl+shift+right",fn:function(){dt(1,5)}},{key:"shift+O",fn:ut},{key:"shift+P",fn:ct},{key:[m+"up",!0],fn:function(){He(2)}},{key:[m+"down",!0],fn:function(){He(.5)}},{key:[m+"]",!0],fn:function(){Je("Up")}},{key:[m+"[",!0],fn:function(){Je("Down")}},{key:["up",!0],fn:function(){rt(0,-1)}},{key:["down",!0],fn:function(){rt(0,1)}},{key:["left",!0],fn:function(){rt(-1,0)}},{key:["right",!0],fn:function(){rt(1,0)}},{key:"shift+up",fn:function(){rt(0,-10)}},{key:"shift+down",fn:function(){rt(0,10)}},{key:"shift+left",fn:function(){rt(-10,0)}},{key:"shift+right",fn:function(){rt(10,0)}},{key:["alt+up",!0],fn:function(){Nr.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){Nr.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){Nr.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){Nr.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){Nr.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){Nr.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){Nr.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){Nr.cloneSelectedElements(10,0)}},{key:"a",fn:function(){Nr.selectAllInCurrentLayer()}},{key:m+"a",fn:function(){Nr.selectAllInCurrentLayer()}},{key:m+"z",fn:yt},{key:m+"shift+z",fn:_t},{key:m+"y",fn:_t},{key:m+"x",fn:Xe},{key:m+"c",fn:Qe},{key:m+"v",fn:Ke}],un={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};Ir.each(cn,(function(t,n){var r;if(n.sel){if(!(r=Ir(n.sel)).length)return!0;if(n.evt&&(H()&&"click"===n.evt&&(n.evt="mousedown"),r[n.evt](n.fn)),n.parent&&Ir(n.parent+"_show").length){var a=Ir(n.parent);a.length||(a=ge(n.parent.substr(1))),n.prepend&&(r[0].style.margin="initial"),a[n.prepend?"prepend":"append"](r),Array.isArray(e[n.parent])||(e[n.parent]=[]),e[n.parent].push(n)}}if(n.key){var i,o=!1;Array.isArray(n.key)?(i=n.key[0],n.key.length>1&&(o=n.key[1])):i=n.key,i=String(i);var s=n.fn;if(Ir.each(i.split("/"),(function(e,t){Ir(document).bind("keydown",t,(function(e){return s(),o&&e.preventDefault(),!1}))})),n.sel&&!n.hidekey&&r.attr("title")){var l=r.attr("title").split("[")[0]+" ("+i+")";un[i]=n.sel,r.parents("#main_menu").length||r.attr("title",l)}}return!0})),fe(e),Ir(".attr_changer, #image_url").bind("keydown","return",(function(e){Ir(this).change(),e.preventDefault()})),Ir(window).bind("keydown","tab",(function(e){"canvas"===A&&(e.preventDefault(),ct())})).bind("keydown","shift+tab",(function(e){"canvas"===A&&(e.preventDefault(),ut())})),Ir("#tool_zoom").dblclick(ze)},setTitles:function(){Ir.each(un,(function(e,t){var n=Ir(t).parents("#main_menu").length;Ir(t).each((function(){var t;t=n?Ir(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";Ir.each(e.split("/"),(function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(Vr["key_"+t]||t)})),n?this.lastChild.textContent=t+" ["+r+"]":this.title=t+" ["+r+"]"}))}))},getButtonData:function(e){return Object.values(cn).find((function(t){return t.sel===e}))}});Pr.ready((function(){var e=Ur.initTool,t=Ir("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:Ir("#tool_select")).click().mouseup(),Ur.wireframe&&Ir("#tool_wireframe").click(),Ur.showlayers&&sn(),Ir("#rulers").toggle(Boolean(Ur.showRulers)),Ur.showRulers&&(Ir("#show_rulers")[0].checked=!0),Ur.baseUnit&&Ir("#base_unit").val(Ur.baseUnit),Ur.gridSnapping&&(Ir("#grid_snapping_on")[0].checked=!0),Ur.snappingStep&&Ir("#grid_snapping_step").val(Ur.snappingStep),Ur.gridColor&&Ir("#grid_color").val(Ur.gridColor)})),Ir("#rect_rx").SpinButton({min:0,max:1e3,stateObj:o,callback:function(e){Nr.setRectRadius(e.value)}}),Ir("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:o,callback:function(e){var t=e.value;0===t&&j&&["line","polyline"].includes(j.nodeName)&&(t=e.value=1),Nr.setStrokeWidth(t)}}),Ir("#angle").SpinButton({min:-180,max:180,step:5,stateObj:o,callback:function(e){Nr.setRotationAngle(e.value),Ir("#tool_reorient").toggleClass("disabled",0===parseInt(e.value))}}),Ir("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),r=n+t,a=r>=n;return 0===t?n:n>=24?a?Math.round(1.1*n):Math.round(n/1.1):n<=1?a?2*n:n/2:r},stateObj:o,callback:function(e){Nr.setFontSize(e.value)}}),Ir("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:o,callback:xe}),Ir("#blur").SpinButton({min:0,max:10,step:.1,stateObj:o,callback:we}),Ir("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var r=n+t;return 0===t?n:n>=100?r:r>=n?2*n:n/2},stateObj:o,callback:le}).val(100*Nr.getZoom()),Ir("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},(function(e,t,n){switch(e){case"delete":We();break;case"cut":Xe();break;case"copy":Qe();break;case"paste":Nr.pasteElements();break;case"paste_in_place":Nr.pasteElements("in_place");break;case"group":case"group_elements":Nr.groupSelectedElements();break;case"ungroup":Nr.ungroupSelectedElement();break;case"move_front":Ze();break;case"move_up":Je("Up");break;case"move_down":Je("Down");break;case"move_back":$e();break;default:Boolean(ln[e])&&function(e){return ln[e].action}(e).call()}}));var fn=function(e,t,n){switch(e){case"dupe":!function(){var e,t;regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=Nr.getCurrentDrawing().getCurrentLayerName()+" copy",n.next=3,regeneratorRuntime.awrap(Ir.prompt(Vr.notification.enterUniqueLayerName,e));case 3:if(t=n.sent){n.next=6;break}return n.abrupt("return");case 6:if(!Nr.getCurrentDrawing().hasLayer(t)){n.next=9;break}return Ir.alert(Vr.notification.dupeLayerName),n.abrupt("return");case 9:Nr.cloneLayer(t),ee(),T();case 12:case"end":return n.stop()}}))}();break;case"delete":$t();break;case"merge_down":Ir("#layerlist tr.layersel").index()!==Nr.getCurrentDrawing().getNumLayers()-1&&(Nr.mergeLayer(),ee(),T());break;case"merge_all":Nr.mergeAllLayers(),ee(),T()}};function mn(){var e;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}b[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if(Ir("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},fn),Ir("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},fn),Ir(".contextMenu li").mousedown((function(e){e.preventDefault()})),Ir("#cmenu_canvas li").disableContextMenu(),b.enableContextMenuItems("#delete,#cut,#copy"),mn(),window.addEventListener("storage",(function(e){"svgedit_clipboard"===e.key&&mn()})),window.addEventListener("beforeunload",(function(e){return 0===y.getUndoStackSize()&&(Pr.showSaveWarning=!1),!(!Ur.no_save_warning&&Pr.showSaveWarning)||(e.returnValue=Vr.notification.unsavedChanges,Vr.notification.unsavedChanges)})),Pr.canvas.getUIStrings=function(){return Vr},Pr.openPrep=function(){return Ir("#main_menu").hide(),0===y.getUndoStackSize()||Ir.confirm(Vr.notification.QwantToOpen)},window.FileReader){var yn=function(e){Ir.process_cancel(Vr.notification.loadingImage),e.stopPropagation(),e.preventDefault(),Ir("#workarea").removeAttr("style"),Ir("#main_menu").hide();var t,n="drop"===e.type?e.dataTransfer.files[0]:this.files[0];n?n.type.includes("image")&&(n.type.includes("svg")?((t=new FileReader).onloadend=function(e){var t=Nr.importSvgString(e.target.result,!0);Nr.ungroupSelectedElement(),Nr.ungroupSelectedElement(),Nr.groupSelectedElements(),Nr.alignSelectedElements("m","page"),Nr.alignSelectedElements("c","page"),Nr.selectOnly([t]),Ir("#dialog_box").hide()},t.readAsText(n)):((t=new FileReader).onloadend=function(e){var t=e.target.result,n=100,r=100,a=new Image;a.style.opacity=0,a.addEventListener("load",(function(){var e,i,o;n=a.offsetWidth||a.naturalWidth||a.width,r=a.offsetHeight||a.naturalHeight||a.height,e=n,i=r,o=Nr.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:Nr.getNextId(),style:"pointer-events:inherit"}}),Nr.setHref(o,t),Nr.selectOnly([o]),Nr.alignSelectedElements("m","page"),Nr.alignSelectedElements("c","page"),ee(),Ir("#dialog_box").hide()})),a.src=t},t.readAsDataURL(n))):Ir("#dialog_box").hide()};_[0].addEventListener("dragenter",(function(e){e.stopPropagation(),e.preventDefault()})),_[0].addEventListener("dragover",(function(e){e.stopPropagation(),e.preventDefault()})),_[0].addEventListener("dragleave",(function(e){e.stopPropagation(),e.preventDefault()})),_[0].addEventListener("drop",yn);var _n=Ir('').change((function(e){var t;return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(Pr.openPrep());case 2:if(e.sent){e.next=5;break}return e.abrupt("return");case 5:Nr.clear(),1===this.files.length&&(Ir.process_cancel(Vr.notification.loadingImage),(t=new FileReader).onloadend=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return t=e.target,n.next=3,regeneratorRuntime.awrap(Hr(t.result));case 3:$();case 4:case"end":return n.stop()}}))},t.readAsText(this.files[0]));case 7:case"end":return e.stop()}}),null,this)}));Ir("#tool_open").show().prepend(_n);var bn=Ir('').change(yn);Ir("#tool_import").show().prepend(bn)}$(!0);var xn=[],wn=Pr.setLang=function(e,t){var n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:if(Pr.langChanged=!0,Ir.pref("lang",e),Ir("#lang_select").val(e),t){i.next=5;break}return i.abrupt("return");case 5:if(document.documentElement.lang=t.lang,Ir.extend(Vr,t),n=Ir("#layerlist tr.layersel td.layername").text(),r=n===Vr.common.layer+" 1",Nr.setUiStrings(t),pn.setTitles(),r&&(Nr.renameCurrentLayer(Vr.common.layer+" 1"),T()),!ve.length){i.next=18;break}return i.next=15,regeneratorRuntime.awrap(Promise.all(ve.map((function(t){return xn.push(t.name),t.langReady({lang:e,uiStrings:Vr,importLocale:zr({defaultLang:e,defaultName:t.name})})}))));case 15:ve.length=0,i.next=19;break;case 18:xn.forEach((function(t){Nr.runExtension(t,"langReady",{lang:e,uiStrings:Vr,importLocale:zr({defaultLang:e,defaultName:t})})}));case 19:Nr.runExtensions("langChanged",e),he(),a={"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},Ir.each(a,(function(e,t){Ir(t).attr("title",Ir(e)[0].title)})),Ir("#multiselected_panel div[id^=tool_align]").each((function(){Ir("#tool_pos"+this.id.substr(10))[0].title=this.title}));case 24:case"end":return i.stop()}}))};!function(e){wr=e}({addLangData:function(e){return Nr.runExtensions("addLangData",(function(t){return{lang:e,importLocale:zr({defaultLang:e,defaultName:t})}}),!0)},curConfig:Ur}),"file:"===document.location.protocol?setTimeout(i,100):i()},Pr.ready=function(e){return new Promise((function(t,n){Rr?t(e()):Lr.push([e,t,n])}))},Pr.runCallbacks=function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,regeneratorRuntime.awrap(Promise.all(Lr.map((function(e){return(0,d(e,1)[0])()}))));case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),Lr.forEach((function(e){(0,d(e,3)[2])()})),e.t0;case 9:Lr.forEach((function(e){(0,d(e,2)[1])()})),Rr=!0;case 11:case"end":return e.stop()}}),null,null,[[0,5]])},Pr.loadFromString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Pr.ready((function(){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,regeneratorRuntime.awrap(Hr(e,{noAlert:n}));case 3:t.next=9;break;case 5:if(t.prev=5,t.t0=t.catch(0),!n){t.next=9;break}throw t.t0;case 9:case"end":return t.stop()}}),null,null,[[0,5]])}))},Pr.disableUI=function(e){},Pr.loadFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.cache,r=t.noAlert;return Pr.ready((function(){return new Promise((function(t,a){Ir.ajax({url:e,dataType:"text",cache:Boolean(n),beforeSend:function(){Ir.process_cancel(Vr.notification.loadingImage)},success:function(e){t(Hr(e,{noAlert:r}))},error:function(e,n,i){404!==e.status&&e.responseText?t(Hr(e.responseText,{noAlert:r})):r?a(new Error("URLLoadFail")):(Ir.alert(Vr.notification.URLLoadFail+": \n"+i),t())},complete:function(){Ir("#dialog_box").hide()}})}))}))},Pr.loadFromDataURI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Pr.ready((function(){var t=!1,r=e.match(/^data:image\/svg\+xml;base64,/);r?t=!0:r=e.match(/^data:image\/svg\+xml(?:;|;utf8)?,/),r&&(r=r[0]);var a=e.slice(r.length);return Hr(t?Et(a):decodeURIComponent(a),{noAlert:n})}))},Pr.addExtension=function(e,t,n){if(!Nr)throw new Error("Extension added too early");return Nr.addExtension.call(this,e,t,n)},Pr.ready((function(){cn()}));var qr=!1,Yr=[];window.addEventListener("message",(function(e){var t={data:e.data,origin:e.origin};qr?Nr.call("message",t):Yr.push(t)})),regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,regeneratorRuntime.awrap(Promise.resolve());case 3:Pr.init(),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:case"end":return e.stop()}}),null,null,[[0,6]]);export default Pr;
//# sourceMappingURL=index-es.min.js.map
diff --git a/dist/index-es.min.js.map b/dist/index-es.min.js.map
index c082dec8..5b882cc0 100644
--- a/dist/index-es.min.js.map
+++ b/dist/index-es.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"index-es.min.js","sources":["../editor/touch.js","../editor/namespaces.js","../editor/svgpathseg.js","../editor/browser.js","../editor/jQuery.attr.js","../editor/svgtransformlist.js","../editor/units.js","../editor/history.js","../editor/path.js","../editor/math.js","../editor/utilities.js","../editor/contextmenu.js","../editor/external/dynamic-import-polyfill/importModule.js","../editor/dbox.js","../editor/layer.js","../editor/historyrecording.js","../editor/draw.js","../editor/sanitize.js","../editor/recalculate.js","../editor/select.js","../editor/coords.js","../editor/svgcanvas.js","../editor/svgicons/jQuery.svgIcons.js","../editor/jgraduate/jQuery.jGraduate.js","../editor/jgraduate/jQuery.jPicker.js","../editor/locale/locale.js","../editor/external/load-stylesheets/index-es.js","../editor/svg-editor.js","../editor/js-hotkeys/jquery.hotkeys.min.js","../editor/jquerybbq/jquery.bbq.min.js","../editor/spinbtn/jQuery.SpinButton.js","../editor/contextmenu/jQuery.contextMenu.js"],"sourcesContent":["// http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/\n/**\n *\n * @param {Event} ev\n * @returns {void}\n */\nfunction touchHandler (ev) {\n const {changedTouches} = ev,\n first = changedTouches[0];\n\n let type = '';\n switch (ev.type) {\n case 'touchstart': type = 'mousedown'; break;\n case 'touchmove': type = 'mousemove'; break;\n case 'touchend': type = 'mouseup'; break;\n default: return;\n }\n\n const {screenX, screenY, clientX, clientY} = first; // eslint-disable-line no-shadow\n const simulatedEvent = new MouseEvent(type, {\n // Event interface\n bubbles: true,\n cancelable: true,\n // UIEvent interface\n view: window,\n detail: 1, // click count\n // MouseEvent interface (customized)\n screenX, screenY, clientX, clientY,\n // MouseEvent interface (defaults) - these could be removed\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0, // main button (usually left)\n relatedTarget: null\n });\n if (changedTouches.length < 2) {\n first.target.dispatchEvent(simulatedEvent);\n ev.preventDefault();\n }\n}\n\ndocument.addEventListener('touchstart', touchHandler, true);\ndocument.addEventListener('touchmove', touchHandler, true);\ndocument.addEventListener('touchend', touchHandler, true);\ndocument.addEventListener('touchcancel', touchHandler, true);\n","/**\n * Namespaces or tools therefor\n * @module namespaces\n * @license MIT\n*/\n\n/**\n* Common namepaces constants in alpha order\n* @enum {string}\n* @type {PlainObject}\n* @memberof module:namespaces\n*/\nexport const NS = {\n HTML: 'http://www.w3.org/1999/xhtml',\n MATH: 'http://www.w3.org/1998/Math/MathML',\n SE: 'http://svg-edit.googlecode.com',\n SVG: 'http://www.w3.org/2000/svg',\n XLINK: 'http://www.w3.org/1999/xlink',\n XML: 'http://www.w3.org/XML/1998/namespace',\n XMLNS: 'http://www.w3.org/2000/xmlns/' // see http://www.w3.org/TR/REC-xml-names/#xmlReserved\n};\n\n/**\n* @function module:namespaces.getReverseNS\n* @returns {string} The NS with key values switched and lowercase\n*/\nexport const getReverseNS = function () {\n const reverseNS = {};\n Object.entries(NS).forEach(([name, URI]) => {\n reverseNS[URI] = name.toLowerCase();\n });\n return reverseNS;\n};\n","/* globals SVGPathSeg, SVGPathSegMovetoRel, SVGPathSegMovetoAbs,\n SVGPathSegMovetoRel, SVGPathSegLinetoRel, SVGPathSegLinetoAbs,\n SVGPathSegLinetoHorizontalRel, SVGPathSegLinetoHorizontalAbs,\n SVGPathSegLinetoVerticalRel, SVGPathSegLinetoVerticalAbs,\n SVGPathSegClosePath, SVGPathSegCurvetoCubicRel,\n SVGPathSegCurvetoCubicAbs, SVGPathSegCurvetoCubicSmoothRel,\n SVGPathSegCurvetoCubicSmoothAbs, SVGPathSegCurvetoQuadraticRel,\n SVGPathSegCurvetoQuadraticAbs, SVGPathSegCurvetoQuadraticSmoothRel,\n SVGPathSegCurvetoQuadraticSmoothAbs, SVGPathSegArcRel, SVGPathSegArcAbs */\n/**\n* SVGPathSeg API polyfill\n* https://github.com/progers/pathseg\n*\n* This is a drop-in replacement for the `SVGPathSeg` and `SVGPathSegList` APIs\n* that were removed from SVG2 ({@link https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html}),\n* including the latest spec changes which were implemented in Firefox 43 and\n* Chrome 46.\n*/\n/* eslint-disable no-shadow, class-methods-use-this */\n// Linting: We avoid `no-shadow` as ESLint thinks these are still available globals\n// Linting: We avoid `class-methods-use-this` as this is a polyfill that must\n// follow the conventions\n(() => {\nif (!('SVGPathSeg' in window)) {\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSeg\n class SVGPathSeg {\n constructor (type, typeAsLetter, owningPathSegList) {\n this.pathSegType = type;\n this.pathSegTypeAsLetter = typeAsLetter;\n this._owningPathSegList = owningPathSegList;\n }\n // Notify owning PathSegList on any changes so they can be synchronized back to the path element.\n _segmentChanged () {\n if (this._owningPathSegList) {\n this._owningPathSegList.segmentChanged(this);\n }\n }\n }\n SVGPathSeg.prototype.classname = 'SVGPathSeg';\n\n SVGPathSeg.PATHSEG_UNKNOWN = 0;\n SVGPathSeg.PATHSEG_CLOSEPATH = 1;\n SVGPathSeg.PATHSEG_MOVETO_ABS = 2;\n SVGPathSeg.PATHSEG_MOVETO_REL = 3;\n SVGPathSeg.PATHSEG_LINETO_ABS = 4;\n SVGPathSeg.PATHSEG_LINETO_REL = 5;\n SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS = 6;\n SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL = 7;\n SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS = 8;\n SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL = 9;\n SVGPathSeg.PATHSEG_ARC_ABS = 10;\n SVGPathSeg.PATHSEG_ARC_REL = 11;\n SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS = 12;\n SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL = 13;\n SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS = 14;\n SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL = 15;\n SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16;\n SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;\n SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;\n SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;\n\n class SVGPathSegClosePath extends SVGPathSeg {\n constructor (owningPathSegList) {\n super(SVGPathSeg.PATHSEG_CLOSEPATH, 'z', owningPathSegList);\n }\n toString () { return '[object SVGPathSegClosePath]'; }\n _asPathString () { return this.pathSegTypeAsLetter; }\n clone () { return new SVGPathSegClosePath(undefined); }\n }\n\n class SVGPathSegMovetoAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_MOVETO_ABS, 'M', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegMovetoAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegMovetoAbs(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegMovetoAbs.prototype, {\n x: {\n get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true\n },\n y: {\n get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true\n }\n });\n\n class SVGPathSegMovetoRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_MOVETO_REL, 'm', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegMovetoRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegMovetoRel(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegMovetoRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegLinetoAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_LINETO_ABS, 'L', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegLinetoAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegLinetoAbs(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegLinetoAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegLinetoRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_LINETO_REL, 'l', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegLinetoRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegLinetoRel(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegLinetoRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x1, y1, x2, y2) {\n super(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, 'C', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x1 = x1;\n this._y1 = y1;\n this._x2 = x2;\n this._y2 = y2;\n }\n toString () { return '[object SVGPathSegCurvetoCubicAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoCubicAbs(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }\n }\n Object.defineProperties(SVGPathSegCurvetoCubicAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x1: {get () { return this._x1; }, set (x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true},\n y1: {get () { return this._y1; }, set (y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true},\n x2: {get () { return this._x2; }, set (x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true},\n y2: {get () { return this._y2; }, set (y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoCubicRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x1, y1, x2, y2) {\n super(SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, 'c', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x1 = x1;\n this._y1 = y1;\n this._x2 = x2;\n this._y2 = y2;\n }\n toString () { return '[object SVGPathSegCurvetoCubicRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoCubicRel(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }\n }\n Object.defineProperties(SVGPathSegCurvetoCubicRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x1: {get () { return this._x1; }, set (x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true},\n y1: {get () { return this._y1; }, set (y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true},\n x2: {get () { return this._x2; }, set (x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true},\n y2: {get () { return this._y2; }, set (y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x1, y1) {\n super(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, 'Q', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x1 = x1;\n this._y1 = y1;\n }\n toString () { return '[object SVGPathSegCurvetoQuadraticAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoQuadraticAbs(undefined, this._x, this._y, this._x1, this._y1); }\n }\n Object.defineProperties(SVGPathSegCurvetoQuadraticAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x1: {get () { return this._x1; }, set (x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true},\n y1: {get () { return this._y1; }, set (y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x1, y1) {\n super(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, 'q', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x1 = x1;\n this._y1 = y1;\n }\n toString () { return '[object SVGPathSegCurvetoQuadraticRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoQuadraticRel(undefined, this._x, this._y, this._x1, this._y1); }\n }\n Object.defineProperties(SVGPathSegCurvetoQuadraticRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x1: {get () { return this._x1; }, set (x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true},\n y1: {get () { return this._y1; }, set (y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegArcAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {\n super(SVGPathSeg.PATHSEG_ARC_ABS, 'A', owningPathSegList);\n this._x = x;\n this._y = y;\n this._r1 = r1;\n this._r2 = r2;\n this._angle = angle;\n this._largeArcFlag = largeArcFlag;\n this._sweepFlag = sweepFlag;\n }\n toString () { return '[object SVGPathSegArcAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._r1 + ' ' + this._r2 + ' ' + this._angle + ' ' + (this._largeArcFlag ? '1' : '0') + ' ' + (this._sweepFlag ? '1' : '0') + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegArcAbs(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }\n }\n Object.defineProperties(SVGPathSegArcAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n r1: {get () { return this._r1; }, set (r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true},\n r2: {get () { return this._r2; }, set (r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true},\n angle: {get () { return this._angle; }, set (angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true},\n largeArcFlag: {get () { return this._largeArcFlag; }, set (largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true},\n sweepFlag: {get () { return this._sweepFlag; }, set (sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegArcRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {\n super(SVGPathSeg.PATHSEG_ARC_REL, 'a', owningPathSegList);\n this._x = x;\n this._y = y;\n this._r1 = r1;\n this._r2 = r2;\n this._angle = angle;\n this._largeArcFlag = largeArcFlag;\n this._sweepFlag = sweepFlag;\n }\n toString () { return '[object SVGPathSegArcRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._r1 + ' ' + this._r2 + ' ' + this._angle + ' ' + (this._largeArcFlag ? '1' : '0') + ' ' + (this._sweepFlag ? '1' : '0') + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegArcRel(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }\n }\n Object.defineProperties(SVGPathSegArcRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n r1: {get () { return this._r1; }, set (r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true},\n r2: {get () { return this._r2; }, set (r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true},\n angle: {get () { return this._angle; }, set (angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true},\n largeArcFlag: {get () { return this._largeArcFlag; }, set (largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true},\n sweepFlag: {get () { return this._sweepFlag; }, set (sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\n constructor (owningPathSegList, x) {\n super(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, 'H', owningPathSegList);\n this._x = x;\n }\n toString () { return '[object SVGPathSegLinetoHorizontalAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x; }\n clone () { return new SVGPathSegLinetoHorizontalAbs(undefined, this._x); }\n }\n Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype, 'x', {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true});\n\n class SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\n constructor (owningPathSegList, x) {\n super(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, 'h', owningPathSegList);\n this._x = x;\n }\n toString () { return '[object SVGPathSegLinetoHorizontalRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x; }\n clone () { return new SVGPathSegLinetoHorizontalRel(undefined, this._x); }\n }\n Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype, 'x', {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true});\n\n class SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\n constructor (owningPathSegList, y) {\n super(SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, 'V', owningPathSegList);\n this._y = y;\n }\n toString () { return '[object SVGPathSegLinetoVerticalAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._y; }\n clone () { return new SVGPathSegLinetoVerticalAbs(undefined, this._y); }\n }\n Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype, 'y', {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true});\n\n class SVGPathSegLinetoVerticalRel extends SVGPathSeg {\n constructor (owningPathSegList, y) {\n super(SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, 'v', owningPathSegList);\n this._y = y;\n }\n toString () { return '[object SVGPathSegLinetoVerticalRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._y; }\n clone () { return new SVGPathSegLinetoVerticalRel(undefined, this._y); }\n }\n Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype, 'y', {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true});\n\n class SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x2, y2) {\n super(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, 'S', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x2 = x2;\n this._y2 = y2;\n }\n toString () { return '[object SVGPathSegCurvetoCubicSmoothAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, this._x, this._y, this._x2, this._y2); }\n }\n Object.defineProperties(SVGPathSegCurvetoCubicSmoothAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x2: {get () { return this._x2; }, set (x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true},\n y2: {get () { return this._y2; }, set (y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y, x2, y2) {\n super(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, 's', owningPathSegList);\n this._x = x;\n this._y = y;\n this._x2 = x2;\n this._y2 = y2;\n }\n toString () { return '[object SVGPathSegCurvetoCubicSmoothRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoCubicSmoothRel(undefined, this._x, this._y, this._x2, this._y2); }\n }\n Object.defineProperties(SVGPathSegCurvetoCubicSmoothRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true},\n x2: {get () { return this._x2; }, set (x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true},\n y2: {get () { return this._y2; }, set (y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, 'T', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegCurvetoQuadraticSmoothAbs]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true}\n });\n\n class SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\n constructor (owningPathSegList, x, y) {\n super(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, 't', owningPathSegList);\n this._x = x;\n this._y = y;\n }\n toString () { return '[object SVGPathSegCurvetoQuadraticSmoothRel]'; }\n _asPathString () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }\n clone () { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, this._x, this._y); }\n }\n Object.defineProperties(SVGPathSegCurvetoQuadraticSmoothRel.prototype, {\n x: {get () { return this._x; }, set (x) { this._x = x; this._segmentChanged(); }, enumerable: true},\n y: {get () { return this._y; }, set (y) { this._y = y; this._segmentChanged(); }, enumerable: true}\n });\n\n // Add createSVGPathSeg* functions to SVGPathElement.\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathElement.\n SVGPathElement.prototype.createSVGPathSegClosePath = function () { return new SVGPathSegClosePath(undefined); };\n SVGPathElement.prototype.createSVGPathSegMovetoAbs = function (x, y) { return new SVGPathSegMovetoAbs(undefined, x, y); };\n SVGPathElement.prototype.createSVGPathSegMovetoRel = function (x, y) { return new SVGPathSegMovetoRel(undefined, x, y); };\n SVGPathElement.prototype.createSVGPathSegLinetoAbs = function (x, y) { return new SVGPathSegLinetoAbs(undefined, x, y); };\n SVGPathElement.prototype.createSVGPathSegLinetoRel = function (x, y) { return new SVGPathSegLinetoRel(undefined, x, y); };\n SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs = function (x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicAbs(undefined, x, y, x1, y1, x2, y2); };\n SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel = function (x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicRel(undefined, x, y, x1, y1, x2, y2); };\n SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs = function (x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticAbs(undefined, x, y, x1, y1); };\n SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel = function (x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticRel(undefined, x, y, x1, y1); };\n SVGPathElement.prototype.createSVGPathSegArcAbs = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcAbs(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); };\n SVGPathElement.prototype.createSVGPathSegArcRel = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcRel(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); };\n SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs = function (x) { return new SVGPathSegLinetoHorizontalAbs(undefined, x); };\n SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel = function (x) { return new SVGPathSegLinetoHorizontalRel(undefined, x); };\n SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs = function (y) { return new SVGPathSegLinetoVerticalAbs(undefined, y); };\n SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel = function (y) { return new SVGPathSegLinetoVerticalRel(undefined, y); };\n SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs = function (x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, x, y, x2, y2); };\n SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel = function (x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothRel(undefined, x, y, x2, y2); };\n SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs = function (x, y) { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, x, y); };\n SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel = function (x, y) { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, x, y); };\n\n if (!('getPathSegAtLength' in SVGPathElement.prototype)) {\n // Add getPathSegAtLength to SVGPathElement.\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-__svg__SVGPathElement__getPathSegAtLength\n // This polyfill requires SVGPathElement.getTotalLength to implement the distance-along-a-path algorithm.\n SVGPathElement.prototype.getPathSegAtLength = function (distance) {\n if (distance === undefined || !isFinite(distance)) {\n throw new Error('Invalid arguments.');\n }\n\n const measurementElement = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n measurementElement.setAttribute('d', this.getAttribute('d'));\n let lastPathSegment = measurementElement.pathSegList.numberOfItems - 1;\n\n // If the path is empty, return 0.\n if (lastPathSegment <= 0) {\n return 0;\n }\n\n do {\n measurementElement.pathSegList.removeItem(lastPathSegment);\n if (distance > measurementElement.getTotalLength()) {\n break;\n }\n lastPathSegment--;\n } while (lastPathSegment > 0);\n return lastPathSegment;\n };\n }\n\n window.SVGPathSeg = SVGPathSeg;\n window.SVGPathSegClosePath = SVGPathSegClosePath;\n window.SVGPathSegMovetoAbs = SVGPathSegMovetoAbs;\n window.SVGPathSegMovetoRel = SVGPathSegMovetoRel;\n window.SVGPathSegLinetoAbs = SVGPathSegLinetoAbs;\n window.SVGPathSegLinetoRel = SVGPathSegLinetoRel;\n window.SVGPathSegCurvetoCubicAbs = SVGPathSegCurvetoCubicAbs;\n window.SVGPathSegCurvetoCubicRel = SVGPathSegCurvetoCubicRel;\n window.SVGPathSegCurvetoQuadraticAbs = SVGPathSegCurvetoQuadraticAbs;\n window.SVGPathSegCurvetoQuadraticRel = SVGPathSegCurvetoQuadraticRel;\n window.SVGPathSegArcAbs = SVGPathSegArcAbs;\n window.SVGPathSegArcRel = SVGPathSegArcRel;\n window.SVGPathSegLinetoHorizontalAbs = SVGPathSegLinetoHorizontalAbs;\n window.SVGPathSegLinetoHorizontalRel = SVGPathSegLinetoHorizontalRel;\n window.SVGPathSegLinetoVerticalAbs = SVGPathSegLinetoVerticalAbs;\n window.SVGPathSegLinetoVerticalRel = SVGPathSegLinetoVerticalRel;\n window.SVGPathSegCurvetoCubicSmoothAbs = SVGPathSegCurvetoCubicSmoothAbs;\n window.SVGPathSegCurvetoCubicSmoothRel = SVGPathSegCurvetoCubicSmoothRel;\n window.SVGPathSegCurvetoQuadraticSmoothAbs = SVGPathSegCurvetoQuadraticSmoothAbs;\n window.SVGPathSegCurvetoQuadraticSmoothRel = SVGPathSegCurvetoQuadraticSmoothRel;\n}\n\n// Checking for SVGPathSegList in window checks for the case of an implementation without the\n// SVGPathSegList API.\n// The second check for appendItem is specific to Firefox 59+ which removed only parts of the\n// SVGPathSegList API (e.g., appendItem). In this case we need to re-implement the entire API\n// so the polyfill data (i.e., _list) is used throughout.\nif (!('SVGPathSegList' in window) || !('appendItem' in window.SVGPathSegList.prototype)) {\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSegList\n class SVGPathSegList {\n constructor (pathElement) {\n this._pathElement = pathElement;\n this._list = this._parsePath(this._pathElement.getAttribute('d'));\n\n // Use a MutationObserver to catch changes to the path's \"d\" attribute.\n this._mutationObserverConfig = {attributes: true, attributeFilter: ['d']};\n this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this));\n this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);\n }\n // Process any pending mutations to the path element and update the list as needed.\n // This should be the first call of all public functions and is needed because\n // MutationObservers are not synchronous so we can have pending asynchronous mutations.\n _checkPathSynchronizedToList () {\n this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords());\n }\n\n _updateListFromPathMutations (mutationRecords) {\n if (!this._pathElement) {\n return;\n }\n let hasPathMutations = false;\n mutationRecords.forEach((record) => {\n if (record.attributeName === 'd') {\n hasPathMutations = true;\n }\n });\n if (hasPathMutations) {\n this._list = this._parsePath(this._pathElement.getAttribute('d'));\n }\n }\n\n // Serialize the list and update the path's 'd' attribute.\n _writeListToPath () {\n this._pathElementMutationObserver.disconnect();\n this._pathElement.setAttribute('d', SVGPathSegList._pathSegArrayAsString(this._list));\n this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);\n }\n\n // When a path segment changes the list needs to be synchronized back to the path element.\n segmentChanged (pathSeg) {\n this._writeListToPath();\n }\n\n clear () {\n this._checkPathSynchronizedToList();\n\n this._list.forEach((pathSeg) => {\n pathSeg._owningPathSegList = null;\n });\n this._list = [];\n this._writeListToPath();\n }\n\n initialize (newItem) {\n this._checkPathSynchronizedToList();\n\n this._list = [newItem];\n newItem._owningPathSegList = this;\n this._writeListToPath();\n return newItem;\n }\n\n _checkValidIndex (index) {\n if (isNaN(index) || index < 0 || index >= this.numberOfItems) {\n throw new Error('INDEX_SIZE_ERR');\n }\n }\n\n getItem (index) {\n this._checkPathSynchronizedToList();\n\n this._checkValidIndex(index);\n return this._list[index];\n }\n\n insertItemBefore (newItem, index) {\n this._checkPathSynchronizedToList();\n\n // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.\n if (index > this.numberOfItems) {\n index = this.numberOfItems;\n }\n if (newItem._owningPathSegList) {\n // SVG2 spec says to make a copy.\n newItem = newItem.clone();\n }\n this._list.splice(index, 0, newItem);\n newItem._owningPathSegList = this;\n this._writeListToPath();\n return newItem;\n }\n\n replaceItem (newItem, index) {\n this._checkPathSynchronizedToList();\n\n if (newItem._owningPathSegList) {\n // SVG2 spec says to make a copy.\n newItem = newItem.clone();\n }\n this._checkValidIndex(index);\n this._list[index] = newItem;\n newItem._owningPathSegList = this;\n this._writeListToPath();\n return newItem;\n }\n\n removeItem (index) {\n this._checkPathSynchronizedToList();\n\n this._checkValidIndex(index);\n const item = this._list[index];\n this._list.splice(index, 1);\n this._writeListToPath();\n return item;\n }\n\n appendItem (newItem) {\n this._checkPathSynchronizedToList();\n\n if (newItem._owningPathSegList) {\n // SVG2 spec says to make a copy.\n newItem = newItem.clone();\n }\n this._list.push(newItem);\n newItem._owningPathSegList = this;\n // TODO: Optimize this to just append to the existing attribute.\n this._writeListToPath();\n return newItem;\n }\n\n // This closely follows SVGPathParser::parsePath from Source/core/svg/SVGPathParser.cpp.\n _parsePath (string) {\n if (!string || !string.length) {\n return [];\n }\n\n const owningPathSegList = this; // eslint-disable-line consistent-this\n\n class Builder {\n constructor () {\n this.pathSegList = [];\n }\n appendSegment (pathSeg) {\n this.pathSegList.push(pathSeg);\n }\n }\n\n class Source {\n constructor (string) {\n this._string = string;\n this._currentIndex = 0;\n this._endIndex = this._string.length;\n this._previousCommand = SVGPathSeg.PATHSEG_UNKNOWN;\n\n this._skipOptionalSpaces();\n }\n _isCurrentSpace () {\n const character = this._string[this._currentIndex];\n return character <= ' ' && (character === ' ' || character === '\\n' || character === '\\t' || character === '\\r' || character === '\\f');\n }\n\n _skipOptionalSpaces () {\n while (this._currentIndex < this._endIndex && this._isCurrentSpace()) {\n this._currentIndex++;\n }\n return this._currentIndex < this._endIndex;\n }\n\n _skipOptionalSpacesOrDelimiter () {\n if (this._currentIndex < this._endIndex && !this._isCurrentSpace() && this._string.charAt(this._currentIndex) !== ',') {\n return false;\n }\n if (this._skipOptionalSpaces()) {\n if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) === ',') {\n this._currentIndex++;\n this._skipOptionalSpaces();\n }\n }\n return this._currentIndex < this._endIndex;\n }\n\n hasMoreData () {\n return this._currentIndex < this._endIndex;\n }\n\n peekSegmentType () {\n const lookahead = this._string[this._currentIndex];\n return this._pathSegTypeFromChar(lookahead);\n }\n\n _pathSegTypeFromChar (lookahead) {\n switch (lookahead) {\n case 'Z':\n case 'z':\n return SVGPathSeg.PATHSEG_CLOSEPATH;\n case 'M':\n return SVGPathSeg.PATHSEG_MOVETO_ABS;\n case 'm':\n return SVGPathSeg.PATHSEG_MOVETO_REL;\n case 'L':\n return SVGPathSeg.PATHSEG_LINETO_ABS;\n case 'l':\n return SVGPathSeg.PATHSEG_LINETO_REL;\n case 'C':\n return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;\n case 'c':\n return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;\n case 'Q':\n return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;\n case 'q':\n return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;\n case 'A':\n return SVGPathSeg.PATHSEG_ARC_ABS;\n case 'a':\n return SVGPathSeg.PATHSEG_ARC_REL;\n case 'H':\n return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;\n case 'h':\n return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;\n case 'V':\n return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;\n case 'v':\n return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;\n case 'S':\n return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;\n case 's':\n return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;\n case 'T':\n return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;\n case 't':\n return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;\n default:\n return SVGPathSeg.PATHSEG_UNKNOWN;\n }\n }\n\n _nextCommandHelper (lookahead, previousCommand) {\n // Check for remaining coordinates in the current command.\n if ((lookahead === '+' || lookahead === '-' || lookahead === '.' || (lookahead >= '0' && lookahead <= '9')) && previousCommand !== SVGPathSeg.PATHSEG_CLOSEPATH) {\n if (previousCommand === SVGPathSeg.PATHSEG_MOVETO_ABS) {\n return SVGPathSeg.PATHSEG_LINETO_ABS;\n }\n if (previousCommand === SVGPathSeg.PATHSEG_MOVETO_REL) {\n return SVGPathSeg.PATHSEG_LINETO_REL;\n }\n return previousCommand;\n }\n return SVGPathSeg.PATHSEG_UNKNOWN;\n }\n\n initialCommandIsMoveTo () {\n // If the path is empty it is still valid, so return true.\n if (!this.hasMoreData()) {\n return true;\n }\n const command = this.peekSegmentType();\n // Path must start with moveTo.\n return command === SVGPathSeg.PATHSEG_MOVETO_ABS || command === SVGPathSeg.PATHSEG_MOVETO_REL;\n }\n\n // Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp.\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF\n _parseNumber () {\n let exponent = 0;\n let integer = 0;\n let frac = 1;\n let decimal = 0;\n let sign = 1;\n let expsign = 1;\n\n const startIndex = this._currentIndex;\n\n this._skipOptionalSpaces();\n\n // Read the sign.\n if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) === '+') {\n this._currentIndex++;\n } else if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) === '-') {\n this._currentIndex++;\n sign = -1;\n }\n\n if (this._currentIndex === this._endIndex || ((this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') && this._string.charAt(this._currentIndex) !== '.')) {\n // The first character of a number must be one of [0-9+-.].\n return undefined;\n }\n\n // Read the integer part, build right-to-left.\n const startIntPartIndex = this._currentIndex;\n while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') {\n this._currentIndex++; // Advance to first non-digit.\n }\n\n if (this._currentIndex !== startIntPartIndex) {\n let scanIntPartIndex = this._currentIndex - 1;\n let multiplier = 1;\n while (scanIntPartIndex >= startIntPartIndex) {\n integer += multiplier * (this._string.charAt(scanIntPartIndex--) - '0');\n multiplier *= 10;\n }\n }\n\n // Read the decimals.\n if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) === '.') {\n this._currentIndex++;\n\n // There must be a least one digit following the .\n if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') {\n return undefined;\n }\n while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') {\n frac *= 10;\n decimal += (this._string.charAt(this._currentIndex) - '0') / frac;\n this._currentIndex += 1;\n }\n }\n\n // Read the exponent part.\n if (this._currentIndex !== startIndex && this._currentIndex + 1 < this._endIndex && (this._string.charAt(this._currentIndex) === 'e' || this._string.charAt(this._currentIndex) === 'E') && (this._string.charAt(this._currentIndex + 1) !== 'x' && this._string.charAt(this._currentIndex + 1) !== 'm')) {\n this._currentIndex++;\n\n // Read the sign of the exponent.\n if (this._string.charAt(this._currentIndex) === '+') {\n this._currentIndex++;\n } else if (this._string.charAt(this._currentIndex) === '-') {\n this._currentIndex++;\n expsign = -1;\n }\n\n // There must be an exponent.\n if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') {\n return undefined;\n }\n\n while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') {\n exponent *= 10;\n exponent += (this._string.charAt(this._currentIndex) - '0');\n this._currentIndex++;\n }\n }\n\n let number = integer + decimal;\n number *= sign;\n\n if (exponent) {\n number *= 10 ** (expsign * exponent);\n }\n\n if (startIndex === this._currentIndex) {\n return undefined;\n }\n\n this._skipOptionalSpacesOrDelimiter();\n\n return number;\n }\n\n _parseArcFlag () {\n if (this._currentIndex >= this._endIndex) {\n return undefined;\n }\n let flag = false;\n const flagChar = this._string.charAt(this._currentIndex++);\n if (flagChar === '0') {\n flag = false;\n } else if (flagChar === '1') {\n flag = true;\n } else {\n return undefined;\n }\n\n this._skipOptionalSpacesOrDelimiter();\n return flag;\n }\n\n parseSegment () {\n const lookahead = this._string[this._currentIndex];\n let command = this._pathSegTypeFromChar(lookahead);\n if (command === SVGPathSeg.PATHSEG_UNKNOWN) {\n // Possibly an implicit command. Not allowed if this is the first command.\n if (this._previousCommand === SVGPathSeg.PATHSEG_UNKNOWN) {\n return null;\n }\n command = this._nextCommandHelper(lookahead, this._previousCommand);\n if (command === SVGPathSeg.PATHSEG_UNKNOWN) {\n return null;\n }\n } else {\n this._currentIndex++;\n }\n\n this._previousCommand = command;\n\n switch (command) {\n case SVGPathSeg.PATHSEG_MOVETO_REL:\n return new SVGPathSegMovetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_MOVETO_ABS:\n return new SVGPathSegMovetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_REL:\n return new SVGPathSegLinetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_ABS:\n return new SVGPathSegLinetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:\n return new SVGPathSegLinetoHorizontalRel(owningPathSegList, this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:\n return new SVGPathSegLinetoHorizontalAbs(owningPathSegList, this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:\n return new SVGPathSegLinetoVerticalRel(owningPathSegList, this._parseNumber());\n case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:\n return new SVGPathSegLinetoVerticalAbs(owningPathSegList, this._parseNumber());\n case SVGPathSeg.PATHSEG_CLOSEPATH:\n this._skipOptionalSpaces();\n return new SVGPathSegClosePath(owningPathSegList);\n case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);\n } case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoCubicAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);\n } case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: {\n const points = {x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, points.x, points.y, points.x2, points.y2);\n } case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: {\n const points = {x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, points.x, points.y, points.x2, points.y2);\n } case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoQuadraticRel(owningPathSegList, points.x, points.y, points.x1, points.y1);\n } case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1);\n } case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:\n return new SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:\n return new SVGPathSegCurvetoQuadraticSmoothAbs(owningPathSegList, this._parseNumber(), this._parseNumber());\n case SVGPathSeg.PATHSEG_ARC_REL: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegArcRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);\n } case SVGPathSeg.PATHSEG_ARC_ABS: {\n const points = {x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber()};\n return new SVGPathSegArcAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);\n } default:\n throw new Error('Unknown path seg type.');\n }\n }\n }\n\n const builder = new Builder();\n const source = new Source(string);\n\n if (!source.initialCommandIsMoveTo()) {\n return [];\n }\n while (source.hasMoreData()) {\n const pathSeg = source.parseSegment();\n if (!pathSeg) {\n return [];\n }\n builder.appendSegment(pathSeg);\n }\n\n return builder.pathSegList;\n }\n\n // STATIC\n static _pathSegArrayAsString (pathSegArray) {\n let string = '';\n let first = true;\n pathSegArray.forEach((pathSeg) => {\n if (first) {\n first = false;\n string += pathSeg._asPathString();\n } else {\n string += ' ' + pathSeg._asPathString();\n }\n });\n return string;\n }\n }\n\n SVGPathSegList.prototype.classname = 'SVGPathSegList';\n\n Object.defineProperty(SVGPathSegList.prototype, 'numberOfItems', {\n get () {\n this._checkPathSynchronizedToList();\n return this._list.length;\n },\n enumerable: true\n });\n\n // Add the pathSegList accessors to SVGPathElement.\n // Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData\n Object.defineProperties(SVGPathElement.prototype, {\n pathSegList: {\n get () {\n if (!this._pathSegList) {\n this._pathSegList = new SVGPathSegList(this);\n }\n return this._pathSegList;\n },\n enumerable: true\n },\n // TODO: The following are not implemented and simply return SVGPathElement.pathSegList.\n normalizedPathSegList: {get () { return this.pathSegList; }, enumerable: true},\n animatedPathSegList: {get () { return this.pathSegList; }, enumerable: true},\n animatedNormalizedPathSegList: {get () { return this.pathSegList; }, enumerable: true}\n });\n window.SVGPathSegList = SVGPathSegList;\n}\n})();\n","/* globals jQuery */\n/**\n * Browser detection\n * @module browser\n * @license MIT\n *\n * @copyright 2010 Jeff Schiller, 2010 Alexis Deveria\n */\n\n// Dependencies:\n// 1) jQuery (for $.alert())\n\nimport './svgpathseg.js';\nimport {NS} from './namespaces.js';\n\nconst $ = jQuery;\n\nconst supportsSVG_ = (function () {\nreturn Boolean(document.createElementNS && document.createElementNS(NS.SVG, 'svg').createSVGRect);\n}());\n\n/**\n * @function module:browser.supportsSvg\n * @returns {boolean}\n*/\nexport const supportsSvg = () => supportsSVG_;\n\nconst {userAgent} = navigator;\nconst svg = document.createElementNS(NS.SVG, 'svg');\n\n// Note: Browser sniffing should only be used if no other detection method is possible\nconst isOpera_ = Boolean(window.opera);\nconst isWebkit_ = userAgent.includes('AppleWebKit');\nconst isGecko_ = userAgent.includes('Gecko/');\nconst isIE_ = userAgent.includes('MSIE');\nconst isChrome_ = userAgent.includes('Chrome/');\nconst isWindows_ = userAgent.includes('Windows');\nconst isMac_ = userAgent.includes('Macintosh');\nconst isTouch_ = 'ontouchstart' in window;\n\nconst supportsSelectors_ = (function () {\nreturn Boolean(svg.querySelector);\n}());\n\nconst supportsXpath_ = (function () {\nreturn Boolean(document.evaluate);\n}());\n\n// segList functions (for FF1.5 and 2.0)\nconst supportsPathReplaceItem_ = (function () {\nconst path = document.createElementNS(NS.SVG, 'path');\npath.setAttribute('d', 'M0,0 10,10');\nconst seglist = path.pathSegList;\nconst seg = path.createSVGPathSegLinetoAbs(5, 5);\ntry {\n seglist.replaceItem(seg, 1);\n return true;\n} catch (err) {}\nreturn false;\n}());\n\nconst supportsPathInsertItemBefore_ = (function () {\nconst path = document.createElementNS(NS.SVG, 'path');\npath.setAttribute('d', 'M0,0 10,10');\nconst seglist = path.pathSegList;\nconst seg = path.createSVGPathSegLinetoAbs(5, 5);\ntry {\n seglist.insertItemBefore(seg, 1);\n return true;\n} catch (err) {}\nreturn false;\n}());\n\n// text character positioning (for IE9 and now Chrome)\nconst supportsGoodTextCharPos_ = (function () {\nconst svgroot = document.createElementNS(NS.SVG, 'svg');\nconst svgcontent = document.createElementNS(NS.SVG, 'svg');\ndocument.documentElement.append(svgroot);\nsvgcontent.setAttribute('x', 5);\nsvgroot.append(svgcontent);\nconst text = document.createElementNS(NS.SVG, 'text');\ntext.textContent = 'a';\nsvgcontent.append(text);\ntry { // Chrome now fails here\n const pos = text.getStartPositionOfChar(0).x;\n return (pos === 0);\n} catch (err) {\n return false;\n} finally {\n svgroot.remove();\n}\n}());\n\nconst supportsPathBBox_ = (function () {\nconst svgcontent = document.createElementNS(NS.SVG, 'svg');\ndocument.documentElement.append(svgcontent);\nconst path = document.createElementNS(NS.SVG, 'path');\npath.setAttribute('d', 'M0,0 C0,0 10,10 10,0');\nsvgcontent.append(path);\nconst bbox = path.getBBox();\nsvgcontent.remove();\nreturn (bbox.height > 4 && bbox.height < 5);\n}());\n\n// Support for correct bbox sizing on groups with horizontal/vertical lines\nconst supportsHVLineContainerBBox_ = (function () {\nconst svgcontent = document.createElementNS(NS.SVG, 'svg');\ndocument.documentElement.append(svgcontent);\nconst path = document.createElementNS(NS.SVG, 'path');\npath.setAttribute('d', 'M0,0 10,0');\nconst path2 = document.createElementNS(NS.SVG, 'path');\npath2.setAttribute('d', 'M5,0 15,0');\nconst g = document.createElementNS(NS.SVG, 'g');\ng.append(path, path2);\nsvgcontent.append(g);\nconst bbox = g.getBBox();\nsvgcontent.remove();\n// Webkit gives 0, FF gives 10, Opera (correctly) gives 15\nreturn (bbox.width === 15);\n}());\n\nconst supportsEditableText_ = (function () {\n// TODO: Find better way to check support for this\nreturn isOpera_;\n}());\n\nconst supportsGoodDecimals_ = (function () {\n// Correct decimals on clone attributes (Opera < 10.5/win/non-en)\nconst rect = document.createElementNS(NS.SVG, 'rect');\nrect.setAttribute('x', 0.1);\nconst crect = rect.cloneNode(false);\nconst retValue = (!crect.getAttribute('x').includes(','));\nif (!retValue) {\n // Todo: i18nize or remove\n $.alert(\n 'NOTE: This version of Opera is known to contain bugs in SVG-edit.\\n' +\n 'Please upgrade to the latest version in which the problems have been fixed.'\n );\n}\nreturn retValue;\n}());\n\nconst supportsNonScalingStroke_ = (function () {\nconst rect = document.createElementNS(NS.SVG, 'rect');\nrect.setAttribute('style', 'vector-effect:non-scaling-stroke');\nreturn rect.style.vectorEffect === 'non-scaling-stroke';\n}());\n\nlet supportsNativeSVGTransformLists_ = (function () {\nconst rect = document.createElementNS(NS.SVG, 'rect');\nconst rxform = rect.transform.baseVal;\nconst t1 = svg.createSVGTransform();\nrxform.appendItem(t1);\nconst r1 = rxform.getItem(0);\nconst isSVGTransform = (o) => {\n // https://developer.mozilla.org/en-US/docs/Web/API/SVGTransform\n return o && typeof o === 'object' && typeof o.setMatrix === 'function' && 'angle' in o;\n};\nreturn isSVGTransform(r1) && isSVGTransform(t1) &&\n r1.type === t1.type && r1.angle === t1.angle &&\n r1.matrix.a === t1.matrix.a &&\n r1.matrix.b === t1.matrix.b &&\n r1.matrix.c === t1.matrix.c &&\n r1.matrix.d === t1.matrix.d &&\n r1.matrix.e === t1.matrix.e &&\n r1.matrix.f === t1.matrix.f;\n}());\n\n// Public API\n\n/**\n * @function module:browser.isOpera\n * @returns {boolean}\n*/\nexport const isOpera = () => isOpera_;\n/**\n * @function module:browser.isWebkit\n * @returns {boolean}\n*/\nexport const isWebkit = () => isWebkit_;\n/**\n * @function module:browser.isGecko\n * @returns {boolean}\n*/\nexport const isGecko = () => isGecko_;\n/**\n * @function module:browser.isIE\n * @returns {boolean}\n*/\nexport const isIE = () => isIE_;\n/**\n * @function module:browser.isChrome\n * @returns {boolean}\n*/\nexport const isChrome = () => isChrome_;\n/**\n * @function module:browser.isWindows\n * @returns {boolean}\n*/\nexport const isWindows = () => isWindows_;\n/**\n * @function module:browser.isMac\n * @returns {boolean}\n*/\nexport const isMac = () => isMac_;\n/**\n * @function module:browser.isTouch\n * @returns {boolean}\n*/\nexport const isTouch = () => isTouch_;\n\n/**\n * @function module:browser.supportsSelectors\n * @returns {boolean}\n*/\nexport const supportsSelectors = () => supportsSelectors_;\n\n/**\n * @function module:browser.supportsXpath\n * @returns {boolean}\n*/\nexport const supportsXpath = () => supportsXpath_;\n\n/**\n * @function module:browser.supportsPathReplaceItem\n * @returns {boolean}\n*/\nexport const supportsPathReplaceItem = () => supportsPathReplaceItem_;\n\n/**\n * @function module:browser.supportsPathInsertItemBefore\n * @returns {boolean}\n*/\nexport const supportsPathInsertItemBefore = () => supportsPathInsertItemBefore_;\n\n/**\n * @function module:browser.supportsPathBBox\n * @returns {boolean}\n*/\nexport const supportsPathBBox = () => supportsPathBBox_;\n\n/**\n * @function module:browser.supportsHVLineContainerBBox\n * @returns {boolean}\n*/\nexport const supportsHVLineContainerBBox = () => supportsHVLineContainerBBox_;\n\n/**\n * @function module:browser.supportsGoodTextCharPos\n * @returns {boolean}\n*/\nexport const supportsGoodTextCharPos = () => supportsGoodTextCharPos_;\n\n/**\n* @function module:browser.supportsEditableText\n * @returns {boolean}\n*/\nexport const supportsEditableText = () => supportsEditableText_;\n\n/**\n * @function module:browser.supportsGoodDecimals\n * @returns {boolean}\n*/\nexport const supportsGoodDecimals = () => supportsGoodDecimals_;\n\n/**\n* @function module:browser.supportsNonScalingStroke\n* @returns {boolean}\n*/\nexport const supportsNonScalingStroke = () => supportsNonScalingStroke_;\n\n/**\n* @function module:browser.supportsNativeTransformLists\n* @returns {boolean}\n*/\nexport const supportsNativeTransformLists = () => supportsNativeSVGTransformLists_;\n\n/**\n * Set `supportsNativeSVGTransformLists_` to `false` (for unit testing).\n * @function module:browser.disableSupportsNativeTransformLists\n * @returns {void}\n*/\nexport const disableSupportsNativeTransformLists = () => {\n supportsNativeSVGTransformLists_ = false;\n};\n","/**\n * jQuery module to work with SVG attributes\n * @module jQueryAttr\n * @license MIT\n */\n\n/**\n* This fixes `$(...).attr()` to work as expected with SVG elements.\n* Does not currently use `*AttributeNS()` since we rarely need that.\n* Adds {@link external:jQuery.fn.attr}.\n* See {@link https://api.jquery.com/attr/} for basic documentation of `.attr()`.\n*\n* Additional functionality:\n* - When getting attributes, a string that's a number is returned as type number.\n* - If an array is supplied as the first parameter, multiple values are returned\n* as an object with values for each given attribute.\n* @function module:jQueryAttr.jQueryAttr\n* @param {external:jQuery} $ The jQuery object to which to add the plug-in\n* @returns {external:jQuery}\n*/\nexport default function jQueryPluginSVG ($) {\n const proxied = $.fn.attr,\n svgns = 'http://www.w3.org/2000/svg';\n /**\n * @typedef {PlainObject} module:jQueryAttr.Attributes\n */\n /**\n * @function external:jQuery.fn.attr\n * @param {string|string[]|PlainObject} key\n * @param {string} value\n * @returns {external:jQuery|module:jQueryAttr.Attributes}\n */\n $.fn.attr = function (key, value) {\n const len = this.length;\n if (!len) { return proxied.call(this, key, value); }\n for (let i = 0; i < len; ++i) {\n const elem = this[i];\n // set/get SVG attribute\n if (elem.namespaceURI === svgns) {\n // Setting attribute\n if (value !== undefined) {\n elem.setAttribute(key, value);\n } else if (Array.isArray(key)) {\n // Getting attributes from array\n const obj = {};\n let j = key.length;\n\n while (j--) {\n const aname = key[j];\n let attr = elem.getAttribute(aname);\n // This returns a number when appropriate\n if (attr || attr === '0') {\n attr = isNaN(attr) ? attr : (attr - 0);\n }\n obj[aname] = attr;\n }\n return obj;\n }\n if (typeof key === 'object') {\n // Setting attributes from object\n for (const [name, val] of Object.entries(key)) {\n elem.setAttribute(name, val);\n }\n // Getting attribute\n } else {\n let attr = elem.getAttribute(key);\n if (attr || attr === '0') {\n attr = isNaN(attr) ? attr : (attr - 0);\n }\n return attr;\n }\n } else {\n return proxied.call(this, key, value);\n }\n }\n return this;\n };\n return $;\n}\n","/**\n * Partial polyfill of `SVGTransformList`\n * @module SVGTransformList\n *\n * @license MIT\n *\n * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller\n */\n\nimport {NS} from './namespaces.js';\nimport {supportsNativeTransformLists} from './browser.js';\n\nconst svgroot = document.createElementNS(NS.SVG, 'svg');\n\n/**\n * Helper function to convert `SVGTransform` to a string.\n * @param {SVGTransform} xform\n * @returns {string}\n */\nfunction transformToString (xform) {\n const m = xform.matrix;\n let text = '';\n switch (xform.type) {\n case 1: // MATRIX\n text = 'matrix(' + [m.a, m.b, m.c, m.d, m.e, m.f].join(',') + ')';\n break;\n case 2: // TRANSLATE\n text = 'translate(' + m.e + ',' + m.f + ')';\n break;\n case 3: // SCALE\n if (m.a === m.d) {\n text = 'scale(' + m.a + ')';\n } else {\n text = 'scale(' + m.a + ',' + m.d + ')';\n }\n break;\n case 4: { // ROTATE\n let cx = 0;\n let cy = 0;\n // this prevents divide by zero\n if (xform.angle !== 0) {\n const K = 1 - m.a;\n cy = (K * m.f + m.b * m.e) / (K * K + m.b * m.b);\n cx = (m.e - m.b * cy) / K;\n }\n text = 'rotate(' + xform.angle + ' ' + cx + ',' + cy + ')';\n break;\n }\n }\n return text;\n}\n\n/**\n * Map of SVGTransformList objects.\n */\nlet listMap_ = {};\n\n/**\n* @interface module:SVGTransformList.SVGEditTransformList\n* @property {Integer} numberOfItems unsigned long\n*/\n/**\n* @function module:SVGTransformList.SVGEditTransformList#clear\n* @returns {void}\n*/\n/**\n* @function module:SVGTransformList.SVGEditTransformList#initialize\n* @param {SVGTransform} newItem\n* @returns {SVGTransform}\n*/\n/**\n* (DOES NOT THROW DOMException, INDEX_SIZE_ERR)\n* @function module:SVGTransformList.SVGEditTransformList#getItem\n* @param {Integer} index unsigned long\n* @returns {SVGTransform}\n*/\n/**\n* (DOES NOT THROW DOMException, INDEX_SIZE_ERR)\n* @function module:SVGTransformList.SVGEditTransformList#insertItemBefore\n* @param {SVGTransform} newItem\n* @param {Integer} index unsigned long\n* @returns {SVGTransform}\n*/\n/**\n* (DOES NOT THROW DOMException, INDEX_SIZE_ERR)\n* @function module:SVGTransformList.SVGEditTransformList#replaceItem\n* @param {SVGTransform} newItem\n* @param {Integer} index unsigned long\n* @returns {SVGTransform}\n*/\n/**\n* (DOES NOT THROW DOMException, INDEX_SIZE_ERR)\n* @function module:SVGTransformList.SVGEditTransformList#removeItem\n* @param {Integer} index unsigned long\n* @returns {SVGTransform}\n*/\n/**\n* @function module:SVGTransformList.SVGEditTransformList#appendItem\n* @param {SVGTransform} newItem\n* @returns {SVGTransform}\n*/\n/**\n* NOT IMPLEMENTED\n* @ignore\n* @function module:SVGTransformList.SVGEditTransformList#createSVGTransformFromMatrix\n* @param {SVGMatrix} matrix\n* @returns {SVGTransform}\n*/\n/**\n* NOT IMPLEMENTED\n* @ignore\n* @function module:SVGTransformList.SVGEditTransformList#consolidate\n* @returns {SVGTransform}\n*/\n\n/**\n* SVGTransformList implementation for Webkit.\n* These methods do not currently raise any exceptions.\n* These methods also do not check that transforms are being inserted. This is basically\n* implementing as much of SVGTransformList that we need to get the job done.\n* @implements {module:SVGTransformList.SVGEditTransformList}\n*/\nexport class SVGTransformList { // eslint-disable-line no-shadow\n /**\n * @param {Element} elem\n * @returns {SVGTransformList}\n */\n constructor (elem) {\n this._elem = elem || null;\n this._xforms = [];\n // TODO: how do we capture the undo-ability in the changed transform list?\n this._update = function () {\n let tstr = '';\n // /* const concatMatrix = */ svgroot.createSVGMatrix();\n for (let i = 0; i < this.numberOfItems; ++i) {\n const xform = this._list.getItem(i);\n tstr += transformToString(xform) + ' ';\n }\n this._elem.setAttribute('transform', tstr);\n };\n this._list = this;\n this._init = function () {\n // Transform attribute parser\n let str = this._elem.getAttribute('transform');\n if (!str) { return; }\n\n // TODO: Add skew support in future\n const re = /\\s*(?