"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_warning=require("../_util/warning"),_warning2=_interopRequireDefault(_warning),_BreadcrumbItem=require("./BreadcrumbItem"),_BreadcrumbItem2=_interopRequireDefault(_BreadcrumbItem),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getBreadcrumbName(e,t){if(!e.breadcrumbName)return null;var r=Object.keys(t).join("|");return e.breadcrumbName.replace(new RegExp(":("+r+")","g"),function(e,r){return t[r]||e})}function defaultItemRender(e,r,t,a){var n=t.indexOf(e)===t.length-1,s=getBreadcrumbName(e,r);return n?React.createElement("span",null,s):React.createElement("a",{href:"#/"+a.join("/")},s)}var Breadcrumb=function(e){function r(){return(0,_classCallCheck3.default)(this,r),(0,_possibleConstructorReturn3.default)(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return(0,_inherits3.default)(r,e),(0,_createClass3.default)(r,[{key:"componentDidMount",value:function(){var e=this.props;(0,_warning2.default)(!("linkRender"in e||"nameRender"in e),"`linkRender` and `nameRender` are removed, please use `itemRender` instead, see: #.")}},{key:"render",value:function(){var e=void 0,r=this.props,t=r.separator,a=r.prefixCls,n=r.style,s=r.className,u=r.routes,i=r.params,l=void 0===i?{}:i,c=r.children,o=r.itemRender,p=void 0===o?defaultItemRender:o;if(u&&0<u.length){var d=[];e=u.map(function(e){e.path=e.path||"";var r=e.path.replace(/^\//,"");return Object.keys(l).forEach(function(e){r=r.replace(":"+e,l[e])}),r&&d.push(r),React.createElement(_BreadcrumbItem2.default,{separator:t,key:e.breadcrumbName||r},p(e,l,u,d))})}else c&&(e=React.Children.map(c,function(e,r){return e?((0,_warning2.default)(e.type&&e.type.__ANT_BREADCRUMB_ITEM,"Breadcrumb only accepts Breadcrumb.Item as it's children"),(0,_react.cloneElement)(e,{separator:t,key:r})):e}));return React.createElement("div",{className:(0,_classnames2.default)(s,a),style:n},e)}}]),r}(React.Component);(exports.default=Breadcrumb).defaultProps={prefixCls:"dt-breadcrumb",separator:"/"},Breadcrumb.propTypes={prefixCls:PropTypes.string,separator:PropTypes.node,routes:PropTypes.array,params:PropTypes.object,linkRender:PropTypes.func,nameRender:PropTypes.func},module.exports=exports.default;