/*! For license information please see dll.FreeTextSurvey.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[49],{2416:function(e,t,a){var n=a(54),r=a(2417);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var l={insert:"head",singleton:!1};n(r,l);e.exports=r.locals||{}},2417:function(e,t,a){"use strict";a.r(t);var n=a(22),r=a.n(n)()(!1);r.push([e.i,".free-text-survey {\n\tborder: 1px solid rgba(92, 92, 92, 0.6);\n\tborder-radius: 6px;\n\tbox-shadow: 0 0 4px rgba(92, 92, 92, 0.5);\n\tmargin-top: 10px;\n\tmargin-right: 10px;\n\tmargin-bottom: 12px;\n\tmax-width: 600px;\n\tmargin-left: -20px;\n}\n",""]),t.default=r},842:function(e,t,a){"use strict";a.r(t);var n=a(14),r=a.n(n),l=a(12),s=a.n(l),u=a(10),i=a.n(u),o=a(15),c=a.n(o),d=a(16),f=a.n(d),m=a(8),p=a.n(m),h=a(7),b=a.n(h),v=a(0),y=a.n(v),E=a(1),g=a.n(E),w=a(74),x=a(86),S=a(969),N=a(66),_=a(958),R=a(2415),T=a(354),k=a(37),q=a.n(k),C=a(1189),M=a.n(C),D=a(1323),Y=a.n(D),A=a(1187),B=a.n(A),I=a(1325),O=a.n(I),P=a(62),U=a(212),F=a(141),J=a(145),Q=a(158),j=a(35),V=a(190);a(2416);function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=p()(e);if(t){var r=p()(this).constructor;a=Reflect.construct(n,arguments,r)}else a=n.apply(this,arguments);return f()(this,a)}}var z=q()("isle:free-text-survey"),L=Object(P.default)("free-text-survey");var G=function(e){c()(a,e);var t=X(a);function a(e){var n;return r()(this,a),n=t.call(this,e),b()(i()(n),"submitQuestion",(function(){var e=n.context,t=function(e){e=B()(e);for(var t=O()(e),a=0;a<R.length;a++)for(var n=0;n<t.length;n++)if(t[n]===R[a])return R[a];return null}(n.state.value);t?e.addNotification({title:"Action required",message:"Your answer contains an offensive word: ".concat(t,". Please remove."),level:"warning"}):(e.log({id:n.id,type:V.TEXT_SURVEY_SUBMISSION,value:n.state.value,anonymous:n.props.anonymous},"members"),n.setState({submitted:!0}),e.addNotification({title:"Submitted",message:"Your answer has been submitted.",level:"success"}),n.props.onSubmit(n.state.value))})),b()(i()(n),"onData",(function(e){z("FreeTextQuestion is receiving data: "+JSON.stringify(e));var t,a=Y()(e),r=a.map((function(e){return{x:e[0],y:e[1]}}));t=y.a.createElement("table",{className:"table table-bordered"},y.a.createElement("tr",null,y.a.createElement("th",null,"Category"),y.a.createElement("th",null,"Count"),y.a.createElement("th",null,"Relative Frequency")),a.map((function(e,t){return y.a.createElement("tr",{key:t},e.map((function(e,t){return 2===t&&(e=e.toFixed(3)),y.a.createElement("td",{key:t},e)})))}))),n.setState({data:r,freqTable:t})})),n.id=e.id||L(e),n.state={data:[],submitted:!1,value:null},n}return s()(a,[{key:"renderChart",value:function(){return M()(this.state.data)?y.a.createElement("h3",null,"No responses yet"):y.a.createElement(T.default,{data:[{x:this.state.data.map((function(e){return e.x})),y:this.state.data.map((function(e){return e.y})),type:"bar"}],layout:{width:400,height:300},removeButtons:!0})}},{key:"render",value:function(){var e=this,t=this.props,a=this.state.submitted&&!t.allowMultipleAnswers;return y.a.createElement(F.default,{user:!0,banner:y.a.createElement("h2",null,"Please sign in...")},y.a.createElement(x.default,{id:this.id,className:this.props.className,style:this.props.style},y.a.createElement(x.default.Body,{style:{overflowY:"auto"}},y.a.createElement(S.default,null,y.a.createElement(_.default,null,y.a.createElement(N.default,{md:6},y.a.createElement(x.default,{className:"free-text-survey",body:!0},y.a.createElement("label",null,t.question),y.a.createElement(U.default,{value:this.state.value,inline:!0,disabled:a,onChange:function(t){e.setState({value:t})},rows:this.props.rows}),y.a.createElement(w.default,{size:"small",variant:"success",block:!0,fill:!0,onClick:this.submitQuestion,disabled:a},a?"Submitted":"Submit"))),y.a.createElement(N.default,{md:6},y.a.createElement(Q.default,{for:[this.id],onData:this.onData}),this.renderChart(),this.state.freqTable))),y.a.createElement(J.default,{buttonLabel:"Responses",id:this.id,info:V.TEXT_SURVEY_SUBMISSION}))))}}]),a}(v.Component);G.defaultProps={question:"",allowMultipleAnswers:!1,anonymous:!1,rows:4,className:"",style:{},onSubmit:function(){}},G.propTypes={question:g.a.string,allowMultipleAnswers:g.a.bool,anonymous:g.a.bool,rows:g.a.number,className:g.a.string,style:g.a.object,onSubmit:g.a.func},G.contextType=j.default,t.default=G}}]);