1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2752],{2401:function(__unused_webpack_module,exports,__webpack_require__){var extendStatics,__extends=this&&this.__extends||(extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var react_1=__importDefault(__webpack_require__(7294)),TimerModel_1=__webpack_require__(6403),TimerContext=react_1.default.createContext({ms:0,s:0,m:0,h:0,d:0,formatValue:function(value){return String(value)}}),TimerValue=function(_a){var unit=_a.unit,formatValue=_a.formatValue;return react_1.default.createElement(Timer.Consumer,null,function(props){return(formatValue||props.formatValue)(props[unit])||null})},Milliseconds=function(props){return react_1.default.createElement(TimerValue,__assign({unit:"ms"},props))},Seconds=function(props){return react_1.default.createElement(TimerValue,__assign({unit:"s"},props))},Minutes=function(props){return react_1.default.createElement(TimerValue,__assign({unit:"m"},props))},Hours=function(props){return react_1.default.createElement(TimerValue,__assign({unit:"h"},props))},Days=function(props){return react_1.default.createElement(TimerValue,__assign({unit:"d"},props))},Timer=function(_super){function Timer(props){var _this=_super.call(this,props)||this,_a=_this.props,initialTime=_a.initialTime,direction=_a.direction,timeToUpdate=_a.timeToUpdate,lastUnit=_a.lastUnit,checkpoints=_a.checkpoints;return _this.timer=new TimerModel_1.TimerModel({initialTime:initialTime,direction:direction,timeToUpdate:timeToUpdate,lastUnit:lastUnit,checkpoints:checkpoints,onChange:_this.setState.bind(_this)}),_this.state=__assign({},_this.timer.timeParts,{timerState:"INITED"}),_this.start=_this.start.bind(_this),_this.pause=_this.pause.bind(_this),_this.resume=_this.resume.bind(_this),_this.stop=_this.stop.bind(_this),_this.reset=_this.reset.bind(_this),_this.setTime=_this.setTime.bind(_this),_this.getTime=_this.getTime.bind(_this),_this.getTimerState=_this.getTimerState.bind(_this),_this.setDirection=_this.setDirection.bind(_this),_this.setCheckpoints=_this.setCheckpoints.bind(_this),_this}return __extends(Timer,_super),Timer.getUI=function(children,renderProps){if(null===children)return null;if(Array.isArray(children)||react_1.default.isValidElement(children))return children;if(children.prototype&&children.prototype.isReactComponent)return react_1.default.createElement(children,renderProps);if("function"==typeof children)return children(renderProps);throw Error("Please use one of the supported APIs for children")},Timer.prototype.componentDidMount=function(){this.props.startImmediately&&this.timer.start()},Timer.prototype.componentWillUnmount=function(){this.timer.stop()},Timer.prototype.render=function(){var start=this.start,pause=this.pause,resume=this.resume,stop=this.stop,reset=this.reset,getTime=this.getTime,getTimerState=this.getTimerState,setTime=this.setTime,setDirection=this.setDirection,setCheckpoints=this.setCheckpoints,_b=this.state,ms=_b.ms,s=_b.s,m=_b.m,h=_b.h,d=_b.d,timerState=_b.timerState,_c=this.props,formatValue=_c.formatValue,children=_c.children;return react_1.default.createElement(TimerContext.Provider,{value:{ms:ms,s:s,m:m,h:h,d:d,formatValue:formatValue}},Timer.getUI(children,{start:start,resume:resume,pause:pause,stop:stop,reset:reset,getTime:getTime,getTimerState:getTimerState,setTime:setTime,setDirection:setDirection,setCheckpoints:setCheckpoints,timerState:timerState}))},Timer.prototype.setTime=function(time){this.timer.setTime(time)},Timer.prototype.getTime=function(){return this.timer.getTime()},Timer.prototype.getTimerState=function(){return this.timer.state},Timer.prototype.setDirection=function(direction){this.timer.setDirection(direction)},Timer.prototype.setCheckpoints=function(checkpoints){this.timer.setCheckpoints(checkpoints)},Timer.prototype.start=function(){this.timer.start(),this.props.onStart()},Timer.prototype.stop=function(){this.timer.stop(),this.props.onStop()},Timer.prototype.pause=function(){this.timer.pause(),this.props.onPause()},Timer.prototype.reset=function(){this.timer.reset(),this.props.onReset()},Timer.prototype.resume=function(){this.timer.resume(),this.props.onResume()},Timer.Consumer=TimerContext.Consumer,Timer.Milliseconds=Milliseconds,Timer.Seconds=Seconds,Timer.Minutes=Minutes,Timer.Hours=Hours,Timer.Days=Days,Timer.defaultProps={timeToUpdate:1e3,direction:"forward",initialTime:0,startImmediately:!0,lastUnit:"d",checkpoints:[],children:null,formatValue:function(value){return String(value)},onStart:function(){},onResume:function(){},onPause:function(){},onStop:function(){},onReset:function(){}},Timer}(react_1.default.PureComponent);exports.default=Timer},7396:function(__unused_webpack_module,exports,__webpack_require__){var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var react_1=__webpack_require__(7294),TimerModel_1=__webpack_require__(6403),getTimeParts_1=__importDefault(__webpack_require__(3166));
1exports.useTimer=function(_a){var _b=void 0===_a?{}:_a,_c=_b.initialTime,initialTime=void 0===_c?0:_c,_d=_b.direction,direction=void 0===_d?"forward":_d,_e=_b.timeToUpdate,timeToUpdate=void 0===_e?1e3:_e,_f=_b.startImmediately,startImmediately=void 0===_f||_f,_g=_b.lastUnit,lastUnit=void 0===_g?"d":_g,_h=_b.checkpoints,checkpoints=void 0===_h?[]:_h,onStart=_b.onStart,onResume=_b.onResume,onPause=_b.onPause,onStop=_b.onStop,onReset=_b.onReset,_j=react_1.useState(__assign({},getTimeParts_1.default(initialTime<0?0:initialTime,lastUnit),{state:"INITED"})),timerValues=_j[0],setTimerValues=_j[1],timer=react_1.useMemo(function(){return new TimerModel_1.TimerModel({initialTime:initialTime,direction:direction,timeToUpdate:timeToUpdate,lastUnit:lastUnit,checkpoints:checkpoints,onChange:function(timerValue){return setTimerValues(function(state){return __assign({},state,timerValue)})}})},[]),setTime=react_1.useCallback(function(time){return timer.setTime(time)},[timer]),getTime=react_1.useCallback(function(){return timer.getTime()},[timer]),getTimerState=react_1.useCallback(function(){return timer.state},[timer]),setDirection=react_1.useCallback(function(direction){return timer.setDirection(direction)},[timer]),setLastUnit=react_1.useCallback(function(lastUnit){return timer.setLastUnit(lastUnit)},[timer]),setCheckpoints=react_1.useCallback(function(checkpoints){return timer.setCheckpoints(checkpoints)},[timer]),setTimeToUpdate=react_1.useCallback(function(interval){return timer.setTimeToUpdate(interval)},[timer]),start=react_1.useCallback(function(){timer.start(),onStart&&onStart()},[timer,onStart]),stop=react_1.useCallback(function(){timer.stop(),onStop&&onStop()},[timer,onStop]),pause=react_1.useCallback(function(){timer.pause(),onPause&&onPause()},[timer,onPause]),reset=react_1.useCallback(function(){timer.reset(),onReset&&onReset()},[timer,onReset]),resume=react_1.useCallback(function(){timer.resume(),onResume&&onResume()},[timer,onResume]),controls=react_1.useMemo(function(){return{start:start,stop:stop,pause:pause,reset:reset,resume:resume,setTime:setTime,getTime:getTime,getTimerState:getTimerState,setDirection:setDirection,setLastUnit:setLastUnit,setTimeToUpdate:setTimeToUpdate,setCheckpoints:setCheckpoints}},[start,stop,pause,reset,resume,setTime,getTime,getTimerState,setDirection,setLastUnit,setTimeToUpdate,setCheckpoints]);return react_1.useEffect(function(){return startImmediately&&start(),function(){stop()}},[]),{controls:controls,value:timerValues}}},2752:function(__unused_webpack_module,exports,__webpack_require__){var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var Timer_1=__importDefault(__webpack_require__(2401)),getTimeParts_1=__importDefault(__webpack_require__(3166));exports.getTimeParts=getTimeParts_1.default;var useTimer_1=__webpack_require__(7396);exports.useTimer=useTimer_1.useTimer,exports.default=Timer_1.default},3166:function(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(time,lastUnit){var units=["ms","s","m","h","d"],lastUnitIndex=units.findIndex(function(unit){return unit===lastUnit}),dividers=[1e3,60,60,24,1],dividersAcc=[1,1e3,6e4,36e5,864e5];return units.reduce(function(obj,unit,index){return index>lastUnitIndex?obj[unit]=0:index===lastUnitIndex?obj[unit]=Math.floor(time/dividersAcc[index]):obj[unit]=Math.floor(time/dividersAcc[index])%dividers[index],obj},{ms:0,s:0,m:0,h:0,d:0})}},5898:function(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){return"undefined"!=typeof window&&"performance"in window?performance.now():Date.now()}},6403:function(__unused_webpack_module,exports,__webpack_require__){var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var getTimeParts_1=__importDefault(__webpack_require__(3166)),now_1=__importDefault(__webpack_require__(5898)),TimerState_1=__importDefault(__webpack_require__(9359)),TimerModel=function(){function TimerModel(_a){var initialTime=_a.initialTime,direction=_a.direction,timeToUpdate=_a.timeToUpdate,lastUnit=_a.lastUnit,checkpoints=_a.checkpoints,onChange=_a.onChange;this.internalTime=now_1.default(),this.initialTime=initialTime,this.time=initialTime,this.direction=direction,this.timeToUpdate=timeToUpdate,this.lastUnit=lastUnit,this.checkpoints=checkpoints,this.innerState=new TimerState_1.default(onChange),this.onChange=onChange,this.timerId=null}return Object.defineProperty(TimerModel.prototype,"state",{get:function(){return this.innerState.getState()},enumerable:!0,configurable:!0}),Object.defineProperty(TimerModel.prototype,"timeParts",{get:function(){return this.getTimeParts(this.computeTime())},enumerable:!0,configurable:!0}),TimerModel.prototype.getTimeParts=function(time){return getTimeParts_1.default(time,this.lastUnit)},TimerModel.prototype.setTime=function(time){this.internalTime=now_1.default(),this.initialTime=time,this.time=this.initialTime,this.onChange(this.getTimeParts(this.time))},TimerModel.prototype.getTime=function(){return this.time},TimerModel.prototype.setLastUnit=function(lastUnit){this.innerState.isPlaying()?(this.pause(),this.lastUnit=lastUnit,this.resume(!0)):this.lastUnit=lastUnit},TimerModel.prototype.setTimeToUpdate=function(interval){this.innerState.isPlaying()?(this.pause(),this.timeToUpdate=interval,this.resume()):this.timeToUpdate=interval},TimerModel.prototype.setDirection=function(direction){this.direction=direction},TimerModel.prototype.setCheckpoints=function(checkpoints){this.checkpoints=checkpoints},TimerModel.prototype.start=function(){this.innerState.setPlaying()&&this.setTimerInterval(!0)},TimerModel.prototype.resume=function(callImmediately){void 0===callImmediately&&(callImmediately=!1),!this.innerState.isStopped()&&this.innerState.setPlaying()&&this.setTimerInterval(callImmediately)},TimerModel.prototype.pause=function(){this.innerState.setPaused()&&clearInterval(this.timerId)},TimerModel.prototype.stop=function(){this.innerState.setStopped()&&clearInterval(this.timerId)},TimerModel.prototype.reset=function(){this.time=this.initialTime,this.onChange(this.getTimeParts(this.time))},TimerModel.prototype.setTimerInterval=function(callImmediately){var _this=this;void 0===callImmediately&&(callImmediately=!1),this.timerId&&clearInterval(this.timerId),this.internalTime=now_1.default(),callImmediately&&this.onChange(this.getTimeParts(this.time)),this.timerId=window.setInterval(function(){var oldTime=_this.time,updatedTime=_this.computeTime();_this.onChange(_this.getTimeParts(updatedTime)),_this.checkpoints.map(function(_a){var time=_a.time,callback=_a.callback;("backward"===_this.direction?time<oldTime&&time>=updatedTime:time>oldTime&&time<=updatedTime)&&callback()})},this.timeToUpdate)},TimerModel.prototype.computeTime=function(){if(this.innerState.isPlaying()){var currentInternalTime=now_1.default(),delta=Math.abs(currentInternalTime-this.internalTime);switch(this.direction){case"forward":this.time=this.time+delta,this.internalTime=currentInternalTime;break;case"backward":if(this.time=this.time-delta,this.internalTime=currentInternalTime,this.time<0)return this.stop(),0}}return this.time},TimerModel}();exports.TimerModel=TimerModel},9359:function(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.INITED="INITED",exports.PLAYING="PLAYING",exports.PAUSED="PAUSED",exports.STOPPED="STOPPED";var TimerState=function(){function TimerState(onChangeStatus){var _this=this;void 0===onChangeStatus&&(onChangeStatus=function(obj){}),this.state=exports.INITED,this.onChange=function(){return onChangeStatus({state:_this.state})},this.state=exports.INITED}return TimerState.prototype.getState=function(){return this.state},TimerState.prototype.setInited=function(){return this.state!==exports.INITED&&(this.state=exports.INITED,this.onChange(),!0)},TimerState.prototype.isInited=function(){return this.state===exports.INITED},TimerState.prototype.setPlaying=function(){return this.state!==exports.PLAYING&&(this.state=exports.PLAYING,this.onChange(),!0)},TimerState.prototype.isPlaying=function(){return this.state===exports.PLAYING},TimerState.prototype.setPaused=function(){return this.state===exports.PLAYING&&(this.state=exports.PAUSED,this.onChange(),!0)},TimerState.prototype.isPaused=function(){return this.state===exports.PAUSED},TimerState.prototype.setStopped=function(){return this.state!==exports.INITED&&(this.state=exports.STOPPED,this.onChange(),!0)},TimerState.prototype.isStopped=function(){return this.state===exports.STOPPED},TimerState}();exports.default=TimerState}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.