/*! For license information please see dll.FreeTextSurvey.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[41],{1061:function(e,t,n){"use strict";n.r(t);var a=n(59),r=n.n(a),l=n(13),s=n.n(l),i=n(12),u=n.n(i),o=n(6),c=n.n(o),d=n(14),f=n.n(d),m=n(15),p=n.n(m),b=n(8),h=n.n(b),y=n(5),v=n.n(y),E=n(0),g=n.n(E),w=n(1),x=n.n(w),S=n(24),R=n(22),_=n(1153),T=n(65),k=n(1152),q=n(2877),N=n(513),C=n(25),M=n.n(C),D=n(1299),Y=n.n(D),A=n(1453),B=n.n(A),I=n(1297),O=n.n(I),P=n(1448),U=n.n(P),F=n(27),J=n(308),Q=n(141),j=n(36),V=n(233),X=n(20),z=n(18);n(2878);function L(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 n,a=h()(e);if(t){var r=h()(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return p()(this,n)}}var G=M()("isle:free-text-survey"),H=Object(F.default)("free-text-survey");var K=function(e){f()(n,e);var t=L(n);function n(e){var a;return s()(this,n),a=t.call(this,e),v()(c()(a),"submitQuestion",(function(){var e=a.context,t=function(e){e=O()(e);for(var t=U()(e),n=0;n<q.length;n++)for(var a=0;a<t.length;a++)if(t[a]===q[n])return q[n];return null}(a.state.value);t?e.addNotification({title:"Action required",message:"Your answer contains an offensive word: ".concat(t,". Please remove."),level:"warning"}):(e.log({id:a.id,type:z.TEXT_SURVEY_SUBMISSION,value:a.state.value,anonymous:a.props.anonymous},"members"),a.setState({submitted:!0}),e.addNotification({title:"Submitted",message:"Your answer has been submitted.",level:"success"}),a.props.onSubmit(a.state.value))})),v()(c()(a),"onData",(function(e){G("FreeTextQuestion is receiving data: "+JSON.stringify(e));var t,n=B()(e),r=n.map((function(e){return{x:e[0],y:e[1]}}));t=g.a.createElement("table",{className:"table table-bordered"},g.a.createElement("tr",null,g.a.createElement("th",null,"Category"),g.a.createElement("th",null,"Count"),g.a.createElement("th",null,"Relative Frequency")),n.map((function(e,t){return g.a.createElement("tr",{key:t},e.map((function(e,t){return 2===t&&(e=e.toFixed(3)),g.a.createElement("td",{key:t},e)})))}))),a.setState({data:r,freqTable:t})})),a.id=e.id||H(e),a.state={data:[],submitted:!1,value:null},a}return u()(n,[{key:"renderChart",value:function(){return Y()(this.state.data)?g.a.createElement("h3",null,"No responses yet"):g.a.createElement(N.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,n=this.state.submitted&&!t.allowMultipleAnswers;return g.a.createElement(Q.default,{user:!0,banner:g.a.createElement("h2",null,"Please sign in...")},g.a.createElement(R.default,{id:this.id,style:this.props.style},g.a.createElement(R.default.Body,{style:{overflowY:"auto"}},g.a.createElement(_.default,null,g.a.createElement(k.default,null,g.a.createElement(T.default,{md:6},g.a.createElement(R.default,{className:"free-text-survey",body:!0},g.a.createElement("label",null,t.question),g.a.createElement(J.default,r()({},t,{inline:!0,disabled:n,onChange:function(t){e.setState({value:t})},rows:this.props.rows})),g.a.createElement(S.default,{size:"small",variant:"success",block:!0,fill:!0,onClick:this.submitQuestion,disabled:n},n?"Submitted":"Submit"))),g.a.createElement(T.default,{md:6},g.a.createElement(V.default,{for:[this.id],onData:this.onData}),this.renderChart(),this.state.freqTable))),g.a.createElement(j.default,{buttonLabel:"Responses",id:this.id,info:z.TEXT_SURVEY_SUBMISSION}))))}}]),n}(E.Component);K.defaultProps={question:"",allowMultipleAnswers:!1,anonymous:!1,rows:4,style:{},onSubmit:function(){}},K.propTypes={id:x.a.string.isRequired,question:x.a.string,allowMultipleAnswers:x.a.bool,anonymous:x.a.bool,rows:x.a.number,style:x.a.object,onSubmit:x.a.func},K.contextType=X.default,t.default=K},2878:function(e,t,n){var a=n(30),r=n(2879);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var l={insert:"head",singleton:!1};a(r,l);e.exports=r.locals||{}},2879:function(e,t,n){(t=n(31)(!1)).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",""]),e.exports=t}}]);