{"version":3,"sources":["webpack:///../../../../../src/.internal/plugins/wordCloud/WordCloudSeries.ts","webpack:///../../../../../src/.internal/plugins/wordCloud/WordCloud.ts","webpack:///./plugins/wordCloud.js"],"names":["WordCloudSeries_WordCloudSeriesDataItem","_super","WordCloudSeriesDataItem","_this","call","this","className","applyTheme","tslib_es6","prototype","hide","duration","delay","toValue","fields","setVisibility","value","noChangeValues","setWorkingValue","values","show","Object","defineProperty","properties","word","setProperty","_label","label_1","component","labels","create","_disposers","push","parent","labelsContainer","isMeasured","x","Percent","y","fontSize","colors","fill","next","Disposer","removeValue","addSprite","visible","Series","WordCloudSeries_WordCloudSeries","WordCloudSeries","_adjustedFont","accuracy","minFontSize","maxFontSize","excludeWords","layout","angles","rotationThreshold","minWordLength","width","height","step","randomness","template","horizontalCenter","verticalCenter","itemReaderText","canvas","document","createElement","style","position","top","left","opacity","_canvas","_ctx","getContext","_maskSprite","createChild","Sprite","Container","shouldClone","_spiral","fillOpacity","strokeOpacity","stroke","Color","validateDataRange","dataItems","each","dataItem","Utils","label","validate","_currentIndex","sort","a","b","_processTimeout","dispose","w","innerWidth","h","innerHeight","context","fillStyle","fillRect","_points","Path","angle","rotation","i","length","point","splice","point2","maskSprite","path","maxWidth","maxHeight","pictureWidth","measuredWidth","scale","pictureHeight","measuredHeight","utils_Math","Infinity","validatePosition","mask","events","isEnabled","dispatchImmediately","processItem","getIndex","DOM","htmlContainer","setTimeout","fontFace","element","node","smallerSize","low","high","percent","initialFontSize","Math","round","random","hardInvalidate","invalidateDataItems","invalidate","maxL","maxLeft","maxR","maxRight","maxT","maxTop","maxB","maxBottom","intersects","p","initialX","pixelX","initialY","pixelY","marginLeft","pixelMarginLeft","marginRight","pixelMarginRight","marginTop","pixelMarginTop","rect1","pixelMarginBottom","pixel","getImageData","data","pow","currentText","abs","animate","property","to","from","interpolationDuration","interpolationEasing","cx","cy","translate","radAngle","PI","rotate","textAlign","textBaseline","font","fontWeight","chart","fillText","showOnInit","event_1","type","target","progress","createLabel","Label","_labels","applyOnClones","text","margin","padding","List","createDataItem","getPropertyValue","setPropertyValue","updateData","getWords","copyFrom","source","input","dataFields","reg","RegExp","res","match","words","pop","item","toLowerCase","isCapitalized","minValue","indexOf","maxCount","slice","lword","substr","Registry","registeredClasses","WordCloud_WordCloudDataItem","WordCloudDataItem","SerialChart","WordCloud_WordCloud","WordCloud","seriesContainer","createSeries","window","am4plugins_wordCloud","wordCloud_namespaceObject"],"mappings":";;;;;;;;;;;;;;;;;;;qfA4CAA,EAAA,SAAAC,GAiBC,SAAAC,IAAA,IAAAC,EACCF,EAAAG,KAAAC,OAAOA,YACPF,EAAKG,UAAY,0BAEjBH,EAAKI,eAoGP,OAzH6CC,EAAA,EAAAN,EAAAD,GAgCrCC,EAAAO,UAAAC,KAAP,SAAYC,EAAmBC,EAAgBC,EAAkBC,GAIhE,OAHKA,IACJA,GAAU,UAEJb,EAAAQ,UAAMC,KAAIN,KAAAC,KAACM,EAAUC,EAAO,EAAGE,IAQhCZ,EAAAO,UAAAM,cAAP,SAAqBC,EAAgBC,GAC/BA,IACAD,EACHX,KAAKa,gBAAgB,QAASb,KAAKc,OAAc,MAAEH,MAAO,EAAG,GAG7DX,KAAKa,gBAAgB,QAAS,EAAG,EAAG,IAItCjB,EAAAQ,UAAMM,cAAaX,KAAAC,KAACW,EAAOC,IAUrBf,EAAAO,UAAAW,KAAP,SAAYT,EAAmBC,EAAgBE,GAI9C,OAHKA,IACJA,GAAU,UAEJb,EAAAQ,UAAMW,KAAIhB,KAAAC,KAACM,EAAUC,EAAOE,IAQpCO,OAAAC,eAAWpB,EAAAO,UAAA,YAOX,WACC,OAAOJ,KAAKkB,WAAWC,UARxB,SAAgBR,GACfX,KAAKoB,YAAY,OAAQT,oCAgB1BK,OAAAC,eAAWpB,EAAAO,UAAA,aAAX,eAAAN,EAAAE,KACC,IAAKA,KAAKqB,OAAQ,CACjB,IAAIC,EAAQtB,KAAKuB,UAAUC,OAAOC,SAClCzB,KAAKqB,OAAS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jBH,EAAK+O,gBAAgB/M,YAAa,EAClChC,EAAK+O,gBAAgB3L,OAAS,WAG9BpD,EAAKI,eAWP,OAnD+BC,EAAA,EAAAyO,EAAAhP,GAgDpBgP,EAAAxO,UAAA0O,aAAV,WACC,OAAO,IAAInM,GAEbiM,EAnDA,CAA+BF,EAAA,GA2D/BJ,EAAA,EAASC,kBAA6B,UAAII,EAC1CL,EAAA,EAASC,kBAAqC,kBAAIC,ECpJlDO,OAAAC,qBAA8BC","file":"./plugins/wordCloud.js","sourcesContent":["/**\r\n * Defines WordCloud series.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Series, SeriesDataItem, ISeriesProperties, ISeriesDataFields, ISeriesAdapters, ISeriesEvents } from \"../../charts/series/Series\";\r\nimport { Sprite } from \"../../core/Sprite\";\r\nimport { Container } from \"../../core/Container\";\r\nimport { Label } from \"../../core/elements/Label\";\r\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\r\nimport { Animation } from \"../../core/utils/Animation\";\r\nimport { color } from \"../../core/utils/Color\";\r\nimport { ColorSet } from \"../../core/utils/ColorSet\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { IPoint } from \"../../core/defs/IPoint\";\r\nimport { WordCloud } from \"./WordCloud\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $path from \"../../core/rendering/Path\";\r\nimport * as $utils from \"../../core/utils/Utils\";\r\nimport * as $math from \"../../core/utils/Math\";\r\nimport * as $dom from \"../../core/utils/DOM\";\r\nimport { Percent, percent } from \"../../core/utils/Percent\";\r\nimport { IDisposer, Disposer } from \"../../core/utils/Disposer\";\r\nimport { AMEvent } from \"../../core/utils/EventDispatcher\";\r\n\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n//@todo: sequenced?\r\n\r\n/**\r\n * Defines a [[DataItem]] for [[WordCloudSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nexport class WordCloudSeriesDataItem extends SeriesDataItem {\r\n\r\n\t/**\r\n\t * A reference to a word label element.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic _label: Label;\r\n\r\n\t/**\r\n\t * Defines a type of [[Component]] this data item is used for.\r\n\t */\r\n\tpublic _component!: WordCloudSeries;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"WordCloudSeriesDataItem\";\r\n\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Hide the data item (and corresponding visual elements).\r\n\t *\r\n\t * @param duration Duration (ms)\r\n\t * @param delay Delay hiding (ms)\r\n\t * @param toValue Target value for animation\r\n\t * @param fields Fields to animate while hiding\r\n\t */\r\n\tpublic hide(duration?: number, delay?: number, toValue?: number, fields?: string[]): $type.Optional {\r\n\t\tif (!fields) {\r\n\t\t\tfields = [\"value\"];\r\n\t\t}\r\n\t\treturn super.hide(duration, delay, 0, fields);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets visibility of the Data Item.\r\n\t *\r\n\t * @param value Data Item\r\n\t */\r\n\tpublic setVisibility(value: boolean, noChangeValues?: boolean): void {\r\n\t\tif (!noChangeValues) {\r\n\t\t\tif (value) {\r\n\t\t\t\tthis.setWorkingValue(\"value\", this.values[\"value\"].value, 0, 0);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.setWorkingValue(\"value\", 0, 0, 0);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsuper.setVisibility(value, noChangeValues);\r\n\t}\r\n\r\n\t/**\r\n\t * Show hidden data item (and corresponding cisual elements).\r\n\t *\r\n\t * @param duration Duration (ms)\r\n\t * @param delay Delay hiding (ms)\r\n\t * @param fields Fields to animate while hiding\r\n\t */\r\n\tpublic show(duration?: number, delay?: number, fields?: string[]): $type.Optional {\r\n\t\tif (!fields) {\r\n\t\t\tfields = [\"value\"];\r\n\t\t}\r\n\t\treturn super.show(duration, delay, fields);\r\n\t}\r\n\r\n\t/**\r\n\t * The word.\r\n\t *\r\n\t * @param value Word\r\n\t */\r\n\tpublic set word(value: string) {\r\n\t\tthis.setProperty(\"word\", value);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Word\r\n\t */\r\n\tpublic get word(): string {\r\n\t\treturn this.properties.word;\r\n\t}\r\n\r\n\t/**\r\n\t * A [Label] element, related to this data item (word).\r\n\t *\r\n\t * @readonly\r\n\t * @return Label element\r\n\t */\r\n\tpublic get label(): this[\"_label\"] {\r\n\t\tif (!this._label) {\r\n\t\t\tlet label = this.component.labels.create();\r\n\t\t\tthis._label = label;\r\n\r\n\t\t\tthis._disposers.push(label);\r\n\t\t\tlabel.parent = this.component.labelsContainer;\r\n\t\t\tlabel.isMeasured = false;\r\n\t\t\tlabel.x = percent(50);\r\n\t\t\tlabel.y = percent(50);\r\n\t\t\tlabel.fontSize = 0;\r\n\r\n\t\t\tif (this.component.colors) {\r\n\t\t\t\tlabel.fill = this.component.colors.next();\r\n\t\t\t}\r\n\r\n\t\t\tthis._disposers.push(new Disposer(() => {\r\n\t\t\t\tif (this.component) {\r\n\t\t\t\t\tthis.component.labels.removeValue(label);\r\n\t\t\t\t}\r\n\t\t\t}));\r\n\r\n\t\t\tthis.addSprite(label);\r\n\t\t\tlabel.visible = this.visible;\r\n\t\t}\r\n\t\treturn this._label;\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines data fields for [[WordCloudSeries]].\r\n */\r\nexport interface IWordCloudSeriesDataFields extends ISeriesDataFields {\r\n\r\n\t/**\r\n\t * Name of the field in data that holds word.\r\n\t */\r\n\tword?: string;\r\n\r\n}\r\n\r\n/**\r\n * Defines properties for [[WordCloudSeries]].\r\n */\r\nexport interface IWordCloudSeriesProperties extends ISeriesProperties {\r\n\r\n\t/**\r\n\t * A color set to be used for words.\r\n\t */\r\n\tcolors?: ColorSet;\r\n\r\n\t/**\r\n\t * Source text from which words are extracted.\r\n\t */\r\n\ttext?: string;\r\n\r\n\t/**\r\n\t * Absolute or relative font size for the smallest words.\r\n\t */\r\n\tminFontSize?: number | Percent;\r\n\r\n\t/**\r\n\t * Absolute or relative font size for the biggest words.\r\n\t */\r\n\tmaxFontSize?: number | Percent;\r\n\r\n\t/**\r\n\t * Minimum occurances for a word to be included into cloud.\r\n\t */\r\n\tminValue?: number;\r\n\r\n\t/**\r\n\t * Maximum number of words to show.\r\n\t */\r\n\tmaxCount?: number;\r\n\r\n\t/**\r\n\t * Array of words exclude from cloud.\r\n\t */\r\n\texcludeWords?: string[];\r\n\r\n\t/**\r\n\t * Randomness of word placement (0-1).\r\n\t */\r\n\trandomness?: number;\r\n\r\n\t/**\r\n\t * Minimum number of characters for a word to be included in the cloud.\r\n\t */\r\n\tminWordLength?: number;\r\n\r\n\t/**\r\n\t * An array of possible rotation angles for words.\r\n\t */\r\n\tangles?: number[];\r\n\r\n\t/**\r\n\t * If word's relative height is bigger than this, it won't be rotated.\r\n\t */\r\n\trotationThreshold?: number;\r\n\r\n\t/**\r\n\t * Step for next word placement.\r\n\t */\r\n\tstep?: number;\r\n\r\n\t/**\r\n\t * Accuracy of overlapping check.\r\n\t */\r\n\taccuracy?: number;\r\n}\r\n\r\n/**\r\n * Defines events for [[WordCloudSeries]].\r\n */\r\nexport interface IWordCloudSeriesEvents extends ISeriesEvents {\r\n\r\n\t/**\r\n\t * Invokes when word arranging starts.\r\n\t */\r\n\tarrangestarted: {}\r\n\r\n\t/**\r\n\t * Invoked when progress has been made in arranging the words.\r\n\t */\r\n\tarrangeprogress: {\r\n\r\n\t\t/**\r\n\t\t * Progress\r\n\t\t */\r\n\t\tprogress: number\r\n\t}\r\n\r\n\t/**\r\n\t * Invoked when word arranging is finished.\r\n\t */\r\n\tarrangeended: {}\r\n}\r\n\r\n/**\r\n * Defines adapters for [[WordCloudSeries]].\r\n *\r\n * @see {@link Adapter}\r\n */\r\nexport interface IWordCloudSeriesAdapters extends ISeriesAdapters, IWordCloudSeriesProperties { }\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines [[WordCloudSeries]] which is a base class for [[PieSeries]],\r\n * [[FunnelSeries]], and [[PyramidSeries]].\r\n *\r\n * @see {@link IWordCloudSeriesEvents} for a list of available Events\r\n * @see {@link IWordCloudSeriesAdapters} for a list of available Adapters\r\n */\r\nexport class WordCloudSeries extends Series {\r\n\t/**\r\n\t * Defines type of the label elements for the series.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic _label: Label;\r\n\r\n\t/**\r\n\t * A reference to chart this series is for.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic _chart: WordCloud;\r\n\r\n\t/**\r\n\t * Defines the type of data fields used for the series.\r\n\t */\r\n\tpublic _dataFields: IWordCloudSeriesDataFields;\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IWordCloudSeriesProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IWordCloudSeriesAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IWordCloudSeriesEvents;\r\n\r\n\t/**\r\n\t * Defines the type of data item.\r\n\t */\r\n\tpublic _dataItem: WordCloudSeriesDataItem;\r\n\r\n\t/**\r\n\t * List of label elements.\r\n\t */\r\n\tprotected _labels: ListTemplate;\r\n\r\n\tprotected _ctx: CanvasRenderingContext2D;\r\n\r\n\tprotected _canvas: HTMLCanvasElement;\r\n\r\n\tprotected _spiral: Sprite;\r\n\r\n\tprotected _points: IPoint[];\r\n\r\n\tprotected _adjustedFont: number = 1;\r\n\r\n\tprotected _processTimeout: IDisposer;\r\n\r\n\tprotected _currentIndex: number;\r\n\r\n\t/**\r\n\t * Holds a Sprite that acts as an intelligent mask for the serries.\r\n\t */\r\n\tprotected _maskSprite: Sprite;\r\n\r\n\t/**\r\n\t * Container label elements are put in.\r\n\t */\r\n\tpublic labelsContainer: Container;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tthis.className = \"WordCloudSeries\";\r\n\r\n\t\t// Disabled\r\n\t\t// this.colors = new ColorSet();\r\n\t\t// this.colors.step = 1;\r\n\t\t// this.colors.passOptions = {}; // makes it loop\r\n\r\n\t\tthis.accuracy = 5;\r\n\r\n\t\tthis.isMeasured = true;\r\n\r\n\t\tthis.minFontSize = percent(2);\r\n\t\tthis.maxFontSize = percent(20);\r\n\r\n\t\tthis.excludeWords = [];\r\n\r\n\t\tthis.layout = \"absolute\";\r\n\r\n\t\tthis.angles = [0, 0, 90];\r\n\r\n\t\t//this.maxCount = 100;\r\n\t\tthis.rotationThreshold = 0.7;\r\n\t\tthis.minWordLength = 1;\r\n\r\n\t\tthis.width = percent(100);\r\n\t\tthis.height = percent(100);\r\n\r\n\t\tthis.step = 15;\r\n\r\n\t\tthis.randomness = 0.2;\r\n\r\n\t\tthis.labels.template.horizontalCenter = \"middle\";\r\n\t\tthis.labels.template.verticalCenter = \"middle\";\r\n\r\n\t\t// Accessibility\r\n\t\tthis.itemReaderText = \"{word}: {value}\";\r\n\r\n\t\tthis.applyTheme();\r\n\r\n\t\tlet canvas = document.createElement(\"canvas\");\r\n\t\tcanvas.style.position = \"absolute\";\r\n\t\tcanvas.style.top = \"0px\";\r\n\t\tcanvas.style.left = \"0px\";\r\n\t\tcanvas.style.opacity = \"0.5\";\r\n\t\t//document.body.appendChild(canvas);\r\n\t\tthis._canvas = canvas;\r\n\r\n\t\tthis._ctx = canvas.getContext(\"2d\");\r\n\r\n\t\tthis._maskSprite = this.createChild(Sprite);\r\n\r\n\t\tlet labelsContainer = this.createChild(Container);\r\n\t\tlabelsContainer.shouldClone = false;\r\n\t\tlabelsContainer.isMeasured = false;\r\n\t\tlabelsContainer.layout = \"none\";\r\n\t\tthis.labelsContainer = labelsContainer;\r\n\r\n\t\tthis._spiral = labelsContainer.createChild(Sprite);\r\n\t\tthis._spiral.fillOpacity = 0.1;\r\n\t\tthis._spiral.strokeOpacity = 1;\r\n\t\tthis._spiral.stroke = color(\"#000\");\r\n\r\n\r\n\t\t//this._maskSprite.visible = false;\r\n\t}\r\n\r\n\t/**\r\n\t * Validates data range.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic validateDataRange(): void {\r\n\t\tsuper.validateDataRange();\r\n\t\tthis.dataItems.each((dataItem) => {\r\n\t\t\t$utils.used(dataItem.label);\r\n\t\t})\r\n\t}\r\n\r\n\t/**\r\n\t * Validates element.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic validate(): void {\r\n\r\n\t\tsuper.validate();\r\n\r\n\t\tthis._currentIndex = 0;\r\n\r\n\t\tthis.dataItems.values.sort(function(a, b) {\r\n\t\t\tif (a.value == b.value) {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\telse if (a.value > b.value) {\r\n\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (this._processTimeout) {\r\n\t\t\tthis._processTimeout.dispose();\r\n\t\t}\r\n\r\n\t\tlet w = this.innerWidth;\r\n\t\tlet h = this.innerHeight;\r\n\t\tif (w > 0 && h > 0) {\r\n\r\n\t\t\tlet context = this._ctx;\r\n\r\n\t\t\tthis._canvas.width = w;\r\n\t\t\tthis._canvas.height = h;\r\n\r\n\t\t\tcontext.fillStyle = \"white\";\r\n\t\t\tcontext.fillRect(0, 0, w, h);\r\n\r\n\t\t\tthis._points = $path.spiralPoints(0, 0, w, h, 0, this.step, this.step);\r\n\r\n\t\t\tlet angle = this.labelsContainer.rotation;\r\n\r\n\t\t\tfor (let i = this._points.length - 1; i >= 0; i--) {\r\n\t\t\t\tlet point = this._points[i];\r\n\r\n\t\t\t\tif (point.x < -w / 2 || point.x > w / 2 || point.y < -h / 2 || point.y > h / 2) {\r\n\t\t\t\t\tthis._points.splice(i, 1);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (angle != 0) {\r\n\t\t\t\t\tlet point2 = $utils.spritePointToSprite({ x: point.x + w / 2, y: point.y + h / 2 }, this, this.labelsContainer);\r\n\t\t\t\t\tpoint.x = point2.x;\r\n\t\t\t\t\tpoint.y = point2.y;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//this._spiral.path = $path.pointsToPath(this._points);\r\n\r\n\r\n\t\t\tlet maskSprite = this._maskSprite;\r\n\r\n\t\t\tif (maskSprite.path) {\r\n\t\t\t\tlet maxWidth = this.maxWidth;\r\n\t\t\t\tlet maxHeight = this.maxHeight;\r\n\r\n\t\t\t\tmaskSprite.isMeasured = true;\r\n\t\t\t\tmaskSprite.validate();\r\n\r\n\t\t\t\tlet pictureWidth = maskSprite.measuredWidth / maskSprite.scale;\r\n\t\t\t\tlet pictureHeight = maskSprite.measuredHeight / maskSprite.scale;\r\n\r\n\t\t\t\tlet scale = $math.min(maxHeight / pictureHeight, maxWidth / pictureWidth);\r\n\r\n\t\t\t\tif (scale == Infinity) {\r\n\t\t\t\t\tscale = 1; // can't return here, won't draw legend properly\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmaskSprite.horizontalCenter = \"none\";\r\n\t\t\t\tmaskSprite.verticalCenter = \"none\";\r\n\t\t\t\tmaskSprite.x = 0;\r\n\t\t\t\tmaskSprite.y = 0;\r\n\t\t\t\tmaskSprite.scale = 1;\r\n\r\n\t\t\t\tscale = $math.max(0.001, scale);\r\n\r\n\t\t\t\tmaskSprite.horizontalCenter = \"middle\";\r\n\t\t\t\tmaskSprite.verticalCenter = \"middle\";\r\n\t\t\t\tmaskSprite.x = w / 2;\r\n\t\t\t\tmaskSprite.y = h / 2;\r\n\t\t\t\tmaskSprite.validatePosition();\r\n\r\n\t\t\t\tthis.mask = maskSprite;\r\n\t\t\t\t/*\r\n\t\t\t\tcontext.fillStyle = \"blue\";\r\n\t\t\t\tcontext.fillRect(0, 0, w, h);\r\n\t\t\t\tcontext.fillStyle = \"white\";\r\n\t\t\t\tcontext.scale(scale, scale);\r\n\r\n\t\t\t\tcontext.translate(maskSprite.maxLeft - maxLeft + w / 2 / scale, maskSprite.maxTop - maxTop + h / 2 / scale);\r\n\t\t\t\t//let commandList = this.svgPathToCommands(maskSprite.path);\r\n\t\t\t\t//this.drawSvgPath(context, commandList);\r\n\t\t\t\tlet p = new Path2D(maskSprite.path);\r\n\t\t\t\tcontext.stroke(p);\r\n\t\t\t\tcontext.fill(p);\r\n\t\t\t\tcontext.translate(-maskSprite.maxLeft + maxLeft - w / 2 / scale, -maskSprite.maxTop + maxTop - h / 2 / scale);\r\n\t\t\t\tcontext.scale(1 / scale, 1 / scale);\r\n\t\t\t\t*/\r\n\r\n\t\t\t\tmaskSprite.scale = scale;\r\n\t\t\t}\r\n\t\t\tif (this.events.isEnabled(\"arrangestarted\")) {\r\n\t\t\t\tthis.dispatchImmediately(\"arrangestarted\");\r\n\t\t\t}\r\n\t\t\tthis.processItem(this.dataItems.getIndex(this._currentIndex));\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * [processItem description]\r\n\t *\r\n\t * @param dataItem Data item\r\n\t */\r\n\tprotected processItem(dataItem: this[\"_dataItem\"]) {\r\n\r\n\t\tif(!dataItem){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet context = this._ctx;\r\n\r\n\t\tlet w = this.innerWidth;\r\n\t\tlet h = this.innerHeight;\r\n\r\n\t\tif ($dom.isHidden(this.htmlContainer)) {\r\n\t\t\tthis._processTimeout = this.setTimeout(() => {\r\n\t\t\t\tthis._currentIndex++;\r\n\t\t\t\tthis.processItem(this.dataItems.getIndex(this._currentIndex));\r\n\t\t\t}, 500);\r\n\t\t\tthis._disposers.push(this._processTimeout);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.labelsContainer.x = w / 2;\r\n\t\tthis.labelsContainer.y = h / 2;\r\n\r\n\t\tlet label = dataItem.label;\r\n\t\tlet fontFace = $dom.findFont(label.element.node);\r\n\r\n\t\tlet smallerSize = $math.min(this.innerHeight, this.innerWidth);\r\n\t\tlet minFontSize = $utils.relativeToValue(this.minFontSize, smallerSize);\r\n\t\tlet maxFontSize = $utils.relativeToValue(this.maxFontSize, smallerSize);\r\n\r\n\t\tlet low = this.dataItem.values.value.low;\r\n\t\tlet high = this.dataItem.values.value.high;\r\n\r\n\t\tlet percent = (dataItem.value - low) / (high - low);\r\n\r\n\t\tif (low == high) {\r\n\t\t\tlet count = this.dataItems.length;\r\n\t\t\tif (count > 1) {\r\n\t\t\t\tpercent = 1 / this.dataItems.length * 1.5;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tpercent = 1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet fontSize = minFontSize + (maxFontSize - minFontSize) * percent * this._adjustedFont;\r\n\r\n\t\tlet initialFontSize = label.fontSize;\r\n\t\tlabel.fontSize = fontSize;\r\n\r\n\t\tlet angle = 0;\r\n\t\tif ((fontSize - minFontSize) / (maxFontSize - minFontSize) < this.rotationThreshold) {\r\n\t\t\tangle = this.angles[Math.round(Math.random() * (this.angles.length - 1))];\r\n\t\t}\r\n\r\n\t\tlabel.fontSize = fontSize;\r\n\t\tlabel.rotation = angle;\r\n\t\tlabel.show(0);\r\n\t\tlabel.hardInvalidate();\r\n\t\tlabel.validate();\r\n\r\n\t\tif (label.measuredWidth > w * 0.95 || label.measuredHeight > h * 0.95) {\r\n\t\t\tthis._adjustedFont -= 0.1;\r\n\t\t\tthis.invalidateDataItems()\r\n\t\t\tthis.invalidate();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet maxL = label.maxLeft;\r\n\t\tlet maxR = label.maxRight;\r\n\t\tlet maxT = label.maxTop;\r\n\t\tlet maxB = label.maxBottom;\r\n\r\n\t\tlet intersects = true;\r\n\r\n\t\tlet p = Math.round(Math.random() * this._points.length * this.randomness);\r\n\r\n\t\tlet initialX = label.pixelX;\r\n\t\tlet initialY = label.pixelY;\r\n\r\n\t\tlet x = 0;\r\n\t\tlet y = 0;\r\n\r\n\t\t// TODO is this needed ?\r\n\t\t$utils.used(this.labelsContainer.rotation);\r\n\t\tif (this._currentIndex > 0) {\r\n\t\t\twhile (intersects) {\r\n\t\t\t\tif (p > this._points.length - 1) {\r\n\t\t\t\t\tintersects = false;\r\n\t\t\t\t\tthis._adjustedFont -= 0.1;\r\n\t\t\t\t\tthis.invalidateDataItems();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tintersects = false;\r\n\r\n\t\t\t\tx = this._points[p].x;\r\n\t\t\t\ty = this._points[p].y;\r\n\r\n\t\t\t\tlet marginLeft = label.pixelMarginLeft;\r\n\t\t\t\tlet marginRight = label.pixelMarginRight;\r\n\t\t\t\tlet marginTop = label.pixelMarginTop;\r\n\t\t\t\tlet marginBottom = label.pixelMarginBottom;\r\n\r\n\t\t\t\tlet rect1 = { x: x + maxL - marginLeft, y: y + maxT - marginTop, width: maxR - maxL + marginLeft + marginRight, height: maxB - maxT + marginTop + marginBottom };\r\n\r\n\t\t\t\tlet pixel = this._ctx.getImageData(rect1.x + w / 2, rect1.y + h / 2, rect1.width, rect1.height).data;\r\n\t\t\t\tfor (let i = 0; i < pixel.length; i += Math.pow(2, this.accuracy)) {\r\n\t\t\t\t\tif (pixel[i] != 255) {\r\n\t\t\t\t\t\tintersects = true;\r\n\t\t\t\t\t\tif (label.currentText.length > 3) {\r\n\t\t\t\t\t\t\tif (angle == 0) {\r\n\t\t\t\t\t\t\t\tif (maxR - maxL < 60) {\r\n\t\t\t\t\t\t\t\t\tthis._points.splice(p, 1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (Math.abs(angle) == 90) {\r\n\t\t\t\t\t\t\t\tif (maxB - maxT < 50) {\r\n\t\t\t\t\t\t\t\t\tthis._points.splice(p, 1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tp += 5;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (initialFontSize == 0) {\r\n\t\t\tlabel.animate([{ property: \"fontSize\", to: fontSize, from: initialFontSize }], this.interpolationDuration, this.interpolationEasing);\r\n\t\t\tlabel.x = x;\r\n\t\t\tlabel.y = y;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlabel.animate([{ property: \"fontSize\", to: fontSize, from: initialFontSize }, { property: \"x\", to: x, from: initialX }, { property: \"y\", to: y, from: initialY }], this.interpolationDuration, this.interpolationEasing);\r\n\t\t}\r\n\r\n\t\tlet cx = x + w / 2;\r\n\t\tlet cy = y + h / 2;\r\n\r\n\t\tcontext.translate(cx, cy);\r\n\t\tlet radAngle = label.rotation * Math.PI / 180;\r\n\t\tcontext.rotate(radAngle);\r\n\t\tcontext.textAlign = \"center\";\r\n\t\tcontext.textBaseline = \"middle\";\r\n\t\tcontext.fillStyle = \"blue\";\r\n\r\n\t\tlet fontWeight = label.fontWeight || this.fontWeight || this.chart.fontWeight || \"normal\";\r\n\t\tlet font = fontWeight + \" \" + fontSize + \"px \" + fontFace;\r\n\r\n\t\tcontext.font = font\r\n\t\tcontext.fillText(label.currentText, 0, 0);\r\n\t\tcontext.rotate(-radAngle);\r\n\t\tcontext.translate(-cx, -cy);\r\n\r\n\t\tif (label.showOnInit) {\r\n\t\t\tlabel.hide(0);\r\n\t\t\tlabel.show();\r\n\t\t}\r\n\r\n\t\tif (this.events.isEnabled(\"arrangeprogress\")) {\r\n\t\t\tconst event: AMEvent[\"arrangeprogress\"] = {\r\n\t\t\t\ttype: \"arrangeprogress\",\r\n\t\t\t\ttarget: this,\r\n\t\t\t\tprogress: (this._currentIndex + 1) / this.dataItems.length\r\n\t\t\t};\r\n\t\t\tthis.events.dispatchImmediately(\"arrangeprogress\", event);\r\n\t\t}\r\n\r\n\t\tif (this._currentIndex < this.dataItems.length - 1) {\r\n\t\t\tthis._processTimeout = this.setTimeout(() => {\r\n\t\t\t\tthis._currentIndex++;\r\n\t\t\t\tthis.processItem(this.dataItems.getIndex(this._currentIndex));\r\n\t\t\t}, 1);\r\n\t\t\tthis._disposers.push(this._processTimeout);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (this.events.isEnabled(\"arrangeended\")) {\r\n\t\t\t\tthis.dispatchImmediately(\"arrangeended\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sreates label element.\r\n\t *\r\n\t * @return label\r\n\t */\r\n\tprotected createLabel(): this[\"_label\"] {\r\n\t\treturn new Label();\r\n\t}\r\n\r\n\t/**\r\n\t * [[Label]] elements representing each word.\r\n\t *\r\n\t * @return Label elements\r\n\t */\r\n\tpublic get labels(): ListTemplate {\r\n\t\tif (!this._labels) {\r\n\t\t\tlet label = this.createLabel();\r\n\t\t\tlabel.applyOnClones = true;\r\n\t\t\tthis._disposers.push(label);\r\n\r\n\t\t\tlabel.text = \"{word}\";\r\n\t\t\tlabel.margin(2, 3, 2, 3);\r\n\t\t\tlabel.padding(0, 0, 0, 0);\r\n\r\n\t\t\tthis._labels = new ListTemplate(label);\r\n\t\t\tthis._disposers.push(new ListDisposer(this._labels));\r\n\t\t}\r\n\t\treturn this._labels;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a new/empty DataItem of the type appropriate for this object.\r\n\t *\r\n\t * @see {@link DataItem}\r\n\t * @return Data Item\r\n\t */\r\n\tprotected createDataItem(): this[\"_dataItem\"] {\r\n\t\treturn new WordCloudSeriesDataItem();\r\n\t}\r\n\r\n\t/**\r\n\t * A color set to be used for each new word.\r\n\t *\r\n\t * By default it's empty, so all words will be colored the same.\r\n\t *\r\n\t * If you want to automatically color each word differently, set this\r\n\t * to a new instance of a [[ColorSet]].\r\n\t *\r\n\t * ```TypeScript\r\n\t * series.colors = new am4core.ColorSet();\r\n\t * series.colors.step = 1;\r\n\t * series.colors.passOptions = {}; // makes it loop\r\n\t * ```\r\n\t * ```JavaScript\r\n\t * series.colors = new am4core.ColorSet();\r\n\t * series.colors.step = 1;\r\n\t * series.colors.passOptions = {}; // makes it loop\r\n\t * ```\r\n\t * ```JSON\r\n\t * {\r\n\t * // ...\r\n\t * \"series\": [{\r\n\t * // ...\r\n\t * \"colors\": {\r\n\t * \"type\": \"ColorSet\",\r\n\t * \"step\": 1,\r\n\t * \"passOptions\": {}\r\n\t * }\r\n\t * }]\r\n\t * }\r\n\t * ```\r\n\t *\r\n\t * @param value Color set\r\n\t */\r\n\tpublic set colors(value: ColorSet) {\r\n\t\tthis.setPropertyValue(\"colors\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Color set\r\n\t */\r\n\tpublic get colors(): ColorSet {\r\n\t\treturn this.getPropertyValue(\"colors\");\r\n\t}\r\n\r\n\t/**\r\n\t * [updateData description]\r\n\t */\r\n\tprotected updateData(): void {\r\n\t\tthis.data = this.getWords(this.text);\r\n\t}\r\n\r\n\t/**\r\n\t * A source text to build word cloud from.\r\n\t *\r\n\t * @param value Source text\r\n\t */\r\n\tpublic set text(value: string) {\r\n\t\tif (this.setPropertyValue(\"text\", value)) {\r\n\t\t\tthis.updateData();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Source text\r\n\t */\r\n\tpublic get text(): string {\r\n\t\treturn this.getPropertyValue(\"text\");\r\n\t}\r\n\r\n\t/**\r\n\t * Maximum number of words to show.\r\n\t *\r\n\t * If ther are more words in the cloud than `maxCount`, smallest words will\r\n\t * be discarded.\r\n\t *\r\n\t * NOTE: this setting is used only when you set whole text using `text`. If\r\n\t * you set `chart.data` or `series.data` directly, it won't have any effect.\r\n\t *\r\n\t * @param value Maximum words to show\r\n\t */\r\n\tpublic set maxCount(value: number) {\r\n\t\tif (this.setPropertyValue(\"maxCount\", value)) {\r\n\t\t\tthis.updateData();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Maximum words to show\r\n\t */\r\n\tpublic get maxCount(): number {\r\n\t\treturn this.getPropertyValue(\"maxCount\");\r\n\t}\r\n\r\n\t/**\r\n\t * Minimum occurances for a word to be included in the cloud.\r\n\t *\r\n\t * NOTE: this setting is used only when you set whole text using `text`. If\r\n\t * you set `chart.data` or `series.data` directly, it won't have any effect.\r\n\t *\r\n\t * @default 1\r\n\t * @param value Minimum occurences\r\n\t */\r\n\tpublic set minValue(value: number) {\r\n\t\tif (this.setPropertyValue(\"minValue\", value)) {\r\n\t\t\tthis.updateData();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Minimum occurences\r\n\t */\r\n\tpublic get minValue(): number {\r\n\t\treturn this.getPropertyValue(\"minValue\");\r\n\t}\r\n\r\n\t/**\r\n\t * An array of words to exclude from the cloud.\r\n\t *\r\n\t * ```TypeScript\r\n\t * series.excludeWords = [\"the\", \"a\", \"an\"];\r\n\t * ```\r\n\t * ```JavaScript\r\n\t * series.excludeWords = [\"the\", \"a\", \"an\"];\r\n\t * ```\r\n\t * ```JSON\r\n\t * {\r\n\t * // ...\r\n\t * \"series\": [{\r\n\t * // ...\r\n\t * \"excludeWords\": [\"the\", \"a\", \"an\"]\r\n\t * }]\r\n\t * }\r\n\t * ```\r\n\t *\r\n\t * NOTE: this setting is used only when you set whole text using `text`. If\r\n\t * you set `chart.data` or `series.data` directly, it won't have any effect.\r\n\t *\r\n\t * @param value Words to exclude from the cloud\r\n\t */\r\n\tpublic set excludeWords(value: string[]) {\r\n\t\tif (this.setPropertyValue(\"excludeWords\", value)) {\r\n\t\t\tthis.updateData();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Words to exclude from the cloud\r\n\t */\r\n\tpublic get excludeWords(): string[] {\r\n\t\treturn this.getPropertyValue(\"excludeWords\");\r\n\t}\r\n\r\n\t/**\r\n\t * Font size for the biggest words.\r\n\t *\r\n\t * This can be set either as a numeric pixel size, or as a relative\r\n\t * as `Percent`.\r\n\t *\r\n\t * When setting as percent it will use series' height or width (the one which is smaller) as a basis for\r\n\t * calculating the font size.\r\n\t *\r\n\t * NOTE: this setting might be automatically adjusted if all words do not fit\r\n\t * in the available space.\r\n\t *\r\n\t * @default 20%\r\n\t * @param value Font size\r\n\t */\r\n\tpublic set maxFontSize(value: number | Percent) {\r\n\t\tthis.setPropertyValue(\"maxFontSize\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return {number} Font size\r\n\t */\r\n\tpublic get maxFontSize(): number | Percent {\r\n\t\treturn this.getPropertyValue(\"maxFontSize\");\r\n\t}\r\n\r\n\t/**\r\n\t * Font size for the smallest words.\r\n\t *\r\n\t * This can be set either as a numeric pixel size, or as a relative\r\n\t * as `Percent`.\r\n\t *\r\n\t * When setting as percent it will use series' height or width (the one which is smaller) as a basis for\r\n\t * calculating the font size.\r\n\t *\r\n\t * @default 2%\r\n\t * @param value Font size\r\n\t */\r\n\tpublic set minFontSize(value: number | Percent) {\r\n\t\tthis.setPropertyValue(\"minFontSize\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Font size\r\n\t */\r\n\tpublic get minFontSize(): number | Percent {\r\n\t\treturn this.getPropertyValue(\"minFontSize\");\r\n\t}\r\n\r\n\t/**\r\n\t * Randomness of word placement.\r\n\t *\r\n\t * Available values are from 0 (no randomization) to 1 (completely random).\r\n\t *\r\n\t * The smaller the value the bigger the chance that biggest words will end up\r\n\t * closer to the center.\r\n\t *\r\n\t * @default 0.2\r\n\t * @param value Randomness\r\n\t */\r\n\tpublic set randomness(value: number) {\r\n\t\tthis.setPropertyValue(\"randomness\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Randomness\r\n\t */\r\n\tpublic get randomness(): number {\r\n\t\treturn this.getPropertyValue(\"randomness\");\r\n\t}\r\n\r\n\t/**\r\n\t * Step by which label is moved if its space is already occupied.\r\n\t *\r\n\t * The smaller the number, the more packed labels will be.\r\n\t *\r\n\t * NOTE: smaller numbers make for more packed clouds, but will consume\r\n\t * considerably more CPU power. Use with caution with bigger clouds.\r\n\t *\r\n\t * @default 15\r\n\t * @param value Step\r\n\t */\r\n\tpublic set step(value: number) {\r\n\t\tthis.setPropertyValue(\"step\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Step\r\n\t */\r\n\tpublic get step(): number {\r\n\t\treturn this.getPropertyValue(\"step\");\r\n\t}\r\n\r\n\t/**\r\n\t * Accuracy setting when checking for overlapping of words.\r\n\t *\r\n\t * The bigger the number, the bigger chance of overlapping, but it's also\r\n\t * better for performance.\r\n\t *\r\n\t * Use smaller numbers if you are using a thin font.\r\n\t *\r\n\t * @default 5\r\n\t * @param value Accuracy\r\n\t */\r\n\tpublic set accuracy(value: number) {\r\n\t\tthis.setPropertyValue(\"accuracy\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Accuracy\r\n\t */\r\n\tpublic get accuracy(): number {\r\n\t\treturn this.getPropertyValue(\"accuracy\");\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Minimum number of characters for a word to be included in the cloud.\r\n\t *\r\n\t * NOTE: this setting is used only when you set whole text using `text`. If\r\n\t * you set `chart.data` or `series.data` directly, it won't have any effect.\r\n\t *\r\n\t * @default 1\r\n\t * @param {number} value Minimum word length\r\n\t */\r\n\tpublic set minWordLength(value: number) {\r\n\t\tif (this.setPropertyValue(\"minWordLength\", value)) {\r\n\t\t\tthis.updateData();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Minimum word length\r\n\t */\r\n\tpublic get minWordLength(): number {\r\n\t\treturn this.getPropertyValue(\"minWordLength\");\r\n\t}\r\n\r\n\t/**\r\n\t * Rotation threshold.\r\n\t *\r\n\t * Big words don't look good good when rotated, hence this setting.\r\n\t *\r\n\t * It works like this: if word's relative height is bigger\r\n\t * than `rotationThreshold`, the word will never be rotated.\r\n\t *\r\n\t * Available values are from 0 (none of the words will be rotated) to 1 (all\r\n\t * words can be rotated).\r\n\t *\r\n\t * @default 0.7\r\n\t * @param value Threshold\r\n\t */\r\n\tpublic set rotationThreshold(value: number) {\r\n\t\tthis.setPropertyValue(\"rotationThreshold\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Threshold\r\n\t */\r\n\tpublic get rotationThreshold(): number {\r\n\t\treturn this.getPropertyValue(\"rotationThreshold\");\r\n\t}\r\n\r\n\t/**\r\n\t * An array of available word rotation angles.\r\n\t *\r\n\t * The only supported values are: 0 (horizontal), and 90 (vertical).\r\n\t *\r\n\t * @default [0, 0, 90]\r\n\t * @param value Angles\r\n\t */\r\n\tpublic set angles(value: number[]) {\r\n\t\tthis.setPropertyValue(\"angles\", value, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @return Angles\r\n\t */\r\n\tpublic get angles(): number[] {\r\n\t\treturn this.getPropertyValue(\"angles\");\r\n\t}\r\n\r\n\t/**\r\n\t * @ignore\r\n\t * Not finished yet\r\n\t */\r\n\tpublic get maskSprite(): Sprite {\r\n\t\treturn this._maskSprite;\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Copies all properties from another instance of [[WordCloudSeries]].\r\n\t *\r\n\t * @param source Source series\r\n\t */\r\n\tpublic copyFrom(source: this): void {\r\n\t\tsuper.copyFrom(source);\r\n\t\tthis.labels.template.copyFrom(source.labels.template);\r\n\t}\r\n\r\n\t/**\r\n\t * Extracts words and number of their appearances from a text.\r\n\t *\r\n\t * @ignore\r\n\t * @param input Source text\r\n\t */\r\n\tpublic getWords(input: string): { word: string, value: number }[] {\r\n\t\tif (input) {\r\n\t\t\tthis.dataFields.word = \"word\";\r\n\t\t\tthis.dataFields.value = \"value\";\r\n\r\n\t\t\tconst reg = new RegExp(\"[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0523\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0972\\u097B-\\u097F\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58-\\u0C59\\u0C60-\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0-\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D3D\\u0D60-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E87-\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA-\\u0EAB\\u0EAD-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8B\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10D0-\\u10FA\\u10FC\\u1100-\\u1159\\u115F-\\u11A2\\u11A8-\\u11F9\\u1200-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u1676\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F0\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19A9\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u2094\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C6F\\u2C71-\\u2C7D\\u2C80-\\u2CE4\\u2D00-\\u2D25\\u2D30-\\u2D65\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31B7\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FC3\\uA000-\\uA48C\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA65F\\uA662-\\uA66E\\uA67F-\\uA697\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78C\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA90A-\\uA925\\uA930-\\uA946\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAC00\\uD7A3\\uF900-\\uFA2D\\uFA30-\\uFA6A\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC0-9@+]+\", \"ig\");\r\n\t\t\tlet res = input.match(reg);\r\n\t\t\tif (!res) {\r\n\t\t\t\treturn [];\r\n\t\t\t}\r\n\r\n\t\t\tlet words: { word: string, value: number }[] = [];\r\n\t\t\tlet word;\r\n\t\t\twhile (true) {\r\n\t\t\t\tword = res.pop();\r\n\r\n\t\t\t\tif (!word) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet item;\r\n\t\t\t\tfor (let i = 0; i < words.length; i++) {\r\n\t\t\t\t\tif (words[i].word.toLowerCase() == word.toLowerCase()) {\r\n\t\t\t\t\t\titem = words[i];\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (item) {\r\n\t\t\t\t\titem.value++;\r\n\t\t\t\t\tif (!this.isCapitalized(word)) {\r\n\t\t\t\t\t\titem.word = word;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\twords.push({\r\n\t\t\t\t\t\tword: word,\r\n\t\t\t\t\t\tvalue: 1\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet excludeWords = this.excludeWords;\r\n\t\t\tif (this.minValue > 1 || this.minWordLength > 1 || (excludeWords && excludeWords.length > 0)) {\r\n\t\t\t\tfor (let i = words.length - 1; i >= 0; i--) {\r\n\t\t\t\t\tlet w = words[i];\r\n\t\t\t\t\tif (w.value < this.minValue) {\r\n\t\t\t\t\t\twords.splice(i, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (w.word.length < this.minWordLength) {\r\n\t\t\t\t\t\twords.splice(i, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (excludeWords.indexOf(w.word) !== -1) {\r\n\t\t\t\t\t\twords.splice(i, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\twords.sort(function(a, b) {\r\n\t\t\t\tif (a.value == b.value) {\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\telse if (a.value > b.value) {\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\r\n\t\t\tif (words.length > this.maxCount) {\r\n\t\t\t\twords = words.slice(0, this.maxCount);\r\n\t\t\t}\r\n\r\n\t\t\treturn words;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if word is capitalized (starts with an uppercase) or not.\r\n\t *\r\n\t * @param word Word\r\n\t * @return Capitalized?\r\n\t */\r\n\tpublic isCapitalized(word: string): boolean {\r\n\t\tlet lword = word.toLowerCase();\r\n\t\treturn word[0] != lword[0]\r\n\t\t\t&& word.substr(1) == lword.substr(1)\r\n\t\t\t&& word != lword;\r\n\t}\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"WordCloudSeries\"] = WordCloudSeries;\r\nregistry.registeredClasses[\"WordCloudSeriesDataItem\"] = WordCloudSeriesDataItem;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/wordCloud/WordCloudSeries.ts","/**\r\n * WordCloud chart module.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { SerialChart, ISerialChartProperties, ISerialChartDataFields, ISerialChartAdapters, ISerialChartEvents, SerialChartDataItem } from \"../../charts/types/SerialChart\";\r\nimport { WordCloudSeries } from \"./WordCloudSeries\";\r\nimport { registry } from \"../../core/Registry\";\r\n\r\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines a [[DataItem]] for [[WordCloud]].\r\n *\r\n * @see {@link DataItem}\r\n */\r\nexport class WordCloudDataItem extends SerialChartDataItem {\r\n\r\n\t/**\r\n\t * Defines a type of [[Component]] this data item is used for.\r\n\t */\r\n\tpublic _component!: WordCloud;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"WordCloudDataItem\";\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines data fields for [[WordCloud]].\r\n */\r\nexport interface IWordCloudDataFields extends ISerialChartDataFields { }\r\n\r\n/**\r\n * Defines properties for [[WordCloud]]\r\n */\r\nexport interface IWordCloudProperties extends ISerialChartProperties { }\r\n\r\n/**\r\n * Defines events for [[WordCloud]].\r\n */\r\nexport interface IWordCloudEvents extends ISerialChartEvents { }\r\n\r\n/**\r\n * Defines adapters for [[WordCloud]].\r\n *\r\n * @see {@link Adapter}\r\n */\r\nexport interface IWordCloudAdapters extends ISerialChartAdapters, IWordCloudProperties { }\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * This is a base class for \"percent-based\" chart types like Pie and Funnel.\r\n *\r\n * @see {@link IWordCloudEvents} for a list of available Events\r\n * @see {@link IWordCloudAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/wordcloud/} for documentation\r\n */\r\nexport class WordCloud extends SerialChart {\r\n\r\n\t/**\r\n\t * Defines available data fields.\r\n\t */\r\n\tpublic _dataFields: IWordCloudDataFields;\r\n\r\n\t/**\r\n\t * Defines available properties.\r\n\t */\r\n\tpublic _properties!: IWordCloudProperties;\r\n\r\n\t/**\r\n\t * Defines available adapters.\r\n\t */\r\n\tpublic _adapter!: IWordCloudAdapters;\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IWordCloudEvents;\r\n\r\n\t/**\r\n\t * Defines a type of series that this chart uses.\r\n\t */\r\n\tpublic _seriesType: WordCloudSeries;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\r\n\t\t// Init\r\n\t\tsuper();\r\n\t\tthis.className = \"WordCloud\";\r\n\r\n\t\tthis.seriesContainer.isMeasured = true;\r\n\t\tthis.seriesContainer.layout = \"absolute\";\r\n\r\n\t\t// Apply theme\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new [[PercentSeries]].\r\n\t *\r\n\t * @return New series\r\n\t */\r\n\tprotected createSeries(): this[\"_seriesType\"] {\r\n\t\treturn new WordCloudSeries();\r\n\t}\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @hidden\r\n */\r\nregistry.registeredClasses[\"WordCloud\"] = WordCloud;\r\nregistry.registeredClasses[\"WordCloudDataItem\"] = WordCloudDataItem;\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/wordCloud/WordCloud.ts","import * as m from \"../../es2015/plugins/wordCloud\";\nwindow.am4plugins_wordCloud = m;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/wordCloud.js\n// module id = null\n// module chunks = "],"sourceRoot":""}