survey-analytics
Version:
SurveyJS Dashboard is a UI component for visualizing and analyzing survey data. It interprets the form JSON schema to identify question types and renders collected responses using interactive charts and tables.
6 lines • 263 kB
JavaScript
/*!
surveyjs - SurveyJS Dashboard library v2.5.35
Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
License: SEE LICENSE IN LICENSE
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("survey-core"),require("plotly.js-dist-min")):"function"==typeof define&&define.amd?define(["exports","survey-core","plotly.js-dist-min"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SurveyAnalytics={},e.Survey,e.Plotly)}(this,function(e,t,i){"use strict";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},r(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var s=function(){return s=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function o(e,t,i,r){return new(i||(i=Promise))(function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})}function a(e,t){var i,r,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError;var l={groupButton:"Group By Me",ungroupButton:"Ungroup By Me",selectButton:"Select Me",hideColumn:"Hide column",showColumn:"Show column",makePrivateColumn:"Make column private",makePublicColumn:"Make column public",moveToDetail:"Move to Detail",showAsColumn:"Show as Column",filterPlaceholder:"Search...",removeRows:"Remove rows",showLabel:"Show",entriesLabel:"entries",visualizer_text:"Texts in table",visualizer_wordcloud:"Wordcloud",visualizer_histogram:"Histogram",visualizer_number:"Average",visualizer_choices:"Table",visualizer_selectBase:"Chart",visualizer_matrix:"Chart",chartType_bar:"Bar",chartType_vbar:"Vertical Bar",chartType_stackedbar:"Stacked Bar",chartType_doughnut:"Doughnut",chartType_pie:"Pie",chartType_scatter:"Scatter",chartType_gauge:"Gauge",chartType_bullet:"Bullet",chartType_line:"Line",chartType_radar:"Radar",hideButton:"Hide",makePrivateButton:"Make private",makePublicButton:"Make public",showButton:"Show",filter:"Filter",resetFilter:"Reset Filter",changeLocale:"Change Locale",clearButton:"Clear",addElement:"Choose question to show...",defaultOrder:"Default Order",ascOrder:"Ascending",descOrder:"Descending",showMinorColumns:"Show minor columns",actionsColumn:"Actions",otherCommentTitle:"Other items and comments",showPercentages:"Show percentages",hidePercentages:"Hide percentages",pdfDownloadCaption:"PDF",xlsxDownloadCaption:"Excel",csvDownloadCaption:"CSV",saveDiagramAsPNG:"Download plot as a PNG file",hideEmptyAnswers:"Hide empty answers",showEmptyAnswers:"Show empty answers","topNValueText-1":"All answers",topNValueText5:"Top 5 answers",topNValueText10:"Top 10 answers",topNValueText20:"Top 20 answers",hideMissingAnswers:"Hide missing answers",showMissingAnswers:"Show missing answers",missingAnswersLabel:"Missing answers",noVisualizerForQuestion:"This question type is not visualized yet",noResults:"There are no results yet",showPerValues:"Per Values",showPerColumns:"Per Columns",answer:"Answer",correctAnswer:"Correct answer: ",percent:"Percent",percentage:"Percentage",statistics_chart:"Chart",responses:"Responses",visualizer_nps:"NPS",visualizer_boolean:"Chart",visualizer_options:"Table",npsScore:"NPS",npsPromoters:"Promoters",npsPassives:"Passives",npsDetractors:"Detractors",axisXSelectorTitle:"Category (X Axis):",axisYSelectorTitle:"Legend (Series):",axisXAlternativeSelectorTitle:"Segments:",axisYAlternativeSelectorTitle:"Groups:",notSelected:"Not selected",intervalMode_default:"Default",intervalMode_decades:"Decades",intervalMode_years:"Years",intervalMode_quarters:"Quarters",intervalMode_months:"Months",intervalMode_days:"Days",intervalMode_custom:"Custom",intervalMode_auto:"Auto",intervalModeTitle:"Intervals:",noRunningTotals:"Show individual values",runningTotals:"Show running totals",groupDateSeries:"Compare periods",ungroupDateSeries:"View timeline",noneAggregateText:"None",selectAggregateText:"Aggregate:",groupedYearsAxisTitle:"Year ends with",license:"To use the Dashboard library in your application, a <a href='https://surveyjs.io/licensing' target='_blank'>developer license</a> is required. If you have an active license, please <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up your license key</a> and ensure you're using the <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>latest version</a>.",license2:"This banner appears because your maintenance subscription for the Dashboard library expired on {date}. You may continue using <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>all versions released up to that date</a>. To remove this banner in the latest version, please <a href='https://surveyjs.io/manage#license-manager' target='_blank'>renew your subscription</a> and <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up a new license key</a>."},u={currentLocaleValue:"",defaultLocaleValue:"en",locales:{},localeNames:{},supportedLocales:[],get currentLocale(){return this.currentLocaleValue===this.defaultLocaleValue?"":this.currentLocaleValue},set currentLocale(e){this.currentLocaleValue=e},get defaultLocale(){return this.defaultLocaleValue},set defaultLocale(e){this.defaultLocaleValue=e},setupLocale:function(e,t){this.locales[e]=t},getLocaleName:function(e,i){return void 0===i&&(i=!1),(i?"":this.localeNames[e])||t.surveyLocalization.getLocaleName(e,i)},getString:function(e){var t=this.currentLocale?this.locales[this.currentLocale]:this.locales[this.defaultLocale];t&&t[e]||(t=this.locales[this.defaultLocale]);var i=t[e];return void 0===i&&(i=this.locales.en[e]||e),i},getLocales:function(){var e=[];if(e.push(""),this.supportedLocales&&this.supportedLocales.length>0)for(var t=0;t<this.supportedLocales.length;t++)e.push(this.supportedLocales[t]);else for(var i in this.locales)e.push(i);return e.sort(),e}},h=l;function c(e){var t=e.localeCode;u.setupLocale(t,e.strings),e.nativeName&&(u.localeNames[t]=e.nativeName)}c({localeCode:"en",strings:l,nativeName:"English"});var d=function(){function e(){}return e.createSelector=function(t,i,r,n){var s=document.createElement("div");s.className="sa-question__select-wrapper";var o=e.createElement("span","sa-question__select-title"),a=document.createElement("select");a.className="sa-question__select";a.onchange=r,s.appendChild(a);return s.__updateSelect=function(){var r;r=!!n&&("string"==typeof n?n:n()),o.innerText=r,r?s.insertBefore(o,a):o.parentElement===s&&s.removeChild(o),function(){a.innerHTML="";var r=t||[];(Array.isArray(r)?r:r()).forEach(function(t){var r=e.createElement("option","",{value:t.value,text:t.text,selected:i(t)});a.appendChild(r)})}()},s.__updateSelect(),s},e.createButton=function(t,i,r){return void 0===i&&(i=""),void 0===r&&(r="sa-toolbar__button"),e.createElement("span",r,{innerText:i,onclick:t})},e.createElement=function(e,t,i){void 0===t&&(t="");var r=document.createElement(e);return t&&(r.className=t),i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r},e.createSvgElement=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=document.createElementNS("http://www.w3.org/2000/svg","use");return i.setAttributeNS("http://www.w3.org/1999/xlink","href","#sa-svg-"+e),t.appendChild(i),t},e.createSvgButton=function(t){var i=e.createElement("button","sa-table__svg-button");return i.appendChild(e.createSvgElement(t)),i},e.createSvgToggleButton=function(t,i,r,n,s,o,a,l){void 0===a&&(a="first"),void 0===l&&(l="sa-toolbar__button sa-toolbar__svg-button");var u=e.createSvgElement(t),h=e.createSvgElement(i),c=e.createElement("button",l);return"first"===a?(c.title=r,c.appendChild(u)):(a="second")&&(c.title=n,c.appendChild(h)),c.onclick=function(e){"first"===a?(a="second",c.title=n,c.removeChild(u),c.appendChild(h),o(e)):"second"===a&&(a="first",c.title=r,c.removeChild(h),c.appendChild(u),s(e))},c},e.createInput=function(t,i,r){return void 0===i&&(i=""),void 0===r&&(r=""),e.createElement("input",t,{placeholder:i,defaultValue:r})},e}();function p(){var e,i=d.createElement("div","sa-commercial"),r=d.createElement("div","sa-commercial__text"),n=d.createElement("span",""),s=d.createElement("span","sa-commercial__product",{innerHTML:(e=!!t.glc&&t.glc(1),e&&e.toLocaleDateString?u.getString("license2").replace("{date}",e.toLocaleDateString()):u.getString("license"))});return i.appendChild(r).appendChild(n),n.appendChild(s),i}var g=function(){function e(){}return e.zipArrays=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=[],r=function(t){i[t]=[],e.forEach(function(e){i[t].push(e[t])})},n=0;n<e[0].length;n++)r(n);return i},e.unzipArrays=function(e){var t=[];return e.forEach(function(e,i){e.forEach(function(e,r){t[r]||(t[r]=[]),t[r][i]=e})}),t},e.sortDictionary=function(e,t,i){var r=this.zipArrays(e,t),n=function(e,t,i){void 0===i&&(i=!0);var r=e[1]<t[1]?1:e[1]==t[1]?0:-1;return i?r:-1*r};r.sort(function(e,t){return i?n(e,t,!1):n(e,t)});var s=this.unzipArrays(r);return{keys:s[0],values:s[1]}},e.toPercentage=function(e,t){return e/t*100},e}();function f(e,t){void 0===t&&(t=2);var i=Math.pow(10,t);return Math.round(i*e)/i}var m=function(){function e(e){void 0===e&&(e=[]),this._data=e,this.filterValues={},this.onFilterChanged=new t.Event,this.onDataChanged=new t.Event}return Object.defineProperty(e.prototype,"data",{get:function(){if(Array.isArray(this._data))return this._data},set:function(e){Array.isArray(e)?this._data=[].concat(e):this._data=e,this.raiseDataChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataFn",{get:function(){if("function"==typeof this._data)return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filteredData",{get:function(){var t=this;void 0===this._filteredData&&(Object.keys(this.filterValues).length>0?this._filteredData=this.data.filter(function(i){return!Object.keys(t.filterValues).some(function(r){var n=t.filterValues[r],s=typeof n,o=i[r];if(Array.isArray(o))return"object"===s?!function(e,t){for(var i=0;i<e.length;i++)if(v(e[i],t))return!0;return!1}(o,n):-1==o.indexOf(n);if("object"==typeof o)return"object"!==s||!v(o,n);var a=i[e.seriesMarkerKey];if(a&&"object"===s)return o!==n[a];if("object"===s&&void 0!==n.start&&void 0!==n.end){var l="number"==typeof o?o:Date.parse(o);return!(!isNaN(l)||(l=parseFloat(o),!isNaN(l)))||(l<n.start||l>=n.end)}return i[r]!==t.filterValues[r]})}):this._filteredData=this.data);return this._filteredData},enumerable:!1,configurable:!0}),e.prototype.setFilter=function(e,t){var i=!0;void 0!==t?(i=this.filterValues[e]!==t)&&(this.filterValues[e]=t):(i=void 0!==this.filterValues[e])&&delete this.filterValues[e],i&&(this.raiseFilterChanged(e,t),this.raiseDataChanged())},e.prototype.resetFilter=function(){var e=this;0!==Object.keys(this.filterValues).length&&(Object.keys(this.filterValues).forEach(function(t){return delete e.filterValues[t]}),this.raiseFilterChanged(),this.raiseDataChanged())},e.prototype.raiseFilterChanged=function(e,t){this.onFilterChanged.isEmpty||this.onFilterChanged.fire(this,{questionName:e,selectedValue:t})},e.prototype.raiseDataChanged=function(e){this._filteredData=void 0,this.onDataChanged.isEmpty||this.onDataChanged.fire(this,{questionName:e})},e.prototype.getFilters=function(){var e=this;return Object.keys(this.filterValues).map(function(t){return{field:t,type:"=",value:e.filterValues[t]}})},e.prototype.fixDropdownData=function(t){(this.data||[]).forEach(function(i){var r=i[t[0]];if(r&&"object"==typeof r&&!Array.isArray(r)){var n=[];Object.keys(r).forEach(function(t){var i=Object.assign({},r[t]);i[e.seriesMarkerKey]=t,n.push(i)}),i[t[0]]=n}})},e.seriesMarkerKey="__sa_series_name",e}();function v(e,t){var i=Object.keys(e),r=Object.keys(t);if(r.length>i.length)return!1;for(var n=0,s=r;n<s.length;n++){var o=s[n];if(t[o]!=e[o])return!1}return!0}var _=function(){function e(){}return e.registerVisualizer=function(t,i,r){void 0===r&&(r=Number.MAX_VALUE);var n=e.vizualizers[t];n||(n=[],e.vizualizers[t]=n),n.push({ctor:i,index:r})},e.unregisterVisualizer=function(t,i){var r=[t];t||(r=Object.keys(e.vizualizers)),r.forEach(function(t){if(i){var r=e.vizualizers[t];if(r){var n=r.filter(function(e){return e.ctor===i})[0];if(n){var s=r.indexOf(n);-1!==s&&r.splice(s,1)}}}else e.vizualizers[t]=[]})},e.unregisterVisualizerForAll=function(t){e.unregisterVisualizer(void 0,t)},e.getVisualizersByType=function(t,i){var r=e.vizualizers[t];return!i||r&&0!=r.length||(r=e.vizualizers[i]),r?((r=[].concat(r)).sort(function(e,t){return e.index-t.index}),r.map(function(e){return e.ctor})):e.defaultVisualizer.suppressVisualizerStubRendering?[]:[e.defaultVisualizer]},e.getAltVisualizerSelector=function(){return e.alternativesVisualizer||e.defaultVisualizer},e.registerAltVisualizerSelector=function(t){e.alternativesVisualizer=t},e.getPivotVisualizerConstructor=function(){return e.pivotVisualizer||e.defaultVisualizer},e.registerPivotVisualizer=function(t){e.pivotVisualizer=t},e.defaultVisualizer=void 0,e.alternativesVisualizer=void 0,e.pivotVisualizer=void 0,e.vizualizers={},e}(),y=function(){function e(){}return e.createVisualizer=function(e,i,r){var n=e.getType(),s=[],o=e,a=Object.assign({},r);if("text"===n&&e.inputType)s=_.getVisualizersByType(e.inputType,n);else{var l=void 0;e instanceof t.QuestionCustomModel?l=e.getDynamicType():e instanceof t.QuestionCompositeModel&&(l="composite"),s=_.getVisualizersByType(n,l)}var u=s.map(function(e){return new e(o,i,a)});return u.length>1?new(_.getAltVisualizerSelector())(u,o,i,a):u[0]},e}();function b(e,t){var i=t.dataNames,r=[],n=t.getValues(),s={};n.forEach(function(e,t){s[e]=t});var o=-1!==n.indexOf(void 0),a=t.getSeriesValues(),l={};a.forEach(function(e,t){l[e]=t});for(var u=a.length||1,h=0;h<i.length;++h){for(var c=new Array,d=0;d<u;++d)c.push(new Array(n.length).fill(0));r.push(c)}var p=function(e){return null!==e&&"object"==typeof e?s[e.value]:s[e]};return e.forEach(function(e){w(e,t).forEach(function(e){i.forEach(function(t,i){!function(e,t,i){var n=e[t];if(void 0!==n||o){var s=Array.isArray(n)?n:[n];if(a.length>0){var u=e[m.seriesMarkerKey];if(void 0!==u){var h=l[u]||0;s.forEach(function(e){var t=p(e);r[i][h][t]++})}else s.forEach(function(e){a.forEach(function(t){if(void 0!==e[t]){var n=l[t]||0;(Array.isArray(e[t])?e[t]:[e[t]]).forEach(function(e){var t=p(e);r[i][n][t]++})}})})}else s.forEach(function(e){var t=p(e);r[0][0][t]++})}}(e,t,i)})})}),t.dataNames.length>1?r:r[0]}function w(e,t){var i=[];if(t.dataPath){if(void 0===e[t.dataPath])return[];if("object"!=typeof e[t.dataPath])return[];i=Array.isArray(e[t.dataPath])?e[t.dataPath]:[e[t.dataPath]]}else i=[e];return i}var C=function(){function e(){}return e.postpone=function(t,i){return e.postponeFunction?e.postponeFunction(t,i):setTimeout(t,i)},e}(),T=function(){function e(i,r,n,s){void 0===n&&(n={});var o,a=this;this.question=i,this.options=n,this._type=s,this._showToolbar=!0,this._footerVisualizer=void 0,this._dataProvider=void 0,this._getDataCore=void 0,this.labelTruncateLength=27,this.haveCommercialLicense=!1,this.renderResult=void 0,this.toolbarContainer=void 0,this.headerContainer=void 0,this.contentContainer=void 0,this.footerContainer=void 0,this._supportSelection=!1,this._chartAdapter=void 0,this._footerIsCollapsed=void 0,this.onAfterRender=new t.Event,this.onLocaleChanged=new t.Event,this.onStateChanged=new t.Event,this.toolbarItemCreators={},this._backgroundColor="#f7f7f7",this._calculationsCache=void 0,this.loadingData=!1,this._settingState=!1;var l=t.hasLicense;this.haveCommercialLicense=!!l&&l(4)||e.haveCommercialLicense||void 0!==n.haveCommercialLicense&&n.haveCommercialLicense,this._getDataCore=null===(o=this.questionOptions)||void 0===o?void 0:o.getDataCore,this._dataProvider=n.dataProvider||new m(r),this._dataProvider.onDataChanged.add(function(){return a.onDataChanged()}),this.loadingData=!!this._dataProvider.dataFn,void 0!==n.labelTruncateLength&&(this.labelTruncateLength=n.labelTruncateLength)}return e.prototype.afterRender=function(e){this.onAfterRender.fire(this,{htmlElement:e})},e.prototype.stateChanged=function(e,t){this._settingState||this.onStateChanged.fire(this,this.getState())},e.prototype.getToolbarItemCreators=function(){return Object.assign({},this.toolbarItemCreators,this.onGetToolbarItemCreators&&this.onGetToolbarItemCreators()||{})},Object.defineProperty(e.prototype,"questionOptions",{get:function(){var e;return this.options[null===(e=this.question)||void 0===e?void 0:e.name]},enumerable:!1,configurable:!0}),e.prototype.onDataChanged=function(){this._calculationsCache=void 0,this.loadingData=!!this._dataProvider.dataFn,this.refresh()},Object.defineProperty(e.prototype,"name",{get:function(){return this.question.valueName||this.question.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataNames",{get:function(){return[this.name]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataPath",{get:function(){return this.options.dataPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasHeader",{get:function(){return!(!this.options||!this.options.showCorrectAnswers)&&(!!this.question&&!!this.question.correctAnswer)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasFooter",{get:function(){return!!this.question&&(this.question.hasComment||this.question.hasOther)},enumerable:!1,configurable:!0}),e.prototype.createVisualizer=function(e,t,i){var r=Object.assign({},t||this.options);return void 0===r.dataProvider&&(r.dataProvider=this.dataProvider),y.createVisualizer(e,i||this.data,r)},Object.defineProperty(e.prototype,"footerVisualizer",{get:function(){var e=this;if(this.hasFooter){if(!this._footerVisualizer){var i=new t.QuestionCommentModel(this.question.name+(t.settings||{}).commentPrefix);i.title=this.processText(this.question.title);var r=Object.assign({},this.options);r.renderContent=void 0,this._footerVisualizer=this.createVisualizer(i,r),this._footerVisualizer&&(this._footerVisualizer.onUpdate=function(){return e.invokeOnUpdate()})}return this._footerVisualizer}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportSelection",{get:function(){return(void 0===this.options.allowSelection||this.options.allowSelection)&&this._supportSelection},enumerable:!1,configurable:!0}),e.prototype.getSeriesValues=function(){return this.options.seriesValues||[]},e.prototype.getSeriesLabels=function(){return this.options.seriesLabels||this.getSeriesValues()},e.prototype.getValues=function(){throw new Error("Method not implemented.")},e.prototype.getLabels=function(){return this.getValues()},e.prototype.registerToolbarItem=function(e,t,i){void 0===i&&(i=100),this.toolbarItemCreators[e]={creator:t,order:i}},e.prototype.unregisterToolbarItem=function(e){if(void 0!==this.toolbarItemCreators[e]){var t=this.toolbarItemCreators[e];return delete this.toolbarItemCreators[e],t.creator}},Object.defineProperty(e.prototype,"title",{get:function(){return this.getTitle(this.question)},enumerable:!1,configurable:!0}),e.prototype.getTitle=function(e){var t;return void 0===e?"":this.processText((null===(t=e.locTitle)||void 0===t?void 0:t.renderedHtml)?e.locTitle.renderedHtml:e.title)},Object.defineProperty(e.prototype,"type",{get:function(){return this._type||"visualizer"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.dataProvider.filteredData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"surveyData",{get:function(){return this.dataProvider.filteredData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataProvider",{get:function(){return this._dataProvider},enumerable:!1,configurable:!0}),e.prototype.updateData=function(e){this.dataProvider.data=e,this.hasFooter&&this.footerVisualizer.updateData(e)},e.prototype.invokeOnUpdate=function(){this.onUpdate&&this.onUpdate()},e.prototype.destroy=function(){this.renderResult&&(this.clear(),this.toolbarContainer=void 0,this.headerContainer=void 0,this.contentContainer=void 0,this.footerContainer=void 0,this.renderResult.innerHTML="",this.renderResult=void 0),this._footerVisualizer&&(this._footerVisualizer.destroy(),this._footerVisualizer.onUpdate=void 0,this._footerVisualizer=void 0)},e.prototype.clear=function(){this.toolbarContainer&&this.destroyToolbar(this.toolbarContainer),this.headerContainer&&this.destroyHeader(this.headerContainer),this.contentContainer&&this.destroyContent(this.contentContainer),this.footerContainer&&this.destroyFooter(this.footerContainer)},e.prototype.createToolbarItems=function(e){var t=this.getToolbarItemCreators();Object.keys(t||{}).map(function(e){return s({name:e},t[e])}).sort(function(e,t){return e.order-t.order}).forEach(function(t){var i=t.creator(e);i&&e.appendChild(i)})},e.prototype.getCorrectAnswerText=function(){return this.question?this.question.correctAnswer:""},e.prototype.destroyToolbar=function(e){e.innerHTML=""},e.prototype.renderToolbar=function(e){if(this.showToolbar){var t=d.createElement("div","sa-toolbar");this.createToolbarItems(t),e.appendChild(t)}},e.prototype.destroyHeader=function(e){this.options&&"function"==typeof this.options.destroyHeader?this.options.destroyHeader(e,this):e.innerHTML=""},e.prototype.destroyContent=function(e){this.options&&"function"==typeof this.options.destroyContent?this.options.destroyContent(e,this):this._chartAdapter&&this._chartAdapter.destroy(e.children[0]),e.innerHTML=""},e.prototype.renderHeader=function(e){if(this.options&&"function"==typeof this.options.renderHeader)this.options.renderHeader(e,this);else{var t=d.createElement("div","sa-visualizer__correct-answer");t.innerText=u.getString("correctAnswer")+this.getCorrectAnswerText(),e.appendChild(t)}},e.prototype.renderContentAsync=function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(i){switch(i.label){case 0:return this._chartAdapter?(t=d.createElement("div"),e.innerHTML="",e.appendChild(t),[4,this._chartAdapter.create(t)]):[3,2];case 1:return i.sent(),[3,3];case 2:e.innerText=u.getString("noVisualizerForQuestion"),i.label=3;case 3:return[2,e]}})})},e.prototype.ensureQuestionIsReady=function(){var e=this;return new Promise(function(t){e.question?e.question.waitForQuestionIsReady().then(function(){return t()}):t()})},e.prototype.renderContent=function(e){var t=this;this.options&&"function"==typeof this.options.renderContent?!1!==this.options.renderContent(e,this)&&this.afterRender(e):(this.loadingData&&this.renderLoadingIndicator(this.contentContainer),this.ensureQuestionIsReady().then(function(){return t.renderContentAsync(e).then(function(e){return t.afterRender(e)})}))},e.prototype.destroyFooter=function(e){e.innerHTML=""},Object.defineProperty(e.prototype,"isFooterCollapsed",{get:function(){return void 0===this._footerIsCollapsed&&(this._footerIsCollapsed=e.otherCommentCollapsed),this._footerIsCollapsed},set:function(e){this._footerIsCollapsed=e},enumerable:!1,configurable:!0}),e.prototype.renderFooter=function(e){var t=this;if(e.innerHTML="",this.hasFooter){var i=d.createElement("h4","sa-visualizer__footer-title",{innerText:u.getString("otherCommentTitle")});e.appendChild(i);var r=d.createElement("div","sa-visualizer__footer-content");r.style.display=this.isFooterCollapsed?"none":"block";var n=u.getString(this.isFooterCollapsed?"showButton":"hideButton"),s=d.createButton(function(){"none"===r.style.display?(r.style.display="block",s.innerText=u.getString("hideButton"),t._footerIsCollapsed=!1):(r.style.display="none",s.innerText=u.getString("showButton"),t._footerIsCollapsed=!0),t.footerVisualizer.invokeOnUpdate()},n);e.appendChild(s),e.appendChild(r),this.footerVisualizer.render(r)}},e.prototype.render=function(e){"string"==typeof e&&(e=document.getElementById(e)),this.renderResult=e,this.toolbarContainer=d.createElement("div","sa-visualizer__toolbar"),e.appendChild(this.toolbarContainer),this.renderToolbar(this.toolbarContainer),this.hasHeader&&(this.headerContainer=d.createElement("div","sa-visualizer__header"),e.appendChild(this.headerContainer),this.renderHeader(this.headerContainer)),this.contentContainer=d.createElement("div","sa-visualizer__content"),e.appendChild(this.contentContainer),this.renderContent(this.contentContainer),this.footerContainer=d.createElement("div","sa-visualizer__footer"),e.appendChild(this.footerContainer),this.renderFooter(this.footerContainer)},e.prototype.updateToolbar=function(){var e=this;this.toolbarContainer&&C.postpone(function(){e.destroyToolbar(e.toolbarContainer),e.renderToolbar(e.toolbarContainer)})},e.prototype.isSupportSoftUpdateContent=function(){return!1},e.prototype.softUpdateContent=function(){},e.prototype.hardUpdateContent=function(){this.destroyContent(this.contentContainer),this.renderContent(this.contentContainer)},e.prototype.updateContent=function(){this.isSupportSoftUpdateContent()?this.softUpdateContent():this.hardUpdateContent()},e.prototype.refresh=function(){var e=this;this.headerContainer&&C.postpone(function(){e.destroyHeader(e.headerContainer),e.renderHeader(e.headerContainer),e.invokeOnUpdate()}),this.contentContainer&&C.postpone(function(){e.updateContent(),e.invokeOnUpdate()}),this.footerContainer&&C.postpone(function(){e.destroyFooter(e.footerContainer),e.renderFooter(e.footerContainer),e.invokeOnUpdate()})},e.prototype.processText=function(e){return!1!==this.options.stripHtmlFromTitles?(e||"").replace(/(<([^>]+)>)/gi,""):e},e.prototype.getRandomColor=function(){var e=this.getColors();return e[Math.floor(Math.random()*e.length)]},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this.getBackgroundColorCore()},set:function(e){this.setBackgroundColorCore(e)},enumerable:!1,configurable:!0}),e.prototype.getBackgroundColorCore=function(){return this._backgroundColor},e.prototype.setBackgroundColorCore=function(e){this._backgroundColor=e,this.footerVisualizer&&(this.footerVisualizer.backgroundColor=e)},e.prototype.getColors=function(t){void 0===t&&(t=10);for(var i=Array.isArray(e.customColors)&&e.customColors.length>0?e.customColors:e.colors,r=[],n=0;n<t;n++)r=r.concat(i);return r},Object.defineProperty(e.prototype,"showToolbar",{get:function(){return this._showToolbar},set:function(e){e!=this._showToolbar&&(this._showToolbar=e,this.toolbarContainer&&(this.destroyToolbar(this.toolbarContainer),this.renderToolbar(this.toolbarContainer)))},enumerable:!1,configurable:!0}),e.prototype.getData=function(){return this.getCalculatedValuesCore()},e.prototype.getCalculatedValuesCore=function(){return this._getDataCore?this._getDataCore(this):b(this.surveyData,this)},e.prototype.renderLoadingIndicator=function(e){var t,i;e.appendChild((t=d.createElement("div","sa-data-loading-indicator-panel"),(i=d.createElement("div","sa-data-loading-indicator")).innerHTML='\n <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_17928_11482)">\n <path d="M32 64C14.36 64 0 49.65 0 32C0 14.35 14.36 0 32 0C49.64 0 64 14.35 64 32C64 49.65 49.64 64 32 64ZM32 4C16.56 4 4 16.56 4 32C4 47.44 16.56 60 32 60C47.44 60 60 47.44 60 32C60 16.56 47.44 4 32 4Z" fill="#E5E5E5"></path>\n <path d="M53.2101 55.2104C52.7001 55.2104 52.1901 55.0104 51.8001 54.6204C51.0201 53.8404 51.0201 52.5704 51.8001 51.7904C57.0901 46.5004 60.0001 39.4704 60.0001 31.9904C60.0001 24.5104 57.0901 17.4804 51.8001 12.1904C51.0201 11.4104 51.0201 10.1404 51.8001 9.36039C52.5801 8.58039 53.8501 8.58039 54.6301 9.36039C60.6701 15.4004 64.0001 23.4404 64.0001 31.9904C64.0001 40.5404 60.6701 48.5704 54.6301 54.6204C54.2401 55.0104 53.7301 55.2104 53.2201 55.2104H53.2101Z" fill="#19B394"></path>\n </g>\n <defs>\n <clipPath id="clip0_17928_11482">\n <rect width="64" height="64" fill="white"></rect>\n </clipPath>\n </defs>\n </svg>\n ',t.appendChild(i),t))},e.prototype.convertFromExternalData=function(e){return e},e.prototype.getCalculatedValues=function(){var e=this;return new Promise(function(t,i){if(void 0!==e._calculationsCache&&t(e._calculationsCache),e.dataProvider.dataFn){e.loadingData=!0;var r=e.dataProvider.dataFn({visualizer:e,filter:e.dataProvider.getFilters(),callback:function(r){e.loadingData=!1,!r.error&&Array.isArray(r.data)?(e._calculationsCache=e.convertFromExternalData(r.data),t(e._calculationsCache)):i()}});r&&r.then(function(i){e.loadingData=!1,e._calculationsCache=e.convertFromExternalData(i),t(e._calculationsCache)}).catch(function(){e.loadingData=!1,i()})}else e._calculationsCache=e.getCalculatedValuesCore(),t(e._calculationsCache)})},e.prototype.getState=function(){return{}},e.prototype.setState=function(e){},e.prototype.resetState=function(){},Object.defineProperty(e.prototype,"locale",{get:function(){var e=this.options.survey;return e?e.locale:u.currentLocale},set:function(e){this.setLocale(e),this.onLocaleChanged.fire(this,{locale:e}),this.refresh()},enumerable:!1,configurable:!0}),e.prototype.setLocale=function(e){u.currentLocale=e;var t=this.options.survey;t&&t.locale!==e&&(t.locale=e)},e.haveCommercialLicense=!1,e.suppressVisualizerStubRendering=!1,e.chartAdapterType=void 0,e.otherCommentCollapsed=!0,e.customColors=[],e.colors=["#86e1fb","#3999fb","#ff6771","#1eb496","#ffc152","#aba1ff","#7d8da5","#4ec46c","#cf37a6","#4e6198"],e}();_.defaultVisualizer=T;var S=function(e){function t(t,i,r,n){void 0===r&&(r={});var s=e.call(this,t,i,r,n||"number")||this;return T.chartAdapterType&&(s._chartAdapter=new T.chartAdapterType(s),s.chartTypes=s._chartAdapter.getChartTypes(),s.chartType=s.chartTypes[0]),!1!==s.options.allowChangeVisualizerType&&s.registerToolbarItem("changeChartType",function(){return s.chartTypes.length>1?d.createSelector(s.chartTypes.map(function(e){return{value:e,text:u.getString("chartType_"+e)}}),function(e){return s.chartType===e.value},function(e){s.setChartType(e.target.value)}):null}),s}return n(t,e),t.prototype.onDataChanged=function(){this._resultAverage=void 0,this._resultMin=void 0,this._resultMax=void 0,e.prototype.onDataChanged.call(this)},t.prototype.onChartTypeChanged=function(){},t.prototype.setChartType=function(e){-1!==this.chartTypes.indexOf(e)&&this.chartType!==e&&(this.chartType=e,this.onChartTypeChanged(),this.contentContainer&&(this.destroyContent(this.contentContainer),this.renderContent(this.contentContainer)),this.invokeOnUpdate())},t.prototype.destroy=function(){this._resultAverage=void 0,this._resultMin=void 0,this._resultMax=void 0,e.prototype.destroy.call(this)},t.prototype.generateText=function(e,i,r){var n=[];if(5===r)n=["very high ("+e+")","high","medium","low","very low ("+i+")"];else{n.push(e);for(var s=0;s<r-2;s++)n.push("");n.push(i)}return t.generateTextsCallback?t.generateTextsCallback(this.question,e,i,r,n):n},t.prototype.generateValues=function(e,t){for(var i=[],r=0;r<t;r++)i.push(e/t);return i.push(e),i},t.prototype.generateColors=function(e,t,i){for(var r=this.getColors(),n=[],s=0;s<i;s++)n.push(r[s]);return n.push("rgba(255, 255, 255, 0)"),n},t.prototype.convertFromExternalData=function(e){return[e.value||0,e.minValue||0,e.maxValue||0]},t.prototype.getCalculatedValuesCore=function(){var e,t,i,r,n,s,o;return void 0!==this._resultAverage&&void 0!==this._resultMin&&void 0!==this._resultMax||(t=this.surveyData,i=this,r=Number.MAX_VALUE,n=-Number.MAX_VALUE,s=0,o=0,t.forEach(function(e){w(e,i).forEach(function(e){var t=e[i.dataNames[0]];if(void 0!==t){var a=+t;o++,s+=a,r>a&&(r=a),n<a&&(n=a)}})}),o>0&&(s/=o),e=[s=Math.ceil(100*s)/100,r,n],this._resultAverage=e[0],this._resultMin=e[1],this._resultMax=e[2]),[this._resultAverage,this._resultMin,this._resultMax]},t.stepsCount=5,t.showAsPercentage=!1,t}(T);_.registerVisualizer("number",S,200),_.registerVisualizer("rating",S,200),_.registerVisualizer("expression",S);var x=function(){function e(){}return e.setup=function(e,t,i){return this.setups[e](t,i)},e.setupPie=function(t,i){var r=i.datasets,n=i.labels,s=i.colors;i.texts;var o=i.seriesLabels,a=o.length>1||"matrix"===t.question.getType(),l=[],u={type:t.chartType,sort:!1,labels:n,customdata:n,text:n.map(function(i){return e.getTruncatedLabel(i,t.labelTruncateLength)}),hoverinfo:"value+text",textposition:"inside",texttemplate:"%{text}"};"doughnut"===t.chartType&&(u.type="pie",u.hole=.4),a||(u.mode="markers",u.marker={color:s},u.marker.symbol="circle",u.marker.size=16),r.forEach(function(i,r){var s=i.some(function(e){return 0!=e}),a=u.text;if(t.showPercentages){var h=t.getPercentages([i])[0];a=n.map(function(i,r){return(t.showOnlyPercentages?h[r]:e.getTruncatedLabel(i,t.labelTruncateLength)+"<br>"+h[r])+"%"})}s&&l.push(Object.assign({},u,{values:i,text:a,domain:{column:l.length%2,row:Math.floor(l.length/2)},title:{position:"bottom center",text:o[r]}}))});var h={font:{family:"Segoe UI, sans-serif",size:14,weight:"normal",color:"#404040"},height:((n.length<10?50*n.length+100:550)+25)*Math.ceil(l.length/2),margin:{l:0,t:25,b:0,r:10},colorway:s,hovermode:"closest",plot_bgcolor:t.backgroundColor,paper_bgcolor:t.backgroundColor,showlegend:!1};return a&&(h.annotations=[],h.grid={rows:Math.ceil(l.length/2),columns:2}),{traces:l,layout:h,hasSeries:a}},e.setupBar=function(t,i){var r=i.datasets,n=i.labels,s=i.colors,o=i.texts,a=i.seriesLabels,l=i.labelsTitle,h=i.valuesTitle,c=a.length>1||"matrix"===t.question.getType(),d=[],p={type:"line"===t.chartType?"line":"bar",y:n,customdata:n,hoverinfo:"text",orientation:"h",textposition:"none"};c||(p.width=.5,p.bargap=.5,p.mode="markers",p.marker={color:s}),r.forEach(function(e,i){var r=c?a[i]:n[i],s=t.showPercentages?"%":"",l=Object.assign({},p,{x:e,name:r,width:c&&"stackedbar"!==t.chartType?.5/a.length:.5,text:o[i],hovertext:n.map(function(e,n){return t.showOnlyPercentages?"".concat(o[i][n]).concat(s):c?"".concat(r," : ").concat(e,", ").concat(o[i][n]).concat(s):"".concat(o[i][n]).concat(s,", ").concat(e)})});if(t.showPercentages){var u=t.showOnlyPercentages?"%{text}%":"%{value} (%{text}%)";l.textposition="inside",l.texttemplate=u,l.width=c&&"stackedbar"!==t.chartType?.7/a.length:.9,l.bargap=c&&"stackedbar"!==t.chartType?.3/a.length:.1}d.push(l)});var g={font:{family:"Segoe UI, sans-serif",size:14,weight:"normal",color:"#404040"},height:30*(n.length+1)+30+30,margin:{t:30,b:30,r:10},colorway:s,hovermode:"closest",plot_bgcolor:t.backgroundColor,paper_bgcolor:t.backgroundColor,showlegend:c,barmode:c&&"stackedbar"==t.chartType?"stack":"group",xaxis:{rangemode:"nonnegative",automargin:!0},yaxis:{automargin:!0,type:"category",orientation:"h",tickmode:"array",tickvals:n,ticktext:n.map(function(i){return e.getTruncatedLabel(i,t.labelTruncateLength)+" "})}};return l&&(g.yaxis.title={text:l}),h&&(g.xaxis.title={text:h}),c&&"stackedbar"!==t.chartType&&(g.height=30*(n.length*a.length+1)+30+30),-1!==["ar","fa"].indexOf(u.currentLocale)&&(g.xaxis.autorange="reversed",g.yaxis.side="right",g.legend={x:0,y:1,xanchor:"left",yanchor:"top"}),{traces:d,layout:g,hasSeries:c}},e.setupVBar=function(t,i){var r=i.datasets,n=i.labels,s=i.colors,o=i.texts,a=i.seriesLabels,l=i.labelsTitle,u=i.valuesTitle,h=a.length>1||"matrix"===t.question.getType();if("histogram"!==t.type&&"pivot"!==t.type){n=[].concat(n).reverse(),a=[].concat(a).reverse(),s=[].concat(s.slice(0,h?a.length:n.length)).reverse();var c=[];o.forEach(function(e){c.push([].concat(e).reverse())}),o=c;var d=[];r.forEach(function(e){d.push([].concat(e).reverse())}),r=d}var p=[],g={type:"line"===t.chartType?"line":"bar",x:n,customdata:h?a:n,hoverinfo:h?void 0:"x+y",orientation:"v",textposition:"none"};h||(g.width=.5,g.bargap=.5,g.mode="markers",g.marker={color:s}),r.forEach(function(e,i){var r=Object.assign({},g,{y:e,name:h?a[i]:n[i],text:o[i]});if(t.showPercentages){var s=t.showOnlyPercentages?"%{text}%":"%{value} (%{text}%)";r.textposition="inside",r.texttemplate=s,h||(r.width=.9,r.bargap=.1)}p.push(r)});var f=Math.ceil(n.length/50),m={font:{family:"Segoe UI, sans-serif",size:14,weight:"normal",color:"#404040"},margin:{t:30,b:30,r:10},colorway:s,hovermode:"closest",plot_bgcolor:t.backgroundColor,paper_bgcolor:t.backgroundColor,showlegend:h,yaxis:{rangemode:"nonnegative",automargin:!0},xaxis:{automargin:!0,type:"category",tickmode:"array",tickvals:n,ticktext:n.map(function(i,r){return n.length>50&&r%f!==0?"":e.getTruncatedLabel(i,t.labelTruncateLength)})}};return l&&(m.xaxis.title={text:l}),u&&(m.yaxis.title={text:u}),t.showPercentages&&t.showOnlyPercentages&&(m.yaxis={automargin:!0,tickformat:".0%",range:[0,1],ticklen:t.showOnlyPercentages?25:5,tickcolor:"transparent"}),t.getValueType&&"date"==t.getValueType()||(m.xaxis={automargin:!0,type:"category"}),{traces:p,layout:m,hasSeries:h}},e.setupScatter=function(t,i){var r=i.datasets,n=i.labels,s=i.colors;i.texts;var o=i.seriesLabels,a=o.length>1||"matrix"===t.question.getType(),l=[],u={type:"scatter",y:(a?o:n).map(function(i){return e.getTruncatedLabel(i,t.labelTruncateLength)}),customdata:a?o:n,text:a?o:n,hoverinfo:"x+y",orientation:"h",mode:"markers",width:.5,marker:{}};a||(u.marker.symbol="circle",u.marker.size=16),r.forEach(function(e){var t=Object.assign({},u,{x:e});l.push(t)});var h={font:{family:"Segoe UI, sans-serif",size:14,weight:"normal",color:"#404040"},height:30*(n.length+1)+30+30,margin:{t:30,b:30,r:10},colorway:s,hovermode:"closest",yaxis:{automargin:!0,type:"category",ticklen:5,tickcolor:"transparent"},xaxis:{rangemode:"nonnegative",automargin:!0},plot_bgcolor:t.backgroundColor,paper_bgcolor:t.backgroundColor,showlegend:!1};return a&&(h.showlegend=!0,h.height=void 0,n.forEach(function(e,t){l[t].hoverinfo="x+name",l[t].marker.color=void 0,l[t].name=e})),{traces:l,layout:h,hasSeries:a}},e.setupGauge=function(e,t){var i=t,r=i[0],n=i[1],s=i[2];if("rating"===e.question.getType()){var o=e.question.visibleRateValues;s=o[o.length-1].value,n=o[0].value}var a=e.generateColors(s,n,S.stepsCount);S.showAsPercentage&&(r=g.toPercentage(r,s),n=g.toPercentage(n,s),s=g.toPercentage(s,s));var l=[{type:"indicator",mode:"gauge+number",gauge:{axis:{range:[n,s]},shape:e.chartType,bgcolor:"white",bar:{color:a[0]}},value:r,text:e.name,domain:{x:[0,1],y:[0,1]}}],u="bullet"===e.chartType?60:30;return{traces:l,layout:{height:250,margin:{l:u,r:u,b:u,t:u,pad:5},plot_bgcolor:e.backgroundColor,paper_bgcolor:e.backgroundColor},hasSeries:!1}},e.setupRadar=function(t,i){var r=i.datasets,n=i.labels,o=i.colors,a=i.texts,l=i.seriesLabels,u=l.length>1||"matrix"===t.question.getType(),h=[],c={type:"scatterpolar",mode:"lines+markers",fill:"toself",line:{width:2},marker:{size:6}};r.forEach(function(e,t){var i=u?l[t]:"",r=Object.assign({},c,{r:e,theta:n,name:i,text:a[t],hoverinfo:"r+theta+name",customdata:n,hovertemplate:"%{theta}: %{r}<extra></extra>",line:s(s({},c.line),{color:o[t%o.length]}),marker:s(s({},c.marker),{color:o[t%o.length]})});h.push(r)});var d={font:{family:"Segoe UI, sans-serif",size:14,weight:"normal",color:"#404040"},polar:{radialaxis:{visible:!0,range:[0,1.1*Math.max.apply(Math,r.map(function(e){return Math.max.apply(Math,e)}))],tickfont:{size:12}},angularaxis:{tickfont:{size:12},ticktext:n.map(function(i){return e.getTruncatedLabel(i,t.labelTruncateLength)}),tickvals:n}},showlegend:u,colorway:o,plot_bgcolor:t.backgroundColor,paper_bgcolor:t.backgroundColor,margin:{l:50,r:50,t:50,b:50}};return{traces:h,layout:d,hasSeries:u}},e.imageExportFormat="png",e.onImageSaving=new t.Event,e.onPlotCreating=new t.Event,e.setups={bar:e.setupBar,vbar:e.setupVBar,line:e.setupVBar,stackedbar:e.setupBar,doughnut:e.setupPie,pie:e.setupPie,scatter:e.setupScatter,gauge:e.setupGauge,bullet:e.setupGauge,radar:e.setupRadar},e.getTruncatedLabel=function(e,t){return t?-1===t||e.length<=t+3?e:e.substring(0,t)+"...":e},e}(),P=function(){function e(e){this._htmlElement=void 0,this.text=void 0,this._htmlElement=d.createElement("div","sa-question__filter"),this.text=d.createElement("span","sa-question__filter-text"),this._htmlElement.appendChild(this.text);var t=d.createButton(function(){e.setSelection(void 0)},u.getString("clearButton"));this._htmlElement.appendChild(t)}return Object.defineProperty(e.prototype,"htmlElement",{get:function(){return this._htmlElement},enumerable:!1,configurable:!0}),e.prototype.update=function(e){void 0!==e&&void 0!==e.value?(this._htmlElement.style.display="inline-flex",this.text.innerText=u.getString("filter")+": ["+e.text+"]"):(this._htmlElement.style.display="none",this.text.innerText="")},e}();function A(e){var t={datasets:[],labels:[],colors:[],texts:[],seriesLabels:[]};if(0===e.seriesLabels.length){t.datasets.push([]),t.texts.push([]);for(var i=0;i<e.datasets[0].length;i++)0!=e.datasets[0][i]&&(t.datasets[0].push(e.datasets[0][i]),t.labels.push(e.labels[i]),t.colors.push(e.colors[i]),t.texts[0].push(e.texts[0][i]));return t}var r=[];r.length=e.seriesLabels.length;var n=[];n.length=e.labels.length;for(var s=0;s<e.seriesLabels.length;s++)for(var o=0;o<e.labels.length;o++)0!=e.datasets[s][o]&&(r[s]=!0,n[o]=!0);for(o=0;o<n.length;o++)n[o]&&(t.labels.push(e.labels[o]),t.colors.push(e.colors[o]));for(s=0;s<e.seriesLabels.length;s++)r[s]&&t.seriesLabels.push(e.seriesLabels[s]);for(s=0;s<e.datasets.length;s++)if(r[s]){var a=[],l=[];for(o=0;o<e.labels.length;o++)n[o]&&(a.push(e.datasets[s][o]),l.push(e.texts[s][o]));t.datasets.push(a),t.texts.push(l)}return t}var D=function(e){function i(r,n,s,o){var a=e.call(this,r,n,s,o||"selectBase")||this;if(a.selectedItem=void 0,a.choicesOrderSelector=void 0,a.showPercentageBtn=void 0,a.emptyAnswersBtn=void 0,a.transposeDataBtn=void 0,a.topNSelector=void 0,a._showOnlyPercentages=!1,a._percentagePrecision=2,a._answersOrder="default",a._hideEmptyAnswers=!1,a._topN=-1,a.topNValues=[].concat(i.topNValuesDefaults),a._transposeData=!1,a._showMissingAnswers=!1,a.missingAnswersBtn=void 0,a.chartTypes=[],a._chartType="bar",a.onAnswersDataReady=new t.Event,r&&(r.visibleChoicesChangedCallback=function(){a.dataProvider.raiseDataChanged()},"function"==typeof r.getSurvey)){var l=r.getSurvey();l&&(l.showInvisibleElements=!0)}return a._supportSelection=!0,a._showOnlyPercentages=!0===a.options.showOnlyPercentages,void 0!==a.options.percentagePrecision&&(a._percentagePrecision=a.options.percentagePrecision),void 0!==a.options.transposeData&&(a._transposeData=a.options.transposeData),a._hideEmptyAnswers=!0===a.options.hideEmptyAnswers,a._answersOrder=a.options.answersOrder||"default",a._showMissingAnswers=a.isSupportMissingAnswers()&&!0===a.options.showMissingAnswers,a.options.allowExperimentalFeatures,T.chartAdapterType&&(a._chartAdapter=new T.chartAdapterType(a),a.chartTypes=a._chartAdapter.getChartTypes(),a.getSeriesValues().length>0&&-1===a.chartTypes.indexOf("stackedbar")&&a.chartTypes.push("stackedbar"),a._chartType=a.chartTypes[0],-1!==a.chartTypes.indexOf(a.options.defaultChartType)&&(a._chartType=a.options.defaultChartType)),!1!==a.options.allowChangeVisualizerType&&a.registerToolbarItem("changeChartType",function(){return a.chartTypes.length>1?d.createSelector(a.chartTypes.map(function(e){return{value:e,text:u.getString("chartType_"+e)}}),function(e){return a.chartType===e.value},function(e){a.setChartType(e.target.value)}):null}),a.registerToolbarItem("changeAnswersOrder",function(){return a.isSupportAnswersOrder()&&(a.choicesOrderSelector=d.createSelector([{text:u.getString("defaultOrder"),value:"default"},{text:u.getString("ascOrder"),value:"asc"},{text:u.getString("descOrder"),value:"desc"}],function(e){return!1},function(e){a.answersOrder=e.target.value}),a.updateOrderSelector()),a.choicesOrderSelector}),a.registerToolbarItem("showPercentages",function(){if(a.options.allowShowPercentages&&(-1!==a.chartTypes.indexOf("bar")||-1!==a.chartTypes.indexOf("stackedbar")))return a.showPercentageBtn=d.createButton(function(){a.showPercentages=!a.showPercentages}),a.updateShowPercentageBtn(),a.showPercentageBtn}),a.registerToolbarItem("hideEmptyAnswers",function(){return a.options.allowHideEmptyAnswers&&(a.emptyAnswersBtn=d.createButton(function(){a.hideEmptyAnswers=!a._hideEmptyAnswers}),a.updateEmptyAnswersBtn()),a.emptyAnswersBtn},1e3),a.registerToolbarItem("topNAnswers",function(){return a.options.allowTopNAnswers&&0===a.getSeriesValues().length&&(a.topNSelector=d.createSelector(a.topNValues.map(function(e){return{text:u.getString("topNValueText"+e),value:e}}),function(e){return!1},function(e){a.topN=parseInt(e.target.value)}),a.updateTopNSelector()),a.topNSelector}),a.registerToolbarItem("transposeData",function(){return a.options.allowTransposeData&&(a.transposeDataBtn=d.createButton(function(){a.transposeData=!a.transposeData}),a.updateTransposeDataBtn()),a.transposeDataBtn}),a.registerToolbarItem("showMissingAnswers",function(){return a.isSupportMissingAnswers()&&a.options.allowShowMissingAnswers&&(a.missingAnswersBtn=d.createButton(function(){a.showMissingAnswers=!a._showMissingAnswers}),a.updateMissingAnswersBtn()),a.missingAnswersBtn}),a.registerToolbarItem("questionFilterInfo",function(){var e;return a.supportSelection&&(a.filterInfo=new P(a),a.filterInfo.update(a.selection)),null===(e=a.filterInfo)||void 0===e?void 0:e.htmlElement},900),a}return n(i,e),Object.defineProperty(i.prototype,"chartType",{get:function(){return this._chartType},set:function(e){this.setChartType(e)},enumerable:!1,configurable:!0}),i.prototype.updateEmptyAnswersBtn=function(){this.emptyAnswersBtn&&(this.emptyAnswersBtn.innerText=this._hideEmptyAnswers?u.getString("showEmptyAnswers"):u.getString("hideEmptyAnswers"),"bar"==this.chartType||"vbar"==this.chartType||"line"==this.chartType||"scatter"==this.chartType?this.emptyAnswersBtn.style.display="inline":this.emptyAnswersBtn.style.display="none")},i.prototype.updateTransposeDataBtn=function(){this.transposeDataBtn&&(this.transposeDataBtn.innerText=this.transposeData?u.getString("showPerColumns"):u.getString("showPerValues"),this.getSeriesValues().length>0?this.transposeDataBtn.style.display="inline":this.transposeDataBtn.style.display="none")},i.prototype.updateOrderSelector=function(){this.choicesOrderSelector&&("bar"==this.chartType||"vbar"==this.chartType||"line"==this.chartType||"scatter"==this.chartType||("pie"==this.chartType||"doughnut"==this.chartType)&&this.topN>0?this.choicesOrderSelector.style.display="inline-flex":this.choicesOrderSelector.style.display="none",this.choicesOrderSelector.getElementsByTagName("select")[0].value=this.answersOrder)},i.prototype.updateShowPercentageBtn=function(){this.showPercentageBtn&&(this.showPercentageBtn.innerText=this._showPercentages?u.getString("hidePercentages"):u.getString("showPercentages"),"bar"==this.chartType||"vbar"==this.chartType||"stackedbar"==this.chartType?this.showPercentageBtn.style.display="inline":this.showPercentageBtn.style.display="none")},i.prototype.updateTopNSelector=function(){this.topNSelector&&(this.topNSelector.getElementsByTagName("select")[0].value=this._topN)},i.prototype.updateMissingAnswersBtn=function(){this.missingAnswersBtn&&(this.missingAnswersBtn.innerText=this._showMissingAnswers?u.getString("hideMissingAnswers"):u.getString("showMissingAnswers"))},i.prototype.onChartTypeChanged=function(){this.updateOrderSelector(),this.updateShowPercentageBtn(),this.updateEmptyAnswersBtn(),this.updateTopNSelector(),this.stateChanged("chartType",this._chartType)},i.prototype.setChartType=function(e){-1!==this.chartTypes.indexOf(e)&&this._chartType!==e&&(this._chartType=e,this.onChartTypeChanged(),this.refreshContent())},i.prototype.getCorrectAnswerText=function(){var i=e.prototype.getCorrectAnswerText.call(this),r=Array.isArray(i)?i:[i],n=this.question;return r.map(function(e){return t.ItemValue.getTextOrHtmlByValue(n.visibleChoices,e)}).join(", ")},i.prototype.isSupportSoftUpdateContent=function(){return!this._hideEmptyAnswers},i.prototype.softUpdateContent=function(){var e,t=null===(e=this.contentContainer)||void 0===e?void 0:e.children[0];t&&this._chartAdapter.update(t)},i.prototype.getSelectedItemByValue=function(e){var i,r=this.question.visibleChoices;return null!==(i=t.ItemValue.getItemByValue(r,e))&&void 0!==i?i:void 0},i.prototype.getSelectedItemByText=function(e){var i;if(this.question instanceof t.QuestionRatingModel){var r=this.question.rateValues;return null!==(i=null==r?void 0:r.filter(function(t){return t.text===e})[0])&&void 0!==i?i:new t.ItemValue(parseFloat(e),e)}var n=this.question;return this.question.hasOther&&e==n.otherText?n.otherItem:n.visibleChoices.filter(function(t){return t.text===e})[0]},i.prototype.onDataChang