mirror of
https://github.com/tbluemel/rtf.js.git
synced 2026-12-01 16:56:07 +01:00
2 lines
60 KiB
JavaScript
Generated
2 lines
60 KiB
JavaScript
Generated
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.EMFJS=e():t.EMFJS=e()}(this,(function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e);var i=r(1);r.d(e,"Renderer",(function(){return i.Renderer}));var n=r(5);r.d(e,"Error",(function(){return n.EMFJSError})),r.d(e,"loggingEnabled",(function(){return n.loggingEnabled}))},function(t,e,r){"use strict";r.r(e),r.d(e,"Renderer",(function(){return a})),r.d(e,"EMF",(function(){return p}));var i=r(2),n=r(4),o=r(6),s=r(11),l=r(5),a=function(){function t(t){this.parse(t),l.Helper.log("EMFJS.Renderer instantiated")}return t.prototype.render=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");return this._render(new i.SVG(e),t.mapMode,t.wExt,t.hExt,t.xExt,t.yExt),e.setAttribute("viewBox",[0,0,t.xExt,t.yExt].join(" ")),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("width",t.width),e.setAttribute("height",t.height),e},t.prototype.parse=function(t){this._img=null;var e=new n.Blob(t);if(1!==e.readUint32())throw new l.EMFJSError("Not an EMF file");var r=e.readUint32();if(r%4!=0)throw new l.EMFJSError("Not an EMF file");if(this._img=new p(e,r),null==this._img)throw new l.EMFJSError("Format not recognized")},t.prototype._render=function(t,e,r,i,n,o){var a=new s.GDIContext(t);a.setWindowExtEx(r,i),a.setViewportExtEx(n,o),a.setMapMode(e),l.Helper.log("[EMF] BEGIN RENDERING ---\x3e"),this._img.render(a),l.Helper.log("[EMF] <--- DONE RENDERING")},t}(),p=function(){function t(t,e){this._hdrsize=e,this._records=new o.EMFRecords(t,this._hdrsize)}return t.prototype.render=function(t){this._records.play(t)},t}()},function(t,e,r){"use strict";r.r(e);var i=r(3);r.d(e,"SVG",(function(){return i.SVG}))},function(t,e,r){"use strict";r.r(e),r.d(e,"SVGFilters",(function(){return i})),r.d(e,"SVGPathBuilder",(function(){return n})),r.d(e,"SVG",(function(){return o}));var i=function(){function t(){}return t.prototype.flood=function(t,e,r,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","feFlood");e&&o.setAttribute("id",e),o.setAttribute("flood-color",r),o.setAttribute("flood-opacity",i.toString()),t.appendChild(o)},t.prototype.composite=function(t,e,r,i,n,o,s,l,a){var p=document.createElementNS("http://www.w3.org/2000/svg","feComposite");e&&p.setAttribute("id",e),p.setAttribute("in",r),p.setAttribute("in2",i),t.appendChild(p)},t}(),n=function(){function t(){this._path=""}return t.prototype.move=function(t,e){this._path+=" M "+t+" "+e},t.prototype.path=function(){return this._path.substr(1)},t.prototype.line=function(t){var e=this;t.forEach((function(t){e._path+=" L "+t[0]+" "+t[1]}))},t.prototype.curveC=function(t,e,r,i,n,o){this._path+=" C "+t+" "+e+", "+r+" "+i+", "+n+" "+o},t.prototype.close=function(){this._path+=" Z"},t}(),o=function(){function t(t){this.filters=new i,this._defs=void 0,this._svg=t}return t.prototype.svg=function(t,e,r,i,n,o){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");return s.setAttribute("x",e.toString()),s.setAttribute("y",r.toString()),s.setAttribute("width",i.toString()),s.setAttribute("height",n.toString()),this._appendSettings(o,s),null!=t?t.appendChild(s):this._svg.appendChild(s),s},t.prototype.image=function(t,e,r,i,n,o,s){var l=document.createElementNS("http://www.w3.org/2000/svg","image");return l.setAttribute("x",e.toString()),l.setAttribute("y",r.toString()),l.setAttribute("width",i.toString()),l.setAttribute("height",n.toString()),l.setAttributeNS("http://www.w3.org/1999/xlink","href",o),this._appendSettings(s,l),t.appendChild(l),l},t.prototype.rect=function(t,e,r,i,n,o,s,l){var a=document.createElementNS("http://www.w3.org/2000/svg","rect");return a.setAttribute("x",e.toString()),a.setAttribute("y",r.toString()),a.setAttribute("width",i.toString()),a.setAttribute("height",n.toString()),void 0!==o&&(o instanceof Number?a.setAttribute("rx",o.toString()):o instanceof Object&&this._appendSettings(o,a)),void 0!==s&&a.setAttribute("ry",s.toString()),this._appendSettings(l,a),t.appendChild(a),a},t.prototype.line=function(t,e,r,i,n,o){var s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1",e.toString()),s.setAttribute("y1",r.toString()),s.setAttribute("x2",i.toString()),s.setAttribute("y2",n.toString()),this._appendSettings(o,s),t.appendChild(s),s},t.prototype.polygon=function(t,e,r){var i=document.createElementNS("http://www.w3.org/2000/svg","polygon");return i.setAttribute("points",e.map((function(t){return t.join(",")})).join(" ")),this._appendSettings(r,i),t.appendChild(i),i},t.prototype.polyline=function(t,e,r){var i=document.createElementNS("http://www.w3.org/2000/svg","polyline");return i.setAttribute("points",e.map((function(t){return t.join(",")})).join(" ")),this._appendSettings(r,i),t.appendChild(i),i},t.prototype.ellipse=function(t,e,r,i,n,o){var s=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return s.setAttribute("cx",e.toString()),s.setAttribute("cy",r.toString()),s.setAttribute("rx",i.toString()),s.setAttribute("ry",n.toString()),this._appendSettings(o,s),t.appendChild(s),s},t.prototype.path=function(t,e,r){var i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e.path()),this._appendSettings(r,i),t.appendChild(i),i},t.prototype.text=function(t,e,r,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","text");o.setAttribute("x",e.toString()),o.setAttribute("y",r.toString()),this._appendSettings(n,o);var s=document.createTextNode(i);return o.appendChild(s),t.appendChild(o),o},t.prototype.filter=function(t,e,r,i,n,o,s){var l=document.createElementNS("http://www.w3.org/2000/svg","filter");return l.setAttribute("x",r.toString()),l.setAttribute("y",i.toString()),l.setAttribute("width",n.toString()),l.setAttribute("height",o.toString()),this._appendSettings(s,l),t.appendChild(l),l},t.prototype.pattern=function(t,e,r,i,n,o,s){var l=document.createElementNS("http://www.w3.org/2000/svg","pattern");return e&&l.setAttribute("id",e),l.setAttribute("x",r.toString()),l.setAttribute("y",i.toString()),l.setAttribute("width",n.toString()),l.setAttribute("height",o.toString()),this._appendSettings(s,l),t.appendChild(l),l},t.prototype.defs=function(){if(void 0===this._defs){var t=document.createElementNS("http://www.w3.org/2000/svg","defs");this._svg.appendChild(t),this._defs=t}return this._defs},t.prototype.clipPath=function(t,e,r,i){var n=document.createElementNS("http://www.w3.org/2000/svg","clipPath");return e&&n.setAttribute("id",e),void 0===r&&(r="userSpaceOnUse"),n.setAttribute("clipPathUnits",r),this._appendSettings(i,n),t.appendChild(n),n},t.prototype.createPath=function(){return new n},t.prototype._appendSettings=function(t,e){void 0!==t&&Object.keys(t).forEach((function(r){e.setAttribute(r,t[r])}))},t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"Blob",(function(){return n}));var i=r(5),n=function(){function t(e,r){e instanceof t?(this.blob=e.blob,this.data=e.data,this.pos=r||e.pos):(this.blob=e,this.data=new Uint8Array(e),this.pos=r||0)}return t.prototype.eof=function(){return this.pos>=this.data.length},t.prototype.seek=function(t){if(t<0||t>this.data.length)throw new i.EMFJSError("Invalid seek position");this.pos=t},t.prototype.skip=function(t){var e=this.pos+t;if(e>this.data.length)throw new i.EMFJSError("Unexpected end of file");this.pos=e},t.prototype.readBinary=function(t){if(this.pos+t>this.data.length)throw new i.EMFJSError("Unexpected end of file");for(var e="";t-- >0;)e+=String.fromCharCode(this.data[this.pos++]);return e},t.prototype.readInt8=function(){if(this.pos+1>this.data.length)throw new i.EMFJSError("Unexpected end of file");return this.data[this.pos++]},t.prototype.readUint8=function(){return this.readInt8()>>>0},t.prototype.readInt32=function(){if(this.pos+4>this.data.length)throw new i.EMFJSError("Unexpected end of file");var t=this.data[this.pos++];return t|=this.data[this.pos++]<<8,t|=this.data[this.pos++]<<16,t|=this.data[this.pos++]<<24},t.prototype.readUint32=function(){return this.readInt32()>>>0},t.prototype.readUint16=function(){if(this.pos+2>this.data.length)throw new i.EMFJSError("Unexpected end of file");var t=this.data[this.pos++];return t|=this.data[this.pos++]<<8},t.prototype.readInt16=function(){var t=this.readUint16();return t>32767&&(t-=65536),t},t.prototype.readString=function(t){if(this.pos+t>this.data.length)throw new i.EMFJSError("Unexpected end of file");for(var e="",r=0;r<t;r++)e+=String.fromCharCode(this.data[this.pos++]>>>0);return e},t.prototype.readNullTermString=function(t){var e="";if(t>0){t--;for(var r=0;r<t;r++){if(this.pos+r+1>this.data.length)throw new i.EMFJSError("Unexpected end of file");var n=this.data[this.pos+r]>>>0;if(0===n)break;e+=String.fromCharCode(n)}}return e},t.prototype.readFixedSizeUnicodeString=function(t){for(var e="",r=0;r<t;r++){var i=this.readUint16();if(0===i){++r<t&&this.skip(2*(t-r));break}e+=String.fromCharCode(i)}return e},t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"EMFJSError",(function(){return o})),r.d(e,"loggingEnabled",(function(){return l})),r.d(e,"Helper",(function(){return a}));var i,n=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=function(t){function e(e){var r=this.constructor,i=t.call(this,e)||this;return Object.setPrototypeOf(i,r.prototype),i}return n(e,t),e}(Error),s=!0;function l(t){s=t}var a=function(){function t(){}return t.log=function(t){s&&console.log(t)},t._makeUniqueId=function(t){return"EMFJS_"+t+this._uniqueId++},t._writeUint32Val=function(t,e,r){t[e++]=255&r,t[e++]=r>>>8&255,t[e++]=r>>>16&255,t[e++]=r>>>24&255},t._blobToBinary=function(t){for(var e="",r=t.length,i=0;i<r;i++)e+=String.fromCharCode(t[i]);return e},t.GDI={FormatSignature:{ENHMETA_SIGNATURE:1179469088,EPS_SIGNATURE:1179865157},BITMAPINFOHEADER_SIZE:40,BITMAPCOREHEADER_SIZE:12,RecordType:{EMR_POLYBEZIER:2,EMR_POLYGON:3,EMR_POLYLINE:4,EMR_POLYBEZIERTO:5,EMR_POLYLINETO:6,EMR_POLYPOLYLINE:7,EMR_POLYPOLYGON:8,EMR_SETWINDOWEXTEX:9,EMR_SETWINDOWORGEX:10,EMR_SETVIEWPORTEXTEX:11,EMR_SETVIEWPORTORGEX:12,EMR_SETBRUSHORGEX:13,EMR_EOF:14,EMR_SETPIXELV:15,EMR_SETMAPPERFLAGS:16,EMR_SETMAPMODE:17,EMR_SETBKMODE:18,EMR_SETPOLYFILLMODE:19,EMR_SETROP2:20,EMR_SETSTRETCHBLTMODE:21,EMR_SETTEXTALIGN:22,EMR_SETCOLORADJUSTMENT:23,EMR_SETTEXTCOLOR:24,EMR_SETBKCOLOR:25,EMR_OFFSETCLIPRGN:26,EMR_MOVETOEX:27,EMR_SETMETARGN:28,EMR_EXCLUDECLIPRECT:29,EMR_INTERSECTCLIPRECT:30,EMR_SCALEVIEWPORTEXTEX:31,EMR_SCALEWINDOWEXTEX:32,EMR_SAVEDC:33,EMR_RESTOREDC:34,EMR_SETWORLDTRANSFORM:35,EMR_MODIFYWORLDTRANSFORM:36,EMR_SELECTOBJECT:37,EMR_CREATEPEN:38,EMR_CREATEBRUSHINDIRECT:39,EMR_DELETEOBJECT:40,EMR_ANGLEARC:41,EMR_ELLIPSE:42,EMR_RECTANGLE:43,EMR_ROUNDRECT:44,EMR_ARC:45,EMR_CHORD:46,EMR_PIE:47,EMR_SELECTPALETTE:48,EMR_CREATEPALETTE:49,EMR_SETPALETTEENTRIES:50,EMR_RESIZEPALETTE:51,EMR_REALIZEPALETTE:52,EMR_EXTFLOODFILL:53,EMR_LINETO:54,EMR_ARCTO:55,EMR_POLYDRAW:56,EMR_SETARCDIRECTION:57,EMR_SETMITERLIMIT:58,EMR_BEGINPATH:59,EMR_ENDPATH:60,EMR_CLOSEFIGURE:61,EMR_FILLPATH:62,EMR_STROKEANDFILLPATH:63,EMR_STROKEPATH:64,EMR_FLATTENPATH:65,EMR_WIDENPATH:66,EMR_SELECTCLIPPATH:67,EMR_ABORTPATH:68,EMR_COMMENT:70,EMR_FILLRGN:71,EMR_FRAMERGN:72,EMR_INVERTRGN:73,EMR_PAINTRGN:74,EMR_EXTSELECTCLIPRGN:75,EMR_BITBLT:76,EMR_STRETCHBLT:77,EMR_MASKBLT:78,EMR_PLGBLT:79,EMR_SETDIBITSTODEVICE:80,EMR_STRETCHDIBITS:81,EMR_EXTCREATEFONTINDIRECTW:82,EMR_EXTTEXTOUTA:83,EMR_EXTTEXTOUTW:84,EMR_POLYBEZIER16:85,EMR_POLYGON16:86,EMR_POLYLINE16:87,EMR_POLYBEZIERTO16:88,EMR_POLYLINETO16:89,EMR_POLYPOLYLINE16:90,EMR_POLYPOLYGON16:91,EMR_POLYDRAW16:92,EMR_CREATEMONOBRUSH:93,EMR_CREATEDIBPATTERNBRUSHPT:94,EMR_EXTCREATEPEN:95,EMR_POLYTEXTOUTA:96,EMR_POLYTEXTOUTW:97,EMR_SETICMMODE:98,EMR_CREATECOLORSPACE:99,EMR_SETCOLORSPACE:100,EMR_DELETECOLORSPACE:101,EMR_GLSRECORD:102,EMR_GLSBOUNDEDRECORD:103,EMR_PIXELFORMAT:104,EMR_DRAWESCAPE:105,EMR_EXTESCAPE:106,EMR_SMALLTEXTOUT:108,EMR_FORCEUFIMAPPING:109,EMR_NAMEDESCAPE:110,EMR_COLORCORRECTPALETTE:111,EMR_SETICMPROFILEA:112,EMR_SETICMPROFILEW:113,EMR_ALPHABLEND:114,EMR_SETLAYOUT:115,EMR_TRANSPARENTBLT:116,EMR_GRADIENTFILL:118,EMR_SETLINKEDUFIS:119,EMR_SETTEXTJUSTIFICATION:120,EMR_COLORMATCHTOTARGETW:121,EMR_CREATECOLORSPACEW:122},MetafileEscapes:{NEWFRAME:1,ABORTDOC:2,NEXTBAND:3,SETCOLORTABLE:4,GETCOLORTABLE:5,FLUSHOUT:6,DRAFTMODE:7,QUERYESCSUPPORT:8,SETABORTPROC:9,STARTDOC:10,ENDDOC:11,GETPHYSPAGESIZE:12,GETPRINTINGOFFSET:13,GETSCALINGFACTOR:14,META_ESCAPE_ENHANCED_METAFILE:15,SETPENWIDTH:16,SETCOPYCOUNT:17,SETPAPERSOURCE:18,PASSTHROUGH:19,GETTECHNOLOGY:20,SETLINECAP:21,SETLINEJOIN:22,SETMITERLIMIT:23,BANDINFO:24,DRAWPATTERNRECT:25,GETVECTORPENSIZE:26,GETVECTORBRUSHSIZE:27,ENABLEDUPLEX:28,GETSETPAPERBINS:29,GETSETPRINTORIENT:30,ENUMPAPERBINS:31,SETDIBSCALING:32,EPSPRINTING:33,ENUMPAPERMETRICS:34,GETSETPAPERMETRICS:35,POSTSCRIPT_DATA:37,POSTSCRIPT_IGNORE:38,GETDEVICEUNITS:42,GETEXTENDEDTEXTMETRICS:256,GETPAIRKERNTABLE:258,EXTTEXTOUT:512,GETFACENAME:513,DOWNLOADFACE:514,METAFILE_DRIVER:2049,QUERYDIBSUPPORT:3073,BEGIN_PATH:4096,CLIP_TO_PATH:4097,END_PATH:4098,OPEN_CHANNEL:4110,DOWNLOADHEADER:4111,CLOSE_CHANNEL:4112,POSTSCRIPT_PASSTHROUGH:4115,ENCAPSULATED_POSTSCRIPT:4116,POSTSCRIPT_IDENTIFY:4117,POSTSCRIPT_INJECTION:4118,CHECKJPEGFORMAT:4119,CHECKPNGFORMAT:4120,GET_PS_FEATURESETTING:4121,MXDC_ESCAPE:4122,SPCLPASSTHROUGH2:4568},MapMode:{MM_TEXT:1,MM_LOMETRIC:2,MM_HIMETRIC:3,MM_LOENGLISH:4,MM_HIENGLISH:5,MM_TWIPS:6,MM_ISOTROPIC:7,MM_ANISOTROPIC:8},StretchMode:{BLACKONWHITE:1,WHITEONBLACK:2,COLORONCOLOR:3,HALFTONE:4},MixMode:{TRANSPARENT:1,OPAQUE:2},BrushStyle:{BS_SOLID:0,BS_NULL:1,BS_HATCHED:2,BS_PATTERN:3,BS_INDEXED:4,BS_DIBPATTERN:5,BS_DIBPATTERNPT:6,BS_PATTERN8X8:7,BS_DIBPATTERN8X8:8,BS_MONOPATTERN:9},PenStyle:{PS_COSMETIC:0,PS_ENDCAP_ROUND:0,PS_JOIN_ROUND:0,PS_SOLID:0,PS_DASH:1,PS_DOT:2,PS_DASHDOT:3,PS_DASHDOTDOT:4,PS_NULL:5,PS_INSIDEFRAME:6,PS_USERSTYLE:7,PS_ALTERNATE:8,PS_ENDCAP_SQUARE:256,PS_ENDCAP_FLAT:512,PS_JOIN_BEVEL:4096,PS_JOIN_MITER:8192,PS_GEOMETRIC:65536},PolygonFillMode:{ALTERNATE:1,WINDING:2},BitmapCompression:{BI_RGB:0,BI_RLE8:1,BI_RLE4:2,BI_BITFIELDS:3,BI_JPEG:4,BI_PNG:5},RegionMode:{RGN_AND:1,RGN_OR:2,RGN_XOR:3,RGN_DIFF:4,RGN_COPY:5},StockObject:{WHITE_BRUSH:2147483648,LTGRAY_BRUSH:2147483649,GRAY_BRUSH:2147483650,DKGRAY_BRUSH:2147483651,BLACK_BRUSH:2147483652,NULL_BRUSH:2147483653,WHITE_PEN:2147483654,BLACK_PEN:2147483655,NULL_PEN:2147483656,OEM_FIXED_FONT:2147483658,ANSI_FIXED_FONT:2147483659,ANSI_VAR_FONT:2147483660,SYSTEM_FONT:2147483661,DEVICE_DEFAULT_FONT:2147483662,DEFAULT_PALETTE:2147483663,SYSTEM_FIXED_FONT:2147483664,DEFAULT_GUI_FONT:2147483665,DC_BRUSH:2147483666,DC_PEN:2147483667}},t._uniqueId=0,t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"EmfHeader",(function(){return l})),r.d(e,"EMFRecords",(function(){return a}));var i=r(5),n=r(7),o=r(8),s=r(9),l=function(){function t(t,e){var r=t.pos-8;if(this.size=e,this.bounds=new n.RectL(t),this.frame=new n.RectL(t),t.readUint32()!==i.Helper.GDI.FormatSignature.ENHMETA_SIGNATURE)throw new i.EMFJSError("Invalid header signature");t.skip(4),t.skip(4),t.skip(4),t.skip(2),t.skip(2);var o=t.readUint32(),s=t.readUint32();this.nPalEntries=t.readUint32(),this.refDevCx=t.readUint32(),this.refDevCy=t.readUint32(),this.refDevCxMm=t.readUint32(),this.refDevCyMm=t.readUint32();var l=e;if(o>0){if(s<88)throw new i.EMFJSError("Invalid header description offset");if((l=s+2*o)>e)throw new i.EMFJSError("Invalid header description length");var a=t.pos;t.seek(r+s),this.description=t.readFixedSizeUnicodeString(o),t.seek(a)}else this.description="";if(l>=100){var p=t.readUint32(),h=t.readUint32();if(0!==t.readUint32())throw new i.EMFJSError("OpenGL records are not yet supported");if(0!==h){if(h<100||h<l)throw new i.EMFJSError("Invalid pixel format offset");if((l=h+p)>e)throw new i.EMFJSError("Invalid pixel format size")}l>=108&&(this.displayDevCxUm=t.readUint32(),this.displayDevCyUm=t.readUint32())}}return t.prototype.toString=function(){return"{bounds: "+this.bounds.toString()+", frame: "+this.frame.toString()+", description: "+this.description+"}"},t}(),a=function(){function t(t,e){this._records=[],this._header=new l(t,e);var r=!1,a=e,p=function(){t.seek(a);var e=t.readUint32(),l=t.readUint32();if(l<8)throw new i.EMFJSError("Invalid record size");switch(e){case i.Helper.GDI.RecordType.EMR_EOF:return r=!0,"break-main_loop";case i.Helper.GDI.RecordType.EMR_SETMAPMODE:var p=t.readInt32();h._records.push((function(t){t.setMapMode(p)}));break;case i.Helper.GDI.RecordType.EMR_SETWINDOWORGEX:var c=t.readInt32(),u=t.readInt32();h._records.push((function(t){t.setWindowOrgEx(c,u)}));break;case i.Helper.GDI.RecordType.EMR_SETWINDOWEXTEX:var E=t.readUint32(),d=t.readUint32();h._records.push((function(t){t.setWindowExtEx(E,d)}));break;case i.Helper.GDI.RecordType.EMR_SETVIEWPORTORGEX:var R=t.readInt32(),_=t.readInt32();h._records.push((function(t){t.setViewportOrgEx(R,_)}));break;case i.Helper.GDI.RecordType.EMR_SETVIEWPORTEXTEX:var f=t.readUint32(),T=t.readUint32();h._records.push((function(t){t.setViewportExtEx(f,T)}));break;case i.Helper.GDI.RecordType.EMR_SAVEDC:h._records.push((function(t){t.saveDC()}));break;case i.Helper.GDI.RecordType.EMR_RESTOREDC:var g=t.readInt32();h._records.push((function(t){t.restoreDC(g)}));break;case i.Helper.GDI.RecordType.EMR_SETBKMODE:var y=t.readUint32();h._records.push((function(t){t.setBkMode(y)}));break;case i.Helper.GDI.RecordType.EMR_SETBKCOLOR:var S=new s.ColorRef(t);h._records.push((function(t){t.setBkColor(S)}));break;case i.Helper.GDI.RecordType.EMR_CREATEBRUSHINDIRECT:var I=t.readUint32(),M=new s.Brush(t);h._records.push((function(t){t.createBrush(I,M)}));break;case i.Helper.GDI.RecordType.EMR_CREATEPEN:var v=t.readUint32(),O=new s.Pen(t,null);h._records.push((function(t){t.createPen(v,O)}));break;case i.Helper.GDI.RecordType.EMR_EXTCREATEPEN:var b=t.readUint32(),P=t.readUint32(),w=t.readUint32(),D=t.readUint32(),H=t.readUint32(),A=new s.Pen(t,{header:{off:P,size:w},data:{off:D,size:H}});h._records.push((function(t){t.createPen(b,A)}));break;case i.Helper.GDI.RecordType.EMR_SELECTOBJECT:var L=t.readUint32();h._records.push((function(t){t.selectObject(L,null)}));break;case i.Helper.GDI.RecordType.EMR_DELETEOBJECT:var C=t.readUint32();h._records.push((function(t){t.deleteObject(C)}));break;case i.Helper.GDI.RecordType.EMR_RECTANGLE:var N=new n.RectL(t);h._records.push((function(t){t.rectangle(N,0,0)}));break;case i.Helper.GDI.RecordType.EMR_ROUNDRECT:var G=new n.RectL(t),m=new n.SizeL(t);h._records.push((function(t){t.rectangle(G,m.cx,m.cy)}));break;case i.Helper.GDI.RecordType.EMR_LINETO:var x=t.readInt32(),B=t.readInt32();h._records.push((function(t){t.lineTo(x,B)}));break;case i.Helper.GDI.RecordType.EMR_MOVETOEX:var U=t.readInt32(),F=t.readInt32();h._records.push((function(t){t.moveToEx(U,F)}));break;case i.Helper.GDI.RecordType.EMR_POLYGON:case i.Helper.GDI.RecordType.EMR_POLYGON16:for(var k=e===i.Helper.GDI.RecordType.EMR_POLYGON16,X=new n.RectL(t),Y=t.readUint32(),j=[];Y>0;)j.push(k?new n.PointS(t):new n.PointL(t)),Y--;h._records.push((function(t){t.polygon(j,X,!0)}));break;case i.Helper.GDI.RecordType.EMR_POLYPOLYGON:case i.Helper.GDI.RecordType.EMR_POLYPOLYGON16:k=e===i.Helper.GDI.RecordType.EMR_POLYPOLYGON16;var W=new n.RectL(t),J=t.readUint32();t.skip(4);for(var V=[],z=0;z<J;z++)V.push(t.readUint32());var K=[];for(z=0;z<J;z++){for(var Z=V[z],q=[],Q=0;Q<Z;Q++)q.push(k?new n.PointS(t):new n.PointL(t));K.push(q)}h._records.push((function(t){t.polyPolygon(K,W)}));break;case i.Helper.GDI.RecordType.EMR_SETPOLYFILLMODE:var $=t.readUint32();h._records.push((function(t){t.setPolyFillMode($)}));break;case i.Helper.GDI.RecordType.EMR_POLYLINE16:case i.Helper.GDI.RecordType.EMR_POLYLINETO16:for(var tt=e===i.Helper.GDI.RecordType.EMR_POLYLINETO16,et=new n.RectL(t),rt=(Y=t.readUint32(),[]);Y>0;)rt.push(new n.PointS(t)),Y--;h._records.push((function(t){t.polyline(tt,rt,et)}));break;case i.Helper.GDI.RecordType.EMR_POLYBEZIER:case i.Helper.GDI.RecordType.EMR_POLYBEZIERTO:for(var it=e===i.Helper.GDI.RecordType.EMR_POLYBEZIERTO,nt=new n.RectL(t),ot=(Y=t.readUint32(),[]);Y>0;)ot.push(new n.PointL(t)),Y--;h._records.push((function(t){t.polybezier(it,ot,nt)}));break;case i.Helper.GDI.RecordType.EMR_POLYBEZIER16:for(var st=new n.RectL(t),lt=new n.PointL(t),at=(Y=t.readUint32(),[lt]);Y>0;)at.push(new n.PointS(t)),Y--;h._records.push((function(t){t.polybezier(!1,at,st)}));break;case i.Helper.GDI.RecordType.EMR_POLYBEZIERTO16:for(var pt=new n.RectL(t),ht=(Y=t.readUint32(),[]);Y>0;)ht.push(new n.PointS(t)),Y--;h._records.push((function(t){t.polybezier(!0,ht,pt)}));break;case i.Helper.GDI.RecordType.EMR_SETTEXTALIGN:var ct=t.readUint32();h._records.push((function(t){t.setTextAlign(ct)}));break;case i.Helper.GDI.RecordType.EMR_SETSTRETCHBLTMODE:var ut=t.readUint32();h._records.push((function(t){t.setStretchBltMode(ut)}));break;case i.Helper.GDI.RecordType.EMR_SETBRUSHORGEX:var Et=new n.PointL(t);h._records.push((function(t){t.setBrushOrgEx(Et)}));break;case i.Helper.GDI.RecordType.EMR_BEGINPATH:h._records.push((function(t){t.beginPath()}));break;case i.Helper.GDI.RecordType.EMR_ENDPATH:h._records.push((function(t){t.endPath()}));break;case i.Helper.GDI.RecordType.EMR_ABORTPATH:h._records.push((function(t){t.abortPath()}));break;case i.Helper.GDI.RecordType.EMR_CLOSEFIGURE:h._records.push((function(t){t.closeFigure()}));break;case i.Helper.GDI.RecordType.EMR_FILLPATH:var dt=new n.RectL(t);h._records.push((function(t){t.fillPath(dt)}));break;case i.Helper.GDI.RecordType.EMR_STROKEPATH:var Rt=new n.RectL(t);h._records.push((function(t){t.strokePath(Rt)}));break;case i.Helper.GDI.RecordType.EMR_SELECTCLIPPATH:var _t=t.readUint32();h._records.push((function(t){t.selectClipPath(_t)}));break;case i.Helper.GDI.RecordType.EMR_EXTSELECTCLIPRGN:t.skip(4);var ft=t.readUint32(),Tt=ft!==i.Helper.GDI.RegionMode.RGN_COPY?new o.Region(t):null;h._records.push((function(t){t.selectClipRgn(ft,Tt)}));break;case i.Helper.GDI.RecordType.EMR_OFFSETCLIPRGN:var gt=new n.PointL(t);h._records.push((function(t){t.offsetClipRgn(gt)}));break;case i.Helper.GDI.RecordType.EMR_SETMITERLIMIT:var yt=t.readUint32();h._records.push((function(t){t.setMiterLimit(yt)}));break;case i.Helper.GDI.RecordType.EMR_POLYLINE:case i.Helper.GDI.RecordType.EMR_POLYLINETO:case i.Helper.GDI.RecordType.EMR_POLYPOLYLINE:case i.Helper.GDI.RecordType.EMR_SETPIXELV:case i.Helper.GDI.RecordType.EMR_SETMAPPERFLAGS:case i.Helper.GDI.RecordType.EMR_SETROP2:case i.Helper.GDI.RecordType.EMR_SETCOLORADJUSTMENT:case i.Helper.GDI.RecordType.EMR_SETTEXTCOLOR:case i.Helper.GDI.RecordType.EMR_SETMETARGN:case i.Helper.GDI.RecordType.EMR_EXCLUDECLIPRECT:case i.Helper.GDI.RecordType.EMR_INTERSECTCLIPRECT:case i.Helper.GDI.RecordType.EMR_SCALEVIEWPORTEXTEX:case i.Helper.GDI.RecordType.EMR_SCALEWINDOWEXTEX:case i.Helper.GDI.RecordType.EMR_SETWORLDTRANSFORM:case i.Helper.GDI.RecordType.EMR_MODIFYWORLDTRANSFORM:case i.Helper.GDI.RecordType.EMR_ANGLEARC:case i.Helper.GDI.RecordType.EMR_ELLIPSE:case i.Helper.GDI.RecordType.EMR_ARC:case i.Helper.GDI.RecordType.EMR_CHORD:case i.Helper.GDI.RecordType.EMR_PIE:case i.Helper.GDI.RecordType.EMR_SELECTPALETTE:case i.Helper.GDI.RecordType.EMR_CREATEPALETTE:case i.Helper.GDI.RecordType.EMR_SETPALETTEENTRIES:case i.Helper.GDI.RecordType.EMR_RESIZEPALETTE:case i.Helper.GDI.RecordType.EMR_REALIZEPALETTE:case i.Helper.GDI.RecordType.EMR_EXTFLOODFILL:case i.Helper.GDI.RecordType.EMR_ARCTO:case i.Helper.GDI.RecordType.EMR_POLYDRAW:case i.Helper.GDI.RecordType.EMR_SETARCDIRECTION:case i.Helper.GDI.RecordType.EMR_STROKEANDFILLPATH:case i.Helper.GDI.RecordType.EMR_FLATTENPATH:case i.Helper.GDI.RecordType.EMR_WIDENPATH:case i.Helper.GDI.RecordType.EMR_COMMENT:case i.Helper.GDI.RecordType.EMR_FILLRGN:case i.Helper.GDI.RecordType.EMR_FRAMERGN:case i.Helper.GDI.RecordType.EMR_INVERTRGN:case i.Helper.GDI.RecordType.EMR_PAINTRGN:case i.Helper.GDI.RecordType.EMR_BITBLT:case i.Helper.GDI.RecordType.EMR_STRETCHBLT:case i.Helper.GDI.RecordType.EMR_MASKBLT:case i.Helper.GDI.RecordType.EMR_PLGBLT:case i.Helper.GDI.RecordType.EMR_SETDIBITSTODEVICE:case i.Helper.GDI.RecordType.EMR_STRETCHDIBITS:case i.Helper.GDI.RecordType.EMR_EXTCREATEFONTINDIRECTW:case i.Helper.GDI.RecordType.EMR_EXTTEXTOUTA:case i.Helper.GDI.RecordType.EMR_EXTTEXTOUTW:case i.Helper.GDI.RecordType.EMR_POLYPOLYLINE16:case i.Helper.GDI.RecordType.EMR_POLYDRAW16:case i.Helper.GDI.RecordType.EMR_CREATEMONOBRUSH:case i.Helper.GDI.RecordType.EMR_CREATEDIBPATTERNBRUSHPT:case i.Helper.GDI.RecordType.EMR_POLYTEXTOUTA:case i.Helper.GDI.RecordType.EMR_POLYTEXTOUTW:case i.Helper.GDI.RecordType.EMR_SETICMMODE:case i.Helper.GDI.RecordType.EMR_CREATECOLORSPACE:case i.Helper.GDI.RecordType.EMR_SETCOLORSPACE:case i.Helper.GDI.RecordType.EMR_DELETECOLORSPACE:case i.Helper.GDI.RecordType.EMR_GLSRECORD:case i.Helper.GDI.RecordType.EMR_GLSBOUNDEDRECORD:case i.Helper.GDI.RecordType.EMR_PIXELFORMAT:case i.Helper.GDI.RecordType.EMR_DRAWESCAPE:case i.Helper.GDI.RecordType.EMR_EXTESCAPE:case i.Helper.GDI.RecordType.EMR_SMALLTEXTOUT:case i.Helper.GDI.RecordType.EMR_FORCEUFIMAPPING:case i.Helper.GDI.RecordType.EMR_NAMEDESCAPE:case i.Helper.GDI.RecordType.EMR_COLORCORRECTPALETTE:case i.Helper.GDI.RecordType.EMR_SETICMPROFILEA:case i.Helper.GDI.RecordType.EMR_SETICMPROFILEW:case i.Helper.GDI.RecordType.EMR_ALPHABLEND:case i.Helper.GDI.RecordType.EMR_SETLAYOUT:case i.Helper.GDI.RecordType.EMR_TRANSPARENTBLT:case i.Helper.GDI.RecordType.EMR_GRADIENTFILL:case i.Helper.GDI.RecordType.EMR_SETLINKEDUFIS:case i.Helper.GDI.RecordType.EMR_SETTEXTJUSTIFICATION:case i.Helper.GDI.RecordType.EMR_COLORMATCHTOTARGETW:case i.Helper.GDI.RecordType.EMR_CREATECOLORSPACEW:default:var St="UNKNOWN";for(var It in i.Helper.GDI.RecordType){if(i.Helper.GDI.RecordType[It]===e){St=It;break}}i.Helper.log("[EMF] "+St+" record (0x"+e.toString(16)+") at offset 0x"+a.toString(16)+" with "+l+" bytes")}a+=l},h=this;t:for(;!r;){switch(p()){case"break-main_loop":break t}}if(!r)throw new i.EMFJSError("Could not read all records")}return t.prototype.play=function(t){for(var e=this._records.length,r=0;r<e;r++)this._records[r](t)},t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"PointS",(function(){return n})),r.d(e,"PointL",(function(){return o})),r.d(e,"RectL",(function(){return s})),r.d(e,"SizeL",(function(){return l})),r.d(e,"Obj",(function(){return a}));var i=r(5),n=function(){function t(t,e,r){null!=t?(this.x=t.readInt16(),this.y=t.readInt16()):(this.x=e,this.y=r)}return t.prototype.clone=function(){return new t(null,this.x,this.y)},t.prototype.toString=function(){return"{x: "+this.x+", y: "+this.y+"}"},t}(),o=function(){function t(t,e,r){null!=t?(this.x=t.readInt32(),this.y=t.readInt32()):(this.x=e,this.y=r)}return t.prototype.clone=function(){return new t(null,this.x,this.y)},t.prototype.toString=function(){return"{x: "+this.x+", y: "+this.y+"}"},t}(),s=function(){function t(t,e,r,i,n){null!=t?(this.left=t.readInt32(),this.top=t.readInt32(),this.right=t.readInt32(),this.bottom=t.readInt32()):(this.bottom=n,this.right=i,this.top=r,this.left=e)}return t.prototype.clone=function(){return new t(null,this.left,this.top,this.right,this.bottom)},t.prototype.toString=function(){return"{left: "+this.left+", top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+"}"},t.prototype.empty=function(){return this.left>=this.right||this.top>=this.bottom},t.prototype.intersect=function(e){return this.empty()||e.empty()||this.left>=e.right||this.top>=e.bottom||this.right<=e.left||this.bottom<=e.top?null:new t(null,Math.max(this.left,e.left),Math.max(this.top,e.top),Math.min(this.right,e.right),Math.min(this.bottom,e.bottom))},t}(),l=function(){function t(t,e,r){null!=t?(this.cx=t.readUint32(),this.cy=t.readUint32()):(this.cx=e,this.cy=r)}return t.prototype.clone=function(){return new t(null,this.cx,this.cy)},t.prototype.toString=function(){return"{cx: "+this.cx+", cy: "+this.cy+"}"},t}(),a=function(){function t(t){this.type=t}return t.prototype.clone=function(){throw new i.EMFJSError("clone not implemented")},t.prototype.toString=function(){throw new i.EMFJSError("toString not implemented")},t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"Region",(function(){return l})),r.d(e,"CreateSimpleRegion",(function(){return a})),r.d(e,"Scan",(function(){return p}));var i,n=r(5),o=r(7),s=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),l=function(t){function e(e,r){var i=t.call(this,"region")||this;if(null!=e){if(32!==e.readUint32())throw new n.EMFJSError("Invalid region header");e.skip(4);var s=e.readUint32();if(16*s!==e.readUint32())throw new n.EMFJSError("Invalid region data");i.bounds=new o.RectL(e),i.scans=[];for(var l=void 0,a=0;a<s;a++){var h=new o.RectL(e);l||l.top!==h.top||l.bottom!==h.bottom?(l=new p(h),i.scans.push(l)):l.append(h)}i._updateComplexity()}else if(null!=r){if(i.bounds=null!=r.bounds?r.bounds.clone():null,null!=r.scans){i.scans=[];for(a=0;a<r.scans.length;a++)i.scans.push(r.scans[a].clone())}else i.scans=null;i.complexity=r.complexity}else i.bounds=null,i.scans=null,i.complexity=0;return i}return s(e,t),e.prototype.clone=function(){return new e(null,this)},e.prototype.toString=function(){return"{complexity: "+["null","simple","complex"][this.complexity]+" bounds: "+(null!=this.bounds?this.bounds.toString():"[none]")+" #scans: "+(null!=this.scans?this.scans.length:"[none]")+"}"},e.prototype._updateComplexity=function(){if(null==this.bounds)this.complexity=0,this.scans=null;else if(this.bounds.empty())this.complexity=0,this.scans=null,this.bounds=null;else if(null==this.scans)this.complexity=1;else if(this.complexity=2,1===this.scans.length){var t=this.scans[0];if(t.top===this.bounds.top&&t.bottom===this.bounds.bottom&&1===t.scanlines.length){var e=t.scanlines[0];e.left===this.bounds.left&&e.right===this.bounds.right&&(this.scans=null,this.complexity=1)}}},e.prototype.subtract=function(t){if((n.Helper.log("[emf] Region "+this.toString()+" subtract "+t.toString()),null!=this.bounds)&&null!=this.bounds.intersect(t)){null==this.scans&&(this.scans=[],this.scans.push(new p(new o.RectL(null,this.bounds.left,this.bounds.top,this.bounds.right,this.bounds.bottom))),this.complexity=2);for(var e=0;e<this.scans.length;){if((d=this.scans[e]).bottom>=t.top){var r=d.clone();d.bottom=t.top-1,r.top=t.top,d.top>=d.bottom?this.scans[e]=r:(n.Helper.log("[emf] Region split top scan "+e+" for substraction"),this.scans.splice(++e,0,r));break}e++}for(var i=e;e<this.scans.length;){if((d=this.scans[e]).top>t.bottom)break;if(d.bottom>t.bottom){r=d.clone();d.bottom=t.bottom,r.top=t.bottom+1,d.top>=d.bottom?this.scans[e]=r:(n.Helper.log("[emf] Region split bottom scan "+e+" for substraction"),this.scans.splice(++e,0,r));break}e++}if(i<this.scans.length){var s=e;for(e=i;e<s;){(d=this.scans[e]).subtract(t.left,t.right)?e++:(n.Helper.log("[emf] Region remove now empty scan "+e+" due to subtraction"),this.scans.splice(e,1),s--)}}if(null!=this.scans){for(var l,a=void 0,h=void 0,c=void 0,u=this.scans.length,E=0;E<u;E++){var d=this.scans[E];0===E&&(l=d.top),E===u-1&&(c=d.bottom);var R=d.scanlines.length;if(R>0){var _=d.scanlines[0];(null==a||_.left<a)&&(a=_.left),_=d.scanlines[R-1],(null==h||_.right>h)&&(h=_.right)}}null!=a&&null!=l&&null!=h&&null!=c?(this.bounds=new o.RectL(null,a,l,h,c),this._updateComplexity()):(this.bounds=null,this.scans=null,this.complexity=0)}else this._updateComplexity()}n.Helper.log("[emf] Region subtraction -> "+this.toString())},e.prototype.intersect=function(t){if(n.Helper.log("[emf] Region "+this.toString()+" intersect with "+t.toString()),null!=this.bounds)if(this.bounds=this.bounds.intersect(t),null!=this.bounds){if(null!=this.scans){for(var e=0;e<this.scans.length;){if(!((r=this.scans[e]).bottom<this.bounds.top))break;e++}for(e>0&&(n.Helper.log("[emf] Region remove "+e+" scans from top"),this.scans.splice(0,e),this.scans.length>0&&(this.scans[0].top=this.bounds.top)),e=0;e<this.scans.length;){var r;if((r=this.scans[e]).top>this.bounds.bottom){n.Helper.log("[emf] Region remove "+(this.scans.length-e)+" scans from bottom"),this.scans.splice(e,this.scans.length-e);break}r.intersect(this.bounds.left,this.bounds.right)?e++:(n.Helper.log("[emf] Region remove now empty scan "+e+" due to intersection"),this.scans.splice(e,1))}this.scans.length>0&&(this.scans[this.scans.length-1].bottom=this.bounds.bottom),this._updateComplexity()}}else this.scans=null,this.complexity=0;n.Helper.log("[emf] Region intersection -> "+this.toString())},e.prototype.offset=function(t,e){if(null!=this.bounds&&(this.bounds.left+=t,this.bounds.top+=e,this.bounds.right+=t,this.bounds.bottom+=e),null!=this.scans)for(var r=this.scans.length,i=0;i<r;i++){var n=this.scans[i];n.top+=e,n.bottom+=e;for(var o=n.scanlines.length,s=0;s<o;s++){var l=n.scanlines[s];l.left+=t,l.right+=t}}},e}(o.Obj);function a(t,e,r,i){var n=new l(null,null);return n.bounds=new o.RectL(null,t,e,r,i),n._updateComplexity(),n}var p=function(){function t(t,e){if(null!=t)this.top=t.top,this.bottom=t.bottom,this.scanlines=[{left:t.left,right:t.right}];else if(null!=e){this.top=e.top,this.bottom=e.bottom,this.scanlines=[];for(var r=0;r<e.scanlines.length;r++){var i=e.scanlines[r];this.scanlines.push({left:i.left,right:i.right})}}}return t.prototype.clone=function(){return new t(null,this)},t.prototype.append=function(t){this.scanlines.push({left:t.left,right:t.right})},t.prototype.subtract=function(t,e){var r;for(r=0;r<this.scanlines.length;){if(!((o=this.scanlines[r]).left<=t))break;o.right>=t&&(o.right=t-1,o.left>=o.right)?this.scanlines.splice(r,1):r++}for(var i=r,n=0;r<this.scanlines.length;){var o;if((o=this.scanlines[r]).right>e){o.left=e,n=r-i,o.left>=o.right&&n++;break}r++}return n>0&&i<this.scanlines.length&&this.scanlines.splice(i,n),this.scanlines.length>0},t.prototype.intersect=function(t,e){for(var r=0;r<this.scanlines.length;r++){if((i=this.scanlines[r]).left>=t||i.right>=t){r>0&&this.scanlines.splice(0,r);break}}if(this.scanlines.length>0){var i;(i=this.scanlines[0]).left<t&&(i.left=t);for(r=0;r<this.scanlines.length;r++)if((i=this.scanlines[r]).left>e){this.scanlines.splice(r,this.scanlines.length-r);break}this.scanlines.length>0&&(i=this.scanlines[this.scanlines.length-1]).right>e&&(i.right=e)}return this.scanlines.length>0},t}()},function(t,e,r){"use strict";r.r(e),r.d(e,"ColorRef",(function(){return a})),r.d(e,"Font",(function(){return p})),r.d(e,"Brush",(function(){return h})),r.d(e,"Pen",(function(){return c}));var i,n=r(10),o=r(5),s=r(7),l=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(){function t(t,e,r,i){null!=t?(this.r=t.readUint8(),this.g=t.readUint8(),this.b=t.readUint8(),t.skip(1)):(this.r=e,this.g=r,this.b=i)}return t.prototype.clone=function(){return new t(null,this.r,this.g,this.b)},t.prototype.toHex=function(){return(16777216+(this.r<<16|this.g<<8|this.b)).toString(16).slice(1)},t.prototype.toString=function(){return"{r: "+this.r+", g: "+this.g+", b: "+this.b+"}"},t}(),p=function(t){function e(e,r){var i=t.call(this,"font")||this;if(null!=e){i.height=e.readInt32(),i.width=e.readInt32(),i.escapement=e.readInt32(),i.orientation=e.readInt32(),i.weight=e.readInt32(),i.italic=e.readUint8(),i.underline=e.readUint8(),i.strikeout=e.readUint8(),i.charset=e.readUint8(),i.outprecision=e.readUint8(),i.clipprecision=e.readUint8(),i.quality=e.readUint8();var n=e.readUint8();i.pitch=15&n,i.family=n>>6&3;var o=r,s=e.pos;i.facename=e.readFixedSizeUnicodeString(Math.min(o-(e.pos-s),32))}else null!=r?(r=r,i.height=r.height,i.width=r.width,i.escapement=r.escapement,i.orientation=r.orientation,i.weight=r.weight,i.italic=r.italic,i.underline=r.underline,i.strikeout=r.strikeout,i.charset=r.charset,i.outprecision=r.outprecision,i.clipprecision=r.clipprecision,i.quality=r.quality,i.pitch=r.pitch,i.family=r.family,i.facename=r.facename):(i.height=-80,i.width=0,i.escapement=0,i.orientation=0,i.weight=400,i.italic=0,i.underline=0,i.strikeout=0,i.charset=0,i.outprecision=0,i.clipprecision=0,i.quality=0,i.pitch=0,i.family=0,i.facename="Helvetica");return i}return l(e,t),e.prototype.clone=function(){return new e(null,this)},e.prototype.toString=function(){return JSON.stringify(this)},e}(s.Obj),h=function(t){function e(e,r){var i=t.call(this,"brush")||this;if(null!=e){var s=e.pos;switch(i.style=e.readUint32(),i.style){case o.Helper.GDI.BrushStyle.BS_SOLID:i.color=new a(e);break;case o.Helper.GDI.BrushStyle.BS_PATTERN:i.pattern=new n.DIBitmap(e);break;case o.Helper.GDI.BrushStyle.BS_DIBPATTERNPT:i.dibpatternpt=new n.DIBitmap(e);break;case o.Helper.GDI.BrushStyle.BS_HATCHED:i.color=new a(e),i.hatchstyle=e.readUint32()}e.seek(s+12)}else switch(i.style=r.style,i.style){case o.Helper.GDI.BrushStyle.BS_SOLID:i.color=r.color.clone();break;case o.Helper.GDI.BrushStyle.BS_PATTERN:i.pattern=r.pattern;break;case o.Helper.GDI.BrushStyle.BS_DIBPATTERNPT:i.dibpatternpt=r.dibpatternpt;break;case o.Helper.GDI.BrushStyle.BS_HATCHED:i.color=r.color.clone(),i.hatchstyle=r.hatchstyle}return i}return l(e,t),e.prototype.clone=function(){return new e(null,this)},e.prototype.toString=function(){var t="{style: "+this.style;switch(this.style){case o.Helper.GDI.BrushStyle.BS_SOLID:t+=", color: "+this.color.toString();break;case o.Helper.GDI.BrushStyle.BS_HATCHED:t+=", color: "+this.color.toString()+", hatchstyle: "+this.hatchstyle}return t+"}"},e}(s.Obj),c=function(t){function e(e,r,i,n,o){var l=t.call(this,"pen")||this;return null!=e?null!=r?(l.style=255&e.readUint32(),l.width=e.readUint32(),l.brush=new h(e),l.color=null!=l.brush.color?l.brush.color.clone():new a(null,0,0,0)):(l.style=255&e.readUint32(),l.width=new s.PointL(e).x,l.color=new a(e)):(l.style=r,l.width=i,null!=n&&(l.color=n),null!=o&&(l.brush=o)),l}return l(e,t),e.prototype.clone=function(){return new e(null,this.style,this.width,null!=this.color?this.color.clone():null,null!=this.brush?this.brush.clone():null)},e.prototype.toString=function(){return"{style: "+this.style+", width: "+this.width+", color: "+(null!=this.color?this.color.toString():"none")+"}"},e}(s.Obj)},function(t,e,r){"use strict";r.r(e),r.d(e,"BitmapBase",(function(){return s})),r.d(e,"BitmapCoreHeader",(function(){return l})),r.d(e,"BitmapInfoHeader",(function(){return a})),r.d(e,"BitmapInfo",(function(){return p})),r.d(e,"DIBitmap",(function(){return h}));var i,n=r(5),o=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=function(){function t(){}return t.prototype.getWidth=function(){throw new n.EMFJSError("getWidth not implemented")},t.prototype.getHeight=function(){throw new n.EMFJSError("getHeight not implemented")},t}(),l=function(){function t(t,e){e&&t.skip(4),this.width=t.readUint16(),this.height=t.readUint16(),this.planes=t.readUint16(),this.bitcount=t.readUint16()}return t.prototype.colors=function(){return this.bitcount<=8?1<<this.bitcount:0},t}(),a=function(){function t(t,e){e&&t.skip(4),this.width=t.readInt32(),this.height=t.readInt32(),this.planes=t.readUint16(),this.bitcount=t.readUint16(),this.compression=t.readUint32(),this.sizeimage=t.readUint32(),this.xpelspermeter=t.readInt32(),this.ypelspermeter=t.readInt32(),this.clrused=t.readUint32(),this.clrimportant=t.readUint32()}return t.prototype.colors=function(){return 0!==this.clrused?this.clrused<256?this.clrused:256:this.bitcount>8?0:1<<this.bitcount},t}(),p=function(t){function e(e,r){var i=t.call(this)||this;i._usergb=r;var o=e.readUint32();if(i._infosize=o,o===n.Helper.GDI.BITMAPCOREHEADER_SIZE)i._header=new l(e,!1),i._infosize+=i._header.colors()*(r?3:2);else{i._header=new a(e,!1);var s=i._header.compression===n.Helper.GDI.BitmapCompression.BI_BITFIELDS?3:0;o<=n.Helper.GDI.BITMAPINFOHEADER_SIZE+4*s&&(i._infosize=n.Helper.GDI.BITMAPINFOHEADER_SIZE+4*s),i._infosize+=i._header.colors()*(r?4:2)}return i}return o(e,t),e.prototype.getWidth=function(){return this._header.width},e.prototype.getHeight=function(){return Math.abs(this._header.height)},e.prototype.infosize=function(){return this._infosize},e.prototype.header=function(){return this._header},e}(s),h=function(t){function e(e,r){var i=t.call(this)||this;return i._reader=e,i._offset=e.pos,i._location=r,i._info=new p(e,!0),i}return o(e,t),e.prototype.getWidth=function(){return this._info.getWidth()},e.prototype.getHeight=function(){return this._info.getHeight()},e.prototype.totalSize=function(){return this._location.header.size+this._location.data.size},e.prototype.makeBitmapFileHeader=function(){var t=new ArrayBuffer(14),e=new Uint8Array(t);return e[0]=66,e[1]=77,n.Helper._writeUint32Val(e,2,this.totalSize()+14),n.Helper._writeUint32Val(e,10,this._info.infosize()+14),n.Helper._blobToBinary(e)},e.prototype.base64ref=function(){var t=this._reader.pos;this._reader.seek(this._offset);var e,r="image/bmp",i=this._info.header();if(i instanceof a&&null!=i.compression)switch(i.compression){case n.Helper.GDI.BitmapCompression.BI_JPEG:r="data:image/jpeg";break;case n.Helper.GDI.BitmapCompression.BI_PNG:r="data:image/png";break;default:e=this.makeBitmapFileHeader()}else e=this.makeBitmapFileHeader();this._reader.seek(this._location.header.offset),null!=e?e+=this._reader.readBinary(this._location.header.size):e=this._reader.readBinary(this._location.header.size),this._reader.seek(this._location.data.offset),e+=this._reader.readBinary(this._location.data.size);var o="data:"+r+";base64,"+btoa(e);return this._reader.seek(t),o},e}(s)},function(t,e,r){"use strict";r.r(e),r.d(e,"Path",(function(){return p})),r.d(e,"_StockObjects",(function(){return h})),r.d(e,"GDIContextState",(function(){return c})),r.d(e,"GDIContext",(function(){return u}));var i,n=r(5),o=r(7),s=r(8),l=r(9),a=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),p=function(t){function e(e,r){var i=t.call(this,"path")||this;return i.svgPath=null!=e?e:r.svgPath,i}return a(e,t),e.prototype.clone=function(){return new e(null,this)},e.prototype.toString=function(){return"{[path]}"},e}(o.Obj);var h=function(){var t=function(t,e,r){return new l.Brush(null,{style:n.Helper.GDI.BrushStyle.BS_SOLID,color:new l.ColorRef(null,t,e,r)})},e=function(t,e,r){return new l.Pen(null,n.Helper.GDI.PenStyle.PS_SOLID,1,new l.ColorRef(null,t,e,r),null)},r={WHITE_BRUSH:t(255,255,255),LTGRAY_BRUSH:t(212,208,200),GRAY_BRUSH:t(128,128,128),DKGRAY_BRUSH:t(64,64,64),BLACK_BRUSH:t(0,0,0),NULL_BRUSH:new l.Brush(null,{style:n.Helper.GDI.BrushStyle.BS_NULL}),WHITE_PEN:e(255,255,255),BLACK_PEN:e(0,0,0),NULL_PEN:new l.Pen(null,n.Helper.GDI.PenStyle.PS_NULL,0,null,null),OEM_FIXED_FONT:null,ANSI_FIXED_FONT:null,ANSI_VAR_FONT:null,SYSTEM_FONT:null,DEVICE_DEFAULT_FONT:null,DEFAULT_PALETTE:null,SYSTEM_FIXED_FONT:null,DEFAULT_GUI_FONT:null},i={};for(var o in r){i[(n.Helper.GDI.StockObject[o]-2147483648).toString()]=r[o]}return i}(),c=function(t,e){if(null!=t)for(var r in this._svggroup=t._svggroup,this._svgclipChanged=t._svgclipChanged,this._svgtextbkfilter=t._svgtextbkfilter,this.mapmode=t.mapmode,this.stretchmode=t.stretchmode,this.textalign=t.textalign,this.bkmode=t.bkmode,this.textcolor=t.textcolor.clone(),this.bkcolor=t.bkcolor.clone(),this.polyfillmode=t.polyfillmode,this.miterlimit=t.miterlimit,this.wx=t.wx,this.wy=t.wy,this.ww=t.ww,this.wh=t.wh,this.vx=t.vx,this.vy=t.vy,this.vw=t.vw,this.vh=t.vh,this.x=t.x,this.y=t.y,this.nextbrx=t.nextbrx,this.nextbry=t.nextbry,this.brx=t.brx,this.bry=t.bry,this.clip=t.clip,this.ownclip=!1,this.selected={},t.selected)this.selected[r]=t.selected[r];else for(var r in this._svggroup=null,this._svgclipChanged=!1,this._svgtextbkfilter=null,this.mapmode=n.Helper.GDI.MapMode.MM_ANISOTROPIC,this.stretchmode=n.Helper.GDI.StretchMode.COLORONCOLOR,this.textalign=0,this.bkmode=n.Helper.GDI.MixMode.OPAQUE,this.textcolor=new l.ColorRef(null,0,0,0),this.bkcolor=new l.ColorRef(null,255,255,255),this.polyfillmode=n.Helper.GDI.PolygonFillMode.ALTERNATE,this.miterlimit=10,this.wx=0,this.wy=0,this.ww=0,this.wh=0,this.vx=0,this.vy=0,this.vw=0,this.vh=0,this.x=0,this.y=0,this.nextbrx=0,this.nextbry=0,this.brx=0,this.bry=0,this.clip=null,this.ownclip=!1,this.selected={},e){var i=e[r];this.selected[r]=null!=i?i.clone():null}},u=function(){function t(t){this._svg=t,this._svgdefs=null,this._svgPatterns={},this._svgClipPaths={},this._svgPath=null,this.defObjects={brush:new l.Brush(null,{style:n.Helper.GDI.BrushStyle.BS_SOLID,color:new l.ColorRef(null,0,0,0)}),pen:new l.Pen(null,n.Helper.GDI.PenStyle.PS_SOLID,1,new l.ColorRef(null,0,0,0),null),font:new l.Font(null,null),palette:null,region:null},this.state=new c(null,this.defObjects),this.statestack=[this.state],this.objects={}}return t.prototype.setMapMode=function(t){n.Helper.log("[gdi] setMapMode: mode="+t),this.state.mapmode=t,this.state._svggroup=null},t.prototype.setWindowOrgEx=function(t,e){n.Helper.log("[gdi] setWindowOrgEx: x="+t+" y="+e),this.state.wx=t,this.state.wy=e,this.state._svggroup=null},t.prototype.setWindowExtEx=function(t,e){n.Helper.log("[gdi] setWindowExtEx: x="+t+" y="+e),this.state.ww=t,this.state.wh=e,this.state._svggroup=null},t.prototype.setViewportOrgEx=function(t,e){n.Helper.log("[gdi] setViewportOrgEx: x="+t+" y="+e),this.state.vx=t,this.state.vy=e,this.state._svggroup=null},t.prototype.setViewportExtEx=function(t,e){n.Helper.log("[gdi] setViewportExtEx: x="+t+" y="+e),this.state.vw=t,this.state.vh=e,this.state._svggroup=null},t.prototype.setBrushOrgEx=function(t){n.Helper.log("[gdi] setBrushOrgEx: x="+t.x+" y="+t.y),this.state.nextbrx=t.x,this.state.nextbry=t.y},t.prototype.saveDC=function(){n.Helper.log("[gdi] saveDC");var t=this.state;this.state=new c(this.state),this.statestack.push(t),this.state._svggroup=null},t.prototype.restoreDC=function(t){if(n.Helper.log("[gdi] restoreDC: saved="+t),!(this.statestack.length>1))throw new n.EMFJSError("No saved contexts");if(-1===t)this.state=this.statestack.pop();else{if(t<-1)throw new n.EMFJSError("restoreDC: relative restore not implemented");if(t>1)throw new n.EMFJSError("restoreDC: absolute restore not implemented")}this.state._svggroup=null},t.prototype.setStretchBltMode=function(t){n.Helper.log("[gdi] setStretchBltMode: stretchMode="+t)},t.prototype.rectangle=function(t,e,r){n.Helper.log("[gdi] rectangle: rect="+t.toString()+" with pen "+this.state.selected.pen.toString()+" and brush "+this.state.selected.brush.toString());var i=this._todevY(t.bottom),o=this._todevX(t.right),s=this._todevY(t.top),l=this._todevX(t.left);e=this._todevH(e),r=this._todevH(r),n.Helper.log("[gdi] rectangle: TRANSLATED: bottom="+i+" right="+o+" top="+s+" left="+l+" rh="+r+" rw="+e),this._pushGroup();var a=this._applyOpts(null,!0,!0,!1);this._svg.rect(this.state._svggroup,l,s,o-l,i-s,e/2,r/2,a)},t.prototype.lineTo=function(t,e){n.Helper.log("[gdi] lineTo: x="+t+" y="+e+" with pen "+this.state.selected.pen.toString());var r=this._todevX(t),i=this._todevY(e),o=this._todevX(this.state.x),s=this._todevY(this.state.y);this.state.x=t,this.state.y=e,n.Helper.log("[gdi] lineTo: TRANSLATED: toX="+r+" toY="+i+" fromX="+o+" fromY="+s),this._pushGroup();var l=this._applyOpts(null,!0,!1,!1);this._svg.line(this.state._svggroup,o,s,r,i,l)},t.prototype.moveToEx=function(t,e){n.Helper.log("[gdi] moveToEx: x="+t+" y="+e),this.state.x=t,this.state.y=e,null!=this._svgPath&&(this._svgPath.move(this.state.x,this.state.y),n.Helper.log("[gdi] new path: "+this._svgPath.path()))},t.prototype.polygon=function(t,e,r){n.Helper.log("[gdi] polygon: points="+t+" with pen "+this.state.selected.pen.toString()+" and brush "+this.state.selected.brush.toString());for(var i=[],o=0;o<t.length;o++){var s=t[o];i.push([this._todevX(s.x),this._todevY(s.y)])}r&&this._pushGroup();var l={"fill-rule":this.state.polyfillmode===n.Helper.GDI.PolygonFillMode.ALTERNATE?"evenodd":"nonzero"};this._applyOpts(l,!0,!0,!1),this._svg.polygon(this.state._svggroup,i,l)},t.prototype.polyPolygon=function(t,e){n.Helper.log("[gdi] polyPolygon: polygons.length="+t.length+" with pen "+this.state.selected.pen.toString()+" and brush "+this.state.selected.brush.toString());for(var r=t.length,i=0;i<r;i++)this.polygon(t[i],e,0===i)},t.prototype.polyline=function(t,e,r){n.Helper.log("[gdi] polyline: isLineTo="+t.toString()+", points="+e+", bounds="+r.toString()+" with pen "+this.state.selected.pen.toString());for(var i=[],o=0;o<e.length;o++){var s=e[o];i.push([this._todevX(s.x),this._todevY(s.y)])}if(null!=this._svgPath){if(t&&0!==i.length){var l=i[0];this._svgPath.move(l[0],l[1])}else this._svgPath.move(this._todevX(this.state.x),this._todevY(this.state.y));this._svgPath.line(i),n.Helper.log("[gdi] new path: "+this._svgPath.path())}else{this._pushGroup();var a=this._applyOpts(null,!0,!1,!1);if(t&&e.length>0){var p=e[0];p.x===this.state.x&&p.y===this.state.y||i.unshift([this._todevX(this.state.x),this._todevY(this.state.y)])}this._svg.polyline(this.state._svggroup,i,a)}if(e.length>0){var h=e[e.length-1];this.state.x=h.x,this.state.y=h.y}},t.prototype.polybezier=function(t,e,r){n.Helper.log("[gdi] polybezier: isPolyBezierTo="+t.toString()+", points="+e+", bounds="+r.toString()+" with pen "+this.state.selected.pen.toString());for(var i=[],o=0;o<e.length;o++){var s=e[o];i.push({x:this._todevX(s.x),y:this._todevY(s.y)})}if(null==this._svgPath)throw new n.EMFJSError("polybezier not implemented (not a path)");if(t&&i.length>0){var l=i[0];this._svgPath.move(l.x,l.y)}else this._svgPath.move(this._todevX(this.state.x),this._todevY(this.state.y));if(i.length<(t?3:4))throw new n.EMFJSError("Not enough points to draw bezier");for(o=t?1:0;o+3<=i.length;o+=3){var a=i[o],p=i[o+1],h=i[o+2];this._svgPath.curveC(a.x,a.y,p.x,p.y,h.x,h.y)}if(n.Helper.log("[gdi] new path: "+this._svgPath.path()),e.length>0){var c=e[e.length-1];this.state.x=c.x,this.state.y=c.y}},t.prototype.selectClipPath=function(t){n.Helper.log("[gdi] selectClipPath: rgnMode=0x"+t.toString(16))},t.prototype.selectClipRgn=function(t,e){if(n.Helper.log("[gdi] selectClipRgn: rgnMode=0x"+t.toString(16)),t!==n.Helper.GDI.RegionMode.RGN_COPY){if(null==e)throw new n.EMFJSError("No clip region to select");throw new n.EMFJSError("Not implemented: rgnMode=0x"+t.toString(16))}this.state.selected.region=e,this.state.clip=null,this.state.ownclip=!1,this.state._svgclipChanged=!0},t.prototype.offsetClipRgn=function(t){n.Helper.log("[gdi] offsetClipRgn: offset="+t.toString()),this._getClipRgn().offset(t.x,t.y)},t.prototype.setTextAlign=function(t){n.Helper.log("[gdi] setTextAlign: textAlignmentMode=0x"+t.toString(16)),this.state.textalign=t},t.prototype.setMiterLimit=function(t){n.Helper.log("[gdi] setMiterLimit: miterLimit="+t),this.state.miterlimit=t},t.prototype.setBkMode=function(t){n.Helper.log("[gdi] setBkMode: bkMode=0x"+t.toString(16)),this.state.bkmode=t},t.prototype.setBkColor=function(t){n.Helper.log("[gdi] setBkColor: bkColor="+t.toString()),this.state.bkcolor=t,this.state._svgtextbkfilter=null},t.prototype.setPolyFillMode=function(t){n.Helper.log("[gdi] setPolyFillMode: polyFillMode="+t),this.state.polyfillmode=t},t.prototype.createBrush=function(t,e){var r=this._storeObject(e,t);n.Helper.log("[gdi] createBrush: brush="+e.toString()+" with handle "+r)},t.prototype.createPen=function(t,e){var r=this._storeObject(e,t);n.Helper.log("[gdi] createPen: pen="+e.toString()+" width handle "+r)},t.prototype.createPenEx=function(t,e){var r=this._storeObject(e,t);n.Helper.log("[gdi] createPenEx: pen="+e.toString()+" width handle "+r)},t.prototype.selectObject=function(t,e){var r=this._getObject(t);null==r||null!=e&&r.type!==e?n.Helper.log("[gdi] selectObject: objIdx="+t+(r?" invalid object type: "+r.type:"[invalid index]")):(this._selectObject(r),n.Helper.log("[gdi] selectObject: objIdx="+t+(r?" selected "+r.type+": "+r.toString():"[invalid index]")))},t.prototype.abortPath=function(){n.Helper.log("[gdi] abortPath"),null!=this._svgPath&&(this._svgPath=null)},t.prototype.beginPath=function(){n.Helper.log("[gdi] beginPath"),null!=this._svgPath&&(this._svgPath=null),this._svgPath=this._svg.createPath()},t.prototype.closeFigure=function(){if(n.Helper.log("[gdi] closeFigure"),null==this._svgPath)throw new n.EMFJSError("No path bracket: cannot close figure");this._svgPath.close()},t.prototype.fillPath=function(t){if(n.Helper.log("[gdi] fillPath"),null==this.state.selected.path)throw new n.EMFJSError("No path selected");var e=this.state.selected.path,r=this._applyOpts(null,!0,!0,!1);this._svg.path(this.state._svggroup,e.svgPath,r),this._pushGroup(),this.state.selected.path=null},t.prototype.strokePath=function(t){if(n.Helper.log("[gdi] strokePath"),null==this.state.selected.path)throw new n.EMFJSError("No path selected");var e=this.state.selected.path,r=this._applyOpts({fill:"none"},!0,!1,!1);this._svg.path(this.state._svggroup,e.svgPath,r),this._pushGroup(),this.state.selected.path=null},t.prototype.endPath=function(){if(n.Helper.log("[gdi] endPath"),null==this._svgPath)throw new n.EMFJSError("No path bracket: cannot end path");this._pushGroup(),this._selectObject(new p(this._svgPath)),this._svgPath=null},t.prototype.deleteObject=function(t){var e=this._deleteObject(t);n.Helper.log("[gdi] deleteObject: objIdx="+t+(e?" deleted object":"[invalid index]"))},t.prototype._pushGroup=function(){if(null==this.state._svggroup||this.state._svgclipChanged){this.state._svgclipChanged=!1,this.state._svgtextbkfilter=null;var t={viewBox:[this.state.vx,this.state.vy,this.state.vw,this.state.vh].join(" "),preserveAspectRatio:"none"};null!=this.state.clip?(n.Helper.log("[gdi] new svg x="+this.state.vx+" y="+this.state.vy+" width="+this.state.vw+" height="+this.state.vh+" with clipping"),t["clip-path"]="url(#"+this._getSvgClipPathForRegion(this.state.clip)+")"):n.Helper.log("[gdi] new svg x="+this.state.vx+" y="+this.state.vy+" width="+this.state.vw+" height="+this.state.vh+" without clipping"),this.state._svggroup=this._svg.svg(this.state._svggroup,this.state.vx,this.state.vy,this.state.vw,this.state.vh,t)}},t.prototype._getStockObject=function(t){return t>=2147483648&&t<=2147483665?h[(t-2147483648).toString()]:t===n.Helper.GDI.StockObject.DC_BRUSH?this.state.selected.brush:t===n.Helper.GDI.StockObject.DC_PEN?this.state.selected.pen:null},t.prototype._storeObject=function(t,e){if(!e){for(e=0;null!=this.objects[e.toString()]&&e<=65535;)e++;if(e>65535)return n.Helper.log("[gdi] Too many objects!"),-1}return this.objects[e.toString()]=t,e},t.prototype._getObject=function(t){var e=this.objects[t.toString()];return null==e&&null==(e=this._getStockObject(t))&&n.Helper.log("[gdi] No object with handle "+t),e},t.prototype._getSvgDef=function(){return null==this._svgdefs&&(this._svgdefs=this._svg.defs()),this._svgdefs},t.prototype._getSvgClipPathForRegion=function(t){for(var e in this._svgClipPaths){if(this._svgClipPaths[e]===t)return e}var r=n.Helper._makeUniqueId("c"),i=this._svg.clipPath(this._getSvgDef(),r,"userSpaceOnUse");switch(t.complexity){case 1:this._svg.rect(i,this._todevX(t.bounds.left),this._todevY(t.bounds.top),this._todevW(t.bounds.right-t.bounds.left),this._todevH(t.bounds.bottom-t.bounds.top),{fill:"black","stroke-width":0});break;case 2:for(var o=0;o<t.scans.length;o++)for(var s=t.scans[o],l=0;l<s.scanlines.length;l++){var a=s.scanlines[l];this._svg.rect(i,this._todevX(a.left),this._todevY(s.top),this._todevW(a.right-a.left),this._todevH(s.bottom-s.top),{fill:"black","stroke-width":0})}}return this._svgClipPaths[r]=t,r},t.prototype._getSvgPatternForBrush=function(t){for(var e in this._svgPatterns){if(this._svgPatterns[e]===t)return e}var r,i,o;switch(t.style){case n.Helper.GDI.BrushStyle.BS_PATTERN:r=t.pattern.getWidth(),i=t.pattern.getHeight();break;case n.Helper.GDI.BrushStyle.BS_DIBPATTERNPT:r=t.dibpatternpt.getWidth(),i=t.dibpatternpt.getHeight(),o=t.dibpatternpt.base64ref();break;default:throw new n.EMFJSError("Invalid brush style")}var s=n.Helper._makeUniqueId("p"),l=this._svg.pattern(this._getSvgDef(),s,this.state.brx,this.state.bry,r,i,{patternUnits:"userSpaceOnUse"});return this._svg.image(l,0,0,r,i,o),this._svgPatterns[s]=t,s},t.prototype._selectObject=function(t){switch(this.state.selected[t.type]=t,t.type){case"region":this.state._svgclipChanged=!0;break;case"brush":this.state.brx=this.state.nextbrx,this.state.bry=this.state.nextbry}},t.prototype._deleteObject=function(t){var e=this.objects[t.toString()];if(null!=e){for(var r=0;r<this.statestack.length;r++){var i=this.statestack[r];i.selected[e.type]===e&&(i.selected[e.type]=this.defObjects[e.type].clone())}return delete this.objects[t.toString()],!0}return n.Helper.log("[gdi] Cannot delete object with invalid handle "+t),!1},t.prototype._getClipRgn=function(){return null!=this.state.clip?this.state.ownclip||(this.state.clip=this.state.clip.clone()):null!=this.state.selected.region?this.state.clip=this.state.selected.region.clone():this.state.clip=Object(s.CreateSimpleRegion)(this.state.wx,this.state.wy,this.state.wx+this.state.ww,this.state.wy+this.state.wh),this.state.ownclip=!0,this.state.clip},t.prototype._todevX=function(t){return Math.floor((t-this.state.wx)*(this.state.vw/this.state.ww))+this.state.vx},t.prototype._todevY=function(t){return Math.floor((t-this.state.wy)*(this.state.vh/this.state.wh))+this.state.vy},t.prototype._todevW=function(t){return Math.floor(t*(this.state.vw/this.state.ww))+this.state.vx},t.prototype._todevH=function(t){return Math.floor(t*(this.state.vh/this.state.wh))+this.state.vy},t.prototype._tologicalX=function(t){return Math.floor((t-this.state.vx)/(this.state.vw/this.state.ww))+this.state.wx},t.prototype._tologicalY=function(t){return Math.floor((t-this.state.vy)/(this.state.vh/this.state.wh))+this.state.wy},t.prototype._tologicalW=function(t){return Math.floor(t/(this.state.vw/this.state.ww))+this.state.wx},t.prototype._tologicalH=function(t){return Math.floor(t/(this.state.vh/this.state.wh))+this.state.wy},t.prototype._applyOpts=function(t,e,r,i){if(null==t&&(t={}),e){var o=this.state.selected.pen;if(o.style!==n.Helper.GDI.PenStyle.PS_NULL){t.stroke="#"+o.color.toHex(),t["stroke-width"]=o.width,t["stroke-miterlimit"]=this.state.miterlimit,t["stroke-linecap"]="round";var s=1;t["stroke-linejoin"]="round";var l=4*t["stroke-width"],a=2*t["stroke-width"];switch(o.style){case n.Helper.GDI.PenStyle.PS_DASH:t["stroke-dasharray"]=[l,a].toString();break;case n.Helper.GDI.PenStyle.PS_DOT:t["stroke-dasharray"]=[s,a].toString();break;case n.Helper.GDI.PenStyle.PS_DASHDOT:t["stroke-dasharray"]=[l,a,s,a].toString();break;case n.Helper.GDI.PenStyle.PS_DASHDOTDOT:t["stroke-dasharray"]=[l,a,s,a,s,a].toString()}}}if(r){var p=this.state.selected.brush;switch(p.style){case n.Helper.GDI.BrushStyle.BS_SOLID:t.fill="#"+p.color.toHex();break;case n.Helper.GDI.BrushStyle.BS_PATTERN:case n.Helper.GDI.BrushStyle.BS_DIBPATTERNPT:t.fill="url(#"+this._getSvgPatternForBrush(p)+")";break;case n.Helper.GDI.BrushStyle.BS_NULL:t.fill="none";break;default:n.Helper.log("[gdi] unsupported brush style: "+p.style),t.fill="none"}}if(i){var h=this.state.selected.font;t["font-family"]=h.facename,t["font-size"]=Math.abs(h.height),t.fill="#"+this.state.textcolor.toHex()}return t},t}()}])}));
|
|
//# sourceMappingURL=EMFJS.bundle.min.js.map
|