'use strict';var_extends=Object.assign||function(a){for(varb,c=1;c<arguments.length;c++)for(vardinb=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);returna},_createClass=function(){functiona(a,b){for(varc,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'inc&&(c.writable=!0),Object.defineProperty(a,c.key,c)}returnfunction(b,c,d){returnc&&a(b.prototype,c),d&&a(b,d),b}}(),_react=require('react'),_react2=_interopRequireDefault(_react),_propTypes=require('prop-types'),_propTypes2=_interopRequireDefault(_propTypes);Object.defineProperty(exports,'__esModule',{value:!0});function_interopRequireDefault(a){returna&&a.__esModule?a:{default:a}}function_objectWithoutProperties(a,b){varc={};for(vardina)!(0<=b.indexOf(d))&&Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);returnc}function_classCallCheck(a,b){if(!(ainstanceofb))thrownewTypeError('Cannot call a class as a function')}function_possibleConstructorReturn(a,b){if(!a)thrownewReferenceError('this hasn\'t been initialised - super() hasn\'t been called');returnb&&('object'==typeofb||'function'==typeofb)?b:a}function_inherits(a,b){if('function'!=typeofb&&null!==b)thrownewTypeError('Super expression must either be null or a function, not '+typeofb);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}vardefaultErrorMessage=_react2.default.createElement('p',null,'\uD604\uC7AC Daum \uC6B0\uD3B8\uBC88\uD638 \uC11C\uBE44\uC2A4\uB97C \uC774\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694.'),DaumPostcode=function(a){functionb(a){_classCallCheck(this,b);varc=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));returnc.state={display:'block',width:c.props.width,height:c.props.height,error:!1},c.initiate=function(a){window.daum.postcode.load(function(){varb=newwindow.daum.Postcode({oncomplete:function(b){a.props.onComplete(b),a.props.autoClose&&a.setState({display:'none'})},onsearch:a.props.onSearch,onresize:function(b){a.props.autoResize&&a.setState({height:b.height})},alwaysShowEngAddr:a.props.alwaysShowEngAddr,animation:a.props.animation,autoMapping:a.props.autoMapping,autoResize:a.props.autoResize,height:a.props.height,hideEngBtn:a.props.hideEngBtn,hideMapBtn:a.props.hideMapBtn,maxSuggestItems:a.props.maxSuggestItems,pleaseReadGuide:a.props.pleaseReadGuide,pleaseReadGuideTimer:a.props.pleaseReadGuideTimer,shorthand:a.props.shorthand,showMoreHName:a.props.showMoreHName,submitMode:a.props.submitMode,theme:a.props.theme,useSuggest:a.props.useSuggest,width:a.props.width,focusInput:a.props.focusInput,focusContent:a.props.focusContent});b.embed(c.wrap,{q:c.props.defaultQuery,autoClose:c.props.autoClose})})},c.handleError=function(a){a.target.remove(),c.setState({error:!0})},c.state={display:'block',width:c.props.width,height:c.props.height,error:!1},c}return_inherits(b,a),_createClass(b,[{key:'componentDidMount',value:functioncomponentDidMount(){vara=this,b='daum_postcode_script',c=!!document.getElementById(b);if(!c){vard=document.createElement('script');d.src=this.props.scriptUrl,d.onload=function(){returna.initiate(a)},d.onerror=function(b){returna.handleError(b)},d.id=b,document.body.appendChild(d)}elsethis.initiate(this)}},{key:'render',value:functionrender(){vara=this,b=this.props,c=b.style,d=b.onComplete,e=b.onSearch,f=b.alwaysShowEngAddr,g=b.animation,h=b.autoClose,i=b.autoMapping,j=b.autoResize,k=b.defaultQuery,l=b.errorMessage,m=b.height,n=b.hideEngBtn,o=b.hideMapBtn,p=b.maxSuggestItems,q=b.pleaseReadGuide,r=b.pleaseReadGuideTimer,s=b.scriptUrl,t=b.shorthand,u=b.showMoreHName,v=b.submitMode,w=b.theme,x=b.useSuggest,y=b.width,z=b.zonecodeOnly,A=b.focusInput,B=b.focusContent,C=_objectWithoutProperties(b,['style','onComplete','onSearch','alwaysShowEngAddr','animation','autoClose','autoMapping','autoResize','defaultQuery','errorMessage','height','hideEngBtn','hideMapBtn','maxSuggestItems','pleaseReadGuide','pleaseReadGuideTimer','scriptUrl','shorthand','showMoreHName','submitMode','theme','useSuggest','width','zonecodeOnly','focusInput','focusContent']);return_react2.default.createElement('div',_extends({ref:functionref(b){a.wrap=b},style:_extends({width:this.state.width,height:this.state.height,display:this.state.display},c)},C),this.state.error&&this.props.errorMessage)}}]),b}(_react2.default.Component);DaumPostcode.propTypes={onComplete:_propTypes2.default.func.isRequired,onSearch:_propTypes2.default.func,alwaysShowEngAddr:_propTypes2.default.bool,animation:_propTypes2.default.bool,autoClose:_propTypes2.default.bool,autoMapping:_propTypes2.default.bool,autoResize:_propTypes2.default.bool,defaultQuery:_propTypes2.default.string,errorMessage:_propTypes2.default.oneOfType([_propTypes2.default.string,_propTypes2.default.element]),height:_propTypes2.default.oneOfType([_propTypes2.default.number,_propTypes2.default.string]),hideEngBtn:_propTypes2.default.bool,hideMapBtn:_propTypes2.default.bool,maxSuggestItems:_propTypes2.default.number,pleaseReadGuide:_propTypes2.default.number,pleaseReadGuideTimer:_propTypes2.default.number,scriptUrl:_propTypes2.default.string,shorthand:_propTypes2.default.bool,showMoreHName:_propTypes2.default.bool,style:_propTypes2.default.object,submitMode:_propTypes2.default.bool,theme:_propTypes2.default.object,useSuggest:_propTypes2.default.bool,width:_propTypes2.default.oneOfType([_propTypes2.default.number,_propTypes2.default.string]),focusInput:_propTypes2.default.bool,focusContent:_propTypes2.default.bool},DaumPostcode.defaultProps={onSearch:void0,alwaysShowEngAddr:!1,animation:!1,autoClose:!1,autoMapping:!0,autoResize:!1,defaultQuery:null,errorMessage:defaultErrorMessage,height:400,hideEngBtn:!1,hideMapBtn:!1,maxSuggestItems:10,pleaseReadGuide:0,pleaseReadGuideTimer:1.5,scriptUrl:'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js',shorthand:!0,showMoreHName:!1,style:null,submitMode:!0,theme:null,useSuggest:!0,width:'100%',focusInput:!0,focusContent:!0},exports.default=DaumPostcode;