{"version":3,"file":"react-datetime.cjs-crtD89Bs.js","sources":["../../../client/app/bundles/Shared/components/shared/textArea.tsx","../../../client/app/bundles/Shared/hooks/useWindowSize.tsx","../../../client/app/bundles/Teacher/components/modules/numberSuffixBuilder.js","../../../client/node_modules/react-datetime/dist/react-datetime.cjs.js"],"sourcesContent":["import * as React from 'react';\n\ninterface InputProps {\n timesSubmitted: Number;\n label?: string;\n error?: string;\n disabled?: boolean;\n className?: string;\n value?: string;\n placeholder?: string;\n id?: string;\n characterLimit?: number;\n handleCancel?: (event: any) => void;\n helperText?: string;\n handleChange?: (event: any) => void;\n onClick?: (event: any) => void;\n}\n\ninterface InputState {\n inactive: boolean;\n errorAcknowledged: boolean;\n}\n\nexport class TextArea extends React.Component {\n private input: any // eslint-disable-line react/sort-comp\n private node: any // eslint-disable-line react/sort-comp\n\n constructor(props) {\n super(props)\n\n this.state = {\n inactive: true,\n errorAcknowledged: false\n }\n\n this.activateInput = this.activateInput.bind(this)\n this.acknowledgeError = this.acknowledgeError.bind(this)\n this.handleClick = this.handleClick.bind(this)\n this.handleTab = this.handleTab.bind(this)\n this.deactivateInput = this.deactivateInput.bind(this)\n }\n\n UNSAFE_componentWillMount() {\n document.addEventListener('mousedown', this.handleClick, false)\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.error !== this.props.error && this.state.errorAcknowledged) {\n this.setState({ errorAcknowledged: false, })\n } else if (nextProps.timesSubmitted !== this.props.timesSubmitted && nextProps.error && this.state.errorAcknowledged) {\n this.setState({ errorAcknowledged: false, })\n }\n }\n\n componentWillUnmount() {\n document.removeEventListener('mousedown', this.handleClick, false)\n }\n\n activateInput() {\n if (!this.props.disabled) {\n this.setState({ inactive: false, }, () => this.input.focus())\n }\n }\n\n deactivateInput() {\n this.setState({ inactive: true, })\n }\n\n handleClick(e) {\n if (!this.node.contains(e.target)) {\n this.deactivateInput()\n }\n }\n\n acknowledgeError() {\n this.setState({ errorAcknowledged: true, inactive: false, }, () => this.input.focus())\n }\n\n handleTab(event) {\n if (event.key === 'Tab') {\n const form = event.target.form;\n const index = Array.prototype.indexOf.call(form, event.target);\n form.elements[index + 1].focus();\n event.preventDefault();\n this.deactivateInput()\n }\n }\n\n renderHelperText() {\n const { helperText } = this.props\n if (helperText) {\n return {helperText}\n }\n }\n\n renderCharacterLimit() {\n const { characterLimit, value, } = this.props\n if (characterLimit) {\n return
{value.length}/{characterLimit}
\n }\n }\n\n renderErrorText() {\n const { error } = this.props\n if (error) {\n return {error}\n }\n }\n\n renderCancelSymbol() {\n const { inactive } = this.state\n const { handleCancel } = this.props\n if (!inactive && handleCancel) {\n return
\n }\n }\n\n renderInput() {\n const { inactive, errorAcknowledged} = this.state\n const { className, label, handleChange, value, placeholder, error, id, disabled, characterLimit, } = this.props\n const hasText = value ? 'has-text' : ''\n const inactiveOrActive = inactive ? 'inactive' : 'active'\n const sharedClasses = `input-container textfield-container ${hasText} ${inactiveOrActive} ${className}`\n if (error) {\n if (errorAcknowledged) {\n return (\n this.node = node}\n >\n \n { this.input = input; }}\n value={value}\n />\n {this.renderCancelSymbol()}\n {this.renderCharacterLimit()}\n \n )\n } else {\n return (\n this.node = node}\n >\n \n { this.input = input; }}\n value={value}\n />\n {this.renderCancelSymbol()}\n {this.renderErrorText()}\n {this.renderCharacterLimit()}\n \n )\n }\n } else if (inactive) {\n return (\n this.node = node}\n >\n \n { this.input = input; }}\n />\n {this.renderHelperText()}\n {this.renderCharacterLimit()}\n \n )\n } else {\n return (\n this.node = node}\n >\n \n { this.input = input; }}\n value={value}\n />\n {this.renderCancelSymbol()}\n {this.renderCharacterLimit()}\n \n )\n }\n }\n\n render() {\n return
{this.renderInput()}
\n }\n\n}\n","import * as React from 'react';\n\n// from https://usehooks.com/useWindowSize/ on 08/31/20\nfunction useWindowSize() {\n // Initialize state with undefined width/height so server and client renders match\n // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/\n const [windowSize, setWindowSize] = React.useState({\n width: undefined,\n height: undefined,\n });\n\n React.useEffect(() => {\n // Handler to call on window resize\n function handleResize() {\n // Set window width/height to state\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n }\n\n // Add event listener\n window.addEventListener(\"resize\", handleResize);\n\n // Call handler right away so state gets updated with initial window size\n handleResize();\n\n // Remove event listener on cleanup\n return () => window.removeEventListener(\"resize\", handleResize);\n }, []); // Empty array ensures that effect is only run on mount\n\n return windowSize;\n}\n\nexport default useWindowSize\n","export default function (num) {\n let numS = String(num);\n const numL = numS.length - 1;\n if (num >= 11 && num <= 19) {\n numS += 'th';\n } else if (numS[numL] === '1') {\n numS += 'st';\n } else if (numS[numL] === '2') {\n numS += 'nd';\n } else if (numS[numL] === '3') {\n numS += 'rd';\n } else {\n numS += 'th';\n }\n return numS;\n}\n","module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\"a\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\"\",n(n.s=4)}([function(e,t){e.exports=require(\"react\")},function(e,t){e.exports=require(\"moment\")},function(e,t){e.exports=require(\"react-dom\")},function(e,t,n){e.exports=n(5)()},function(e,t,n){e.exports=n(7)},function(e,t,n){\"use strict\";var r=n(6);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error(\"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types\");throw s.name=\"Invariant Violation\",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){\"use strict\";e.exports=\"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED\"},function(e,t,n){\"use strict\";n.r(t);var r=n(3),o=n.n(r),i=n(1),a=n.n(i),s=n(0),c=n.n(s);function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t1;)if(t(n.date(r)))return!1;return!0}},{key:\"getMonthText\",value:function(e){var t,n=this.props.viewDate,r=n.localeData().monthsShort(n.month(e));return(t=r.substring(0,3)).charAt(0).toUpperCase()+t.slice(1)}}])&&C(t.prototype,n),r&&C(t,r),Object.defineProperty(t,\"prototype\",{writable:!1}),i}(c.a.Component);function N(e,t){return t<4?e[0]:t<8?e[1]:e[2]}function x(e){return(x=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}function F(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function I(e,t){for(var n=0;n1;)if(n(r.dayOfYear(o)))return t[e]=!1,!1;return t[e]=!0,!0}}])&&I(t.prototype,n),r&&I(t,r),Object.defineProperty(t,\"prototype\",{writable:!1}),i}(c.a.Component);function U(e,t){return t<3?e[0]:t<7?e[1]:e[2]}function Z(e){return(Z=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}function W(e,t){for(var n=0;n=12?e-=12:e+=12,this.props.setTime(\"hours\",e)}},{key:\"increase\",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)+t.step;return n>t.max&&(n=t.min+(n-(t.max+1))),te(e,n)}},{key:\"decrease\",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)-t.step;return n=0||(o[n]=e[n]);return o}(t,[\"excludeScrollbar\"]);return e.prototype&&e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(s.createElement)(e,n)},a}(s.Component),n.displayName=\"OnClickOutside(\"+o+\")\",n.defaultProps={eventTypes:[\"mousedown\",\"touchstart\"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:\"ignore-react-onclickoutside\",preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r};function he(e){return(he=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function me(e){for(var t=1;t0?r.props.onNavigateForward(e,t):r.props.onNavigateBack(-e,t),r.setState({viewDate:n})})),_e(Ce(r),\"_setTime\",(function(e,t){var n=(r.getSelectedDate()||r.state.viewDate).clone();n[e](t),r.props.value||r.setState({selectedDate:n,viewDate:n.clone(),inputValue:n.format(r.getFormat(\"datetime\"))}),r.props.onChange(n)})),_e(Ce(r),\"_openCalendar\",(function(){r.isOpen()||r.setState({open:!0},r.props.onOpen)})),_e(Ce(r),\"_closeCalendar\",(function(){r.isOpen()&&r.setState({open:!1},(function(){r.props.onClose(r.state.selectedDate||r.state.inputValue)}))})),_e(Ce(r),\"_handleClickOutside\",(function(){var e=r.props;e.input&&r.state.open&&void 0===e.open&&e.closeOnClickOutside&&r._closeCalendar()})),_e(Ce(r),\"_onInputFocus\",(function(e){r.callHandler(r.props.inputProps.onFocus,e)&&r._openCalendar()})),_e(Ce(r),\"_onInputChange\",(function(e){if(r.callHandler(r.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,n=r.localMoment(t,r.getFormat(\"datetime\")),o={inputValue:t};n.isValid()?(o.selectedDate=n,o.viewDate=n.clone().startOf(\"month\")):o.selectedDate=null,r.setState(o,(function(){r.props.onChange(n.isValid()?n:r.state.inputValue)}))}})),_e(Ce(r),\"_onInputKeyDown\",(function(e){r.callHandler(r.props.inputProps.onKeyDown,e)&&9===e.which&&r.props.closeOnTab&&r._closeCalendar()})),_e(Ce(r),\"_onInputClick\",(function(e){r.callHandler(r.props.inputProps.onClick,e)&&r._openCalendar()})),r.state=r.getInitialState(),r}return Oe(n,[{key:\"render\",value:function(){return c.a.createElement(Re,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),c.a.createElement(\"div\",{className:\"rdtPicker\"},this.renderView()))}},{key:\"renderInput\",value:function(){if(this.props.input){var e=me(me({type:\"text\",className:\"form-control\",value:this.getInputValue()},this.props.inputProps),{},{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onClick:this._onInputClick});return this.props.renderInput?c.a.createElement(\"div\",null,this.props.renderInput(e,this._openCalendar,this._closeCalendar)):c.a.createElement(\"input\",e)}}},{key:\"renderView\",value:function(){return this.props.renderView(this.state.currentView,this._renderCalendar)}},{key:\"getInitialState\",value:function(){var e=this.props,t=this.getFormat(\"datetime\"),n=this.parseDate(e.value||e.initialValue,t);return this.checkTZ(),{open:!e.input,currentView:e.initialViewMode||this.getInitialView(),viewDate:this.getInitialViewDate(n),selectedDate:n&&n.isValid()?n:void 0,inputValue:this.getInitialInputValue(n)}}},{key:\"getInitialViewDate\",value:function(e){var t,n=this.props.initialViewDate;if(n){if((t=this.parseDate(n,this.getFormat(\"datetime\")))&&t.isValid())return t;Ie('The initialViewDated given \"'+n+'\" is not valid. Using current date instead.')}else if(e&&e.isValid())return e.clone();return this.getInitialDate()}},{key:\"getInitialDate\",value:function(){var e=this.localMoment();return e.hour(0).minute(0).second(0).millisecond(0),e}},{key:\"getInitialView\",value:function(){var e=this.getFormat(\"date\");return e?this.getUpdateOn(e):Ve}},{key:\"parseDate\",value:function(e,t){var n;return e&&\"string\"==typeof e?n=this.localMoment(e,t):e&&(n=this.localMoment(e)),n&&!n.isValid()&&(n=null),n}},{key:\"getClassName\",value:function(){var e=\"rdt\",t=this.props,n=t.className;return Array.isArray(n)?e+=\" \"+n.join(\" \"):n&&(e+=\" \"+n),t.input||(e+=\" rdtStatic\"),this.isOpen()&&(e+=\" rdtOpen\"),e}},{key:\"isOpen\",value:function(){return!this.props.input||(void 0===this.props.open?this.state.open:this.props.open)}},{key:\"getUpdateOn\",value:function(e){return this.props.updateOnView?this.props.updateOnView:e.match(/[lLD]/)?Se:-1!==e.indexOf(\"M\")?je:-1!==e.indexOf(\"Y\")?Ee:Se}},{key:\"getLocaleData\",value:function(){var e=this.props;return this.localMoment(e.value||e.defaultValue||new Date).localeData()}},{key:\"getDateFormat\",value:function(){var e=this.getLocaleData(),t=this.props.dateFormat;return!0===t?e.longDateFormat(\"L\"):t||\"\"}},{key:\"getTimeFormat\",value:function(){var e=this.getLocaleData(),t=this.props.timeFormat;return!0===t?e.longDateFormat(\"LT\"):t||\"\"}},{key:\"getFormat\",value:function(e){if(\"date\"===e)return this.getDateFormat();if(\"time\"===e)return this.getTimeFormat();var t=this.getDateFormat(),n=this.getTimeFormat();return t&&n?t+\" \"+n:t||n}},{key:\"updateTime\",value:function(e,t,n,r){var o={},i=r?\"selectedDate\":\"viewDate\";o[i]=this.state[i].clone()[e](t,n),this.setState(o)}},{key:\"localMoment\",value:function(e,t,n){var r=null;return r=(n=n||this.props).utc?a.a.utc(e,t,n.strictParsing):n.displayTimeZone?a.a.tz(e,t,n.displayTimeZone):a()(e,t,n.strictParsing),n.locale&&r.locale(n.locale),r}},{key:\"checkTZ\",value:function(){var e=this.props.displayTimeZone;!e||this.tzWarning||a.a.tz||(this.tzWarning=!0,Ie('displayTimeZone prop with value \"'+e+'\" is used but moment.js timezone is not loaded.',\"error\"))}},{key:\"componentDidUpdate\",value:function(e){if(e!==this.props){var t=!1,n=this.props;[\"locale\",\"utc\",\"displayZone\",\"dateFormat\",\"timeFormat\"].forEach((function(r){e[r]!==n[r]&&(t=!0)})),t&&this.regenerateDates(),n.value&&n.value!==e.value&&this.setViewDate(n.value),this.checkTZ()}}},{key:\"regenerateDates\",value:function(){var e=this.props,t=this.state.viewDate.clone(),n=this.state.selectedDate&&this.state.selectedDate.clone();e.locale&&(t.locale(e.locale),n&&n.locale(e.locale)),e.utc?(t.utc(),n&&n.utc()):e.displayTimeZone?(t.tz(e.displayTimeZone),n&&n.tz(e.displayTimeZone)):(t.locale(),n&&n.locale());var r={viewDate:t,selectedDate:n};n&&n.isValid()&&(r.inputValue=n.format(this.getFormat(\"datetime\"))),this.setState(r)}},{key:\"getSelectedDate\",value:function(){if(void 0===this.props.value)return this.state.selectedDate;var e=this.parseDate(this.props.value,this.getFormat(\"datetime\"));return!(!e||!e.isValid())&&e}},{key:\"getInitialInputValue\",value:function(e){var t=this.props;return t.inputProps.value?t.inputProps.value:e&&e.isValid()?e.format(this.getFormat(\"datetime\")):t.value&&\"string\"==typeof t.value?t.value:t.initialValue&&\"string\"==typeof t.initialValue?t.initialValue:\"\"}},{key:\"getInputValue\",value:function(){var e=this.getSelectedDate();return e?e.format(this.getFormat(\"datetime\")):this.state.inputValue}},{key:\"setViewDate\",value:function(e){var t,n=function(){return Ie(\"Invalid date passed to the `setViewDate` method: \"+e)};return e&&(t=\"string\"==typeof e?this.localMoment(e,this.getFormat(\"datetime\")):this.localMoment(e))&&t.isValid()?void this.setState({viewDate:t}):n()}},{key:\"navigate\",value:function(e){this._showView(e)}},{key:\"callHandler\",value:function(e,t){return!e||!1!==e(t)}}]),n}(c.a.Component);function Ie(e,t){var n=\"undefined\"!=typeof window&&window.console;n&&(t||(t=\"warn\"),n[t](\"***react-datetime:\"+e))}_e(Fe,\"propTypes\",{value:xe,initialValue:xe,initialViewDate:xe,initialViewMode:Te.oneOf([Ee,je,Se,Ve]),onOpen:Te.func,onClose:Te.func,onChange:Te.func,onNavigate:Te.func,onBeforeNavigate:Te.func,onNavigateBack:Te.func,onNavigateForward:Te.func,updateOnView:Te.string,locale:Te.string,utc:Te.bool,displayTimeZone:Te.string,input:Te.bool,dateFormat:Te.oneOfType([Te.string,Te.bool]),timeFormat:Te.oneOfType([Te.string,Te.bool]),inputProps:Te.object,timeConstraints:Te.object,isValidDate:Te.func,open:Te.bool,strictParsing:Te.bool,closeOnSelect:Te.bool,closeOnTab:Te.bool,renderView:Te.func,renderInput:Te.func,renderDay:Te.func,renderMonth:Te.func,renderYear:Te.func}),_e(Fe,\"defaultProps\",{onOpen:Ne,onClose:Ne,onCalendarOpen:Ne,onCalendarClose:Ne,onChange:Ne,onNavigate:Ne,onBeforeNavigate:function(e){return e},onNavigateBack:Ne,onNavigateForward:Ne,dateFormat:!0,timeFormat:!0,utc:!1,className:\"\",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0,renderView:function(e,t){return t()}}),_e(Fe,\"moment\",a.a);var Re=de(function(e){ge(n,e);var t=De(n);function n(){var e;ve(this,n);for(var r=arguments.length,o=new Array(r),i=0;i