-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
14 lines (14 loc) · 11.5 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t,r){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,r){"use strict";var n=function(e){};e.exports=function(e,t,r,o,a,u,c,i){if(n(t),!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 f=[r,o,a,u,c,i],s=0;(l=new Error(t.replace(/%s/g,function(){return f[s++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";var n=r(0),o=r(1),a=r(2);e.exports=function(){function e(e,t,r,n,u,c){c!==a&&o(!1,"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")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){e.exports=r(3)()},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,u,c=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i<arguments.length;i++){for(var l in r=Object(arguments[i]))o.call(r,l)&&(c[l]=r[l]);if(n){u=n(r);for(var f=0;f<u.length;f++)a.call(r,u[f])&&(c[u[f]]=r[u[f]])}}return c}},function(e,t,r){"use strict";
/** @license React v16.3.2
* react.production.min.js
*
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var n=r(6),o=r(1),a=r(5),u=r(0),c="function"==typeof Symbol&&Symbol.for,i=c?Symbol.for("react.element"):60103,l=c?Symbol.for("react.portal"):60106,f=c?Symbol.for("react.fragment"):60107,s=c?Symbol.for("react.strict_mode"):60108,p=c?Symbol.for("react.provider"):60109,d=c?Symbol.for("react.context"):60110,y=c?Symbol.for("react.async_mode"):60111,h=c?Symbol.for("react.forward_ref"):60112,b="function"==typeof Symbol&&Symbol.iterator;function v(e){for(var t=arguments.length-1,r="http://reactjs.org/docs/error-decoder.html?invariant="+e,n=0;n<t;n++)r+="&args[]="+encodeURIComponent(arguments[n+1]);o(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",r)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function g(e,t,r){this.props=e,this.context=t,this.refs=a,this.updater=r||m}function O(){}function _(e,t,r){this.props=e,this.context=t,this.refs=a,this.updater=r||m}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&v("85"),this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},O.prototype=g.prototype;var S=_.prototype=new O;S.constructor=_,n(S,g.prototype),S.isPureReactComponent=!0;var w={current:null},x=Object.prototype.hasOwnProperty,j={key:!0,ref:!0,__self:!0,__source:!0};function P(e,t,r){var n=void 0,o={},a=null,u=null;if(null!=t)for(n in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(a=""+t.key),t)x.call(t,n)&&!j.hasOwnProperty(n)&&(o[n]=t[n]);var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){for(var l=Array(c),f=0;f<c;f++)l[f]=arguments[f+2];o.children=l}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===o[n]&&(o[n]=c[n]);return{$$typeof:i,type:e,key:a,ref:u,props:o,_owner:w.current}}function R(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var k=/\/+/g,T=[];function C(e,t,r,n){if(T.length){var o=T.pop();return o.result=e,o.keyPrefix=t,o.func=r,o.context=n,o.count=0,o}return{result:e,keyPrefix:t,func:r,context:n,count:0}}function E(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>T.length&&T.push(e)}function D(e,t,r,n){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a=!1;if(null===e)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case i:case l:a=!0}}if(a)return r(n,e,""===t?"."+$(e,0):t),1;if(a=0,t=""===t?".":t+":",Array.isArray(e))for(var u=0;u<e.length;u++){var c=t+$(o=e[u],u);a+=D(o,c,r,n)}else if(null===e||void 0===e?c=null:c="function"==typeof(c=b&&e[b]||e["@@iterator"])?c:null,"function"==typeof c)for(e=c.call(e),u=0;!(o=e.next()).done;)a+=D(o=o.value,c=t+$(o,u++),r,n);else"object"===o&&v("31","[object Object]"===(r=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":r,"");return a}function $(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function L(e,t){e.func.call(e.context,t,e.count++)}function A(e,t,r){var n=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?q(e,n,r,u.thatReturnsArgument):null!=e&&(R(e)&&(t=o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(k,"$&/")+"/")+r,e={$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}),n.push(e))}function q(e,t,r,n,o){var a="";null!=r&&(a=(""+r).replace(k,"$&/")+"/"),t=C(t,a,n,o),null==e||D(e,"",A,t),E(t)}var I={Children:{map:function(e,t,r){if(null==e)return e;var n=[];return q(e,n,null,t,r),n},forEach:function(e,t,r){if(null==e)return e;t=C(null,null,t,r),null==e||D(e,"",L,t),E(t)},count:function(e){return null==e?0:D(e,"",u.thatReturnsNull,null)},toArray:function(e){var t=[];return q(e,t,null,u.thatReturnsArgument),t},only:function(e){return R(e)||v("143"),e}},createRef:function(){return{current:null}},Component:g,PureComponent:_,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:d,_calculateChangedBits:t,_defaultValue:e,_currentValue:e,_changedBits:0,Provider:null,Consumer:null}).Provider={$$typeof:p,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:h,render:e}},Fragment:f,StrictMode:s,unstable_AsyncMode:y,createElement:P,cloneElement:function(e,t,r){(null===e||void 0===e)&&v("267",e);var o=void 0,a=n({},e.props),u=e.key,c=e.ref,l=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,l=w.current),void 0!==t.key&&(u=""+t.key);var f=void 0;for(o in e.type&&e.type.defaultProps&&(f=e.type.defaultProps),t)x.call(t,o)&&!j.hasOwnProperty(o)&&(a[o]=void 0===t[o]&&void 0!==f?f[o]:t[o])}if(1===(o=arguments.length-2))a.children=r;else if(1<o){f=Array(o);for(var s=0;s<o;s++)f[s]=arguments[s+2];a.children=f}return{$$typeof:i,type:e.type,key:u,ref:c,props:a,_owner:l}},createFactory:function(e){var t=P.bind(null,e);return t.type=e,t},isValidElement:R,version:"16.3.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:w,assign:n}},F=Object.freeze({default:I}),N=F&&I||F;e.exports=N.default?N.default:N},function(e,t,r){"use strict";e.exports=r(7)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(8),u=i(a),c=i(r(4));function i(e){return e&&e.__esModule?e:{default:e}}var l={onSearch:c.default.func.isRequired,handleDataToRender:c.default.func.isRequired,apiData:c.default.object.isRequired,styles:c.default.object},f=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.loadState=function(){try{var e=localStorage.getItem("SearchBarState");r.state=null!=e?JSON.parse(e):{searchTerm:"",cachedData:{},searchTermLowerCase:""}}catch(e){console.log(e)}},r.saveState=function(){var e=JSON.stringify(n({},r.state,{searchTerm:"",searchTermLowerCase:""}));try{localStorage.setItem("SearchBarState",e)}catch(e){console.log(e)}},r.updateCachedData=function(e){var t,o,a;console.log(e),r.setState({cachedData:n({},r.state.cachedData,(t={},o=r.state.searchTermLowerCase,a=e.city,o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t))},function(){r.saveState(),r.props.handleDataToRender(r.state.cachedData[r.state.searchTermLowerCase])})},r.loadState(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),o(t,[{key:"componentWillReceiveProps",value:function(e){e.apiData!==this.props.apiData&&this.updateCachedData(e.apiData)}},{key:"render",value:function(){var e=this,t=this.state,r=t.cachedData,n=(t.searchTerm,t.searchTermLowerCase),o=this.props.styles||{};return u.default.createElement("div",null,u.default.createElement("input",{type:"text",style:o.input,onChange:function(t){e.setState({searchTerm:t.target.value,searchTermLowerCase:t.target.value.toLowerCase()})},onKeyPress:function(t){"Enter"===t.key&&(n in r?e.props.handleDataToRender(r[n]):e.props.onSearch(e.state.searchTermLowerCase))}}),u.default.createElement("button",{style:o.button,onClick:function(){console.log("here"),n in r?e.props.handleDataToRender(r[n]):e.props.onSearch(e.state.searchTermLowerCase)}},"Search"))}}]),t}();f.propTypes=l,f.defaultProps={styles:{input:{background:"transparent",borderWidth:"1px",lineHeight:"1.5",height:"43px",width:"500px",borderRadius:"5px",fontSize:"17px"},button:{fontSize:"19px",paddingTop:"0px",paddingBottom:"0px",color:"#ffffff",paddingLeft:"18px",paddingRight:"18px",borderRadius:"4px",border:"0px",background:"#FF5A5F",height:"45px",textAlign:"center",display:"inline-block",whiteSpace:"nowrap",marginLeft:"7px"}}},t.default=f}]);