2020-09-09 10:14:00 +00:00
|
|
|
|
System.register([],(function(t){"use strict";return{execute:function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},r=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof e&&e)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},n=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,c={f:i&&!o.call({1:2},1)?function propertyIsEnumerable(t){var e=i(this,t);return!!e&&e.enumerable}:o},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},u="".split,f=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?u.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return f(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},s={}.hasOwnProperty,has=function(t,e){return s.call(t,e)},l=r.document,p=isObject(l)&&isObject(l.createElement),documentCreateElement=function(t){return p?l.createElement(t):{}},h=!n&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),y=Object.getOwnPropertyDescriptor,v={f:n?y:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),h)try{return y(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!c.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},d=Object.defineProperty,g={f:n?d:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),h)try{return d(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},m=n?function(t,e,r){return g.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,e){try{m(r,t,e)}catch(n){r[t]=e}return e},b="__core-js_shared__",w=r[b]||setGlobal(b,{}),S=Function.toString;"function"!=typeof w.inspectSource&&(w.inspectSource=function(t){return S.call(t)});var _,O,j,x=w.inspectSource,E=r.WeakMap,P="function"==typeof E&&/native code/.test(x(E)),T=createCommonjsModule((function(t){(t.exports=function(t,e){return w[t]||(w[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),A=0,k=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++A+k).toString(36)},L=T("keys"),sharedKey=function(t){return L[t]||(L[t]=uid(t))},I={},C=r.WeakMap;if(P){var M=new C,G=M.get,N=M.has,R=M.set;_=function(t,e){return R.call(M,t,e),e},O=function(t){return G.call(M,t)||{}},j=function(t){return N.call(M,t)}}else{var D=sharedKey("state");I[D]=!0,_=function(t,e){return m(t,D,e),e},O=function(t){return has(t,D)?t[D]:{}},j=function(t){return has(t,D)}}var z,W,H={set:_,get:O,has:j,enforce:function(t){return j(t)?O(t):_(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=O(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},V=
|
2020-09-06 06:32:10 +00:00
|
|
|
|
/**
|
2020-09-08 23:35:47 +00:00
|
|
|
|
* @file ext-foreignobject.js
|
|
|
|
|
*
|
|
|
|
|
* @license Apache-2.0
|
|
|
|
|
*
|
|
|
|
|
* @copyright 2010 Jacques Distler, 2010 Alexis Deveria
|
|
|
|
|
*
|
2020-09-09 10:14:00 +00:00
|
|
|
|
*/t("default",{name:"foreignobject",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var r,n,o,i,c,a,u,f,s,l,p,h,y,v,d,g,m,b,w,S;return regeneratorRuntime.wrap((function _callee2$(_){for(;;)switch(_.prev=_.next){case 0:return b=function _setAttr(t,e){c.changeSelectedAttribute(t,e),c.call("changed",h)},m=function _showForeignEditor(){var t=h[0];if(t&&!d){d=!0,p(!0),t.removeAttribute("fill");var e=c.svgToString(t,0);n("#svg_source_textarea").val(e),n("#svg_source_editor").fadeIn(),s(),n("#svg_source_textarea").focus()}},g=function _setForeignString(t){var e=h[0];try{var r=o('<svg xmlns="'+i.SVG+'" xmlns:xlink="'+i.XLINK+'">'+t+"</svg>");c.sanitizeSvg(r.documentElement),e.replaceWith(a.importNode(r.documentElement.firstChild,!0)),c.call("changed",[e]),c.clearSelection()}catch(t){return console.log(t),!1}return!0},p=function _toggleSourceButtons(t){n("#tool_source_save, #tool_source_cancel").toggle(!t),n("#foreign_save, #foreign_cancel").toggle(t)},l=function _showPanel(t){var e=n("#fc_rules");e.length||(e=n('<style id="fc_rules"></style>').appendTo("head")),e.text(t?" #tool_topath { display: none !important; }":""),n("#foreignObject_panel").toggle(t)},r=e,n=t.$,o=t.text2xml,i=t.NS,c=r.canvas,a=t.svgroot.parentNode.ownerDocument,_.next=11,__variableDynamicImportRuntime0__("./locale/".concat(r.curPrefs.lang,".js"));case 11:return u=_.sent,f=u.default,s=function properlySourceSizeTextArea(){var t=n("#svg_source_container").height()-80;n("#svg_source_textarea").css("height",t)},d=!1,w=[{id:"tool_foreign",icon:"foreignobject-tool.png",type:"mode",events:{click:function click(){c.setMode("foreign")}}},{id:"edit_foreign",icon:"foreignobject-edit.png",type:"context",panel:"foreignObject_panel",events:{click:function click(){m()}}}],S=[{type:"input",panel:"foreignObject_panel",id:"foreign_width",size:3,events:{change:function change(){b("width",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_height",events:{change:function change(){b("height",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_font_size",size:2,defval:16,events:{change:function change(){b("font-size",this.value)}}}],_.abrupt("return",{name:f.name,svgicons:"foreignobject-icons.xml",buttons:f.buttons.map((function(t,e){return Object.assign(w[e],t)})),context_tools:f.contextTools.map((function(t,e){return Object.assign(S[e],t)})),callback:function callback(){n("#foreignObject_panel").hide();var t=function endChanges(){n("#svg_source_editor").hide(),d=!1,n("#svg_source_textarea").blur(),p(!1)};setTimeout((function(){n("#tool_source_save").clone().hide().attr("id","foreign_save").unbind().appendTo("#tool_source_back").click(_asyncToGenerator(regeneratorRuntime.mark((function _callee(){return regeneratorRuntime.wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(d){e.next=2;break}return e.abrupt("return");case 2:if(g(n("#svg_source_textarea").val())){e.next=11;break}return e.next=5,n.confirm("Errors found. Revert to original?");case 5:if(e.sent){e.next=8;break}return e.abrupt("return");case 8:t(),e.next=12;break;case 11:t();case 12:case"end":return e.stop()}}),_callee)})))),n("#tool_source_cancel").clone().hide().attr("id","foreign_cancel").unbind().appendTo("#tool_source_back").click((function(){t()}))}),3e3)},mouseDown:function mouseDown(t){if("foreign"===c.getMode()){y=!0,v=c.addSVGElementFromJson({element:"foreignObject",attr:{x:t.start_x,y:t.start_y,id:c.getNextId(),"font-size":16,width:"48",height:"20",style:"pointer-events:inherit"}});var e=a.createElementNS(i.MATH,"math");e.setAttributeNS(i.XMLNS,"xmlns",i.MATH),e.setAttribute("display","inline");var r=a.createElementNS(i.MATH,"mi");r.setAttribute("mathvariant","normal"),r.textContent="Φ";var n=a.createElementNS(i.MATH,"mo");n.textContent="∪";var o=a.createElementNS(i.MATH,"mi");return o.textContent="ℳ",e.append(r,n,o),v.append(e),{started:!0}}},mouseUp:function mouseUp(t){if("foreign"===c.getMode()&&y){var e=n(v).attr(["width","height"]),r="0"!==e.width||"0"!==e.height;return c.addToSelection([v],!0
|