Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.223.158.29
(window.webpackJsonp=window.webpackJsonp||[]).push([[217],{1269:function(e,t,n){"use strict";n.r(t);var r=n(3),a=n(68),o=n(100),i=n(101),s=n(103),l=n(102),u=n(104),c=n(2),h=n.n(c),p=n(1377),f=n(1343),d=n(272),m=n(1335),v=n(1337),g=n(941),b=n(300),y=n(105),x=n(275),w=n.n(x),k=n(287),E=n.n(k),S=n(267);function C(){C=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=t&&t.prototype instanceof g?t:g,i=Object.create(o.prototype),s=new M(r||[]);return a(i,"_invoke",{value:j(e,n,s)}),i}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var p="suspendedStart",f="suspendedYield",d="executing",m="completed",v={};function g(){}function b(){}function y(){}var x={};u(x,i,function(){return this});var w=Object.getPrototypeOf,k=w&&w(w(B([])));k&&k!==n&&r.call(k,i)&&(x=k);var E=y.prototype=g.prototype=Object.create(x);function S(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function O(e,t){function n(a,o,i,s){var l=h(e[a],e,o);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then(function(e){n("next",e,i,s)},function(e){n("throw",e,i,s)}):t.resolve(c).then(function(e){u.value=e,i(u)},function(e){return n("throw",e,i,s)})}s(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t(function(t,a){n(e,r,t,a)})}return o=o?o.then(a,a):a()}})}function j(t,n,r){var a=p;return function(o,i){if(a===d)throw new Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var l=D(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===p)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=d;var u=h(t,n,r);if("normal"===u.type){if(a=r.done?m:f,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=m,r.method="throw",r.arg=u.arg)}}}function D(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,D(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=h(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function B(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=y,a(E,"constructor",{value:y,configurable:!0}),a(y,"constructor",{value:b,configurable:!0}),b.displayName=u(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},S(O.prototype),u(O.prototype,s,function(){return this}),t.AsyncIterator=O,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new O(c(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then(function(e){return e.done?e.value:i.next()})},S(E),u(E,l,"Generator"),u(E,i,function(){return this}),u(E,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=B,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return s.type="throw",s.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:B(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var O=function(e){function t(){var e,n;Object(o.a)(this,t);for(var i=arguments.length,u=new Array(i),c=0;c<i;c++)u[c]=arguments[c];return(n=Object(s.a)(this,(e=Object(l.a)(t)).call.apply(e,[this].concat(u)))).state={exam:"",board:"",subj:"",teachSub:!1,status:"",table:[],noqp:"1",check:"F",ftoday:E()()},n.componentDidMount=Object(a.a)(C().mark(function e(){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.examDate();case 2:case"end":return e.stop()}},e)})),n.examDates=function(){var e=Object(a.a)(C().mark(function e(t,r){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.getBoardDet(r.value);case 2:return n.setState({exam:r.value}),n.setState({board:"All"}),e.next=6,n.props.getBoardSubj(n.state.exam,n.state.board);case 6:n.setState({teachSub:!1}),n.setState({subj:""});case 8:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.boardSubj=function(){var e=Object(a.a)(C().mark(function e(t,r){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.setState({board:r.value}),e.next=3,n.props.getBoardSubj(n.state.exam,r.value);case 3:n.setState({teachSub:!1}),n.setState({subj:""});case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.subjVal=function(){var e=Object(a.a)(C().mark(function e(t,r){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.setState({subj:r.value}),n.setState({teachSub:!1});case 2:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.submitDet=Object(a.a)(C().mark(function e(){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.getSelTeachDet(n.state.exam,n.state.board,n.state.subj);case 2:n.setState({teachSub:!0}),n.setState({table:n.props.seltech});case 4:case"end":return e.stop()}},e)})),n.changeCell=function(e,t){var r=n.state.table.map(function(n,r){return r===t&&(n.flastdate=e.target.value,n.onchange="T"),n});n.setState({table:r})},n.arr=[],n.obj={},n.noqpval=function(){var e=Object(a.a)(C().mark(function e(t,r){var a;return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=n.state.table.map(function(e,n){return n===r&&(e.fnoqp=t.target.value,e.onchange="T"),e}),n.setState({table:a});case 2:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleCancel=Object(a.a)(C().mark(function e(){return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.setState({exam:""}),n.setState({teachSub:!1}),n.setState({board:""}),n.setState({subj:""});case 4:case"end":return e.stop()}},e)})),n.handleCheckBox=function(e,t){var a=n.state.table.map(function(n,r){return t===r?("T"==e.status?(n.status="F",n.onchange="T"):(n.status="T",n.onchange="T"),n):n});n.setState({table:Object(r.a)(a)})},n.handleAllCheckBox=function(e){e.target.checked?n.setState({check:"T"}):n.setState({check:"F"});var t=n.state.table.map(function(t,n){return!0===e.target.checked?(t.emailstatus="T",t.onchange="T"):(t.emailstatus="F",t.onchange="T"),t});n.setState({table:t})},n.checkDate=function(e,t,r){if(n.state.ftoday.format("DD/MM/YYYY")>e){alert("Enter vaild date");var a=n.state.table.map(function(e,t){return t===r&&(e.flastdate=""),e});n.setState({table:a})}else;},n.handleEmailStatus=function(e,t){var r=n.state.table.map(function(r,a){return r.fteachcode===t?(e.target.checked?(r.emailstatus="T",r.onchange="T"):(n.state.femailstat="F",r.emailstatus="F",r.onchange="T"),r):r});n.setState({table:r})},n.handleSave=Object(a.a)(C().mark(function e(){var t,r,a,o;return C().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],e.next=4,n.state.table.map(function(e,n){"T"==e.onchange&&t.push(e),""==e.flastdate&&r.push(e)});case 4:if(0===r.length){e.next=8;break}return a={header:"Error",content:"Please Enter Last Date"},n.props.showError(a),e.abrupt("return");case 8:return(o=new FormData).append("user",n.props.user),o.append("exam",n.state.exam),o.append("board",n.state.board),o.append("subj",n.state.subj),o.append("arr",t),o.append("collcode",n.props.user.fcollcode),o.append("mobile",n.props.user.fmobileno),o.append("data",JSON.stringify(t)),e.next=19,n.props.saveSelQPSeter(o);case 19:case"end":return e.stop()}},e)})),n.handleAllTeachCheck=function(e){var t=n.state.table.map(function(t,n){return e.target.checked?(t.status="T",t.onchange="T"):(t.status="F",t.onchange="T"),t});n.setState({table:t})},n}return Object(u.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){var e=this,t=this.state,n=t.board,a=t.subj,o=t.teachSub,i=t.exam,s=(t.noqp,t.table,t.femailstat,this.props),l=s.boarddet,u=s.boardsubj,c=(s.teachdet,s.examdate),b={n:"[0-1]",m:"[0-9]",e:"[0-3]",d:"[0-9]",z:"[1-2]",y:"[0-9]"},y=c.map(function(e,t){return{key:t,value:e.fexamyear,text:e.fdesexam}}),x=l.map(function(e,t){return{key:t,value:e.fboardcode,text:e.fboardcode+" - "+e.fboardname}}),k=[].concat([{key:"All",value:"All",text:"All"}],Object(r.a)(x)),E=u.map(function(e,t){return{key:t,value:e.fqpcode,text:e.fqpcode+"-"+e.fsubname}});return h.a.createElement("div",null,h.a.createElement(p.a,{fluid:!0},h.a.createElement(p.a.Content,null,h.a.createElement(p.a.Header,{style:{display:"flex"}},h.a.createElement("h4",null,"Select QP Setter"),h.a.createElement("div",{className:"ml-auto"},h.a.createElement(f.a,{basic:!0,color:"green",icon:"save",onClick:this.handleSave,content:"Save"}),h.a.createElement(f.a,{basic:!0,color:"black",icon:"ban",onClick:this.handleCancel,content:"Cancel"}),h.a.createElement(g.a,{to:"/Dashboard"},h.a.createElement(f.a,{basic:!0,color:"red",content:"Exit",icon:"home"})))),h.a.createElement(d.a,null),h.a.createElement(p.a.Description,null,h.a.createElement(m.a.Group,null,h.a.createElement(m.a.Field,null,h.a.createElement("div",null,h.a.createElement("label",null,"Exam"),h.a.createElement("label",{style:{marginLeft:"54px"}},":"),h.a.createElement(v.a,{search:!0,selection:!0,style:{width:"400px"},options:y,value:i,onChange:this.examDates,placeholder:"Exam"})),h.a.createElement("div",null,h.a.createElement("label",null,"Board"),h.a.createElement("label",{style:{marginLeft:"50px"}},":"),h.a.createElement(v.a,{search:!0,selection:!0,style:{marginTop:"5px",width:"400px"},options:k,value:n,onChange:this.boardSubj,placeholder:"Board"})),h.a.createElement("div",null,h.a.createElement("label",null,"Subject"),h.a.createElement("label",{style:{marginLeft:"40px"}},":"),h.a.createElement(v.a,{search:!0,selection:!0,style:{marginTop:"5px",width:"400px"},options:E,value:a,onChange:this.subjVal,placeholder:"Subject"})),h.a.createElement("div",null,h.a.createElement(f.a,{style:{marginTop:"5px",marginLeft:"85px"},content:"Submit",color:"blue",onClick:this.submitDet})))),o&&h.a.createElement("div",{style:{height:"550px",overflowY:"auto",border:"1px solid grey"}},h.a.createElement("table",{style:{width:"100%",border:"1px solid"}},h.a.createElement("thead",{style:{backgroundColor:"#1e7f91",color:"white",height:"40px",position:"sticky",top:0}},h.a.createElement("tr",null,h.a.createElement("th",{style:{width:"5%",borderBottom:"1px solid",borderRight:"1px solid"}},"Sl. No."),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"5%"}},"Teach. Code."),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"25%"}},"Teacher Name"),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"35%"}},"Teacher Email ID"),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"10%"}},"Mobile No."),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"5%"}},"No. of Sets"),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"5%"}},"On or Before Date"),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"2.5%"}},"Email Send ",h.a.createElement("br",null),h.a.createElement("input",{type:"checkbox",checked:"T"===this.state.check,onChange:function(t){return e.handleAllCheckBox(t)}})),h.a.createElement("th",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"2.5%"}},"Select ",h.a.createElement("br",null),h.a.createElement("input",{type:"checkbox",onChange:function(t){return e.handleAllTeachCheck(t)}})))),h.a.createElement("tbody",null,this.props.seltech.length>0?this.state.table.map(function(t,n){return h.a.createElement("tr",{key:n},h.a.createElement("td",{style:{border:"1px solid",textAlign:"center",width:"5%",height:"30px"}},n+1),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"5%",height:"30px"}},t.fteachcode),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",width:"25%",height:"30px",paddingLeft:"10px"}},t.fteachname),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",paddingLeft:"10px",width:"35%",height:"30px"}},t.femail),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"10%",height:"30px"}},t.fmobile),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"5%",height:"30px"}},h.a.createElement("input",{type:"text",value:t.fnoqp,onChange:function(t){return e.noqpval(t,n)},style:{textAlign:"center",width:"30px",height:"30px"}})),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"4%",height:"30px"}},h.a.createElement(w.a,{type:"text",style:{textAlign:"center",height:"30px"},formatChars:b,mask:"ed/nm/zyyy",name:"fdate",value:t.flastdate,onChange:function(t){return e.changeCell(t,n)},placeholder:"dd/mm/yyyy"})),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"3%",height:"30px"}},h.a.createElement("input",{type:"checkbox",name:"emailstatus",onChange:function(n){return e.handleEmailStatus(n,t.fteachcode)},checked:"T"===t.emailstatus})),h.a.createElement("td",{style:{borderBottom:"1px solid",borderRight:"1px solid",textAlign:"center",width:"3%",height:"30px"}},h.a.createElement("input",{type:"checkbox",name:"status",value:t.status,onChange:function(r){return e.handleCheckBox(t,n)},checked:"T"==t.status})))}):h.a.createElement("tr",null,h.a.createElement("td",{colSpan:6,style:{textAlign:"center",height:"30px"}},"No Data Found")))))))))}}]),t}(c.Component);t.default=Object(y.b)(function(e){return{user:e.user,examdate:e.examdate,boarddet:e.boaddet,boardsubj:e.boardsubj,seltech:e.seltech}},{getBoardDet:b.k,getBoardSubj:b.l,getSelTeachDet:b.t,saveSelQPSeter:b.D,examDate:b.h,showError:S.A})(O)},275:function(e,t,n){e.exports=n(276)},276:function(e,t,n){"use strict";var r,a=(r=n(2))&&"object"==typeof r&&"default"in r?r.default:r,o=n(106);function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var a=n[r],o=Object.getOwnPropertyDescriptor(t,a);o&&o.configurable&&void 0===e[a]&&Object.defineProperty(e,a,o)}}(e.prototype.constructor=e,t)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u=function(e,t,n,r,a,o,i,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,a,o,i,s],c=0;(l=new Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}};function c(e,t,n){if("selectionStart"in e&&"selectionEnd"in e)e.selectionStart=t,e.selectionEnd=n;else{var r=e.createTextRange();r.collapse(!0),r.moveStart("character",t),r.moveEnd("character",n-t),r.select()}}var h={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},p="_";function f(e,t,n){var r="",a="",o=null,i=[];if(void 0===t&&(t=p),null==n&&(n=h),!e||"string"!=typeof e)return{maskChar:t,formatChars:n,mask:null,prefix:null,lastEditablePosition:null,permanents:[]};var s=!1;return e.split("").forEach(function(e){s=!s&&"\\"===e||(s||!n[e]?(i.push(r.length),r.length===i.length-1&&(a+=e)):o=r.length+1,r+=e,!1)}),{maskChar:t,formatChars:n,prefix:a,mask:r,lastEditablePosition:o,permanents:i}}function d(e,t){return-1!==e.permanents.indexOf(t)}function m(e,t,n){var r=e.mask,a=e.formatChars;if(!n)return!1;if(d(e,t))return r[t]===n;var o=a[r[t]];return new RegExp(o).test(n)}function v(e,t){return t.split("").every(function(t,n){return d(e,n)||!m(e,n,t)})}function g(e,t){var n=e.maskChar,r=e.prefix;if(!n){for(;t.length>r.length&&d(e,t.length-1);)t=t.slice(0,t.length-1);return t.length}for(var a=r.length,o=t.length;o>=r.length;o--){var i=t[o];if(!d(e,o)&&m(e,o,i)){a=o+1;break}}return a}function b(e,t){return g(e,t)===e.mask.length}function y(e,t){var n=e.maskChar,r=e.mask,a=e.prefix;if(!n){for((t=x(e,"",t,0)).length<a.length&&(t=a);t.length<r.length&&d(e,t.length);)t+=r[t.length];return t}if(t)return x(e,y(e,""),t,0);for(var o=0;o<r.length;o++)d(e,o)?t+=r[o]:t+=n;return t}function x(e,t,n,r){var a=e.mask,o=e.maskChar,i=e.prefix,s=n.split(""),l=b(e,t);return!o&&r>t.length&&(t+=a.slice(t.length,r)),s.every(function(n){for(;c=n,d(e,u=r)&&c!==a[u];){if(r>=t.length&&(t+=a[r]),s=n,o&&d(e,r)&&s===o)return!0;if(++r>=a.length)return!1}var s,u,c;return!m(e,r,n)&&n!==o||(r<t.length?t=o||l||r<i.length?t.slice(0,r)+n+t.slice(r+1):(t=t.slice(0,r)+n+t.slice(r),y(e,t)):o||(t+=n),++r<a.length)}),t}function w(e,t){for(var n=e.mask,r=t;r<n.length;++r)if(!d(e,r))return r;return null}function k(e){return e||0===e?e+"":""}function E(e,t,n,r,a){var o=e.mask,i=e.prefix,s=e.lastEditablePosition,l=t,u="",c=0,h=0,p=Math.min(a.start,n.start);return n.end>a.start?h=(c=function(e,t,n,r){var a=e.mask,o=e.maskChar,i=n.split(""),s=r;return i.every(function(t){for(;i=t,d(e,n=r)&&i!==a[n];)if(++r>=a.length)return!1;var n,i;return(m(e,r,t)||t===o)&&r++,r<a.length}),r-s}(e,0,u=l.slice(a.start,n.end),p))?a.length:0:l.length<r.length&&(h=r.length-l.length),l=r,h&&(1!==h||a.length||(p=a.start===n.start?w(e,n.start):function(e,t){for(var n=t;0<=n;--n)if(!d(e,n))return n;return null}(e,n.start)),l=function(e,t,n,r){var a=n+r,o=e.maskChar,i=e.mask,s=e.prefix,l=t.split("");if(o)return l.map(function(t,r){return r<n||a<=r?t:d(e,r)?i[r]:o}).join("");for(var u=a;u<l.length;u++)d(e,u)&&(l[u]="");return n=Math.max(s.length,n),l.splice(n,a-n),t=l.join(""),y(e,t)}(e,l,p,h)),l=x(e,l,u,p),(p+=c)>=o.length?p=o.length:p<i.length&&!c?p=i.length:p>=i.length&&p<s&&c&&(p=w(e,p)),u||(u=null),{value:l=y(e,l),enteredString:u,selection:{start:p,end:p}}}function S(e){return"function"==typeof e}function C(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame}function O(e){return(C()?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:function(){return setTimeout(e,1e3/60)})(e)}function j(e){(C()||clearTimeout)(e)}var D=function(e){function t(t){var n=e.call(this,t)||this;n.focused=!1,n.mounted=!1,n.previousSelection=null,n.selectionDeferId=null,n.saveSelectionLoopDeferId=null,n.saveSelectionLoop=function(){n.previousSelection=n.getSelection(),n.saveSelectionLoopDeferId=O(n.saveSelectionLoop)},n.runSaveSelectionLoop=function(){null===n.saveSelectionLoopDeferId&&n.saveSelectionLoop()},n.stopSaveSelectionLoop=function(){null!==n.saveSelectionLoopDeferId&&(j(n.saveSelectionLoopDeferId),n.saveSelectionLoopDeferId=null,n.previousSelection=null)},n.getInputDOMNode=function(){if(!n.mounted)return null;var e=o.findDOMNode(l(l(n))),t="undefined"!=typeof window&&e instanceof window.Element;if(e&&!t)return null;if("INPUT"!==e.nodeName&&(e=e.querySelector("input")),!e)throw new Error("react-input-mask: inputComponent doesn't contain input node");return e},n.getInputValue=function(){var e=n.getInputDOMNode();return e?e.value:null},n.setInputValue=function(e){var t=n.getInputDOMNode();t&&(n.value=e,t.value=e)},n.setCursorToEnd=function(){var e=g(n.maskOptions,n.value),t=w(n.maskOptions,e);null!==t&&n.setCursorPosition(t)},n.setSelection=function(e,t,r){void 0===r&&(r={});var a=n.getInputDOMNode(),o=n.isFocused();a&&o&&(r.deferred||c(a,e,t),null!==n.selectionDeferId&&j(n.selectionDeferId),n.selectionDeferId=O(function(){n.selectionDeferId=null,c(a,e,t)}),n.previousSelection={start:e,end:t,length:Math.abs(t-e)})},n.getSelection=function(){return function(e){var t=0,n=0;if("selectionStart"in e&&"selectionEnd"in e)t=e.selectionStart,n=e.selectionEnd;else{var r=document.selection.createRange();r.parentElement()===e&&(t=-r.moveStart("character",-e.value.length),n=-r.moveEnd("character",-e.value.length))}return{start:t,end:n,length:n-t}}(n.getInputDOMNode())},n.getCursorPosition=function(){return n.getSelection().start},n.setCursorPosition=function(e){n.setSelection(e,e)},n.isFocused=function(){return n.focused},n.getBeforeMaskedValueChangeConfig=function(){var e=n.maskOptions,t=e.mask,r=e.maskChar,a=e.permanents,o=e.formatChars;return{mask:t,maskChar:r,permanents:a,alwaysShowMask:!!n.props.alwaysShowMask,formatChars:o}},n.isInputAutofilled=function(e,t,r,a){var o=n.getInputDOMNode();try{if(o.matches(":-webkit-autofill"))return!0}catch(u){}return!n.focused||a.end<r.length&&t.end===e.length},n.onChange=function(e){var t=l(l(n)).beforePasteState,r=l(l(n)).previousSelection,a=n.props.beforeMaskedValueChange,o=n.getInputValue(),i=n.value,s=n.getSelection();n.isInputAutofilled(o,s,i,r)&&(i=y(n.maskOptions,""),r={start:0,end:0,length:0}),t&&(r=t.selection,i=t.value,s={start:r.start+o.length,end:r.start+o.length,length:0},o=i.slice(0,r.start)+o+i.slice(r.end),n.beforePasteState=null);var u=E(n.maskOptions,o,s,i,r),c=u.enteredString,h=u.selection,p=u.value;if(S(a)){var f=a({value:p,selection:h},{value:i,selection:r},c,n.getBeforeMaskedValueChangeConfig());p=f.value,h=f.selection}n.setInputValue(p),S(n.props.onChange)&&n.props.onChange(e),n.isWindowsPhoneBrowser?n.setSelection(h.start,h.end,{deferred:!0}):n.setSelection(h.start,h.end)},n.onFocus=function(e){var t=n.props.beforeMaskedValueChange,r=n.maskOptions,a=r.mask,o=r.prefix;if(n.focused=!0,n.mounted=!0,a){if(n.value)g(n.maskOptions,n.value)<n.maskOptions.mask.length&&n.setCursorToEnd();else{var i=y(n.maskOptions,o),s=y(n.maskOptions,i),l=g(n.maskOptions,s),u=w(n.maskOptions,l),c={start:u,end:u};if(S(t)){var h=t({value:s,selection:c},{value:n.value,selection:null},null,n.getBeforeMaskedValueChangeConfig());s=h.value,c=h.selection}var p=s!==n.getInputValue();p&&n.setInputValue(s),p&&S(n.props.onChange)&&n.props.onChange(e),n.setSelection(c.start,c.end)}n.runSaveSelectionLoop()}S(n.props.onFocus)&&n.props.onFocus(e)},n.onBlur=function(e){var t=n.props.beforeMaskedValueChange,r=n.maskOptions.mask;if(n.stopSaveSelectionLoop(),n.focused=!1,r&&!n.props.alwaysShowMask&&v(n.maskOptions,n.value)){var a="";S(t)&&(a=t({value:a,selection:null},{value:n.value,selection:n.previousSelection},null,n.getBeforeMaskedValueChangeConfig()).value);var o=a!==n.getInputValue();o&&n.setInputValue(a),o&&S(n.props.onChange)&&n.props.onChange(e)}S(n.props.onBlur)&&n.props.onBlur(e)},n.onMouseDown=function(e){if(!n.focused&&document.addEventListener){n.mouseDownX=e.clientX,n.mouseDownY=e.clientY,n.mouseDownTime=(new Date).getTime();document.addEventListener("mouseup",function e(t){if(document.removeEventListener("mouseup",e),n.focused){var r=Math.abs(t.clientX-n.mouseDownX),a=Math.abs(t.clientY-n.mouseDownY),o=Math.max(r,a),i=(new Date).getTime()-n.mouseDownTime;(o<=10&&i<=200||o<=5&&i<=300)&&n.setCursorToEnd()}})}S(n.props.onMouseDown)&&n.props.onMouseDown(e)},n.onPaste=function(e){S(n.props.onPaste)&&n.props.onPaste(e),e.defaultPrevented||(n.beforePasteState={value:n.getInputValue(),selection:n.getSelection()},n.setInputValue(""))},n.handleRef=function(e){null==n.props.children&&S(n.props.inputRef)&&n.props.inputRef(e)};var r=t.mask,a=t.maskChar,i=t.formatChars,s=t.alwaysShowMask,u=t.beforeMaskedValueChange,h=t.defaultValue,p=t.value;n.maskOptions=f(r,a,i),null==h&&(h=""),null==p&&(p=h);var d=k(p);if(n.maskOptions.mask&&(s||d)&&(d=y(n.maskOptions,d),S(u))){var m=t.value;null==t.value&&(m=h),d=u({value:d,selection:null},{value:m=k(m),selection:null},null,n.getBeforeMaskedValueChangeConfig()).value}return n.value=d,n}s(t,e);var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.getInputDOMNode()&&(this.isWindowsPhoneBrowser=function(){var e=new RegExp("windows","i"),t=new RegExp("phone","i"),n=navigator.userAgent;return e.test(n)&&t.test(n)}(),this.maskOptions.mask&&this.getInputValue()!==this.value&&this.setInputValue(this.value))},n.componentDidUpdate=function(){var e=this.previousSelection,t=this.props,n=t.beforeMaskedValueChange,r=t.alwaysShowMask,a=t.mask,o=t.maskChar,i=t.formatChars,s=this.maskOptions,l=r||this.isFocused(),u=null!=this.props.value,c=u?k(this.props.value):this.value,h=e?e.start:null;if(this.maskOptions=f(a,o,i),this.maskOptions.mask){!s.mask&&this.isFocused()&&this.runSaveSelectionLoop();var p=this.maskOptions.mask&&this.maskOptions.mask!==s.mask;if(s.mask||u||(c=this.getInputValue()),(p||this.maskOptions.mask&&(c||l))&&(c=y(this.maskOptions,c)),p){var d=g(this.maskOptions,c);(null===h||d<h)&&(h=b(this.maskOptions,c)?d:w(this.maskOptions,d))}!this.maskOptions.mask||!v(this.maskOptions,c)||l||u&&this.props.value||(c="");var m={start:h,end:h};if(S(n)){var x=n({value:c,selection:m},{value:this.value,selection:this.previousSelection},null,this.getBeforeMaskedValueChangeConfig());c=x.value,m=x.selection}this.value=c;var E=this.getInputValue()!==this.value;E?(this.setInputValue(this.value),this.forceUpdate()):p&&this.forceUpdate();var C=!1;null!=m.start&&null!=m.end&&(C=!e||e.start!==m.start||e.end!==m.end),(C||E)&&this.setSelection(m.start,m.end)}else s.mask&&(this.stopSaveSelectionLoop(),this.forceUpdate())},n.componentWillUnmount=function(){this.mounted=!1,null!==this.selectionDeferId&&j(this.selectionDeferId),this.stopSaveSelectionLoop()},n.render=function(){var e,t=this.props,n=(t.mask,t.alwaysShowMask,t.maskChar,t.formatChars,t.inputRef,t.beforeMaskedValueChange,t.children),r=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],0<=t.indexOf(n)||(a[n]=e[n]);return a}(t,["mask","alwaysShowMask","maskChar","formatChars","inputRef","beforeMaskedValueChange","children"]);if(n){S(n)||u(!1);var o=["onChange","onPaste","onMouseDown","onFocus","onBlur","value","disabled","readOnly"],s=i({},r);o.forEach(function(e){return delete s[e]}),e=n(s),o.filter(function(t){return null!=e.props[t]&&e.props[t]!==r[t]}).length&&u(!1)}else e=a.createElement("input",i({ref:this.handleRef},r));var l={onFocus:this.onFocus,onBlur:this.onBlur};return this.maskOptions.mask&&(r.disabled||r.readOnly||(l.onChange=this.onChange,l.onPaste=this.onPaste,l.onMouseDown=this.onMouseDown),null!=r.value&&(l.value=this.value)),e=a.cloneElement(e,l)},t}(a.Component);e.exports=D}}]);
//# sourceMappingURL=217.a410c0ad.chunk.js.map
|