File: /var/www/html/wpprm_old/wp-content/themes/ronneby/assets/js/excanvas.compiled.js
// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
document.createElement("canvas").getContext||function(){var X=Math,Y=X.round,p=X.sin,y=X.cos,r=X.abs,s=X.sqrt,L=10,d=L/2;function i(){return this.context_||(this.context_=new _(this))}var n=Array.prototype.slice;var t={init:function(t){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var e=t||document;e.createElement("canvas"),e.attachEvent("onreadystatechange",function(t,e){var i=n.call(arguments,2);return function(){return t.apply(e,i.concat(n.call(arguments)))}}(this.init_,this,e))}},init_:function(t){if(t.namespaces.g_vml_||t.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML"),t.namespaces.g_o_||t.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML"),!t.styleSheets.ex_canvas_){var e=t.createStyleSheet();e.owningElement.id="ex_canvas_",e.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}for(var i=t.getElementsByTagName("canvas"),r=0;r<i.length;r++)this.initElement(i[r])},initElement:function(t){if(!t.getContext){t.getContext=i,t.innerHTML="",t.attachEvent("onpropertychange",a),t.attachEvent("onresize",o);var e=t.attributes;e.width&&e.width.specified?t.style.width=e.width.nodeValue+"px":t.width=t.clientWidth,e.height&&e.height.specified?t.style.height=e.height.nodeValue+"px":t.height=t.clientHeight}return t}};function a(t){var e=t.srcElement;switch(t.propertyName){case"width":e.style.width=e.attributes.width.nodeValue+"px",e.getContext().clearRect();break;case"height":e.style.height=e.attributes.height.nodeValue+"px",e.getContext().clearRect()}}function o(t){var e=t.srcElement;e.firstChild&&(e.firstChild.style.width=e.clientWidth+"px",e.firstChild.style.height=e.clientHeight+"px")}t.init();for(var h=[],e=0;e<16;e++)for(var l=0;l<16;l++)h[16*e+l]=e.toString(16)+l.toString(16);function c(t,e){for(var i=[[1,0,0],[0,1,0],[0,0,1]],r=0;r<3;r++)for(var s=0;s<3;s++){for(var n=0,a=0;a<3;a++)n+=t[r][a]*e[a][s];i[r][s]=n}return i}function u(t,e){e.fillStyle=t.fillStyle,e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.shadowBlur=t.shadowBlur,e.shadowColor=t.shadowColor,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY,e.strokeStyle=t.strokeStyle,e.globalAlpha=t.globalAlpha,e.arcScaleX_=t.arcScaleX_,e.arcScaleY_=t.arcScaleY_,e.lineScale_=t.lineScale_}function A(t){var e,i=1;if("rgb"==(t=String(t)).substring(0,3)){var r=t.indexOf("(",3),s=t.indexOf(")",r+1),n=t.substring(r+1,s).split(",");e="#";for(var a=0;a<3;a++)e+=h[Number(n[a])];4==n.length&&"a"==t.substr(3,1)&&(i=n[3])}else e=t;return{color:e,alpha:i}}function _(t){this.m_=[[1,0,0],[0,1,0],[0,0,1]],this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.fillStyle=this.strokeStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=1*L,this.globalAlpha=1;var e=(this.canvas=t).ownerDocument.createElement("div");e.style.width=t.clientWidth+"px",e.style.height=t.clientHeight+"px",e.style.overflow="hidden",e.style.position="absolute",t.appendChild(e),this.element_=e,this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var f=_.prototype;function x(t,e,i,r){t.currentPath_.push({type:"bezierCurveTo",cp1x:e.x,cp1y:e.y,cp2x:i.x,cp2y:i.y,x:r.x,y:r.y}),t.currentX_=r.x,t.currentY_=r.y}function g(t,e,i){(function(t){for(var e=0;e<3;e++)for(var i=0;i<2;i++)if(!isFinite(t[e][i])||isNaN(t[e][i]))return!1;return!0})(e)&&(t.m_=e,i&&(t.lineScale_=s(r(e[0][0]*e[1][1]-e[0][1]*e[1][0]))))}function m(t){this.type_=t,this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0,this.colors_=[]}function v(){}f.clearRect=function(){this.element_.innerHTML=""},f.beginPath=function(){this.currentPath_=[]},f.moveTo=function(t,e){var i=this.getCoords_(t,e);this.currentPath_.push({type:"moveTo",x:i.x,y:i.y}),this.currentX_=i.x,this.currentY_=i.y},f.lineTo=function(t,e){var i=this.getCoords_(t,e);this.currentPath_.push({type:"lineTo",x:i.x,y:i.y}),this.currentX_=i.x,this.currentY_=i.y},f.bezierCurveTo=function(t,e,i,r,s,n){var a=this.getCoords_(s,n);x(this,this.getCoords_(t,e),this.getCoords_(i,r),a)},f.quadraticCurveTo=function(t,e,i,r){var s=this.getCoords_(t,e),n=this.getCoords_(i,r),a={x:this.currentX_+.6666666666666666*(s.x-this.currentX_),y:this.currentY_+.6666666666666666*(s.y-this.currentY_)};x(this,a,{x:a.x+(n.x-this.currentX_)/3,y:a.y+(n.y-this.currentY_)/3},n)},f.arc=function(t,e,i,r,s,n){i*=L;var a=n?"at":"wa",o=t+y(r)*i-d,h=e+p(r)*i-d,l=t+y(s)*i-d,c=e+p(s)*i-d;o!=l||n||(o+=.125);var u=this.getCoords_(t,e),_=this.getCoords_(o,h),f=this.getCoords_(l,c);this.currentPath_.push({type:a,x:u.x,y:u.y,radius:i,xStart:_.x,yStart:_.y,xEnd:f.x,yEnd:f.y})},f.rect=function(t,e,i,r){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.closePath()},f.strokeRect=function(t,e,i,r){var s=this.currentPath_;this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.closePath(),this.stroke(),this.currentPath_=s},f.fillRect=function(t,e,i,r){var s=this.currentPath_;this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.closePath(),this.fill(),this.currentPath_=s},f.createLinearGradient=function(t,e,i,r){var s=new m("gradient");return s.x0_=t,s.y0_=e,s.x1_=i,s.y1_=r,s},f.createRadialGradient=function(t,e,i,r,s,n){var a=new m("gradientradial");return a.x0_=t,a.y0_=e,a.r0_=i,a.x1_=r,a.y1_=s,a.r1_=n,a},f.drawImage=function(t){var e,i,r,s,n,a,o,h,l=t.runtimeStyle.width,c=t.runtimeStyle.height;t.runtimeStyle.width="auto",t.runtimeStyle.height="auto";var u=t.width,_=t.height;if(t.runtimeStyle.width=l,t.runtimeStyle.height=c,3==arguments.length)e=arguments[1],i=arguments[2],n=a=0,o=r=u,h=s=_;else if(5==arguments.length)e=arguments[1],i=arguments[2],r=arguments[3],s=arguments[4],n=a=0,o=u,h=_;else{if(9!=arguments.length)throw Error("Invalid number of arguments");n=arguments[1],a=arguments[2],o=arguments[3],h=arguments[4],e=arguments[5],i=arguments[6],r=arguments[7],s=arguments[8]}var f=this.getCoords_(e,i),p=[];if(p.push(" <g_vml_:group",' coordsize="',10*L,",",10*L,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;"),1!=this.m_[0][0]||this.m_[0][1]){var y=[];y.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",Y(f.x/L),",","Dy=",Y(f.y/L),"");var d=f,x=this.getCoords_(e+r,i),g=this.getCoords_(e,i+s),m=this.getCoords_(e+r,i+s);d.x=X.max(d.x,x.x,g.x,m.x),d.y=X.max(d.y,x.y,g.y,m.y),p.push("padding:0 ",Y(d.x/L),"px ",Y(d.y/L),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",y.join(""),", sizingmethod='clip');")}else p.push("top:",Y(f.y/L),"px;left:",Y(f.x/L),"px;");p.push(' ">','<g_vml_:image src="',t.src,'"',' style="width:',L*r,"px;"," height:",L*s,'px;"',' cropleft="',n/u,'"',' croptop="',a/_,'"',' cropright="',(u-n-o)/u,'"',' cropbottom="',(_-a-h)/_,'"'," />","</g_vml_:group>"),this.element_.insertAdjacentHTML("BeforeEnd",p.join(""))},f.stroke=function(t){var e=[],i=A(t?this.fillStyle:this.strokeStyle),r=i.color,s=i.alpha*this.globalAlpha;e.push("<g_vml_:shape",' filled="',!!t,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',10*L," ",10*L,'"',' stroked="',!t,'"',' path="');for(var n={x:null,y:null},a={x:null,y:null},o=0;o<this.currentPath_.length;o++){var h=this.currentPath_[o];switch(h.type){case"moveTo":e.push(" m ",Y(h.x),",",Y(h.y));break;case"lineTo":e.push(" l ",Y(h.x),",",Y(h.y));break;case"close":e.push(" x "),h=null;break;case"bezierCurveTo":e.push(" c ",Y(h.cp1x),",",Y(h.cp1y),",",Y(h.cp2x),",",Y(h.cp2y),",",Y(h.x),",",Y(h.y));break;case"at":case"wa":e.push(" ",h.type," ",Y(h.x-this.arcScaleX_*h.radius),",",Y(h.y-this.arcScaleY_*h.radius)," ",Y(h.x+this.arcScaleX_*h.radius),",",Y(h.y+this.arcScaleY_*h.radius)," ",Y(h.xStart),",",Y(h.yStart)," ",Y(h.xEnd),",",Y(h.yEnd))}h&&((null==n.x||h.x<n.x)&&(n.x=h.x),(null==a.x||h.x>a.x)&&(a.x=h.x),(null==n.y||h.y<n.y)&&(n.y=h.y),(null==a.y||h.y>a.y)&&(a.y=h.y))}if(e.push(' ">'),t)if("object"==typeof this.fillStyle){var l=this.fillStyle,c=0,u={x:0,y:0},_=0,f=1;if("gradient"==l.type_){var p=l.x1_/this.arcScaleX_,y=l.y1_/this.arcScaleY_,d=this.getCoords_(l.x0_/this.arcScaleX_,l.y0_/this.arcScaleY_),x=this.getCoords_(p,y);(c=180*Math.atan2(x.x-d.x,x.y-d.y)/Math.PI)<0&&(c+=360),c<1e-6&&(c=0)}else{d=this.getCoords_(l.x0_,l.y0_);var g=a.x-n.x,m=a.y-n.y;u={x:(d.x-n.x)/g,y:(d.y-n.y)/m},g/=this.arcScaleX_*L,m/=this.arcScaleY_*L;var v=X.max(g,m);_=2*l.r0_/v,f=2*l.r1_/v-_}var S=l.colors_;S.sort(function(t,e){return t.offset-e.offset});var w=S.length,C=S[0].color,b=S[w-1].color,T=S[0].alpha*this.globalAlpha,P=S[w-1].alpha*this.globalAlpha,k=[];for(o=0;o<w;o++){var E=S[o];k.push(E.offset*f+_+" "+E.color)}e.push('<g_vml_:fill type="',l.type_,'"',' method="none" focus="100%"',' color="',C,'"',' color2="',b,'"',' colors="',k.join(","),'"',' opacity="',P,'"',' g_o_:opacity2="',T,'"',' angle="',c,'"',' focusposition="',u.x,",",u.y,'" />')}else e.push('<g_vml_:fill color="',r,'" opacity="',s,'" />');else{var M=this.lineScale_*this.lineWidth;M<1&&(s*=M),e.push("<g_vml_:stroke",' opacity="',s,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',function(t){switch(t){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}(this.lineCap),'"',' weight="',M,'px"',' color="',r,'" />')}e.push("</g_vml_:shape>"),this.element_.insertAdjacentHTML("beforeEnd",e.join(""))},f.fill=function(){this.stroke(!0)},f.closePath=function(){this.currentPath_.push({type:"close"})},f.getCoords_=function(t,e){var i=this.m_;return{x:L*(t*i[0][0]+e*i[1][0]+i[2][0])-d,y:L*(t*i[0][1]+e*i[1][1]+i[2][1])-d}},f.save=function(){var t={};u(this,t),this.aStack_.push(t),this.mStack_.push(this.m_),this.m_=c([[1,0,0],[0,1,0],[0,0,1]],this.m_)},f.restore=function(){u(this.aStack_.pop(),this),this.m_=this.mStack_.pop()},f.translate=function(t,e){g(this,c([[1,0,0],[0,1,0],[t,e,1]],this.m_),!1)},f.rotate=function(t){var e=y(t),i=p(t);g(this,c([[e,i,0],[-i,e,0],[0,0,1]],this.m_),!1)},f.scale=function(t,e){this.arcScaleX_*=t,this.arcScaleY_*=e,g(this,c([[t,0,0],[0,e,0],[0,0,1]],this.m_),!0)},f.transform=function(t,e,i,r,s,n){g(this,c([[t,e,0],[i,r,0],[s,n,1]],this.m_),!0)},f.setTransform=function(t,e,i,r,s,n){g(this,[[t,e,0],[i,r,0],[s,n,1]],!0)},f.clip=function(){},f.arcTo=function(){},f.createPattern=function(){return new v},m.prototype.addColorStop=function(t,e){e=A(e),this.colors_.push({offset:t,color:e.color,alpha:e.alpha})},G_vmlCanvasManager=t,CanvasRenderingContext2D=_,CanvasGradient=m,CanvasPattern=v}();