=o)return K(!0)}else for(P=s,s++;;){if(-1===(P=a.indexOf(n,P+1)))return p||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:m.length,index:s}),$();if(P===v-1)return $(a.substring(s,P).replace(W,n));if(n!==c||a[P+1]!==c){if(n===c||0===P||a[P-1]!==c){-1!==D&&D=o)return K(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:m.length,index:s}),P++}}else P++}return $();function q(t){m.push(t),S=s}function N(t){var n=0;if(-1!==t){var e=a.substring(P+1,t);e&&""===e.trim()&&(n=e.length)}return n}function $(t){return p||(void 0===t&&(t=a.substring(s)),k.push(t),s=v,q(k),w&&Y()),K()}function H(t){s=t,q(k),k=[],F=a.indexOf(r,s)}function K(t){return{data:m,errors:x,meta:{delimiter:e,linebreak:r,aborted:l,truncated:!!t,cursor:S+(h||0)}}}function Y(){u(K()),m=[],x=[]}},this.abort=function(){l=!0},this.getCharIndex=function(){return s}}function g(t){var n=t.data,e=i[n.workerId],r=!1;if(n.error)e.userError(n.error,n.file);else if(n.results&&n.results.data){var u={abort:function(){r=!0,_(n.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(b(e.userStep)){for(var a=0;a=0?1/(Math.cos(2*Math.PI/10-n)+3.07768*Math.sin(2*Math.PI/10-n)):1/(Math.cos(n)+3.07768*Math.sin(n))};break}r.gridSize=Math.max(Math.floor(r.gridSize),4);var a,o,p,d,v,g,_,y,w=r.gridSize,m=w-r.maskGapWidth,b=Math.abs(r.maxRotation-r.minRotation),x=Math.min(r.maxRotation,r.minRotation),k=r.rotationStep;switch(r.color){case"random-dark":_=function(){return N(10,50)};break;case"random-light":_=function(){return N(50,90)};break;default:"function"===typeof r.color&&(_=r.color);break}"function"===typeof r.fontWeight&&(y=r.fontWeight);var S=null;"function"===typeof r.classes&&(S=r.classes);var E,I=!1,C=[],R=function(t){var n,e,r=t.currentTarget,i=r.getBoundingClientRect();t.touches?(n=t.touches[0].clientX,e=t.touches[0].clientY):(n=t.clientX,e=t.clientY);var u=n-i.left,a=e-i.top,o=Math.floor(u*(r.width/i.width||1)/w),f=Math.floor(a*(r.height/i.height||1)/w);return C[o]?C[o][f]:null},A=function(t){var n=R(t);E!==n&&(E=n,n?r.hover(n.item,n.dimension,t):r.hover(void 0,void 0,t))},O=function(t){var n=R(t);n&&(r.click(n.item,n.dimension,t),t.preventDefault())},M=[],T=function(t){if(M[t])return M[t];var n=8*t,e=n,i=[];0===t&&i.push([d[0],d[1],0]);while(e--){var u=1;"circle"!==r.shape&&(u=r.shape(e/n*2*Math.PI)),i.push([d[0]+t*u*Math.cos(-e/n*2*Math.PI),d[1]+t*u*Math.sin(-e/n*2*Math.PI)*r.ellipticity,e/n*2*Math.PI])}return M[t]=i,i},j=function(){return r.abortThreshold>0&&(new Date).getTime()-g>r.abortThreshold},z=function(){return 0===r.rotateRatio||Math.random()>r.rotateRatio?0:0===b?x:x+Math.round(Math.random()*b/k)*k},L=function(t,n,e,i){var u=!1,a=r.weightFactor(n);if(a<=r.minSize)return!1;var o,f=1;aT[1]&&(T[1]=M),CT[2]&&(T[2]=C),u&&(l.fillStyle="rgba(255, 0, 0, 0.5)",l.fillRect(M*w,C*w,w-.5,w-.5));break t}}u&&(l.fillStyle="rgba(0, 0, 255, 0.5)",l.fillRect(M*w,C*w,w-.5,w-.5))}}return u&&(l.fillStyle="rgba(0, 255, 0, 0.5)",l.fillRect(T[3]*w,T[0]*w,(T[1]-T[3]+1)*w,(T[2]-T[0]+1)*w)),{mu:f,occupied:O,bounds:T,gw:k,gh:x,fillTextOffsetX:m,fillTextOffsetY:b,fillTextWidth:h,fillTextHeight:p,fontSize:a}},D=function(t,n,e,i,u){var f=u.length;while(f--){var c=t+u[f][0],s=n+u[f][1];if(c>=o||s>=p||c<0||s<0){if(!r.drawOutOfBound)return!1}else if(!a[c][s])return!1}return!0},F=function(n,e,i,u,a,o,f,c,s,l){var h,p,d,v=i.fontSize;h=_?_(u,a,v,o,f,l):r.color,p=y?y(u,a,v,l):r.fontWeight,d=S?S(u,a,v,l):r.classes,t.forEach((function(t){if(t.getContext){var a=t.getContext("2d"),o=i.mu;a.save(),a.scale(1/o,1/o),a.font=p+" "+(v*o).toString(10)+"px "+r.fontFamily,a.fillStyle=h,a.translate((n+i.gw/2)*w*o,(e+i.gh/2)*w*o),0!==c&&a.rotate(-c),a.textBaseline="middle",a.fillText(u,i.fillTextOffsetX*o,(i.fillTextOffsetY+.5*v)*o),a.restore()}else{var f=document.createElement("span"),l="";l="rotate("+-c/Math.PI*180+"deg) ",1!==i.mu&&(l+="translateX(-"+i.fillTextWidth/4+"px) scale("+1/i.mu+")");var g={position:"absolute",display:"block",font:p+" "+v*i.mu+"px "+r.fontFamily,left:(n+i.gw/2)*w+i.fillTextOffsetX+"px",top:(e+i.gh/2)*w+i.fillTextOffsetY+"px",width:i.fillTextWidth+"px",height:i.fillTextHeight+"px",lineHeight:v+"px",whiteSpace:"nowrap",transform:l,webkitTransform:l,msTransform:l,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};for(var _ in h&&(g.color=h),f.textContent=u,g)f.style[_]=g[_];if(s)for(var y in s)f.setAttribute(y,s[y]);d&&(f.className+=d),t.appendChild(f)}}))},W=function(n,e,r,i,u){if(!(n>=o||e>=p||n<0||e<0)){if(a[n][e]=!1,r){var f=t[0].getContext("2d");f.fillRect(n*w,e*w,m,m)}I&&(C[n][e]={item:u,dimension:i})}},P=function(n,e,i,u,a,f){var c,s,l=a.occupied,h=r.drawMask;if(h&&(c=t[0].getContext("2d"),c.save(),c.fillStyle=r.maskColor),I){var d=a.bounds;s={x:(n+d[3])*w,y:(e+d[0])*w,w:(d[1]-d[3]+1)*w,h:(d[2]-d[0]+1)*w}}var v=l.length;while(v--){var g=n+l[v][0],_=e+l[v][1];g>=o||_>=p||g<0||_<0||W(g,_,h,s,f)}h&&c.restore()},B=function t(n,e){if(e>20)return null;var i,u,a;Array.isArray(n)?(i=n[0],u=n[1]):(i=n.word,u=n.weight,a=n.attributes);var f=z(),c=s(n),h=L(i,u,f,c);if(!h)return!1;if(j())return!1;if(!r.drawOutOfBound&&!r.shrinkToFit){var d=h.bounds;if(d[1]-d[3]+1>o||d[2]-d[0]+1>p)return!1}var g=v+1,_=function(t){var e=Math.floor(t[0]-h.gw/2),r=Math.floor(t[1]-h.gh/2),o=h.gw,s=h.gh;return!!D(e,r,o,s,h.occupied)&&(F(e,r,h,i,u,v-g,t[2],f,a,c),P(e,r,o,s,h,n),{gx:e,gy:r,rot:f,info:h})};while(g--){var y=T(v-g);r.shuffle&&(y=[].concat(y),l(y));for(var w=0;w=r.list.length)return l(h[e]),U("wordcloudstop",!1),R("wordcloudstart",M),void delete h[e];g=(new Date).getTime();var n=B(r.list[c],0),i=!U("wordclouddrawn",!0,{item:r.list[c],drawn:n});if(j()||i)return l(h[e]),r.abort(),U("wordcloudabort",!1),U("wordcloudstop",!1),void R("wordcloudstart",M);c++,h[e]=s(t,r.wait)}}),r.wait)}};q()}function N(t,n){return"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(n-t)+t).toFixed()+"%)"}};p.isSupported=f,p.minFontSize=c;var d=p;if(!d.isSupported)throw new Error("Sorry your browser not support wordCloud");function v(t){for(var n=t.getContext("2d"),e=n.getImageData(0,0,t.width,t.height),r=n.createImageData(e),i=0,u=0,a=0;a128){var f=e.data[a]+e.data[a+1]+e.data[a+2];i+=f,++u}}var c=i/u;for(a=0;ac?(r.data[a]=0,r.data[a+1]=0,r.data[a+2]=0,r.data[a+3]=0):(r.data[a]=255,r.data[a+1]=255,r.data[a+2]=255,r.data[a+3]=255)}n.putImageData(r,0,0)}function g(t,n){var e=t.width,r=t.height;e>r*n?(t.x+=(e-r*n)/2,t.width=r*n):(t.y+=(r-e/n)/2,t.height=e/n)}r["J"]((function(t,n){t.eachSeriesByType("wordCloud",(function(e){var i=r["A"].getLayoutRect(e.getBoxLayoutParams(),{width:n.getWidth(),height:n.getHeight()}),u=e.get("keepAspect"),a=e.get("maskImage"),o=a?a.width/a.height:1;u&&g(i,o);var f=e.getData(),c=document.createElement("canvas");c.width=i.width,c.height=i.height;var s=c.getContext("2d");if(a)try{s.drawImage(a,0,0,c.width,c.height),v(c)}catch(m){console.error("Invalid mask image"),console.error(m.toString())}var l=e.get("sizeRange"),h=e.get("rotationRange"),p=f.getDataExtent("value"),_=Math.PI/180,y=e.get("gridSize");function w(t){var n=t.detail.item;t.detail.drawn&&e.layoutInstance.ondraw&&(t.detail.drawn.gx+=i.x/y,t.detail.drawn.gy+=i.y/y,e.layoutInstance.ondraw(n[0],n[1],n[2],t.detail.drawn))}d(c,{list:f.mapArray("value",(function(t,n){var e=f.getItemModel(n);return[f.getName(n),e.get("textStyle.fontSize",!0)||r["E"].linearMap(t,p,l),n]})).sort((function(t,n){return n[1]-t[1]})),fontFamily:e.get("textStyle.fontFamily")||e.get("emphasis.textStyle.fontFamily")||t.get("textStyle.fontFamily"),fontWeight:e.get("textStyle.fontWeight")||e.get("emphasis.textStyle.fontWeight")||t.get("textStyle.fontWeight"),gridSize:y,ellipticity:i.height/i.width,minRotation:h[0]*_,maxRotation:h[1]*_,clearCanvas:!a,rotateRatio:1,rotationStep:e.get("rotationStep")*_,drawOutOfBound:e.get("drawOutOfBound"),shrinkToFit:e.get("shrinkToFit"),layoutAnimation:e.get("layoutAnimation"),shuffle:!1,shape:e.get("shape")}),c.addEventListener("wordclouddrawn",w),e.layoutInstance&&e.layoutInstance.dispose(),e.layoutInstance={ondraw:null,dispose:function(){c.removeEventListener("wordclouddrawn",w),c.addEventListener("wordclouddrawn",(function(t){t.preventDefault()}))}}}))})),r["P"]((function(t){var n=(t||{}).series;!r["ab"].isArray(n)&&(n=n?[n]:[]);var e=["shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function i(t){t&&r["ab"].each(e,(function(n){t.hasOwnProperty(n)&&(t["text"+r["u"].capitalFirst(n)]=t[n])}))}r["ab"].each(n,(function(t){if(t&&"wordCloud"===t.type){var n=t.textStyle||{};i(n.normal),i(n.emphasis)}}))}))}}]);