var goog=goog||{};goog.global=this;goog.exportPath_=function(name,opt_object,opt_objectToExportTo){var parts=name.split(".");var cur=opt_objectToExportTo||goog.global;if(!(parts[0]in cur)&&cur.execScript)cur.execScript("var "+parts[0]);for(var part;parts.length&&(part=parts.shift());)if(!parts.length&&opt_object!==undefined)cur[part]=opt_object;else if(cur[part])cur=cur[part];else cur=cur[part]={}}; goog.exportSymbol=function(publicPath,object,opt_objectToExportTo){goog.exportPath_(publicPath,object,opt_objectToExportTo)};goog.exportProperty=function(object,publicName,symbol){object[publicName]=symbol};function aa(l){l&&l.preventDefault?l.preventDefault():window.event&&(window.event.returnValue=!1)}function ba(l){l&&l.stopPropagation?l.stopPropagation():window.event&&(window.event.cancelBubble=!0)} function m(l){function L(){var a=n.getBoundingClientRect().width,b=n.getBoundingClientRect().height;n.width=a*p;n.height=b*p;f.scale(p,p);n.style.backgroundColor=n.style.backgroundColor}function I(a,b,c){window.getSelection()?window.getSelection().removeAllRanges():document.selection.empty();f.save();f.moveTo(a,b);F=G/2*(B/320);N&&(J(document,"mousemove",N),J(document,"touchmove",N),J(document,"mouseup",M),J(document,"touchend",M));"touchstart"==c?(O(document,"touchmove",N),O(document,"touchend", M)):(O(document,"mousemove",N),O(document,"mouseup",M));x=null;R(a,b)}function R(a,b){var c,d;if(u.length&&(c=u[u.length-1],d=Math.sqrt((c.x-a)*(c.x-a)+(c.y-b)*(c.y-b)),!d))return;ka++;navigator.userAgent.match(/ OS (\d+).*? Mac OS/)&&!ca&&2==u.length&&4*c3*H.a&&(g/=4,h=1);ca=1;b||(b=ma(g));X=b;if(h)for(h=1;3>=h;h++)na(c+h/3*(x.x-c),d+h/3*(x.y-d),g)}na(c,d,g);x=a}}function ma(a){var b=B/320*G;return.65*(a<.003125*B?1.2*b:a<.00625*B?1.15*b:a<.009375*B?1.1*b:a<.015625*B?1.05*b:a<.021875*B?b:a<.028125*B?.95*b:a<.034375*B?.9*b:a<.046875*B?.85*b:a<.0625*B?.8*b:.75*b)}function na(a,b,c){var d={x:a,y:b},g=F;f.fillStyle=C;f.strokeStyle=C;if(x){a=Math.floor(Math.abs(c)/(F/3));if(1B/320*G*.025&&(g=F-(F-X)/8);a=Math.abs(F-g);1<=a&&(g=F>g?g+.4*a:g-.4*a);a=null;if(0=a.length?P=null:P=a[1]}else 2<=u.length&&((g=u[1].a)&&(F=ma(g)),F+=2),f.beginPath(),f.fillStyle=C,f.arc(a,b,F,0,2*Math.PI),f.fill(),f.closePath()}function oa(a,b){return Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2))}function Q(){D&&M(null)}function da(a){aa(a);ba(a);Q();if("edit"===w){var b,c;if("touchstart"==a.type){if(2<=a.touches.length)return;b=a.touches[0].pageX;c=a.touches[0].pageY;J(n,"mousedown", da)}else a.pageX?(b=a.pageX,c=a.pageY):(b=a.clientX,c=a.clientY);pa()||(canvasRect=n.getBoundingClientRect(),canvasRect={left:canvasRect.left+(window.scrollX||window.pageXOffset),top:canvasRect.top+(window.scrollY||window.pageYOffset)},b-=canvasRect.left,c-=canvasRect.top,D={time:new Date,points:[{x:b,y:c,t:0}],color:C,penSize:G},I(b,c,a.type))}}function N(a){aa(a);ba(a);if("edit"===w){var b;if("touchmove"==a.type){if(2<=a.touches.length)return;b=a.touches[0].pageX;a=a.touches[0].pageY}else a.pageX? (b=a.pageX,a=a.pageY):(b=a.clientX,a=a.clientY);b-=canvasRect.left;a-=canvasRect.top;pa()?M(null):(D.points.push({x:b,y:a,t:new Date-D.time}),R(b,a))}}function M(a){aa(a);ba(a);"edit"===w&&(U(),k.length?D.time-=qa:(qa=D.time,D.time=D.time.getTime()),k.push(D),S=null,V=[],D=null)}function pa(){var a=0;D&&(a+=D.points.length);for(var b=0;bua?!0:!1}function ea(){"play"==w&&(w=Y,clearTimeout(T),W());"edit"===w&&(x=null,e=[-1,-1,-1,-1],ka=0,k.length&&(S=k), k=[],f.beginPath(),f.clearRect(0,0,n.width,n.height),f.closePath())}function U(){J(document,"mousemove",N);J(document,"touchmove",N);J(document,"mouseup",M);J(document,"touchend",M);for(var a;u.length;)a=u.shift(),la(a,B/320*G/8)}function ra(){function a(){C=b;G=c;K>=k.length?w=Y:(clearTimeout(T),T=setTimeout(function(){ra()},300))}var b=C,c=G,d=k[K];if(d&&"play"==w){C=d.color;G=d.penSize;I(d.points[0].x,d.points[0].y);1==d.points.length&&(U(),a());var g=1,e,h=0;e=d.points[g];(function(){e&&(R(e.x, e.y),g>=d.points.length-1&&(U(),a()),g++,e=d.points[g])&&(clearTimeout(T),T=setTimeout(arguments.callee,e.t-h),h=e.t)})();K++}}function W(){function a(){C=b;G=c;K>=k.length&&(w="edit")}var b=C,c=G;f.clearRect(0,0,n.width,n.height);f.beginPath();K=0;for(var d=k[K];d;){C=d.color;G=d.penSize;I(d.points[0].x,d.points[0].y);1==d.points.length&&(U(),a());for(var g=1,e=1;g=d.points.length&&(U(),a())}K++;d=k[K]}}function fa(a,b,c,d){a.height=d;a.width= c;a.style.height=d/p+"px";a.style.width=c/p+"px";b.scale(p,p)}function sa(a,b){q+="getWritingRect start \n";e=[-1,-1,-1,-1];for(var c=0;cH-16?0:H-16,f=0>g-16?0:g-16;e[0]=0>e[0]?h:e[0];e[0]=e[0]>h?h:e[0];e[1]=e[1]e[2]?f:e[2];e[2]=e[2]>f?f:e[2];e[3]=e[3]a?a:e[1];e[3]=e[3]>b?b:e[3];for(c=0;ca)return null;var b=Math.floor(a/4294967295);a%=4294967295;var c=[],d=[];if(b){do c.push(b&255),b>>>=8;while(b);d.push.apply(d,c.reverse())}c= [];do c.push(a&255),a>>>=8;while(a);d.push.apply(d,c.reverse());return d}function t(a){if(!a||0==a.length)return null;var b=4a.S||0>b?null:a.slice(b,c)}function z(a,b){var c=[],d=ha(a);if(null==d)return null;if(d.length>b){for(var g=0;g=a&&.9<=b&&1.1>=b||(L(),q+="[window-resize canvas.width + canvas.height] ="+n.width/p+"_"+n.height/p,ea(),q+="[window-resize function] end \n")});var p=(window.devicePixelRatio|| 1)/1,k=[],V=[],F=1,X=1,C="rgb(0,0,0)",G=8,B=320,ka=0,D=null,S=null,w="edit",e=[-1,-1,-1,-1],ta=.4,x=null,P=null,u=[],ca=0,qa=null,K=0,Y="edit",T=null,f=n.getContext("2d"),ua=5E4,q="";(function(){L();ea();n.getContext&&(f.strokeStyle=C,f.fillStyle=C,O(n,"selectstart",function(){return!1}),O(n,"touchstart",da),O(n,"mousedown",da))})();this.C=function(){for(var a="4.5.0.3";0<=a.indexOf(".");)a=a.replace(".","");return z(parseInt(a),2)};this.j=function(a){var b=a.match(/(\d+)/g);a=[];if(b)for(var c=0;c< b.length;c++)a.push.apply(a,ha(b[c]));for(b=a.length;3>b;b++)a.push(0);return a};this.c=function(a){G=1==a&&18||2==a&&12||3==a&&8||4==a&&6||5==a&&3||8};this.R=function(a,b,c){C="rgb("+a+","+b+","+c+")"};this.g=function(){Q();return!!V.length};this.f=function(){Q();if("edit"===w)if(S&&S.length)k=S,S=null,W();else if(k.length){var a=k.pop();V.push([a]);W()}};this.L=function(){Q();"edit"===w&&V.length&&(k=k.concat(V.pop()),W())};this.O=function(){Q();0!=k.length&&("play"==w?(w=Y,clearTimeout(T),W()): (Y=w,w="play",f.clearRect(0,0,n.width,n.height),f.beginPath(),K=0,ra()))};this.D=function(){return 0!=k.length&&"play"==w?!0:!1};this.h=function(){q+="_clear start \n";ea();q+="_clear end \n"};this.l=function(){Q();q+="_getHandWritingData start \n";if(0>=k.length)return null;var a=navigator.userAgent.match(/\([^\)]*\)[^\(]*\([^\)]*\)\s(.*)/);a&&0A&&(h[0]|=128),A=h):A=null;g.push.apply(g,A)}c.push.apply(c,b);c.push.apply(c,a);c.push.apply(c,g)}q+="_getHandWritingData end \n";return c};this.b=function(){Q(); q+="_getHandWritingPng start \n";if(0>=k.length)return null;sa(f.canvas.width,f.canvas.height);for(var a=f.getImageData(e[0],e[2],e[1]-e[0],e[3]-e[2]),b,c=b=0;cb)return null;q+="_getHandWritingPng end(callback == null) \n";q+="convertImgToBase64URL start \n";b=document.createElement("CANVAS");ctx=b.getContext("2d");fa(b,ctx,a.width,a.height);ctx.putImageData(a,0,0);dataURL=b.toDataURL("image/png"); q+="convertImgToBase64URL end \n";return dataURL};this.w=function(a,b,c){if(!(0>=a||0>=b)){var d=this.b();if(2!==(d?d.split(","):"").length)c?c(null):null;else{sa(f.canvas.width,f.canvas.height);var g=[e[1]-e[0],e[3]-e[2]],k=document.createElement("CANVAS"),h=k.getContext("2d");fa(k,h,a,b);var n=new Image;n.src=d;n.onload=function(){var d,e,f,l;g[0]>Math.round(a/b*g[1])?(f=a,l=Math.round(g[1]/g[0]*a),d=0,e=Math.round((b-l)/2)):(l=b,f=Math.round(g[0]/g[1]*b),d=Math.round((a-f)/2),e=0);h.drawImage(n, d/p,e/p,f/p,l/p);d=k.toDataURL("image/png");c?c(d):null}}}};this.F=function(a,b,c,d){if(!(0>=a||0>=b||0>=c.length)){var e=document.createElement("CANVAS"),f=e.getContext("2d");fa(e,f,a,b);a=Math.floor(a/d);b=Math.floor(b/Math.ceil(c.length/d));for(var h=1;h<=c.length;h++)f.drawImage(c[h-1],(h-1)%d*a/p,(Math.ceil(h/d)*b-b)/p,a/p,b/p);return e.toDataURL("image/png")}};this.A=function(){var a=q+="userAgent \u4fe1\u606f:"+navigator.userAgent+"\n";q="";return a};this.H=function(a){if(a){var b=0,c=t(v(a, b,2)),d=0;4101z?z=3:18