(function(){try{var r=window.$MicrosoftMaps8,n=r.Internal,l=n._CurveColorHelper,t=n._Debug,a=n._Dispatcher,o=n._Gimme,i=n._Helper,v=n._ObservableObject,y=r.Point,s=r.Size,p=r.GlobalConfig,h=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),u=function(){function n(t,r,u){if(this.arrowDrawAccumulator=0,t&&t.substr(t.length-9)==="Singleton")return n[t]=n[t]||new n;this._rasterDPIScale=u;this._canvas=r||i._createElement("canvas");this._canvasElem=this._canvas[0];this._context=this._canvasElem.getContext("2d");this._style=this._resetStyle={fillStyle:this._context.fillStyle,strokeStyle:this._context.strokeStyle,lineWidth:this._context.lineWidth}}return n.getLineHeight=function(t){var u=n._lineHeights[t],r;return u||(r=n._scratchElement,r||(r=n._scratchElement=i._createElement("div").appendTo(document.body).appendText("X").set_style({visibility:"hidden",position:"fixed",left:"100%",top:"100%","line-height":"100%"})),r.set_style({font:t}),u=n._lineHeights[t]=r.get_native_prop("offsetHeight")),u},n.prototype.setGlobalAlpha=function(n){this._context.globalAlpha=n},n.prototype.getGlobalAlpha=function(){return this._context.globalAlpha},n.prototype.save=function(){this._context.save()},n.prototype.restore=function(n){this._context.restore();n!==!1&&(this._font=null,this._style=this._resetStyle)},n.prototype.getDataURL=function(){return this._canvasElem.toDataURL()},n.prototype.setSize=function(n,t,i){var r=i?1:this.getDevicePixelRatio(!0);this._canvasElem.width=n*r;this._canvasElem.height=t*r;this._canvasElem.style.width=n+"px";this._canvasElem.style.height=t+"px";this._context.scale(r,r)},n.prototype.getSize=function(){return new s(this._canvasElem.width,this._canvasElem.height)},n.prototype.clear=function(n,t,i,r,u){if(t=t||0,i=i||0,r=r||this._canvasElem.width,u=u||this._canvasElem.height,n){var f=this._context.fillStyle;this._context.fillStyle=n;this._context.fillRect(t,i,r,u);this._context.fillStyle=f}else this._context.clearRect(t,i,r,u)},n.prototype.setFont=function(n){n!==this._font&&(this._context.font=n,this._font=n)},n.prototype.translate=function(n,t){this._context.translate(n,t)},n.prototype.setStyle=function(t,r){var u;if(this._style=t,r=r||1,this._context.fillStyle=this._style.fillStyle||"transparent",this._context.strokeStyle=this._style.strokeStyle||"transparent",this._context.lineWidth=Math.round(this._style.lineWidth*i._getFinite(this._style.lineWidthScale,1)*r)||0,this._context.lineCap=this._style.lineCap||"round",this._context.lineJoin=this._style.lineJoin||"round",this._context.setLineDash&&(this._context.setLineDash(n.prepareLineDashes(this._style.dashes,this._context.lineWidth,!0)),this._context.lineDashOffset=Math.round((this._style.dashOffset||0)*this._context.lineWidth)),u=this._style.fillImage,u&&typeof u!="number"&&(this._context.fillStyle=this._context.createPattern(u,"repeat")),this._style.font){var o=this._style.horizontalAlignment,s=this._style.verticalAlignment,f="center",e="middle";o===1?f="left":o===2&&(f="right");s===0?e="bottom":s===2&&(e="hanging");this._context.textAlign=f;this._context.textBaseline=e}this._context.shadowColor=this._style.shadowColor||"transparent";this._context.shadowBlur=this._style.shadowBlur||0;this._style.shadowOffset&&(this._context.shadowOffsetX=this._style.shadowOffset.x||0,this._context.shadowOffsetY=this._style.shadowOffset.y||0)},n.prototype.getStyle=function(){return this._style},n.prototype.setPrimitive=function(){},n.prototype.hasPrimitives=function(){return!1},n.prototype.setLayer=function(){},n.prototype.getHitTestingData=function(){return null},n.prototype.flush=function(){var n=this._context.shadowColor;this._needsFill&&(this._context.fill(),this._context.shadowColor="transparent");this._needsStroke&&this._style.lineWidth>0&&i._getFinite(this._style.lineWidthScale,1)>0&&this._context.stroke();this._needsStroke=this._needsFill=!1;this._context.shadowColor=n;this._context.beginPath()},n.prototype.stroke=function(){var u=this._style,r=u.secondaryLineWidth,f=i._getFinite(u.secondaryLineWidthScale,1);if(r>0&&f>0){var t=this._context,e=t.strokeStyle,o=t.lineWidth;r*=f;t.setLineDash&&(t.setLineDash(n.prepareLineDashes(u.dashes,r,!0)),t.lineDashOffset=Math.round((this._style.dashOffset||0)*r));t.strokeStyle=u.secondaryStrokeStyle;t.lineWidth=r;t.stroke();t.strokeStyle=e;t.lineWidth=o}this._needsStroke=!0},n.prototype.fill=function(){this._needsFill=!0},n.prototype.getImageData=function(n,t,i,r){return this._context.getImageData(n,t,i,r)},n.prototype.getRawContext=function(){return this._context},n.prototype.getRootElement=function(){return this._canvas},n.prototype.getDevicePixelRatio=function(n){return(!this._devicePixelRatio||n)&&(this._devicePixelRatio=this._rasterDPIScale||window.devicePixelRatio||1||1),this._devicePixelRatio},n.prototype.putImageData=function(n,t,i,r,u,f,e){typeof r=="number"?this._context.putImageData(n,t,i,r,u,f,e):this._context.putImageData(n,t,i)},n.prototype.drawImage=function(n,i,r,u,f,e,o,s,h,c){var a,l;t.assertNotNull(n,"image");a=this._context.globalAlpha;e&&(this._context.globalAlpha=e);try{l=this.getDevicePixelRatio();u&&f&&typeof o=="number"&&typeof s=="number"&&h&&c?this._context.drawImage(n,o,s,h/l,c/l,i||0,r||0,u/l,f/l):u&&f?this._context.drawImage(n,i||0,r||0,u/l,f/l):this._context.drawImage(n,i||0,r||0)}catch(v){}this._context.globalAlpha=a},n.prototype.drawEllipse=function(n,t,i,r){if(i===r)this._context.arc(n,t,i,0,2*Math.PI,!1);else{var u=r/.75;this._context.beginPath();this._context.moveTo(n-i,t);this._context.bezierCurveTo(n-i,t+u,n+i,t+u,n+i,t);this._context.bezierCurveTo(n+i,t-u,n-i,t-u,n-i,t)}},n.prototype.lineTo=function(n,t,i,r){var u=this._style.dashes;!this._context.setLineDash&&u&&u.length>0?this._dashedLineTo(n,t,i||0,r||0,u):this._context.lineTo(n,t)},n.prototype.moveTo=function(n,t){this._context.moveTo(n,t)},n.prototype.dispose=function(){this._canvas&&(this._canvas.removeFromParent(),this._canvas.clear(),this._canvas=null);this._canvasElem=null;this._context=null},n.prepareLineDashes=function(n,t,i){var r=[],u;if(n&&n.length>0)for(r=n.slice(0),u=0;u.005&&(l=a/h);var c=new Array(e.length),v=new Array(e.length),b=this._style.lineWidth*i._getFinite(this._style.lineWidthScale,1);for(o=0;o0,"Dash length is not positive"),s<1){this._context.lineTo(n,r);break}Math.abs(h)<=.005||Math.abs(l)>200?(c[o]=0,v[o]=a>0?s:-s):Math.abs(l)<.005?(c[o]=h>0?s:-s,v[o]=0):(c[o]=Math.sqrt(s*s/(1+l*l)),h<0&&(c[o]=-c[o]),v[o]=l*c[o])}for(y=Math.sqrt(h*h+a*a),p=!0,o=0;y>0;)s=e[o%e.length]*b,y>s?(w=o++%e.length,u+=c[w],f+=v[w]):(u=n,f=r),p?this._context.lineTo(u,f):this._context.moveTo(u,f),y-=s,p=!p},n._lineHeights={},n}(),c=function(n){function r(t){var r=n.call(this,t)||this;return i._disableSmoothing(r.getRawContext()),r._primitives=[],r._layers=[],r._layerIdToIndex={},r}return h(r,n),r.prototype.setSize=function(t,r){n.prototype.setSize.call(this,t,r,!0);i._disableSmoothing(this.getRawContext())},r.prototype.stroke=function(){this.getRawContext().stroke()},r.prototype.fill=function(){this.getRawContext().fill()},r.prototype.setPrimitive=function(n){if(n){this._currentPrimitiveIndex=this._primitives.length;var i=r.decimalToColorString(this._currentLayerIndex,this._currentPrimitiveIndex),t=this.getRawContext();t.fillStyle=t.strokeStyle=i;t.beginPath();this._primitives.push(n)}},r.prototype.hasPrimitives=function(){return!0},r.prototype.setLayer=function(n){t.assertNotNull(n,"layer");var r=n.getId(),i=this._layerIdToIndex[r];i||(this._layers.push(n),this._layerIdToIndex[r]=i=this._layers.length);this._currentLayerIndex=i},r.prototype.getHitTestingData=function(){var n=this.getSize();return new f(this._primitives,this._layers,this.getRawContext().getImageData(0,0,n.width,n.height))},r.prototype.clear=function(){this._primitives=[];this._layers=[];this._layerIdToIndex={};n.prototype.clear.call(this)},r.prototype.drawImage=function(n,i,r,u,f){t.assertNotNull(n,"image");u=u||n.naturalWidth||n.width;f=f||n.naturalHeight||n.height;this.getRawContext().fillRect(i||0,r||0,u,f)},r.prototype.setStyle=function(n){n.lineWidth&&(this.getRawContext().lineWidth=n.lineWidth+2)},r.decimalToColorString=function(n,i){var r,u;return t.assert(n>0,"layers is empty"),r=(n-1).toString(16).toUpperCase(),t.assert(r.length<=2,"Hit testing layers number exceeds #FF"),u=r.length===1?"#0"+r+"0000":"#"+r+"0000",r=i.toString(16).toUpperCase(),t.assert(r.length<=4,"Hit testing primitives number exceeds #00FFFF"),u.substring(0,u.length-r.length)+r},r}(u),f=function(){function n(n,t,i){this._primitives=n||[];this._layers=t||[];this._imageData=i}return n.prototype.setResultToArgs=function(n,i,r){var u,s,h,c,f,e;if((t.assertNotNull(r,"args"),n=Math.round(n),i=Math.round(i),u=this.getResultIndex(n,i),!(u<0))&&(s=u>>16,h=u&65535,h1){r.primitive=this._primitives[h];r.layer=this._layers[s];return}}},n.prototype.getResultIndex=function(t,i){var u=-1,r;if(n.isPointWithinBoundary(t,i,this._imageData.width,this._imageData.height)&&this._imageData&&this._imageData.data&&(r=(this._imageData.width*i+t)*4,r>=0&&r+3=0&&n=0&&t