ht-cadviewer.js 55 KB

12
  1. !function(w,z,c){"use strict";var o="ht",A=w[o],b=A.Default,N=b.getInternal();N.addMethod(b,{toDxf:function(D){var V=new A.DxfWriter;V.snapshotView(D);var U=V.write();return U},viewDxf:function(w,t,m){var H=new A.DxfViewer(w,m);w.addBottomPainter(H),H.parseFile(t)}}),function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var y;y="undefined"!=typeof w?w:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,y.DxfParser=n()}}(function(){var V;return function T(w,q,D){function Z(g,F){if(!q[g]){if(!w[g]){var L="function"==typeof require&&require;if(!F&&L)return L(g,!0);if(m)return m(g,!0);var l=new Error("Cannot find module '"+g+"'");throw l.code="MODULE_NOT_FOUND",l}var u=q[g]={exports:{}};w[g][0].call(u.exports,function(J){var D=w[g][1][J];return Z(D?D:J)},u,u.exports,T,w,q,D)}return q[g].exports}for(var m="function"==typeof require&&require,C=0;C<D.length;C++)Z(D[C]);return Z}({1:[function(J,L){L.exports=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215]},{}],2:[function(d,g){function N(e){this._pointer=0,this._data=e,this._eof=!1}function v(Y,o){return 9>=Y?o:Y>=10&&59>=Y?parseFloat(o):Y>=60&&99>=Y?parseInt(o):Y>=100&&109>=Y?o:Y>=110&&149>=Y?parseFloat(o):Y>=160&&179>=Y?parseInt(o):Y>=210&&239>=Y?parseFloat(o):Y>=270&&289>=Y?parseInt(o):Y>=290&&299>=Y?H(o):Y>=300&&369>=Y?o:Y>=370&&389>=Y?parseInt(o):Y>=390&&399>=Y?o:Y>=400&&409>=Y?parseInt(o):Y>=410&&419>=Y?o:Y>=420&&429>=Y?parseInt(o):Y>=430&&439>=Y?o:Y>=440&&459>=Y?parseInt(o):Y>=460&&469>=Y?parseFloat(o):Y>=470&&481>=Y?o:999===Y?o:Y>=1e3&&1009>=Y?o:Y>=1010&&1059>=Y?parseFloat(o):Y>=1060&&1071>=Y?parseInt(o):(console.log("WARNING: Group code does not have a defined type: %j",{code:Y,value:o}),o)}function H(Q){if("0"===Q)return!1;if("1"===Q)return!0;throw TypeError("String '"+Q+"' cannot be cast to Boolean type")}N.prototype.next=function(){var p;if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);return p={code:parseInt(this._data[this._pointer])},this._pointer++,p.value=v(p.code,this._data[this._pointer].trim()),this._pointer++,0===p.code&&"EOF"===p.value&&(this._eof=!0),p},N.prototype.hasNext=function(){return this._eof?!1:this._pointer>this._data.length-2?!1:!0},N.prototype.isEOF=function(){return this._eof},g.exports=N},{}],3:[function(Y,X){function E(){}function H(m){v.debug("unhandled group "+O(m))}function O(g){return g.code+":"+g.value}function t(H){return e[H]}var b=Y("./DxfArrayScanner.js"),e=Y("./AutoCadColorIndex"),v=Y("loglevel");v.setLevel("error"),E.prototype.parse=function(){throw new Error("read() not implemented. Use readSync()")},E.prototype.parseSync=function(J){return"string"==typeof J?this._parse(J):(console.error("Cannot read dxf source of type `"+typeof J),null)},E.prototype.parseStream=function(T,i){function L(D){F+=D}function I(){try{var B=M._parse(F)}catch(D){return i(D)}i(null,B)}function X(f){i(f)}var F="",M=this;T.on("data",L),T.on("end",I),T.on("error",X)},E.prototype._parse=function(o){var g,I,e={},h=0,q=o.split(/\r\n|\r|\n/g);if(g=new b(q),!g.hasNext())throw Error("Empty file");var _=function(){for(I=g.next();!g.isEOF();)if(0===I.code&&"SECTION"===I.value){if(I=g.next(),2!==I.code){console.error("Unexpected code %s after 0:SECTION",O(I)),I=g.next();continue}"HEADER"===I.value?(v.debug("> HEADER"),e.header=J(),v.debug("<")):"BLOCKS"===I.value?(v.debug("> BLOCKS"),e.blocks=W(),v.debug("<")):"ENTITIES"===I.value?(v.debug("> ENTITIES"),e.entities=x(!1),v.debug("<")):"TABLES"===I.value?(v.debug("> TABLES"),e.tables=i(),v.debug("<")):"EOF"===I.value?v.debug("EOF"):v.warn("Skipping section '%s'",I.value)}else I=g.next()},r=function(R,Y){return I.code===R&&I.value===Y},J=function(){var s=null,C=null,S={};for(I=g.next();;){if(r(0,"ENDSEC")){s&&(S[s]=C);break}9===I.code?(s&&(S[s]=C),s=I.value):10===I.code?C={x:I.value}:20===I.code?C.y=I.value:30===I.code?C.z=I.value:C=I.value,I=g.next()}return I=g.next(),S},W=function(){var X,J={};for(I=g.next();"EOF"!==I.value&&!r(0,"ENDSEC");)r(0,"BLOCK")?(v.debug("block {"),X=d(),v.debug("}"),V(X),X.name?J[X.name]=X:v.error('block with handle "'+X.handle+'" is missing a name.')):(H(I),I=g.next());return J},d=function(){var w={};for(I=g.next();"EOF"!==I.value;){switch(I.code){case 1:w.xrefPath=I.value,I=g.next();break;case 2:w.name=I.value,I=g.next();break;case 3:w.name2=I.value,I=g.next();break;case 5:w.handle=I.value,I=g.next();break;case 8:w.layer=I.value,I=g.next();break;case 10:w.position=Z();break;case 67:w.paperSpace=I.value&&1==I.value?!0:!1,I=g.next();break;case 70:0!=I.value&&(w.type=I.value),I=g.next();break;case 100:I=g.next();break;case 330:w.ownerHandle=I.value,I=g.next();break;case 0:if("ENDBLK"==I.value)break;g._pointer-=2,w.entities=x(!0);break;default:H(I),I=g.next()}if(r(0,"ENDBLK")){I=g.next();break}}return w},i=function(){var u={};for(I=g.next();"EOF"!==I.value&&!r(0,"ENDSEC");)if(r(0,"TABLE")){I=g.next();var t=k[I.value];t?(v.debug(I.value+" Table {"),u[k[I.value].tableName]=K(),v.debug("}")):v.debug("Unhandled Table "+I.value)}else I=g.next();return I=g.next(),u},G="ENDTAB",K=function(){var j,b=k[I.value],l={},F=0;for(I=g.next();!r(0,G);)switch(I.code){case 5:l.handle=I.value,I=g.next();break;case 330:l.ownerHandle=I.value,I=g.next();break;case 100:"AcDbSymbolTable"===I.value?I=g.next():(H(I),I=g.next());break;case 70:F=I.value,I=g.next();break;case 0:I.value===b.dxfSymbolName?l[b.tableRecordsProperty]=b.parseTableRecords():(H(I),I=g.next());break;default:H(I),I=g.next()}var c=l[b.tableRecordsProperty];return c&&(c.constructor===Array?j=c.length:"object"==typeof c&&(j=z.keys(c).length),F!==j&&v.warn("Parsed "+j+" "+b.dxfSymbolName+"'s but expected "+F)),I=g.next(),l},L=function(){var P=[],m={};for(v.debug("ViewPort {"),I=g.next();!r(0,G);)switch(I.code){case 2:m.name=I.value,I=g.next();break;case 10:m.lowerLeftCorner=Z();break;case 11:m.upperRightCorner=Z();break;case 12:m.center=Z();break;case 13:m.snapBasePoint=Z();break;case 14:m.snapSpacing=Z();break;case 15:m.gridSpacing=Z();break;case 16:m.viewDirectionFromTarget=Z();break;case 17:m.viewTarget=Z();break;case 40:m.viewHeight=I.value,m.aspectRatio!==c&&(m.viewWidth=I.value*m.aspectRatio),I=g.next();break;case 41:m.aspectRatio=I.value,m.viewHeight!==c&&(m.viewWidth=I.value*m.viewHeight),I=g.next();break;case 42:m.lensLength=I.value,I=g.next();break;case 43:m.frontClippingPlane=I.value,I=g.next();break;case 44:m.backClippingPlane=I.value,I=g.next();break;case 45:m.viewHeight=I.value,I=g.next();break;case 50:m.snapRotationAngle=I.value,I=g.next();break;case 51:m.viewTwistAngle=I.value,I=g.next();break;case 79:m.orthographicType=I.value,I=g.next();break;case 110:m.ucsOrigin=Z();break;case 111:m.ucsXAxis=Z();break;case 112:m.ucsYAxis=Z();break;case 110:m.ucsOrigin=Z();break;case 281:m.renderMode=I.value,I=g.next();break;case 281:m.defaultLightingType=I.value,I=g.next();break;case 292:m.defaultLightingOn=I.value,I=g.next();break;case 330:m.ownerHandle=I.value,I=g.next();break;case 63:case 421:case 431:m.ambientColor=I.value,I=g.next();break;case 0:"VPORT"===I.value&&(v.debug("}"),P.push(m),v.debug("ViewPort {"),m={},I=g.next());break;default:H(I),I=g.next()}return v.debug("}"),P.push(m),P},F=function(){var w,s,Q={},L={};for(v.debug("LType {"),I=g.next();!r(0,"ENDTAB");)switch(I.code){case 2:L.name=I.value,w=I.value,I=g.next();break;case 3:L.description=I.value,I=g.next();break;case 73:s=I.value,s>0&&(L.pattern=[]),I=g.next();break;case 40:L.patternLength=I.value,I=g.next();break;case 49:L.pattern.push(I.value),I=g.next();break;case 0:v.debug("}"),s>0&&s!==L.pattern.length&&v.warn("lengths do not match on LTYPE pattern"),Q[w]=L,L={},v.debug("LType {"),I=g.next();break;default:I=g.next()}return v.debug("}"),Q[w]=L,Q},Q=function(){var G,Z={},f={};for(v.debug("Layer {"),I=g.next();!r(0,"ENDTAB");)switch(I.code){case 2:f.name=I.value,G=I.value,I=g.next();break;case 62:f.visible=I.value>0,f.color=t(Math.abs(I.value)),I=g.next();break;case 6:f.lineType=I.value,I=g.next();break;case 0:"LAYER"===I.value&&(v.debug("}"),Z[G]=f,v.debug("Layer {"),f={},G=c,I=g.next());break;default:H(I),I=g.next()}return v.debug("}"),Z[G]=f,Z},k={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:L},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:F},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:Q}},x=function(K){var e=[],b=K?"ENDBLK":"ENDSEC";for(I=g.next();;)if(0===I.code){if(I.value===b)break;var L;if("LWPOLYLINE"===I.value)v.debug("LWPOLYLINE {"),L=j(),v.debug("}");else if("POLYLINE"===I.value)v.debug("POLYLINE {"),L=f(),v.debug("}");else if("LINE"===I.value)v.debug("LINE {"),L=A(),v.debug("}");else if("CIRCLE"===I.value)v.debug("CIRCLE {"),L=$(),v.debug("}");else if("ARC"===I.value)v.debug("ARC {"),L=$(),v.debug("}");else if("ELLIPSE"===I.value)v.debug("ELLIPSE {"),L=D(),v.debug("}");else if("SPLINE"===I.value)v.debug("SPLINE {"),L=C(),v.debug("}");else if("TEXT"===I.value)v.debug("TEXT {"),L=M(),v.debug("}");else if("DIMENSION"===I.value)v.debug("DIMENSION {"),L=U(),v.debug("}");else if("INSERT"===I.value)v.debug("INSERT {"),L=m(),v.debug("}");else if("HATCH"===I.value)v.debug("HATCH {"),L=l(),v.debug("}");else if("SOLID"===I.value)v.debug("SOLID {"),L=P(),v.debug("}");else if("POINT"===I.value)v.debug("POINT {"),L=s(),v.debug("}");else if("MTEXT"===I.value)v.debug("MTEXT {"),L=X(),v.debug("}");else{if("ATTDEF"!==I.value){v.warn("Unhandled entity "+I.value),I=g.next();continue}v.debug("ATTDEF {"),L=T(),v.debug("}")}V(L),e.push(L)}else I=g.next();return"ENDSEC"==b&&(I=g.next()),e},n=function(Y){switch(I.code){case 0:Y.type=I.value,I=g.next();break;case 5:Y.handle=I.value,I=g.next();break;case 6:Y.lineType=I.value,I=g.next();break;case 8:Y.layer=I.value,I=g.next();break;case 48:Y.lineTypeScale=I.value,I=g.next();break;case 60:Y.visible=0===I.value,I=g.next();break;case 62:Y.colorIndex=I.value,Y.color=t(Math.abs(I.value)),I=g.next();break;case 67:Y.inPaperSpace=0!==I.value,I=g.next();break;case 210:Y.extrusionDirection=Z();break;case 330:Y.ownerHandle=I.value,I=g.next();break;case 347:Y.materialObjectHandle=I.value,I=g.next();break;case 370:Y.lineweight=I.value,I=g.next();break;case 420:Y.color=I.value,I=g.next();break;case 100:if("AcDbEntity"==I.value){I=g.next();break}default:H(I),I=g.next()}},p=function(){var T={type:I.value};for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:T.x=I.value,I=g.next();break;case 20:T.y=I.value,I=g.next();break;case 30:T.z=I.value,I=g.next();break;case 40:case 41:case 42:I=g.next();break;case 70:T.curveFittingVertex=0!==(1|I.value),T.curveFitTangent=0!==(2|I.value),T.splineVertex=0!==(8|I.value),T.splineControlPoint=0!==(16|I.value),T.ThreeDPolylineVertex=0!==(32|I.value),T.ThreeDPolylineMesh=0!==(64|I.value),T.polyfaceMeshVertex=0!==(128|I.value),I=g.next();break;case 50:case 71:case 72:case 73:case 74:I=g.next();break;default:n(T)}return T},B=function(){var J={type:I.value};for(I=g.next();"EOF"!=I&&0!=I.code;)n(J);return J},Z=function(){var a={},$=I.code;if(a.x=I.value,$+=10,I=g.next(),I.code!=$)throw new Error("Expected code for point value to be "+$+" but got "+I.code+".");return a.y=I.value,$+=10,I=g.next(),I.code!=$?a:(a.z=I.value,I=g.next(),a)},S=function(){var O={},H=I.code;return O.x=I.value,H+=1,I=g.next(),I.code!=H?(g._pointer-=2,O.y=1):O.y=I.value,H+=1,I=g.next(),I.code!=H?(g._pointer-=2,O):(O.z=I.value,I=g.next(),O)},E=function(F){if(!F||0>=F)throw Error("n must be greater than 0 verticies");var D,l=[],Y=!1,k=!1;for(D=0;F>D;D++){for(var X={};"EOF"!==I&&0!==I.code&&!k;){switch(I.code){case 10:if(Y){k=!0;continue}X.x=I.value,Y=!0;break;case 20:X.y=I.value;break;case 30:X.z=I.value;break;case 40:X.startWidth=I.value;break;case 41:X.endWidth=I.value;break;case 42:0!=I.value&&(X.bulge=I.value);break;default:I=g.next();continue}I=g.next()}l.push(X),Y=!1,k=!1}return l},Y=function(){for(var l=[];"EOF"!==I;)if(0===I.code)if("VERTEX"===I.value)l.push(p());else if("SEQEND"===I.value){B();break}return l},X=function(){var q={type:I.value};for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 1:q.text=I.value,I=g.next();break;case 3:q.text+=I.value,I=g.next();break;case 10:q.position=Z();break;case 40:q.height=I.value,I=g.next();break;case 41:q.width=I.value,I=g.next();break;case 71:q.attachmentPoint=I.value,I=g.next();break;case 72:q.drawingDirection=I.value,I=g.next();break;case 50:q.angle=2*I.value*Math.PI/360,I=g.next();break;case 11:q.directionX=I.value,I=g.next();break;case 21:q.directionY=I.value,I=g.next();break;default:n(q)}return q},T=function(){var t={type:I.value,scale:1,textStyle:"STANDARD"};for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 1:t.text=I.value,I=g.next();break;case 2:t.tag=I.value,I=g.next();break;case 3:t.prompt=I.value,I=g.next();break;case 7:t.textStyle=I.value,I=g.next();break;case 10:t.x=I.value,I=g.next();break;case 20:t.y=I.value,I=g.next();break;case 30:t.z=I.value,I=g.next();break;case 39:t.thickness=I.value,I=g.next();break;case 40:t.textHeight=I.value,I=g.next();break;case 41:t.scale=I.value,I=g.next();break;case 50:t.rotation=I.value,I=g.next();break;case 51:t.obliqueAngle=I.value,I=g.next();break;case 70:t.invisible=!!(1&I.value),t.constant=!!(2&I.value),t.verificationRequired=!!(4&I.value),t.preset=!!(8&I.value),I=g.next();break;case 71:t.backwards=!!(2&I.value),t.mirrored=!!(4&I.value),I=g.next();break;case 72:t.horizontalJustification=I.value,I=g.next();break;case 73:t.fieldLength=I.value,I=g.next();break;case 74:t.verticalJustification=I.value,I=g.next();break;case 100:I=g.next();break;case 210:t.extrusionDirectionX=I.value,I=g.next();break;case 220:t.extrusionDirectionY=I.value,I=g.next();break;case 230:t.extrusionDirectionZ=I.value,I=g.next();break;default:n(t)}return t},j=function(){var h={type:I.value,vertices:[]},L=0;for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 38:h.elevation=I.value,I=g.next();break;case 39:h.depth=I.value,I=g.next();break;case 70:h.shape=1===I.value,I=g.next();break;case 90:L=I.value,I=g.next();break;case 10:h.vertices=E(L);break;case 43:0!==I.value&&(h.width=I.value),I=g.next();break;default:n(h)}return h},f=function(){var s={type:I.value,vertices:[]};for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:case 20:case 30:case 39:case 40:case 41:I=g.next();break;case 70:s.shape=0!==(1|I.value),I=g.next();break;case 71:case 72:case 73:case 74:case 75:I=g.next();break;case 210:v.debug(I.value),I=g.next();break;case 220:case 230:I=g.next();break;case 100:I=g.next();break;default:n(s)}return s.vertices=Y(),s},A=function(){var V={type:I.value,vertices:[]};for(I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:V.vertices.unshift(Z());break;case 11:V.vertices.push(Z());break;case 100:if("AcDbLine"==I.value){I=g.next();break}default:n(V)}return V},$=function(){var x,l;for(x={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:x.center=Z();break;case 40:x.radius=I.value,I=g.next();break;case 50:x.startAngle=Math.PI/180*I.value,I=g.next();break;case 51:l=Math.PI/180*I.value,x.angleLength=l<x.startAngle?l+2*Math.PI-x.startAngle:l-x.startAngle,x.endAngle=l,I=g.next();break;default:n(x)}return x},D=function(){var A,t;for(A={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:A.center=Z();break;case 11:A.major=Z();break;case 40:A.ratio=I.value,I=g.next();break;case 41:A.startAngle=I.value,I=g.next();break;case 42:t=I.value,A.angleLength=t<A.startAngle?t+2*Math.PI-A.startAngle:t-A.startAngle,A.endAngle=t,I=g.next();break;default:n(A)}return A},m=function(){var J;for(J={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 2:J.block=I.value,I=g.next();break;case 10:J.center=Z();break;case 41:J.scale=S();break;case 50:J.deg=I.value,I=g.next();break;default:n(J)}return J},l=function(){var m;for(m={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 2:m.block=I.value,I=g.next();break;case 10:m.center=Z();break;case 41:m.scale=S();break;case 50:m.deg=I.value,I=g.next();break;default:n(m)}return m},C=function(){var s,d;for(s={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:s.center=Z();break;case 11:s.major=Z();break;case 40:s.ratio=I.value,I=g.next();break;case 41:s.startAngle=I.value,I=g.next();break;case 42:d=I.value,s.angleLength=d<s.startAngle?d+2*Math.PI-s.startAngle:d-s.startAngle,s.endAngle=d,I=g.next();break;default:n(s)}return s},M=function(){var U;for(U={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:U.startPoint=Z();break;case 11:U.endPoint=Z();break;case 40:U.textHeight=I.value,I=g.next();break;case 41:U.xScale=I.value,I=g.next();break;case 1:U.text=I.value,I=g.next();break;case 71:U.generationFlags=I.value,I=g.next();break;case 72:U.halign=I.value,I=g.next();break;case 73:U.valign=I.value,I=g.next();break;case 50:U.rotation=2*I.value*Math.PI/360,I=g.next();break;default:n(U)}return U},U=function(){var G;for(G={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 2:G.block=I.value,I=g.next();break;case 10:G.anchorPoint=Z();break;case 11:G.middleOfText=Z();break;case 71:G.attachmentPoint=I.value,I=g.next();break;case 42:G.actualMeasurement=I.value,I=g.next();break;case 1:G.text=I.value,I=g.next();break;case 50:G.angle=I.value,I=g.next();break;default:n(G)}return G},P=function(){var N;for(N={type:I.value},N.points=[],I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:N.points[0]=Z();break;case 11:N.points[1]=Z();break;case 12:N.points[2]=Z();break;case 13:N.points[3]=Z();break;default:n(N)}return N},s=function(){var C;for(C={type:I.value},I=g.next();"EOF"!==I&&0!==I.code;)switch(I.code){case 10:C.position=Z();break;case 39:C.thickness=I.value,I=g.next();break;case 100:if("AcDbPoint"==I.value){I=g.next();break}default:n(C)}return C},V=function(c){if(!c)throw new TypeError("entity cannot be undefined or null");c.handle||(c.handle=h++)};return _(),e},X.exports=E},{"./AutoCadColorIndex":1,"./DxfArrayScanner.js":2,loglevel:4}],4:[function(N,P){!function(W,i){"object"==typeof P&&P.exports&&"function"==typeof N?P.exports=i():"function"==typeof V&&"object"==typeof V.amd?V(i):W.log=i()}(this,function(){function k(X){return typeof console===n?!1:console[X]!==c?b(console,X):console.log!==c?b(console,"log"):i}function b(e,b){var O=e[b];if("function"==typeof O.bind)return O.bind(e);try{return Function.prototype.bind.call(O,e)}catch(u){return function(){return Function.prototype.apply.apply(O,[e,arguments])}}}function N(w,o){return function(){typeof console!==n&&(K(o),t[w].apply(t,arguments))}}function K(e){for(var V=0;V<Q.length;V++){var G=Q[V];t[G]=e>V?i:t.methodFactory(G,e)}}function S(y){var f=(Q[y]||"silent").toUpperCase();try{return w.localStorage.loglevel=f,void 0}catch(Y){}try{w.document.cookie="loglevel="+f+";"}catch(Y){}}function O(){var R;try{R=w.localStorage.loglevel}catch(O){}if(typeof R===n)try{R=/loglevel=([^;]+)/.exec(w.document.cookie)[1]}catch(O){}t.levels[R]===c&&(R="WARN"),t.setLevel(t.levels[R],!1)}var t={},i=function(){},n="undefined",Q=["trace","debug","info","warn","error"];t.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},t.methodFactory=function(M,b){return k(M)||N(M,b)},t.setLevel=function(z,g){if("string"==typeof z&&t.levels[z.toUpperCase()]!==c&&(z=t.levels[z.toUpperCase()]),!("number"==typeof z&&z>=0&&z<=t.levels.SILENT))throw"log.setLevel() called with invalid level: "+z;return g!==!1&&S(z),K(z),typeof console===n&&z<t.levels.SILENT?"No console available for logging":void 0},t.enableAll=function(d){t.setLevel(t.levels.TRACE,d)},t.disableAll=function(E){t.setLevel(t.levels.SILENT,E)};var s=typeof w!==n?w.log:c;return t.noConflict=function(){return typeof w!==n&&w.log===t&&(w.log=s),t},O(),t})},{}]},{},[3])(3)});var r=A.DxfViewer=function(h,l){var Y=this;Y._gv=h,Y.$17w={},Y.$16w(l)};r.prototype={},r.prototype.constructor=r;var J={LINE:["LINE","POLYLINE","LWPOLYLINE"],CIRCLE:["CIRCLE","ARC"],ELLIPSE:["ELLIPSE"],TEXT:["TEXT","MTEXT"],SOLID:["SOLID"],POINT:["POINT"]};z.defineProperties(r.prototype,{gv:{get:function(){return this._gv}},dxf:{get:function(){return this._dxf}},forceUpdate:{get:function(){return this.$1ew},set:function(r){var l=this;l.$1ew=r,l.$18w&&(clearTimeout(l.$18w),l.$18w=c),r&&l.gv&&l.gv.redraw()}},viewport:{get:function(){var L=this;if(L._dxf){var Z=L.options;return{x:Z.x===c?L.$19w.x:Z.x,y:Z.y===c?L.$19w.y:Z.y}}},set:function(d){var Q=this;Q.options.x=d.x||0,Q.options.y=d.y||0,Q.forceUpdate=!0}},zoom:{get:function(){var e=this;return e._gv?e._gv.getZoom():e.options.zoom},set:function(P){var t=this;t._gv?t._gv.setZoom(P):t.options.zoom=P}}}),r.prototype.$16w=function(h){var Q=this,i=Q.options={};h=h||{},i.zoom=h.zoom||1,h.zoom&&Q._gv&&h.zoom!==Q._gv.getZoom()&&Q._gv.setZoom(i.zoom),i.baseCacheUpdateInterval=h.baseCacheUpdateInterval||0,i.extraCacheUpdateInterval=h.extraCacheUpdateInterval||500,i.lineWidth=h.lineWidth||1,i.linesBatchSize=h.linesBatchSize||1e5,i.font=h.font||"Courier",i.pointCircleSize=h.pointCircleSize||5,i.pointCenterSize=h.pointCenterSize||2,i.textMinFontSize=h.textMinFontSize||3,i.textScaleRatio=h.textScaleRatio||1},r.prototype.draw=function(c){var z=this;z._dxf&&z.$5w()&&(z._now=Date.now(),z._resolution=w.devicePixelRatio,z.$64w(),z.$6w(),z.$13w(c),z.$1ew=!1)},r.prototype.$64w=function(){var $=this,u=$.gv,b=u.getZoom(),D=u.tx(),l=u.ty(),Z=$.$17w,S=$.options.extraCacheUpdateInterval;b!==Z.zoom||D!==Z.tx||l!==Z.ty?(Z.zoom=b,Z.tx=D,Z.ty=l,Z.dirty=!0,Z.dirtyTime=$._now,$.$18w&&clearTimeout($.$18w),0===S?$.forceUpdate=!0:$.$18w=setTimeout(function(){$.forceUpdate=!0},$.options.extraCacheUpdateInterval)):Z.dirty=!1},r.prototype.$13w=function(b){var s=this;s.options,s.$17w;var x;x=s.$1aw;var K=x.zoom;b.drawImage(s.$15w,-x.tx/K,-x.ty/K,x.width/K,x.height/K),s.$18w||(x=s.$1fw,b.drawImage(s.$1cw,-x.tx/K,-x.ty/K,x.width/K,x.height/K))},r.prototype.$12w=function(o){var y,U,n,g,N,q,Q,P,G,r,s,e,M,t,O,X,j,p,i=this,A=i._models;for(o.lineWidth=i.options.lineWidth,e=i.options.linesBatchSize,y=J.LINE,g=0,N=y.length;N>g;g++){U=y[g],n=A[U];for(P in n){for(o.strokeStyle=P,G=n[P],o.beginPath(),s=0,q=0,Q=G.length;Q>q;q++)if(r=G[q],(s++>=e||r.width)&&(o.stroke(),o.beginPath(),s=0),M=r.vertices,M&&M.length){for(j=i.$3w(M[0].x,1),p=i.$3w(M[0].y,2),o.moveTo(j,p),O=1,X=M.length;X>O;O++)t=M[O],o.lineTo(i.$3w(t.x,1),i.$3w(t.y,2));r.shape&&o.lineTo(j,p),r.width&&(o.lineWidth=Math.max(1,i.$3w(r.width)),o.stroke(),o.beginPath(),o.lineWidth=1)}o.stroke()}}},r.prototype.$11w=function(o){var f,x,u,a,I,X,p,C,b,F,g,s,d,G=this,D=G._models;for(o.lineWidth=G.options.lineWidth,s=G.options.linesBatchSize,f=J.SOLID,a=0,I=f.length;I>a;a++){x=f[a],u=D[x];for(C in u){for(o.fillStyle=C,b=u[C],o.beginPath(),g=0,X=0,p=b.length;p>X;X++)F=b[X],g++>=s&&(o.fill(),o.beginPath(),g=0),d=F.points,o.moveTo(G.$3w(d[0].x,1),G.$3w(d[0].y,2)),o.lineTo(G.$3w(d[1].x,1),G.$3w(d[1].y,2)),o.lineTo(G.$3w(d[3].x,1),G.$3w(d[3].y,2)),o.lineTo(G.$3w(d[2].x,1),G.$3w(d[2].y,2)),o.lineTo(G.$3w(d[0].x,1),G.$3w(d[0].y,2));o.fill()}}},r.prototype.$10w=function(I){var X,C,S,g,u,H,j,U,P,q,V,c,G,M,Z=this,F=Z._models;for(I.lineWidth=Z.options.lineWidth,X=J.POINT,G=Z.$3w(Z.options.pointCircleSize),M=Z.$3w(Z.options.pointCenterSize),g=0,u=X.length;u>g;g++){C=X[g],S=F[C];for(U in S)for(I.strokeStyle=U,I.fillStyle=U,P=S[U],H=0,j=P.length;j>H;H++)q=P[H],V=Z.$3w(q.position.x,1),c=Z.$3w(q.position.y,2),I.fillRect(V,c,M,M),I.beginPath(),I.arc(V,c,G,0,2*Math.PI,!0),I.stroke()}},r.prototype.$9w=function(f){var e,k,o,w,$,s,G,y,B,q,r,R,m,C,j,h,v,E,p,z,t=this,g=t._models;for(f.lineWidth=t.options.lineWidth,e=J.CIRCLE,w=0,$=e.length;$>w;w++){k=e[w],o=g[k];for(y in o)for(f.strokeStyle=y,B=o[y],s=0,G=B.length;G>s;s++)q=B[s],f.beginPath(),r=q.startAngle||0,R=q.angleLength||2*Math.PI,m=r+R,C=q.radius,j=q.addonAngle||0,h=t.$3w(q.center.x,1),v=t.$3w(q.center.y,2),z=q.xInvert^(q.extrusionDirection&&-1===q.extrusionDirection.z),p=q.yInvert,p||z?z&&p?(r=Math.PI+r,m=Math.PI+m,E=!1):(r=Math.PI*(z?1:2)-r,m=Math.PI*(z?1:2)-m,E=!0):E=!1,f.arc(h,v,t.$3w(C),r+j,m+j,E),f.stroke()}},r.prototype.$8w=function($){var c,N,u,d,l,P,B,s,H,v,x,f,i,A,z,g,C,p,Q,b,r,L,j,T,k,t=this,D=t._models;for(c=J.TEXT,z=t.options.font,j=t.options.textScaleRatio,T=t.options.textMinFontSize,d=0,l=c.length;l>d;d++){N=c[d],u=D[N];for(s in u)for($.fillStyle=s,H=u[s],P=0,B=H.length;B>P;P++)if(v=H[P],x=v.text,"MTEXT"===N?(f=t.$3w(v.height||12),i=t.$3w(v.position.x,1),A=t.$3w(v.position.y,2),Q=v.angle?v.angle:v.directionX?Math.atan2(v.directionY,v.directionX):0,Q+=v.addonAngle||0,L=1,p=v.attachmentPoint||1,g=p%3,C=Math.floor(p/3)):(f=t.$3w(v.textHeight||12),i=v.startPoint.x,A=v.startPoint.y,Q=v.rotation||0,L=v.xScale||1,2===v.generationFlags?Q=2*Math.PI-Q:4===v.generationFlags?Q=Math.PI-Q:6===v.generationFlags&&(Q=Math.PI+Q),i=t.$3w(i,1),A=t.$3w(A,2),g=(v.halign||0)+1,3===v.valign?C=0:2===v.valign?(C=1,v.endPoint&&(i=(i+t.$3w(v.endPoint.x,1))/2)):C=2),!(T>f)){if(t._isAc2015&&(A-=f),$.save(),$.translate(i,A),$.rotate(Q),$.scale(L,-1),"MTEXT"===N&&(1===C?$.translate(0,f/2):0===C&&$.translate(0,f)),$.textAlign=0===g?"right":2===g?"center":"left",$.font=f*j+"px "+z,"MTEXT"===N)for(x=x.replace(/\\{/g,"#@#"),x=x.replace(/\\}/g,"#@@"),x=x.replace(/({|})/g,""),x=x.replace(/#@#/g,"{"),x=x.replace(/#@@/g,"}"),x=x.replace(/\\[ACT]\d+;/g,""),(k=x.match(/\\f[^;]*;/))&&(x=x.replace(k[0],""),k=k[0].match(/\|p(\d+)/),k&&($.font=k[0]/10*f*j+"px "+z)),b=x.split("\\P"),r=0;r<b.length;r++)$.fillText(b[r],0,1.2*r*f);else $.fillText(x,0,0);$.restore()}}},r.prototype.$7w=function(c){var T,D,u,B,w,H,Z,O,m,l,$,p,f,W,r,x,G,Y,n,d,E,h=this,A=h._models;for(T=J.ELLIPSE,B=0,w=T.length;w>B;B++){D=T[B],u=A[D];for(O in u)for(c.strokeStyle=O,m=u[O],H=0,Z=m.length;Z>H;H++)l=m[H],$=l.major,p=Math.atan2($.y,$.x),f=Math.sqrt($.x*$.x+$.y*$.y),W=l.startAngle||0,r=l.angleLength||2*Math.PI,x=W+r,G=h.$3w(l.center.x,1),Y=h.$3w(l.center.y,2),n=l.xInvert,d=l.yInvert^(l.extrusionDirection&&-1===l.extrusionDirection.z),d||n?n&&d?(W=Math.PI+W,x=Math.PI+x,E=!1):(W=Math.PI*(n?1:2)-W,x=Math.PI*(n?1:2)-x,E=!0):E=!1,c.lineWidth=h.options.lineWidth,c.save(),c.translate(G,Y),c.scale(l.ratio,1),c.rotate(p),c.beginPath(),c.arc(0,0,h.$3w(f),W,x,E),c.strokeStyle=O,c.restore(),c.stroke()}},r.prototype.$6w=function(){var B,n,s,k,U,E,M,T,y=this,t=y.$17w,C=y._resolution;if(E=y.viewport,M=-E.x,T=-E.y,y._shiftX=y.viewport.x,y._shiftY=y.viewport.y,y._zoom=t.zoom,y.forceUpdate||y._now-(y._baseCacheUpdateTime||0)>y.options.baseCacheUpdateInterval){var V=y.$1bw,e=y.$15w;k=e.width,U=e.height,V.clearRect(0,0,k,U),y.$1aw={tx:B=t.tx,ty:n=t.ty,zoom:s=t.zoom,width:k/C,height:U/C},V.save(),V.setTransform(C,0,0,-C,C*B,C*n),y.$12w(V),y._baseCacheUpdateTime=y._now,V.restore()}if(y.forceUpdate){var v=y.$1dw,p=y.$1cw;k=p.width,U=p.height,v.clearRect(0,0,k,U),y.$1fw={tx:B=t.tx,ty:n=t.ty,zoom:s=t.zoom,width:k/C,height:U/C},v.save(),v.setTransform(C,0,0,-C,C*B,C*n),y.$10w(v),y.$9w(v),y.$11w(v),y.$7w(v),y.$8w(v),v.restore()}},r.prototype.$5w=function(){var p=this,V=p._gv.getCanvas();if(!V)return!1;var f,H=p.$15w;return H?f=p.$1cw:(H=p.$15w=document.createElement("canvas"),p.$1bw=H.getContext("2d"),f=p.$1cw=document.createElement("canvas"),p.$1dw=f.getContext("2d")),(H.style.width!==V.style.width||H.style.height!==V.style.height||H.width!==V.width||H.height!==V.height)&&(H.style.width=f.style.width=V.style.width,H.style.height=f.style.height=V.style.height,H.width=f.width=V.width,H.height=f.height=V.height,p.$1ew=!0),!0},r.prototype.$4w=function(h,U,n,H){var o=this,F=o.$2w(U,n);if(F){var E,A,S,e=U.type;if("DIMENSION"!==e&&"INSERT"!==e){(E=h[e])||(E=h[e]={}),(A=E[F])||(A=E[F]=[]);var X=U.extrusionDirection&&-1===U.extrusionDirection.z&&["POINT","LINE","POLYLINE","LWPOLYLINE","ELLIPSE"].indexOf(e)<0;if(H||X){H||(H={a:1,b:0,c:0,d:1,tx:0,ty:0});var c={};for(var Y in U)c[Y]=U[Y];c.radius&&(c.radius*=Math.sqrt(H.a*H.a+H.b*H.b)),c.textHeight&&(c.textHeight*=Math.sqrt(H.a*H.a+H.b*H.b));var y=X?-1:1,l=function(d,P){if(d){var z=d.x,E=d.y;return{x:z*y*P.a+E*P.c+P.tx,y:z*y*P.b+E*P.d+P.ty}}};if(c.position=l(c.position,H),c.startPoint=l(c.startPoint,H),c.center=l(c.center,H),"ELLIPSE"===e){var I;I=l({x:U.major.x+U.center.x,y:U.major.y+U.center.y},H),c.major={x:I.x-c.center.x,y:I.y-c.center.y},U.extrusionDirection&&-1===U.extrusionDirection.z&&(c.major.x*=-1)}var g;c.vertices&&(g=[],c.vertices.forEach(function(C){g.push(l(C,H))}),c.vertices=g),c.points&&(g=[],c.points.forEach(function(f){g.push(l(f,H))}),c.points=g);var R=Math.atan2(H.b,H.a),i=Math.cos(R);c.yInvert=H.d*i<0,c.xInvert=H.a*i<0,0!==R&&(c.addonAngle=R),A.push(c)}else A.push(U)}else{if(!U.block)return;var f=n.blocks[U.block];if(!f||!f.entities)return;var C=H;if("INSERT"===e){var V=U.scale?U.scale.x:1,Q=U.scale?U.scale.y:1,G=0,L=1,b=0;if(U.deg&&(G=U.deg*Math.PI/180,L=Math.cos(G),b=Math.sin(G)),H){var j=V*L,B=V*b,$=-Q*b,x=Q*L,K=U.center.x,a=U.center.y;C={a:H.a*j+H.c*B,b:H.b*j+H.d*B,c:H.a*$+H.c*x,d:H.b*$+H.d*x,tx:H.a*K+H.c*a+H.tx,ty:H.b*K+H.d*a+H.ty}}else C={a:V*L,b:V*b,c:-Q*b,d:Q*L,tx:U.center.x,ty:U.center.y}}for(S=0;S<f.entities.length;S++)o.$4w(h,f.entities[S],n,C)}}},r.prototype.parseFile=function(a){var E=this,M=new DxfParser,B=M.parseSync(a);E._dxf=B,E.$19w=E.$1w(B),E._isAc2015="AC1015"===B.header.$ACADVER;var O=E.gv?E.gv.getWidth():1e3,i=E.gv?E.gv.getZoom():1;E._dxfSelfZoom=O/E.$19w.width/i,E.$19w.x-=E.$19w.width/2,E.$19w.y+=E.$19w.height/2;var F,t,Y,I=E._models={};for(F=0,t=B.entities.length;t>F;F++)Y=B.entities[F],E.$4w(I,Y,B);console.log("parse finished"),E.forceUpdate=!0},r.prototype.$3w=function(E,F){var K=1===F?this._shiftX:2===F?this._shiftY:0,Y=this._zoom*this._dxfSelfZoom;return(E-K)*Y},r.prototype.$2w=function(i,D){var w;if(D.tables&&D.tables.layer&&(w=D.tables.layer.layers[i.layer]),!w||w.visible){var n;return i.color!==c?(n=i.color,0===n&&(n=16777215)):w&&(n=w.color),n||(n=16777215),"#"+((1<<24)+n).toString(16).slice(1)}},r.prototype.$1w=function(F){var d,g,q,J,x,e,D,s,o,m,w,W,S=0;
  2. if(!d&&F.tables&&F.tables.viewPort){m=F.tables.viewPort.viewPorts;for(o in m)if(w=m[o],W=w.viewDirectionFromTarget,w.center&&(w.renderMode===S||W&&0===W.x&&0===W.y&&1===W.z)){q=w.center,J=w.upperRightCorner,x=w.lowerLeftCorner,d={x:J.x,y:J.y},g={x:x.x,y:x.y},e=w.viewWidth||0,D=w.viewHeight||0,w.viewTarget&&(q={x:q.x+w.viewTarget.x,y:q.y+w.viewTarget.y});break}}return!d&&F.header&&(s=F.header,s.$EXTMIN&&s.$EXTMAX&&(d=s.$EXTMAX,g=s.$EXTMIN)),e=Math.max(e,d.x-g.x),D=Math.max(D,d.y-g.y),q=q||{x:e/2+g.x,y:D/2+g.y},{width:e,height:D,x:q.x,y:q.y}};var H=A.VirtualCanvas=function(k){this.view=k};H.prototype={},H.prototype.constructor=H,H.prototype.getCanvas=function(){return this.view._canvas},H.prototype.redraw=function(){var P=this.view;P.redraw(),P.validateImpl()},H.prototype.getView=function(){return this.view};var P=A.Context2dProxy=function(h,S){var v=this;v.ctx=h,v.writer=S,v._currentContext={a:1,b:0,c:0,d:1,tx:0,ty:0},v.$3fw(),v._contextStack=[],v._textScale=.8,v._forceSplitEllipse=!0,v._ellipseSegments=32,v._styleToColorCache={};for(var B in CanvasRenderingContext2D.prototype)if("webkitImageSmoothingEnabled"!==B){var m=h[B];if("function"==typeof m)v[B]=function(Z,B){return function(){var V=B.apply(h,arguments);return v.$20w(Z,arguments),V}}(B,m);else{var A=z.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,B);if(!A.get&&!A.set)continue;!function(n){z.defineProperty(v,n,{get:function(){return h[n]},set:function(f){h[n]=f,v.$21w(n,f)}})}(B)}}};P.prototype={},P.prototype.constructor=P,P.prototype.$20w=function(e,q){var T=this;switch(e){case"save":T.$22w();break;case"restore":T.$23w();break;case"translate":T.$24w.apply(T,q);break;case"rotate":T.$26w.apply(T,q);break;case"scale":T.$25w.apply(T,q);break;case"setTransform":T.$27w.apply(T,q);break;case"transform":T.$28w.apply(T,q);break;case"fillText":case"strokeText":T.$30w(q[0],q[1],q[2],"fillText"===e);break;case"rect":T.$31w.apply(T,q);break;case"fill":T.$32w();break;case"stroke":T.$3ew();break;case"moveTo":T.$34w(q[0],q[1]);break;case"lineTo":T.$35w(q[0],q[1]);break;case"beginPath":T.$39w();break;case"closePath":T.$3aw();break;case"arc":T.$36w.apply(T,q);break;case"ellipse":T.$37w.apply(T,q);break;case"quadraticCurveTo":T.$38w([{x:q[0],y:q[1]}],q[2],q[3]);break;case"bezierCurveTo":T.$38w([{x:q[0],y:q[1]},{x:q[2],y:q[3]}],q[4],q[5])}},P.prototype.$21w=function(){},P.prototype.$22w=function(){var f=this,R={},c=f._currentContext;for(var N in c)R[N]=c[N];f._contextStack.push(R)},P.prototype.$23w=function(){var D=this;D._currentContext=D._contextStack.pop(),D.$29w()},P.prototype.$24w=function(A,l){if(0!==A||0!==l){var J=this,j=J._currentContext,E=j.a,M=j.b,Z=j.c,b=j.d;j.tx=E*A+Z*l+j.tx,j.ty=M*A+b*l+j.ty,J.$29w()}},P.prototype.$25w=function(L,O){if(1!==L||1!==O){var J=this,T=J._currentContext;T.a*=L,T.b*=L,T.c*=O,T.d*=O,J.$29w()}},P.prototype.$26w=function(x){var b=Math.cos(x),Q=Math.sin(x),C=this,U=C._currentContext,D=U.a,V=U.b,$=U.c,f=U.d;U.a=D*b+$*Q,U.b=V*b+f*Q,U.c=-D*Q+$*b,U.d=-V*Q+f*b,C.$29w()},P.prototype.$27w=function(L,_,H,i,o,G){var M=this,m=M._currentContext;m.a=L,m.b=_,m.c=H,m.d=i,m.tx=o,m.ty=G,M.$29w()},P.prototype.$28w=function(J,i,n,c,$,e){var y=this,Z=y._currentContext,m=Z.a,d=Z.b,u=Z.c,x=Z.d;Z.a=m*J+u*i,Z.b=d*J+x*i,Z.c=m*n+u*c,Z.d=d*n+x*c,Z.tx=m*$+u*e+Z.tx,Z.ty=d*$+x*e+Z.ty,y.$29w()},P.prototype.$29w=function(){var l=this;l.writer.$40w(l._currentContext)},P.prototype.$2aw=function(){var A=this._currentContext;return 0===A.b&&0===A.c?0:Math.atan2(A.b,A.a)},P.prototype.$2bw=function(){var m=this._currentContext;return{x:Math.sqrt(m.a*m.a+m.c*m.c),y:Math.sqrt(m.b*m.b+m.d*m.d)}},P.prototype.$2cw=function(g){var k=this._currentContext,y=g.x,l=g.y;return{x:k.a*y+k.c*l+k.tx,y:k.b*y+k.d*l+k.ty}},P.prototype.$2dw=function(T){for(var R=this,K=new Array(T.length),m=0,u=T.length;u>m;m++)K[m]=R.$2cw(T[m]);return K},P.prototype.$2ew=function(z){var W=this._currentContext;return z*Math.sqrt(W.a*W.a+W.b*W.b)},P.prototype._equal=function(F,V){var l=F-V;return l>-1e-5&&1e-5>l},P.cadColorConst=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215],P.prototype.$2fw=function(O){var C=this,p=C._styleToColorCache[O];if(p!==c)return p;for(var J,b,Y,K="string"==typeof O?parseInt("0x"+O.slice(1)):7,k=P.cadColorConst,d=1e4,L=0,s=k.length;s>L;L++)J=k[L],b=Math.abs((J>>16)-(K>>16))+Math.abs((255&J>>8)-(255&K>>8))+Math.abs((255&J)-(255&K)),d>b&&(d=b,Y=L);return C._styleToColorCache[O]=Y,Y},P.prototype.$30w=function(N,c,h,q){var L,S,n=this,y=n.ctx,M=y.font,w=q?y.fillStyle:y.strokeStyle,i=y.textAlign,A=y.textBaseline;S=y.measureText("e").width,c+=S/2,"left"!==i&&(L=y.measureText(N).width,"center"===i?c-=L/2:"right"===i&&(c-=L)),"middle"===A&&(h+=S/2);var X,B=8;"string"==typeof M&&(X=M.match(/^\d+/),X&&(B=X[0]));var H=n.$2aw(),z=n.$2fw(w);N=(""+N).split("\n").join(","),n.writer.$49w(N,n.$2cw({x:c,y:h}),n.$2ew(n._textScale*B),H,z)},P.prototype.$31w=function(u,r,B,Q){var n=this,I=n.$2dw([{x:u,y:r},{x:u+B,y:r},{x:u+B,y:r+Q},{x:u,y:r+Q}]);n.$3bw(I[0]),n._path.push({type:"rect",points:I})},P.prototype.$32w=function(){var I,y=this,E=y._path;if(E.length){var o=E.length;"closePath"!==E[E.length-1].subType&&y.$3aw();var $,q,g,S=y.$2fw(y.ctx.fillStyle),X=!0;for(g=0;o>g;g++){if($=E[g].type,"moveTo"!==$&&"rect"!==$){X=!1;break}if("rect"===$){if(q){X=!1;break}q=g}}X?(I=E[q],y.writer.$4aw(I.points,S)):(y._filling=!0,y._hatchContext={startId:y.writer.entities.length,color:S},y.$3ew(),y.$33w(),y._filling=c)}},P.prototype.$33w=function(){var f=this,Y=f._hatchContext;if(Y){var N=Y.startId,F=f.writer.entities,n=F.length,D=n-N;if(D){var E;for(E=N;n>E;E++)F[E].invisible=!0;f.writer.$45w(D,Y.color),Y.startId=F.length}}},P.prototype.$34w=function(I,P){var q=this,v=q.$2cw({x:I,y:P});q._headPoint=v,q._path.push({type:"moveTo",x:v.x,y:v.y})},P.prototype.$35w=function(b,$){var B=this,C=B.$2cw({x:b,y:$});B._path.push({type:"lineTo",x:C.x,y:C.y})},P.prototype.$36w=function(W,B,S,m,P,T){this.$37w(W,B,S,S,0,m,P,T)},P.prototype.$37w=function(A,a,e,k,$,Q,t,E){var X,l,H,o,s,p,U,Y,C,F,d,j,M,h,Z,J=this,y=J.$2bw(),m=J.$2cw({x:A,y:a});p=Math.sin($),U=Math.cos($);var r=function(h){var q=e*Math.cos(-h),O=k*Math.sin(-h);return J.$2cw({x:A+(U*q-p*O),y:a+(p*q+U*O)})},f=[],z=t;if(E)for(;z>=Q;)z-=2*Math.PI;else for(;Q>=z;)z+=2*Math.PI;for(F=(z-Q)/J._ellipseSegments,j=0;j<=J._ellipseSegments;j++)d=Q+F*j,M=r(-d),f.push(M);if(o=f[0],s=f[f.length-1],X=J.$3cw(Q,t,E),Q=X.start,t=X.end,J.$3bw(o),Y=J._equal(y.x,y.y),C=J._equal(e,k),!J._forceSplitEllipse&&Y&&C&&J._equal(Math.abs(Q-t),2*Math.PI))J._path.push({type:"circle",x:m.x,y:m.y,end:s,keyPoints:f,radius:e*y.x});else if(!J._forceSplitEllipse&&Y&&C)l=J.$2aw(),H=Math.cos(l),h=J._currentContext.a*H<0,Z=J._currentContext.d*H<0,X=J.$3dw(Q,t,h,Z),Q=X.start-l,t=X.end-l,J._path.push({type:"arc",x:m.x,y:m.y,end:s,radius:e*y.x,startAngle:Q,endAngle:t,keyPoints:f});else{if(J._forceSplitEllipse||!Y){for(j=1;j<=J._ellipseSegments;j++)M=f[j],J._path.push({type:"lineTo",x:M.x,y:M.y});return}var x,N,n=r(0),G=r(Math.PI/2),_=function(g,i){var Z=g.x-i.x,_=g.y-i.y;return Math.sqrt(Z*Z+_*_)},O=_(n,m),V=_(G,m);V>O?(N=O,O=V,V=N,x=G):x=n,l=J.$2aw(),H=Math.cos(l),h=J._currentContext.a*H<0,Z=J._currentContext.d*H<0,X=J.$3dw(Q-Math.PI/2,t-Math.PI/2,h,Z),Q=X.start,t=X.end,J._path.push({type:"ellipse",x:m.x,y:m.y,end:s,major:{x:x.x-m.x,y:x.y-m.y},ratio:V/O,startAngle:Q,endAngle:t,keyPoints:f})}},P.prototype.$38w=function(e,s,W){var m=this,G=m.$2cw({x:s,y:W});this._path.push({type:"bezier",x:G.x,y:G.y,ctrl:m.$2dw(e)})},P.prototype.$39w=function(){this.$3fw()},P.prototype.$3aw=function(){var H=this,O=H._headPoint;O&&(H._path.push({type:"lineTo",x:O.x,y:O.y,subType:"closePath"}),H._headPoint=null,H._lastPoint=null)},P.prototype.$3bw=function(X){var Z=this;return Z._headPoint?(Z._path.push({type:"lineTo",x:X.x,y:X.y,subType:"connect"}),void 0):(Z._headPoint=X,Z._path.push({type:"moveTo",x:X.x,y:X.y}),void 0)},P.prototype.$3cw=function(Z,J,I){Z=-Z,J=-J;var T,Q=Z%(2*Math.PI),s=J%(2*Math.PI);for(0>Q&&(Q+=2*Math.PI),0>s&&(s+=2*Math.PI),I||(T=Q,Q=s,s=T);Q>=s;)s+=2*Math.PI;return{start:Q,end:s}},P.prototype.$3dw=function(G,P,g,i){var X;return(i||g)&&(g&&i?(G=Math.PI+G,P=Math.PI+P):(X=Math.PI*(g?1:2)-P,P=Math.PI*(g?1:2)-G,G=X)),{start:G,end:P}},P.prototype.$3ew=function(){var X=this,D=X._path;if(D.length){var U,L,J,m,W,e,K=[],I=X.$2fw(X.ctx.strokeStyle),q=function(){K.length>1&&X.writer.$48w(K,I),K=[]};for(L=0,U=D.length;U>L;L++){if(J=D[L],X._filling&&["circle","arc","ellipse"].indexOf(J.type)>=0){if(e=J.keyPoints,!X._lastPoint)break;K.length||K.push(X._lastPoint),K=K.concat(e),X._lastPoint=J.end;break}switch(J.type){case"moveTo":q(),X._filling&&X.$33w(),X._lastPoint={x:J.x,y:J.y},K.push(X._lastPoint);break;case"lineTo":if(!X._lastPoint)break;K.length||K.push(X._lastPoint),K.push({x:J.x,y:J.y}),X._lastPoint={x:J.x,y:J.y};break;case"rect":q(),W=[].concat(J.points,J.points[0]),X.writer.$48w(W,I),X._lastPoint=J.points[0];break;case"circle":q(),X.writer.$43w(J.x,J.y,J.radius,I),X._lastPoint=J.end;break;case"arc":q(),X.writer.$44w(J.x,J.y,J.radius,J.startAngle,J.endAngle,I),X._lastPoint=J.end;break;case"ellipse":q(),X.writer.$46w(J.x,J.y,J.major,J.ratio,J.startAngle,J.endAngle,I),X._lastPoint=J.end;break;case"bezier":if(q(),m=X._lastPoint,!m)break;X.writer.$47w(m.x,m.y,J.x,J.y,J.ctrl,I),X._lastPoint={x:J.x,y:J.y};break;default:K.push({x:J.x,y:J.y})}}q()}},P.prototype.$3fw=function(){var E=this;E._path=[],E._lastPoint=null,E._headPoint=null};var m=A.DxfWriter=function($){var z=this;z.version=$||"AC1027",z._lineContents=[],z._entityList=[]};m.prototype={},m.prototype.constructor=m,m.version="0.9.2",z.defineProperties(m.prototype,{entities:{get:function(){return this._entityList}}}),m.prototype.snapshotView=function(v){this.snapshotVCanvas(new H(v))},m.prototype.snapshotVCanvas=function(Q){var C=this;C._lineContents=[],C._viewport={left:1/0,up:-1/0,right:-1/0,down:1/0},C._matrix={a:1,b:0,c:0,d:-1,tx:0,ty:0};var b=Q.getCanvas(),Z=Q.getView()._42,o=b.getContext;b.getContext=function(X){return function(j){var v=X.apply(this,arguments);return"2d"===j&&(v=C.$41w(v)),v}}(b.getContext),Q.getView()._42=function(S){return Z.call(Q.getView(),S)},Q.redraw(),Q.getView()._42=Z,b.getContext=o},m.prototype.$40w=function(){},m.prototype.$41w=function(l){return new P(l,this)},m.prototype.write=function(){var y=this;return y.$4cw(),y.$56w(),y.$57w(),y.$59w(),y.$58w(),y.$67w(),y._lineContents.join("\n")},m.prototype.$42w=function(E,l,P,s){var Q=this;Q.$4bw("LINE",{p1:E=Q.$2cw(E),p2:l=Q.$2cw(l),color:P||7,layer:s||0}),Q.$64w([E,l])},m.prototype.$43w=function(i,W,D,k){var l=this,p=l.$2ew(D),v=l.$2cw({x:i,y:W});l.$4bw("CIRCLE",{center:v,radius:p,color:k}),l.$64w([{x:v.x-p,y:v.y-p},{x:v.x+p,y:v.y+p}])},m.prototype.$44w=function(h,g,K,X,Q,U){var F=this,K=F.$2ew(K),m=F.$2cw({x:h,y:g});F.$4bw("ARC",{center:m,radius:K,color:U,startAngle:X,endAngle:Q}),F.$64w([{x:m.x-K,y:m.y-K},{x:m.x+K,y:m.y+K}])},m.prototype.$45w=function(x,d){this.$4bw("HATCH",{color:d||7,edgeNum:x})},m.prototype.$46w=function(t,S,E,N,T,o,G){var r=this,A=r.$2cw({x:t,y:S}),E=r.$2cw(E);r.$4bw("ELLIPSE",{center:A,majorAxis:E,axisRatio:N,color:G,startAngle:T,endAngle:o}),r.$64w([{x:A.x-E.x,y:A.y-E.y},{x:A.x+E.x,y:A.y+E.y}])},m.prototype.$47w=function(r,k,B,Q,e,s){var S=this,y=S.$2cw({x:r,y:k}),p=S.$2cw({x:B,y:Q}),Z=S.$2dw(e);S.$4bw("SPLINE",{source:y,dest:p,ctrl:Z,color:s||7}),S.$64w([y,p]),S.$64w(e)},m.prototype.$48w=function(f,b,j){var V=this;V.$4bw("LWPOLYLINE",{points:f=V.$2dw(f),color:b||7,layer:j||0}),V.$64w(f)},m.prototype.$49w=function(u,i,w,K,N){var x=this;x.$4bw("TEXT",{text:u,pos:i=x.$2cw(i),size:x.$2ew(w),degree:x.$8bw(K||0),color:N||7}),x.$64w([i])},m.prototype.$4aw=function(d,j){var r=this,x=[d[0],d[1],d[3],d[2]];r.$4bw("SOLID",{points:x=r.$2dw(x),color:j||7}),r.$64w(x)},m.prototype.$4bw=function(v,y){y.type=v,this._entityList.push(y)},m.prototype.$4cw=function(){var $=this;$.$76w("HT Dxf Writer. Version: "+m.version),$.$72w(),$.$7aw(9,"$ACADVER"),$.$7aw(1,$.version),$.$7aw(9,"$INSBASE"),$.$79w(10,0),$.$79w(20,0),$.$79w(30,0),$.$7aw(9,"$EXTMIN"),$.$79w(10,0),$.$79w(20,0),$.$79w(30,0),$.$7aw(9,"$EXTMAX"),$.$79w(10,1e3),$.$79w(20,1e3),$.$79w(30,0),$.$7aw(9,"$HANDSEED"),$._dxfHandleValue=672,$.$6dw(),$.$74w()},m.prototype.$4dw=function(){var V=this,d=V._viewport;V.$75w("VPORT",8,1),V.$7aw(0,"VPORT"),V.$77w(5,94),V.$77w(330,8),V.$7aw(100,"AcDbSymbolTableRecord"),V.$7aw(100,"AcDbViewportTableRecord"),V.$7aw(2,"*Active"),V.$77w(70,0),V.$79w(10,0),V.$79w(20,0),V.$79w(11,1),V.$79w(21,1),V.$79w(12,(d.left+d.right)/2),V.$79w(22,(d.down+d.up)/2),V.$79w(13,0),V.$79w(23,0),V.$79w(14,1),V.$79w(24,1),V.$79w(15,0),V.$79w(25,0),V.$79w(16,0),V.$79w(26,0),V.$79w(36,1),V.$79w(17,0),V.$79w(27,0),V.$79w(37,0),V.$79w(40,d.up-d.down),V.$79w(41,(d.up-d.down)/(d.right-d.left)),V.$79w(42,50),V.$79w(43,0),V.$79w(44,0),V.$79w(50,0),V.$79w(51,0),V.$77w(71,0),V.$77w(72,1e3),V.$77w(73,1),V.$77w(74,3),V.$77w(75,0),V.$77w(76,0),V.$77w(77,0),V.$77w(78,0),V.$71w()},m.prototype.$4ew=function(){var E=this;E.$75w("LTYPE",5,1),E.$73w(14,"ByBlock"),E.$73w(15,"ByLayer"),E.$73w(16,"Continuous","Solid line"),E.$71w()},m.prototype.$4fw=function(){var Q=this;Q.$75w("LAYER",2,1),Q.$7aw(0,"LAYER"),Q.$77w(5,10),Q.$77w(330,2),Q.$7aw(100,"AcDbSymbolTableRecord"),Q.$7aw(100,"AcDbLayerTableRecord"),Q.$77w(2,0),Q.$77w(70,0),Q.$77w(62,7),Q.$7aw(6,"Continuous"),Q.$7aw(390,"F"),Q.$71w()},m.prototype.$50w=function(){var I=this;I.$75w("STYLE",3,2),I.$69w("Standard","11"),I.$69w("Annotative","DC"),I.$71w()},m.prototype.$51w=function(){var E=this;E.$75w("UCS",7,0),E.$71w()},m.prototype.$52w=function(){var E=this;E.$75w("VIEW",6,1),E.$71w()},m.prototype.$53w=function(){var X=this;X.$75w("APPID",9,7),X.$6aw("ACAD","12"),X.$6aw("AcadAnnoPO","DD"),X.$6aw("AcadAnnotative","DE"),X.$6aw("ACAD_DSTYLE_DIMJAG","DF"),X.$6aw("ACAD_DSTYLE_DIMTALN","E0"),X.$6aw("ACAD_MLEADERVER","107"),X.$6aw("ACAD_NAV_VCDISPLAY","1A6"),X.$71w()},m.prototype.$54w=function(){var W=this;W.$75w("DIMSTYLE","A",2),W.$7aw(100,"AcDbDimStyleTable"),W.$77w(71,2),W.$7aw(340,"27"),W.$7aw(340,"E1"),W.$71w()},m.prototype.$55w=function(){var w=this;w.$75w("BLOCK_RECORD",1,1),w.$6bw("*Model_Space","1F","22"),w.$6bw("*Paper_Space","58","59"),w.$6bw("*Paper_Space0","5D","5E"),w.$71w()},m.prototype.$56w=function(){var G=this;G.$70w(),G.$4dw(),G.$4ew(),G.$4fw(),G.$50w(),G.$52w(),G.$51w(),G.$53w(),G.$54w(),G.$55w(),G.$74w()},m.prototype.$57w=function(){var x=this;x.$68w("BLOCKS"),x.$6cw("*Model_Space",32,31),x.$6cw("*Paper_Space",90,88,!0),x.$6cw("*Paper_Space0",95,93,!0),x.$74w()},m.prototype.$58w=function(){var C=this;C.$68w("OBJECTS"),C.$6ew("C","0",0,1),C.$6fw(350,{ACAD_CIP_PREVIOUS_PRODUCT_INFO:"1A5",ACAD_COLOR:"73",ACAD_DETAILVIEWSTYLE:"1AB",ACAD_GROUP:"D",ACAD_LAYOUT:"1A",ACAD_MATERIAL:"72",ACAD_MLEADERSTYLE:"D7",ACAD_MLINESTYLE:"17",ACAD_PLOTSETTINGS:"19",ACAD_PLOTSTYLENAME:"E",ACAD_SCALELIST:"B6",ACAD_SECTIONVIEWSTYLE:"1A8",ACAD_TABLESTYLE:"86",ACAD_VISUALSTYLE:"99",ACDB_RECOMPOSE_DATA:"2A6",AcDbVariableDictionary:"66"}),C.$6ew("18E","2",1,1),C.$6fw(360,{ACAD_LAYERSTATES:"18F"}),C.$6ew("15D","1F",1,1),C.$6ew("D","C",0,1),C.$6ew("1A","C",0,1),C.$6fw(350,{Layout1:"59",Layout2:"5E",Model:"22"}),C.$6ew("D7","C",0,1),C.$6fw(350,{Annotative:"E5",Standard:"D8"}),C.$6ew("17","C",0,1),C.$6fw(350,{Standard:18}),C.$6ew("19","C",0,1),C.$74w()},m.prototype.$59w=function(){var y=this;y.$68w("ENTITIES"),y._dxfHandleValue=720;var v,W,I,p=y._entityList;for(v in p)if(I=p[v],I.id=v,!I.invisible)switch(W=I.type,y.$7aw(0,W),y.$6dw(),y.$78w(330,31),y.$7aw(100,"AcDbEntity"),y.$77w(62,I.color||7),y.$77w(8,I.layer||0),W){case"LINE":y.$5aw(I);break;case"TEXT":y.$65w(I);break;case"SOLID":y.$66w(I);break;case"LWPOLYLINE":y.$63w(I);break;case"CIRCLE":y.$5bw(I);break;case"ARC":y.$5cw(I);break;case"ELLIPSE":y.$5dw(I);break;case"SPLINE":y.$5ew(I);break;case"HATCH":y.$5fw(I)}y.$74w()},m.prototype.$5aw=function(w){var j=this,E=w.p1,b=w.p2;j.$7aw(100,"AcDbLine"),j.$7cw(10,E),j.$7cw(11,b)},m.prototype.$5bw=function(R){var x=this;x.$7aw(100,"AcDbCircle"),x.$7cw(10,R.center),x.$79w(40,R.radius)},m.prototype.$5cw=function(w){var j=this;j.$7aw(100,"AcDbCircle"),j.$7cw(10,w.center),j.$79w(40,w.radius),j.$7aw(100,"AcDbArc"),j.$79w(50,j.$8bw(w.startAngle)),j.$79w(51,j.$8bw(w.endAngle))},m.prototype.$5dw=function(x){var v=this;v.$7aw(100,"AcDbEllipse"),v.$7cw(10,x.center),v.$7cw(11,x.majorAxis),v.$79w(40,x.axisRatio),v.$79w(41,x.startAngle),v.$79w(42,x.endAngle)},m.prototype.$5ew=function(r){var X=this,L=[r.source];L=L.concat(r.ctrl,[r.dest]);var p,w=L.length;for(X.$7aw(6,"Continuous"),X.$7aw(100,"AcDbSpline"),X.$77w(70,8),X.$77w(71,w-1),X.$77w(72,2*w),X.$77w(73,w),X.$77w(74,0),X.$7aw(42,"0.000000001"),X.$7aw(43,"0.0000000001"),p=0;w>p;p++)X.$7aw(40,"0.0");for(p=0;w>p;p++)X.$7aw(40,"1.0");for(p=0;w>p;p++){var G=L[p];X.$79w(10,G.x),X.$79w(20,G.y),X.$79w(30,0)}},m.prototype.$5fw=function(d){var b=this;b.$7aw(6,"Continuous"),b.$7aw(100,"AcDbHatch"),b.$7cw(10,{x:0,y:0,z:0}),b.$7cw(210,{x:0,y:0,z:1}),b.$7aw(2,"SOLID"),b.$77w(70,1),b.$77w(71,0),b.$60w(d),b.$62w(d)},m.prototype.$60w=function(e){var K=this;K.$77w(91,1);var Q,H,y,c,W=K._entityList;for(y=0,H=5,Q=e.id-e.edgeNum;Q<e.id;Q++)switch(c=W[Q],c.type){case"ARC":case"CIRCLE":case"ELLIPSE":case"LINE":case"SPLINE":y+=1;break;case"LWPOLYLINE":y+=c.points.length-1}for(K.$77w(92,H),2!==(2&e.pathTypeFlag)&&K.$77w(93,y),Q=e.id-e.edgeNum;Q<e.id;Q++)K.$61w(W[Q]);K.$77w(97,0)},m.prototype.$61w=function(v){var D,J,N,u=this;switch(v.type){case"LWPOLYLINE":for(J=v.points.length,D=0;J-1>D;D++)u.$77w(72,1),u.$7cw(10,v.points[D]),u.$7cw(11,v.points[D+1]);break;case"ARC":u.$77w(72,2),u.$7cw(10,v.center),u.$79w(40,v.radius),u.$79w(50,u.$8bw(v.startAngle)),u.$79w(51,u.$8bw(v.endAngle));break;case"CIRCLE":u.$77w(72,2),u.$7cw(10,v.center),u.$7cw(40,v.radius),u.$79w(50,0),u.$79w(51,360);break;case"ELLIPSE":u.$77w(72,3),u.$7cw(10,v.center),u.$7cw(11,v.majorAxis),u.$79w(40,v.axisRatio),u.$79w(50,v.startAngle),u.$79w(51,v.endAngle);break;case"SPLINE":for(u.$77w(72,4),N=[v.source],N=N.concat(v.ctrl,[v.dest]),J=N.length,u.$77w(94,J-1),u.$77w(73,0),u.$77w(74,0),u.$77w(95,2*J),u.$77w(96,J),D=0;J>D;D++)u.$7aw(40,"0.0");for(D=0;J>D;D++)u.$7aw(40,"1.0");for(D=0;J>D;D++){var e=N[D];u.$79w(10,e.x),u.$79w(20,e.y)}u.$77w(97,0)}},m.prototype.$62w=function(){var $=this;$.$77w(75,1),$.$77w(76,1),$.$79w(47,0),$.$77w(98,1),$.$79w(10,0),$.$79w(20,0),$.$77w(450,0),$.$77w(451,0),$.$79w(460,0),$.$79w(461,0),$.$77w(452,0),$.$79w(462,1),$.$77w(453,0),$.$7aw(470,"LINEAR")},m.prototype.$63w=function(x){var l,u=this,k=x.points.length;for(u.$7aw(6,"Continuous"),u.$7aw(100,"AcDbPolyline"),u.$77w(90,k),u.$77w(70,0),u.$79w(43,0),l=0;k>l;l++)u.$7cw(10,x.points[l])},m.prototype.$64w=function(Q){var O,T,i,m=this,o=m._viewport;for(T=0,i=Q.length;i>T;T++)O=Q[T],O.x<o.left&&(o.left=O.x),O.x>o.right&&(o.right=O.x),O.y<o.down&&(o.down=O.y),O.y>o.up&&(o.up=O.y)},m.prototype.$65w=function(A){var C=this,M=A.text,O=A.pos,n=A.size,F=A.degree;A.color,C.$7aw(100,"AcDbText"),C.$7cw(10,O),C.$79w(40,n),C.$7aw(1,M),C.$79w(50,360-F),C.$7aw(100,"AcDbText")},m.prototype.$66w=function(Z){var J=this;J.$7aw(100,"AcDbTrace"),J.$7cw(10,Z.points[0]),J.$7cw(11,Z.points[1]),J.$7cw(12,Z.points[2]),J.$7cw(13,Z.points[3])},m.prototype.$67w=function(){this.$7aw(0,"EOF")},m.prototype.$68w=function(c){var X=this;X.$7aw(0,"SECTION"),X.$7aw(2,c)},m.prototype.$69w=function(v,N){var x=this;x.$7aw(0,"STYLE"),x.$7aw(5,N),x.$7aw(330,3),x.$7aw(100,"AcDbSymbolTableRecord"),x.$7aw(100,"AcDbTextStyleTableRecord"),x.$7aw(2,v),x.$77w(70,0),x.$79w(40,0),x.$79w(41,1),x.$79w(50,0),x.$77w(71,0),x.$79w(42,.2),x.$7aw(3,"Arial.ttf"),x.$7aw(4,""),x.$7aw(1001,"ACAD"),x.$7aw(1e3,"Arial"),x.$77w(1071,34)},m.prototype.$6aw=function(N,E){var j=this;j.$7aw(0,"APPID"),j.$7aw(5,E),j.$77w(330,9),j.$7aw(100,"AcDbSymbolTableRecord"),j.$7aw(100,"AcDbRegAppTableRecord"),j.$7aw(2,N),j.$77w(70,0)},m.prototype.$6bw=function(f,A,H){var e=this;e.$7aw(0,"BLOCK_RECORD"),e.$7aw(5,A),e.$77w(330,1),e.$7aw(100,"AcDbSymbolTableRecord"),e.$7aw(100,"AcDbBlockTableRecord"),e.$7aw(2,f),e.$7aw(340,H),e.$77w(70,0),e.$77w(280,1),e.$77w(281,0)},m.prototype.$6cw=function(i,I,z,h){var Z=this;Z.$7aw(0,"BLOCK"),Z.$78w(5,I),Z.$78w(330,z),Z.$7aw(100,"AcDbEntity"),h&&Z.$77w(67,1),Z.$77w(8,0),Z.$7aw(100,"AcDbBlockBegin"),Z.$7aw(2,i),Z.$77w(70,0),Z.$79w(10,0),Z.$79w(20,0),Z.$79w(30,0),Z.$7aw(3,i),Z.$7aw(1,""),Z.$7aw(0,"ENDBLK"),Z.$78w(5,I+1),Z.$78w(330,z),Z.$7aw(100,"AcDbEntity"),h&&Z.$77w(67,1),Z.$77w(8,0),Z.$7aw(100,"AcDbBlockEnd")},m.prototype.$6dw=function(){var J=this;J.$78w(5,J._dxfHandleValue++)},m.prototype.$6ew=function(M,A,w,D){var T=this;T.$7aw(0,"DICTIONARY"),T.$7aw(5,M),"C"===A&&(T.$7aw(102,"{ACAD_REACTORS"),T.$7aw(330,A),T.$7aw(102,"}")),T.$7aw(330,A),T.$7aw(100,"AcDbDictionary"),w&&T.$77w(280,w),T.$77w(281,D)},m.prototype.$6fw=function(l,z){var L=this;for(var H in z){var a=z[H];L.$7aw(3,H),L.$7aw(l,a)}},m.prototype.$70w=function(){this.$68w("TABLES")},m.prototype.$71w=function(){this.$7aw(0,"ENDTAB")},m.prototype.$72w=function(){this.$68w("HEADER")},m.prototype.$73w=function(n,S,a){var R=this;R.$7aw(0,"LTYPE"),R.$77w(5,n),R.$77w(330,5),R.$7aw(100,"AcDbSymbolTableRecord"),R.$7aw(100,"AcDbLinetypeTableRecord"),R.$7aw(2,S),R.$77w(70,0),R.$77w(3,a||""),R.$77w(72,65),R.$77w(73,0),R.$79w(40,0)},m.prototype.$74w=function(){this.$7aw(0,"ENDSEC")},m.prototype.$75w=function(d,N,j){var n=this;n.$7aw(0,"TABLE"),n.$7aw(2,d),n.$77w(5,N),n.$77w(330,0),n.$7aw(100,"AcDbSymbolTable"),n.$77w(70,j)},m.prototype.$76w=function(n){this.$7aw(999,n)},m.prototype.$77w=function(p,O){return this.$7aw(p,O)},m.prototype.$78w=function(L,B){return this.$7aw(L,B.toString(16).toUpperCase())},m.prototype.$79w=function(u,m){return m=""+m,m.indexOf(".")<0&&(m+=".0"),this.$7aw(u,m)},m.prototype.$7aw=function(L,c){var Y;Y=10>L?" ":100>L?" ":"",this._lineContents.push(Y+L+"\n"+c)},m.prototype.$7bw=function(d){this._lineContents.push(d.join("\n"))},m.prototype.$7cw=function(l,h){var y=this;y.$79w(l,h.x),y.$79w(l+10,h.y),h.z!==c&&y.$79w(l+20,h.z)},m.prototype.$7dw=function(H){var V,x,C=this;for(V=0,x=H.length;x>V;V++)C.$7aw(0,"VERTEX"),C.$77w(8,0),C.$7cw(10,H[V])},m.prototype.$2cw=function(i){var K=this._matrix,h=i.x,I=i.y;return{x:K.a*h+K.c*I+K.tx,y:K.b*h+K.d*I+K.ty}},m.prototype.$2dw=function(C){for(var d=this,r=new Array(C.length),g=0,D=C.length;D>g;g++)r[g]=d.$2cw(C[g]);return r},m.prototype.$2ew=function(P){var A=this._matrix;return P*Math.sqrt(A.a*A.a+A.b*A.b)},m.prototype.$8bw=function(r){return 180*(r/Math.PI)}}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);