realchart 1.4.27 → 1.4.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vector.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Vector v1.4.27
3
+ * RealChart Vector v1.4.29
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartVector={},e.RealChart)}(this,(function(e,t){"use strict";function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var n=s(t);class i extends t.DataPoint{_assignTo(e){return t.assignObj(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,s){if(s.length<=2)this.isNull=!0;else{const n=s.length>3?1:0;n>0&&(this.x=s[t.pickNum(e.options.xField,0)]),this.y=s[t.pickNum(e.options.yField,0+n)],this.length=s[t.pickNum(e.options.lengthField,1+n)],this.angle=s[t.pickNum(e.options.angleField,2+n)]}}_readObject(e,s){super._readObject(e,s),this.length=t.pickProp(s[e.options.lengthField],s.length),this.angle=t.pickProp(s[e.options.angleField],s.angle),this.y=t.pickProp3(e._yFielder(s),s.y,s.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,s){this.lengthValue=t.incv(e.lengthValue,this.lengthValue,s)}}class r extends t.ConnectableSeries{_createPoint(e){return new i(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const s=this._op.maxLength,n=this._op.origin,i=e.map((e=>e.length)).reduce(((e,s)=>t.maxv(e,s)));e.forEach((e=>{const t=e.length/i;switch(e._len=t*s,n){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}}))}}_createLegendMarker(e,s){const n=.3,i=.7*s,r=[0,-n*s,-.2*s,-n*s,0,-.6*s,.2*s,-n*s,0,-n*s,0,.6*s],a=["M",r[0],r[1]+i];for(let e=2;e<r.length;e+=2)a.push("L",r[e],r[e+1]+i);const o=new t.PathElement(e,t.Series.LEGEND_MARKER).setPath(a);return o.setStyle("strokeWidth","2px"),o.rotation=30,o}}r.type=t.VectorSeriesType,r.defaults=t.extend(t.Series.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class a extends t.PointElement{layout(e,t,s){const n=this.point._len,i=n*s,r=.5;let a,o=(n-i)/2;switch(e){case"none":a=[0,o-r*i,0,o+r*i];break;case"open":const e=.15,t=.45,s=.2;a=[0,o-t*i,0-e*i,o-s*i,0,o-r*i,0+e*i,o-s*i,0,o-t*i,0,o+r*i];break;default:const n=.1,l=.3;a=[0,o-l*i,0-n*i,o-l*i,0,o-r*i,0+n*i,o-l*i,0,o-l*i,0,o+r*i]}const l=this.point._off*s,h=["M",a[0],a[1]+l];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+l);this.rotation=t,this.setPath(h)}}class o extends t.SeriesView{constructor(e){super(e,"rct-vector-series"),this._arrows=new t.PointViewPool(this._pointContainer,a)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let n=s.options.startAngle;const i=s.options.arrowHead,r=s._xAxisObj,a=s._yAxisObj,o=this._inverted,l=o?e:t,h=o?t:e,u=this._getGrowRate(),g=o?0:t,c=r.options.reversed?-1:1,p=a.options.reversed;this._pointContainer.invert(o,t),this._arrows.forEach((e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=r.getPos(h,t.xValue),d=g-a.getPos(l,t.yValue);let _=n+t.angleValue*c;p&&(_=180-_),t.xPos=o?g+a.getPos(l,t.yValue):s,t.yPos=o?h-r.getPos(h,t.xValue):d,e.trans(s,d),e.layout(i,_,u)}}))}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,((s,n)=>{const i=s.point=t[n];this._setPointStyle(s,e,i)}))}}function l(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(r),e.SeriesView.register([r,o]))}l(n),e.VectorSeries=r,e.default=l,Object.defineProperty(e,"__esModule",{value:!0})}));
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartVector={},e.RealChart)}(this,function(e,t){"use strict";function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,Object.freeze(t)}var n=s(t);class i extends t.DataPoint{_assignTo(e){return t.assignObj(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,s){if(s.length<=2)this.isNull=!0;else{const n=s.length>3?1:0;n>0&&(this.x=s[t.pickNum(e.options.xField,0)]),this.y=s[t.pickNum(e.options.yField,0+n)],this.length=s[t.pickNum(e.options.lengthField,1+n)],this.angle=s[t.pickNum(e.options.angleField,2+n)]}}_readObject(e,s){super._readObject(e,s),this.length=t.pickProp(s[e.options.lengthField],s.length),this.angle=t.pickProp(s[e.options.angleField],s.angle),this.y=t.pickProp3(e._yFielder(s),s.y,s.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,s){this.lengthValue=t.incv(e.lengthValue,this.lengthValue,s)}}class r extends t.ConnectableSeries{_createPoint(e){return new i(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const s=this._op.maxLength,n=this._op.origin,i=e.map(e=>e.length).reduce((e,s)=>t.maxv(e,s));e.forEach(e=>{const t=e.length/i;switch(e._len=t*s,n){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,s){const n=.3,i=.7*s,r=[0,-n*s,-.2*s,-n*s,0,-.6*s,.2*s,-n*s,0,-n*s,0,.6*s],a=["M",r[0],r[1]+i];for(let e=2;e<r.length;e+=2)a.push("L",r[e],r[e+1]+i);const o=new t.PathElement(e,t.Series.LEGEND_MARKER).setPath(a);return o.setStyle("strokeWidth","2px"),o.rotation=30,o}}r.type=t.VectorSeriesType,r.defaults=t.extend(t.Series.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class a extends t.PointElement{layout(e,t,s){const n=this.point._len,i=n*s,r=.5;let a,o=(n-i)/2;switch(e){case"none":a=[0,o-r*i,0,o+r*i];break;case"open":const e=.15,t=.45,s=.2;a=[0,o-t*i,0-e*i,o-s*i,0,o-r*i,0+e*i,o-s*i,0,o-t*i,0,o+r*i];break;default:const n=.1,l=.3;a=[0,o-l*i,0-n*i,o-l*i,0,o-r*i,0+n*i,o-l*i,0,o-l*i,0,o+r*i]}const l=this.point._off*s,h=["M",a[0],a[1]+l];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+l);this.rotation=t,this.setPath(h)}}class o extends t.SeriesView{constructor(e){super(e,"rct-vector-series"),this._arrows=new t.PointViewPool(this._pointContainer,a)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let n=s.options.startAngle;const i=s.options.arrowHead,r=s._xAxisObj,a=s._yAxisObj,o=this._inverted,l=o?e:t,h=o?t:e,u=this._getGrowRate(),g=o?0:t,c=r.options.reversed?-1:1,p=a.options.reversed;this._pointContainer.invert(o,t),this._arrows.forEach(e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=r.getPos(h,t.xValue),d=g-a.getPos(l,t.yValue);let _=n+t.angleValue*c;p&&(_=180-_),t.xPos=o?g+a.getPos(l,t.yValue):s,t.yPos=o?h-r.getPos(h,t.xValue):d,e.trans(s,d),e.layout(i,_,u)}})}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,n)=>{const i=s.point=t[n];this._setPointStyle(s,e,i)})}}function l(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(r),e.SeriesView.register([r,o]))}l(n),e.VectorSeries=r,e.default=l,Object.defineProperty(e,"__esModule",{value:!0})});
package/vector.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Vector v1.4.27
3
+ * RealChart Vector v1.4.29
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- import{VectorSeriesType as e,extend as t,Series as s,ConnectableSeries as n,maxv as i,PathElement as r,DataPoint as a,assignObj as l,pickNum as o,pickProp as h,pickProp3 as g,incv as u,SeriesView as p,PointViewPool as _,SeriesAnimation as d,PointElement as c}from"./index.mjs";class f extends a{_assignTo(e){return l(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,t){if(t.length<=2)this.isNull=!0;else{const s=t.length>3?1:0;s>0&&(this.x=t[o(e.options.xField,0)]),this.y=t[o(e.options.yField,0+s)],this.length=t[o(e.options.lengthField,1+s)],this.angle=t[o(e.options.angleField,2+s)]}}_readObject(e,t){super._readObject(e,t),this.length=h(t[e.options.lengthField],t.length),this.angle=h(t[e.options.angleField],t.angle),this.y=g(e._yFielder(t),t.y,t.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,t){this.lengthValue=u(e.lengthValue,this.lengthValue,t)}}class V extends n{_createPoint(e){return new f(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const t=this._op.maxLength,s=this._op.origin,n=e.map((e=>e.length)).reduce(((e,t)=>i(e,t)));e.forEach((e=>{const i=e.length/n;switch(e._len=i*t,s){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}}))}}_createLegendMarker(e,t){const n=.3,i=.7*t,a=[0,-n*t,-.2*t,-n*t,0,-.6*t,.2*t,-n*t,0,-n*t,0,.6*t],l=["M",a[0],a[1]+i];for(let e=2;e<a.length;e+=2)l.push("L",a[e],a[e+1]+i);const o=new r(e,s.LEGEND_MARKER).setPath(l);return o.setStyle("strokeWidth","2px"),o.rotation=30,o}}V.type=e,V.defaults=t(s.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class w extends c{layout(e,t,s){const n=this.point._len,i=n*s,r=.5;let a,l=(n-i)/2;switch(e){case"none":a=[0,l-r*i,0,l+r*i];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*i,0-e*i,l-s*i,0,l-r*i,0+e*i,l-s*i,0,l-t*i,0,l+r*i];break;default:const n=.1,o=.3;a=[0,l-o*i,0-n*i,l-o*i,0,l-r*i,0+n*i,l-o*i,0,l-o*i,0,l+r*i]}const o=this.point._off*s,h=["M",a[0],a[1]+o];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+o);this.rotation=t,this.setPath(h)}}class y extends p{constructor(e){super(e,"rct-vector-series"),this._arrows=new _(this._pointContainer,w)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let n=s.options.startAngle;const i=s.options.arrowHead,r=s._xAxisObj,a=s._yAxisObj,l=this._inverted,o=l?e:t,h=l?t:e,g=this._getGrowRate(),u=l?0:t,p=r.options.reversed?-1:1,_=a.options.reversed;this._pointContainer.invert(l,t),this._arrows.forEach((e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=r.getPos(h,t.xValue),d=u-a.getPos(o,t.yValue);let c=n+t.angleValue*p;_&&(c=180-c),t.xPos=l?u+a.getPos(o,t.yValue):s,t.yPos=l?h-r.getPos(h,t.xValue):d,e.trans(s,d),e.layout(i,c,g)}}))}_runShowEffect(e){e&&d.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,((s,n)=>{const i=s.point=t[n];this._setPointStyle(s,e,i)}))}}function P(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(V),e.SeriesView.register([V,y]))}export{V as VectorSeries,P as default};
7
+ import{VectorSeriesType as e,extend as t,Series as s,ConnectableSeries as n,maxv as i,PathElement as r,DataPoint as a,assignObj as l,pickNum as o,pickProp as h,pickProp3 as g,incv as u,SeriesView as p,PointViewPool as _,SeriesAnimation as d,PointElement as c}from"./index.mjs";class f extends a{_assignTo(e){return l(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,t){if(t.length<=2)this.isNull=!0;else{const s=t.length>3?1:0;s>0&&(this.x=t[o(e.options.xField,0)]),this.y=t[o(e.options.yField,0+s)],this.length=t[o(e.options.lengthField,1+s)],this.angle=t[o(e.options.angleField,2+s)]}}_readObject(e,t){super._readObject(e,t),this.length=h(t[e.options.lengthField],t.length),this.angle=h(t[e.options.angleField],t.angle),this.y=g(e._yFielder(t),t.y,t.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,t){this.lengthValue=u(e.lengthValue,this.lengthValue,t)}}class V extends n{_createPoint(e){return new f(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const t=this._op.maxLength,s=this._op.origin,n=e.map(e=>e.length).reduce((e,t)=>i(e,t));e.forEach(e=>{const i=e.length/n;switch(e._len=i*t,s){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,t){const n=.3,i=.7*t,a=[0,-n*t,-.2*t,-n*t,0,-.6*t,.2*t,-n*t,0,-n*t,0,.6*t],l=["M",a[0],a[1]+i];for(let e=2;e<a.length;e+=2)l.push("L",a[e],a[e+1]+i);const o=new r(e,s.LEGEND_MARKER).setPath(l);return o.setStyle("strokeWidth","2px"),o.rotation=30,o}}V.type=e,V.defaults=t(s.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class w extends c{layout(e,t,s){const n=this.point._len,i=n*s,r=.5;let a,l=(n-i)/2;switch(e){case"none":a=[0,l-r*i,0,l+r*i];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*i,0-e*i,l-s*i,0,l-r*i,0+e*i,l-s*i,0,l-t*i,0,l+r*i];break;default:const n=.1,o=.3;a=[0,l-o*i,0-n*i,l-o*i,0,l-r*i,0+n*i,l-o*i,0,l-o*i,0,l+r*i]}const o=this.point._off*s,h=["M",a[0],a[1]+o];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+o);this.rotation=t,this.setPath(h)}}class y extends p{constructor(e){super(e,"rct-vector-series"),this._arrows=new _(this._pointContainer,w)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let n=s.options.startAngle;const i=s.options.arrowHead,r=s._xAxisObj,a=s._yAxisObj,l=this._inverted,o=l?e:t,h=l?t:e,g=this._getGrowRate(),u=l?0:t,p=r.options.reversed?-1:1,_=a.options.reversed;this._pointContainer.invert(l,t),this._arrows.forEach(e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=r.getPos(h,t.xValue),d=u-a.getPos(o,t.yValue);let c=n+t.angleValue*p;_&&(c=180-c),t.xPos=l?u+a.getPos(o,t.yValue):s,t.yPos=l?h-r.getPos(h,t.xValue):d,e.trans(s,d),e.layout(i,c,g)}})}_runShowEffect(e){e&&d.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,n)=>{const i=s.point=t[n];this._setPointStyle(s,e,i)})}}function P(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(V),e.SeriesView.register([V,y]))}export{V as VectorSeries,P as default};
package/wordcloud.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Wordcloud v1.4.27
3
+ * RealChart Wordcloud v1.4.29
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,(function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this._op,s=i.text;let n=[];if(s){const t=Math.max(i.minLength||1,1),e={};let r=i.excludes,o=s.split(/\s+/g);Array.isArray(r)&&r.length>0&&(o=o.filter((t=>r.indexOf(t)<0))),o.forEach((i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)}));for(const t in e)n.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)n.push({x:e.toStr(t[i]),y:t[i+1]||0});n.length>0&&(t=n.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const a=Math.floor;class h{constructor(t){this._options=t}start(t,i,s,n,r,o){this._container=t;const a="circle"===s.frame||"ellipse"===s.frame,h=s.autoScale,l=e.pickNum(s.seed,0)*Math.PI*2/360,c=Math.max(0,e.pickNum(s.wordGap,0));let d=n,u=0,_=r,x=0,p=0;this._prepare(s,n,r),this._unit,this._startTime=Date.now(),i.forEach((t=>{const e=t.point;if(this._findPos(t,a,s.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),u=Math.max(u,i+n),_=Math.min(_,s),x=Math.max(x,s+r),p++}else t.setVis(!1)})),e.Utils.log("Words placed.",p,"of",i.length);const m=u-d,f=x-_,g=n/2,y=r/2,M=h?1/(Math.max(m/n,f/r)+.02):1,w=~~((d+m/2-g)*M),P=~~((_+f/2-y)*M);return this._trans={x:w,y:P,cx:g,cy:y,rate:M},i.forEach((t=>{const e=t.point;e.xPos=g-w+(e.xPos-g)*M,e.yPos=y-P+(e.yPos-y)*M})),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:i,y:s,cx:n,cy:r,rate:o}=this._trans;if(i=~~(i*t),s=~~(s*t),e.isIE){const e=o*t,a=n*(1-e),h=r*(1-e);this._container.trans(-i+a,-s+h),this._container.scale(e)}else this._container.dom.setAttribute("transform-origin",`${n} ${r}`),this._container.trans(-i,-s),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=Math.min(t*this._unit,64);let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,d=a+l,u=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:d},{x:c,y:d}].map((t=>({x:u+(t.x-u)*n-(t.y-_)*r,y:_+(t.x-u)*r+(t.y-_)*n}))),p=Math.min(...x.map((t=>t.x))),m=Math.min(...x.map((t=>t.y))),f=Math.max(...x.map((t=>t.x))),g=Math.max(...x.map((t=>t.y))),y=this._unit,M=f-p,w=g-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:p,y:m,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),d=Math.ceil(l/2),u=Math.max(0,e-c),_=Math.max(0,i-d),x=u+Math.ceil(h),p=_+Math.ceil(l),m={x:(e-c)*r,y:(i-d)*r,width:o,height:a};return n?this._rotatePoint(m,n,s):{c1:u,r1:_,c2:x+s,r2:p,bounds:m}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=Date.now()-this._startTime;if(n>e.pickNum(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${n} ms 경과하여 중단합니다.`);const d=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(d);if(d.some(((i,s)=>{let n=this._options.rotation?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}})))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,d=c*Math.cos(l)/n,u=c*Math.sin(l),_=s.c+d,x=s.r+u;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const d=Math.max(1,this._unit>>1),u=d-Math.max(1,d>>1),_=.99;for(;++o>=0;){e=1+u*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class d extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.PointViewPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,i){const s=this.model.options,n=s.text;if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();if(s.minWeight>0&&(o=o.filter((t=>t.yValue>=s.minWeight))),s.minLength>1&&(o=o.filter((t=>t.x.length>=s.minLength))),s.maxCount<o.length&&(o.length=Math.max(0,s.maxCount)),this.$_prepareWords(this.doc,this.model,o),"spiral"===s.placer)this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,(e=>{this.$_layoutWords(t,i)}));this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const d=n===r||l===h,u=d?NaN:i.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.options.textHeight)),p=isNaN(x)?t.createElement("canvas").getContext("2d"):null,m=1-c.TOP_PAD;let f;this._words.prepare(s.length,((r,a)=>{const c=r.point=s[a],g=r.textView;r._bbox=null;let y=(c.y-n)/o;u>1&&(y=1-(Math.pow(u,1-y)-1)/(u-1));let M=l+(d?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),p?(p.font=`${e.pixel(M)} ${_}`,f=p.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*m):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function u(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,d]))}u(s),t.WordCloudSeries=o,t.default=u,Object.defineProperty(t,"__esModule",{value:!0})}));
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this._op,s=i.text;let n=[];if(s){const t=Math.max(i.minLength||1,1),e={};let r=i.excludes,o=s.split(/\s+/g);Array.isArray(r)&&r.length>0&&(o=o.filter(t=>r.indexOf(t)<0)),o.forEach(i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)});for(const t in e)n.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)n.push({x:e.toStr(t[i]),y:t[i+1]||0});n.length>0&&(t=n.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const a=Math.floor;class h{constructor(t){this._options=t}start(t,i,s,n,r,o){this._container=t;const a="circle"===s.frame||"ellipse"===s.frame,h=s.autoScale,l=e.pickNum(s.seed,0)*Math.PI*2/360,c=Math.max(0,e.pickNum(s.wordGap,0));let d=n,u=0,_=r,x=0,p=0;this._prepare(s,n,r),this._unit,this._startTime=Date.now(),i.forEach(t=>{const e=t.point;if(this._findPos(t,a,s.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),u=Math.max(u,i+n),_=Math.min(_,s),x=Math.max(x,s+r),p++}else t.setVis(!1)}),e.Utils.log("Words placed.",p,"of",i.length);const m=u-d,f=x-_,g=n/2,y=r/2,M=h?1/(Math.max(m/n,f/r)+.02):1,w=~~((d+m/2-g)*M),P=~~((_+f/2-y)*M);return this._trans={x:w,y:P,cx:g,cy:y,rate:M},i.forEach(t=>{const e=t.point;e.xPos=g-w+(e.xPos-g)*M,e.yPos=y-P+(e.yPos-y)*M}),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:i,y:s,cx:n,cy:r,rate:o}=this._trans;if(i=~~(i*t),s=~~(s*t),e.isIE){const e=o*t,a=n*(1-e),h=r*(1-e);this._container.trans(-i+a,-s+h),this._container.scale(e)}else this._container.dom.setAttribute("transform-origin",`${n} ${r}`),this._container.trans(-i,-s),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=Math.min(t*this._unit,64);let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,d=a+l,u=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:d},{x:c,y:d}].map(t=>({x:u+(t.x-u)*n-(t.y-_)*r,y:_+(t.x-u)*r+(t.y-_)*n})),p=Math.min(...x.map(t=>t.x)),m=Math.min(...x.map(t=>t.y)),f=Math.max(...x.map(t=>t.x)),g=Math.max(...x.map(t=>t.y)),y=this._unit,M=f-p,w=g-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:p,y:m,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),d=Math.ceil(l/2),u=Math.max(0,e-c),_=Math.max(0,i-d),x=u+Math.ceil(h),p=_+Math.ceil(l),m={x:(e-c)*r,y:(i-d)*r,width:o,height:a};return n?this._rotatePoint(m,n,s):{c1:u,r1:_,c2:x+s,r2:p,bounds:m}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=Date.now()-this._startTime;if(n>e.pickNum(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${n} ms 경과하여 중단합니다.`);const d=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(d);if(d.some((i,s)=>{let n=this._options.rotation?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}}))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,d=c*Math.cos(l)/n,u=c*Math.sin(l),_=s.c+d,x=s.r+u;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const d=Math.max(1,this._unit>>1),u=d-Math.max(1,d>>1),_=.99;for(;++o>=0;){e=1+u*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class d extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.PointViewPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,i){const s=this.model.options,n=s.text;if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();if(s.minWeight>0&&(o=o.filter(t=>t.yValue>=s.minWeight)),s.minLength>1&&(o=o.filter(t=>t.x.length>=s.minLength)),s.maxCount<o.length&&(o.length=Math.max(0,s.maxCount)),this.$_prepareWords(this.doc,this.model,o),"spiral"===s.placer)this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const d=n===r||l===h,u=d?NaN:i.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.options.textHeight)),p=isNaN(x)?t.createElement("canvas").getContext("2d"):null,m=1-c.TOP_PAD;let f;this._words.prepare(s.length,(r,a)=>{const c=r.point=s[a],g=r.textView;r._bbox=null;let y=(c.y-n)/o;u>1&&(y=1-(Math.pow(u,1-y)-1)/(u-1));let M=l+(d?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),p?(p.font=`${e.pixel(M)} ${_}`,f=p.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*m):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)})}}function u(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,d]))}u(s),t.WordCloudSeries=o,t.default=u,Object.defineProperty(t,"__esModule",{value:!0})});
package/wordcloud.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Wordcloud v1.4.27
3
+ * RealChart Wordcloud v1.4.29
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- import{WordCloudSeriesType as t,extend as e,WidgetSeries as i,calcPercent as s,parsePercentSize as n,Utils as o,toStr as r,WidgetSeriesPoint as a,RcElement as h,SeriesView as l,RectElement as c,TextElement as _,WidgetSeriesView as x,LayerElement as d,PointViewPool as u,SeriesAnimation as m,TextAnchor as p,pixel as g,pickNum as M,isIE as f}from"./index.mjs";class y extends a{}class w extends y{constructor(t,e){super(t),this.points=e}}class S extends i{$_denormalizeFontSize(t,e,i){let o,r;return"min"==t?(o=s(n(S.MinFontSize,!1),e),r=s(n(S.MaxMinFontSize,!1),e)):(o=s(n(S.MinMaxFontSize,!1),e),r=s(n(S.MaxFontSize,!1),e)),i>1?r:i<0?o:i*(r-o)+o}calcFontRatio(t,e,i,n){return s(e,i,n)}getMinFontSize(t,e){const{fixed:i,size:o}=this._minFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("min",t,o):s(this._minFontSizeDim,t,e);return Math.max(s(n(S.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:o}=this._maxFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("max",t,o):s(this._maxFontSizeDim,t,e);return Math.min(s(n(S.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new y(t)}_createOthersPoint(t,e){return t.y=e.map((t=>t.y)).reduce(((t,e)=>t+e)),new w(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||o.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this._op,i=e.text;let s=[];if(i){const t=Math.max(e.minLength||1,1),n={};let o=e.excludes,r=i.split(/\s+/g);Array.isArray(o)&&o.length>0&&(r=r.filter((t=>o.indexOf(t)<0))),r.forEach((e=>{e.length>=t&&(e in n?n[e]++:n[e]=1)}));for(const t in n)s.push({x:t,y:n[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)s.push({x:r(t[e]),y:t[e+1]||0});s.length>0&&(t=s.sort(((t,e)=>e.y-t.y))),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}S.type=t,S.MinFontSize=8,S.MaxMinFontSize=15,S.MaxFontSize="15%",S.MinMaxFontSize="5%",S.defaults=e(i.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const P=Math.floor;class b{constructor(t){this._options=t}start(t,e,i,s,n,r){this._container=t;const a="circle"===i.frame||"ellipse"===i.frame,h=i.autoScale,l=M(i.seed,0)*Math.PI*2/360,c=Math.max(0,M(i.wordGap,0));let _=s,x=0,d=n,u=0,m=0;this._prepare(i,s,n),this._unit,this._startTime=Date.now(),e.forEach((t=>{const e=t.point;if(this._findPos(t,a,i.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,_=Math.min(_,i),x=Math.max(x,i+n),d=Math.min(d,s),u=Math.max(u,s+o),m++}else t.setVis(!1)})),o.log("Words placed.",m,"of",e.length);const p=x-_,g=u-d,f=s/2,y=n/2,w=h?1/(Math.max(p/s,g/n)+.02):1,S=~~((_+p/2-f)*w),P=~~((d+g/2-y)*w);return this._trans={x:S,y:P,cx:f,cy:y,rate:w},e.forEach((t=>{const e=t.point;e.xPos=f-S+(e.xPos-f)*w,e.yPos=y-P+(e.yPos-y)*w})),this.$_transform(),null==r||r(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;if(e=~~(e*t),i=~~(i*t),f){const r=o*t,a=s*(1-r),h=n*(1-r);this._container.trans(-e+a,-i+h),this._container.scale(r)}else this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=P(e/s),this._rows=P(i/s),this._radius=P(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=Math.min(t*this._unit,64);let r=0,a=[];for(0===t&&a.push([s.c,s.r]);r<o;){const h=r/o*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:a,width:h,height:l}=t,c=r+h,_=a+l,x=r+h/2,d=a+l/2,u=[{x:r,y:a},{x:c,y:a},{x:r,y:_},{x:c,y:_}].map((t=>({x:x+(t.x-x)*n-(t.y-d)*o,y:d+(t.x-x)*o+(t.y-d)*n}))),m=Math.min(...u.map((t=>t.x))),p=Math.min(...u.map((t=>t.y))),g=Math.max(...u.map((t=>t.x))),M=Math.max(...u.map((t=>t.y))),f=this._unit,y=g-m,w=M-p;return{c1:Math.max(0,~~(m/f)),r1:Math.max(0,~~(p/f)),c2:~~(g/f),r2:~~(M/f)+i,bounds:{x:m,y:p,width:y,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),a=t.hText,h=r/o,l=a/o,c=Math.ceil(h/2),_=Math.ceil(l/2),x=Math.max(0,e-c),d=Math.max(0,i-_),u=x+Math.ceil(h),m=d+Math.ceil(l),p={x:(e-c)*o,y:(i-_)*o,width:r,height:a};return n?this._rotatePoint(p,n,s):{c1:x,r1:d,c2:u+s,r2:m,bounds:p}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,a=c.create(i,"",s,n,o,r);a.setFill((null==e?void 0:e.fill)||"#ff000055"),a.setStroke((null==e?void 0:e.stroke)||"none"),a.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(a)}_findPos(t,e,i,s,n,r){let a=0,h=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<s;){const s=Date.now()-this._startTime;if(s>M(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${s} ms 경과하여 중단합니다.`);const _=this._getPoints(a,e,n+h++%4*(Math.PI/4));i&&o.shuffle(_);if(_.some(((e,i)=>{let s=this._options.rotation?l[~~(o.randomLike(i+n)*c)]:0;const a=this._getBox(t,e[0],e[1],r,s);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],r),{bounds:n}=i,o={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(o.x,o.y,s),t.box=a,!0}})))return!0;a++}}}class z extends b{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some((e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0})))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*h,c=t*e,_=c*Math.cos(l)/n,x=c*Math.sin(l),d=s.c+_,u=s.r+x;a.push([~~d,~~u])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),x=_-Math.max(1,_>>1),d=.99;for(;++r>=0;){e=1+x*Math.pow(d,r),o=e/n;switch(3&(h*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,a=Math.min(2*this._radius,Math.max(0,e-P(o.width/2/n))),h=Math.min(2*this._radius,Math.max(0,i-P(r/2/n)));return{c1:a,r1:h,c2:a+P(o.width/n)+s,r2:h+P(r/n),w:t.width,h:r}}}class B extends h{constructor(t){super(t,l.POINT_CLASS),this.add(this.hintView=new c(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new _(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*B.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*B.TOP_PAD)}}B.TOP_PAD=.5;class F extends x{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new d(t,null)),this._words=new u(this._wordContainer,B)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,e){const i=this.model.options,s=i.text;if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let r=this._visPoints.slice();if(i.minWeight>0&&(r=r.filter((t=>t.yValue>=i.minWeight))),i.minLength>1&&(r=r.filter((t=>t.x.length>=i.minLength))),i.maxCount<r.length&&(r.length=Math.max(0,i.maxCount)),this.$_prepareWords(this.doc,this.model,r),"spiral"===i.placer)this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));else this._placer=new b(i).start(this._wordContainer,this._words._internalItems(),i,t,e,(i=>{this.$_layoutWords(t,e)}));this._wSave=t,this._hSave=e,this._tSave=s,this._empty=r.length<1,o.log(r.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&m.spread(this,(()=>{}))}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,a=e.getMaxFontSize(r,1);let h=Math.min(a,e.getMinFontSize(r,0));const l=s===n||h===a,c=l?NaN:e.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+e.options.textHeight)),d=isNaN(x)?t.createElement("canvas").getContext("2d"):null,u=1-B.TOP_PAD;let m;this._words.prepare(i.length,((n,r)=>{const M=n.point=i[r],f=n.textView;n._bbox=null;let y=(M.y-s)/o;c>1&&(y=1-(Math.pow(c,1-y)-1)/(c-1));let w=h+(l?(a-h)/2:y*(a-h));const S=M.x;this._preparePoint(t,e,M,n),delete n.box,f.text=S,f.anchor=p.START,f.setStyles({fontSize:g(w)}),f.layoutText(),d?(d.font=`${g(w)} ${_}`,m=d.measureText(S),n.yText=.9*Math.max(0,m.fontBoundingBoxAscent-m.actualBoundingBoxAscent),n.hText=Math.ceil((m.actualBoundingBoxAscent+m.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*u):(n.yText=0,n.hText=n.getBBox().height*x),n.layout(),n.setVis(!0)}))}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach((i=>{const{bounds:n}=i.box,o=n.width,r=n.height,a=(t-o)/2;let h=(e-r)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)}))}}function T(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(S),t.SeriesView.register([S,F]))}export{S as WordCloudSeries,T as default};
7
+ import{WordCloudSeriesType as t,extend as e,WidgetSeries as i,calcPercent as s,parsePercentSize as n,Utils as o,toStr as r,WidgetSeriesPoint as a,RcElement as h,SeriesView as l,RectElement as c,TextElement as _,WidgetSeriesView as x,LayerElement as d,PointViewPool as u,SeriesAnimation as m,TextAnchor as p,pixel as g,pickNum as M,isIE as f}from"./index.mjs";class y extends a{}class w extends y{constructor(t,e){super(t),this.points=e}}class S extends i{$_denormalizeFontSize(t,e,i){let o,r;return"min"==t?(o=s(n(S.MinFontSize,!1),e),r=s(n(S.MaxMinFontSize,!1),e)):(o=s(n(S.MinMaxFontSize,!1),e),r=s(n(S.MaxFontSize,!1),e)),i>1?r:i<0?o:i*(r-o)+o}calcFontRatio(t,e,i,n){return s(e,i,n)}getMinFontSize(t,e){const{fixed:i,size:o}=this._minFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("min",t,o):s(this._minFontSizeDim,t,e);return Math.max(s(n(S.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:o}=this._maxFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("max",t,o):s(this._maxFontSizeDim,t,e);return Math.min(s(n(S.MaxFontSize,!1),t),r)}getLogFunc(){const t=this._op.logBase;return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this._op.colorByPoint}_createPoint(t){return new y(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new w(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||o.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this._op,i=e.text;let s=[];if(i){const t=Math.max(e.minLength||1,1),n={};let o=e.excludes,r=i.split(/\s+/g);Array.isArray(o)&&o.length>0&&(r=r.filter(t=>o.indexOf(t)<0)),r.forEach(e=>{e.length>=t&&(e in n?n[e]++:n[e]=1)});for(const t in n)s.push({x:t,y:n[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)s.push({x:r(t[e]),y:t[e+1]||0});s.length>0&&(t=s.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}S.type=t,S.MinFontSize=8,S.MaxMinFontSize=15,S.MaxFontSize="15%",S.MinMaxFontSize="5%",S.defaults=e(i.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const P=Math.floor;class b{constructor(t){this._options=t}start(t,e,i,s,n,r){this._container=t;const a="circle"===i.frame||"ellipse"===i.frame,h=i.autoScale,l=M(i.seed,0)*Math.PI*2/360,c=Math.max(0,M(i.wordGap,0));let _=s,x=0,d=n,u=0,m=0;this._prepare(i,s,n),this._unit,this._startTime=Date.now(),e.forEach(t=>{const e=t.point;if(this._findPos(t,a,i.shuffle,this._radius,l,c)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,_=Math.min(_,i),x=Math.max(x,i+n),d=Math.min(d,s),u=Math.max(u,s+o),m++}else t.setVis(!1)}),o.log("Words placed.",m,"of",e.length);const p=x-_,g=u-d,f=s/2,y=n/2,w=h?1/(Math.max(p/s,g/n)+.02):1,S=~~((_+p/2-f)*w),P=~~((d+g/2-y)*w);return this._trans={x:S,y:P,cx:f,cy:y,rate:w},e.forEach(t=>{const e=t.point;e.xPos=f-S+(e.xPos-f)*w,e.yPos=y-P+(e.yPos-y)*w}),this.$_transform(),null==r||r(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;if(e=~~(e*t),i=~~(i*t),f){const r=o*t,a=s*(1-r),h=n*(1-r);this._container.trans(-e+a,-i+h),this._container.scale(r)}else this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=P(e/s),this._rows=P(i/s),this._radius=P(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[],this._ellipticity="ellipse"===t.frame||"rectangle"===t.frame?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=Math.min(t*this._unit,64);let r=0,a=[];for(0===t&&a.push([s.c,s.r]);r<o;){const h=r/o*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:a,width:h,height:l}=t,c=r+h,_=a+l,x=r+h/2,d=a+l/2,u=[{x:r,y:a},{x:c,y:a},{x:r,y:_},{x:c,y:_}].map(t=>({x:x+(t.x-x)*n-(t.y-d)*o,y:d+(t.x-x)*o+(t.y-d)*n})),m=Math.min(...u.map(t=>t.x)),p=Math.min(...u.map(t=>t.y)),g=Math.max(...u.map(t=>t.x)),M=Math.max(...u.map(t=>t.y)),f=this._unit,y=g-m,w=M-p;return{c1:Math.max(0,~~(m/f)),r1:Math.max(0,~~(p/f)),c2:~~(g/f),r2:~~(M/f)+i,bounds:{x:m,y:p,width:y,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),a=t.hText,h=r/o,l=a/o,c=Math.ceil(h/2),_=Math.ceil(l/2),x=Math.max(0,e-c),d=Math.max(0,i-_),u=x+Math.ceil(h),m=d+Math.ceil(l),p={x:(e-c)*o,y:(i-_)*o,width:r,height:a};return n?this._rotatePoint(p,n,s):{c1:x,r1:d,c2:u+s,r2:m,bounds:p}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,a=c.create(i,"",s,n,o,r);a.setFill((null==e?void 0:e.fill)||"#ff000055"),a.setStroke((null==e?void 0:e.stroke)||"none"),a.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(a)}_findPos(t,e,i,s,n,r){let a=0,h=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<s;){const s=Date.now()-this._startTime;if(s>M(this._options.drawTimeout,5e3))throw new Error(`단어배치 시간이 ${s} ms 경과하여 중단합니다.`);const _=this._getPoints(a,e,n+h++%4*(Math.PI/4));i&&o.shuffle(_);if(_.some((e,i)=>{let s=this._options.rotation?l[~~(o.randomLike(i+n)*c)]:0;const a=this._getBox(t,e[0],e[1],r,s);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],r),{bounds:n}=i,o={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(o.x,o.y,s),t.box=a,!0}}))return!0;a++}}}class z extends b{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*h,c=t*e,_=c*Math.cos(l)/n,x=c*Math.sin(l),d=s.c+_,u=s.r+x;a.push([~~d,~~u])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),x=_-Math.max(1,_>>1),d=.99;for(;++r>=0;){e=1+x*Math.pow(d,r),o=e/n;switch(3&(h*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,a=Math.min(2*this._radius,Math.max(0,e-P(o.width/2/n))),h=Math.min(2*this._radius,Math.max(0,i-P(r/2/n)));return{c1:a,r1:h,c2:a+P(o.width/n)+s,r2:h+P(r/n),w:t.width,h:r}}}class B extends h{constructor(t){super(t,l.POINT_CLASS),this.add(this.hintView=new c(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new _(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*B.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*B.TOP_PAD)}}B.TOP_PAD=.5;class F extends x{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new d(t,null)),this._words=new u(this._wordContainer,B)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,e){const i=this.model.options,s=i.text;if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let r=this._visPoints.slice();if(i.minWeight>0&&(r=r.filter(t=>t.yValue>=i.minWeight)),i.minLength>1&&(r=r.filter(t=>t.x.length>=i.minLength)),i.maxCount<r.length&&(r.length=Math.max(0,i.maxCount)),this.$_prepareWords(this.doc,this.model,r),"spiral"===i.placer)this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});else this._placer=new b(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});this._wSave=t,this._hSave=e,this._tSave=s,this._empty=r.length<1,o.log(r.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&m.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,a=e.getMaxFontSize(r,1);let h=Math.min(a,e.getMinFontSize(r,0));const l=s===n||h===a,c=l?NaN:e.options.logBase,_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+e.options.textHeight)),d=isNaN(x)?t.createElement("canvas").getContext("2d"):null,u=1-B.TOP_PAD;let m;this._words.prepare(i.length,(n,r)=>{const M=n.point=i[r],f=n.textView;n._bbox=null;let y=(M.y-s)/o;c>1&&(y=1-(Math.pow(c,1-y)-1)/(c-1));let w=h+(l?(a-h)/2:y*(a-h));const S=M.x;this._preparePoint(t,e,M,n),delete n.box,f.text=S,f.anchor=p.START,f.setStyles({fontSize:g(w)}),f.layoutText(),d?(d.font=`${g(w)} ${_}`,m=d.measureText(S),n.yText=.9*Math.max(0,m.fontBoundingBoxAscent-m.actualBoundingBoxAscent),n.hText=Math.ceil((m.actualBoundingBoxAscent+m.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*u):(n.yText=0,n.hText=n.getBBox().height*x),n.layout(),n.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,o=n.width,r=n.height,a=(t-o)/2;let h=(e-r)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)})}}function T(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(S),t.SeriesView.register([S,F]))}export{S as WordCloudSeries,T as default};