svgedit/dist/editor/system/extensions/ext-server_moinsave/ext-server_moinsave.js

20 lines
154 KiB
JavaScript
Raw Normal View History

2020-09-10 06:24:38 +00:00
System.register([],(function(t,e){"use strict";return{execute:function(){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,n){return t(n={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&&n.path)}},n.exports),n.exports}var check=function(t){return t&&t.Math==Math&&t},i=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof n&&n)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},s=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,u={f:l&&!o.call({1:2},1)?function propertyIsEnumerable(t){var e=l(this,t);return!!e&&e.enumerable}:o},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},h={}.toString,classofRaw=function(t){return h.call(t).slice(8,-1)},p="".split,d=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?p.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 d(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!isObject(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!isObject(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!isObject(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")},v={}.hasOwnProperty,has=function(t,e){return v.call(t,e)},g=i.document,b=isObject(g)&&isObject(g.createElement),documentCreateElement=function(t){return b?g.createElement(t):{}},_=!s&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),w=Object.getOwnPropertyDescriptor,P={f:s?w:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),_)try{return w(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!u.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},k=Object.defineProperty,C={f:s?k:function defineProperty(t,e,n){if(anObject(t),e=toPrimitive(e,!0),anObject(n),_)try{return k(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},E=s?function(t,e,n){return C.f(t,e,createPropertyDescriptor(1,n))}:function(t,e,n){return t[e]=n,t},setGlobal=function(t,e){try{E(i,t,e)}catch(n){i[t]=e}return e},S="__core-js_shared__",A=i[S]||setGlobal(S,{}),T=Function.toString;"function"!=typeof A.inspectSource&&(A.inspectSource=function(t){return T.call(t)});var O,R,M,B=A.inspectSource,V=i.WeakMap,I="function"==typeof V&&/native code/.test(B(V)),L=createCommonjsModule((function(t){(t.exports=function(t,e){return A[t]||(A[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),j=0,N=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++j+N).toString(36)},D=L("keys"),sharedKey=function(t){return D[t]||(D[t]=uid(t))},G={},U=i.WeakMap;if(I){var z=new U,W=z.get,q=z.has,X=z.set;O=function(t,e){return X.call(z,t,e),e},R=function(t){return W.call(z,t)||{}},M=function(t){return q.call(z,t)}}else{var $=sharedKey("state");G[$]=!0,O=function(t,e){return E(t,$,e),e},R=function(t){return has(t,$)?t[$]:{}},M=function(t){return has(t,$)}}var H,Y,Q={set:O,get:R,has:M,enforce:function(t){return M(t)?R(t):O(t,{})},getterFor:function(t){return function(e){var n;if(!isObject(e)||(n=R(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},
/**
* For parsing color values.
* @module RGBColor
* @author Stoyan Stefanov <sstoo@gmail.com>
* @see https://www.phpied.com/rgb-color-parser-in-javascript/
* @license MIT
*/
var wo={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},Po=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t)}))}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t,16)}))}},{re:/^(\w)(\w)(\w)$/,example:["#fb0","f0f"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t+t,16)}))}}],ko=function(){function RGBColor(t){var e=this;_classCallCheck(this,RGBColor),this.ok=!1,"#"===t.charAt(0)&&(t=t.substr(1,6)),(t=(t=t.replace(/ /g,"")).toLowerCase())in wo&&(t=wo[t]),Po.forEach((function(n){var i=n.re,s=n.process,o=i.exec(t);if(o){var l=_slicedToArray(s.apply(void 0,_toConsumableArray(o)),3),u=l[0],h=l[1],p=l[2];Object.assign(e,{r:u,g:h,b:p}),e.ok=!0}})),this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b}return _createClass(RGBColor,[{key:"toRGB",value:function toRGB(){return"rgb("+this.r+", "+this.g+", "+this.b+")"}},{key:"toH
/**
* Localizing script for SVG-edit UI.
* @module locale
* @license MIT
*
* @copyright 2010 Narendra Sisodya
* @copyright 2010 Alexis Deveria
*
*/
jQuery;var No=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee2(t,n){var i;return regeneratorRuntime.wrap((function _callee2$(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,e.import("./extensions/ext-".concat(t,"/locale/").concat(n,".js"));case 3:i=s.sent,s.next=12;break;case 6:return s.prev=6,s.t0=s.catch(0),console.error("Missing translation (".concat(n,") for extension ").concat(t," - using 'en'")),s.next=11,e.import("./extensions/ext-".concat(t,"/locale/en.js"));case 11:i=s.sent;case 12:return s.abrupt("return",i.default);case 13:case"end":return s.stop()}}),_callee2,null,[[0,6]])})));return function loadExtensionTranslation(e,n){return t.apply(this,arguments)}}();t("default",{name:"server_moinsave",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var n,i,s,o,l;return regeneratorRuntime.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return n=t.$,i=t.encode64,t.importLocale,s=e,u.next=4,No("server_moinsave",s.curPrefs.lang);case 4:o=u.sent,l=s.canvas,"/+modify",n('<iframe name="output_frame" title="'.concat(o.hiddenframe,'"\n style="width: 0; height: 0;" src="data:text/html;base64,PGh0bWw+PC9odG1sPg=="/>')).appendTo("body"),s.setCustomHandlers({save:function save(t,e){return _asyncToGenerator(regeneratorRuntime.mark((function _callee(){var t,s,u,h,p,d,v,g;return regeneratorRuntime.wrap((function _callee$(b){for(;;)switch(b.prev=b.next){case 0:return t='<?xml version="1.0"?>\n'+e,s=new URL(location),u=s.pathname,h=u.replace(/\/+get\//,""),p=i(t),n("#export_canvas").length||n("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(d=n("#export_canvas")[0]).width=l.contentW,d.height=l.contentH,b.next=10,To(d,t);case 10:v=d.toDataURL("image/png"),g=i(v),n("<form>").attr({method:"post",action:"/+modify/"+h,target:"output_frame"}).append('\n <input type="hidden" name="png_data" value="'.concat(g,'">\n <input type="hidden" name="filepath" value="').concat(p,'">\n <input type="hidden" name="filename" value="drawing.svg">\n <input type="hidden" name="contenttype" value="application/x-svgdraw">\n ')).appendTo("body").submit().remove(),n.alert(o.saved),top.window.location="/"+h;case 15:case"end":return b.stop()}}),_callee)})))()}});case 9:case"end":return u.stop()}}),_callee2)})))()}})}}}));