vendor: 3,595 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 0); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 4,727 bytes, lines 89-127
89/***/ "./assets/js/src/components/adres/adresZorgverlener.jsx": 90/*!**************************************************************!*\ 91 !*** ./assets/js/src/components/adres/adresZorgverlener.jsx ***! 92 \**************************************************************/ 93/*! exports provided: default */ 94/***/ (function(module, __webpack_exports__, __webpack_require__) { 95 96"use strict"; 97__webpack_require__.r(__webpack_exports__); 98/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return AdresZorgverlener; }); 99/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 100/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 101/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 102/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 103/* harmony import */ var _generic_zorgverlenerLocationsSelect_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../generic/zorgverlenerLocationsSelect.jsx */ "./assets/js/src/components/generic/zorgverlenerLocationsSelect.jsx"); 104/* harmony import */ var _generic_googleMapRouteModes_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../generic/googleMapRouteModes.jsx */ "./assets/js/src/components/generic/googleMapRouteModes.jsx"); 105/* harmony import */ var _generic_LocationRemarks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../generic/LocationRemarks */ "./assets/js/src/components/generic/LocationRemarks.jsx"); 106/* harmony import */ var _generic_leafletMap_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../generic/leafletMap.jsx */ "./assets/js/src/components/generic/leafletMap.jsx"); 107/* harmony import */ var _utils_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils.jsx */ "./assets/js/src/utils.jsx"); 108function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 109 110function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 111 112function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 113 114function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 115 116function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 117 118function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 119 120function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 121 122function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 123 124function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 125 126function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 127
128function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 129 130 131 132 133 134 135 136 137 138var AdresZorgverlener = /*#__PURE__*/function (_React$Component) { 139 _inherits(AdresZorgverlener, _React$Component); 140 141 var _super = _createSuper(AdresZorgverlener); 142 143 function AdresZorgverlener(props) { 144 var _this; 145 146 _classCallCheck(this, AdresZorgverlener); 147 148 _this = _super.call(this, props); 149 var location = WP.zorgverlenerInfo.locations[0]; 150 _this.state = { 151 locations: WP.zorgverlenerInfo.locations, 152 location: location, 153 latLng: WP.zorgverlenerMap.locations[0] 154 }; 155 _this.onChange = _this.onChange.bind(_assertThisInitialized(_this)); 156 return _this; 157 } 158 159 _createClass(AdresZorgverlener, [{ 160 key: "onChange", 161 value: function onChange(event) { 162 var mapIndex = event.target.value; 163 var location = this.state.locations[mapIndex]; 164 this.setState({ 165 location: location, 166 latLng: WP.zorgverlenerMap.locations[mapIndex] 167 }); 168 } 169 }, { 170 key: "render", 171 value: function render() { 172 var adressLinesHTML = []; 173 var adressLines = this.state.location.adress.split(","); 174 var zorgverlenerLocationSelect = lodash__WEBPACK_IMPORTED_MODULE_1___default.a.size(this.state.locations) > 1 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_zorgverlenerLocationsSelect_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], { 175 onChange: this.onChange 176 }) : ""; 177 adressLines.map(function (line, i) { 178 adressLinesHTML.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 179 translate: "no", 180 key: i 181 }, line)); 182 }); 183 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 184 className: "row" 185 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 186 className: "col-md-6" 187 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("header", { 188 className: "util--vertical-margin page-section--header" 189 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h2", { 190 className: "display-h1" 191 }, "Adres en contact")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 192 className: "content" 193 }, this.state.locations.length > 1 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { 194 htmlFor: "zorgverlener-openingstijden", 195 "aria-label": "Kies een locatie om de adres- en contactgegevens te zien", 196 className: "select-label" 197 }, "Kies een locatie om de adres- en contactgegevens te zien:"), zorgverlenerLocationSelect, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 198 className: "util--xl-down--margin-bottom row" 199 }, this.state.location.name && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 200 className: "col-sm-12" 201 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 202 className: "display-h3 util--vertical-margin--half special-color--primary" 203 }, this.state.location.name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 204 className: "col-sm-6" 205 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("b", null, "Adres")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 206 className: "list--unlist" 207 }, adressLinesHTML)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 208 className: "col-sm-6" 209 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("b", null, "Contact")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 210 className: "list--unlist", 211 translate: "no" 212 }, this.state.location.phone && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 213 key: "adress-phone", 214 translate: "no", 215 dangerouslySetInnerHTML: { 216 __html: "Tel: " + this.state.location.phone 217 } 218 }), this.state.location.phone_emergency && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 219 key: "adress-phone-emergency", 220 translate: "no", 221 dangerouslySetInnerHTML: { 222 __html: "Spoed: " + this.state.location.phone_emergency 223 } 224 }), this.state.location.fax && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 225 key: "adress-fax", 226 translate: "no", 227 dangerouslySetInnerHTML: { 228 __html: "Fax: " + this.state.location.fax 229 } 230 }), this.state.location.email && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 231 key: "adress-email", 232 translate: "no", 233 dangerouslySetInnerHTML: { 234 __html: "Mail: " + this.state.location.email 235 } 236 }))), this.state.location.remarks && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 237 className: "col-sm-12" 238 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_LocationRemarks__WEBPACK_IMPORTED_MODULE_4__["default"], { 239 content: this.state.location.remarks 240 }))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 241 className: "col-md-5 col-md-offset-1" 242 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 243 className: "padded-block padded-block--border" 244 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
245 className: "col-md-12 col-md-padding pt-2 pt-md-3" 246 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_leafletMap_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], { 247 markerColor: WP.zorgverlenerMap.markerColor, 248 latLng: this.state.latLng 249 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_googleMapRouteModes_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], { 250 adress: this.state.location.adress 251 }))))); 252 } 253 }]); 254 255 return AdresZorgverlener; 256}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 257 258 259 260/***/ }), 261
vendor: 4,651 bytes, lines 262-299
262/***/ "./assets/js/src/components/contactRoute/contactRouteGlobal.jsx": 263/*!**********************************************************************!*\ 264 !*** ./assets/js/src/components/contactRoute/contactRouteGlobal.jsx ***! 265 \**********************************************************************/ 266/*! exports provided: default */ 267/***/ (function(module, __webpack_exports__, __webpack_require__) { 268 269"use strict"; 270__webpack_require__.r(__webpack_exports__); 271/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return contactRouteGlobal; }); 272/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 273/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 274/* harmony import */ var _generic_zorgverlenersSelect_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../generic/zorgverlenersSelect.jsx */ "./assets/js/src/components/generic/zorgverlenersSelect.jsx"); 275/* harmony import */ var _generic_loadingIcon_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../generic/loadingIcon.jsx */ "./assets/js/src/components/generic/loadingIcon.jsx"); 276/* harmony import */ var _generic_googleMapRouteModes_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../generic/googleMapRouteModes.jsx */ "./assets/js/src/components/generic/googleMapRouteModes.jsx"); 277/* harmony import */ var _generic_LocationRemarks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../generic/LocationRemarks */ "./assets/js/src/components/generic/LocationRemarks.jsx"); 278/* harmony import */ var _generic_leafletMap_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../generic/leafletMap.jsx */ "./assets/js/src/components/generic/leafletMap.jsx"); 279/* harmony import */ var _utils_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../utils.jsx */ "./assets/js/src/utils.jsx"); 280function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 281 282function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 283 284function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 285 286function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 287 288function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 289 290function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 291 292function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 293 294function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 295 296function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 297 298function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 299
300function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 301 302 303 304 305 306 307 308 309 310var contactRouteGlobal = /*#__PURE__*/function (_React$Component) { 311 _inherits(contactRouteGlobal, _React$Component); 312 313 var _super = _createSuper(contactRouteGlobal); 314 315 function contactRouteGlobal(props) { 316 var _this; 317 318 _classCallCheck(this, contactRouteGlobal); 319 320 _this = _super.call(this, props); 321 _this.state = { 322 locations: WP.zorgverlenerInfo.locations, 323 location: false, 324 latLng: WP.zorgverlenerMap, 325 loading: false 326 }; 327 _this.onChange = _this.onChange.bind(_assertThisInitialized(_this)); 328 return _this; 329 } 330 331 _createClass(contactRouteGlobal, [{ 332 key: "getContactInformation", 333 value: function getContactInformation(id, locationSlug) { 334 this.setState({ 335 loading: true 336 }); 337 locationSlug = locationSlug.length > 0 ? locationSlug : 0; 338 jQuery.get(WP.REST_API_URL + "/zorgverlener/" + id + "/contactroute/" + locationSlug, function (result) { 339 this.setState({ 340 location: result, 341 latLng: result.coords, 342 loading: false 343 }); 344 }.bind(this)); 345 } 346 }, { 347 key: "onChange", 348 value: function onChange(event) { 349 var id = event.target.value; 350 var locationSlug = jQuery("#" + event.target.id + " option:selected").attr("data-location"); 351 locationSlug = locationSlug !== undefined ? locationSlug : ""; 352 this.getContactInformation(id, locationSlug); 353 } 354 }, { 355 key: "render", 356 value: function render() { 357 var loadingIcon = this.state.loading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_loadingIcon_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], null) : ""; 358 var adressLinesHTML = []; 359 var adressLines = ""; 360 361 if (this.state.location) { 362 adressLines = this.state.location.adress.split(","); 363 adressLines.map(function (line, i) { 364 adressLinesHTML.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 365 translate: "no", 366 key: i 367 }, line)); 368 }); 369 } 370 371 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 372 className: "row" 373 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 374 className: "col-md-6" 375 }, loadingIcon, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("header", { 376 className: "util--vertical-margin page-section--header" 377 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h2", { 378 className: "display-h1" 379 }, "Adres en contact")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 380 className: "content" 381 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { 382 id: "select-contact-route-global--label", 383 htmlFor: "select-contact-route-global", 384 "aria-label": "Kies een zorgverlener om de adres- en contactgegevens te zien", 385 className: "select-label" 386 }, "Kies een zorgverlener om de adres- en contactgegevens te zien:"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_zorgverlenersSelect_jsx__WEBPACK_IMPORTED_MODULE_1__["default"], { 387 ariaLabelledBy: "select-contact-route-global--label", 388 onChange: this.onChange, 389 id: "select-contact-route-global" 390 })), this.state.location && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 391 role: "region", 392 "aria-live": "polite", 393 className: "util--xl-down--margin-bottom flex-grid mt-4" 394 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 395 className: "col-sm-12 mb-2" 396 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 397 className: "util--vertical-margin--half special-color--primary display-h3" 398 }, this.state.location.name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 399 className: "flex-grid--child flex-grid--grow-1 flex-grid--xs-down--full" 400 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("b", null, "Adres")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 401 className: "list--unlist mt-2" 402 }, adressLinesHTML)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 403 className: "flex-grid--child flex-grid--grow-1 flex-grid--xs-down--full" 404 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("b", null, "Contact")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 405 className: "list--unlist mt-2", 406 translate: "no" 407 }, this.state.location.phone && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 408 key: "adress-phone", 409 translate: "no", 410 dangerouslySetInnerHTML: { 411 __html: "Tel: " + this.state.location.phone 412 } 413 }), this.state.location.phone_emergency && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 414 key: "adress-phone-emergency", 415 translate: "no", 416 dangerouslySetInnerHTML: { 417 __html: "Spoed: " + this.state.location.phone_emergency 418 } 419 }), this.state.location.fax && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 420 key: "adress-fax", 421 translate: "no", 422 dangerouslySetInnerHTML: { 423 __html: "Fax: " + this.state.location.fax 424 } 425 }), this.state.location.email && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 426 key: "adress-email", 427 translate: "no", 428 dangerouslySetInnerHTML: { 429 __html: "Mail: " + this.state.location.email 430 } 431 }))), this.state.location.remarks && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 432 className: "col-sm-12" 433 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_LocationRemarks__WEBPACK_IMPORTED_MODULE_4__["default"], { 434 content: this.state.location.remarks 435 }))))), this.state.location && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 436 className: "col-md-5 col-md-offset-1" 437 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 438 className: "padded-block padded-block--border" 439 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
440 className: "col-md-12 col-md-padding" 441 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_leafletMap_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], { 442 markerColor: WP.zorgverlenerMap.markerColor, 443 latLng: this.state.latLng 444 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_googleMapRouteModes_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], { 445 adress: this.state.location.adress 446 }))))); 447 } 448 }]); 449 450 return contactRouteGlobal; 451}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 452 453 454 455/***/ }), 456
457/***/ "./assets/js/src/components/generic/LocationRemarks.jsx": 458/*!**************************************************************!*\ 459 !*** ./assets/js/src/components/generic/LocationRemarks.jsx ***! 460 \**************************************************************/ 461/*! exports provided: default */ 462/***/ (function(module, __webpack_exports__, __webpack_require__) { 463 464"use strict"; 465__webpack_require__.r(__webpack_exports__); 466/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 467/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 468 469 470var LocationRemarks = function LocationRemarks(props) { 471 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 472 className: "location-remarks", 473 dangerouslySetInnerHTML: { 474 __html: props.content 475 } 476 }); 477}; 478 479/* harmony default export */ __webpack_exports__["default"] = (LocationRemarks); 480 481/***/ }), 482
vendor: 5,212 bytes, lines 483-565
483/***/ "./assets/js/src/components/generic/SelectList.jsx": 484/*!*********************************************************!*\ 485 !*** ./assets/js/src/components/generic/SelectList.jsx ***! 486 \*********************************************************/ 487/*! exports provided: default */ 488/***/ (function(module, __webpack_exports__, __webpack_require__) { 489 490"use strict"; 491__webpack_require__.r(__webpack_exports__); 492/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return SelectList; }); 493/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 494/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 495/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 496/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 497function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 498 499function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 500 501function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 502 503function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 504 505function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 506 507function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 508 509function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 510 511function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 512 513function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 514 515function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 516 517function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 518 519 520 521/** 522 * Default component for generating optgroups with options 523 * TODO: should also work when optgroup is not provided 524 */ 525 526var SelectList = /*#__PURE__*/function (_React$Component) { 527 _inherits(SelectList, _React$Component); 528 529 var _super = _createSuper(SelectList); 530 531 function SelectList(props) { 532 _classCallCheck(this, SelectList); 533 534 return _super.call(this, props); 535 } 536 537 _createClass(SelectList, [{ 538 key: "getOptions", 539 value: function getOptions(options) { 540 var _this = this; 541 542 return options.map(function (option) { 543 return _this.getOptionsTag(option); 544 }); 545 } 546 }, { 547 key: "getOptionsTag", 548 value: function getOptionsTag(option) { 549 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 550 key: option.id, 551 value: option.url 552 }, option.title); 553 } 554 }, { 555 key: "getOptgroupTags", 556 value: function getOptgroupTags(optionList) { 557 var _this2 = this; 558 559 var optGroups = []; 560 561 lodash__WEBPACK_IMPORTED_MODULE_1___default.a.forEach(optionList, function (value, key) { 562 var children = _this2.getOptions(value); 563 564 optGroups.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("optgroup", { 565 key: key,
566 label: key 567 }, children)); 568 }); 569 570 return optGroups; 571 } 572 }, { 573 key: "render", 574 value: function render() { 575 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("select", { 576 value: "default", 577 className: this.props.className, 578 onChange: this.props.onChange 579 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 580 key: "default", 581 value: "default", 582 disabled: true 583 }, this.props.defaultText), this.getOptgroupTags(this.props.optionList)); 584 } 585 }]); 586 587 return SelectList; 588}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 589 590 591SelectList.propTypes = { 592 optionList: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.object, 593 className: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 594 onChange: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.func, 595 defaultValue: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 596 defaultText: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 597}; 598 599/***/ }), 600
vendor: 6,871 bytes, lines 601-699
601/***/ "./assets/js/src/components/generic/googleMapRouteModes.jsx": 602/*!******************************************************************!*\ 603 !*** ./assets/js/src/components/generic/googleMapRouteModes.jsx ***! 604 \******************************************************************/ 605/*! exports provided: default */ 606/***/ (function(module, __webpack_exports__, __webpack_require__) { 607 608"use strict"; 609__webpack_require__.r(__webpack_exports__); 610/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return googleMapRouteModes; }); 611/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 612/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 613function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 614 615function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 616 617function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 618 619function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 620 621function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 622 623function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 624 625function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 626 627function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 628 629function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 630 631function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 632 633function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 634 635 636 637var googleMapRouteModes = /*#__PURE__*/function (_React$Component) { 638 _inherits(googleMapRouteModes, _React$Component); 639 640 var _super = _createSuper(googleMapRouteModes); 641 642 function googleMapRouteModes() { 643 _classCallCheck(this, googleMapRouteModes); 644 645 return _super.apply(this, arguments); 646 } 647 648 _createClass(googleMapRouteModes, [{ 649 key: "render", 650 value: function render() { 651 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 652 className: "route-container" 653 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 654 className: "display-h4 util--vertical-margin--only-bottom" 655 }, "Plan uw route"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 656 className: "list-unstyled" 657 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 658 className: "btn primary-color primary-bg--hover text-white--hover", 659 target: "_blank", 660 title: "Route auto", 661 href: "https://maps.google.com/?daddr=".concat(this.props.adress, "&driving") 662 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 663 className: "fa fa-car", 664 "aria-hidden": "true" 665 }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 666 className: "btn primary-color primary-bg--hover text-white--hover", 667 target: "_blank", 668 title: "Route openbaar vervoer", 669 href: "https://maps.google.com/?dirflg=r&daddr=".concat(this.props.adress, "&mode=transit") 670 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 671 className: "fa fa-train", 672 "aria-hidden": "true" 673 }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 674 className: "btn primary-color primary-bg--hover text-white--hover", 675 target: "_blank", 676 title: "Route lopen", 677 href: "https://maps.google.com/?dirflg=w&daddr=".concat(this.props.adress) 678 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 679 className: "fa fa-male", 680 "aria-hidden": "true" 681 }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 682 className: "btn primary-color primary-bg--hover text-white--hover", 683 target: "_blank", 684 title: "Route fiets", 685 href: "https://maps.google.com/?dirflg=b&daddr=".concat(this.props.adress, "&mode=bicycling") 686 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 687 className: "fa fa-bicycle", 688 "aria-hidden": "true" 689 }))))); 690 } 691 }]); 692 693 return googleMapRouteModes; 694}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 695 696 697 698/***/ }), 699
vendor: 5,036 bytes, lines 700-783
700/***/ "./assets/js/src/components/generic/leafletMap.jsx": 701/*!*********************************************************!*\ 702 !*** ./assets/js/src/components/generic/leafletMap.jsx ***! 703 \*********************************************************/ 704/*! exports provided: default */ 705/***/ (function(module, __webpack_exports__, __webpack_require__) { 706 707"use strict"; 708__webpack_require__.r(__webpack_exports__); 709/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 710/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 711/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 712/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__); 713function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 714 715function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 716 717function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 718 719function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 720 721function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 722 723function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 724 725function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 726 727function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 728 729function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 730 731function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 732 733function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 734 735function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 736 737 738 739var zoom = 14; 740 741var LeafletMap = /*#__PURE__*/function (_React$Component) { 742 _inherits(LeafletMap, _React$Component); 743 744 var _super = _createSuper(LeafletMap); 745 746 function LeafletMap(props) { 747 var _this; 748 749 _classCallCheck(this, LeafletMap); 750 751 _this = _super.call(this, props); 752 _this.map = null; 753 _this.marker = null; 754 _this.tileLayer = null; 755 _this.state = { 756 loading: true, 757 latLng: null 758 }; 759 return _this; 760 } 761 762 _createClass(LeafletMap, [{ 763 key: "componentDidMount", 764 value: function componentDidMount() { 765 this.loadLeaflet(); 766 } 767 }, { 768 key: "componentWillReceiveProps", 769 value: function componentWillReceiveProps(nextProps) { 770 if (nextProps !== this.props) { 771 this.updateLeaflet(nextProps.latLng); 772 } 773 } 774 }, { 775 key: "updateLeaflet", 776 value: function updateLeaflet(_ref) { 777 var _this2 = this; 778 779 var lat = _ref.lat, 780 lng = _ref.lng; 781 this.setState({ 782 loading: true 783 });
784 this.map.setView(new leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.LatLng(lat, lng), zoom); 785 this.tileLayer.on("load", function () { 786 leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.marker([lat, lng], { 787 icon: _this2.createIcon() 788 }).addTo(_this2.map); 789 790 _this2.setState({ 791 loading: false 792 }); 793 }); 794 } 795 }, { 796 key: "loadLeaflet", 797 value: function loadLeaflet() { 798 var _this3 = this; 799 800 this.tileLayer = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { 801 attribution: '© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>' 802 }); 803 var _this$props$latLng = this.props.latLng, 804 lat = _this$props$latLng.lat, 805 lng = _this$props$latLng.lng; 806 this.map = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.map("leaflet-map", _defineProperty({ 807 zoomControl: false, 808 attributionControl: false, 809 dragging: false, 810 doubleClickZoom: false, 811 center: [lat, lng], 812 zoom: zoom, 813 layers: [this.tileLayer] 814 }, "attributionControl", false)); 815 this.map.scrollWheelZoom.disable(); 816 this.tileLayer.on("loading", function () { 817 _this3.setState({ 818 loading: true 819 }); 820 }); 821 this.tileLayer.on("load", function () { 822 _this3.setState({ 823 loading: false 824 }); 825 826 _this3.marker = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.marker([lat, lng], { 827 icon: _this3.createIcon() 828 }).addTo(_this3.map); 829 }); 830 } 831 }, { 832 key: "generateSvg", 833 value: function generateSvg() { 834 var markerColor = this.props.markerColor; 835 var svgIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1792\" viewBox=\"0 0 1792 1792\" width=\"1792\"><path fill=\"".concat(markerColor, "\" d=\"M1152 640q0-106-75-181t-181-75-181 75-75 181 75 181 181 75 181-75 75-181zm256 0q0 109-33 179l-364 774q-16 33-47.5 52t-67.5 19-67.5-19-46.5-52l-365-774q-33-70-33-179 0-212 150-362t362-150 362 150 150 362z\"/></svg>"); 836 return encodeURI("data:image/svg+xml," + svgIcon).replace("#", "%23"); 837 } 838 }, { 839 key: "createIcon", 840 value: function createIcon(markerColor) { 841 return leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.icon({ 842 iconUrl: this.generateSvg(), 843 iconSize: 55 844 }); 845 } 846 }, { 847 key: "render", 848 value: function render() { 849 var _this$props$latLng2 = this.props.latLng, 850 lat = _this$props$latLng2.lat, 851 lng = _this$props$latLng2.lng; 852 var loading = this.state.loading; 853 var mapLink = "//www.google.com/maps?q=loc:".concat(lat, ",").concat(lng, "&z=").concat(zoom); 854 var spinnerStyles = { 855 position: "absolute", 856 top: "50%", 857 left: "50%", 858 transform: "translate(-50%, -50%)" 859 }; 860 var mapStyles = { 861 width: "100%", 862 height: "330px" 863 }; 864 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 865 href: mapLink, 866 target: "_blank" 867 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 868 style: mapStyles, 869 id: "leaflet-map" 870 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 871 style: spinnerStyles 872 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 873 className: "fa fa-circle-o-notch fa-spin fa-2x fa-fw special-color--primary " 874 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 875 className: "sr-only" 876 }, "Loading..."))))); 877 } 878 }]); 879 880 return LeafletMap; 881}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 882 883/* harmony default export */ __webpack_exports__["default"] = (LeafletMap); 884 885/***/ }), 886
vendor: 9,582 bytes, lines 887-1025
887/***/ "./assets/js/src/components/generic/loadingIcon.jsx": 888/*!**********************************************************!*\ 889 !*** ./assets/js/src/components/generic/loadingIcon.jsx ***! 890 \**********************************************************/ 891/*! exports provided: default */ 892/***/ (function(module, __webpack_exports__, __webpack_require__) { 893 894"use strict"; 895__webpack_require__.r(__webpack_exports__); 896/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return loadingIcon; }); 897/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 898/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 899function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 900 901function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 902 903function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 904 905function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 906 907function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 908 909function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 910 911function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 912 913function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 914 915function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 916 917function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 918 919function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 920 921 922 923var loadingIcon = /*#__PURE__*/function (_React$Component) { 924 _inherits(loadingIcon, _React$Component); 925 926 var _super = _createSuper(loadingIcon); 927 928 function loadingIcon() { 929 _classCallCheck(this, loadingIcon); 930 931 return _super.apply(this, arguments); 932 } 933 934 _createClass(loadingIcon, [{ 935 key: "componentDidMount", 936 value: function componentDidMount() { 937 jQuery('.loader-wrapper').height(jQuery('.loader-wrapper').closest('section').height()); 938 } 939 }, { 940 key: "render", 941 value: function render() { 942 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 943 className: "loader-wrapper" 944 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 945 className: "loader-components" 946 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 947 className: "loader-components__dot primary-bg" 948 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 949 className: "loader-components__text primary-color" 950 }, "Gegevens ophalen"))); 951 } 952 }]); 953 954 return loadingIcon; 955}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 956 957 958 959/***/ }), 960 961/***/ "./assets/js/src/components/generic/zorgverlenerLocationsSelect.jsx": 962/*!**************************************************************************!*\ 963 !*** ./assets/js/src/components/generic/zorgverlenerLocationsSelect.jsx ***! 964 \**************************************************************************/ 965/*! exports provided: default */ 966/***/ (function(module, __webpack_exports__, __webpack_require__) { 967 968"use strict"; 969__webpack_require__.r(__webpack_exports__); 970/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return ZorgverlenerLocationSelect; }); 971/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 972/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 973function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 974 975function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 976 977function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 978 979function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 980 981function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 982 983function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 984 985function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 986 987function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 988 989function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 990 991function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 992 993function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 994 995 996 997var ZorgverlenerLocationSelect = /*#__PURE__*/function (_React$Component) { 998 _inherits(ZorgverlenerLocationSelect, _React$Component); 999 1000 var _super = _createSuper(ZorgverlenerLocationSelect); 1001 1002 function ZorgverlenerLocationSelect() { 1003 _classCallCheck(this, ZorgverlenerLocationSelect); 1004 1005 return _super.apply(this, arguments); 1006 } 1007 1008 _createClass(ZorgverlenerLocationSelect, [{ 1009 key: "render", 1010 value: function render() { 1011 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("select", { 1012 className: "c-select flex-grid--xl-down--full", 1013 id: this.props.id, 1014 onChange: this.props.onChange, 1015 dangerouslySetInnerHTML: { 1016 __html: WP.zorgverlenerLocationsOptions 1017 } 1018 })); 1019 } 1020 }]); 1021 1022 return ZorgverlenerLocationSelect; 1023}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1024 1025
1026ZorgverlenerLocationSelect.propTypes = { 1027 id: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.number 1028}; 1029 1030/***/ }), 1031
vendor: 4,584 bytes, lines 1032-1100
1032/***/ "./assets/js/src/components/generic/zorgverlenersSelect.jsx": 1033/*!******************************************************************!*\ 1034 !*** ./assets/js/src/components/generic/zorgverlenersSelect.jsx ***! 1035 \******************************************************************/ 1036/*! exports provided: default */ 1037/***/ (function(module, __webpack_exports__, __webpack_require__) { 1038 1039"use strict"; 1040__webpack_require__.r(__webpack_exports__); 1041/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return ZorgverlenerSelectHTML; }); 1042/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1043/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1044function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1045 1046function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1047 1048function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1049 1050function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1051 1052function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1053 1054function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1055 1056function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1057 1058function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1059 1060function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1061 1062function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1063 1064function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1065 1066 1067 1068var ZorgverlenerSelectHTML = /*#__PURE__*/function (_React$Component) { 1069 _inherits(ZorgverlenerSelectHTML, _React$Component); 1070 1071 var _super = _createSuper(ZorgverlenerSelectHTML); 1072 1073 function ZorgverlenerSelectHTML() { 1074 _classCallCheck(this, ZorgverlenerSelectHTML); 1075 1076 return _super.apply(this, arguments); 1077 } 1078 1079 _createClass(ZorgverlenerSelectHTML, [{ 1080 key: "render", 1081 value: function render() { 1082 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("select", { 1083 "aria-labelledby": this.props.ariaLabelledBy, 1084 className: "c-select", 1085 id: this.props.id, 1086 onChange: this.props.onChange, 1087 dangerouslySetInnerHTML: { 1088 __html: WP.zorgverlenersDropdown 1089 } 1090 }); 1091 } 1092 }]); 1093 1094 return ZorgverlenerSelectHTML; 1095}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1096 1097 1098 1099/***/ }), 1100
vendor: 5,280 bytes, lines 1101-1178
1101/***/ "./assets/js/src/components/medicalInformation/MedicalInformationHerhaalReceptDropdown.jsx": 1102/*!*************************************************************************************************!*\ 1103 !*** ./assets/js/src/components/medicalInformation/MedicalInformationHerhaalReceptDropdown.jsx ***! 1104 \*************************************************************************************************/ 1105/*! exports provided: default */ 1106/***/ (function(module, __webpack_exports__, __webpack_require__) { 1107 1108"use strict"; 1109__webpack_require__.r(__webpack_exports__); 1110/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MedicalInformationHerhaalReceptDropdown; }); 1111/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1112/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1113/* harmony import */ var _generic_SelectList_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../generic/SelectList.jsx */ "./assets/js/src/components/generic/SelectList.jsx"); 1114function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1115 1116function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1117 1118function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1119 1120function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1121 1122function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1123 1124function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1125 1126function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1127 1128function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1129 1130function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1131 1132function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1133 1134function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1135 1136 1137 1138 1139var MedicalInformationHerhaalReceptDropdown = /*#__PURE__*/function (_React$Component) { 1140 _inherits(MedicalInformationHerhaalReceptDropdown, _React$Component); 1141 1142 var _super = _createSuper(MedicalInformationHerhaalReceptDropdown); 1143 1144 function MedicalInformationHerhaalReceptDropdown(props) { 1145 var _this; 1146 1147 _classCallCheck(this, MedicalInformationHerhaalReceptDropdown); 1148 1149 _this = _super.call(this, props); 1150 _this.onChange = _this.onChange.bind(_assertThisInitialized(_this)); 1151 return _this; 1152 } 1153 1154 _createClass(MedicalInformationHerhaalReceptDropdown, [{ 1155 key: "onChange", 1156 value: function onChange(e) { 1157 document.location.href = e.target.value; 1158 } 1159 }, { 1160 key: "render", 1161 value: function render() { 1162 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_SelectList_jsx__WEBPACK_IMPORTED_MODULE_1__["default"], { 1163 optionList: this.props.zorgverlenerList, 1164 className: "c-select", 1165 onChange: this.onChange, 1166 defaultText: "Waar wilt u uw herhaalrecept aanvragen?", 1167 defaultValue: "default" 1168 }); 1169 } 1170 }]); 1171 1172 return MedicalInformationHerhaalReceptDropdown; 1173}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1174 1175 1176 1177/***/ }), 1178
vendor: 4,911 bytes, lines 1179-1218
1179/***/ "./assets/js/src/components/openingstijden/openingstijdenGlobal.jsx": 1180/*!**************************************************************************!*\ 1181 !*** ./assets/js/src/components/openingstijden/openingstijdenGlobal.jsx ***! 1182 \**************************************************************************/ 1183/*! exports provided: default */ 1184/***/ (function(module, __webpack_exports__, __webpack_require__) { 1185 1186"use strict"; 1187__webpack_require__.r(__webpack_exports__); 1188/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return OpeningstijdenGlobalWidget; }); 1189/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1190/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1191/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 1192/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); 1193/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 1194/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__); 1195/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/lib/ReactCSSTransitionGroup */ "./node_modules/react/lib/ReactCSSTransitionGroup.js"); 1196/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3__); 1197/* harmony import */ var _generic_zorgverlenersSelect_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../generic/zorgverlenersSelect.jsx */ "./assets/js/src/components/generic/zorgverlenersSelect.jsx"); 1198/* harmony import */ var _generic_loadingIcon_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../generic/loadingIcon.jsx */ "./assets/js/src/components/generic/loadingIcon.jsx"); 1199function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1200 1201function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1202 1203function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1204 1205function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1206 1207function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1208 1209function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1210 1211function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1212 1213function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1214 1215function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1216 1217function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1218
1219function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1220 1221 1222 1223 1224 1225 1226 1227 1228var OpeningstijdenGlobalWidget = /*#__PURE__*/function (_React$Component) { 1229 _inherits(OpeningstijdenGlobalWidget, _React$Component); 1230 1231 var _super = _createSuper(OpeningstijdenGlobalWidget); 1232 1233 function OpeningstijdenGlobalWidget(props) { 1234 var _this; 1235 1236 _classCallCheck(this, OpeningstijdenGlobalWidget); 1237 1238 _this = _super.call(this, props); 1239 _this.state = { 1240 openingstijden: [], 1241 loading: false 1242 }; 1243 _this.onChange = _this.onChange.bind(_assertThisInitialized(_this)); 1244 return _this; 1245 } 1246 1247 _createClass(OpeningstijdenGlobalWidget, [{ 1248 key: "getOpeningstijdenByLocationSlug", 1249 value: function getOpeningstijdenByLocationSlug(id, locationSlug) { 1250 this.setState({ 1251 loading: true 1252 }); 1253 locationSlug = locationSlug.length > 0 ? locationSlug : 0; 1254 jQuery.get(WP.REST_API_URL + "/zorgverlener/" + id + "/openingstijden/" + locationSlug, function (result) { 1255 this.setState({ 1256 openingstijden: result, 1257 loading: false 1258 }); 1259 }.bind(this)); 1260 } 1261 }, { 1262 key: "onChange", 1263 value: function onChange(event) { 1264 var id = event.target.value; 1265 var locationSlug = jQuery("#" + event.target.id + " option:selected").attr("data-location"); 1266 this.getOpeningstijdenByLocationSlug(id, locationSlug); 1267 } 1268 }, { 1269 key: "render", 1270 value: function render() { 1271 var loadingIcon = this.state.loading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_loadingIcon_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], null) : ""; 1272 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1273 className: "content" 1274 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1275 className: "row" 1276 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1277 className: "col-md-6" 1278 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", { 1279 id: "select-openingstijd-global--label", 1280 "aria-label": "Kies zorgverlener om de openingstijden te zien" 1281 }, "Kies zorgverlener om de openingstijden te zien:", " "), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_generic_zorgverlenersSelect_jsx__WEBPACK_IMPORTED_MODULE_4__["default"], { 1282 ariaLabelledBy: "select-openingstijd-global--label", 1283 id: "select-openingstijd-global", 1284 onChange: this.onChange 1285 }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenGlobalContent, { 1286 openingstijden: this.state.openingstijden 1287 }), loadingIcon); 1288 } 1289 }]); 1290 1291 return OpeningstijdenGlobalWidget; 1292}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1293 1294 1295 1296var OpeningstijdenGlobalContent = /*#__PURE__*/function (_React$Component2) { 1297 _inherits(OpeningstijdenGlobalContent, _React$Component2); 1298 1299 var _super2 = _createSuper(OpeningstijdenGlobalContent); 1300 1301 function OpeningstijdenGlobalContent() { 1302 _classCallCheck(this, OpeningstijdenGlobalContent); 1303 1304 return _super2.apply(this, arguments); 1305 } 1306 1307 _createClass(OpeningstijdenGlobalContent, [{ 1308 key: "render", 1309 value: function render() { 1310 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3___default.a, { 1311 transitionName: "example", 1312 transitionEnterTimeout: 500, 1313 transitionLeaveTimeout: 300 1314 }, typeof this.props.openingstijden.blocks !== "undefined" ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1315 role: "region", 1316 "aria-live": "polite", 1317 key: "cont", 1318 className: "row util--vertical-margin--half vertical-rhythm mt-5 openingstijden-content" 1319 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1320 key: "col-1", 1321 className: "col-sm-6 col-lg-3 util--md-down--margin-bottom" 1322 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenGlobalTimetable, { 1323 openingstijden: this.props.openingstijden 1324 })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenGlobalBlocks, { 1325 openingstijden: this.props.openingstijden 1326 })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1327 className: "d-none openingstijden-content" 1328 })); 1329 } 1330 }]); 1331 1332 return OpeningstijdenGlobalContent; 1333}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1334 1335var OpeningstijdenGlobalTimetable = /*#__PURE__*/function (_React$Component3) { 1336 _inherits(OpeningstijdenGlobalTimetable, _React$Component3); 1337 1338 var _super3 = _createSuper(OpeningstijdenGlobalTimetable); 1339 1340 function OpeningstijdenGlobalTimetable() { 1341 _classCallCheck(this, OpeningstijdenGlobalTimetable); 1342 1343 return _super3.apply(this, arguments); 1344 } 1345 1346 _createClass(OpeningstijdenGlobalTimetable, [{ 1347 key: "render", 1348 value: function render() { 1349 var rows = []; 1350 var i = 0; 1351 var days = 0; 1352 1353 if (this.props.openingstijden.timetable) { 1354 lodash__WEBPACK_IMPORTED_MODULE_2___default.a.forEach(this.props.openingstijden.timetable, function (value, index) { 1355 var theme = days % 2 ? "" : "theme--dark"; 1356 var background = days % 2 ? "" : "primary-bg "; 1357 1358 if (value.is_closed) { 1359 rows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 1360 key: "li" + i, 1361 className: background + theme + " clearfix" 1362 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1363 className: "pull-xs-left" 1364 }, index), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1365 className: "pull-xs-right" 1366 }, "Gesloten"), value.info && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1367 className: "comment clear-both" 1368 }, value.info))); 1369 days++; 1370 } else if (value.open !== "" && value.close !== "") { 1371 rows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 1372 key: "li" + i, 1373 className: background + theme + " clearfix" 1374 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1375 className: "pull-xs-left" 1376 }, index), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1377 className: "pull-xs-right" 1378 }, value.open, " - ", value.close), value.info && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1379 className: "comment clear-both" 1380 }, value.info))); 1381 days++; 1382 } 1383 1384 i++; 1385 }); 1386 1387 if (days === 0) { 1388 rows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, "Geen openingstijden beschikbaar")); 1389 } 1390 } 1391 1392 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 1393 key: "ul", 1394 className: "list--unlist list--padded" 1395 }, rows); 1396 } 1397 }]); 1398 1399 return OpeningstijdenGlobalTimetable; 1400}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1401 1402var OpeningstijdenGlobalBlocks = /*#__PURE__*/function (_React$Component4) { 1403 _inherits(OpeningstijdenGlobalBlocks, _React$Component4); 1404 1405 var _super4 = _createSuper(OpeningstijdenGlobalBlocks); 1406 1407 function OpeningstijdenGlobalBlocks() { 1408 _classCallCheck(this, OpeningstijdenGlobalBlocks); 1409 1410 return _super4.apply(this, arguments); 1411 } 1412 1413 _createClass(OpeningstijdenGlobalBlocks, [{ 1414 key: "render", 1415 value: function render() { 1416 var blocks = []; 1417 1418 lodash__WEBPACK_IMPORTED_MODULE_2___default.a.forEach(this.props.openingstijden.blocks, function (value, index) { 1419 blocks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1420 key: index + "col", 1421 className: "col-sm-6 col-lg-3 util--md-down--margin-bottom px-4" 1422 }, value.title && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1423 className: "h4", 1424 key: index 1425 }, value.title), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1426 key: index + "p", 1427 dangerouslySetInnerHTML: { 1428 __html: value.content 1429 } 1430 }))); 1431 }); 1432 1433 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1434 key: "divv" 1435 }, blocks); 1436 } 1437 }]); 1438 1439 return OpeningstijdenGlobalBlocks; 1440}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1441 1442/***/ }), 1443
vendor: 4,537 bytes, lines 1444-1481
1444/***/ "./assets/js/src/components/openingstijden/openingstijdenZorgverlener.jsx": 1445/*!********************************************************************************!*\ 1446 !*** ./assets/js/src/components/openingstijden/openingstijdenZorgverlener.jsx ***! 1447 \********************************************************************************/ 1448/*! exports provided: default */ 1449/***/ (function(module, __webpack_exports__, __webpack_require__) { 1450 1451"use strict"; 1452__webpack_require__.r(__webpack_exports__); 1453/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return OpeningstijdenZorgverlenerWidget; }); 1454/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1455/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1456/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 1457/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); 1458/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 1459/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__); 1460/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/lib/ReactCSSTransitionGroup */ "./node_modules/react/lib/ReactCSSTransitionGroup.js"); 1461/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_3__); 1462function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1463 1464function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1465 1466function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1467 1468function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1469 1470function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1471 1472function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1473 1474function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1475 1476function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1477 1478function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1479 1480function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1481
1482function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1483 1484 1485 1486 1487 1488 1489var OpeningstijdenZorgverlenerWidget = /*#__PURE__*/function (_React$Component) { 1490 _inherits(OpeningstijdenZorgverlenerWidget, _React$Component); 1491 1492 var _super = _createSuper(OpeningstijdenZorgverlenerWidget); 1493 1494 function OpeningstijdenZorgverlenerWidget(props) { 1495 var _this; 1496 1497 _classCallCheck(this, OpeningstijdenZorgverlenerWidget); 1498 1499 _this = _super.call(this, props); 1500 _this.state = { 1501 selectedValue: "", 1502 locations: WP.zorgverlenerInfo.locations, 1503 location: WP.zorgverlenerInfo.locations[0] 1504 }; 1505 _this.onChange = _this.onChange.bind(_assertThisInitialized(_this)); 1506 return _this; 1507 } 1508 1509 _createClass(OpeningstijdenZorgverlenerWidget, [{ 1510 key: "onChange", 1511 value: function onChange(event) { 1512 this.setState({ 1513 selectedValue: event.target.value, 1514 location: this.state.locations[event.target.value] 1515 }); 1516 } 1517 }, { 1518 key: "render", 1519 value: function render() { 1520 /** 1521 * If the zorgverlener has multiple locations the user must select a zorgverlener to see the timetable 1522 * Otherwise it will renders the first item of the array which is set in the state location: WP.zorgverlenerInfo.locations[0] 1523 * @type {string} 1524 */ 1525 var openingstijdenZorgverlenerDropdown = WP.zorgverlenerInfo["multiple_locations"] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenZorgverlenerDropdown, { 1526 onChange: this.onChange, 1527 locations: this.state.locations 1528 }) : ""; 1529 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, openingstijdenZorgverlenerDropdown ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1530 className: "content vertical-rhythm" 1531 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1532 className: "row" 1533 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1534 className: "col-md-6" 1535 }, openingstijdenZorgverlenerDropdown)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenZorgverlenerContent, { 1536 prefix: this.prefix, 1537 selectedValue: this.state.selectedValue, 1538 location: this.state.location 1539 })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1540 className: "content vertical-rhythm" 1541 }, openingstijdenZorgverlenerDropdown, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenZorgverlenerContent, { 1542 prefix: this.prefix, 1543 location: this.state.location 1544 }))); 1545 } 1546 }]); 1547 1548 return OpeningstijdenZorgverlenerWidget; 1549}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1550 1551 1552 1553var OpeningstijdenZorgverlenerDropdown = /*#__PURE__*/function (_React$Component2) { 1554 _inherits(OpeningstijdenZorgverlenerDropdown, _React$Component2); 1555 1556 var _super2 = _createSuper(OpeningstijdenZorgverlenerDropdown); 1557 1558 function OpeningstijdenZorgverlenerDropdown() { 1559 _classCallCheck(this, OpeningstijdenZorgverlenerDropdown); 1560 1561 return _super2.apply(this, arguments); 1562 } 1563 1564 _createClass(OpeningstijdenZorgverlenerDropdown, [{ 1565 key: "render", 1566 value: function render() { 1567 var options = []; 1568 this.props.locations.map(function (location, i) { 1569 if (location === "") return false; 1570 return options.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 1571 value: i, 1572 key: i 1573 }, location.name)); 1574 }); 1575 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1576 id: "js-zorgverlener-openingstijden-dropdown" 1577 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", { 1578 "aria-hidden": true 1579 }, "Kies zorgverlener om de openingstijden te zien: "), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("select", { 1580 name: "zorgverlener-openingstijden", 1581 defaultValue: "", 1582 onChange: this.props.onChange, 1583 className: "c-select col-md-", 1584 placeholder: "Selecteer uw zorgverlener" 1585 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 1586 value: "", 1587 disabled: true 1588 }, "Klik hier om uw zorgverlener te kiezen"), options)); 1589 } 1590 }]); 1591 1592 return OpeningstijdenZorgverlenerDropdown; 1593}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1594 1595var OpeningstijdenZorgverlenerContent = /*#__PURE__*/function (_React$Component3) { 1596 _inherits(OpeningstijdenZorgverlenerContent, _React$Component3); 1597 1598 var _super3 = _createSuper(OpeningstijdenZorgverlenerContent); 1599 1600 function OpeningstijdenZorgverlenerContent() { 1601 _classCallCheck(this, OpeningstijdenZorgverlenerContent); 1602 1603 return _super3.apply(this, arguments); 1604 } 1605 1606 _createClass(OpeningstijdenZorgverlenerContent, [{ 1607 key: "getOpeningstijdenRows", 1608 value: function getOpeningstijdenRows(location) { 1609 var openingsTijden = []; 1610 var days = 0; 1611 1612 if (location.openingstijden.days) { 1613 lodash__WEBPACK_IMPORTED_MODULE_2___default.a.forEach(location.openingstijden.days, function (value, index) { 1614 var theme = index % 2 ? "" : "theme--dark"; 1615 var background = index % 2 ? "" : "primary-bg "; 1616 1617 if (value.is_closed) { 1618 openingsTijden.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 1619 key: index, 1620 className: background + theme + " clearfix" 1621 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1622 className: "pull-xs-left" 1623 }, value.label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1624 className: "pull-xs-right" 1625 }, "Gesloten"), value.info && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1626 className: "comment clear-both" 1627 }, value.info))); 1628 days++; 1629 } else if (value.open !== "" && value.close !== "") { 1630 openingsTijden.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { 1631 key: index, 1632 className: background + theme + " clearfix" 1633 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1634 className: "pull-xs-left" 1635 }, value.label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1636 className: "pull-xs-right" 1637 }, value.open, " - ", value.close), value.info && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1638 className: "comment clear-both" 1639 }, value.info))); 1640 days++; 1641 } 1642 }); 1643 1644 if (days === 0) { 1645 rows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", null, "Geen openingstijden beschikbaar")); 1646 } 1647 } 1648 1649 return openingsTijden; 1650 } 1651 }, { 1652 key: "getOpeningstijdenBlocks", 1653 value: function getOpeningstijdenBlocks(location) { 1654 var openingstijdenBlocks = []; 1655 1656 lodash__WEBPACK_IMPORTED_MODULE_2___default.a.forEach(location.openingstijden.blocks, function (value, index) { 1657 if (value.open_close_block_title === undefined && value.open_close_block_content === undefined) return; 1658 openingstijdenBlocks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1659 key: index, 1660 className: "col-sm-6 col-lg-3 util--md-down--margin-bottom" 1661 }, value.open_close_block_title && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenZorgverlenerContentBlockTitle, { 1662 prop: index, 1663 obj: value 1664 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(OpeningstijdenZorgverlenerContentBlockContent, { 1665 prop: index, 1666 obj: value 1667 }))); 1668 }); 1669 1670 return openingstijdenBlocks; 1671 } 1672 }, { 1673 key: "render", 1674 value: function render() { 1675 if (this.props.selectedValue === "") return null; 1676 var openingsTijdenRows = this.getOpeningstijdenRows(this.props.location); 1677 var openingsTijdenBlocks = this.getOpeningstijdenBlocks(this.props.location); 1678 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1679 className: "row util--vertical-margin--half" 1680 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1681 className: "col-sm-6 col-lg-3 util--md-down--margin-bottom" 1682 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", { 1683 className: "list--unlist list--padded" 1684 }, openingsTijdenRows)), openingsTijdenBlocks); 1685 } 1686 }]); 1687 1688 return OpeningstijdenZorgverlenerContent; 1689}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1690 1691var OpeningstijdenZorgverlenerContentBlockTitle = /*#__PURE__*/function (_React$Component4) { 1692 _inherits(OpeningstijdenZorgverlenerContentBlockTitle, _React$Component4); 1693 1694 var _super4 = _createSuper(OpeningstijdenZorgverlenerContentBlockTitle); 1695 1696 function OpeningstijdenZorgverlenerContentBlockTitle() { 1697 _classCallCheck(this, OpeningstijdenZorgverlenerContentBlockTitle); 1698 1699 return _super4.apply(this, arguments); 1700 } 1701 1702 _createClass(OpeningstijdenZorgverlenerContentBlockTitle, [{ 1703 key: "render", 1704 value: function render() { 1705 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1706 className: "h4", 1707 key: this.props.prop 1708 }, this.props.obj.open_close_block_title); 1709 } 1710 }]); 1711 1712 return OpeningstijdenZorgverlenerContentBlockTitle; 1713}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1714 1715var OpeningstijdenZorgverlenerContentBlockContent = /*#__PURE__*/function (_React$Component5) { 1716 _inherits(OpeningstijdenZorgverlenerContentBlockContent, _React$Component5); 1717 1718 var _super5 = _createSuper(OpeningstijdenZorgverlenerContentBlockContent); 1719 1720 function OpeningstijdenZorgverlenerContentBlockContent() { 1721 _classCallCheck(this, OpeningstijdenZorgverlenerContentBlockContent); 1722 1723 return _super5.apply(this, arguments); 1724 } 1725 1726 _createClass(OpeningstijdenZorgverlenerContentBlockContent, [{ 1727 key: "render", 1728 value: function render() { 1729 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1730 dangerouslySetInnerHTML: { 1731 __html: this.props.obj.open_close_block_content 1732 } 1733 }); 1734 } 1735 }]); 1736 1737 return OpeningstijdenZorgverlenerContentBlockContent; 1738}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1739 1740/***/ }), 1741
vendor: 4,958 bytes, lines 1742-1817
1742/***/ "./assets/js/src/components/toptaken/toptakenBtn.jsx": 1743/*!***********************************************************!*\ 1744 !*** ./assets/js/src/components/toptaken/toptakenBtn.jsx ***! 1745 \***********************************************************/ 1746/*! exports provided: default */ 1747/***/ (function(module, __webpack_exports__, __webpack_require__) { 1748 1749"use strict"; 1750__webpack_require__.r(__webpack_exports__); 1751/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtn; }); 1752/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1753/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1754function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1755 1756function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1757 1758function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1759 1760function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1761 1762function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1763 1764function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1765 1766function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1767 1768function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1769 1770function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1771 1772function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1773 1774function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1775 1776 1777 1778var TopTakenBtn = /*#__PURE__*/function (_React$Component) { 1779 _inherits(TopTakenBtn, _React$Component); 1780 1781 var _super = _createSuper(TopTakenBtn); 1782 1783 function TopTakenBtn() { 1784 _classCallCheck(this, TopTakenBtn); 1785 1786 return _super.apply(this, arguments); 1787 } 1788 1789 _createClass(TopTakenBtn, [{ 1790 key: "render", 1791 value: function render() { 1792 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { 1793 id: this.props.id, 1794 onClick: this.props.onClick, 1795 className: "btn btn--icon-fontawesome ".concat(this.props.classes) 1796 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 1797 className: "icon" 1798 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("i", { 1799 className: "fad ".concat(this.props.icon), 1800 "aria-hidden": "true" 1801 })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { 1802 className: "btn--text" 1803 }, this.props.text)); 1804 } 1805 }]); 1806 1807 return TopTakenBtn; 1808}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1809 1810 1811TopTakenBtn.propTypes = { 1812 id: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1813 icon: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 1814}; 1815 1816/***/ }), 1817
vendor: 10,121 bytes, lines 1818-1962
1818/***/ "./assets/js/src/components/toptaken/toptakenBtnAfspraak.jsx": 1819/*!*******************************************************************!*\ 1820 !*** ./assets/js/src/components/toptaken/toptakenBtnAfspraak.jsx ***! 1821 \*******************************************************************/ 1822/*! exports provided: default */ 1823/***/ (function(module, __webpack_exports__, __webpack_require__) { 1824 1825"use strict"; 1826__webpack_require__.r(__webpack_exports__); 1827/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnAfspraak; }); 1828/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1829/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1830/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 1831/* harmony import */ var _utils_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils.jsx */ "./assets/js/src/utils.jsx"); 1832function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1833 1834function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1835 1836function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1837 1838function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1839 1840function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1841 1842function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1843 1844function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1845 1846function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1847 1848function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1849 1850function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1851 1852function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1853 1854 1855 1856 1857 1858var TopTakenBtnAfspraak = /*#__PURE__*/function (_React$Component) { 1859 _inherits(TopTakenBtnAfspraak, _React$Component); 1860 1861 var _super = _createSuper(TopTakenBtnAfspraak); 1862 1863 function TopTakenBtnAfspraak() { 1864 _classCallCheck(this, TopTakenBtnAfspraak); 1865 1866 return _super.apply(this, arguments); 1867 } 1868 1869 _createClass(TopTakenBtnAfspraak, [{ 1870 key: "render", 1871 value: function render() { 1872 var text = _utils_jsx__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-afspraakmaken-title', 'Afspraak maken'); 1873 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 1874 icon: "fa-calendar-plus", 1875 id: this.props.prefix + "afspraakmaken", 1876 onClick: this.props.onClick, 1877 classes: this.props.btnClass, 1878 text: text 1879 }); 1880 } 1881 }]); 1882 1883 return TopTakenBtnAfspraak; 1884}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1885 1886 1887TopTakenBtnAfspraak.propTypes = { 1888 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1889 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 1890}; 1891 1892/***/ }), 1893 1894/***/ "./assets/js/src/components/toptaken/toptakenBtnHerhaal.jsx": 1895/*!******************************************************************!*\ 1896 !*** ./assets/js/src/components/toptaken/toptakenBtnHerhaal.jsx ***! 1897 \******************************************************************/ 1898/*! exports provided: default */ 1899/***/ (function(module, __webpack_exports__, __webpack_require__) { 1900 1901"use strict"; 1902__webpack_require__.r(__webpack_exports__); 1903/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnHerhaal; }); 1904/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1905/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1906/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 1907/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 1908function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1909 1910function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1911 1912function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1913 1914function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1915 1916function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1917 1918function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1919 1920function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 1921 1922function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 1923 1924function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1925 1926function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 1927 1928function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 1929 1930 1931 1932 1933 1934var TopTakenBtnHerhaal = /*#__PURE__*/function (_React$Component) { 1935 _inherits(TopTakenBtnHerhaal, _React$Component); 1936 1937 var _super = _createSuper(TopTakenBtnHerhaal); 1938 1939 function TopTakenBtnHerhaal() { 1940 _classCallCheck(this, TopTakenBtnHerhaal); 1941 1942 return _super.apply(this, arguments); 1943 } 1944 1945 _createClass(TopTakenBtnHerhaal, [{ 1946 key: "render", 1947 value: function render() { 1948 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-herhaalservice-title', 'Herhaal medicatie'); 1949 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 1950 icon: "fa-pills", 1951 id: this.props.prefix + "herhaalservice", 1952 onClick: this.props.onClick, 1953 classes: this.props.btnClass, 1954 text: text 1955 }); 1956 } 1957 }]); 1958 1959 return TopTakenBtnHerhaal; 1960}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 1961 1962
1963TopTakenBtnHerhaal.propTypes = { 1964 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1965 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1966 icon: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1967 text: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 1968 classes: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 1969}; 1970 1971/***/ }), 1972
vendor: 26,149 bytes, lines 1973-2355
1973/***/ "./assets/js/src/components/toptaken/toptakenBtnInschrijven.jsx": 1974/*!**********************************************************************!*\ 1975 !*** ./assets/js/src/components/toptaken/toptakenBtnInschrijven.jsx ***! 1976 \**********************************************************************/ 1977/*! exports provided: default */ 1978/***/ (function(module, __webpack_exports__, __webpack_require__) { 1979 1980"use strict"; 1981__webpack_require__.r(__webpack_exports__); 1982/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnInschrijven; }); 1983/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 1984/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1985/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 1986/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 1987function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 1988 1989function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1990 1991function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 1992 1993function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 1994 1995function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 1996 1997function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 1998 1999function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2000 2001function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2002 2003function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2004 2005function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2006 2007function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2008 2009 2010 2011 2012 2013var TopTakenBtnInschrijven = /*#__PURE__*/function (_React$Component) { 2014 _inherits(TopTakenBtnInschrijven, _React$Component); 2015 2016 var _super = _createSuper(TopTakenBtnInschrijven); 2017 2018 function TopTakenBtnInschrijven() { 2019 _classCallCheck(this, TopTakenBtnInschrijven); 2020 2021 return _super.apply(this, arguments); 2022 } 2023 2024 _createClass(TopTakenBtnInschrijven, [{ 2025 key: "render", 2026 value: function render() { 2027 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-inschrijven-title', 'Inschrijven'); 2028 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 2029 icon: "fa-pen-square", 2030 id: this.props.prefix + "inschrijven", 2031 onClick: this.props.onClick, 2032 classes: this.props.btnClass, 2033 text: text 2034 }); 2035 } 2036 }]); 2037 2038 return TopTakenBtnInschrijven; 2039}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2040 2041 2042TopTakenBtnInschrijven.propTypes = { 2043 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2044 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2045 url: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2046}; 2047 2048/***/ }), 2049 2050/***/ "./assets/js/src/components/toptaken/toptakenBtnKlachtTip.jsx": 2051/*!********************************************************************!*\ 2052 !*** ./assets/js/src/components/toptaken/toptakenBtnKlachtTip.jsx ***! 2053 \********************************************************************/ 2054/*! exports provided: default */ 2055/***/ (function(module, __webpack_exports__, __webpack_require__) { 2056 2057"use strict"; 2058__webpack_require__.r(__webpack_exports__); 2059/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnKlachtTip; }); 2060/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2061/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2062/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 2063/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 2064function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2065 2066function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2067 2068function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2069 2070function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2071 2072function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2073 2074function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2075 2076function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2077 2078function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2079 2080function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2081 2082function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2083 2084function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2085 2086 2087 2088 2089 2090var TopTakenBtnKlachtTip = /*#__PURE__*/function (_React$Component) { 2091 _inherits(TopTakenBtnKlachtTip, _React$Component); 2092 2093 var _super = _createSuper(TopTakenBtnKlachtTip); 2094 2095 function TopTakenBtnKlachtTip() { 2096 _classCallCheck(this, TopTakenBtnKlachtTip); 2097 2098 return _super.apply(this, arguments); 2099 } 2100 2101 _createClass(TopTakenBtnKlachtTip, [{ 2102 key: "render", 2103 value: function render() { 2104 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-tipklacht-title', 'Tip of klacht melden'); 2105 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 2106 icon: "fa-comment-alt-exclamation", 2107 id: this.props.prefix + "klachten", 2108 onClick: this.props.onClick, 2109 classes: this.props.btnClass, 2110 text: text 2111 }); 2112 } 2113 }]); 2114 2115 return TopTakenBtnKlachtTip; 2116}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2117 2118 2119TopTakenBtnKlachtTip.propTypes = { 2120 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2121 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2122 url: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2123}; 2124 2125/***/ }), 2126 2127/***/ "./assets/js/src/components/toptaken/toptakenBtnOnderzoeksUitslag.jsx": 2128/*!****************************************************************************!*\ 2129 !*** ./assets/js/src/components/toptaken/toptakenBtnOnderzoeksUitslag.jsx ***! 2130 \****************************************************************************/ 2131/*! exports provided: default */ 2132/***/ (function(module, __webpack_exports__, __webpack_require__) { 2133 2134"use strict"; 2135__webpack_require__.r(__webpack_exports__); 2136/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnOnderzoeksUitslag; }); 2137/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2138/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2139/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 2140/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 2141function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2142 2143function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2144 2145function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2146 2147function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2148 2149function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2150 2151function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2152 2153function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2154 2155function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2156 2157function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2158 2159function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2160 2161function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2162 2163 2164 2165 2166 2167var TopTakenBtnOnderzoeksUitslag = /*#__PURE__*/function (_React$Component) { 2168 _inherits(TopTakenBtnOnderzoeksUitslag, _React$Component); 2169 2170 var _super = _createSuper(TopTakenBtnOnderzoeksUitslag); 2171 2172 function TopTakenBtnOnderzoeksUitslag() { 2173 _classCallCheck(this, TopTakenBtnOnderzoeksUitslag); 2174 2175 return _super.apply(this, arguments); 2176 } 2177 2178 _createClass(TopTakenBtnOnderzoeksUitslag, [{ 2179 key: "render", 2180 value: function render() { 2181 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-onderzoek-title', 'Onderzoeksuitslag'); 2182 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 2183 icon: "fa-eye-dropper", 2184 id: this.props.prefix + "onderzoeksuitslag", 2185 onClick: this.props.onClick, 2186 classes: this.props.btnClass, 2187 text: text 2188 }); 2189 } 2190 }]); 2191 2192 return TopTakenBtnOnderzoeksUitslag; 2193}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2194 2195 2196TopTakenBtnOnderzoeksUitslag.propTypes = { 2197 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2198 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2199}; 2200 2201/***/ }), 2202 2203/***/ "./assets/js/src/components/toptaken/toptakenBtnStelVraag.jsx": 2204/*!********************************************************************!*\ 2205 !*** ./assets/js/src/components/toptaken/toptakenBtnStelVraag.jsx ***! 2206 \********************************************************************/ 2207/*! exports provided: default */ 2208/***/ (function(module, __webpack_exports__, __webpack_require__) { 2209 2210"use strict"; 2211__webpack_require__.r(__webpack_exports__); 2212/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnStelVraag; }); 2213/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2214/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2215/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 2216/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 2217function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2218 2219function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2220 2221function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2222 2223function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2224 2225function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2226 2227function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2228 2229function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2230 2231function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2232 2233function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2234 2235function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2236 2237function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2238 2239 2240 2241 2242 2243var TopTakenBtnStelVraag = /*#__PURE__*/function (_React$Component) { 2244 _inherits(TopTakenBtnStelVraag, _React$Component); 2245 2246 var _super = _createSuper(TopTakenBtnStelVraag); 2247 2248 function TopTakenBtnStelVraag() { 2249 _classCallCheck(this, TopTakenBtnStelVraag); 2250 2251 return _super.apply(this, arguments); 2252 } 2253 2254 _createClass(TopTakenBtnStelVraag, [{ 2255 key: "render", 2256 value: function render() { 2257 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-stelvraag-title', 'Stel een vraag'); 2258 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 2259 icon: "fa-comment-lines", 2260 id: this.props.prefix + "stelvraag", 2261 onClick: this.props.onClick, 2262 classes: this.props.btnClass, 2263 text: text 2264 }); 2265 } 2266 }]); 2267 2268 return TopTakenBtnStelVraag; 2269}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2270 2271 2272TopTakenBtnStelVraag.propTypes = { 2273 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2274 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2275}; 2276 2277/***/ }), 2278 2279/***/ "./assets/js/src/components/toptaken/toptakenBtnWebsite.jsx": 2280/*!******************************************************************!*\ 2281 !*** ./assets/js/src/components/toptaken/toptakenBtnWebsite.jsx ***! 2282 \******************************************************************/ 2283/*! exports provided: default */ 2284/***/ (function(module, __webpack_exports__, __webpack_require__) { 2285 2286"use strict"; 2287__webpack_require__.r(__webpack_exports__); 2288/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnWebsite; }); 2289/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2290/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2291/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 2292/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./assets/js/src/utils.jsx"); 2293function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2294 2295function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2296 2297function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2298 2299function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2300 2301function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2302 2303function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2304 2305function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2306 2307function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2308 2309function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2310 2311function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2312 2313function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2314 2315 2316 2317 2318 2319var TopTakenBtnWebsite = /*#__PURE__*/function (_React$Component) { 2320 _inherits(TopTakenBtnWebsite, _React$Component); 2321 2322 var _super = _createSuper(TopTakenBtnWebsite); 2323 2324 function TopTakenBtnWebsite() { 2325 _classCallCheck(this, TopTakenBtnWebsite); 2326 2327 return _super.apply(this, arguments); 2328 } 2329 2330 _createClass(TopTakenBtnWebsite, [{ 2331 key: "render", 2332 value: function render() { 2333 var text = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getSiteSettings('modules-website-title', 'Naar website'); 2334 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtn__WEBPACK_IMPORTED_MODULE_1__["default"], { 2335 icon: "fa-browser", 2336 id: this.props.prefix + "website", 2337 onClick: this.props.onClick, 2338 classes: this.props.btnClass, 2339 text: text 2340 }); 2341 } 2342 }]); 2343 2344 return TopTakenBtnWebsite; 2345}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2346 2347 2348TopTakenBtnWebsite.propTypes = { 2349 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2350 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2351 url: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2352}; 2353 2354/***/ }), 2355
vendor: 4,653 bytes, lines 2356-2389
2356/***/ "./assets/js/src/components/toptaken/toptakenGlobal.jsx": 2357/*!**************************************************************!*\ 2358 !*** ./assets/js/src/components/toptaken/toptakenGlobal.jsx ***! 2359 \**************************************************************/ 2360/*! exports provided: default */ 2361/***/ (function(module, __webpack_exports__, __webpack_require__) { 2362 2363"use strict"; 2364__webpack_require__.r(__webpack_exports__); 2365/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenBtnGlobal; }); 2366/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2367/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2368/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 2369/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 2370/* harmony import */ var _toptakenBtnHerhaal_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./toptakenBtnHerhaal.jsx */ "./assets/js/src/components/toptaken/toptakenBtnHerhaal.jsx"); 2371/* harmony import */ var _toptakenBtnWebsite_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toptakenBtnWebsite.jsx */ "./assets/js/src/components/toptaken/toptakenBtnWebsite.jsx"); 2372/* harmony import */ var _toptakenBtnAfspraak_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toptakenBtnAfspraak.jsx */ "./assets/js/src/components/toptaken/toptakenBtnAfspraak.jsx"); 2373/* harmony import */ var _toptakenBtnStelVraag_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./toptakenBtnStelVraag.jsx */ "./assets/js/src/components/toptaken/toptakenBtnStelVraag.jsx"); 2374/* harmony import */ var _toptakenBtnKlachtTip_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./toptakenBtnKlachtTip.jsx */ "./assets/js/src/components/toptaken/toptakenBtnKlachtTip.jsx"); 2375/* harmony import */ var _toptakenBtnInschrijven_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./toptakenBtnInschrijven.jsx */ "./assets/js/src/components/toptaken/toptakenBtnInschrijven.jsx"); 2376/* harmony import */ var _toptakenBtnOnderzoeksUitslag_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./toptakenBtnOnderzoeksUitslag.jsx */ "./assets/js/src/components/toptaken/toptakenBtnOnderzoeksUitslag.jsx"); 2377/* harmony import */ var _toptakenHomeZorgverlenerList_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./toptakenHomeZorgverlenerList.jsx */ "./assets/js/src/components/toptaken/toptakenHomeZorgverlenerList.jsx"); 2378/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/lib/ReactCSSTransitionGroup */ "./node_modules/react/lib/ReactCSSTransitionGroup.js"); 2379/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10__); 2380/* harmony import */ var _toptakenBtn__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./toptakenBtn */ "./assets/js/src/components/toptaken/toptakenBtn.jsx"); 2381function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2382 2383function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2384 2385function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2386 2387function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2388 2389function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
2389onstructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2390 2391function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2392 2393function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2394 2395function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2396 2397function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2398 2399function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2400 2401function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416var TopTakenBtnGlobal = /*#__PURE__*/function (_React$Component) { 2417 _inherits(TopTakenBtnGlobal, _React$Component); 2418 2419 var _super = _createSuper(TopTakenBtnGlobal); 2420 2421 function TopTakenBtnGlobal(props) { 2422 var _this; 2423 2424 _classCallCheck(this, TopTakenBtnGlobal); 2425 2426 _this = _super.call(this, props); 2427 _this.state = { 2428 activeModule: "", 2429 zorgverlenerList: WP.zorgverlenersActiveModules, 2430 zorgverlenerListFiltered: [], 2431 showZorgverlenerList: false 2432 }; 2433 _this.onClick = _this.onClick.bind(_assertThisInitialized(_this)); 2434 return _this; 2435 } 2436 2437 _createClass(TopTakenBtnGlobal, [{ 2438 key: "onClick", 2439 value: function onClick(event) { 2440 jQuery("#js-react-widget-toptasks-global a").removeClass("active"); 2441 jQuery("#" + event.currentTarget.id).addClass("active"); 2442 jQuery("#js-react-widget-toptasks-global").addClass("js--toptasks--open"); 2443 this.filterZorgverlenerList(event.currentTarget.id.replace(this.props.prefix, "")); 2444 } 2445 }, { 2446 key: "filterZorgverlenerList", 2447 value: function filterZorgverlenerList(module) { 2448 this.setState({ 2449 zorgverlenerListFiltered: this.state.zorgverlenerList[module], 2450 showZorgverlenerList: true 2451 }); 2452 } 2453 }, { 2454 key: "render", 2455 value: function render() { 2456 var settings = WP.SITE_SETTINGS || {}, 2457 modules = []; // fall back to default modules when settings are not defined 2458 2459 if (!settings.hasOwnProperty("modules_select_list") || !settings.modules_select_list.length) { 2460 settings.modules_select_list = ["herhaalservice", "afspraakmaken", "stelvraag"]; 2461 } 2462 2463 for (var i = 0; i < settings.modules_select_list.length; i++) { 2464 switch (settings.modules_select_list[i]) { 2465 case "herhaalservice": 2466 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["herhaalservice"])) { 2467 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnHerhaal_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], { 2468 key: "herhaal", 2469 location: this.props.location, 2470 prefix: this.props.prefix, 2471 onClick: this.onClick 2472 })); // modules.push(<BtnHerhaal key="herhaal" location={ this.props.location } prefix={ this.props.prefix } onClick={ this.onClick } />); 2473 } 2474 2475 break; 2476 2477 case "afspraakmaken": 2478 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["afspraakmaken"])) { 2479 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnAfspraak_jsx__WEBPACK_IMPORTED_MODULE_4__["default"], { 2480 key: "afspraak", 2481 location: this.props.location, 2482 prefix: this.props.prefix, 2483 onClick: this.onClick 2484 })); 2485 } 2486 2487 break; 2488 2489 case "stelvraag": 2490 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["stelvraag"])) { 2491 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnStelVraag_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], { 2492 key: "stelvraag", 2493 location: this.props.location, 2494 prefix: this.props.prefix, 2495 onClick: this.onClick 2496 })); 2497 } 2498 2499 break; 2500 2501 case "inschrijven": 2502 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["inschrijven"])) { 2503 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnInschrijven_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], { 2504 key: "inschrijven", 2505 location: this.props.location, 2506 prefix: this.props.prefix, 2507 onClick: this.onClick 2508 })); 2509 } 2510 2511 break; 2512 2513 case "tipklacht": 2514 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["klachten"])) { 2515 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnKlachtTip_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], { 2516 key: "klachten", 2517 location: this.props.location, 2518 prefix: this.props.prefix, 2519 onClick: this.onClick 2520 })); 2521 } 2522 2523 break; 2524 2525 case "website": 2526 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["website"])) { 2527 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnWebsite_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], { 2528 key: "website", 2529 location: this.props.location, 2530 prefix: this.props.prefix, 2531 onClick: this.onClick 2532 })); 2533 } 2534 2535 break; 2536 2537 case "onderzoek": 2538 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList["onderzoeksuitslag"])) { 2539 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnOnderzoeksUitslag_jsx__WEBPACK_IMPORTED_MODULE_8__["default"], { 2540 key: "uitslag", 2541 location: this.props.location, 2542 prefix: this.props.prefix, 2543 onClick: this.onClick 2544 })); 2545 } 2546 2547 break; 2548 } 2549 } 2550 2551 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2552 className: "row" 2553 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2554 className: "col-xs-12 util--xl-down--margin-bottom" 2555 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2556 className: "flex-grid" 2557 }, modules)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10___default.a, {
2558 transitionName: "example", 2559 transitionEnterTimeout: 300, 2560 transitionLeaveTimeout: 300 2561 }, this.state.showZorgverlenerList && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenHomeZorgverlenerList_jsx__WEBPACK_IMPORTED_MODULE_9__["default"], { 2562 prefix: this.props.prefix, 2563 zorgverlenerList: this.state.zorgverlenerListFiltered 2564 }))); 2565 } 2566 }]); 2567 2568 return TopTakenBtnGlobal; 2569}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2570 2571 2572TopTakenBtnGlobal.propTypes = { 2573 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string, 2574 btnClass: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2575}; 2576TopTakenBtnGlobal.defaultProps = { 2577 prefix: "ttbg-", 2578 btnClass: "tertiary-bg" 2579}; 2580 2581/***/ }), 2582
vendor: 4,622 bytes, lines 2583-2616
2583/***/ "./assets/js/src/components/toptaken/toptakenHome.jsx": 2584/*!************************************************************!*\ 2585 !*** ./assets/js/src/components/toptaken/toptakenHome.jsx ***! 2586 \************************************************************/ 2587/*! exports provided: default */ 2588/***/ (function(module, __webpack_exports__, __webpack_require__) { 2589 2590"use strict"; 2591__webpack_require__.r(__webpack_exports__); 2592/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenHomeWidget; }); 2593/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2594/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2595/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 2596/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 2597/* harmony import */ var _toptakenBtnHerhaal_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./toptakenBtnHerhaal.jsx */ "./assets/js/src/components/toptaken/toptakenBtnHerhaal.jsx"); 2598/* harmony import */ var _toptakenBtnWebsite_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toptakenBtnWebsite.jsx */ "./assets/js/src/components/toptaken/toptakenBtnWebsite.jsx"); 2599/* harmony import */ var _toptakenBtnAfspraak_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toptakenBtnAfspraak.jsx */ "./assets/js/src/components/toptaken/toptakenBtnAfspraak.jsx"); 2600/* harmony import */ var _toptakenBtnStelVraag_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./toptakenBtnStelVraag.jsx */ "./assets/js/src/components/toptaken/toptakenBtnStelVraag.jsx"); 2601/* harmony import */ var _toptakenBtnKlachtTip_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./toptakenBtnKlachtTip.jsx */ "./assets/js/src/components/toptaken/toptakenBtnKlachtTip.jsx"); 2602/* harmony import */ var _toptakenBtnInschrijven_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./toptakenBtnInschrijven.jsx */ "./assets/js/src/components/toptaken/toptakenBtnInschrijven.jsx"); 2603/* harmony import */ var _toptakenBtnOnderzoeksUitslag_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./toptakenBtnOnderzoeksUitslag.jsx */ "./assets/js/src/components/toptaken/toptakenBtnOnderzoeksUitslag.jsx"); 2604/* harmony import */ var _toptakenHomeZorgverlenerList_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./toptakenHomeZorgverlenerList.jsx */ "./assets/js/src/components/toptaken/toptakenHomeZorgverlenerList.jsx"); 2605/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/lib/ReactCSSTransitionGroup */ "./node_modules/react/lib/ReactCSSTransitionGroup.js"); 2606/* harmony import */ var react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10__); 2607/* harmony import */ var _utils_jsx__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../../utils.jsx */ "./assets/js/src/utils.jsx"); 2608function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2609 2610function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2611 2612function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2613 2614function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2615 2616function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
2616onstructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2617 2618function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2619 2620function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2621 2622function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2623 2624function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2625 2626function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2627 2628function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643var TopTakenHomeWidget = /*#__PURE__*/function (_React$Component) { 2644 _inherits(TopTakenHomeWidget, _React$Component); 2645 2646 var _super = _createSuper(TopTakenHomeWidget); 2647 2648 function TopTakenHomeWidget(props) { 2649 var _this; 2650 2651 _classCallCheck(this, TopTakenHomeWidget); 2652 2653 _this = _super.call(this, props); 2654 _this.state = { 2655 activeModule: '', 2656 zorgverlenerList: WP.zorgverlenersActiveModules, 2657 zorgverlenerListFiltered: [], 2658 showZorgverlenerList: false, 2659 btnClass: _this.props.btnClass 2660 }; 2661 _this.onClick = _this.onClick.bind(_assertThisInitialized(_this)); 2662 2663 if (_this.props.location == "footer") { 2664 _this.state.btnClass = _this.state.btnClass + " btn--huge--footer"; 2665 } else { 2666 _this.state.btnClass = _this.state.btnClass + " btn--huge--intro"; 2667 } 2668 2669 return _this; 2670 } 2671 2672 _createClass(TopTakenHomeWidget, [{ 2673 key: "onClick", 2674 value: function onClick(event) { 2675 jQuery('#js-react-widget-toptasks-home a').removeClass('active'); 2676 jQuery('#' + event.currentTarget.id).addClass('active'); 2677 jQuery('#js-react-widget-toptasks-home').addClass('js--toptasks--open'); 2678 this.filterZorgverlenerList(event.currentTarget.id.replace(this.props.prefix, '')); 2679 } 2680 }, { 2681 key: "filterZorgverlenerList", 2682 value: function filterZorgverlenerList(module) { 2683 this.setState({ 2684 zorgverlenerListFiltered: this.state.zorgverlenerList[module], 2685 showZorgverlenerList: true 2686 }); 2687 } 2688 }, { 2689 key: "render", 2690 value: function render() { 2691 if (_utils_jsx__WEBPACK_IMPORTED_MODULE_11__["default"].zorgverlenersModulesActive(['onderzoeksuitslag', 'klachten', 'inschrijven', 'website', 'tipklacht', 'stelvraag', 'herhaalservice']) === false) return null; 2692 var settings = WP.SITE_SETTINGS || {}, 2693 modules = []; // fall back to default modules when settings are not defined 2694 2695 if (!settings.hasOwnProperty('modules_select_list') || !settings.modules_select_list.length) { 2696 settings.modules_select_list = ['herhaalservice', 'afspraakmaken', 'stelvraag']; 2697 } 2698 2699 for (var i = 0; i < settings.modules_select_list.length; i++) { 2700 switch (settings.modules_select_list[i]) { 2701 case 'herhaalservice': 2702 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['herhaalservice'])) { 2703 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnHerhaal_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], { 2704 prefix: this.props.prefix, 2705 onClick: this.onClick 2706 })); 2707 } 2708 2709 break; 2710 2711 case 'afspraakmaken': 2712 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['afspraakmaken'])) { 2713 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnAfspraak_jsx__WEBPACK_IMPORTED_MODULE_4__["default"], { 2714 prefix: this.props.prefix, 2715 onClick: this.onClick 2716 })); 2717 } 2718 2719 break; 2720 2721 case 'stelvraag': 2722 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['stelvraag'])) { 2723 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnStelVraag_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], { 2724 prefix: this.props.prefix, 2725 onClick: this.onClick 2726 })); 2727 } 2728 2729 break; 2730 2731 case 'inschrijven': 2732 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['inschrijven'])) { 2733 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnInschrijven_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], { 2734 prefix: this.props.prefix, 2735 onClick: this.onClick 2736 })); 2737 } 2738 2739 break; 2740 2741 case 'tipklacht': 2742 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['klachten'])) { 2743 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnKlachtTip_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], { 2744 prefix: this.props.prefix, 2745 onClick: this.onClick 2746 })); 2747 } 2748 2749 break; 2750 2751 case 'website': 2752 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['website'])) { 2753 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnWebsite_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], { 2754 prefix: this.props.prefix, 2755 onClick: this.onClick 2756 })); 2757 } 2758 2759 break; 2760 2761 case 'onderzoek': 2762 if (!lodash__WEBPACK_IMPORTED_MODULE_1___default.a.isEmpty(this.state.zorgverlenerList['onderzoeksuitslag'])) { 2763 modules.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenBtnOnderzoeksUitslag_jsx__WEBPACK_IMPORTED_MODULE_8__["default"], { 2764 prefix: this.props.prefix, 2765 onClick: this.onClick 2766 })); 2767 } 2768 2769 break; 2770 } 2771 } 2772 2773 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2774 className: "content padded-block padded-block--glass" 2775 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
2776 className: "col-xs-12 col-md-padding util--xl-down--margin-bottom" 2777 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2778 className: "flex-grid" 2779 }, modules)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_lib_ReactCSSTransitionGroup__WEBPACK_IMPORTED_MODULE_10___default.a, { 2780 transitionName: "example", 2781 transitionEnterTimeout: 300, 2782 transitionLeaveTimeout: 300 2783 }, this.state.showZorgverlenerList && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_toptakenHomeZorgverlenerList_jsx__WEBPACK_IMPORTED_MODULE_9__["default"], { 2784 prefix: this.props.prefix, 2785 zorgverlenerList: this.state.zorgverlenerListFiltered 2786 }))); 2787 } 2788 }]); 2789 2790 return TopTakenHomeWidget; 2791}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2792 2793 2794TopTakenHomeWidget.propTypes = { 2795 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2796}; 2797TopTakenHomeWidget.defaultProps = { 2798 prefix: 'tthw-' 2799}; 2800 2801/***/ }), 2802
vendor: 4,889 bytes, lines 2803-2865
2803/***/ "./assets/js/src/components/toptaken/toptakenHomeZorgverlenerList.jsx": 2804/*!****************************************************************************!*\ 2805 !*** ./assets/js/src/components/toptaken/toptakenHomeZorgverlenerList.jsx ***! 2806 \****************************************************************************/ 2807/*! exports provided: default */ 2808/***/ (function(module, __webpack_exports__, __webpack_require__) { 2809 2810"use strict"; 2811__webpack_require__.r(__webpack_exports__); 2812/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TopTakenHomeZorgverlenerList; }); 2813/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2814/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2815/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 2816/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 2817function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 2818 2819function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2820 2821function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2822 2823function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2824 2825function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 2826 2827function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 2828 2829function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 2830 2831function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 2832 2833function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 2834 2835function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 2836 2837function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 2838 2839 2840 2841 2842var TopTakenHomeZorgverlenerList = /*#__PURE__*/function (_React$Component) { 2843 _inherits(TopTakenHomeZorgverlenerList, _React$Component); 2844 2845 var _super = _createSuper(TopTakenHomeZorgverlenerList); 2846 2847 function TopTakenHomeZorgverlenerList() { 2848 _classCallCheck(this, TopTakenHomeZorgverlenerList); 2849 2850 return _super.apply(this, arguments); 2851 } 2852 2853 _createClass(TopTakenHomeZorgverlenerList, [{ 2854 key: "onChange", 2855 value: function onChange(event) { 2856 document.location.href = event.target.value; 2857 } 2858 }, { 2859 key: "render", 2860 value: function render() { 2861 var items = []; 2862 2863 lodash__WEBPACK_IMPORTED_MODULE_1___default.a.forEach(this.props.zorgverlenerList, function (value, key) { 2864 items.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(TopTakenHomeZorgverlenerListOptGroup, { 2865 key: key,
2866 label: key, 2867 obj: value 2868 })); 2869 }); 2870 2871 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2872 key: this.props.prefix + "js-react-zorgverleners-select", 2873 id: this.props.prefix + "js-react-zorgverleners-select", 2874 className: "col-xs-12 util--xl-down--margin-bottom col-md-padding" 2875 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { 2876 key: "flex-grid", 2877 className: "flex-grid" 2878 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("select", { 2879 key: "select", 2880 value: "Klik hier om uw zorgverlener te kiezen", 2881 className: "c-select flex-grid--child flex-grid--xl-down--full c-select--no-border", 2882 onChange: this.onChange 2883 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 2884 key: "default", 2885 value: "Klik hier om uw zorgverlener te kiezen", 2886 disabled: true 2887 }, "Klik hier om uw zorgverlener te kiezen"), items))); 2888 } 2889 }]); 2890 2891 return TopTakenHomeZorgverlenerList; 2892}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2893 2894 2895TopTakenHomeZorgverlenerList.propTypes = { 2896 prefix: react__WEBPACK_IMPORTED_MODULE_0___default.a.PropTypes.string 2897}; 2898 2899var TopTakenHomeZorgverlenerListOptGroup = /*#__PURE__*/function (_React$Component2) { 2900 _inherits(TopTakenHomeZorgverlenerListOptGroup, _React$Component2); 2901 2902 var _super2 = _createSuper(TopTakenHomeZorgverlenerListOptGroup); 2903 2904 function TopTakenHomeZorgverlenerListOptGroup() { 2905 _classCallCheck(this, TopTakenHomeZorgverlenerListOptGroup); 2906 2907 return _super2.apply(this, arguments); 2908 } 2909 2910 _createClass(TopTakenHomeZorgverlenerListOptGroup, [{ 2911 key: "render", 2912 value: function render() { 2913 var options = []; 2914 2915 lodash__WEBPACK_IMPORTED_MODULE_1___default.a.forEach(this.props.obj, function (value, key) { 2916 options.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(TopTakenHomeZorgverlenerListOption, { 2917 key: key, 2918 value: value 2919 })); 2920 }); 2921 2922 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("optgroup", { 2923 label: this.props.label 2924 }, options); 2925 } 2926 }]); 2927 2928 return TopTakenHomeZorgverlenerListOptGroup; 2929}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2930 2931var TopTakenHomeZorgverlenerListOption = /*#__PURE__*/function (_React$Component3) { 2932 _inherits(TopTakenHomeZorgverlenerListOption, _React$Component3); 2933 2934 var _super3 = _createSuper(TopTakenHomeZorgverlenerListOption); 2935 2936 function TopTakenHomeZorgverlenerListOption() { 2937 _classCallCheck(this, TopTakenHomeZorgverlenerListOption); 2938 2939 return _super3.apply(this, arguments); 2940 } 2941 2942 _createClass(TopTakenHomeZorgverlenerListOption, [{ 2943 key: "render", 2944 value: function render() { 2945 var url = this.props.value.url; // Some button trigger instant redirects 2946 2947 if (jQuery('#tthw-website').hasClass('active') || // header 2948 jQuery('#ttbg-website').hasClass('active') // footer 2949 ) { 2950 url = this.props.value.website || this.props.value.url; 2951 } else if (jQuery('#tthw-klachten').hasClass('active') || // header 2952 jQuery('#ttbg-klachten').hasClass('active') // footer 2953 ) { 2954 url = this.props.value.klachten || this.props.value.url; 2955 } else if (jQuery('#tthw-onderzoeksuitslag').hasClass('active') || // header 2956 jQuery('#ttbg-onderzoeksuitslag').hasClass('active') // footer 2957 ) { 2958 url = this.props.value.onderzoek || this.props.value.url; 2959 } 2960 2961 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("option", { 2962 value: url 2963 }, " ", this.props.value.title, " "); 2964 } 2965 }]); 2966 2967 return TopTakenHomeZorgverlenerListOption; 2968}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); 2969 2970/***/ }), 2971
2972/***/ "./assets/js/src/index.jsx": 2973/*!*********************************!*\ 2974 !*** ./assets/js/src/index.jsx ***! 2975 \*********************************/ 2976/*! no exports provided */ 2977/***/ (function(module, __webpack_exports__, __webpack_require__) { 2978 2979"use strict"; 2980__webpack_require__.r(__webpack_exports__); 2981/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/react.js"); 2982/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2983/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 2984/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); 2985/* harmony import */ var _components_openingstijden_openingstijdenZorgverlener_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/openingstijden/openingstijdenZorgverlener.jsx */ "./assets/js/src/components/openingstijden/openingstijdenZorgverlener.jsx"); 2986/* harmony import */ var _components_openingstijden_openingstijdenGlobal_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/openingstijden/openingstijdenGlobal.jsx */ "./assets/js/src/components/openingstijden/openingstijdenGlobal.jsx"); 2987/* harmony import */ var _components_toptaken_toptakenHome_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/toptaken/toptakenHome.jsx */ "./assets/js/src/components/toptaken/toptakenHome.jsx"); 2988/* harmony import */ var _components_toptaken_toptakenGlobal_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/toptaken/toptakenGlobal.jsx */ "./assets/js/src/components/toptaken/toptakenGlobal.jsx"); 2989/* harmony import */ var _components_adres_adresZorgverlener_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/adres/adresZorgverlener.jsx */ "./assets/js/src/components/adres/adresZorgverlener.jsx"); 2990/* harmony import */ var _components_contactRoute_contactRouteGlobal_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/contactRoute/contactRouteGlobal.jsx */ "./assets/js/src/components/contactRoute/contactRouteGlobal.jsx"); 2991/* harmony import */ var _components_medicalInformation_MedicalInformationHerhaalReceptDropdown_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/medicalInformation/MedicalInformationHerhaalReceptDropdown.jsx */ "./assets/js/src/components/medicalInformation/MedicalInformationHerhaalReceptDropdown.jsx"); 2992/* harmony import */ var _scss_loader_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../scss/loader.scss */ "./assets/scss/loader.scss"); 2993/* harmony import */ var _scss_loader_scss__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_scss_loader_scss__WEBPACK_IMPORTED_MODULE_9__); 2994function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2995 2996function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 2997 2998function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011var Bootstrap = /*#__PURE__*/function () { 3012 function Bootstrap() { 3013 _classCallCheck(this, Bootstrap); 3014 3015 this.renderOpeningstijdenZorgverlener(); 3016 this.renderOpeningstijdenGlobal(); 3017 this.renderTopTakenHome(); 3018 this.renderTopTakenGlobal(); 3019 this.renderAdresZorgverlener(); 3020 this.renderContactRouteGlobal(); 3021 this.renderMedicalInformation(); 3022 } 3023 3024 _createClass(Bootstrap, [{ 3025 key: "renderOpeningstijdenZorgverlener", 3026 value: function renderOpeningstijdenZorgverlener() { 3027 if (jQuery('#js-react-widget-openingstijden-zorgverlener').length !== 0) { 3028 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_openingstijden_openingstijdenZorgverlener_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], null), document.getElementById('js-react-widget-openingstijden-zorgverlener')); 3029 } 3030 } 3031 }, { 3032 key: "renderOpeningstijdenGlobal", 3033 value: function renderOpeningstijdenGlobal() { 3034 if (jQuery('#js-react-widget-openingstijden-global').length !== 0) { 3035 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_openingstijden_openingstijdenGlobal_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], null), document.getElementById('js-react-widget-openingstijden-global')); 3036 } 3037 } 3038 }, { 3039 key: "renderTopTakenHome", 3040 value: function renderTopTakenHome() { 3041 if (jQuery('#js-react-widget-toptasks-home').length !== 0) { 3042 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_toptaken_toptakenHome_jsx__WEBPACK_IMPORTED_MODULE_4__["default"], null), document.getElementById('js-react-widget-toptasks-home')); 3043 } 3044 } 3045 }, { 3046 key: "renderTopTakenGlobal", 3047 value: function renderTopTakenGlobal() { 3048 if (jQuery('#js-react-widget-toptasks-global').length !== 0) { 3049 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_toptaken_toptakenGlobal_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], { 3050 location: "footer" 3051 }), document.getElementById('js-react-widget-toptasks-global')); 3052 } 3053 } 3054 }, { 3055 key: "renderAdresZorgverlener", 3056 value: function renderAdresZorgverlener() { 3057 if (jQuery('#js-react-widget-adres-zorgverlener').length !== 0) { 3058 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_adres_adresZorgverlener_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], null), document.getElementById('js-react-widget-adres-zorgverlener')); 3059 } 3060 } 3061 }, { 3062 key: "renderContactRouteGlobal", 3063 value: function renderContactRouteGlobal() { 3064 if (jQuery('#js-react-widget-contact-route-global').length !== 0) { 3065 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_contactRoute_contactRouteGlobal_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], null), document.getElementById('js-react-widget-contact-route-global')); 3066 } 3067 } 3068 }, { 3069 key: "renderMedicalInformation", 3070 value: function renderMedicalInformation() { 3071 if (jQuery('#js-react-medical-information-herhaalrecept-dropdown').length !== 0) { 3072 Object(react_dom__WEBPACK_IMPORTED_MODULE_1__["render"])( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_medicalInformation_MedicalInformationHerhaalReceptDropdown_jsx__WEBPACK_IMPORTED_MODULE_8__["default"], { 3073 zorgverlenerList: WP.zorgverlenersActiveModules['herhaalservice'] 3074 }), document.getElementById('js-react-medical-information-herhaalrecept-dropdown')); 3075 } 3076 } 3077 }]); 3078 3079 return Bootstrap; 3080}(); 3081 3082var b = new Bootstrap(); 3083 3084/***/ }), 3085
3086/***/ "./assets/js/src/utils.jsx": 3087/*!*********************************!*\ 3088 !*** ./assets/js/src/utils.jsx ***! 3089 \*********************************/ 3090/*! exports provided: default */ 3091/***/ (function(module, __webpack_exports__, __webpack_require__) { 3092 3093"use strict"; 3094__webpack_require__.r(__webpack_exports__); 3095/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Utils; }); 3096/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 3097/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); 3098function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3099 3100function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3101 3102function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 3103 3104 3105 3106var Utils = /*#__PURE__*/function () { 3107 function Utils() { 3108 _classCallCheck(this, Utils); 3109 } 3110 3111 _createClass(Utils, null, [{ 3112 key: "zorgverlenersModulesActive", 3113 3114 /** 3115 * Returns the active zorgverlener modules, at least one needs to be activated. 3116 * With exclude its possible to skip modules like websites 3117 * 3118 * @param exclude 3119 * @returns {boolean} 3120 */ 3121 value: function zorgverlenersModulesActive() { 3122 var exclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 3123 var active = false, 3124 modules = WP.zorgverlenersActiveModules; 3125 3126 for (var module in modules) { 3127 if (modules.hasOwnProperty(module) && !lodash__WEBPACK_IMPORTED_MODULE_0___default.a.isEmpty(modules[module])) { 3128 active = true; 3129 break; 3130 } 3131 } 3132 3133 return active; 3134 } 3135 /** 3136 * Returns the site setting key 3137 * 3138 * @param {string} key 3139 * @param {string} defaultValue 3140 */ 3141 3142 }, { 3143 key: "getSiteSettings", 3144 value: function getSiteSettings() { 3145 var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 3146 var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 3147 var siteSettings = WP['SITE_SETTINGS']; 3148 return siteSettings[key] ? siteSettings[key] : defaultValue; 3149 } 3150 }]); 3151 3152 return Utils; 3153}(); 3154 3155 3156 3157/***/ }), 3158
vendor: 5,393 bytes, lines 3159-3201
3159/***/ "./assets/scss/loader.scss": 3160/*!*********************************!*\ 3161 !*** ./assets/scss/loader.scss ***! 3162 \*********************************/ 3163/*! no static exports found */ 3164/***/ (function(module, exports, __webpack_require__) { 3165 3166 3167var content = __webpack_require__(/*! !../../node_modules/css-loader!../../node_modules/postcss-loader/src??ref--6-2!../../node_modules/sass-loader/dist/cjs.js??ref--6-3!./loader.scss */ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js?!./assets/scss/loader.scss"); 3168 3169if(typeof content === 'string') content = [[module.i, content, '']]; 3170 3171var transform; 3172var insertInto; 3173 3174 3175 3176var options = {"hmr":true} 3177 3178options.transform = transform 3179options.insertInto = undefined; 3180 3181var update = __webpack_require__(/*! ../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); 3182 3183if(content.locals) module.exports = content.locals; 3184 3185if(false) {} 3186 3187/***/ }), 3188 3189/***/ "./node_modules/css-loader/index.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js?!./assets/scss/loader.scss": 3190/*!********************************************************************************************************************************************************!*\ 3191 !*** ./node_modules/css-loader!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./assets/scss/loader.scss ***! 3192 \********************************************************************************************************************************************************/ 3193/*! no static exports found */ 3194/***/ (function(module, exports, __webpack_require__) { 3195 3196exports = module.exports = __webpack_require__(/*! ../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false); 3197// imports 3198 3199 3200// module 3201exports.push([module.i, ".example-enter {\n opacity: 0.01;\n filter: alpha(opacity=1);\n /*\n -webkit-transition: opacity 1s ease-in;\n transition: opacity 1s ease-in;\n */\n}\n\n.example-enter.example-enter-active {\n opacity: 1;\n filter: alpha(opacity=100);\n}\n\n.example-leave {\n opacity: 1;\n filter: alpha(opacity=100);\n -webkit-transition: opacity 1s ease-in;\n transition: opacity 1s ease-in;\n}\n\n.example-leave.example-leave-active {\n opacity: 0.01;\n filter: alpha(opacity=1);\n}\n\n.loader-wrapper {\n position: absolute;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n width: 100%;\n top: 0;\n left: 0;\n z-index: 99;\n}\n\n.loader-components {\n padding: 15px;\n background: #fff;\n border: 1px solid #e5e5e5;\n}\n\n.loader-components__dot {\n width: 50px;\n height: 50px;\n margin: 10px auto 0 auto;\n background-color: #0497db;\n border-radius: 100%;\n -webkit-animation: sk-scaleout 1s infinite ease-in-out;\n animation: sk-scaleout 1s infinite ease-in-out;\n}\n\n.loader-components__text {\n width: 100%;\n font-size: 0.9em;\n padding-top: 1em;\n font-weight: bold;\n text-transform: uppercase;\n text-align: center;\n color: #0497db;\n}\n\n@-webkit-keyframes sk-scaleout {\n 0% {\n -webkit-transform: scale(0);\n }\n 100% {\n -webkit-transform: scale(1);\n opacity: 0;\n }\n}\n@keyframes sk-scaleout {\n 0% {\n -webkit-transform: scale(0);\n transform: scale(0);\n }\n 100% {\n -webkit-transform: scale(1);\n transform: scale(1);\n opacity: 0;\n }\n}\n/*\n* React auto-suggest base styling\n*/\n.react-autosuggest__container {\n position: relative;\n}\n\n.react-autosuggest__suggestion--focused {\n background-color: #ddd;\n}\n\n.react-autosuggest__input {\n width: 100%;\n height: 2.55rem;\n padding: 0.375rem 0.75rem;\n font-size: 1rem;\n line-height: 1.5;\n color: #55595c;\n background-color: #fff;\n background-image: none;\n border: 1px solid #e5e5e5;\n border-radius: 0.25rem;\n}\n\n.react-autosuggest__input:focus {\n outline: none;\n}\n\n.react-autosuggest__container--open .react-autosuggest__input {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.react-autosuggest__suggestions-container {\n position: absolute;\n max-height: 70vh;\n top: 2.55rem;\n left: 0;\n width: 100%;\n margin: 0;\n padding: 0;\n list-style-type: none;\n border: 1px solid #e5e5e5;\n border-top: none;\n background: #fff;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n z-index: 999;\n overflow: scroll;\n overflow-x: hidden;\n}\n\n.react-autosuggest__suggestion {\n cursor: pointer;\n padding: 10px 15px;\n}\n\n.no-suggestions {\n margin-top: 10px;\n padding-left: 10px;\n}\n\n/* required styles */\n.leaflet-pane,\n.leaflet-tile,\n.leaflet-marker-icon,\n.leaflet-marker-shadow,\n.leaflet-tile-container,\n.leaflet-pane > svg,\n.leaflet-pane > canvas,\n.leaflet-zoom-box,\n.leaflet-image-layer,\n.leaflet-layer {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.leaflet-container {\n overflow: hidden;\n}\n\n.leaflet-tile,\n.leaflet-marker-icon,\n.leaflet-marker-shadow {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;
3201\n -webkit-user-drag: none;\n}\n\n/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\n.leaflet-safari .leaflet-tile {\n image-rendering: -webkit-optimize-contrast;\n}\n\n/* hack that prevents hw layers \"stretching\" when loading new tiles */\n.leaflet-safari .leaflet-tile-container {\n width: 1600px;\n height: 1600px;\n -webkit-transform-origin: 0 0;\n}\n\n.leaflet-marker-icon,\n.leaflet-marker-shadow {\n display: block;\n}\n\n/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\n/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\n.leaflet-container .leaflet-overlay-pane svg,\n.leaflet-container .leaflet-marker-pane img,\n.leaflet-container .leaflet-shadow-pane img,\n.leaflet-container .leaflet-tile-pane img,\n.leaflet-container img.leaflet-image-layer,\n.leaflet-container .leaflet-tile {\n max-width: none !important;\n max-height: none !important;\n}\n\n.leaflet-container.leaflet-touch-zoom {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.leaflet-container.leaflet-touch-drag {\n -ms-touch-action: pinch-zoom;\n /* Fallback for FF which doesn't support pinch-zoom */\n touch-action: none;\n touch-action: pinch-zoom;\n}\n\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.leaflet-container {\n -webkit-tap-highlight-color: transparent;\n}\n\n.leaflet-container a {\n -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\n}\n\n.leaflet-tile {\n filter: inherit;\n visibility: hidden;\n}\n\n.leaflet-tile-loaded {\n visibility: inherit;\n}\n\n.leaflet-zoom-box {\n width: 0;\n height: 0;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n z-index: 800;\n}\n\n/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\n.leaflet-overlay-pane svg {\n -moz-user-select: none;\n}\n\n.leaflet-pane {\n z-index: 400;\n}\n\n.leaflet-tile-pane {\n z-index: 200;\n}\n\n.leaflet-overlay-pane {\n z-index: 400;\n}\n\n.leaflet-shadow-pane {\n z-index: 500;\n}\n\n.leaflet-marker-pane {\n z-index: 600;\n}\n\n.leaflet-tooltip-pane {\n z-index: 650;\n}\n\n.leaflet-popup-pane {\n z-index: 700;\n}\n\n.leaflet-map-pane canvas {\n z-index: 100;\n}\n\n.leaflet-map-pane svg {\n z-index: 200;\n}\n\n.leaflet-vml-shape {\n width: 1px;\n height: 1px;\n}\n\n.lvml {\n behavior: url(#default#VML);\n display: inline-block;\n position: absolute;\n}\n\n/* control positioning */\n.leaflet-control {\n position: relative;\n z-index: 800;\n pointer-events: visiblePainted;\n /* IE 9-10 doesn't have auto */\n pointer-events: auto;\n}\n\n.leaflet-top,\n.leaflet-bottom {\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n}\n\n.leaflet-top {\n top: 0;\n}\n\n.leaflet-right {\n right: 0;\n}\n\n.leaflet-bottom {\n bottom: 0;\n}\n\n.leaflet-left {\n left: 0;\n}\n\n.leaflet-control {\n float: left;\n clear: both;\n}\n\n.leaflet-right .leaflet-control {\n float: right;\n}\n\n.leaflet-top .leaflet-control {\n margin-top: 10px;\n}\n\n.leaflet-bottom .leaflet-control {\n margin-bottom: 10px;\n}\n\n.leaflet-left .leaflet-control {\n margin-left: 10px;\n}\n\n.leaflet-right .leaflet-control {\n margin-right: 10px;\n}\n\n/* zoom and fade animations */\n.leaflet-fade-anim .leaflet-tile {\n will-change: opacity;\n}\n\n.leaflet-fade-anim .leaflet-popup {\n opacity: 0;\n -webkit-transition: opacity 0.2s linear;\n -moz-transition: opacity 0.2s linear;\n transition: opacity 0.2s linear;\n}\n\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\n opacity: 1;\n}\n\n.leaflet-zoom-animated {\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n}\n\n.leaflet-zoom-anim .leaflet-zoom-animated {\n will-change: transform;\n}\n\n.leaflet-zoom-anim .leaflet-zoom-animated {\n -webkit-transition: -webkit-transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n -moz-transition: -moz-transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n}\n\n.leaflet-zoom-anim .leaflet-tile,\n.leaflet-pan-anim .leaflet-tile {\n -webkit-transition: none;\n -moz-transition: none;\n transition: none;\n}\n\n.leaflet-zoom-anim .leaflet-zoom-hide {\n visibility: hidden;\n}\n\n/* cursors */\n.leaflet-interactive {\n cursor: pointer;\n}\n\n.leaflet-grab {\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n}\n\n.leaflet-crosshair,\n.leaflet-crosshair .leaflet-interactive {\n cursor: crosshair;\n}
3201\n\n.leaflet-popup-pane,\n.leaflet-control {\n cursor: auto;\n}\n\n.leaflet-dragging .leaflet-grab,\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\n.leaflet-dragging .leaflet-marker-draggable {\n cursor: move;\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n\n/* marker & overlays interactivity */\n.leaflet-marker-icon,\n.leaflet-marker-shadow,\n.leaflet-image-layer,\n.leaflet-pane > svg path,\n.leaflet-tile-container {\n pointer-events: none;\n}\n\n.leaflet-marker-icon.leaflet-interactive,\n.leaflet-image-layer.leaflet-interactive,\n.leaflet-pane > svg path.leaflet-interactive {\n pointer-events: visiblePainted;\n /* IE 9-10 doesn't have auto */\n pointer-events: auto;\n}\n\n/* visual tweaks */\n.leaflet-container {\n background: #ddd;\n outline: 0;\n}\n\n.leaflet-container a {\n color: #0078A8;\n}\n\n.leaflet-container a.leaflet-active {\n outline: 2px solid orange;\n}\n\n.leaflet-zoom-box {\n border: 2px dotted #38f;\n background: rgba(255, 255, 255, 0.5);\n}\n\n/* general typography */\n.leaflet-container {\n font: 12px/1.5 \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n}\n\n/* general toolbar styles */\n.leaflet-bar {\n box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);\n border-radius: 4px;\n}\n\n.leaflet-bar a,\n.leaflet-bar a:hover {\n background-color: #fff;\n border-bottom: 1px solid #ccc;\n width: 26px;\n height: 26px;\n line-height: 26px;\n display: block;\n text-align: center;\n text-decoration: none;\n color: black;\n}\n\n.leaflet-bar a,\n.leaflet-control-layers-toggle {\n background-position: 50% 50%;\n background-repeat: no-repeat;\n display: block;\n}\n\n.leaflet-bar a:hover {\n background-color: #f4f4f4;\n}\n\n.leaflet-bar a:first-child {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n\n.leaflet-bar a:last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n border-bottom: none;\n}\n\n.leaflet-bar a.leaflet-disabled {\n cursor: default;\n background-color: #f4f4f4;\n color: #bbb;\n}\n\n.leaflet-touch .leaflet-bar a {\n width: 30px;\n height: 30px;\n line-height: 30px;\n}\n\n.leaflet-touch .leaflet-bar a:first-child {\n border-top-left-radius: 2px;\n border-top-right-radius: 2px;\n}\n\n.leaflet-touch .leaflet-bar a:last-child {\n border-bottom-left-radius: 2px;\n border-bottom-right-radius: 2px;\n}\n\n/* zoom control */\n.leaflet-control-zoom-in,\n.leaflet-control-zoom-out {\n font: bold 18px \"Lucida Console\", Monaco, monospace;\n text-indent: 1px;\n}\n\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\n font-size: 22px;\n}\n\n/* layers control */\n.leaflet-control-layers {\n box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);\n background: #fff;\n border-radius: 5px;\n}\n\n.leaflet-touch .leaflet-control-layers-toggle {\n width: 44px;\n height: 44px;\n}\n\n.leaflet-control-layers .leaflet-control-layers-list,\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\n display: none;\n}\n\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\n display: block;\n position: relative;\n}\n\n.leaflet-control-layers-expanded {\n padding: 6px 10px 6px 6px;\n color: #333;\n background: #fff;\n}\n\n.leaflet-control-layers-scrollbar {\n overflow-y: scroll;\n overflow-x: hidden;\n padding-right: 5px;\n}\n\n.leaflet-control-layers-selector {\n margin-top: 2px;\n position: relative;\n top: 1px;\n}\n\n.leaflet-control-layers label {\n display: block;\n}\n\n.leaflet-control-layers-separator {\n height: 0;\n border-top: 1px solid #ddd;\n margin: 5px -10px 5px -6px;\n}\n\n/* attribution and scale controls */\n.leaflet-container .leaflet-control-attribution {\n background: #fff;\n background: rgba(255, 255, 255, 0.7);\n margin: 0;\n}\n\n.leaflet-control-attribution,\n.leaflet-control-scale-line {\n padding: 0 5px;\n color: #333;\n}\n\n.leaflet-control-attribution a {\n text-decoration: none;\n}\n\n.leaflet-control-attribution a:hover {\n text-decoration: underline;\n}\n\n.leaflet-container .leaflet-control-attribution,\n.leaflet-container .leaflet-control-scale {\n font-size: 11px;\n}\n\n.leaflet-left .leaflet-control-scale {\n margin-left: 5px;\n}\n\n.leaflet-bottom .leaflet-control-scale {\n margin-bottom: 5px;\n}\n\n.leaflet-control-scale-line {\n border: 2px solid #777;\n border-top: none;\n line-height: 1.1;\n padding: 2px 5px 1px;\n font-size: 11px;\n white-space: nowrap;\n overflow: hidden;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: #fff;\n background: rgba(255, 255, 255, 0.5);\n}\n\n.leaflet-control-scale-line:not(:first-child) {\n border-top: 2px solid #777;\n border-bottom: none;\n margin-top: -2px;\n}\n\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\n border-bottom: 2px solid #777;\n}\n\n.leaflet-touch .leaflet-control-attribution,\n.leaflet-touch .leaflet-control-layers,\n.leaflet-touch .leaflet-bar {\n box-shadow: none;\n}\n\n.leaflet-touch .leaflet-control-layers,\n.leaflet-touch .leaflet-bar {\n border: 2px solid rgba(0, 0, 0, 0.2);\n background-clip: padding-box;\n}\n\n/* popup */\n.leaflet-popup {\n position: absolute;\n text-align: center;\n margin-bottom: 20px;\n}\n\n.leaflet-popup-content-wrapper {\n padding: 1px;\n text-align: left;\n border-radius: 12px;\n}\n\n.leaflet-popup-content {\n margin: 13px 19px;\n line-height: 1.4;\n}\n\n.leaflet-popup-content p {\n margin: 18px 0;\n}\n\n.leaflet-popup-tip-container {\n width: 40px;\n height: 20px;\n position: absolute;\n left: 50%;\n margin-left: -20px;\n overflow: hidden;\n pointer-events: none;\n}\n\n.leaflet-popup-tip {\n width: 17px;\n height: 17px;\n padding: 1px;\n margin: -10px auto 0;\n -webkit-transform: rotate(45deg);\n -moz-transform: rotate(45deg);\n -ms-transform: rotate(45deg);\n transform: rotate(45deg);\n}\n\n.leaflet-popup-content-wrapper,\n.leaflet-popup-tip {\n background: white;\n color: #333;\n box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);\n}\n\n.leaflet-container a.leaflet-popup-close-button {\n position: absolute;\n top: 0;\n right: 0;\n padding: 4px 4px 0 0;\n border: none;\n text-align: center;\n width: 18px;\n height: 14px;\n font: 16px/14px Tahoma, Verdana, sans-serif;\n color: #c3c3c3;\n text-decoration: none;\n font-weight: bold;\n background: transparent;\n}
3201\n\n.leaflet-container a.leaflet-popup-close-button:hover {\n color: #999;\n}\n\n.leaflet-popup-scrolled {\n overflow: auto;\n border-bottom: 1px solid #ddd;\n border-top: 1px solid #ddd;\n}\n\n.leaflet-oldie .leaflet-popup-content-wrapper {\n zoom: 1;\n}\n\n.leaflet-oldie .leaflet-popup-tip {\n width: 24px;\n margin: 0 auto;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";\n filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\n}\n\n.leaflet-oldie .leaflet-popup-tip-container {\n margin-top: -1px;\n}\n\n.leaflet-oldie .leaflet-control-zoom,\n.leaflet-oldie .leaflet-control-layers,\n.leaflet-oldie .leaflet-popup-content-wrapper,\n.leaflet-oldie .leaflet-popup-tip {\n border: 1px solid #999;\n}\n\n/* div icon */\n.leaflet-div-icon {\n background: #fff;\n border: 1px solid #666;\n}\n\n/* Tooltip */\n/* Base styles for the element that has a tooltip */\n.leaflet-tooltip {\n position: absolute;\n padding: 6px;\n background-color: #fff;\n border: 1px solid #fff;\n border-radius: 3px;\n color: #222;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n pointer-events: none;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n}\n\n.leaflet-tooltip.leaflet-clickable {\n cursor: pointer;\n pointer-events: auto;\n}\n\n.leaflet-tooltip-top:before,\n.leaflet-tooltip-bottom:before,\n.leaflet-tooltip-left:before,\n.leaflet-tooltip-right:before {\n position: absolute;\n pointer-events: none;\n border: 6px solid transparent;\n background: transparent;\n content: \"\";\n}\n\n/* Directions */\n.leaflet-tooltip-bottom {\n margin-top: 6px;\n}\n\n.leaflet-tooltip-top {\n margin-top: -6px;\n}\n\n.leaflet-tooltip-bottom:before,\n.leaflet-tooltip-top:before {\n left: 50%;\n margin-left: -6px;\n}\n\n.leaflet-tooltip-top:before {\n bottom: 0;\n margin-bottom: -12px;\n border-top-color: #fff;\n}\n\n.leaflet-tooltip-bottom:before {\n top: 0;\n margin-top: -12px;\n margin-left: -6px;\n border-bottom-color: #fff;\n}\n\n.leaflet-tooltip-left {\n margin-left: -6px;\n}\n\n.leaflet-tooltip-right {\n margin-left: 6px;\n}\n\n.leaflet-tooltip-left:before,\n.leaflet-tooltip-right:before {\n top: 50%;\n margin-top: -6px;\n}\n\n.leaflet-tooltip-left:before {\n right: 0;\n margin-right: -12px;\n border-left-color: #fff;\n}\n\n.leaflet-tooltip-right:before {\n left: 0;\n margin-left: -12px;\n border-right-color: #fff;\n}", ""]); 3202 3203// exports 3204 3205 3206/***/ }), 3207
vendor: 2,555 bytes, lines 3208-3294
3208/***/ "./node_modules/css-loader/lib/css-base.js": 3209/*!*************************************************!*\ 3210 !*** ./node_modules/css-loader/lib/css-base.js ***! 3211 \*************************************************/ 3212/*! no static exports found */ 3213/***/ (function(module, exports) { 3214 3215/* 3216 MIT License http://www.opensource.org/licenses/mit-license.php 3217 Author Tobias Koppers @sokra 3218*/ 3219// css base code, injected by the css-loader 3220module.exports = function(useSourceMap) { 3221 var list = []; 3222 3223 // return the list of modules as css string 3224 list.toString = function toString() { 3225 return this.map(function (item) { 3226 var content = cssWithMappingToString(item, useSourceMap); 3227 if(item[2]) { 3228 return "@media " + item[2] + "{" + content + "}"; 3229 } else { 3230 return content; 3231 } 3232 }).join(""); 3233 }; 3234 3235 // import a list of modules into the list 3236 list.i = function(modules, mediaQuery) { 3237 if(typeof modules === "string") 3238 modules = [[null, modules, ""]]; 3239 var alreadyImportedModules = {}; 3240 for(var i = 0; i < this.length; i++) { 3241 var id = this[i][0]; 3242 if(typeof id === "number") 3243 alreadyImportedModules[id] = true; 3244 } 3245 for(i = 0; i < modules.length; i++) { 3246 var item = modules[i]; 3247 // skip already imported module 3248 // this implementation is not 100% perfect for weird media query combinations 3249 // when a module is imported multiple times with different media queries. 3250 // I hope this will never occur (Hey this way we have smaller bundles) 3251 if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { 3252 if(mediaQuery && !item[2]) { 3253 item[2] = mediaQuery; 3254 } else if(mediaQuery) { 3255 item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; 3256 } 3257 list.push(item); 3258 } 3259 } 3260 }; 3261 return list; 3262}; 3263 3264function cssWithMappingToString(item, useSourceMap) { 3265 var content = item[1] || ''; 3266 var cssMapping = item[3]; 3267 if (!cssMapping) { 3268 return content; 3269 } 3270 3271 if (useSourceMap && typeof btoa === 'function') { 3272 var sourceMapping = toComment(cssMapping); 3273 var sourceURLs = cssMapping.sources.map(function (source) { 3274 return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' 3275 }); 3276 3277 return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); 3278 } 3279 3280 return [content].join('\n'); 3281} 3282 3283// Adapted from convert-source-map (MIT) 3284function toComment(sourceMap) { 3285 // eslint-disable-next-line no-undef 3286 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); 3287 var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; 3288 3289 return '/*# ' + data + ' */'; 3290} 3291 3292 3293/***/ }), 3294
vendor: 3,825 bytes, lines 3295-3402
3295/***/ "./node_modules/fbjs/lib/CSSCore.js": 3296/*!******************************************!*\ 3297 !*** ./node_modules/fbjs/lib/CSSCore.js ***! 3298 \******************************************/ 3299/*! no static exports found */ 3300/***/ (function(module, exports, __webpack_require__) { 3301 3302"use strict"; 3303/** 3304 * Copyright 2013-2015, Facebook, Inc. 3305 * All rights reserved. 3306 * 3307 * This source code is licensed under the BSD-style license found in the 3308 * LICENSE file in the root directory of this source tree. An additional grant 3309 * of patent rights can be found in the PATENTS file in the same directory. 3310 * 3311 * @providesModule CSSCore 3312 * @typechecks 3313 */ 3314 3315 3316 3317var invariant = __webpack_require__(/*! ./invariant */ "./node_modules/fbjs/lib/invariant.js"); 3318 3319/** 3320 * The CSSCore module specifies the API (and implements most of the methods) 3321 * that should be used when dealing with the display of elements (via their 3322 * CSS classes and visibility on screen. It is an API focused on mutating the 3323 * display and not reading it as no logical state should be encoded in the 3324 * display of elements. 3325 */ 3326 3327var CSSCore = { 3328 3329 /** 3330 * Adds the class passed in to the element if it doesn't already have it. 3331 * 3332 * @param {DOMElement} element the element to set the class on 3333 * @param {string} className the CSS className 3334 * @return {DOMElement} the element passed in 3335 */ 3336 addClass: function (element, className) { 3337 !!/\s/.test(className) ? true ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : undefined : undefined; 3338 3339 if (className) { 3340 if (element.classList) { 3341 element.classList.add(className); 3342 } else if (!CSSCore.hasClass(element, className)) { 3343 element.className = element.className + ' ' + className; 3344 } 3345 } 3346 return element; 3347 }, 3348 3349 /** 3350 * Removes the class passed in from the element 3351 * 3352 * @param {DOMElement} element the element to set the class on 3353 * @param {string} className the CSS className 3354 * @return {DOMElement} the element passed in 3355 */ 3356 removeClass: function (element, className) { 3357 !!/\s/.test(className) ? true ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : undefined : undefined; 3358 3359 if (className) { 3360 if (element.classList) { 3361 element.classList.remove(className); 3362 } else if (CSSCore.hasClass(element, className)) { 3363 element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one 3364 .replace(/^\s*|\s*$/g, ''); // trim the ends 3365 } 3366 } 3367 return element; 3368 }, 3369 3370 /** 3371 * Helper to add or remove a class from an element based on a condition. 3372 * 3373 * @param {DOMElement} element the element to set the class on 3374 * @param {string} className the CSS className 3375 * @param {*} bool condition to whether to add or remove the class 3376 * @return {DOMElement} the element passed in 3377 */ 3378 conditionClass: function (element, className, bool) { 3379 return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className); 3380 }, 3381 3382 /** 3383 * Tests whether the element has the class specified. 3384 * 3385 * @param {DOMNode|DOMWindow} element the element to set the class on 3386 * @param {string} className the CSS className 3387 * @return {boolean} true if the element has the class, false if not 3388 */ 3389 hasClass: function (element, className) { 3390 !!/\s/.test(className) ? true ? invariant(false, 'CSS.hasClass takes only a single class name.') : undefined : undefined; 3391 if (element.classList) { 3392 return !!className && element.classList.contains(className); 3393 } 3394 return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; 3395 } 3396 3397}; 3398 3399module.exports = CSSCore; 3400 3401/***/ }), 3402
vendor: 2,993 bytes, lines 3403-3497
3403/***/ "./node_modules/fbjs/lib/EventListener.js": 3404/*!************************************************!*\ 3405 !*** ./node_modules/fbjs/lib/EventListener.js ***! 3406 \************************************************/ 3407/*! no static exports found */ 3408/***/ (function(module, exports, __webpack_require__) { 3409 3410"use strict"; 3411/** 3412 * Copyright 2013-2015, Facebook, Inc. 3413 * 3414 * Licensed under the Apache License, Version 2.0 (the "License"); 3415 * you may not use this file except in compliance with the License. 3416 * You may obtain a copy of the License at 3417 * 3418 * http://www.apache.org/licenses/LICENSE-2.0 3419 * 3420 * Unless required by applicable law or agreed to in writing, software 3421 * distributed under the License is distributed on an "AS IS" BASIS, 3422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3423 * See the License for the specific language governing permissions and 3424 * limitations under the License. 3425 * 3426 * @providesModule EventListener 3427 * @typechecks 3428 */ 3429 3430 3431 3432var emptyFunction = __webpack_require__(/*! ./emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 3433 3434/** 3435 * Upstream version of event listener. Does not take into account specific 3436 * nature of platform. 3437 */ 3438var EventListener = { 3439 /** 3440 * Listen to DOM events during the bubble phase. 3441 * 3442 * @param {DOMEventTarget} target DOM element to register listener on. 3443 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. 3444 * @param {function} callback Callback function. 3445 * @return {object} Object with a `remove` method. 3446 */ 3447 listen: function (target, eventType, callback) { 3448 if (target.addEventListener) { 3449 target.addEventListener(eventType, callback, false); 3450 return { 3451 remove: function () { 3452 target.removeEventListener(eventType, callback, false); 3453 } 3454 }; 3455 } else if (target.attachEvent) { 3456 target.attachEvent('on' + eventType, callback); 3457 return { 3458 remove: function () { 3459 target.detachEvent('on' + eventType, callback); 3460 } 3461 }; 3462 } 3463 }, 3464 3465 /** 3466 * Listen to DOM events during the capture phase. 3467 * 3468 * @param {DOMEventTarget} target DOM element to register listener on. 3469 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. 3470 * @param {function} callback Callback function. 3471 * @return {object} Object with a `remove` method. 3472 */ 3473 capture: function (target, eventType, callback) { 3474 if (target.addEventListener) { 3475 target.addEventListener(eventType, callback, true); 3476 return { 3477 remove: function () { 3478 target.removeEventListener(eventType, callback, true); 3479 } 3480 }; 3481 } else { 3482 if (true) { 3483 console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); 3484 } 3485 return { 3486 remove: emptyFunction 3487 }; 3488 } 3489 }, 3490 3491 registerDefault: function () {} 3492}; 3493 3494module.exports = EventListener; 3495 3496/***/ }), 3497
vendor: 1,435 bytes, lines 3498-3544
3498/***/ "./node_modules/fbjs/lib/ExecutionEnvironment.js": 3499/*!*******************************************************!*\ 3500 !*** ./node_modules/fbjs/lib/ExecutionEnvironment.js ***! 3501 \*******************************************************/ 3502/*! no static exports found */ 3503/***/ (function(module, exports, __webpack_require__) { 3504 3505"use strict"; 3506/** 3507 * Copyright 2013-2015, Facebook, Inc. 3508 * All rights reserved. 3509 * 3510 * This source code is licensed under the BSD-style license found in the 3511 * LICENSE file in the root directory of this source tree. An additional grant 3512 * of patent rights can be found in the PATENTS file in the same directory. 3513 * 3514 * @providesModule ExecutionEnvironment 3515 */ 3516 3517 3518 3519var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); 3520 3521/** 3522 * Simple, lightweight module assisting with the detection and context of 3523 * Worker. Helps avoid circular dependencies and allows code to reason about 3524 * whether or not they are in a Worker, even if they never include the main 3525 * `ReactWorker` dependency. 3526 */ 3527var ExecutionEnvironment = { 3528 3529 canUseDOM: canUseDOM, 3530 3531 canUseWorkers: typeof Worker !== 'undefined', 3532 3533 canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), 3534 3535 canUseViewport: canUseDOM && !!window.screen, 3536 3537 isInWorker: !canUseDOM // For now, this is true - might change in the future. 3538 3539}; 3540 3541module.exports = ExecutionEnvironment; 3542 3543/***/ }), 3544
vendor: 1,022 bytes, lines 3545-3587
3545/***/ "./node_modules/fbjs/lib/camelize.js": 3546/*!*******************************************!*\ 3547 !*** ./node_modules/fbjs/lib/camelize.js ***! 3548 \*******************************************/ 3549/*! no static exports found */ 3550/***/ (function(module, exports, __webpack_require__) { 3551 3552"use strict"; 3553/** 3554 * Copyright 2013-2015, Facebook, Inc. 3555 * All rights reserved. 3556 * 3557 * This source code is licensed under the BSD-style license found in the 3558 * LICENSE file in the root directory of this source tree. An additional grant 3559 * of patent rights can be found in the PATENTS file in the same directory. 3560 * 3561 * @providesModule camelize 3562 * @typechecks 3563 */ 3564 3565 3566 3567var _hyphenPattern = /-(.)/g; 3568 3569/** 3570 * Camelcases a hyphenated string, for example: 3571 * 3572 * > camelize('background-color') 3573 * < "backgroundColor" 3574 * 3575 * @param {string} string 3576 * @return {string} 3577 */ 3578function camelize(string) { 3579 return string.replace(_hyphenPattern, function (_, character) { 3580 return character.toUpperCase(); 3581 }); 3582} 3583 3584module.exports = camelize; 3585 3586/***/ }), 3587
vendor: 1,415 bytes, lines 3588-3638
3588/***/ "./node_modules/fbjs/lib/camelizeStyleName.js": 3589/*!****************************************************!*\ 3590 !*** ./node_modules/fbjs/lib/camelizeStyleName.js ***! 3591 \****************************************************/ 3592/*! no static exports found */ 3593/***/ (function(module, exports, __webpack_require__) { 3594 3595"use strict"; 3596/** 3597 * Copyright 2013-2015, Facebook, Inc. 3598 * All rights reserved. 3599 * 3600 * This source code is licensed under the BSD-style license found in the 3601 * LICENSE file in the root directory of this source tree. An additional grant 3602 * of patent rights can be found in the PATENTS file in the same directory. 3603 * 3604 * @providesModule camelizeStyleName 3605 * @typechecks 3606 */ 3607 3608 3609 3610var camelize = __webpack_require__(/*! ./camelize */ "./node_modules/fbjs/lib/camelize.js"); 3611 3612var msPattern = /^-ms-/; 3613 3614/** 3615 * Camelcases a hyphenated CSS property name, for example: 3616 * 3617 * > camelizeStyleName('background-color') 3618 * < "backgroundColor" 3619 * > camelizeStyleName('-moz-transition') 3620 * < "MozTransition" 3621 * > camelizeStyleName('-ms-transition') 3622 * < "msTransition" 3623 * 3624 * As Andi Smith suggests 3625 * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix 3626 * is converted to lowercase `ms`. 3627 * 3628 * @param {string} string 3629 * @return {string} 3630 */ 3631function camelizeStyleName(string) { 3632 return camelize(string.replace(msPattern, 'ms-')); 3633} 3634 3635module.exports = camelizeStyleName; 3636 3637/***/ }), 3638
vendor: 1,798 bytes, lines 3639-3704
3639/***/ "./node_modules/fbjs/lib/containsNode.js": 3640/*!***********************************************!*\ 3641 !*** ./node_modules/fbjs/lib/containsNode.js ***! 3642 \***********************************************/ 3643/*! no static exports found */ 3644/***/ (function(module, exports, __webpack_require__) { 3645 3646"use strict"; 3647/** 3648 * Copyright 2013-2015, Facebook, Inc. 3649 * All rights reserved. 3650 * 3651 * This source code is licensed under the BSD-style license found in the 3652 * LICENSE file in the root directory of this source tree. An additional grant 3653 * of patent rights can be found in the PATENTS file in the same directory. 3654 * 3655 * @providesModule containsNode 3656 * @typechecks 3657 */ 3658 3659 3660 3661var isTextNode = __webpack_require__(/*! ./isTextNode */ "./node_modules/fbjs/lib/isTextNode.js"); 3662 3663/*eslint-disable no-bitwise */ 3664 3665/** 3666 * Checks if a given DOM node contains or is another DOM node. 3667 * 3668 * @param {?DOMNode} outerNode Outer DOM node. 3669 * @param {?DOMNode} innerNode Inner DOM node. 3670 * @return {boolean} True if `outerNode` contains or is `innerNode`. 3671 */ 3672function containsNode(_x, _x2) { 3673 var _again = true; 3674 3675 _function: while (_again) { 3676 var outerNode = _x, 3677 innerNode = _x2; 3678 _again = false; 3679 3680 if (!outerNode || !innerNode) { 3681 return false; 3682 } else if (outerNode === innerNode) { 3683 return true; 3684 } else if (isTextNode(outerNode)) { 3685 return false; 3686 } else if (isTextNode(innerNode)) { 3687 _x = outerNode; 3688 _x2 = innerNode.parentNode; 3689 _again = true; 3690 continue _function; 3691 } else if (outerNode.contains) { 3692 return outerNode.contains(innerNode); 3693 } else if (outerNode.compareDocumentPosition) { 3694 return !!(outerNode.compareDocumentPosition(innerNode) & 16); 3695 } else { 3696 return false; 3697 } 3698 } 3699} 3700 3701module.exports = containsNode; 3702 3703/***/ }), 3704
vendor: 2,753 bytes, lines 3705-3800
3705/***/ "./node_modules/fbjs/lib/createArrayFromMixed.js": 3706/*!*******************************************************!*\ 3707 !*** ./node_modules/fbjs/lib/createArrayFromMixed.js ***! 3708 \*******************************************************/ 3709/*! no static exports found */ 3710/***/ (function(module, exports, __webpack_require__) { 3711 3712"use strict"; 3713/** 3714 * Copyright 2013-2015, Facebook, Inc. 3715 * All rights reserved. 3716 * 3717 * This source code is licensed under the BSD-style license found in the 3718 * LICENSE file in the root directory of this source tree. An additional grant 3719 * of patent rights can be found in the PATENTS file in the same directory. 3720 * 3721 * @providesModule createArrayFromMixed 3722 * @typechecks 3723 */ 3724 3725 3726 3727var toArray = __webpack_require__(/*! ./toArray */ "./node_modules/fbjs/lib/toArray.js"); 3728 3729/** 3730 * Perform a heuristic test to determine if an object is "array-like". 3731 * 3732 * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" 3733 * Joshu replied: "Mu." 3734 * 3735 * This function determines if its argument has "array nature": it returns 3736 * true if the argument is an actual array, an `arguments' object, or an 3737 * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). 3738 * 3739 * It will return false for other array-like objects like Filelist. 3740 * 3741 * @param {*} obj 3742 * @return {boolean} 3743 */ 3744function hasArrayNature(obj) { 3745 return( 3746 // not null/false 3747 !!obj && ( 3748 // arrays are objects, NodeLists are functions in Safari 3749 typeof obj == 'object' || typeof obj == 'function') && 3750 // quacks like an array 3751 'length' in obj && 3752 // not window 3753 !('setInterval' in obj) && 3754 // no DOM node should be considered an array-like 3755 // a 'select' element has 'length' and 'item' properties on IE8 3756 typeof obj.nodeType != 'number' && ( 3757 // a real array 3758 Array.isArray(obj) || 3759 // arguments 3760 'callee' in obj || 3761 // HTMLCollection/NodeList 3762 'item' in obj) 3763 ); 3764} 3765 3766/** 3767 * Ensure that the argument is an array by wrapping it in an array if it is not. 3768 * Creates a copy of the argument if it is already an array. 3769 * 3770 * This is mostly useful idiomatically: 3771 * 3772 * var createArrayFromMixed = require('createArrayFromMixed'); 3773 * 3774 * function takesOneOrMoreThings(things) { 3775 * things = createArrayFromMixed(things); 3776 * ... 3777 * } 3778 * 3779 * This allows you to treat `things' as an array, but accept scalars in the API. 3780 * 3781 * If you need to convert an array-like object, like `arguments`, into an array 3782 * use toArray instead. 3783 * 3784 * @param {*} obj 3785 * @return {array} 3786 */ 3787function createArrayFromMixed(obj) { 3788 if (!hasArrayNature(obj)) { 3789 return [obj]; 3790 } else if (Array.isArray(obj)) { 3791 return obj.slice(); 3792 } else { 3793 return toArray(obj); 3794 } 3795} 3796 3797module.exports = createArrayFromMixed; 3798 3799/***/ }), 3800
vendor: 3,229 bytes, lines 3801-3895
3801/***/ "./node_modules/fbjs/lib/createNodesFromMarkup.js": 3802/*!********************************************************!*\ 3803 !*** ./node_modules/fbjs/lib/createNodesFromMarkup.js ***! 3804 \********************************************************/ 3805/*! no static exports found */ 3806/***/ (function(module, exports, __webpack_require__) { 3807 3808"use strict"; 3809/** 3810 * Copyright 2013-2015, Facebook, Inc. 3811 * All rights reserved. 3812 * 3813 * This source code is licensed under the BSD-style license found in the 3814 * LICENSE file in the root directory of this source tree. An additional grant 3815 * of patent rights can be found in the PATENTS file in the same directory. 3816 * 3817 * @providesModule createNodesFromMarkup 3818 * @typechecks 3819 */ 3820 3821/*eslint-disable fb-www/unsafe-html*/ 3822 3823 3824 3825var ExecutionEnvironment = __webpack_require__(/*! ./ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 3826 3827var createArrayFromMixed = __webpack_require__(/*! ./createArrayFromMixed */ "./node_modules/fbjs/lib/createArrayFromMixed.js"); 3828var getMarkupWrap = __webpack_require__(/*! ./getMarkupWrap */ "./node_modules/fbjs/lib/getMarkupWrap.js"); 3829var invariant = __webpack_require__(/*! ./invariant */ "./node_modules/fbjs/lib/invariant.js"); 3830 3831/** 3832 * Dummy container used to render all markup. 3833 */ 3834var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; 3835 3836/** 3837 * Pattern used by `getNodeName`. 3838 */ 3839var nodeNamePattern = /^\s*<(\w+)/; 3840 3841/** 3842 * Extracts the `nodeName` of the first element in a string of markup. 3843 * 3844 * @param {string} markup String of markup. 3845 * @return {?string} Node name of the supplied markup. 3846 */ 3847function getNodeName(markup) { 3848 var nodeNameMatch = markup.match(nodeNamePattern); 3849 return nodeNameMatch && nodeNameMatch[1].toLowerCase(); 3850} 3851 3852/** 3853 * Creates an array containing the nodes rendered from the supplied markup. The 3854 * optionally supplied `handleScript` function will be invoked once for each 3855 * <script> element that is rendered. If no `handleScript` function is supplied, 3856 * an exception is thrown if any <script> elements are rendered. 3857 * 3858 * @param {string} markup A string of valid HTML markup. 3859 * @param {?function} handleScript Invoked once for each rendered <script>. 3860 * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. 3861 */ 3862function createNodesFromMarkup(markup, handleScript) { 3863 var node = dummyNode; 3864 !!!dummyNode ? true ? invariant(false, 'createNodesFromMarkup dummy not initialized') : undefined : undefined; 3865 var nodeName = getNodeName(markup); 3866 3867 var wrap = nodeName && getMarkupWrap(nodeName); 3868 if (wrap) { 3869 node.innerHTML = wrap[1] + markup + wrap[2]; 3870 3871 var wrapDepth = wrap[0]; 3872 while (wrapDepth--) { 3873 node = node.lastChild; 3874 } 3875 } else { 3876 node.innerHTML = markup; 3877 } 3878 3879 var scripts = node.getElementsByTagName('script'); 3880 if (scripts.length) { 3881 !handleScript ? true ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : undefined : undefined; 3882 createArrayFromMixed(scripts).forEach(handleScript); 3883 } 3884 3885 var nodes = createArrayFromMixed(node.childNodes); 3886 while (node.lastChild) { 3887 node.removeChild(node.lastChild); 3888 } 3889 return nodes; 3890} 3891 3892module.exports = createNodesFromMarkup; 3893 3894/***/ }), 3895
vendor: 1,399 bytes, lines 3896-3944
3896/***/ "./node_modules/fbjs/lib/emptyFunction.js": 3897/*!************************************************!*\ 3898 !*** ./node_modules/fbjs/lib/emptyFunction.js ***! 3899 \************************************************/ 3900/*! no static exports found */ 3901/***/ (function(module, exports, __webpack_require__) { 3902 3903"use strict"; 3904/** 3905 * Copyright 2013-2015, Facebook, Inc. 3906 * All rights reserved. 3907 * 3908 * This source code is licensed under the BSD-style license found in the 3909 * LICENSE file in the root directory of this source tree. An additional grant 3910 * of patent rights can be found in the PATENTS file in the same directory. 3911 * 3912 * @providesModule emptyFunction 3913 */ 3914 3915 3916 3917function makeEmptyFunction(arg) { 3918 return function () { 3919 return arg; 3920 }; 3921} 3922 3923/** 3924 * This function accepts and discards inputs; it has no side effects. This is 3925 * primarily useful idiomatically for overridable function endpoints which 3926 * always need to be callable, since JS lacks a null-call idiom ala Cocoa. 3927 */ 3928function emptyFunction() {} 3929 3930emptyFunction.thatReturns = makeEmptyFunction; 3931emptyFunction.thatReturnsFalse = makeEmptyFunction(false); 3932emptyFunction.thatReturnsTrue = makeEmptyFunction(true); 3933emptyFunction.thatReturnsNull = makeEmptyFunction(null); 3934emptyFunction.thatReturnsThis = function () { 3935 return this; 3936}; 3937emptyFunction.thatReturnsArgument = function (arg) { 3938 return arg; 3939}; 3940 3941module.exports = emptyFunction; 3942 3943/***/ }), 3944
vendor: 754 bytes, lines 3945-3975
3945/***/ "./node_modules/fbjs/lib/emptyObject.js": 3946/*!**********************************************!*\ 3947 !*** ./node_modules/fbjs/lib/emptyObject.js ***! 3948 \**********************************************/ 3949/*! no static exports found */ 3950/***/ (function(module, exports, __webpack_require__) { 3951 3952"use strict"; 3953/** 3954 * Copyright 2013-2015, Facebook, Inc. 3955 * All rights reserved. 3956 * 3957 * This source code is licensed under the BSD-style license found in the 3958 * LICENSE file in the root directory of this source tree. An additional grant 3959 * of patent rights can be found in the PATENTS file in the same directory. 3960 * 3961 * @providesModule emptyObject 3962 */ 3963 3964 3965 3966var emptyObject = {}; 3967 3968if (true) { 3969 Object.freeze(emptyObject); 3970} 3971 3972module.exports = emptyObject; 3973 3974/***/ }), 3975
vendor: 1,022 bytes, lines 3976-4012
3976/***/ "./node_modules/fbjs/lib/focusNode.js": 3977/*!********************************************!*\ 3978 !*** ./node_modules/fbjs/lib/focusNode.js ***! 3979 \********************************************/ 3980/*! no static exports found */ 3981/***/ (function(module, exports, __webpack_require__) { 3982 3983"use strict"; 3984/** 3985 * Copyright 2013-2015, Facebook, Inc. 3986 * All rights reserved. 3987 * 3988 * This source code is licensed under the BSD-style license found in the 3989 * LICENSE file in the root directory of this source tree. An additional grant 3990 * of patent rights can be found in the PATENTS file in the same directory. 3991 * 3992 * @providesModule focusNode 3993 */ 3994 3995 3996 3997/** 3998 * @param {DOMElement} node input/textarea to focus 3999 */ 4000function focusNode(node) { 4001 // IE8 can throw "Can't move focus to the control because it is invisible, 4002 // not enabled, or of a type that does not accept the focus." for all kinds of 4003 // reasons that are too expensive and fragile to test. 4004 try { 4005 node.focus(); 4006 } catch (e) {} 4007} 4008 4009module.exports = focusNode; 4010 4011/***/ }), 4012
vendor: 1,249 bytes, lines 4013-4058
4013/***/ "./node_modules/fbjs/lib/getActiveElement.js": 4014/*!***************************************************!*\ 4015 !*** ./node_modules/fbjs/lib/getActiveElement.js ***! 4016 \***************************************************/ 4017/*! no static exports found */ 4018/***/ (function(module, exports, __webpack_require__) { 4019 4020"use strict"; 4021/** 4022 * Copyright 2013-2015, Facebook, Inc. 4023 * All rights reserved. 4024 * 4025 * This source code is licensed under the BSD-style license found in the 4026 * LICENSE file in the root directory of this source tree. An additional grant 4027 * of patent rights can be found in the PATENTS file in the same directory. 4028 * 4029 * @providesModule getActiveElement 4030 * @typechecks 4031 */ 4032 4033/* eslint-disable fb-www/typeof-undefined */ 4034 4035/** 4036 * Same as document.activeElement but wraps in a try-catch block. In IE it is 4037 * not safe to call document.activeElement if there is nothing focused. 4038 * 4039 * The activeElement will be null only if the document or document body is not 4040 * yet defined. 4041 */ 4042 4043 4044function getActiveElement() /*?DOMElement*/{ 4045 if (typeof document === 'undefined') { 4046 return null; 4047 } 4048 try { 4049 return document.activeElement || document.body; 4050 } catch (e) { 4051 return document.body; 4052 } 4053} 4054 4055module.exports = getActiveElement; 4056 4057/***/ }), 4058
vendor: 3,461 bytes, lines 4059-4164
4059/***/ "./node_modules/fbjs/lib/getMarkupWrap.js": 4060/*!************************************************!*\ 4061 !*** ./node_modules/fbjs/lib/getMarkupWrap.js ***! 4062 \************************************************/ 4063/*! no static exports found */ 4064/***/ (function(module, exports, __webpack_require__) { 4065 4066"use strict"; 4067/** 4068 * Copyright 2013-2015, Facebook, Inc. 4069 * All rights reserved. 4070 * 4071 * This source code is licensed under the BSD-style license found in the 4072 * LICENSE file in the root directory of this source tree. An additional grant 4073 * of patent rights can be found in the PATENTS file in the same directory. 4074 * 4075 * @providesModule getMarkupWrap 4076 */ 4077 4078/*eslint-disable fb-www/unsafe-html */ 4079 4080 4081 4082var ExecutionEnvironment = __webpack_require__(/*! ./ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 4083 4084var invariant = __webpack_require__(/*! ./invariant */ "./node_modules/fbjs/lib/invariant.js"); 4085 4086/** 4087 * Dummy container used to detect which wraps are necessary. 4088 */ 4089var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; 4090 4091/** 4092 * Some browsers cannot use `innerHTML` to render certain elements standalone, 4093 * so we wrap them, render the wrapped nodes, then extract the desired node. 4094 * 4095 * In IE8, certain elements cannot render alone, so wrap all elements ('*'). 4096 */ 4097 4098var shouldWrap = {}; 4099 4100var selectWrap = [1, '<select multiple="true">', '</select>']; 4101var tableWrap = [1, '<table>', '</table>']; 4102var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; 4103 4104var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; 4105 4106var markupWrap = { 4107 '*': [1, '?<div>', '</div>'], 4108 4109 'area': [1, '<map>', '</map>'], 4110 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], 4111 'legend': [1, '<fieldset>', '</fieldset>'], 4112 'param': [1, '<object>', '</object>'], 4113 'tr': [2, '<table><tbody>', '</tbody></table>'], 4114 4115 'optgroup': selectWrap, 4116 'option': selectWrap, 4117 4118 'caption': tableWrap, 4119 'colgroup': tableWrap, 4120 'tbody': tableWrap, 4121 'tfoot': tableWrap, 4122 'thead': tableWrap, 4123 4124 'td': trWrap, 4125 'th': trWrap 4126}; 4127 4128// Initialize the SVG elements since we know they'll always need to be wrapped 4129// consistently. If they are created inside a <div> they will be initialized in 4130// the wrong namespace (and will not display). 4131var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; 4132svgElements.forEach(function (nodeName) { 4133 markupWrap[nodeName] = svgWrap; 4134 shouldWrap[nodeName] = true; 4135}); 4136 4137/** 4138 * Gets the markup wrap configuration for the supplied `nodeName`. 4139 * 4140 * NOTE: This lazily detects which wraps are necessary for the current browser. 4141 * 4142 * @param {string} nodeName Lowercase `nodeName`. 4143 * @return {?array} Markup wrap configuration, if applicable. 4144 */ 4145function getMarkupWrap(nodeName) { 4146 !!!dummyNode ? true ? invariant(false, 'Markup wrapping node not initialized') : undefined : undefined; 4147 if (!markupWrap.hasOwnProperty(nodeName)) { 4148 nodeName = '*'; 4149 } 4150 if (!shouldWrap.hasOwnProperty(nodeName)) { 4151 if (nodeName === '*') { 4152 dummyNode.innerHTML = '<link />'; 4153 } else { 4154 dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; 4155 } 4156 shouldWrap[nodeName] = !dummyNode.firstChild; 4157 } 4158 return shouldWrap[nodeName] ? markupWrap[nodeName] : null; 4159} 4160 4161module.exports = getMarkupWrap; 4162 4163/***/ }), 4164
vendor: 1,456 bytes, lines 4165-4213
4165/***/ "./node_modules/fbjs/lib/getUnboundedScrollPosition.js": 4166/*!*************************************************************!*\ 4167 !*** ./node_modules/fbjs/lib/getUnboundedScrollPosition.js ***! 4168 \*************************************************************/ 4169/*! no static exports found */ 4170/***/ (function(module, exports, __webpack_require__) { 4171 4172"use strict"; 4173/** 4174 * Copyright 2013-2015, Facebook, Inc. 4175 * All rights reserved. 4176 * 4177 * This source code is licensed under the BSD-style license found in the 4178 * LICENSE file in the root directory of this source tree. An additional grant 4179 * of patent rights can be found in the PATENTS file in the same directory. 4180 * 4181 * @providesModule getUnboundedScrollPosition 4182 * @typechecks 4183 */ 4184 4185 4186 4187/** 4188 * Gets the scroll position of the supplied element or window. 4189 * 4190 * The return values are unbounded, unlike `getScrollPosition`. This means they 4191 * may be negative or exceed the element boundaries (which is possible using 4192 * inertial scrolling). 4193 * 4194 * @param {DOMWindow|DOMElement} scrollable 4195 * @return {object} Map with `x` and `y` keys. 4196 */ 4197function getUnboundedScrollPosition(scrollable) { 4198 if (scrollable === window) { 4199 return { 4200 x: window.pageXOffset || document.documentElement.scrollLeft, 4201 y: window.pageYOffset || document.documentElement.scrollTop 4202 }; 4203 } 4204 return { 4205 x: scrollable.scrollLeft, 4206 y: scrollable.scrollTop 4207 }; 4208} 4209 4210module.exports = getUnboundedScrollPosition; 4211 4212/***/ }), 4213
vendor: 1,119 bytes, lines 4214-4257
4214/***/ "./node_modules/fbjs/lib/hyphenate.js": 4215/*!********************************************!*\ 4216 !*** ./node_modules/fbjs/lib/hyphenate.js ***! 4217 \********************************************/ 4218/*! no static exports found */ 4219/***/ (function(module, exports, __webpack_require__) { 4220 4221"use strict"; 4222/** 4223 * Copyright 2013-2015, Facebook, Inc. 4224 * All rights reserved. 4225 * 4226 * This source code is licensed under the BSD-style license found in the 4227 * LICENSE file in the root directory of this source tree. An additional grant 4228 * of patent rights can be found in the PATENTS file in the same directory. 4229 * 4230 * @providesModule hyphenate 4231 * @typechecks 4232 */ 4233 4234 4235 4236var _uppercasePattern = /([A-Z])/g; 4237 4238/** 4239 * Hyphenates a camelcased string, for example: 4240 * 4241 * > hyphenate('backgroundColor') 4242 * < "background-color" 4243 * 4244 * For CSS style names, use `hyphenateStyleName` instead which works properly 4245 * with all vendor prefixes, including `ms`. 4246 * 4247 * @param {string} string 4248 * @return {string} 4249 */ 4250function hyphenate(string) { 4251 return string.replace(_uppercasePattern, '-$1').toLowerCase(); 4252} 4253 4254module.exports = hyphenate; 4255 4256/***/ }), 4257
vendor: 1,394 bytes, lines 4258-4307
4258/***/ "./node_modules/fbjs/lib/hyphenateStyleName.js": 4259/*!*****************************************************!*\ 4260 !*** ./node_modules/fbjs/lib/hyphenateStyleName.js ***! 4261 \*****************************************************/ 4262/*! no static exports found */ 4263/***/ (function(module, exports, __webpack_require__) { 4264 4265"use strict"; 4266/** 4267 * Copyright 2013-2015, Facebook, Inc. 4268 * All rights reserved. 4269 * 4270 * This source code is licensed under the BSD-style license found in the 4271 * LICENSE file in the root directory of this source tree. An additional grant 4272 * of patent rights can be found in the PATENTS file in the same directory. 4273 * 4274 * @providesModule hyphenateStyleName 4275 * @typechecks 4276 */ 4277 4278 4279 4280var hyphenate = __webpack_require__(/*! ./hyphenate */ "./node_modules/fbjs/lib/hyphenate.js"); 4281 4282var msPattern = /^ms-/; 4283 4284/** 4285 * Hyphenates a camelcased CSS property name, for example: 4286 * 4287 * > hyphenateStyleName('backgroundColor') 4288 * < "background-color" 4289 * > hyphenateStyleName('MozTransition') 4290 * < "-moz-transition" 4291 * > hyphenateStyleName('msTransition') 4292 * < "-ms-transition" 4293 * 4294 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix 4295 * is converted to `-ms-`. 4296 * 4297 * @param {string} string 4298 * @return {string} 4299 */ 4300function hyphenateStyleName(string) { 4301 return hyphenate(string).replace(msPattern, '-ms-'); 4302} 4303 4304module.exports = hyphenateStyleName; 4305 4306/***/ }), 4307
vendor: 1,779 bytes, lines 4308-4368
4308/***/ "./node_modules/fbjs/lib/invariant.js": 4309/*!********************************************!*\ 4310 !*** ./node_modules/fbjs/lib/invariant.js ***! 4311 \********************************************/ 4312/*! no static exports found */ 4313/***/ (function(module, exports, __webpack_require__) { 4314 4315"use strict"; 4316/** 4317 * Copyright 2013-2015, Facebook, Inc. 4318 * All rights reserved. 4319 * 4320 * This source code is licensed under the BSD-style license found in the 4321 * LICENSE file in the root directory of this source tree. An additional grant 4322 * of patent rights can be found in the PATENTS file in the same directory. 4323 * 4324 * @providesModule invariant 4325 */ 4326 4327 4328 4329/** 4330 * Use invariant() to assert state which your program assumes to be true. 4331 * 4332 * Provide sprintf-style format (only %s is supported) and arguments 4333 * to provide information about what broke and what you were 4334 * expecting. 4335 * 4336 * The invariant message will be stripped in production, but the invariant 4337 * will remain to ensure logic does not differ in production. 4338 */ 4339 4340function invariant(condition, format, a, b, c, d, e, f) { 4341 if (true) { 4342 if (format === undefined) { 4343 throw new Error('invariant requires an error message argument'); 4344 } 4345 } 4346 4347 if (!condition) { 4348 var error; 4349 if (format === undefined) { 4350 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); 4351 } else { 4352 var args = [a, b, c, d, e, f]; 4353 var argIndex = 0; 4354 error = new Error(format.replace(/%s/g, function () { 4355 return args[argIndex++]; 4356 })); 4357 error.name = 'Invariant Violation'; 4358 } 4359 4360 error.framesToPop = 1; // we don't care about invariant's own frame 4361 throw error; 4362 } 4363} 4364 4365module.exports = invariant; 4366 4367/***/ }), 4368
vendor: 997 bytes, lines 4369-4402
4369/***/ "./node_modules/fbjs/lib/isNode.js": 4370/*!*****************************************!*\ 4371 !*** ./node_modules/fbjs/lib/isNode.js ***! 4372 \*****************************************/ 4373/*! no static exports found */ 4374/***/ (function(module, exports, __webpack_require__) { 4375 4376"use strict"; 4377/** 4378 * Copyright 2013-2015, Facebook, Inc. 4379 * All rights reserved. 4380 * 4381 * This source code is licensed under the BSD-style license found in the 4382 * LICENSE file in the root directory of this source tree. An additional grant 4383 * of patent rights can be found in the PATENTS file in the same directory. 4384 * 4385 * @providesModule isNode 4386 * @typechecks 4387 */ 4388 4389/** 4390 * @param {*} object The object to check. 4391 * @return {boolean} Whether or not the object is a DOM node. 4392 */ 4393 4394 4395function isNode(object) { 4396 return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); 4397} 4398 4399module.exports = isNode; 4400 4401/***/ }), 4402
vendor: 982 bytes, lines 4403-4438
4403/***/ "./node_modules/fbjs/lib/isTextNode.js": 4404/*!*********************************************!*\ 4405 !*** ./node_modules/fbjs/lib/isTextNode.js ***! 4406 \*********************************************/ 4407/*! no static exports found */ 4408/***/ (function(module, exports, __webpack_require__) { 4409 4410"use strict"; 4411/** 4412 * Copyright 2013-2015, Facebook, Inc. 4413 * All rights reserved. 4414 * 4415 * This source code is licensed under the BSD-style license found in the 4416 * LICENSE file in the root directory of this source tree. An additional grant 4417 * of patent rights can be found in the PATENTS file in the same directory. 4418 * 4419 * @providesModule isTextNode 4420 * @typechecks 4421 */ 4422 4423 4424 4425var isNode = __webpack_require__(/*! ./isNode */ "./node_modules/fbjs/lib/isNode.js"); 4426 4427/** 4428 * @param {*} object The object to check. 4429 * @return {boolean} Whether or not the object is a DOM text node. 4430 */ 4431function isTextNode(object) { 4432 return isNode(object) && object.nodeType == 3; 4433} 4434 4435module.exports = isTextNode; 4436 4437/***/ }), 4438
vendor: 1,585 bytes, lines 4439-4497
4439/***/ "./node_modules/fbjs/lib/keyMirror.js": 4440/*!********************************************!*\ 4441 !*** ./node_modules/fbjs/lib/keyMirror.js ***! 4442 \********************************************/ 4443/*! no static exports found */ 4444/***/ (function(module, exports, __webpack_require__) { 4445 4446"use strict"; 4447/** 4448 * Copyright 2013-2015, Facebook, Inc. 4449 * All rights reserved. 4450 * 4451 * This source code is licensed under the BSD-style license found in the 4452 * LICENSE file in the root directory of this source tree. An additional grant 4453 * of patent rights can be found in the PATENTS file in the same directory. 4454 * 4455 * @providesModule keyMirror 4456 * @typechecks static-only 4457 */ 4458 4459 4460 4461var invariant = __webpack_require__(/*! ./invariant */ "./node_modules/fbjs/lib/invariant.js"); 4462 4463/** 4464 * Constructs an enumeration with keys equal to their value. 4465 * 4466 * For example: 4467 * 4468 * var COLORS = keyMirror({blue: null, red: null}); 4469 * var myColor = COLORS.blue; 4470 * var isColorValid = !!COLORS[myColor]; 4471 * 4472 * The last line could not be performed if the values of the generated enum were 4473 * not equal to their keys. 4474 * 4475 * Input: {key1: val1, key2: val2} 4476 * Output: {key1: key1, key2: key2} 4477 * 4478 * @param {object} obj 4479 * @return {object} 4480 */ 4481var keyMirror = function (obj) { 4482 var ret = {}; 4483 var key; 4484 !(obj instanceof Object && !Array.isArray(obj)) ? true ? invariant(false, 'keyMirror(...): Argument must be an object.') : undefined : undefined; 4485 for (key in obj) { 4486 if (!obj.hasOwnProperty(key)) { 4487 continue; 4488 } 4489 ret[key] = key; 4490 } 4491 return ret; 4492}; 4493 4494module.exports = keyMirror; 4495 4496/***/ }), 4497
vendor: 1,394 bytes, lines 4498-4543
4498/***/ "./node_modules/fbjs/lib/keyOf.js": 4499/*!****************************************!*\ 4500 !*** ./node_modules/fbjs/lib/keyOf.js ***! 4501 \****************************************/ 4502/*! no static exports found */ 4503/***/ (function(module, exports, __webpack_require__) { 4504 4505"use strict"; 4506/** 4507 * Copyright 2013-2015, Facebook, Inc. 4508 * All rights reserved. 4509 * 4510 * This source code is licensed under the BSD-style license found in the 4511 * LICENSE file in the root directory of this source tree. An additional grant 4512 * of patent rights can be found in the PATENTS file in the same directory. 4513 * 4514 * @providesModule keyOf 4515 */ 4516 4517/** 4518 * Allows extraction of a minified key. Let's the build system minify keys 4519 * without losing the ability to dynamically use key strings as values 4520 * themselves. Pass in an object with a single key/val pair and it will return 4521 * you the string key of that single record. Suppose you want to grab the 4522 * value for a key 'className' inside of an object. Key/val minification may 4523 * have aliased that key to be 'xa12'. keyOf({className: null}) will return 4524 * 'xa12' in that case. Resolve keys you want to use once at startup time, then 4525 * reuse those resolutions. 4526 */ 4527 4528 4529var keyOf = function (oneKeyObj) { 4530 var key; 4531 for (key in oneKeyObj) { 4532 if (!oneKeyObj.hasOwnProperty(key)) { 4533 continue; 4534 } 4535 return key; 4536 } 4537 return null; 4538}; 4539 4540module.exports = keyOf; 4541 4542/***/ }), 4543
vendor: 1,763 bytes, lines 4544-4605
4544/***/ "./node_modules/fbjs/lib/mapObject.js": 4545/*!********************************************!*\ 4546 !*** ./node_modules/fbjs/lib/mapObject.js ***! 4547 \********************************************/ 4548/*! no static exports found */ 4549/***/ (function(module, exports, __webpack_require__) { 4550 4551"use strict"; 4552/** 4553 * Copyright 2013-2015, Facebook, Inc. 4554 * All rights reserved. 4555 * 4556 * This source code is licensed under the BSD-style license found in the 4557 * LICENSE file in the root directory of this source tree. An additional grant 4558 * of patent rights can be found in the PATENTS file in the same directory. 4559 * 4560 * @providesModule mapObject 4561 */ 4562 4563 4564 4565var hasOwnProperty = Object.prototype.hasOwnProperty; 4566 4567/** 4568 * Executes the provided `callback` once for each enumerable own property in the 4569 * object and constructs a new object from the results. The `callback` is 4570 * invoked with three arguments: 4571 * 4572 * - the property value 4573 * - the property name 4574 * - the object being traversed 4575 * 4576 * Properties that are added after the call to `mapObject` will not be visited 4577 * by `callback`. If the values of existing properties are changed, the value 4578 * passed to `callback` will be the value at the time `mapObject` visits them. 4579 * Properties that are deleted before being visited are not visited. 4580 * 4581 * @grep function objectMap() 4582 * @grep function objMap() 4583 * 4584 * @param {?object} object 4585 * @param {function} callback 4586 * @param {*} context 4587 * @return {?object} 4588 */ 4589function mapObject(object, callback, context) { 4590 if (!object) { 4591 return null; 4592 } 4593 var result = {}; 4594 for (var name in object) { 4595 if (hasOwnProperty.call(object, name)) { 4596 result[name] = callback.call(context, object[name], name, object); 4597 } 4598 } 4599 return result; 4600} 4601 4602module.exports = mapObject; 4603 4604/***/ }), 4605
vendor: 1,107 bytes, lines 4606-4647
4606/***/ "./node_modules/fbjs/lib/memoizeStringOnly.js": 4607/*!****************************************************!*\ 4608 !*** ./node_modules/fbjs/lib/memoizeStringOnly.js ***! 4609 \****************************************************/ 4610/*! no static exports found */ 4611/***/ (function(module, exports, __webpack_require__) { 4612 4613"use strict"; 4614/** 4615 * Copyright 2013-2015, Facebook, Inc. 4616 * All rights reserved. 4617 * 4618 * This source code is licensed under the BSD-style license found in the 4619 * LICENSE file in the root directory of this source tree. An additional grant 4620 * of patent rights can be found in the PATENTS file in the same directory. 4621 * 4622 * @providesModule memoizeStringOnly 4623 * @typechecks static-only 4624 */ 4625 4626 4627 4628/** 4629 * Memoizes the return value of a function that accepts one string argument. 4630 * 4631 * @param {function} callback 4632 * @return {function} 4633 */ 4634function memoizeStringOnly(callback) { 4635 var cache = {}; 4636 return function (string) { 4637 if (!cache.hasOwnProperty(string)) { 4638 cache[string] = callback.call(this, string); 4639 } 4640 return cache[string]; 4641 }; 4642} 4643 4644module.exports = memoizeStringOnly; 4645 4646/***/ }), 4647
vendor: 984 bytes, lines 4648-4681
4648/***/ "./node_modules/fbjs/lib/performance.js": 4649/*!**********************************************!*\ 4650 !*** ./node_modules/fbjs/lib/performance.js ***! 4651 \**********************************************/ 4652/*! no static exports found */ 4653/***/ (function(module, exports, __webpack_require__) { 4654 4655"use strict"; 4656/** 4657 * Copyright 2013-2015, Facebook, Inc. 4658 * All rights reserved. 4659 * 4660 * This source code is licensed under the BSD-style license found in the 4661 * LICENSE file in the root directory of this source tree. An additional grant 4662 * of patent rights can be found in the PATENTS file in the same directory. 4663 * 4664 * @providesModule performance 4665 * @typechecks 4666 */ 4667 4668 4669 4670var ExecutionEnvironment = __webpack_require__(/*! ./ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 4671 4672var performance; 4673 4674if (ExecutionEnvironment.canUseDOM) { 4675 performance = window.performance || window.msPerformance || window.webkitPerformance; 4676} 4677 4678module.exports = performance || {}; 4679 4680/***/ }), 4681
vendor: 1,219 bytes, lines 4682-4726
4682/***/ "./node_modules/fbjs/lib/performanceNow.js": 4683/*!*************************************************!*\ 4684 !*** ./node_modules/fbjs/lib/performanceNow.js ***! 4685 \*************************************************/ 4686/*! no static exports found */ 4687/***/ (function(module, exports, __webpack_require__) { 4688 4689"use strict"; 4690/** 4691 * Copyright 2013-2015, Facebook, Inc. 4692 * All rights reserved. 4693 * 4694 * This source code is licensed under the BSD-style license found in the 4695 * LICENSE file in the root directory of this source tree. An additional grant 4696 * of patent rights can be found in the PATENTS file in the same directory. 4697 * 4698 * @providesModule performanceNow 4699 * @typechecks 4700 */ 4701 4702 4703 4704var performance = __webpack_require__(/*! ./performance */ "./node_modules/fbjs/lib/performance.js"); 4705 4706var performanceNow; 4707 4708/** 4709 * Detect if we can use `window.performance.now()` and gracefully fallback to 4710 * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now 4711 * because of Facebook's testing infrastructure. 4712 */ 4713if (performance.now) { 4714 performanceNow = function () { 4715 return performance.now(); 4716 }; 4717} else { 4718 performanceNow = function () { 4719 return Date.now(); 4720 }; 4721} 4722 4723module.exports = performanceNow; 4724 4725/***/ }), 4726
vendor: 1,585 bytes, lines 4727-4787
4727/***/ "./node_modules/fbjs/lib/shallowEqual.js": 4728/*!***********************************************!*\ 4729 !*** ./node_modules/fbjs/lib/shallowEqual.js ***! 4730 \***********************************************/ 4731/*! no static exports found */ 4732/***/ (function(module, exports, __webpack_require__) { 4733 4734"use strict"; 4735/** 4736 * Copyright 2013-2015, Facebook, Inc. 4737 * All rights reserved. 4738 * 4739 * This source code is licensed under the BSD-style license found in the 4740 * LICENSE file in the root directory of this source tree. An additional grant 4741 * of patent rights can be found in the PATENTS file in the same directory. 4742 * 4743 * @providesModule shallowEqual 4744 * @typechecks 4745 * 4746 */ 4747 4748 4749 4750var hasOwnProperty = Object.prototype.hasOwnProperty; 4751 4752/** 4753 * Performs equality by iterating through keys on an object and returning false 4754 * when any key has values which are not strictly equal between the arguments. 4755 * Returns true when the values of all keys are strictly equal. 4756 */ 4757function shallowEqual(objA, objB) { 4758 if (objA === objB) { 4759 return true; 4760 } 4761 4762 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { 4763 return false; 4764 } 4765 4766 var keysA = Object.keys(objA); 4767 var keysB = Object.keys(objB); 4768 4769 if (keysA.length !== keysB.length) { 4770 return false; 4771 } 4772 4773 // Test for A's keys different from B. 4774 var bHasOwnProperty = hasOwnProperty.bind(objB); 4775 for (var i = 0; i < keysA.length; i++) { 4776 if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { 4777 return false; 4778 } 4779 } 4780 4781 return true; 4782} 4783 4784module.exports = shallowEqual; 4785 4786/***/ }), 4787
vendor: 2,209 bytes, lines 4788-4855
4788/***/ "./node_modules/fbjs/lib/toArray.js": 4789/*!******************************************!*\ 4790 !*** ./node_modules/fbjs/lib/toArray.js ***! 4791 \******************************************/ 4792/*! no static exports found */ 4793/***/ (function(module, exports, __webpack_require__) { 4794 4795"use strict"; 4796/** 4797 * Copyright 2013-2015, Facebook, Inc. 4798 * All rights reserved. 4799 * 4800 * This source code is licensed under the BSD-style license found in the 4801 * LICENSE file in the root directory of this source tree. An additional grant 4802 * of patent rights can be found in the PATENTS file in the same directory. 4803 * 4804 * @providesModule toArray 4805 * @typechecks 4806 */ 4807 4808 4809 4810var invariant = __webpack_require__(/*! ./invariant */ "./node_modules/fbjs/lib/invariant.js"); 4811 4812/** 4813 * Convert array-like objects to arrays. 4814 * 4815 * This API assumes the caller knows the contents of the data type. For less 4816 * well defined inputs use createArrayFromMixed. 4817 * 4818 * @param {object|function|filelist} obj 4819 * @return {array} 4820 */ 4821function toArray(obj) { 4822 var length = obj.length; 4823 4824 // Some browse builtin objects can report typeof 'function' (e.g. NodeList in 4825 // old versions of Safari). 4826 !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? true ? invariant(false, 'toArray: Array-like object expected') : undefined : undefined; 4827 4828 !(typeof length === 'number') ? true ? invariant(false, 'toArray: Object needs a length property') : undefined : undefined; 4829 4830 !(length === 0 || length - 1 in obj) ? true ? invariant(false, 'toArray: Object should have keys for indices') : undefined : undefined; 4831 4832 // Old IE doesn't give collections access to hasOwnProperty. Assume inputs 4833 // without method will throw during the slice call and skip straight to the 4834 // fallback. 4835 if (obj.hasOwnProperty) { 4836 try { 4837 return Array.prototype.slice.call(obj); 4838 } catch (e) { 4839 // IE < 9 does not support Array#slice on collections objects 4840 } 4841 } 4842 4843 // Fall back to copying key by key. This assumes all keys have a value, 4844 // so will not preserve sparsely populated inputs. 4845 var ret = Array(length); 4846 for (var ii = 0; ii < length; ii++) { 4847 ret[ii] = obj[ii]; 4848 } 4849 return ret; 4850} 4851 4852module.exports = toArray; 4853 4854/***/ }), 4855
vendor: 2,087 bytes, lines 4856-4923
4856/***/ "./node_modules/fbjs/lib/warning.js": 4857/*!******************************************!*\ 4858 !*** ./node_modules/fbjs/lib/warning.js ***! 4859 \******************************************/ 4860/*! no static exports found */ 4861/***/ (function(module, exports, __webpack_require__) { 4862 4863"use strict"; 4864/** 4865 * Copyright 2014-2015, Facebook, Inc. 4866 * All rights reserved. 4867 * 4868 * This source code is licensed under the BSD-style license found in the 4869 * LICENSE file in the root directory of this source tree. An additional grant 4870 * of patent rights can be found in the PATENTS file in the same directory. 4871 * 4872 * @providesModule warning 4873 */ 4874 4875 4876 4877var emptyFunction = __webpack_require__(/*! ./emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 4878 4879/** 4880 * Similar to invariant but only logs a warning if the condition is not met. 4881 * This can be used to log issues in development environments in critical 4882 * paths. Removing the logging code for production environments will keep the 4883 * same logic and follow the same code paths. 4884 */ 4885 4886var warning = emptyFunction; 4887 4888if (true) { 4889 warning = function (condition, format) { 4890 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 4891 args[_key - 2] = arguments[_key]; 4892 } 4893 4894 if (format === undefined) { 4895 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); 4896 } 4897 4898 if (format.indexOf('Failed Composite propType: ') === 0) { 4899 return; // Ignore CompositeComponent proptype check. 4900 } 4901 4902 if (!condition) { 4903 var argIndex = 0; 4904 var message = 'Warning: ' + format.replace(/%s/g, function () { 4905 return args[argIndex++]; 4906 }); 4907 if (typeof console !== 'undefined') { 4908 console.error(message); 4909 } 4910 try { 4911 // --- Welcome to debugging React --- 4912 // This error was thrown as a convenience so that you can use this stack 4913 // to find the callsite that caused this warning to fire. 4914 throw new Error(message); 4915 } catch (x) {} 4916 } 4917 }; 4918} 4919 4920module.exports = warning; 4921 4922/***/ }), 4923
vendor: 409,196 bytes, lines 4924-19013
4924/***/ "./node_modules/leaflet/dist/leaflet-src.js": 4925/*!**************************************************!*\ 4926 !*** ./node_modules/leaflet/dist/leaflet-src.js ***! 4927 \**************************************************/ 4928/*! no static exports found */ 4929/***/ (function(module, exports, __webpack_require__) { 4930 4931/* @preserve 4932 * Leaflet 1.6.0, a JS library for interactive maps. http://leafletjs.com 4933 * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade 4934 */ 4935 4936(function (global, factory) { 4937 true ? factory(exports) : 4938 undefined; 4939}(this, (function (exports) { 'use strict'; 4940 4941var version = "1.6.0"; 4942 4943/* 4944 * @namespace Util 4945 * 4946 * Various utility functions, used by Leaflet internally. 4947 */ 4948 4949var freeze = Object.freeze; 4950Object.freeze = function (obj) { return obj; }; 4951 4952// @function extend(dest: Object, src?: Object): Object 4953// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut. 4954function extend(dest) { 4955 var i, j, len, src; 4956 4957 for (j = 1, len = arguments.length; j < len; j++) { 4958 src = arguments[j]; 4959 for (i in src) { 4960 dest[i] = src[i]; 4961 } 4962 } 4963 return dest; 4964} 4965 4966// @function create(proto: Object, properties?: Object): Object 4967// Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create) 4968var create = Object.create || (function () { 4969 function F() {} 4970 return function (proto) { 4971 F.prototype = proto; 4972 return new F(); 4973 }; 4974})(); 4975 4976// @function bind(fn: Function, …): Function 4977// Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). 4978// Has a `L.bind()` shortcut. 4979function bind(fn, obj) { 4980 var slice = Array.prototype.slice; 4981 4982 if (fn.bind) { 4983 return fn.bind.apply(fn, slice.call(arguments, 1)); 4984 } 4985 4986 var args = slice.call(arguments, 2); 4987 4988 return function () { 4989 return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments); 4990 }; 4991} 4992 4993// @property lastId: Number 4994// Last unique ID used by [`stamp()`](#util-stamp) 4995var lastId = 0; 4996 4997// @function stamp(obj: Object): Number 4998// Returns the unique ID of an object, assigning it one if it doesn't have it. 4999function stamp(obj) { 5000 /*eslint-disable */ 5001 obj._leaflet_id = obj._leaflet_id || ++lastId; 5002 return obj._leaflet_id; 5003 /* eslint-enable */ 5004} 5005 5006// @function throttle(fn: Function, time: Number, context: Object): Function 5007// Returns a function which executes function `fn` with the given scope `context` 5008// (so that the `this` keyword refers to `context` inside `fn`'s code). The function 5009// `fn` will be called no more than one time per given amount of `time`. The arguments 5010// received by the bound function will be any arguments passed when binding the 5011// function, followed by any arguments passed when invoking the bound function. 5012// Has an `L.throttle` shortcut. 5013function throttle(fn, time, context) { 5014 var lock, args, wrapperFn, later; 5015 5016 later = function () { 5017 // reset lock and call if queued 5018 lock = false; 5019 if (args) { 5020 wrapperFn.apply(context, args); 5021 args = false; 5022 } 5023 }; 5024 5025 wrapperFn = function () { 5026 if (lock) { 5027 // called too soon, queue to call later 5028 args = arguments; 5029 5030 } else { 5031 // call and lock until later 5032 fn.apply(context, arguments); 5033 setTimeout(later, time); 5034 lock = true; 5035 } 5036 }; 5037 5038 return wrapperFn; 5039} 5040 5041// @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number 5042// Returns the number `num` modulo `range` in such a way so it lies within 5043// `range[0]` and `range[1]`. The returned value will be always smaller than 5044// `range[1]` unless `includeMax` is set to `true`. 5045function wrapNum(x, range, includeMax) { 5046 var max = range[1], 5047 min = range[0], 5048 d = max - min; 5049 return x === max && includeMax ? x : ((x - min) % d + d) % d + min; 5050} 5051 5052// @function falseFn(): Function 5053// Returns a function which always returns `false`. 5054function falseFn() { return false; } 5055 5056// @function formatNum(num: Number, digits?: Number): Number 5057// Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default. 5058function formatNum(num, digits) { 5059 var pow = Math.pow(10, (digits === undefined ? 6 : digits)); 5060 return Math.round(num * pow) / pow; 5061} 5062 5063// @function trim(str: String): String 5064// Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) 5065function trim(str) { 5066 return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); 5067} 5068 5069// @function splitWords(str: String): String[] 5070// Trims and splits the string on whitespace and returns the array of parts. 5071function splitWords(str) { 5072 return trim(str).split(/\s+/); 5073} 5074 5075// @function setOptions(obj: Object, options: Object): Object 5076// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut. 5077function setOptions(obj, options) { 5078 if (!obj.hasOwnProperty('options')) { 5079 obj.options = obj.options ? create(obj.options) : {}; 5080 } 5081 for (var i in options) { 5082 obj.options[i] = options[i]; 5083 } 5084 return obj.options; 5085} 5086 5087// @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String 5088// Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}` 5089// translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will 5090// be appended at the end. If `uppercase` is `true`, the parameter names will 5091// be uppercased (e.g. `'?A=foo&B=bar'`) 5092function getParamString(obj, existingUrl, uppercase) { 5093 var params = []; 5094 for (var i in obj) { 5095 params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i])); 5096 } 5097 return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&'); 5098} 5099 5100var templateRe = /\{ *([\w_-]+) *\}/g; 5101 5102// @function template(str: String, data: Object): String 5103// Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'` 5104// and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string 5105// `('Hello foo, bar')`. You can also specify functions instead of strings for 5106// data values — they will be evaluated passing `data` as an argument. 5107function template(str, data) { 5108 return str.replace(templateRe, function (str, key) { 5109 var value = data[key]; 5110 5111 if (value === undefined) { 5112 throw new Error('No value provided for variable ' + str); 5113 5114 } else if (typeof value === 'function') { 5115 value = value(data); 5116 } 5117 return value; 5118 }); 5119} 5120 5121// @function isArray(obj): Boolean 5122// Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) 5123var isArray = Array.isArray || function (obj) { 5124 return (Object.prototype.toString.call(obj) === '[object Array]'); 5125}; 5126 5127// @function indexOf(array: Array, el: Object): Number 5128// Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) 5129function indexOf(array, el) { 5130 for (var i = 0; i < array.length; i++) { 5131 if (array[i] === el) { return i; } 5132 } 5133 return -1; 5134} 5135 5136// @property emptyImageUrl: String 5137// Data URI string containing a base64-encoded empty GIF image. 5138// Used as a hack to free memory from unused images on WebKit-powered 5139// mobile devices (by setting image `src` to this string). 5140var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; 5141 5142// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5143 5144function getPrefixed(name) { 5145 return window['webkit' + name] || window['moz' + name] || window['ms' + name]; 5146} 5147 5148var lastTime = 0; 5149 5150// fallback for IE 7-8 5151function timeoutDefer(fn) { 5152 var time = +new Date(), 5153 timeToCall = Math.max(0, 16 - (time - lastTime)); 5154 5155 lastTime = time + timeToCall; 5156 return window.setTimeout(fn, timeToCall); 5157} 5158 5159var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer; 5160var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || 5161 getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); }; 5162 5163// @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number 5164// Schedules `fn` to be executed when the browser repaints. `fn` is bound to 5165// `context` if given. When `immediate` is set, `fn` is called immediately if 5166// the browser doesn't have native support for 5167// [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame), 5168// otherwise it's delayed. Returns a request ID that can be used to cancel the request. 5169function requestAnimFrame(fn, context, immediate) { 5170 if (immediate && requestFn === timeoutDefer) { 5171 fn.call(context); 5172 } else { 5173 return requestFn.call(window, bind(fn, context)); 5174 } 5175} 5176 5177// @function cancelAnimFrame(id: Number): undefined 5178// Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame). 5179function cancelAnimFrame(id) { 5180 if (id) { 5181 cancelFn.call(window, id); 5182 } 5183} 5184 5185 5186var Util = (Object.freeze || Object)({ 5187 freeze: freeze, 5188 extend: extend, 5189 create: create, 5190 bind: bind, 5191 lastId: lastId, 5192 stamp: stamp, 5193 throttle: throttle, 5194 wrapNum: wrapNum, 5195 falseFn: falseFn, 5196 formatNum: formatNum, 5197 trim: trim, 5198 splitWords: splitWords, 5199 setOptions: setOptions, 5200 getParamString: getParamString, 5201 template: template, 5202 isArray: isArray, 5203 indexOf: indexOf, 5204 emptyImageUrl: emptyImageUrl, 5205 requestFn: requestFn, 5206 cancelFn: cancelFn, 5207 requestAnimFrame: requestAnimFrame, 5208 cancelAnimFrame: cancelAnimFrame 5209}); 5210 5211// @class Class 5212// @aka L.Class 5213 5214// @section 5215// @uninheritable 5216 5217// Thanks to John Resig and Dean Edwards for inspiration! 5218 5219function Class() {} 5220 5221Class.extend = function (props) { 5222 5223 // @function extend(props: Object): Function 5224 // [Extends the current class](#class-inheritance) given the properties to be included. 5225 // Returns a Javascript function that is a class constructor (to be called with `new`). 5226 var NewClass = function () { 5227 5228 // call the constructor 5229 if (this.initialize) { 5230 this.initialize.apply(this, arguments); 5231 } 5232 5233 // call all constructor hooks 5234 this.callInitHooks(); 5235 }; 5236 5237 var parentProto = NewClass.__super__ = this.prototype; 5238 5239 var proto = create(parentProto); 5240 proto.constructor = NewClass; 5241 5242 NewClass.prototype = proto; 5243 5244 // inherit parent's statics 5245 for (var i in this) { 5246 if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') { 5247 NewClass[i] = this[i]; 5248 } 5249 } 5250 5251 // mix static properties into the class 5252 if (props.statics) { 5253 extend(NewClass, props.statics); 5254 delete props.statics; 5255 } 5256 5257 // mix includes into the prototype 5258 if (props.includes) { 5259 checkDeprecatedMixinEvents(props.includes); 5260 extend.apply(null, [proto].concat(props.includes)); 5261 delete props.includes; 5262 } 5263 5264 // merge options 5265 if (proto.options) { 5266 props.options = extend(create(proto.options), props.options); 5267 } 5268 5269 // mix given properties into the prototype 5270 extend(proto, props); 5271 5272 proto._initHooks = []; 5273 5274 // add method for calling all hooks 5275 proto.callInitHooks = function () { 5276 5277 if (this._initHooksCalled) { return; } 5278 5279 if (parentProto.callInitHooks) { 5280 parentProto.callInitHooks.call(this); 5281 } 5282 5283 this._initHooksCalled = true; 5284 5285 for (var i = 0, len = proto._initHooks.length; i < len; i++) { 5286 proto._initHooks[i].call(this); 5287 } 5288 }; 5289 5290 return NewClass; 5291}; 5292 5293 5294// @function include(properties: Object): this 5295// [Includes a mixin](#class-includes) into the current class. 5296Class.include = function (props) { 5297 extend(this.prototype, props); 5298 return this; 5299}; 5300 5301// @function mergeOptions(options: Object): this 5302// [Merges `options`](#class-options) into the defaults of the class. 5303Class.mergeOptions = function (options) { 5304 extend(this.prototype.options, options); 5305 return this; 5306}; 5307 5308// @function addInitHook(fn: Function): this 5309// Adds a [constructor hook](#class-constructor-hooks) to the class. 5310Class.addInitHook = function (fn) { // (Function) || (String, args...) 5311 var args = Array.prototype.slice.call(arguments, 1); 5312 5313 var init = typeof fn === 'function' ? fn : function () { 5314 this[fn].apply(this, args); 5315 }; 5316 5317 this.prototype._initHooks = this.prototype._initHooks || []; 5318 this.prototype._initHooks.push(init); 5319 return this; 5320}; 5321 5322function checkDeprecatedMixinEvents(includes) { 5323 if (typeof L === 'undefined' || !L || !L.Mixin) { return; } 5324 5325 includes = isArray(includes) ? includes : [includes]; 5326 5327 for (var i = 0; i < includes.length; i++) { 5328 if (includes[i] === L.Mixin.Events) { 5329 console.warn('Deprecated include of L.Mixin.Events: ' + 5330 'this property will be removed in future releases, ' + 5331 'please inherit from L.Evented instead.', new Error().stack); 5332 } 5333 } 5334} 5335 5336/* 5337 * @class Evented 5338 * @aka L.Evented 5339 * @inherits Class 5340 * 5341 * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event). 5342 * 5343 * @example 5344 * 5345 * ```js 5346 * map.on('click', function(e) { 5347 * alert(e.latlng); 5348 * } ); 5349 * ``` 5350 * 5351 * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function: 5352 * 5353 * ```js 5354 * function onClick(e) { ... } 5355 * 5356 * map.on('click', onClick); 5357 * map.off('click', onClick); 5358 * ``` 5359 */ 5360 5361var Events = { 5362 /* @method on(type: String, fn: Function, context?: Object): this 5363 * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`). 5364 * 5365 * @alternative 5366 * @method on(eventMap: Object): this 5367 * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 5368 */ 5369 on: function (types, fn, context) { 5370 5371 // types can be a map of types/handlers 5372 if (typeof types === 'object') { 5373 for (var type in types) { 5374 // we don't process space-separated events here for performance; 5375 // it's a hot path since Layer uses the on(obj) syntax 5376 this._on(type, types[type], fn); 5377 } 5378 5379 } else { 5380 // types can be a string of space-separated words 5381 types = splitWords(types); 5382 5383 for (var i = 0, len = types.length; i < len; i++) { 5384 this._on(types[i], fn, context); 5385 } 5386 } 5387 5388 return this; 5389 }, 5390 5391 /* @method off(type: String, fn?: Function, context?: Object): this 5392 * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener. 5393 * 5394 * @alternative 5395 * @method off(eventMap: Object): this 5396 * Removes a set of type/listener pairs. 5397 * 5398 * @alternative 5399 * @method off: this 5400 * Removes all listeners to all events on the object. This includes implicitly attached events. 5401 */ 5402 off: function (types, fn, context) { 5403 5404 if (!types) { 5405 // clear all listeners if called without arguments 5406 delete this._events; 5407 5408 } else if (typeof types === 'object') { 5409 for (var type in types) { 5410 this._off(type, types[type], fn); 5411 } 5412 5413 } else { 5414 types = splitWords(types); 5415 5416 for (var i = 0, len = types.length; i < len; i++) { 5417 this._off(types[i], fn, context); 5418 } 5419 } 5420 5421 return this; 5422 }, 5423 5424 // attach listener (without syntactic sugar now) 5425 _on: function (type, fn, context) { 5426 this._events = this._events || {}; 5427 5428 /* get/init listeners for type */ 5429 var typeListeners = this._events[type]; 5430 if (!typeListeners) { 5431 typeListeners = []; 5432 this._events[type] = typeListeners; 5433 } 5434 5435 if (context === this) { 5436 // Less memory footprint. 5437 context = undefined; 5438 } 5439 var newListener = {fn: fn, ctx: context}, 5440 listeners = typeListeners; 5441 5442 // check if fn already there 5443 for (var i = 0, len = listeners.length; i < len; i++) { 5444 if (listeners[i].fn === fn && listeners[i].ctx === context) { 5445 return; 5446 } 5447 } 5448 5449 listeners.push(newListener); 5450 }, 5451 5452 _off: function (type, fn, context) { 5453 var listeners, 5454 i, 5455 len; 5456 5457 if (!this._events) { return; } 5458 5459 listeners = this._events[type]; 5460 5461 if (!listeners) { 5462 return; 5463 } 5464 5465 if (!fn) { 5466 // Set all removed listeners to noop so they are not called if remove happens in fire 5467 for (i = 0, len = listeners.length; i < len; i++) { 5468 listeners[i].fn = falseFn; 5469 } 5470 // clear all listeners for a type if function isn't specified 5471 delete this._events[type]; 5472 return; 5473 } 5474 5475 if (context === this) { 5476 context = undefined; 5477 } 5478 5479 if (listeners) { 5480 5481 // find fn and remove it 5482 for (i = 0, len = listeners.length; i < len; i++) { 5483 var l = listeners[i]; 5484 if (l.ctx !== context) { continue; } 5485 if (l.fn === fn) { 5486 5487 // set the removed listener to noop so that's not called if remove happens in fire 5488 l.fn = falseFn; 5489 5490 if (this._firingCount) { 5491 /* copy array in case events are being fired */ 5492 this._events[type] = listeners = listeners.slice(); 5493 } 5494 listeners.splice(i, 1); 5495 5496 return; 5497 } 5498 } 5499 } 5500 }, 5501 5502 // @method fire(type: String, data?: Object, propagate?: Boolean): this 5503 // Fires an event of the specified type. You can optionally provide an data 5504 // object — the first argument of the listener function will contain its 5505 // properties. The event can optionally be propagated to event parents. 5506 fire: function (type, data, propagate) { 5507 if (!this.listens(type, propagate)) { return this; } 5508 5509 var event = extend({}, data, { 5510 type: type, 5511 target: this, 5512 sourceTarget: data && data.sourceTarget || this 5513 }); 5514 5515 if (this._events) { 5516 var listeners = this._events[type]; 5517 5518 if (listeners) { 5519 this._firingCount = (this._firingCount + 1) || 1; 5520 for (var i = 0, len = listeners.length; i < len; i++) { 5521 var l = listeners[i]; 5522 l.fn.call(l.ctx || this, event); 5523 } 5524 5525 this._firingCount--; 5526 } 5527 } 5528 5529 if (propagate) { 5530 // propagate the event to parents (set with addEventParent) 5531 this._propagateEvent(event); 5532 } 5533 5534 return this; 5535 }, 5536 5537 // @method listens(type: String): Boolean 5538 // Returns `true` if a particular event type has any listeners attached to it. 5539 listens: function (type, propagate) { 5540 var listeners = this._events && this._events[type]; 5541 if (listeners && listeners.length) { return true; } 5542 5543 if (propagate) { 5544 // also check parents for listeners if event propagates 5545 for (var id in this._eventParents) { 5546 if (this._eventParents[id].listens(type, propagate)) { return true; } 5547 } 5548 } 5549 return false; 5550 }, 5551 5552 // @method once(…): this 5553 // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed. 5554 once: function (types, fn, context) { 5555 5556 if (typeof types === 'object') { 5557 for (var type in types) { 5558 this.once(type, types[type], fn); 5559 } 5560 return this; 5561 } 5562 5563 var handler = bind(function () { 5564 this 5565 .off(types, fn, context) 5566 .off(types, handler, context); 5567 }, this); 5568 5569 // add a listener that's executed once and removed after that 5570 return this 5571 .on(types, fn, context) 5572 .on(types, handler, context); 5573 }, 5574 5575 // @method addEventParent(obj: Evented): this 5576 // Adds an event parent - an `Evented` that will receive propagated events 5577 addEventParent: function (obj) { 5578 this._eventParents = this._eventParents || {}; 5579 this._eventParents[stamp(obj)] = obj; 5580 return this; 5581 }, 5582 5583 // @method removeEventParent(obj: Evented): this 5584 // Removes an event parent, so it will stop receiving propagated events 5585 removeEventParent: function (obj) { 5586 if (this._eventParents) { 5587 delete this._eventParents[stamp(obj)]; 5588 } 5589 return this; 5590 }, 5591 5592 _propagateEvent: function (e) { 5593 for (var id in this._eventParents) { 5594 this._eventParents[id].fire(e.type, extend({ 5595 layer: e.target, 5596 propagatedFrom: e.target 5597 }, e), true); 5598 } 5599 } 5600}; 5601 5602// aliases; we should ditch those eventually 5603 5604// @method addEventListener(…): this 5605// Alias to [`on(…)`](#evented-on) 5606Events.addEventListener = Events.on; 5607 5608// @method removeEventListener(…): this 5609// Alias to [`off(…)`](#evented-off) 5610 5611// @method clearAllEventListeners(…): this 5612// Alias to [`off()`](#evented-off) 5613Events.removeEventListener = Events.clearAllEventListeners = Events.off; 5614 5615// @method addOneTimeEventListener(…): this 5616// Alias to [`once(…)`](#evented-once) 5617Events.addOneTimeEventListener = Events.once; 5618 5619// @method fireEvent(…): this 5620// Alias to [`fire(…)`](#evented-fire) 5621Events.fireEvent = Events.fire; 5622 5623// @method hasEventListeners(…): Boolean 5624// Alias to [`listens(…)`](#evented-listens) 5625Events.hasEventListeners = Events.listens; 5626 5627var Evented = Class.extend(Events); 5628 5629/* 5630 * @class Point 5631 * @aka L.Point 5632 * 5633 * Represents a point with `x` and `y` coordinates in pixels. 5634 * 5635 * @example 5636 * 5637 * ```js 5638 * var point = L.point(200, 300); 5639 * ``` 5640 * 5641 * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent: 5642 * 5643 * ```js 5644 * map.panBy([200, 300]); 5645 * map.panBy(L.point(200, 300)); 5646 * ``` 5647 * 5648 * Note that `Point` does not inherit from Leafet's `Class` object, 5649 * which means new classes can't inherit from it, and new methods 5650 * can't be added to it with the `include` function. 5651 */ 5652 5653function Point(x, y, round) { 5654 // @property x: Number; The `x` coordinate of the point 5655 this.x = (round ? Math.round(x) : x); 5656 // @property y: Number; The `y` coordinate of the point 5657 this.y = (round ? Math.round(y) : y); 5658} 5659 5660var trunc = Math.trunc || function (v) { 5661 return v > 0 ? Math.floor(v) : Math.ceil(v); 5662}; 5663 5664Point.prototype = { 5665 5666 // @method clone(): Point 5667 // Returns a copy of the current point. 5668 clone: function () { 5669 return new Point(this.x, this.y); 5670 }, 5671 5672 // @method add(otherPoint: Point): Point 5673 // Returns the result of addition of the current and the given points. 5674 add: function (point) { 5675 // non-destructive, returns a new point 5676 return this.clone()._add(toPoint(point)); 5677 }, 5678 5679 _add: function (point) { 5680 // destructive, used directly for performance in situations where it's safe to modify existing point 5681 this.x += point.x; 5682 this.y += point.y; 5683 return this; 5684 }, 5685 5686 // @method subtract(otherPoint: Point): Point 5687 // Returns the result of subtraction of the given point from the current. 5688 subtract: function (point) { 5689 return this.clone()._subtract(toPoint(point)); 5690 }, 5691 5692 _subtract: function (point) { 5693 this.x -= point.x; 5694 this.y -= point.y; 5695 return this; 5696 }, 5697 5698 // @method divideBy(num: Number): Point 5699 // Returns the result of division of the current point by the given number. 5700 divideBy: function (num) { 5701 return this.clone()._divideBy(num); 5702 }, 5703 5704 _divideBy: function (num) { 5705 this.x /= num; 5706 this.y /= num; 5707 return this; 5708 }, 5709 5710 // @method multiplyBy(num: Number): Point 5711 // Returns the result of multiplication of the current point by the given number. 5712 multiplyBy: function (num) { 5713 return this.clone()._multiplyBy(num); 5714 }, 5715 5716 _multiplyBy: function (num) { 5717 this.x *= num; 5718 this.y *= num; 5719 return this; 5720 }, 5721 5722 // @method scaleBy(scale: Point): Point 5723 // Multiply each coordinate of the current point by each coordinate of 5724 // `scale`. In linear algebra terms, multiply the point by the 5725 // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation) 5726 // defined by `scale`. 5727 scaleBy: function (point) { 5728 return new Point(this.x * point.x, this.y * point.y); 5729 }, 5730 5731 // @method unscaleBy(scale: Point): Point 5732 // Inverse of `scaleBy`. Divide each coordinate of the current point by 5733 // each coordinate of `scale`. 5734 unscaleBy: function (point) { 5735 return new Point(this.x / point.x, this.y / point.y); 5736 }, 5737 5738 // @method round(): Point 5739 // Returns a copy of the current point with rounded coordinates. 5740 round: function () { 5741 return this.clone()._round(); 5742 }, 5743 5744 _round: function () { 5745 this.x = Math.round(this.x); 5746 this.y = Math.round(this.y); 5747 return this; 5748 }, 5749 5750 // @method floor(): Point 5751 // Returns a copy of the current point with floored coordinates (rounded down). 5752 floor: function () { 5753 return this.clone()._floor(); 5754 }, 5755 5756 _floor: function () { 5757 this.x = Math.floor(this.x); 5758 this.y = Math.floor(this.y); 5759 return this; 5760 }, 5761 5762 // @method ceil(): Point 5763 // Returns a copy of the current point with ceiled coordinates (rounded up). 5764 ceil: function () { 5765 return this.clone()._ceil(); 5766 }, 5767 5768 _ceil: function () { 5769 this.x = Math.ceil(this.x); 5770 this.y = Math.ceil(this.y); 5771 return this; 5772 }, 5773 5774 // @method trunc(): Point 5775 // Returns a copy of the current point with truncated coordinates (rounded towards zero). 5776 trunc: function () { 5777 return this.clone()._trunc(); 5778 }, 5779 5780 _trunc: function () { 5781 this.x = trunc(this.x); 5782 this.y = trunc(this.y); 5783 return this; 5784 }, 5785 5786 // @method distanceTo(otherPoint: Point): Number 5787 // Returns the cartesian distance between the current and the given points. 5788 distanceTo: function (point) { 5789 point = toPoint(point); 5790 5791 var x = point.x - this.x, 5792 y = point.y - this.y; 5793 5794 return Math.sqrt(x * x + y * y); 5795 }, 5796 5797 // @method equals(otherPoint: Point): Boolean 5798 // Returns `true` if the given point has the same coordinates. 5799 equals: function (point) { 5800 point = toPoint(point); 5801 5802 return point.x === this.x && 5803 point.y === this.y; 5804 }, 5805 5806 // @method contains(otherPoint: Point): Boolean 5807 // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values). 5808 contains: function (point) { 5809 point = toPoint(point); 5810 5811 return Math.abs(point.x) <= Math.abs(this.x) && 5812 Math.abs(point.y) <= Math.abs(this.y); 5813 }, 5814 5815 // @method toString(): String 5816 // Returns a string representation of the point for debugging purposes. 5817 toString: function () { 5818 return 'Point(' + 5819 formatNum(this.x) + ', ' + 5820 formatNum(this.y) + ')'; 5821 } 5822}; 5823 5824// @factory L.point(x: Number, y: Number, round?: Boolean) 5825// Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values. 5826 5827// @alternative 5828// @factory L.point(coords: Number[]) 5829// Expects an array of the form `[x, y]` instead. 5830 5831// @alternative 5832// @factory L.point(coords: Object) 5833// Expects a plain object of the form `{x: Number, y: Number}` instead. 5834function toPoint(x, y, round) { 5835 if (x instanceof Point) { 5836 return x; 5837 } 5838 if (isArray(x)) { 5839 return new Point(x[0], x[1]); 5840 } 5841 if (x === undefined || x === null) { 5842 return x; 5843 } 5844 if (typeof x === 'object' && 'x' in x && 'y' in x) { 5845 return new Point(x.x, x.y); 5846 } 5847 return new Point(x, y, round); 5848} 5849 5850/* 5851 * @class Bounds 5852 * @aka L.Bounds 5853 * 5854 * Represents a rectangular area in pixel coordinates. 5855 * 5856 * @example 5857 * 5858 * ```js 5859 * var p1 = L.point(10, 10), 5860 * p2 = L.point(40, 60), 5861 * bounds = L.bounds(p1, p2); 5862 * ``` 5863 * 5864 * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: 5865 * 5866 * ```js 5867 * otherBounds.intersects([[10, 10], [40, 60]]); 5868 * ``` 5869 * 5870 * Note that `Bounds` does not inherit from Leafet's `Class` object, 5871 * which means new classes can't inherit from it, and new methods 5872 * can't be added to it with the `include` function. 5873 */ 5874 5875function Bounds(a, b) { 5876 if (!a) { return; } 5877 5878 var points = b ? [a, b] : a; 5879 5880 for (var i = 0, len = points.length; i < len; i++) { 5881 this.extend(points[i]); 5882 } 5883} 5884 5885Bounds.prototype = { 5886 // @method extend(point: Point): this 5887 // Extends the bounds to contain the given point. 5888 extend: function (point) { // (Point) 5889 point = toPoint(point); 5890 5891 // @property min: Point 5892 // The top left corner of the rectangle. 5893 // @property max: Point 5894 // The bottom right corner of the rectangle. 5895 if (!this.min && !this.max) { 5896 this.min = point.clone(); 5897 this.max = point.clone(); 5898 } else { 5899 this.min.x = Math.min(point.x, this.min.x); 5900 this.max.x = Math.max(point.x, this.max.x); 5901 this.min.y = Math.min(point.y, this.min.y); 5902 this.max.y = Math.max(point.y, this.max.y); 5903 } 5904 return this; 5905 }, 5906 5907 // @method getCenter(round?: Boolean): Point 5908 // Returns the center point of the bounds. 5909 getCenter: function (round) { 5910 return new Point( 5911 (this.min.x + this.max.x) / 2, 5912 (this.min.y + this.max.y) / 2, round); 5913 }, 5914 5915 // @method getBottomLeft(): Point 5916 // Returns the bottom-left point of the bounds. 5917 getBottomLeft: function () { 5918 return new Point(this.min.x, this.max.y); 5919 }, 5920 5921 // @method getTopRight(): Point 5922 // Returns the top-right point of the bounds. 5923 getTopRight: function () { // -> Point 5924 return new Point(this.max.x, this.min.y); 5925 }, 5926 5927 // @method getTopLeft(): Point 5928 // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)). 5929 getTopLeft: function () { 5930 return this.min; // left, top 5931 }, 5932 5933 // @method getBottomRight(): Point 5934 // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)). 5935 getBottomRight: function () { 5936 return this.max; // right, bottom 5937 }, 5938 5939 // @method getSize(): Point 5940 // Returns the size of the given bounds 5941 getSize: function () { 5942 return this.max.subtract(this.min); 5943 }, 5944 5945 // @method contains(otherBounds: Bounds): Boolean 5946 // Returns `true` if the rectangle contains the given one. 5947 // @alternative 5948 // @method contains(point: Point): Boolean 5949 // Returns `true` if the rectangle contains the given point. 5950 contains: function (obj) { 5951 var min, max; 5952 5953 if (typeof obj[0] === 'number' || obj instanceof Point) { 5954 obj = toPoint(obj); 5955 } else { 5956 obj = toBounds(obj); 5957 } 5958 5959 if (obj instanceof Bounds) { 5960 min = obj.min; 5961 max = obj.max; 5962 } else { 5963 min = max = obj; 5964 } 5965 5966 return (min.x >= this.min.x) && 5967 (max.x <= this.max.x) && 5968 (min.y >= this.min.y) && 5969 (max.y <= this.max.y); 5970 }, 5971 5972 // @method intersects(otherBounds: Bounds): Boolean 5973 // Returns `true` if the rectangle intersects the given bounds. Two bounds 5974 // intersect if they have at least one point in common. 5975 intersects: function (bounds) { // (Bounds) -> Boolean 5976 bounds = toBounds(bounds); 5977 5978 var min = this.min, 5979 max = this.max, 5980 min2 = bounds.min, 5981 max2 = bounds.max, 5982 xIntersects = (max2.x >= min.x) && (min2.x <= max.x), 5983 yIntersects = (max2.y >= min.y) && (min2.y <= max.y); 5984 5985 return xIntersects && yIntersects; 5986 }, 5987 5988 // @method overlaps(otherBounds: Bounds): Boolean 5989 // Returns `true` if the rectangle overlaps the given bounds. Two bounds 5990 // overlap if their intersection is an area. 5991 overlaps: function (bounds) { // (Bounds) -> Boolean 5992 bounds = toBounds(bounds); 5993 5994 var min = this.min, 5995 max = this.max, 5996 min2 = bounds.min, 5997 max2 = bounds.max, 5998 xOverlaps = (max2.x > min.x) && (min2.x < max.x), 5999 yOverlaps = (max2.y > min.y) && (min2.y < max.y); 6000 6001 return xOverlaps && yOverlaps; 6002 }, 6003 6004 isValid: function () { 6005 return !!(this.min && this.max); 6006 } 6007}; 6008 6009 6010// @factory L.bounds(corner1: Point, corner2: Point) 6011// Creates a Bounds object from two corners coordinate pairs. 6012// @alternative 6013// @factory L.bounds(points: Point[]) 6014// Creates a Bounds object from the given array of points. 6015function toBounds(a, b) { 6016 if (!a || a instanceof Bounds) { 6017 return a; 6018 } 6019 return new Bounds(a, b); 6020} 6021 6022/* 6023 * @class LatLngBounds 6024 * @aka L.LatLngBounds 6025 * 6026 * Represents a rectangular geographical area on a map. 6027 * 6028 * @example 6029 * 6030 * ```js 6031 * var corner1 = L.latLng(40.712, -74.227), 6032 * corner2 = L.latLng(40.774, -74.125), 6033 * bounds = L.latLngBounds(corner1, corner2); 6034 * ``` 6035 * 6036 * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: 6037 * 6038 * ```js 6039 * map.fitBounds([ 6040 * [40.712, -74.227], 6041 * [40.774, -74.125] 6042 * ]); 6043 * ``` 6044 * 6045 * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range. 6046 * 6047 * Note that `LatLngBounds` does not inherit from Leafet's `Class` object, 6048 * which means new classes can't inherit from it, and new methods 6049 * can't be added to it with the `include` function. 6050 */ 6051 6052function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[]) 6053 if (!corner1) { return; } 6054 6055 var latlngs = corner2 ? [corner1, corner2] : corner1; 6056 6057 for (var i = 0, len = latlngs.length; i < len; i++) { 6058 this.extend(latlngs[i]); 6059 } 6060} 6061 6062LatLngBounds.prototype = { 6063 6064 // @method extend(latlng: LatLng): this 6065 // Extend the bounds to contain the given point 6066 6067 // @alternative 6068 // @method extend(otherBounds: LatLngBounds): this 6069 // Extend the bounds to contain the given bounds 6070 extend: function (obj) { 6071 var sw = this._southWest, 6072 ne = this._northEast, 6073 sw2, ne2; 6074 6075 if (obj instanceof LatLng) { 6076 sw2 = obj; 6077 ne2 = obj; 6078 6079 } else if (obj instanceof LatLngBounds) { 6080 sw2 = obj._southWest; 6081 ne2 = obj._northEast; 6082 6083 if (!sw2 || !ne2) { return this; } 6084 6085 } else { 6086 return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this; 6087 } 6088 6089 if (!sw && !ne) { 6090 this._southWest = new LatLng(sw2.lat, sw2.lng); 6091 this._northEast = new LatLng(ne2.lat, ne2.lng); 6092 } else { 6093 sw.lat = Math.min(sw2.lat, sw.lat); 6094 sw.lng = Math.min(sw2.lng, sw.lng); 6095 ne.lat = Math.max(ne2.lat, ne.lat); 6096 ne.lng = Math.max(ne2.lng, ne.lng); 6097 } 6098 6099 return this; 6100 }, 6101 6102 // @method pad(bufferRatio: Number): LatLngBounds 6103 // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction. 6104 // For example, a ratio of 0.5 extends the bounds by 50% in each direction. 6105 // Negative values will retract the bounds. 6106 pad: function (bufferRatio) { 6107 var sw = this._southWest, 6108 ne = this._northEast, 6109 heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio, 6110 widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio; 6111 6112 return new LatLngBounds( 6113 new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), 6114 new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer)); 6115 }, 6116 6117 // @method getCenter(): LatLng 6118 // Returns the center point of the bounds. 6119 getCenter: function () { 6120 return new LatLng( 6121 (this._southWest.lat + this._northEast.lat) / 2, 6122 (this._southWest.lng + this._northEast.lng) / 2); 6123 }, 6124 6125 // @method getSouthWest(): LatLng 6126 // Returns the south-west point of the bounds. 6127 getSouthWest: function () { 6128 return this._southWest; 6129 }, 6130 6131 // @method getNorthEast(): LatLng 6132 // Returns the north-east point of the bounds. 6133 getNorthEast: function () { 6134 return this._northEast; 6135 }, 6136 6137 // @method getNorthWest(): LatLng 6138 // Returns the north-west point of the bounds. 6139 getNorthWest: function () { 6140 return new LatLng(this.getNorth(), this.getWest()); 6141 }, 6142 6143 // @method getSouthEast(): LatLng 6144 // Returns the south-east point of the bounds. 6145 getSouthEast: function () { 6146 return new LatLng(this.getSouth(), this.getEast()); 6147 }, 6148 6149 // @method getWest(): Number 6150 // Returns the west longitude of the bounds 6151 getWest: function () { 6152 return this._southWest.lng; 6153 }, 6154 6155 // @method getSouth(): Number 6156 // Returns the south latitude of the bounds 6157 getSouth: function () { 6158 return this._southWest.lat; 6159 }, 6160 6161 // @method getEast(): Number 6162 // Returns the east longitude of the bounds 6163 getEast: function () { 6164 return this._northEast.lng; 6165 }, 6166 6167 // @method getNorth(): Number 6168 // Returns the north latitude of the bounds 6169 getNorth: function () { 6170 return this._northEast.lat; 6171 }, 6172 6173 // @method contains(otherBounds: LatLngBounds): Boolean 6174 // Returns `true` if the rectangle contains the given one. 6175 6176 // @alternative 6177 // @method contains (latlng: LatLng): Boolean 6178 // Returns `true` if the rectangle contains the given point. 6179 contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean 6180 if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) { 6181 obj = toLatLng(obj); 6182 } else { 6183 obj = toLatLngBounds(obj); 6184 } 6185 6186 var sw = this._southWest, 6187 ne = this._northEast, 6188 sw2, ne2; 6189 6190 if (obj instanceof LatLngBounds) { 6191 sw2 = obj.getSouthWest(); 6192 ne2 = obj.getNorthEast(); 6193 } else { 6194 sw2 = ne2 = obj; 6195 } 6196 6197 return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) && 6198 (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng); 6199 }, 6200 6201 // @method intersects(otherBounds: LatLngBounds): Boolean 6202 // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common. 6203 intersects: function (bounds) { 6204 bounds = toLatLngBounds(bounds); 6205 6206 var sw = this._southWest, 6207 ne = this._northEast, 6208 sw2 = bounds.getSouthWest(), 6209 ne2 = bounds.getNorthEast(), 6210 6211 latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat), 6212 lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng); 6213 6214 return latIntersects && lngIntersects; 6215 }, 6216 6217 // @method overlaps(otherBounds: Bounds): Boolean 6218 // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area. 6219 overlaps: function (bounds) { 6220 bounds = toLatLngBounds(bounds); 6221 6222 var sw = this._southWest, 6223 ne = this._northEast, 6224 sw2 = bounds.getSouthWest(), 6225 ne2 = bounds.getNorthEast(), 6226 6227 latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat), 6228 lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng); 6229 6230 return latOverlaps && lngOverlaps; 6231 }, 6232 6233 // @method toBBoxString(): String 6234 // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data. 6235 toBBoxString: function () { 6236 return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(','); 6237 }, 6238 6239 // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean 6240 // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number. 6241 equals: function (bounds, maxMargin) { 6242 if (!bounds) { return false; } 6243 6244 bounds = toLatLngBounds(bounds); 6245 6246 return this._southWest.equals(bounds.getSouthWest(), maxMargin) && 6247 this._northEast.equals(bounds.getNorthEast(), maxMargin); 6248 }, 6249 6250 // @method isValid(): Boolean 6251 // Returns `true` if the bounds are properly initialized. 6252 isValid: function () { 6253 return !!(this._southWest && this._northEast); 6254 } 6255}; 6256 6257// TODO International date line? 6258 6259// @factory L.latLngBounds(corner1: LatLng, corner2: LatLng) 6260// Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle. 6261 6262// @alternative 6263// @factory L.latLngBounds(latlngs: LatLng[]) 6264// Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds). 6265function toLatLngBounds(a, b) { 6266 if (a instanceof LatLngBounds) { 6267 return a; 6268 } 6269 return new LatLngBounds(a, b); 6270} 6271 6272/* @class LatLng 6273 * @aka L.LatLng 6274 * 6275 * Represents a geographical point with a certain latitude and longitude. 6276 * 6277 * @example 6278 * 6279 * ``` 6280 * var latlng = L.latLng(50.5, 30.5); 6281 * ``` 6282 * 6283 * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent: 6284 * 6285 * ``` 6286 * map.panTo([50, 30]); 6287 * map.panTo({lon: 30, lat: 50}); 6288 * map.panTo({lat: 50, lng: 30}); 6289 * map.panTo(L.latLng(50, 30)); 6290 * ``` 6291 * 6292 * Note that `LatLng` does not inherit from Leaflet's `Class` object, 6293 * which means new classes can't inherit from it, and new methods 6294 * can't be added to it with the `include` function. 6295 */ 6296 6297function LatLng(lat, lng, alt) { 6298 if (isNaN(lat) || isNaN(lng)) { 6299 throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')'); 6300 } 6301 6302 // @property lat: Number 6303 // Latitude in degrees 6304 this.lat = +lat; 6305 6306 // @property lng: Number 6307 // Longitude in degrees 6308 this.lng = +lng; 6309 6310 // @property alt: Number 6311 // Altitude in meters (optional) 6312 if (alt !== undefined) { 6313 this.alt = +alt; 6314 } 6315} 6316 6317LatLng.prototype = { 6318 // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean 6319 // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number. 6320 equals: function (obj, maxMargin) { 6321 if (!obj) { return false; } 6322 6323 obj = toLatLng(obj); 6324 6325 var margin = Math.max( 6326 Math.abs(this.lat - obj.lat), 6327 Math.abs(this.lng - obj.lng)); 6328 6329 return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin); 6330 }, 6331 6332 // @method toString(): String 6333 // Returns a string representation of the point (for debugging purposes). 6334 toString: function (precision) { 6335 return 'LatLng(' + 6336 formatNum(this.lat, precision) + ', ' + 6337 formatNum(this.lng, precision) + ')'; 6338 }, 6339 6340 // @method distanceTo(otherLatLng: LatLng): Number 6341 // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines). 6342 distanceTo: function (other) { 6343 return Earth.distance(this, toLatLng(other)); 6344 }, 6345 6346 // @method wrap(): LatLng 6347 // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees. 6348 wrap: function () { 6349 return Earth.wrapLatLng(this); 6350 }, 6351 6352 // @method toBounds(sizeInMeters: Number): LatLngBounds 6353 // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`. 6354 toBounds: function (sizeInMeters) { 6355 var latAccuracy = 180 * sizeInMeters / 40075017, 6356 lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat); 6357 6358 return toLatLngBounds( 6359 [this.lat - latAccuracy, this.lng - lngAccuracy], 6360 [this.lat + latAccuracy, this.lng + lngAccuracy]); 6361 }, 6362 6363 clone: function () { 6364 return new LatLng(this.lat, this.lng, this.alt); 6365 } 6366}; 6367 6368 6369 6370// @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng 6371// Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude). 6372 6373// @alternative 6374// @factory L.latLng(coords: Array): LatLng 6375// Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead. 6376 6377// @alternative 6378// @factory L.latLng(coords: Object): LatLng 6379// Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead. 6380 6381function toLatLng(a, b, c) { 6382 if (a instanceof LatLng) { 6383 return a; 6384 } 6385 if (isArray(a) && typeof a[0] !== 'object') { 6386 if (a.length === 3) { 6387 return new LatLng(a[0], a[1], a[2]); 6388 } 6389 if (a.length === 2) { 6390 return new LatLng(a[0], a[1]); 6391 } 6392 return null; 6393 } 6394 if (a === undefined || a === null) { 6395 return a; 6396 } 6397 if (typeof a === 'object' && 'lat' in a) { 6398 return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt); 6399 } 6400 if (b === undefined) { 6401 return null; 6402 } 6403 return new LatLng(a, b, c); 6404} 6405 6406/* 6407 * @namespace CRS 6408 * @crs L.CRS.Base 6409 * Object that defines coordinate reference systems for projecting 6410 * geographical points into pixel (screen) coordinates and back (and to 6411 * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See 6412 * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system). 6413 * 6414 * Leaflet defines the most usual CRSs by default. If you want to use a 6415 * CRS not defined by default, take a look at the 6416 * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin. 6417 * 6418 * Note that the CRS instances do not inherit from Leafet's `Class` object, 6419 * and can't be instantiated. Also, new classes can't inherit from them, 6420 * and methods can't be added to them with the `include` function. 6421 */ 6422 6423var CRS = { 6424 // @method latLngToPoint(latlng: LatLng, zoom: Number): Point 6425 // Projects geographical coordinates into pixel coordinates for a given zoom. 6426 latLngToPoint: function (latlng, zoom) { 6427 var projectedPoint = this.projection.project(latlng), 6428 scale = this.scale(zoom); 6429 6430 return this.transformation._transform(projectedPoint, scale); 6431 }, 6432 6433 // @method pointToLatLng(point: Point, zoom: Number): LatLng 6434 // The inverse of `latLngToPoint`. Projects pixel coordinates on a given 6435 // zoom into geographical coordinates. 6436 pointToLatLng: function (point, zoom) { 6437 var scale = this.scale(zoom), 6438 untransformedPoint = this.transformation.untransform(point, scale); 6439 6440 return this.projection.unproject(untransformedPoint); 6441 }, 6442 6443 // @method project(latlng: LatLng): Point 6444 // Projects geographical coordinates into coordinates in units accepted for 6445 // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services). 6446 project: function (latlng) { 6447 return this.projection.project(latlng); 6448 }, 6449 6450 // @method unproject(point: Point): LatLng 6451 // Given a projected coordinate returns the corresponding LatLng. 6452 // The inverse of `project`. 6453 unproject: function (point) { 6454 return this.projection.unproject(point); 6455 }, 6456 6457 // @method scale(zoom: Number): Number 6458 // Returns the scale used when transforming projected coordinates into 6459 // pixel coordinates for a particular zoom. For example, it returns 6460 // `256 * 2^zoom` for Mercator-based CRS. 6461 scale: function (zoom) { 6462 return 256 * Math.pow(2, zoom); 6463 }, 6464 6465 // @method zoom(scale: Number): Number 6466 // Inverse of `scale()`, returns the zoom level corresponding to a scale 6467 // factor of `scale`. 6468 zoom: function (scale) { 6469 return Math.log(scale / 256) / Math.LN2; 6470 }, 6471 6472 // @method getProjectedBounds(zoom: Number): Bounds 6473 // Returns the projection's bounds scaled and transformed for the provided `zoom`. 6474 getProjectedBounds: function (zoom) { 6475 if (this.infinite) { return null; } 6476 6477 var b = this.projection.bounds, 6478 s = this.scale(zoom), 6479 min = this.transformation.transform(b.min, s), 6480 max = this.transformation.transform(b.max, s); 6481 6482 return new Bounds(min, max); 6483 }, 6484 6485 // @method distance(latlng1: LatLng, latlng2: LatLng): Number 6486 // Returns the distance between two geographical coordinates. 6487 6488 // @property code: String 6489 // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`) 6490 // 6491 // @property wrapLng: Number[] 6492 // An array of two numbers defining whether the longitude (horizontal) coordinate 6493 // axis wraps around a given range and how. Defaults to `[-180, 180]` in most 6494 // geographical CRSs. If `undefined`, the longitude axis does not wrap around. 6495 // 6496 // @property wrapLat: Number[] 6497 // Like `wrapLng`, but for the latitude (vertical) axis. 6498 6499 // wrapLng: [min, max], 6500 // wrapLat: [min, max], 6501 6502 // @property infinite: Boolean 6503 // If true, the coordinate space will be unbounded (infinite in both axes) 6504 infinite: false, 6505 6506 // @method wrapLatLng(latlng: LatLng): LatLng 6507 // Returns a `LatLng` where lat and lng has been wrapped according to the 6508 // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds. 6509 wrapLatLng: function (latlng) { 6510 var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng, 6511 lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat, 6512 alt = latlng.alt; 6513 6514 return new LatLng(lat, lng, alt); 6515 }, 6516 6517 // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds 6518 // Returns a `LatLngBounds` with the same size as the given one, ensuring 6519 // that its center is within the CRS's bounds. 6520 // Only accepts actual `L.LatLngBounds` instances, not arrays. 6521 wrapLatLngBounds: function (bounds) { 6522 var center = bounds.getCenter(), 6523 newCenter = this.wrapLatLng(center), 6524 latShift = center.lat - newCenter.lat, 6525 lngShift = center.lng - newCenter.lng; 6526 6527 if (latShift === 0 && lngShift === 0) { 6528 return bounds; 6529 } 6530 6531 var sw = bounds.getSouthWest(), 6532 ne = bounds.getNorthEast(), 6533 newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift), 6534 newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift); 6535 6536 return new LatLngBounds(newSw, newNe); 6537 } 6538}; 6539 6540/* 6541 * @namespace CRS 6542 * @crs L.CRS.Earth 6543 * 6544 * Serves as the base for CRS that are global such that they cover the earth. 6545 * Can only be used as the base for other CRS and cannot be used directly, 6546 * since it does not have a `code`, `projection` or `transformation`. `distance()` returns 6547 * meters. 6548 */ 6549 6550var Earth = extend({}, CRS, { 6551 wrapLng: [-180, 180], 6552 6553 // Mean Earth Radius, as recommended for use by 6554 // the International Union of Geodesy and Geophysics, 6555 // see http://rosettacode.org/wiki/Haversine_formula 6556 R: 6371000, 6557 6558 // distance between two geographical points using spherical law of cosines approximation 6559 distance: function (latlng1, latlng2) { 6560 var rad = Math.PI / 180, 6561 lat1 = latlng1.lat * rad, 6562 lat2 = latlng2.lat * rad, 6563 sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2), 6564 sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2), 6565 a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon, 6566 c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 6567 return this.R * c; 6568 } 6569}); 6570 6571/* 6572 * @namespace Projection 6573 * @projection L.Projection.SphericalMercator 6574 * 6575 * Spherical Mercator projection — the most common projection for online maps, 6576 * used by almost all free and commercial tile providers. Assumes that Earth is 6577 * a sphere. Used by the `EPSG:3857` CRS. 6578 */ 6579 6580var earthRadius = 6378137; 6581 6582var SphericalMercator = { 6583 6584 R: earthRadius, 6585 MAX_LATITUDE: 85.0511287798, 6586 6587 project: function (latlng) { 6588 var d = Math.PI / 180, 6589 max = this.MAX_LATITUDE, 6590 lat = Math.max(Math.min(max, latlng.lat), -max), 6591 sin = Math.sin(lat * d); 6592 6593 return new Point( 6594 this.R * latlng.lng * d, 6595 this.R * Math.log((1 + sin) / (1 - sin)) / 2); 6596 }, 6597 6598 unproject: function (point) { 6599 var d = 180 / Math.PI; 6600 6601 return new LatLng( 6602 (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d, 6603 point.x * d / this.R); 6604 }, 6605 6606 bounds: (function () { 6607 var d = earthRadius * Math.PI; 6608 return new Bounds([-d, -d], [d, d]); 6609 })() 6610}; 6611 6612/* 6613 * @class Transformation 6614 * @aka L.Transformation 6615 * 6616 * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d` 6617 * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing 6618 * the reverse. Used by Leaflet in its projections code. 6619 * 6620 * @example 6621 * 6622 * ```js 6623 * var transformation = L.transformation(2, 5, -1, 10), 6624 * p = L.point(1, 2), 6625 * p2 = transformation.transform(p), // L.point(7, 8) 6626 * p3 = transformation.untransform(p2); // L.point(1, 2) 6627 * ``` 6628 */ 6629 6630 6631// factory new L.Transformation(a: Number, b: Number, c: Number, d: Number) 6632// Creates a `Transformation` object with the given coefficients. 6633function Transformation(a, b, c, d) { 6634 if (isArray(a)) { 6635 // use array properties 6636 this._a = a[0]; 6637 this._b = a[1]; 6638 this._c = a[2]; 6639 this._d = a[3]; 6640 return; 6641 } 6642 this._a = a; 6643 this._b = b; 6644 this._c = c; 6645 this._d = d; 6646} 6647 6648Transformation.prototype = { 6649 // @method transform(point: Point, scale?: Number): Point 6650 // Returns a transformed point, optionally multiplied by the given scale. 6651 // Only accepts actual `L.Point` instances, not arrays. 6652 transform: function (point, scale) { // (Point, Number) -> Point 6653 return this._transform(point.clone(), scale); 6654 }, 6655 6656 // destructive transform (faster) 6657 _transform: function (point, scale) { 6658 scale = scale || 1; 6659 point.x = scale * (this._a * point.x + this._b); 6660 point.y = scale * (this._c * point.y + this._d); 6661 return point; 6662 }, 6663 6664 // @method untransform(point: Point, scale?: Number): Point 6665 // Returns the reverse transformation of the given point, optionally divided 6666 // by the given scale. Only accepts actual `L.Point` instances, not arrays. 6667 untransform: function (point, scale) { 6668 scale = scale || 1; 6669 return new Point( 6670 (point.x / scale - this._b) / this._a, 6671 (point.y / scale - this._d) / this._c); 6672 } 6673}; 6674 6675// factory L.transformation(a: Number, b: Number, c: Number, d: Number) 6676 6677// @factory L.transformation(a: Number, b: Number, c: Number, d: Number) 6678// Instantiates a Transformation object with the given coefficients. 6679 6680// @alternative 6681// @factory L.transformation(coefficients: Array): Transformation 6682// Expects an coefficients array of the form 6683// `[a: Number, b: Number, c: Number, d: Number]`. 6684 6685function toTransformation(a, b, c, d) { 6686 return new Transformation(a, b, c, d); 6687} 6688 6689/* 6690 * @namespace CRS 6691 * @crs L.CRS.EPSG3857 6692 * 6693 * The most common CRS for online maps, used by almost all free and commercial 6694 * tile providers. Uses Spherical Mercator projection. Set in by default in 6695 * Map's `crs` option. 6696 */ 6697 6698var EPSG3857 = extend({}, Earth, { 6699 code: 'EPSG:3857', 6700 projection: SphericalMercator, 6701 6702 transformation: (function () { 6703 var scale = 0.5 / (Math.PI * SphericalMercator.R); 6704 return toTransformation(scale, 0.5, -scale, 0.5); 6705 }()) 6706}); 6707 6708var EPSG900913 = extend({}, EPSG3857, { 6709 code: 'EPSG:900913' 6710}); 6711 6712// @namespace SVG; @section 6713// There are several static functions which can be called without instantiating L.SVG: 6714 6715// @function create(name: String): SVGElement 6716// Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement), 6717// corresponding to the class name passed. For example, using 'line' will return 6718// an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement). 6719function svgCreate(name) { 6720 return document.createElementNS('http://www.w3.org/2000/svg', name); 6721} 6722 6723// @function pointsToPath(rings: Point[], closed: Boolean): String 6724// Generates a SVG path string for multiple rings, with each ring turning 6725// into "M..L..L.." instructions 6726function pointsToPath(rings, closed) { 6727 var str = '', 6728 i, j, len, len2, points, p; 6729 6730 for (i = 0, len = rings.length; i < len; i++) { 6731 points = rings[i]; 6732 6733 for (j = 0, len2 = points.length; j < len2; j++) { 6734 p = points[j]; 6735 str += (j ? 'L' : 'M') + p.x + ' ' + p.y; 6736 } 6737 6738 // closes the ring for polygons; "x" is VML syntax 6739 str += closed ? (svg ? 'z' : 'x') : ''; 6740 } 6741 6742 // SVG complains about empty path strings 6743 return str || 'M0 0'; 6744} 6745 6746/* 6747 * @namespace Browser 6748 * @aka L.Browser 6749 * 6750 * A namespace with static properties for browser/feature detection used by Leaflet internally. 6751 * 6752 * @example 6753 * 6754 * ```js 6755 * if (L.Browser.ielt9) { 6756 * alert('Upgrade your browser, dude!'); 6757 * } 6758 * ``` 6759 */ 6760 6761var style$1 = document.documentElement.style; 6762 6763// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge). 6764var ie = 'ActiveXObject' in window; 6765 6766// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9. 6767var ielt9 = ie && !document.addEventListener; 6768 6769// @property edge: Boolean; `true` for the Edge web browser. 6770var edge = 'msLaunchUri' in navigator && !('documentMode' in document); 6771 6772// @property webkit: Boolean; 6773// `true` for webkit-based browsers like Chrome and Safari (including mobile versions). 6774var webkit = userAgentContains('webkit'); 6775 6776// @property android: Boolean 6777// `true` for any browser running on an Android platform. 6778var android = userAgentContains('android'); 6779 6780// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3. 6781var android23 = userAgentContains('android 2') || userAgentContains('android 3'); 6782 6783/* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */ 6784var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit 6785// @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome) 6786var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window); 6787 6788// @property opera: Boolean; `true` for the Opera browser 6789var opera = !!window.opera; 6790 6791// @property chrome: Boolean; `true` for the Chrome browser. 6792var chrome = userAgentContains('chrome'); 6793 6794// @property gecko: Boolean; `true` for gecko-based browsers like Firefox. 6795var gecko = userAgentContains('gecko') && !webkit && !opera && !ie; 6796 6797// @property safari: Boolean; `true` for the Safari browser. 6798var safari = !chrome && userAgentContains('safari'); 6799 6800var phantom = userAgentContains('phantom'); 6801 6802// @property opera12: Boolean 6803// `true` for the Opera browser supporting CSS transforms (version 12 or later). 6804var opera12 = 'OTransition' in style$1; 6805 6806// @property win: Boolean; `true` when the browser is running in a Windows platform 6807var win = navigator.platform.indexOf('Win') === 0; 6808 6809// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms. 6810var ie3d = ie && ('transition' in style$1); 6811 6812// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms. 6813var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23; 6814 6815// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms. 6816var gecko3d = 'MozPerspective' in style$1; 6817 6818// @property any3d: Boolean 6819// `true` for all browsers supporting CSS transforms. 6820var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom; 6821 6822// @property mobile: Boolean; `true` for all browsers running in a mobile device. 6823var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile'); 6824 6825// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device. 6826var mobileWebkit = mobile && webkit; 6827 6828// @property mobileWebkit3d: Boolean 6829// `true` for all webkit-based browsers in a mobile device supporting CSS transforms. 6830var mobileWebkit3d = mobile && webkit3d; 6831 6832// @property msPointer: Boolean 6833// `true` for browsers implementing the Microsoft touch events model (notably IE10). 6834var msPointer = !window.PointerEvent && window.MSPointerEvent; 6835 6836// @property pointer: Boolean 6837// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx). 6838var pointer = !webkit && !!(window.PointerEvent || msPointer); 6839 6840// @property touch: Boolean 6841// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events). 6842// This does not necessarily mean that the browser is running in a computer with 6843// a touchscreen, it only means that the browser is capable of understanding 6844// touch events. 6845var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window || 6846 (window.DocumentTouch && document instanceof window.DocumentTouch)); 6847 6848// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device. 6849var mobileOpera = mobile && opera; 6850 6851// @property mobileGecko: Boolean 6852// `true` for gecko-based browsers running in a mobile device. 6853var mobileGecko = mobile && gecko; 6854 6855// @property retina: Boolean 6856// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%. 6857var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1; 6858 6859// @property passiveEvents: Boolean 6860// `true` for browsers that support passive events. 6861var passiveEvents = (function () { 6862 var supportsPassiveOption = false; 6863 try { 6864 var opts = Object.defineProperty({}, 'passive', { 6865 get: function () { 6866 supportsPassiveOption = true; 6867 } 6868 }); 6869 window.addEventListener('testPassiveEventSupport', falseFn, opts); 6870 window.removeEventListener('testPassiveEventSupport', falseFn, opts); 6871 } catch (e) { 6872 // Errors can safely be ignored since this is only a browser support test. 6873 } 6874 return supportsPassiveOption; 6875}); 6876 6877// @property canvas: Boolean 6878// `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API). 6879var canvas = (function () { 6880 return !!document.createElement('canvas').getContext; 6881}()); 6882 6883// @property svg: Boolean 6884// `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG). 6885var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect); 6886 6887// @property vml: Boolean 6888// `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language). 6889var vml = !svg && (function () { 6890 try { 6891 var div = document.createElement('div'); 6892 div.innerHTML = '<v:shape adj="1"/>'; 6893 6894 var shape = div.firstChild; 6895 shape.style.behavior = 'url(#default#VML)'; 6896 6897 return shape && (typeof shape.adj === 'object'); 6898 6899 } catch (e) { 6900 return false; 6901 } 6902}()); 6903 6904 6905function userAgentContains(str) { 6906 return navigator.userAgent.toLowerCase().indexOf(str) >= 0; 6907} 6908 6909 6910var Browser = (Object.freeze || Object)({ 6911 ie: ie, 6912 ielt9: ielt9, 6913 edge: edge, 6914 webkit: webkit, 6915 android: android, 6916 android23: android23, 6917 androidStock: androidStock, 6918 opera: opera, 6919 chrome: chrome, 6920 gecko: gecko, 6921 safari: safari, 6922 phantom: phantom, 6923 opera12: opera12, 6924 win: win, 6925 ie3d: ie3d, 6926 webkit3d: webkit3d, 6927 gecko3d: gecko3d, 6928 any3d: any3d, 6929 mobile: mobile, 6930 mobileWebkit: mobileWebkit, 6931 mobileWebkit3d: mobileWebkit3d, 6932 msPointer: msPointer, 6933 pointer: pointer, 6934 touch: touch, 6935 mobileOpera: mobileOpera, 6936 mobileGecko: mobileGecko, 6937 retina: retina, 6938 passiveEvents: passiveEvents, 6939 canvas: canvas, 6940 svg: svg, 6941 vml: vml 6942}); 6943 6944/* 6945 * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices. 6946 */ 6947 6948 6949var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown'; 6950var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove'; 6951var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup'; 6952var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel'; 6953var TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION']; 6954 6955var _pointers = {}; 6956var _pointerDocListener = false; 6957 6958// DomEvent.DoubleTap needs to know about this 6959var _pointersCount = 0; 6960 6961// Provides a touch events wrapper for (ms)pointer events. 6962// ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890 6963 6964function addPointerListener(obj, type, handler, id) { 6965 if (type === 'touchstart') { 6966 _addPointerStart(obj, handler, id); 6967 6968 } else if (type === 'touchmove') { 6969 _addPointerMove(obj, handler, id); 6970 6971 } else if (type === 'touchend') { 6972 _addPointerEnd(obj, handler, id); 6973 } 6974 6975 return this; 6976} 6977 6978function removePointerListener(obj, type, id) { 6979 var handler = obj['_leaflet_' + type + id]; 6980 6981 if (type === 'touchstart') { 6982 obj.removeEventListener(POINTER_DOWN, handler, false); 6983 6984 } else if (type === 'touchmove') { 6985 obj.removeEventListener(POINTER_MOVE, handler, false); 6986 6987 } else if (type === 'touchend') { 6988 obj.removeEventListener(POINTER_UP, handler, false); 6989 obj.removeEventListener(POINTER_CANCEL, handler, false); 6990 } 6991 6992 return this; 6993} 6994 6995function _addPointerStart(obj, handler, id) { 6996 var onDown = bind(function (e) { 6997 if (e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) { 6998 // In IE11, some touch events needs to fire for form controls, or 6999 // the controls will stop working. We keep a whitelist of tag names that 7000 // need these events. For other target tags, we prevent default on the event. 7001 if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) { 7002 preventDefault(e); 7003 } else { 7004 return; 7005 } 7006 } 7007 7008 _handlePointer(e, handler); 7009 }); 7010 7011 obj['_leaflet_touchstart' + id] = onDown; 7012 obj.addEventListener(POINTER_DOWN, onDown, false); 7013 7014 // need to keep track of what pointers and how many are active to provide e.touches emulation 7015 if (!_pointerDocListener) { 7016 // we listen documentElement as any drags that end by moving the touch off the screen get fired there 7017 document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true); 7018 document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true); 7019 document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true); 7020 document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true); 7021 7022 _pointerDocListener = true; 7023 } 7024} 7025 7026function _globalPointerDown(e) { 7027 _pointers[e.pointerId] = e; 7028 _pointersCount++; 7029} 7030 7031function _globalPointerMove(e) { 7032 if (_pointers[e.pointerId]) { 7033 _pointers[e.pointerId] = e; 7034 } 7035} 7036 7037function _globalPointerUp(e) { 7038 delete _pointers[e.pointerId]; 7039 _pointersCount--; 7040} 7041 7042function _handlePointer(e, handler) { 7043 e.touches = []; 7044 for (var i in _pointers) { 7045 e.touches.push(_pointers[i]); 7046 } 7047 e.changedTouches = [e]; 7048 7049 handler(e); 7050} 7051 7052function _addPointerMove(obj, handler, id) { 7053 var onMove = function (e) { 7054 // don't fire touch moves when mouse isn't down 7055 if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) { return; } 7056 7057 _handlePointer(e, handler); 7058 }; 7059 7060 obj['_leaflet_touchmove' + id] = onMove; 7061 obj.addEventListener(POINTER_MOVE, onMove, false); 7062} 7063 7064function _addPointerEnd(obj, handler, id) { 7065 var onUp = function (e) { 7066 _handlePointer(e, handler); 7067 }; 7068 7069 obj['_leaflet_touchend' + id] = onUp; 7070 obj.addEventListener(POINTER_UP, onUp, false); 7071 obj.addEventListener(POINTER_CANCEL, onUp, false); 7072} 7073 7074/* 7075 * Extends the event handling code with double tap support for mobile browsers. 7076 */ 7077 7078var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart'; 7079var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend'; 7080var _pre = '_leaflet_'; 7081 7082// inspired by Zepto touch code by Thomas Fuchs 7083function addDoubleTapListener(obj, handler, id) { 7084 var last, touch$$1, 7085 doubleTap = false, 7086 delay = 250; 7087 7088 function onTouchStart(e) { 7089 var count; 7090 7091 if (pointer) { 7092 if ((!edge) || e.pointerType === 'mouse') { return; } 7093 count = _pointersCount; 7094 } else { 7095 count = e.touches.length; 7096 } 7097 7098 if (count > 1) { return; } 7099 7100 var now = Date.now(), 7101 delta = now - (last || now); 7102 7103 touch$$1 = e.touches ? e.touches[0] : e; 7104 doubleTap = (delta > 0 && delta <= delay); 7105 last = now; 7106 } 7107 7108 function onTouchEnd(e) { 7109 if (doubleTap && !touch$$1.cancelBubble) { 7110 if (pointer) { 7111 if ((!edge) || e.pointerType === 'mouse') { return; } 7112 // work around .type being readonly with MSPointer* events 7113 var newTouch = {}, 7114 prop, i; 7115 7116 for (i in touch$$1) { 7117 prop = touch$$1[i]; 7118 newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop; 7119 } 7120 touch$$1 = newTouch; 7121 } 7122 touch$$1.type = 'dblclick'; 7123 touch$$1.button = 0; 7124 handler(touch$$1); 7125 last = null; 7126 } 7127 } 7128 7129 obj[_pre + _touchstart + id] = onTouchStart; 7130 obj[_pre + _touchend + id] = onTouchEnd; 7131 obj[_pre + 'dblclick' + id] = handler; 7132 7133 obj.addEventListener(_touchstart, onTouchStart, passiveEvents ? {passive: false} : false); 7134 obj.addEventListener(_touchend, onTouchEnd, passiveEvents ? {passive: false} : false); 7135 7136 // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse), 7137 // the browser doesn't fire touchend/pointerup events but does fire 7138 // native dblclicks. See #4127. 7139 // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180. 7140 obj.addEventListener('dblclick', handler, false); 7141 7142 return this; 7143} 7144 7145function removeDoubleTapListener(obj, id) { 7146 var touchstart = obj[_pre + _touchstart + id], 7147 touchend = obj[_pre + _touchend + id], 7148 dblclick = obj[_pre + 'dblclick' + id]; 7149 7150 obj.removeEventListener(_touchstart, touchstart, passiveEvents ? {passive: false} : false); 7151 obj.removeEventListener(_touchend, touchend, passiveEvents ? {passive: false} : false); 7152 if (!edge) { 7153 obj.removeEventListener('dblclick', dblclick, false); 7154 } 7155 7156 return this; 7157} 7158 7159/* 7160 * @namespace DomUtil 7161 * 7162 * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model) 7163 * tree, used by Leaflet internally. 7164 * 7165 * Most functions expecting or returning a `HTMLElement` also work for 7166 * SVG elements. The only difference is that classes refer to CSS classes 7167 * in HTML and SVG classes in SVG. 7168 */ 7169 7170 7171// @property TRANSFORM: String 7172// Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit). 7173var TRANSFORM = testProp( 7174 ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']); 7175 7176// webkitTransition comes first because some browser versions that drop vendor prefix don't do 7177// the same for the transitionend event, in particular the Android 4.1 stock browser 7178 7179// @property TRANSITION: String 7180// Vendor-prefixed transition style name. 7181var TRANSITION = testProp( 7182 ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']); 7183 7184// @property TRANSITION_END: String 7185// Vendor-prefixed transitionend event name. 7186var TRANSITION_END = 7187 TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend'; 7188 7189 7190// @function get(id: String|HTMLElement): HTMLElement 7191// Returns an element given its DOM id, or returns the element itself 7192// if it was passed directly. 7193function get(id) { 7194 return typeof id === 'string' ? document.getElementById(id) : id; 7195} 7196 7197// @function getStyle(el: HTMLElement, styleAttrib: String): String 7198// Returns the value for a certain style attribute on an element, 7199// including computed values or values set through CSS. 7200function getStyle(el, style) { 7201 var value = el.style[style] || (el.currentStyle && el.currentStyle[style]); 7202 7203 if ((!value || value === 'auto') && document.defaultView) { 7204 var css = document.defaultView.getComputedStyle(el, null); 7205 value = css ? css[style] : null; 7206 } 7207 return value === 'auto' ? null : value; 7208} 7209 7210// @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement 7211// Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element. 7212function create$1(tagName, className, container) { 7213 var el = document.createElement(tagName); 7214 el.className = className || ''; 7215 7216 if (container) { 7217 container.appendChild(el); 7218 } 7219 return el; 7220} 7221 7222// @function remove(el: HTMLElement) 7223// Removes `el` from its parent element 7224function remove(el) { 7225 var parent = el.parentNode; 7226 if (parent) { 7227 parent.removeChild(el); 7228 } 7229} 7230 7231// @function empty(el: HTMLElement) 7232// Removes all of `el`'s children elements from `el` 7233function empty(el) { 7234 while (el.firstChild) { 7235 el.removeChild(el.firstChild); 7236 } 7237} 7238 7239// @function toFront(el: HTMLElement) 7240// Makes `el` the last child of its parent, so it renders in front of the other children. 7241function toFront(el) { 7242 var parent = el.parentNode; 7243 if (parent && parent.lastChild !== el) { 7244 parent.appendChild(el); 7245 } 7246} 7247 7248// @function toBack(el: HTMLElement) 7249// Makes `el` the first child of its parent, so it renders behind the other children. 7250function toBack(el) { 7251 var parent = el.parentNode; 7252 if (parent && parent.firstChild !== el) { 7253 parent.insertBefore(el, parent.firstChild); 7254 } 7255} 7256 7257// @function hasClass(el: HTMLElement, name: String): Boolean 7258// Returns `true` if the element's class attribute contains `name`. 7259function hasClass(el, name) { 7260 if (el.classList !== undefined) { 7261 return el.classList.contains(name); 7262 } 7263 var className = getClass(el); 7264 return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className); 7265} 7266 7267// @function addClass(el: HTMLElement, name: String) 7268// Adds `name` to the element's class attribute. 7269function addClass(el, name) { 7270 if (el.classList !== undefined) { 7271 var classes = splitWords(name); 7272 for (var i = 0, len = classes.length; i < len; i++) { 7273 el.classList.add(classes[i]); 7274 } 7275 } else if (!hasClass(el, name)) { 7276 var className = getClass(el); 7277 setClass(el, (className ? className + ' ' : '') + name); 7278 } 7279} 7280 7281// @function removeClass(el: HTMLElement, name: String) 7282// Removes `name` from the element's class attribute. 7283function removeClass(el, name) { 7284 if (el.classList !== undefined) { 7285 el.classList.remove(name); 7286 } else { 7287 setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' '))); 7288 } 7289} 7290 7291// @function setClass(el: HTMLElement, name: String) 7292// Sets the element's class. 7293function setClass(el, name) { 7294 if (el.className.baseVal === undefined) { 7295 el.className = name; 7296 } else { 7297 // in case of SVG element 7298 el.className.baseVal = name; 7299 } 7300} 7301 7302// @function getClass(el: HTMLElement): String 7303// Returns the element's class. 7304function getClass(el) { 7305 // Check if the element is an SVGElementInstance and use the correspondingElement instead 7306 // (Required for linked SVG elements in IE11.) 7307 if (el.correspondingElement) { 7308 el = el.correspondingElement; 7309 } 7310 return el.className.baseVal === undefined ? el.className : el.className.baseVal; 7311} 7312 7313// @function setOpacity(el: HTMLElement, opacity: Number) 7314// Set the opacity of an element (including old IE support). 7315// `opacity` must be a number from `0` to `1`. 7316function setOpacity(el, value) { 7317 if ('opacity' in el.style) { 7318 el.style.opacity = value; 7319 } else if ('filter' in el.style) { 7320 _setOpacityIE(el, value); 7321 } 7322} 7323 7324function _setOpacityIE(el, value) { 7325 var filter = false, 7326 filterName = 'DXImageTransform.Microsoft.Alpha'; 7327 7328 // filters collection throws an error if we try to retrieve a filter that doesn't exist 7329 try { 7330 filter = el.filters.item(filterName); 7331 } catch (e) { 7332 // don't set opacity to 1 if we haven't already set an opacity, 7333 // it isn't needed and breaks transparent pngs. 7334 if (value === 1) { return; } 7335 } 7336 7337 value = Math.round(value * 100); 7338 7339 if (filter) { 7340 filter.Enabled = (value !== 100); 7341 filter.Opacity = value; 7342 } else { 7343 el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')'; 7344 } 7345} 7346 7347// @function testProp(props: String[]): String|false 7348// Goes through the array of style names and returns the first name 7349// that is a valid style name for an element. If no such name is found, 7350// it returns false. Useful for vendor-prefixed styles like `transform`. 7351function testProp(props) { 7352 var style = document.documentElement.style; 7353 7354 for (var i = 0; i < props.length; i++) { 7355 if (props[i] in style) { 7356 return props[i]; 7357 } 7358 } 7359 return false; 7360} 7361 7362// @function setTransform(el: HTMLElement, offset: Point, scale?: Number) 7363// Resets the 3D CSS transform of `el` so it is translated by `offset` pixels 7364// and optionally scaled by `scale`. Does not have an effect if the 7365// browser doesn't support 3D CSS transforms. 7366function setTransform(el, offset, scale) { 7367 var pos = offset || new Point(0, 0); 7368 7369 el.style[TRANSFORM] = 7370 (ie3d ? 7371 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 7372 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + 7373 (scale ? ' scale(' + scale + ')' : ''); 7374} 7375 7376// @function setPosition(el: HTMLElement, position: Point) 7377// Sets the position of `el` to coordinates specified by `position`, 7378// using CSS translate or top/left positioning depending on the browser 7379// (used by Leaflet internally to position its layers). 7380function setPosition(el, point) { 7381 7382 /*eslint-disable */ 7383 el._leaflet_pos = point; 7384 /* eslint-enable */ 7385 7386 if (any3d) { 7387 setTransform(el, point); 7388 } else { 7389 el.style.left = point.x + 'px'; 7390 el.style.top = point.y + 'px'; 7391 } 7392} 7393 7394// @function getPosition(el: HTMLElement): Point 7395// Returns the coordinates of an element previously positioned with setPosition. 7396function getPosition(el) { 7397 // this method is only used for elements previously positioned using setPosition, 7398 // so it's safe to cache the position for performance 7399 7400 return el._leaflet_pos || new Point(0, 0); 7401} 7402 7403// @function disableTextSelection() 7404// Prevents the user from generating `selectstart` DOM events, usually generated 7405// when the user drags the mouse through a page with text. Used internally 7406// by Leaflet to override the behaviour of any click-and-drag interaction on 7407// the map. Affects drag interactions on the whole document. 7408 7409// @function enableTextSelection() 7410// Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection). 7411var disableTextSelection; 7412var enableTextSelection; 7413var _userSelect; 7414if ('onselectstart' in document) { 7415 disableTextSelection = function () { 7416 on(window, 'selectstart', preventDefault); 7417 }; 7418 enableTextSelection = function () { 7419 off(window, 'selectstart', preventDefault); 7420 }; 7421} else { 7422 var userSelectProperty = testProp( 7423 ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']); 7424 7425 disableTextSelection = function () { 7426 if (userSelectProperty) { 7427 var style = document.documentElement.style; 7428 _userSelect = style[userSelectProperty]; 7429 style[userSelectProperty] = 'none'; 7430 } 7431 }; 7432 enableTextSelection = function () { 7433 if (userSelectProperty) { 7434 document.documentElement.style[userSelectProperty] = _userSelect; 7435 _userSelect = undefined; 7436 } 7437 }; 7438} 7439 7440// @function disableImageDrag() 7441// As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but 7442// for `dragstart` DOM events, usually generated when the user drags an image. 7443function disableImageDrag() { 7444 on(window, 'dragstart', preventDefault); 7445} 7446 7447// @function enableImageDrag() 7448// Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection). 7449function enableImageDrag() { 7450 off(window, 'dragstart', preventDefault); 7451} 7452 7453var _outlineElement; 7454var _outlineStyle; 7455// @function preventOutline(el: HTMLElement) 7456// Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline) 7457// of the element `el` invisible. Used internally by Leaflet to prevent 7458// focusable elements from displaying an outline when the user performs a 7459// drag interaction on them. 7460function preventOutline(element) { 7461 while (element.tabIndex === -1) { 7462 element = element.parentNode; 7463 } 7464 if (!element.style) { return; } 7465 restoreOutline(); 7466 _outlineElement = element; 7467 _outlineStyle = element.style.outline; 7468 element.style.outline = 'none'; 7469 on(window, 'keydown', restoreOutline); 7470} 7471 7472// @function restoreOutline() 7473// Cancels the effects of a previous [`L.DomUtil.preventOutline`](). 7474function restoreOutline() { 7475 if (!_outlineElement) { return; } 7476 _outlineElement.style.outline = _outlineStyle; 7477 _outlineElement = undefined; 7478 _outlineStyle = undefined; 7479 off(window, 'keydown', restoreOutline); 7480} 7481 7482// @function getSizedParentNode(el: HTMLElement): HTMLElement 7483// Finds the closest parent node which size (width and height) is not null. 7484function getSizedParentNode(element) { 7485 do { 7486 element = element.parentNode; 7487 } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body); 7488 return element; 7489} 7490 7491// @function getScale(el: HTMLElement): Object 7492// Computes the CSS scale currently applied on the element. 7493// Returns an object with `x` and `y` members as horizontal and vertical scales respectively, 7494// and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). 7495function getScale(element) { 7496 var rect = element.getBoundingClientRect(); // Read-only in old browsers. 7497 7498 return { 7499 x: rect.width / element.offsetWidth || 1, 7500 y: rect.height / element.offsetHeight || 1, 7501 boundingClientRect: rect 7502 }; 7503} 7504 7505 7506var DomUtil = (Object.freeze || Object)({ 7507 TRANSFORM: TRANSFORM, 7508 TRANSITION: TRANSITION, 7509 TRANSITION_END: TRANSITION_END, 7510 get: get, 7511 getStyle: getStyle, 7512 create: create$1, 7513 remove: remove, 7514 empty: empty, 7515 toFront: toFront, 7516 toBack: toBack, 7517 hasClass: hasClass, 7518 addClass: addClass, 7519 removeClass: removeClass, 7520 setClass: setClass, 7521 getClass: getClass, 7522 setOpacity: setOpacity, 7523 testProp: testProp, 7524 setTransform: setTransform, 7525 setPosition: setPosition, 7526 getPosition: getPosition, 7527 disableTextSelection: disableTextSelection, 7528 enableTextSelection: enableTextSelection, 7529 disableImageDrag: disableImageDrag, 7530 enableImageDrag: enableImageDrag, 7531 preventOutline: preventOutline, 7532 restoreOutline: restoreOutline, 7533 getSizedParentNode: getSizedParentNode, 7534 getScale: getScale 7535}); 7536 7537/* 7538 * @namespace DomEvent 7539 * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally. 7540 */ 7541 7542// Inspired by John Resig, Dean Edwards and YUI addEvent implementations. 7543 7544// @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this 7545// Adds a listener function (`fn`) to a particular DOM event type of the 7546// element `el`. You can optionally specify the context of the listener 7547// (object the `this` keyword will point to). You can also pass several 7548// space-separated types (e.g. `'click dblclick'`). 7549 7550// @alternative 7551// @function on(el: HTMLElement, eventMap: Object, context?: Object): this 7552// Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 7553function on(obj, types, fn, context) { 7554 7555 if (typeof types === 'object') { 7556 for (var type in types) { 7557 addOne(obj, type, types[type], fn); 7558 } 7559 } else { 7560 types = splitWords(types); 7561 7562 for (var i = 0, len = types.length; i < len; i++) { 7563 addOne(obj, types[i], fn, context); 7564 } 7565 } 7566 7567 return this; 7568} 7569 7570var eventsKey = '_leaflet_events'; 7571 7572// @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this 7573// Removes a previously added listener function. 7574// Note that if you passed a custom context to on, you must pass the same 7575// context to `off` in order to remove the listener. 7576 7577// @alternative 7578// @function off(el: HTMLElement, eventMap: Object, context?: Object): this 7579// Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 7580function off(obj, types, fn, context) { 7581 7582 if (typeof types === 'object') { 7583 for (var type in types) { 7584 removeOne(obj, type, types[type], fn); 7585 } 7586 } else if (types) { 7587 types = splitWords(types); 7588 7589 for (var i = 0, len = types.length; i < len; i++) { 7590 removeOne(obj, types[i], fn, context); 7591 } 7592 } else { 7593 for (var j in obj[eventsKey]) { 7594 removeOne(obj, j, obj[eventsKey][j]); 7595 } 7596 delete obj[eventsKey]; 7597 } 7598 7599 return this; 7600} 7601 7602function addOne(obj, type, fn, context) { 7603 var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''); 7604 7605 if (obj[eventsKey] && obj[eventsKey][id]) { return this; } 7606 7607 var handler = function (e) { 7608 return fn.call(context || obj, e || window.event); 7609 }; 7610 7611 var originalHandler = handler; 7612 7613 if (pointer && type.indexOf('touch') === 0) { 7614 // Needs DomEvent.Pointer.js 7615 addPointerListener(obj, type, handler, id); 7616 7617 } else if (touch && (type === 'dblclick') && addDoubleTapListener && 7618 !(pointer && chrome)) { 7619 // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener 7620 // See #5180 7621 addDoubleTapListener(obj, handler, id); 7622 7623 } else if ('addEventListener' in obj) { 7624 7625 if (type === 'mousewheel') { 7626 obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, passiveEvents ? {passive: false} : false); 7627 7628 } else if ((type === 'mouseenter') || (type === 'mouseleave')) { 7629 handler = function (e) { 7630 e = e || window.event; 7631 if (isExternalTarget(obj, e)) { 7632 originalHandler(e); 7633 } 7634 }; 7635 obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false); 7636 7637 } else { 7638 if (type === 'click' && android) { 7639 handler = function (e) { 7640 filterClick(e, originalHandler); 7641 }; 7642 } 7643 obj.addEventListener(type, handler, false); 7644 } 7645 7646 } else if ('attachEvent' in obj) { 7647 obj.attachEvent('on' + type, handler); 7648 } 7649 7650 obj[eventsKey] = obj[eventsKey] || {}; 7651 obj[eventsKey][id] = handler; 7652} 7653 7654function removeOne(obj, type, fn, context) { 7655 7656 var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''), 7657 handler = obj[eventsKey] && obj[eventsKey][id]; 7658 7659 if (!handler) { return this; } 7660 7661 if (pointer && type.indexOf('touch') === 0) { 7662 removePointerListener(obj, type, id); 7663 7664 } else if (touch && (type === 'dblclick') && removeDoubleTapListener && 7665 !(pointer && chrome)) { 7666 removeDoubleTapListener(obj, id); 7667 7668 } else if ('removeEventListener' in obj) { 7669 7670 if (type === 'mousewheel') { 7671 obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, passiveEvents ? {passive: false} : false); 7672 7673 } else { 7674 obj.removeEventListener( 7675 type === 'mouseenter' ? 'mouseover' : 7676 type === 'mouseleave' ? 'mouseout' : type, handler, false); 7677 } 7678 7679 } else if ('detachEvent' in obj) { 7680 obj.detachEvent('on' + type, handler); 7681 } 7682 7683 obj[eventsKey][id] = null; 7684} 7685 7686// @function stopPropagation(ev: DOMEvent): this 7687// Stop the given event from propagation to parent elements. Used inside the listener functions: 7688// ```js 7689// L.DomEvent.on(div, 'click', function (ev) { 7690// L.DomEvent.stopPropagation(ev); 7691// }); 7692// ``` 7693function stopPropagation(e) { 7694 7695 if (e.stopPropagation) { 7696 e.stopPropagation(); 7697 } else if (e.originalEvent) { // In case of Leaflet event. 7698 e.originalEvent._stopped = true; 7699 } else { 7700 e.cancelBubble = true; 7701 } 7702 skipped(e); 7703 7704 return this; 7705} 7706 7707// @function disableScrollPropagation(el: HTMLElement): this 7708// Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants). 7709function disableScrollPropagation(el) { 7710 addOne(el, 'mousewheel', stopPropagation); 7711 return this; 7712} 7713 7714// @function disableClickPropagation(el: HTMLElement): this 7715// Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`, 7716// `'mousedown'` and `'touchstart'` events (plus browser variants). 7717function disableClickPropagation(el) { 7718 on(el, 'mousedown touchstart dblclick', stopPropagation); 7719 addOne(el, 'click', fakeStop); 7720 return this; 7721} 7722 7723// @function preventDefault(ev: DOMEvent): this 7724// Prevents the default action of the DOM Event `ev` from happening (such as 7725// following a link in the href of the a element, or doing a POST request 7726// with page reload when a `<form>` is submitted). 7727// Use it inside listener functions. 7728function preventDefault(e) { 7729 if (e.preventDefault) { 7730 e.preventDefault(); 7731 } else { 7732 e.returnValue = false; 7733 } 7734 return this; 7735} 7736 7737// @function stop(ev: DOMEvent): this 7738// Does `stopPropagation` and `preventDefault` at the same time. 7739function stop(e) { 7740 preventDefault(e); 7741 stopPropagation(e); 7742 return this; 7743} 7744 7745// @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point 7746// Gets normalized mouse position from a DOM event relative to the 7747// `container` (border excluded) or to the whole page if not specified. 7748function getMousePosition(e, container) { 7749 if (!container) { 7750 return new Point(e.clientX, e.clientY); 7751 } 7752 7753 var scale = getScale(container), 7754 offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y) 7755 7756 return new Point( 7757 // offset.left/top values are in page scale (like clientX/Y), 7758 // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies). 7759 (e.clientX - offset.left) / scale.x - container.clientLeft, 7760 (e.clientY - offset.top) / scale.y - container.clientTop 7761 ); 7762} 7763 7764// Chrome on Win scrolls double the pixels as in other platforms (see #4538), 7765// and Firefox scrolls device pixels, not CSS pixels 7766var wheelPxFactor = 7767 (win && chrome) ? 2 * window.devicePixelRatio : 7768 gecko ? window.devicePixelRatio : 1; 7769 7770// @function getWheelDelta(ev: DOMEvent): Number 7771// Gets normalized wheel delta from a mousewheel DOM event, in vertical 7772// pixels scrolled (negative if scrolling down). 7773// Events from pointing devices without precise scrolling are mapped to 7774// a best guess of 60 pixels. 7775function getWheelDelta(e) { 7776 return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta 7777 (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels 7778 (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines 7779 (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages 7780 (e.deltaX || e.deltaZ) ? 0 : // Skip horizontal/depth wheel events 7781 e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels 7782 (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines 7783 e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages 7784 0; 7785} 7786 7787var skipEvents = {}; 7788 7789function fakeStop(e) { 7790 // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e) 7791 skipEvents[e.type] = true; 7792} 7793 7794function skipped(e) { 7795 var events = skipEvents[e.type]; 7796 // reset when checking, as it's only used in map container and propagates outside of the map 7797 skipEvents[e.type] = false; 7798 return events; 7799} 7800 7801// check if element really left/entered the event target (for mouseenter/mouseleave) 7802function isExternalTarget(el, e) { 7803 7804 var related = e.relatedTarget; 7805 7806 if (!related) { return true; } 7807 7808 try { 7809 while (related && (related !== el)) { 7810 related = related.parentNode; 7811 } 7812 } catch (err) { 7813 return false; 7814 } 7815 return (related !== el); 7816} 7817 7818var lastClick; 7819 7820// this is a horrible workaround for a bug in Android where a single touch triggers two click events 7821function filterClick(e, handler) { 7822 var timeStamp = (e.timeStamp || (e.originalEvent && e.originalEvent.timeStamp)), 7823 elapsed = lastClick && (timeStamp - lastClick); 7824 7825 // are they closer together than 500ms yet more than 100ms? 7826 // Android typically triggers them ~300ms apart while multiple listeners 7827 // on the same event should be triggered far faster; 7828 // or check if click is simulated on the element, and if it is, reject any non-simulated events 7829 7830 if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) { 7831 stop(e); 7832 return; 7833 } 7834 lastClick = timeStamp; 7835 7836 handler(e); 7837} 7838 7839 7840 7841 7842var DomEvent = (Object.freeze || Object)({ 7843 on: on, 7844 off: off, 7845 stopPropagation: stopPropagation, 7846 disableScrollPropagation: disableScrollPropagation, 7847 disableClickPropagation: disableClickPropagation, 7848 preventDefault: preventDefault, 7849 stop: stop, 7850 getMousePosition: getMousePosition, 7851 getWheelDelta: getWheelDelta, 7852 fakeStop: fakeStop, 7853 skipped: skipped, 7854 isExternalTarget: isExternalTarget, 7855 addListener: on, 7856 removeListener: off 7857}); 7858 7859/* 7860 * @class PosAnimation 7861 * @aka L.PosAnimation 7862 * @inherits Evented 7863 * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9. 7864 * 7865 * @example 7866 * ```js 7867 * var fx = new L.PosAnimation(); 7868 * fx.run(el, [300, 500], 0.5); 7869 * ``` 7870 * 7871 * @constructor L.PosAnimation() 7872 * Creates a `PosAnimation` object. 7873 * 7874 */ 7875 7876var PosAnimation = Evented.extend({ 7877 7878 // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number) 7879 // Run an animation of a given element to a new position, optionally setting 7880 // duration in seconds (`0.25` by default) and easing linearity factor (3rd 7881 // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1), 7882 // `0.5` by default). 7883 run: function (el, newPos, duration, easeLinearity) { 7884 this.stop(); 7885 7886 this._el = el; 7887 this._inProgress = true; 7888 this._duration = duration || 0.25; 7889 this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2); 7890 7891 this._startPos = getPosition(el); 7892 this._offset = newPos.subtract(this._startPos); 7893 this._startTime = +new Date(); 7894 7895 // @event start: Event 7896 // Fired when the animation starts 7897 this.fire('start'); 7898 7899 this._animate(); 7900 }, 7901 7902 // @method stop() 7903 // Stops the animation (if currently running). 7904 stop: function () { 7905 if (!this._inProgress) { return; } 7906 7907 this._step(true); 7908 this._complete(); 7909 }, 7910 7911 _animate: function () { 7912 // animation loop 7913 this._animId = requestAnimFrame(this._animate, this); 7914 this._step(); 7915 }, 7916 7917 _step: function (round) { 7918 var elapsed = (+new Date()) - this._startTime, 7919 duration = this._duration * 1000; 7920 7921 if (elapsed < duration) { 7922 this._runFrame(this._easeOut(elapsed / duration), round); 7923 } else { 7924 this._runFrame(1); 7925 this._complete(); 7926 } 7927 }, 7928 7929 _runFrame: function (progress, round) { 7930 var pos = this._startPos.add(this._offset.multiplyBy(progress)); 7931 if (round) { 7932 pos._round(); 7933 } 7934 setPosition(this._el, pos); 7935 7936 // @event step: Event 7937 // Fired continuously during the animation. 7938 this.fire('step'); 7939 }, 7940 7941 _complete: function () { 7942 cancelAnimFrame(this._animId); 7943 7944 this._inProgress = false; 7945 // @event end: Event 7946 // Fired when the animation ends. 7947 this.fire('end'); 7948 }, 7949 7950 _easeOut: function (t) { 7951 return 1 - Math.pow(1 - t, this._easeOutPower); 7952 } 7953}); 7954 7955/* 7956 * @class Map 7957 * @aka L.Map 7958 * @inherits Evented 7959 * 7960 * The central class of the API — it is used to create a map on a page and manipulate it. 7961 * 7962 * @example 7963 * 7964 * ```js 7965 * // initialize the map on the "map" div with a given center and zoom 7966 * var map = L.map('map', { 7967 * center: [51.505, -0.09], 7968 * zoom: 13 7969 * }); 7970 * ``` 7971 * 7972 */ 7973 7974var Map = Evented.extend({ 7975 7976 options: { 7977 // @section Map State Options 7978 // @option crs: CRS = L.CRS.EPSG3857 7979 // The [Coordinate Reference System](#crs) to use. Don't change this if you're not 7980 // sure what it means. 7981 crs: EPSG3857, 7982 7983 // @option center: LatLng = undefined 7984 // Initial geographic center of the map 7985 center: undefined, 7986 7987 // @option zoom: Number = undefined 7988 // Initial map zoom level 7989 zoom: undefined, 7990 7991 // @option minZoom: Number = * 7992 // Minimum zoom level of the map. 7993 // If not specified and at least one `GridLayer` or `TileLayer` is in the map, 7994 // the lowest of their `minZoom` options will be used instead. 7995 minZoom: undefined, 7996 7997 // @option maxZoom: Number = * 7998 // Maximum zoom level of the map. 7999 // If not specified and at least one `GridLayer` or `TileLayer` is in the map, 8000 // the highest of their `maxZoom` options will be used instead. 8001 maxZoom: undefined, 8002 8003 // @option layers: Layer[] = [] 8004 // Array of layers that will be added to the map initially 8005 layers: [], 8006 8007 // @option maxBounds: LatLngBounds = null 8008 // When this option is set, the map restricts the view to the given 8009 // geographical bounds, bouncing the user back if the user tries to pan 8010 // outside the view. To set the restriction dynamically, use 8011 // [`setMaxBounds`](#map-setmaxbounds) method. 8012 maxBounds: undefined, 8013 8014 // @option renderer: Renderer = * 8015 // The default method for drawing vector layers on the map. `L.SVG` 8016 // or `L.Canvas` by default depending on browser support. 8017 renderer: undefined, 8018 8019 8020 // @section Animation Options 8021 // @option zoomAnimation: Boolean = true 8022 // Whether the map zoom animation is enabled. By default it's enabled 8023 // in all browsers that support CSS3 Transitions except Android. 8024 zoomAnimation: true, 8025 8026 // @option zoomAnimationThreshold: Number = 4 8027 // Won't animate zoom if the zoom difference exceeds this value. 8028 zoomAnimationThreshold: 4, 8029 8030 // @option fadeAnimation: Boolean = true 8031 // Whether the tile fade animation is enabled. By default it's enabled 8032 // in all browsers that support CSS3 Transitions except Android. 8033 fadeAnimation: true, 8034 8035 // @option markerZoomAnimation: Boolean = true 8036 // Whether markers animate their zoom with the zoom animation, if disabled 8037 // they will disappear for the length of the animation. By default it's 8038 // enabled in all browsers that support CSS3 Transitions except Android. 8039 markerZoomAnimation: true, 8040 8041 // @option transform3DLimit: Number = 2^23 8042 // Defines the maximum size of a CSS translation transform. The default 8043 // value should not be changed unless a web browser positions layers in 8044 // the wrong place after doing a large `panBy`. 8045 transform3DLimit: 8388608, // Precision limit of a 32-bit float 8046 8047 // @section Interaction Options 8048 // @option zoomSnap: Number = 1 8049 // Forces the map's zoom level to always be a multiple of this, particularly 8050 // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom. 8051 // By default, the zoom level snaps to the nearest integer; lower values 8052 // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0` 8053 // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom. 8054 zoomSnap: 1, 8055 8056 // @option zoomDelta: Number = 1 8057 // Controls how much the map's zoom level will change after a 8058 // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+` 8059 // or `-` on the keyboard, or using the [zoom controls](#control-zoom). 8060 // Values smaller than `1` (e.g. `0.5`) allow for greater granularity. 8061 zoomDelta: 1, 8062 8063 // @option trackResize: Boolean = true 8064 // Whether the map automatically handles browser window resize to update itself. 8065 trackResize: true 8066 }, 8067 8068 initialize: function (id, options) { // (HTMLElement or String, Object) 8069 options = setOptions(this, options); 8070 8071 // Make sure to assign internal flags at the beginning, 8072 // to avoid inconsistent state in some edge cases. 8073 this._handlers = []; 8074 this._layers = {}; 8075 this._zoomBoundLayers = {}; 8076 this._sizeChanged = true; 8077 8078 this._initContainer(id); 8079 this._initLayout(); 8080 8081 // hack for https://github.com/Leaflet/Leaflet/issues/1980 8082 this._onResize = bind(this._onResize, this); 8083 8084 this._initEvents(); 8085 8086 if (options.maxBounds) { 8087 this.setMaxBounds(options.maxBounds); 8088 } 8089 8090 if (options.zoom !== undefined) { 8091 this._zoom = this._limitZoom(options.zoom); 8092 } 8093 8094 if (options.center && options.zoom !== undefined) { 8095 this.setView(toLatLng(options.center), options.zoom, {reset: true}); 8096 } 8097 8098 this.callInitHooks(); 8099 8100 // don't animate on browsers without hardware-accelerated transitions or old Android/Opera 8101 this._zoomAnimated = TRANSITION && any3d && !mobileOpera && 8102 this.options.zoomAnimation; 8103 8104 // zoom transitions run with the same duration for all layers, so if one of transitionend events 8105 // happens after starting zoom animation (propagating to the map pane), we know that it ended globally 8106 if (this._zoomAnimated) { 8107 this._createAnimProxy(); 8108 on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this); 8109 } 8110 8111 this._addLayers(this.options.layers); 8112 }, 8113 8114 8115 // @section Methods for modifying map state 8116 8117 // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this 8118 // Sets the view of the map (geographical center and zoom) with the given 8119 // animation options. 8120 setView: function (center, zoom, options) { 8121 8122 zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom); 8123 center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds); 8124 options = options || {}; 8125 8126 this._stop(); 8127 8128 if (this._loaded && !options.reset && options !== true) { 8129 8130 if (options.animate !== undefined) { 8131 options.zoom = extend({animate: options.animate}, options.zoom); 8132 options.pan = extend({animate: options.animate, duration: options.duration}, options.pan); 8133 } 8134 8135 // try animating pan or zoom 8136 var moved = (this._zoom !== zoom) ? 8137 this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) : 8138 this._tryAnimatedPan(center, options.pan); 8139 8140 if (moved) { 8141 // prevent resize handler call, the view will refresh after animation anyway 8142 clearTimeout(this._sizeTimer); 8143 return this; 8144 } 8145 } 8146 8147 // animation didn't start, just reset the map view 8148 this._resetView(center, zoom); 8149 8150 return this; 8151 }, 8152 8153 // @method setZoom(zoom: Number, options?: Zoom/pan options): this 8154 // Sets the zoom of the map. 8155 setZoom: function (zoom, options) { 8156 if (!this._loaded) { 8157 this._zoom = zoom; 8158 return this; 8159 } 8160 return this.setView(this.getCenter(), zoom, {zoom: options}); 8161 }, 8162 8163 // @method zoomIn(delta?: Number, options?: Zoom options): this 8164 // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). 8165 zoomIn: function (delta, options) { 8166 delta = delta || (any3d ? this.options.zoomDelta : 1); 8167 return this.setZoom(this._zoom + delta, options); 8168 }, 8169 8170 // @method zoomOut(delta?: Number, options?: Zoom options): this 8171 // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). 8172 zoomOut: function (delta, options) { 8173 delta = delta || (any3d ? this.options.zoomDelta : 1); 8174 return this.setZoom(this._zoom - delta, options); 8175 }, 8176 8177 // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this 8178 // Zooms the map while keeping a specified geographical point on the map 8179 // stationary (e.g. used internally for scroll zoom and double-click zoom). 8180 // @alternative 8181 // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this 8182 // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary. 8183 setZoomAround: function (latlng, zoom, options) { 8184 var scale = this.getZoomScale(zoom), 8185 viewHalf = this.getSize().divideBy(2), 8186 containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng), 8187 8188 centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale), 8189 newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset)); 8190 8191 return this.setView(newCenter, zoom, {zoom: options}); 8192 }, 8193 8194 _getBoundsCenterZoom: function (bounds, options) { 8195 8196 options = options || {}; 8197 bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds); 8198 8199 var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), 8200 paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), 8201 8202 zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)); 8203 8204 zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom; 8205 8206 if (zoom === Infinity) { 8207 return { 8208 center: bounds.getCenter(), 8209 zoom: zoom 8210 }; 8211 } 8212 8213 var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2), 8214 8215 swPoint = this.project(bounds.getSouthWest(), zoom), 8216 nePoint = this.project(bounds.getNorthEast(), zoom), 8217 center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom); 8218 8219 return { 8220 center: center, 8221 zoom: zoom 8222 }; 8223 }, 8224 8225 // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this 8226 // Sets a map view that contains the given geographical bounds with the 8227 // maximum zoom level possible. 8228 fitBounds: function (bounds, options) { 8229 8230 bounds = toLatLngBounds(bounds); 8231 8232 if (!bounds.isValid()) { 8233 throw new Error('Bounds are not valid.'); 8234 } 8235 8236 var target = this._getBoundsCenterZoom(bounds, options); 8237 return this.setView(target.center, target.zoom, options); 8238 }, 8239 8240 // @method fitWorld(options?: fitBounds options): this 8241 // Sets a map view that mostly contains the whole world with the maximum 8242 // zoom level possible. 8243 fitWorld: function (options) { 8244 return this.fitBounds([[-90, -180], [90, 180]], options); 8245 }, 8246 8247 // @method panTo(latlng: LatLng, options?: Pan options): this 8248 // Pans the map to a given center. 8249 panTo: function (center, options) { // (LatLng) 8250 return this.setView(center, this._zoom, {pan: options}); 8251 }, 8252 8253 // @method panBy(offset: Point, options?: Pan options): this 8254 // Pans the map by a given number of pixels (animated). 8255 panBy: function (offset, options) { 8256 offset = toPoint(offset).round(); 8257 options = options || {}; 8258 8259 if (!offset.x && !offset.y) { 8260 return this.fire('moveend'); 8261 } 8262 // If we pan too far, Chrome gets issues with tiles 8263 // and makes them disappear or appear in the wrong place (slightly offset) #2602 8264 if (options.animate !== true && !this.getSize().contains(offset)) { 8265 this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom()); 8266 return this; 8267 } 8268 8269 if (!this._panAnim) { 8270 this._panAnim = new PosAnimation(); 8271 8272 this._panAnim.on({ 8273 'step': this._onPanTransitionStep, 8274 'end': this._onPanTransitionEnd 8275 }, this); 8276 } 8277 8278 // don't fire movestart if animating inertia 8279 if (!options.noMoveStart) { 8280 this.fire('movestart'); 8281 } 8282 8283 // animate pan unless animate: false specified 8284 if (options.animate !== false) { 8285 addClass(this._mapPane, 'leaflet-pan-anim'); 8286 8287 var newPos = this._getMapPanePos().subtract(offset).round(); 8288 this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity); 8289 } else { 8290 this._rawPanBy(offset); 8291 this.fire('move').fire('moveend'); 8292 } 8293 8294 return this; 8295 }, 8296 8297 // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this 8298 // Sets the view of the map (geographical center and zoom) performing a smooth 8299 // pan-zoom animation. 8300 flyTo: function (targetCenter, targetZoom, options) { 8301 8302 options = options || {}; 8303 if (options.animate === false || !any3d) { 8304 return this.setView(targetCenter, targetZoom, options); 8305 } 8306 8307 this._stop(); 8308 8309 var from = this.project(this.getCenter()), 8310 to = this.project(targetCenter), 8311 size = this.getSize(), 8312 startZoom = this._zoom; 8313 8314 targetCenter = toLatLng(targetCenter); 8315 targetZoom = targetZoom === undefined ? startZoom : targetZoom; 8316 8317 var w0 = Math.max(size.x, size.y), 8318 w1 = w0 * this.getZoomScale(startZoom, targetZoom), 8319 u1 = (to.distanceTo(from)) || 1, 8320 rho = 1.42, 8321 rho2 = rho * rho; 8322 8323 function r(i) { 8324 var s1 = i ? -1 : 1, 8325 s2 = i ? w1 : w0, 8326 t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1, 8327 b1 = 2 * s2 * rho2 * u1, 8328 b = t1 / b1, 8329 sq = Math.sqrt(b * b + 1) - b; 8330 8331 // workaround for floating point precision bug when sq = 0, log = -Infinite, 8332 // thus triggering an infinite loop in flyTo 8333 var log = sq < 0.000000001 ? -18 : Math.log(sq); 8334 8335 return log; 8336 } 8337 8338 function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } 8339 function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } 8340 function tanh(n) { return sinh(n) / cosh(n); } 8341 8342 var r0 = r(0); 8343 8344 function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); } 8345 function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; } 8346 8347 function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); } 8348 8349 var start = Date.now(), 8350 S = (r(1) - r0) / rho, 8351 duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8; 8352 8353 function frame() { 8354 var t = (Date.now() - start) / duration, 8355 s = easeOut(t) * S; 8356 8357 if (t <= 1) { 8358 this._flyToFrame = requestAnimFrame(frame, this); 8359 8360 this._move( 8361 this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), 8362 this.getScaleZoom(w0 / w(s), startZoom), 8363 {flyTo: true}); 8364 8365 } else { 8366 this 8367 ._move(targetCenter, targetZoom) 8368 ._moveEnd(true); 8369 } 8370 } 8371 8372 this._moveStart(true, options.noMoveStart); 8373 8374 frame.call(this); 8375 return this; 8376 }, 8377 8378 // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this 8379 // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto), 8380 // but takes a bounds parameter like [`fitBounds`](#map-fitbounds). 8381 flyToBounds: function (bounds, options) { 8382 var target = this._getBoundsCenterZoom(bounds, options); 8383 return this.flyTo(target.center, target.zoom, options); 8384 }, 8385 8386 // @method setMaxBounds(bounds: Bounds): this 8387 // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option). 8388 setMaxBounds: function (bounds) { 8389 bounds = toLatLngBounds(bounds); 8390 8391 if (!bounds.isValid()) { 8392 this.options.maxBounds = null; 8393 return this.off('moveend', this._panInsideMaxBounds); 8394 } else if (this.options.maxBounds) { 8395 this.off('moveend', this._panInsideMaxBounds); 8396 } 8397 8398 this.options.maxBounds = bounds; 8399 8400 if (this._loaded) { 8401 this._panInsideMaxBounds(); 8402 } 8403 8404 return this.on('moveend', this._panInsideMaxBounds); 8405 }, 8406 8407 // @method setMinZoom(zoom: Number): this 8408 // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option). 8409 setMinZoom: function (zoom) { 8410 var oldZoom = this.options.minZoom; 8411 this.options.minZoom = zoom; 8412 8413 if (this._loaded && oldZoom !== zoom) { 8414 this.fire('zoomlevelschange'); 8415 8416 if (this.getZoom() < this.options.minZoom) { 8417 return this.setZoom(zoom); 8418 } 8419 } 8420 8421 return this; 8422 }, 8423 8424 // @method setMaxZoom(zoom: Number): this 8425 // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option). 8426 setMaxZoom: function (zoom) { 8427 var oldZoom = this.options.maxZoom; 8428 this.options.maxZoom = zoom; 8429 8430 if (this._loaded && oldZoom !== zoom) { 8431 this.fire('zoomlevelschange'); 8432 8433 if (this.getZoom() > this.options.maxZoom) { 8434 return this.setZoom(zoom); 8435 } 8436 } 8437 8438 return this; 8439 }, 8440 8441 // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this 8442 // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any. 8443 panInsideBounds: function (bounds, options) { 8444 this._enforcingBounds = true; 8445 var center = this.getCenter(), 8446 newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds)); 8447 8448 if (!center.equals(newCenter)) { 8449 this.panTo(newCenter, options); 8450 } 8451 8452 this._enforcingBounds = false; 8453 return this; 8454 }, 8455 8456 // @method panInside(latlng: LatLng, options?: options): this 8457 // Pans the map the minimum amount to make the `latlng` visible. Use 8458 // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit 8459 // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds). 8460 // If `latlng` is already within the (optionally padded) display bounds, 8461 // the map will not be panned. 8462 panInside: function (latlng, options) { 8463 options = options || {}; 8464 8465 var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), 8466 paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), 8467 center = this.getCenter(), 8468 pixelCenter = this.project(center), 8469 pixelPoint = this.project(latlng), 8470 pixelBounds = this.getPixelBounds(), 8471 halfPixelBounds = pixelBounds.getSize().divideBy(2), 8472 paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]); 8473 8474 if (!paddedBounds.contains(pixelPoint)) { 8475 this._enforcingBounds = true; 8476 var diff = pixelCenter.subtract(pixelPoint), 8477 newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y); 8478 8479 if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) { 8480 newCenter.x = pixelCenter.x - diff.x; 8481 if (diff.x > 0) { 8482 newCenter.x += halfPixelBounds.x - paddingTL.x; 8483 } else { 8484 newCenter.x -= halfPixelBounds.x - paddingBR.x; 8485 } 8486 } 8487 if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) { 8488 newCenter.y = pixelCenter.y - diff.y; 8489 if (diff.y > 0) { 8490 newCenter.y += halfPixelBounds.y - paddingTL.y; 8491 } else { 8492 newCenter.y -= halfPixelBounds.y - paddingBR.y; 8493 } 8494 } 8495 this.panTo(this.unproject(newCenter), options); 8496 this._enforcingBounds = false; 8497 } 8498 return this; 8499 }, 8500 8501 // @method invalidateSize(options: Zoom/pan options): this 8502 // Checks if the map container size changed and updates the map if so — 8503 // call it after you've changed the map size dynamically, also animating 8504 // pan by default. If `options.pan` is `false`, panning will not occur. 8505 // If `options.debounceMoveend` is `true`, it will delay `moveend` event so 8506 // that it doesn't happen often even if the method is called many 8507 // times in a row. 8508 8509 // @alternative 8510 // @method invalidateSize(animate: Boolean): this 8511 // Checks if the map container size changed and updates the map if so — 8512 // call it after you've changed the map size dynamically, also animating 8513 // pan by default. 8514 invalidateSize: function (options) { 8515 if (!this._loaded) { return this; } 8516 8517 options = extend({ 8518 animate: false, 8519 pan: true 8520 }, options === true ? {animate: true} : options); 8521 8522 var oldSize = this.getSize(); 8523 this._sizeChanged = true; 8524 this._lastCenter = null; 8525 8526 var newSize = this.getSize(), 8527 oldCenter = oldSize.divideBy(2).round(), 8528 newCenter = newSize.divideBy(2).round(), 8529 offset = oldCenter.subtract(newCenter); 8530 8531 if (!offset.x && !offset.y) { return this; } 8532 8533 if (options.animate && options.pan) { 8534 this.panBy(offset); 8535 8536 } else { 8537 if (options.pan) { 8538 this._rawPanBy(offset); 8539 } 8540 8541 this.fire('move'); 8542 8543 if (options.debounceMoveend) { 8544 clearTimeout(this._sizeTimer); 8545 this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200); 8546 } else { 8547 this.fire('moveend'); 8548 } 8549 } 8550 8551 // @section Map state change events 8552 // @event resize: ResizeEvent 8553 // Fired when the map is resized. 8554 return this.fire('resize', { 8555 oldSize: oldSize, 8556 newSize: newSize 8557 }); 8558 }, 8559 8560 // @section Methods for modifying map state 8561 // @method stop(): this 8562 // Stops the currently running `panTo` or `flyTo` animation, if any. 8563 stop: function () { 8564 this.setZoom(this._limitZoom(this._zoom)); 8565 if (!this.options.zoomSnap) { 8566 this.fire('viewreset'); 8567 } 8568 return this._stop(); 8569 }, 8570 8571 // @section Geolocation methods 8572 // @method locate(options?: Locate options): this 8573 // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound) 8574 // event with location data on success or a [`locationerror`](#map-locationerror) event on failure, 8575 // and optionally sets the map view to the user's location with respect to 8576 // detection accuracy (or to the world view if geolocation failed). 8577 // Note that, if your page doesn't use HTTPS, this method will fail in 8578 // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins)) 8579 // See `Locate options` for more details. 8580 locate: function (options) { 8581 8582 options = this._locateOptions = extend({ 8583 timeout: 10000, 8584 watch: false 8585 // setView: false 8586 // maxZoom: <Number> 8587 // maximumAge: 0 8588 // enableHighAccuracy: false 8589 }, options); 8590 8591 if (!('geolocation' in navigator)) { 8592 this._handleGeolocationError({ 8593 code: 0, 8594 message: 'Geolocation not supported.' 8595 }); 8596 return this; 8597 } 8598 8599 var onResponse = bind(this._handleGeolocationResponse, this), 8600 onError = bind(this._handleGeolocationError, this); 8601 8602 if (options.watch) { 8603 this._locationWatchId = 8604 navigator.geolocation.watchPosition(onResponse, onError, options); 8605 } else { 8606 navigator.geolocation.getCurrentPosition(onResponse, onError, options); 8607 } 8608 return this; 8609 }, 8610 8611 // @method stopLocate(): this 8612 // Stops watching location previously initiated by `map.locate({watch: true})` 8613 // and aborts resetting the map view if map.locate was called with 8614 // `{setView: true}`. 8615 stopLocate: function () { 8616 if (navigator.geolocation && navigator.geolocation.clearWatch) { 8617 navigator.geolocation.clearWatch(this._locationWatchId); 8618 } 8619 if (this._locateOptions) { 8620 this._locateOptions.setView = false; 8621 } 8622 return this; 8623 }, 8624 8625 _handleGeolocationError: function (error) { 8626 var c = error.code, 8627 message = error.message || 8628 (c === 1 ? 'permission denied' : 8629 (c === 2 ? 'position unavailable' : 'timeout')); 8630 8631 if (this._locateOptions.setView && !this._loaded) { 8632 this.fitWorld(); 8633 } 8634 8635 // @section Location events 8636 // @event locationerror: ErrorEvent 8637 // Fired when geolocation (using the [`locate`](#map-locate) method) failed. 8638 this.fire('locationerror', { 8639 code: c, 8640 message: 'Geolocation error: ' + message + '.' 8641 }); 8642 }, 8643 8644 _handleGeolocationResponse: function (pos) { 8645 var lat = pos.coords.latitude, 8646 lng = pos.coords.longitude, 8647 latlng = new LatLng(lat, lng), 8648 bounds = latlng.toBounds(pos.coords.accuracy * 2), 8649 options = this._locateOptions; 8650 8651 if (options.setView) { 8652 var zoom = this.getBoundsZoom(bounds); 8653 this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom); 8654 } 8655 8656 var data = { 8657 latlng: latlng, 8658 bounds: bounds, 8659 timestamp: pos.timestamp 8660 }; 8661 8662 for (var i in pos.coords) { 8663 if (typeof pos.coords[i] === 'number') { 8664 data[i] = pos.coords[i]; 8665 } 8666 } 8667 8668 // @event locationfound: LocationEvent 8669 // Fired when geolocation (using the [`locate`](#map-locate) method) 8670 // went successfully. 8671 this.fire('locationfound', data); 8672 }, 8673 8674 // TODO Appropriate docs section? 8675 // @section Other Methods 8676 // @method addHandler(name: String, HandlerClass: Function): this 8677 // Adds a new `Handler` to the map, given its name and constructor function. 8678 addHandler: function (name, HandlerClass) { 8679 if (!HandlerClass) { return this; } 8680 8681 var handler = this[name] = new HandlerClass(this); 8682 8683 this._handlers.push(handler); 8684 8685 if (this.options[name]) { 8686 handler.enable(); 8687 } 8688 8689 return this; 8690 }, 8691 8692 // @method remove(): this 8693 // Destroys the map and clears all related event listeners. 8694 remove: function () { 8695 8696 this._initEvents(true); 8697 8698 if (this._containerId !== this._container._leaflet_id) { 8699 throw new Error('Map container is being reused by another instance'); 8700 } 8701 8702 try { 8703 // throws error in IE6-8 8704 delete this._container._leaflet_id; 8705 delete this._containerId; 8706 } catch (e) { 8707 /*eslint-disable */ 8708 this._container._leaflet_id = undefined; 8709 /* eslint-enable */ 8710 this._containerId = undefined; 8711 } 8712 8713 if (this._locationWatchId !== undefined) { 8714 this.stopLocate(); 8715 } 8716 8717 this._stop(); 8718 8719 remove(this._mapPane); 8720 8721 if (this._clearControlPos) { 8722 this._clearControlPos(); 8723 } 8724 if (this._resizeRequest) { 8725 cancelAnimFrame(this._resizeRequest); 8726 this._resizeRequest = null; 8727 } 8728 8729 this._clearHandlers(); 8730 8731 if (this._loaded) { 8732 // @section Map state change events 8733 // @event unload: Event 8734 // Fired when the map is destroyed with [remove](#map-remove) method. 8735 this.fire('unload'); 8736 } 8737 8738 var i; 8739 for (i in this._layers) { 8740 this._layers[i].remove(); 8741 } 8742 for (i in this._panes) { 8743 remove(this._panes[i]); 8744 } 8745 8746 this._layers = []; 8747 this._panes = []; 8748 delete this._mapPane; 8749 delete this._renderer; 8750 8751 return this; 8752 }, 8753 8754 // @section Other Methods 8755 // @method createPane(name: String, container?: HTMLElement): HTMLElement 8756 // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already, 8757 // then returns it. The pane is created as a child of `container`, or 8758 // as a child of the main map pane if not set. 8759 createPane: function (name, container) { 8760 var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''), 8761 pane = create$1('div', className, container || this._mapPane); 8762 8763 if (name) { 8764 this._panes[name] = pane; 8765 } 8766 return pane; 8767 }, 8768 8769 // @section Methods for Getting Map State 8770 8771 // @method getCenter(): LatLng 8772 // Returns the geographical center of the map view 8773 getCenter: function () { 8774 this._checkIfLoaded(); 8775 8776 if (this._lastCenter && !this._moved()) { 8777 return this._lastCenter; 8778 } 8779 return this.layerPointToLatLng(this._getCenterLayerPoint()); 8780 }, 8781 8782 // @method getZoom(): Number 8783 // Returns the current zoom level of the map view 8784 getZoom: function () { 8785 return this._zoom; 8786 }, 8787 8788 // @method getBounds(): LatLngBounds 8789 // Returns the geographical bounds visible in the current map view 8790 getBounds: function () { 8791 var bounds = this.getPixelBounds(), 8792 sw = this.unproject(bounds.getBottomLeft()), 8793 ne = this.unproject(bounds.getTopRight()); 8794 8795 return new LatLngBounds(sw, ne); 8796 }, 8797 8798 // @method getMinZoom(): Number 8799 // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default. 8800 getMinZoom: function () { 8801 return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom; 8802 }, 8803 8804 // @method getMaxZoom(): Number 8805 // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers). 8806 getMaxZoom: function () { 8807 return this.options.maxZoom === undefined ? 8808 (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) : 8809 this.options.maxZoom; 8810 }, 8811 8812 // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number 8813 // Returns the maximum zoom level on which the given bounds fit to the map 8814 // view in its entirety. If `inside` (optional) is set to `true`, the method 8815 // instead returns the minimum zoom level on which the map view fits into 8816 // the given bounds in its entirety. 8817 getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number 8818 bounds = toLatLngBounds(bounds); 8819 padding = toPoint(padding || [0, 0]); 8820 8821 var zoom = this.getZoom() || 0, 8822 min = this.getMinZoom(), 8823 max = this.getMaxZoom(), 8824 nw = bounds.getNorthWest(), 8825 se = bounds.getSouthEast(), 8826 size = this.getSize().subtract(padding), 8827 boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(), 8828 snap = any3d ? this.options.zoomSnap : 1, 8829 scalex = size.x / boundsSize.x, 8830 scaley = size.y / boundsSize.y, 8831 scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley); 8832 8833 zoom = this.getScaleZoom(scale, zoom); 8834 8835 if (snap) { 8836 zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level 8837 zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap; 8838 } 8839 8840 return Math.max(min, Math.min(max, zoom)); 8841 }, 8842 8843 // @method getSize(): Point 8844 // Returns the current size of the map container (in pixels). 8845 getSize: function () { 8846 if (!this._size || this._sizeChanged) { 8847 this._size = new Point( 8848 this._container.clientWidth || 0, 8849 this._container.clientHeight || 0); 8850 8851 this._sizeChanged = false; 8852 } 8853 return this._size.clone(); 8854 }, 8855 8856 // @method getPixelBounds(): Bounds 8857 // Returns the bounds of the current map view in projected pixel 8858 // coordinates (sometimes useful in layer and overlay implementations). 8859 getPixelBounds: function (center, zoom) { 8860 var topLeftPoint = this._getTopLeftPoint(center, zoom); 8861 return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize())); 8862 }, 8863 8864 // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to 8865 // the map pane? "left point of the map layer" can be confusing, specially 8866 // since there can be negative offsets. 8867 // @method getPixelOrigin(): Point 8868 // Returns the projected pixel coordinates of the top left point of 8869 // the map layer (useful in custom layer and overlay implementations). 8870 getPixelOrigin: function () { 8871 this._checkIfLoaded(); 8872 return this._pixelOrigin; 8873 }, 8874 8875 // @method getPixelWorldBounds(zoom?: Number): Bounds 8876 // Returns the world's bounds in pixel coordinates for zoom level `zoom`. 8877 // If `zoom` is omitted, the map's current zoom level is used. 8878 getPixelWorldBounds: function (zoom) { 8879 return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom); 8880 }, 8881 8882 // @section Other Methods 8883 8884 // @method getPane(pane: String|HTMLElement): HTMLElement 8885 // Returns a [map pane](#map-pane), given its name or its HTML element (its identity). 8886 getPane: function (pane) { 8887 return typeof pane === 'string' ? this._panes[pane] : pane; 8888 }, 8889 8890 // @method getPanes(): Object 8891 // Returns a plain object containing the names of all [panes](#map-pane) as keys and 8892 // the panes as values. 8893 getPanes: function () { 8894 return this._panes; 8895 }, 8896 8897 // @method getContainer: HTMLElement 8898 // Returns the HTML element that contains the map. 8899 getContainer: function () { 8900 return this._container; 8901 }, 8902 8903 8904 // @section Conversion Methods 8905 8906 // @method getZoomScale(toZoom: Number, fromZoom: Number): Number 8907 // Returns the scale factor to be applied to a map transition from zoom level 8908 // `fromZoom` to `toZoom`. Used internally to help with zoom animations. 8909 getZoomScale: function (toZoom, fromZoom) { 8910 // TODO replace with universal implementation after refactoring projections 8911 var crs = this.options.crs; 8912 fromZoom = fromZoom === undefined ? this._zoom : fromZoom; 8913 return crs.scale(toZoom) / crs.scale(fromZoom); 8914 }, 8915 8916 // @method getScaleZoom(scale: Number, fromZoom: Number): Number 8917 // Returns the zoom level that the map would end up at, if it is at `fromZoom` 8918 // level and everything is scaled by a factor of `scale`. Inverse of 8919 // [`getZoomScale`](#map-getZoomScale). 8920 getScaleZoom: function (scale, fromZoom) { 8921 var crs = this.options.crs; 8922 fromZoom = fromZoom === undefined ? this._zoom : fromZoom; 8923 var zoom = crs.zoom(scale * crs.scale(fromZoom)); 8924 return isNaN(zoom) ? Infinity : zoom; 8925 }, 8926 8927 // @method project(latlng: LatLng, zoom: Number): Point 8928 // Projects a geographical coordinate `LatLng` according to the projection 8929 // of the map's CRS, then scales it according to `zoom` and the CRS's 8930 // `Transformation`. The result is pixel coordinate relative to 8931 // the CRS origin. 8932 project: function (latlng, zoom) { 8933 zoom = zoom === undefined ? this._zoom : zoom; 8934 return this.options.crs.latLngToPoint(toLatLng(latlng), zoom); 8935 }, 8936 8937 // @method unproject(point: Point, zoom: Number): LatLng 8938 // Inverse of [`project`](#map-project). 8939 unproject: function (point, zoom) { 8940 zoom = zoom === undefined ? this._zoom : zoom; 8941 return this.options.crs.pointToLatLng(toPoint(point), zoom); 8942 }, 8943 8944 // @method layerPointToLatLng(point: Point): LatLng 8945 // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), 8946 // returns the corresponding geographical coordinate (for the current zoom level). 8947 layerPointToLatLng: function (point) { 8948 var projectedPoint = toPoint(point).add(this.getPixelOrigin()); 8949 return this.unproject(projectedPoint); 8950 }, 8951 8952 // @method latLngToLayerPoint(latlng: LatLng): Point 8953 // Given a geographical coordinate, returns the corresponding pixel coordinate 8954 // relative to the [origin pixel](#map-getpixelorigin). 8955 latLngToLayerPoint: function (latlng) { 8956 var projectedPoint = this.project(toLatLng(latlng))._round(); 8957 return projectedPoint._subtract(this.getPixelOrigin()); 8958 }, 8959 8960 // @method wrapLatLng(latlng: LatLng): LatLng 8961 // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the 8962 // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the 8963 // CRS's bounds. 8964 // By default this means longitude is wrapped around the dateline so its 8965 // value is between -180 and +180 degrees. 8966 wrapLatLng: function (latlng) { 8967 return this.options.crs.wrapLatLng(toLatLng(latlng)); 8968 }, 8969 8970 // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds 8971 // Returns a `LatLngBounds` with the same size as the given one, ensuring that 8972 // its center is within the CRS's bounds. 8973 // By default this means the center longitude is wrapped around the dateline so its 8974 // value is between -180 and +180 degrees, and the majority of the bounds 8975 // overlaps the CRS's bounds. 8976 wrapLatLngBounds: function (latlng) { 8977 return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng)); 8978 }, 8979 8980 // @method distance(latlng1: LatLng, latlng2: LatLng): Number 8981 // Returns the distance between two geographical coordinates according to 8982 // the map's CRS. By default this measures distance in meters. 8983 distance: function (latlng1, latlng2) { 8984 return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2)); 8985 }, 8986 8987 // @method containerPointToLayerPoint(point: Point): Point 8988 // Given a pixel coordinate relative to the map container, returns the corresponding 8989 // pixel coordinate relative to the [origin pixel](#map-getpixelorigin). 8990 containerPointToLayerPoint: function (point) { // (Point) 8991 return toPoint(point).subtract(this._getMapPanePos()); 8992 }, 8993 8994 // @method layerPointToContainerPoint(point: Point): Point 8995 // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), 8996 // returns the corresponding pixel coordinate relative to the map container. 8997 layerPointToContainerPoint: function (point) { // (Point) 8998 return toPoint(point).add(this._getMapPanePos()); 8999 }, 9000 9001 // @method containerPointToLatLng(point: Point): LatLng 9002 // Given a pixel coordinate relative to the map container, returns 9003 // the corresponding geographical coordinate (for the current zoom level). 9004 containerPointToLatLng: function (point) { 9005 var layerPoint = this.containerPointToLayerPoint(toPoint(point)); 9006 return this.layerPointToLatLng(layerPoint); 9007 }, 9008 9009 // @method latLngToContainerPoint(latlng: LatLng): Point 9010 // Given a geographical coordinate, returns the corresponding pixel coordinate 9011 // relative to the map container. 9012 latLngToContainerPoint: function (latlng) { 9013 return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng))); 9014 }, 9015 9016 // @method mouseEventToContainerPoint(ev: MouseEvent): Point 9017 // Given a MouseEvent object, returns the pixel coordinate relative to the 9018 // map container where the event took place. 9019 mouseEventToContainerPoint: function (e) { 9020 return getMousePosition(e, this._container); 9021 }, 9022 9023 // @method mouseEventToLayerPoint(ev: MouseEvent): Point 9024 // Given a MouseEvent object, returns the pixel coordinate relative to 9025 // the [origin pixel](#map-getpixelorigin) where the event took place. 9026 mouseEventToLayerPoint: function (e) { 9027 return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e)); 9028 }, 9029 9030 // @method mouseEventToLatLng(ev: MouseEvent): LatLng 9031 // Given a MouseEvent object, returns geographical coordinate where the 9032 // event took place. 9033 mouseEventToLatLng: function (e) { // (MouseEvent) 9034 return this.layerPointToLatLng(this.mouseEventToLayerPoint(e)); 9035 }, 9036 9037 9038 // map initialization methods 9039 9040 _initContainer: function (id) { 9041 var container = this._container = get(id); 9042 9043 if (!container) { 9044 throw new Error('Map container not found.'); 9045 } else if (container._leaflet_id) { 9046 throw new Error('Map container is already initialized.'); 9047 } 9048 9049 on(container, 'scroll', this._onScroll, this); 9050 this._containerId = stamp(container); 9051 }, 9052 9053 _initLayout: function () { 9054 var container = this._container; 9055 9056 this._fadeAnimated = this.options.fadeAnimation && any3d; 9057 9058 addClass(container, 'leaflet-container' + 9059 (touch ? ' leaflet-touch' : '') + 9060 (retina ? ' leaflet-retina' : '') + 9061 (ielt9 ? ' leaflet-oldie' : '') + 9062 (safari ? ' leaflet-safari' : '') + 9063 (this._fadeAnimated ? ' leaflet-fade-anim' : '')); 9064 9065 var position = getStyle(container, 'position'); 9066 9067 if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') { 9068 container.style.position = 'relative'; 9069 } 9070 9071 this._initPanes(); 9072 9073 if (this._initControlPos) { 9074 this._initControlPos(); 9075 } 9076 }, 9077 9078 _initPanes: function () { 9079 var panes = this._panes = {}; 9080 this._paneRenderers = {}; 9081 9082 // @section 9083 // 9084 // Panes are DOM elements used to control the ordering of layers on the map. You 9085 // can access panes with [`map.getPane`](#map-getpane) or 9086 // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the 9087 // [`map.createPane`](#map-createpane) method. 9088 // 9089 // Every map has the following default panes that differ only in zIndex. 9090 // 9091 // @pane mapPane: HTMLElement = 'auto' 9092 // Pane that contains all other map panes 9093 9094 this._mapPane = this.createPane('mapPane', this._container); 9095 setPosition(this._mapPane, new Point(0, 0)); 9096 9097 // @pane tilePane: HTMLElement = 200 9098 // Pane for `GridLayer`s and `TileLayer`s 9099 this.createPane('tilePane'); 9100 // @pane overlayPane: HTMLElement = 400 9101 // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s 9102 this.createPane('shadowPane'); 9103 // @pane shadowPane: HTMLElement = 500 9104 // Pane for overlay shadows (e.g. `Marker` shadows) 9105 this.createPane('overlayPane'); 9106 // @pane markerPane: HTMLElement = 600 9107 // Pane for `Icon`s of `Marker`s 9108 this.createPane('markerPane'); 9109 // @pane tooltipPane: HTMLElement = 650 9110 // Pane for `Tooltip`s. 9111 this.createPane('tooltipPane'); 9112 // @pane popupPane: HTMLElement = 700 9113 // Pane for `Popup`s. 9114 this.createPane('popupPane'); 9115 9116 if (!this.options.markerZoomAnimation) { 9117 addClass(panes.markerPane, 'leaflet-zoom-hide'); 9118 addClass(panes.shadowPane, 'leaflet-zoom-hide'); 9119 } 9120 }, 9121 9122 9123 // private methods that modify map state 9124 9125 // @section Map state change events 9126 _resetView: function (center, zoom) { 9127 setPosition(this._mapPane, new Point(0, 0)); 9128 9129 var loading = !this._loaded; 9130 this._loaded = true; 9131 zoom = this._limitZoom(zoom); 9132 9133 this.fire('viewprereset'); 9134 9135 var zoomChanged = this._zoom !== zoom; 9136 this 9137 ._moveStart(zoomChanged, false) 9138 ._move(center, zoom) 9139 ._moveEnd(zoomChanged); 9140 9141 // @event viewreset: Event 9142 // Fired when the map needs to redraw its content (this usually happens 9143 // on map zoom or load). Very useful for creating custom overlays. 9144 this.fire('viewreset'); 9145 9146 // @event load: Event 9147 // Fired when the map is initialized (when its center and zoom are set 9148 // for the first time). 9149 if (loading) { 9150 this.fire('load'); 9151 } 9152 }, 9153 9154 _moveStart: function (zoomChanged, noMoveStart) { 9155 // @event zoomstart: Event 9156 // Fired when the map zoom is about to change (e.g. before zoom animation). 9157 // @event movestart: Event 9158 // Fired when the view of the map starts changing (e.g. user starts dragging the map). 9159 if (zoomChanged) { 9160 this.fire('zoomstart'); 9161 } 9162 if (!noMoveStart) { 9163 this.fire('movestart'); 9164 } 9165 return this; 9166 }, 9167 9168 _move: function (center, zoom, data) { 9169 if (zoom === undefined) { 9170 zoom = this._zoom; 9171 } 9172 var zoomChanged = this._zoom !== zoom; 9173 9174 this._zoom = zoom; 9175 this._lastCenter = center; 9176 this._pixelOrigin = this._getNewPixelOrigin(center); 9177 9178 // @event zoom: Event 9179 // Fired repeatedly during any change in zoom level, including zoom 9180 // and fly animations. 9181 if (zoomChanged || (data && data.pinch)) { // Always fire 'zoom' if pinching because #3530 9182 this.fire('zoom', data); 9183 } 9184 9185 // @event move: Event 9186 // Fired repeatedly during any movement of the map, including pan and 9187 // fly animations. 9188 return this.fire('move', data); 9189 }, 9190 9191 _moveEnd: function (zoomChanged) { 9192 // @event zoomend: Event 9193 // Fired when the map has changed, after any animations. 9194 if (zoomChanged) { 9195 this.fire('zoomend'); 9196 } 9197 9198 // @event moveend: Event 9199 // Fired when the center of the map stops changing (e.g. user stopped 9200 // dragging the map). 9201 return this.fire('moveend'); 9202 }, 9203 9204 _stop: function () { 9205 cancelAnimFrame(this._flyToFrame); 9206 if (this._panAnim) { 9207 this._panAnim.stop(); 9208 } 9209 return this; 9210 }, 9211 9212 _rawPanBy: function (offset) { 9213 setPosition(this._mapPane, this._getMapPanePos().subtract(offset)); 9214 }, 9215 9216 _getZoomSpan: function () { 9217 return this.getMaxZoom() - this.getMinZoom(); 9218 }, 9219 9220 _panInsideMaxBounds: function () { 9221 if (!this._enforcingBounds) { 9222 this.panInsideBounds(this.options.maxBounds); 9223 } 9224 }, 9225 9226 _checkIfLoaded: function () { 9227 if (!this._loaded) { 9228 throw new Error('Set map center and zoom first.'); 9229 } 9230 }, 9231 9232 // DOM event handling 9233 9234 // @section Interaction events 9235 _initEvents: function (remove$$1) { 9236 this._targets = {}; 9237 this._targets[stamp(this._container)] = this; 9238 9239 var onOff = remove$$1 ? off : on; 9240 9241 // @event click: MouseEvent 9242 // Fired when the user clicks (or taps) the map. 9243 // @event dblclick: MouseEvent 9244 // Fired when the user double-clicks (or double-taps) the map. 9245 // @event mousedown: MouseEvent 9246 // Fired when the user pushes the mouse button on the map. 9247 // @event mouseup: MouseEvent 9248 // Fired when the user releases the mouse button on the map. 9249 // @event mouseover: MouseEvent 9250 // Fired when the mouse enters the map. 9251 // @event mouseout: MouseEvent 9252 // Fired when the mouse leaves the map. 9253 // @event mousemove: MouseEvent 9254 // Fired while the mouse moves over the map. 9255 // @event contextmenu: MouseEvent 9256 // Fired when the user pushes the right mouse button on the map, prevents 9257 // default browser context menu from showing if there are listeners on 9258 // this event. Also fired on mobile when the user holds a single touch 9259 // for a second (also called long press). 9260 // @event keypress: KeyboardEvent 9261 // Fired when the user presses a key from the keyboard that produces a character value while the map is focused. 9262 // @event keydown: KeyboardEvent 9263 // Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event, 9264 // the `keydown` event is fired for keys that produce a character value and for keys 9265 // that do not produce a character value. 9266 // @event keyup: KeyboardEvent 9267 // Fired when the user releases a key from the keyboard while the map is focused. 9268 onOff(this._container, 'click dblclick mousedown mouseup ' + 9269 'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this); 9270 9271 if (this.options.trackResize) { 9272 onOff(window, 'resize', this._onResize, this); 9273 } 9274 9275 if (any3d && this.options.transform3DLimit) { 9276 (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd); 9277 } 9278 }, 9279 9280 _onResize: function () { 9281 cancelAnimFrame(this._resizeRequest); 9282 this._resizeRequest = requestAnimFrame( 9283 function () { this.invalidateSize({debounceMoveend: true}); }, this); 9284 }, 9285 9286 _onScroll: function () { 9287 this._container.scrollTop = 0; 9288 this._container.scrollLeft = 0; 9289 }, 9290 9291 _onMoveEnd: function () { 9292 var pos = this._getMapPanePos(); 9293 if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) { 9294 // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have 9295 // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/ 9296 this._resetView(this.getCenter(), this.getZoom()); 9297 } 9298 }, 9299 9300 _findEventTargets: function (e, type) { 9301 var targets = [], 9302 target, 9303 isHover = type === 'mouseout' || type === 'mouseover', 9304 src = e.target || e.srcElement, 9305 dragging = false; 9306 9307 while (src) { 9308 target = this._targets[stamp(src)]; 9309 if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) { 9310 // Prevent firing click after you just dragged an object. 9311 dragging = true; 9312 break; 9313 } 9314 if (target && target.listens(type, true)) { 9315 if (isHover && !isExternalTarget(src, e)) { break; } 9316 targets.push(target); 9317 if (isHover) { break; } 9318 } 9319 if (src === this._container) { break; } 9320 src = src.parentNode; 9321 } 9322 if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) { 9323 targets = [this]; 9324 } 9325 return targets; 9326 }, 9327 9328 _handleDOMEvent: function (e) { 9329 if (!this._loaded || skipped(e)) { return; } 9330 9331 var type = e.type; 9332 9333 if (type === 'mousedown' || type === 'keypress' || type === 'keyup' || type === 'keydown') { 9334 // prevents outline when clicking on keyboard-focusable element 9335 preventOutline(e.target || e.srcElement); 9336 } 9337 9338 this._fireDOMEvent(e, type); 9339 }, 9340 9341 _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'], 9342 9343 _fireDOMEvent: function (e, type, targets) { 9344 9345 if (e.type === 'click') { 9346 // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups). 9347 // @event preclick: MouseEvent 9348 // Fired before mouse click on the map (sometimes useful when you 9349 // want something to happen on click before any existing click 9350 // handlers start running). 9351 var synth = extend({}, e); 9352 synth.type = 'preclick'; 9353 this._fireDOMEvent(synth, synth.type, targets); 9354 } 9355 9356 if (e._stopped) { return; } 9357 9358 // Find the layer the event is propagating from and its parents. 9359 targets = (targets || []).concat(this._findEventTargets(e, type)); 9360 9361 if (!targets.length) { return; } 9362 9363 var target = targets[0]; 9364 if (type === 'contextmenu' && target.listens(type, true)) { 9365 preventDefault(e); 9366 } 9367 9368 var data = { 9369 originalEvent: e 9370 }; 9371 9372 if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') { 9373 var isMarker = target.getLatLng && (!target._radius || target._radius <= 10); 9374 data.containerPoint = isMarker ? 9375 this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e); 9376 data.layerPoint = this.containerPointToLayerPoint(data.containerPoint); 9377 data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint); 9378 } 9379 9380 for (var i = 0; i < targets.length; i++) { 9381 targets[i].fire(type, data, true); 9382 if (data.originalEvent._stopped || 9383 (targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; } 9384 } 9385 }, 9386 9387 _draggableMoved: function (obj) { 9388 obj = obj.dragging && obj.dragging.enabled() ? obj : this; 9389 return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved()); 9390 }, 9391 9392 _clearHandlers: function () { 9393 for (var i = 0, len = this._handlers.length; i < len; i++) { 9394 this._handlers[i].disable(); 9395 } 9396 }, 9397 9398 // @section Other Methods 9399 9400 // @method whenReady(fn: Function, context?: Object): this 9401 // Runs the given function `fn` when the map gets initialized with 9402 // a view (center and zoom) and at least one layer, or immediately 9403 // if it's already initialized, optionally passing a function context. 9404 whenReady: function (callback, context) { 9405 if (this._loaded) { 9406 callback.call(context || this, {target: this}); 9407 } else { 9408 this.on('load', callback, context); 9409 } 9410 return this; 9411 }, 9412 9413 9414 // private methods for getting map state 9415 9416 _getMapPanePos: function () { 9417 return getPosition(this._mapPane) || new Point(0, 0); 9418 }, 9419 9420 _moved: function () { 9421 var pos = this._getMapPanePos(); 9422 return pos && !pos.equals([0, 0]); 9423 }, 9424 9425 _getTopLeftPoint: function (center, zoom) { 9426 var pixelOrigin = center && zoom !== undefined ? 9427 this._getNewPixelOrigin(center, zoom) : 9428 this.getPixelOrigin(); 9429 return pixelOrigin.subtract(this._getMapPanePos()); 9430 }, 9431 9432 _getNewPixelOrigin: function (center, zoom) { 9433 var viewHalf = this.getSize()._divideBy(2); 9434 return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round(); 9435 }, 9436 9437 _latLngToNewLayerPoint: function (latlng, zoom, center) { 9438 var topLeft = this._getNewPixelOrigin(center, zoom); 9439 return this.project(latlng, zoom)._subtract(topLeft); 9440 }, 9441 9442 _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) { 9443 var topLeft = this._getNewPixelOrigin(center, zoom); 9444 return toBounds([ 9445 this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft), 9446 this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft), 9447 this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft), 9448 this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft) 9449 ]); 9450 }, 9451 9452 // layer point of the current center 9453 _getCenterLayerPoint: function () { 9454 return this.containerPointToLayerPoint(this.getSize()._divideBy(2)); 9455 }, 9456 9457 // offset of the specified place to the current center in pixels 9458 _getCenterOffset: function (latlng) { 9459 return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint()); 9460 }, 9461 9462 // adjust center for view to get inside bounds 9463 _limitCenter: function (center, zoom, bounds) { 9464 9465 if (!bounds) { return center; } 9466 9467 var centerPoint = this.project(center, zoom), 9468 viewHalf = this.getSize().divideBy(2), 9469 viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)), 9470 offset = this._getBoundsOffset(viewBounds, bounds, zoom); 9471 9472 // If offset is less than a pixel, ignore. 9473 // This prevents unstable projections from getting into 9474 // an infinite loop of tiny offsets. 9475 if (offset.round().equals([0, 0])) { 9476 return center; 9477 } 9478 9479 return this.unproject(centerPoint.add(offset), zoom); 9480 }, 9481 9482 // adjust offset for view to get inside bounds 9483 _limitOffset: function (offset, bounds) { 9484 if (!bounds) { return offset; } 9485 9486 var viewBounds = this.getPixelBounds(), 9487 newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset)); 9488 9489 return offset.add(this._getBoundsOffset(newBounds, bounds)); 9490 }, 9491 9492 // returns offset needed for pxBounds to get inside maxBounds at a specified zoom 9493 _getBoundsOffset: function (pxBounds, maxBounds, zoom) { 9494 var projectedMaxBounds = toBounds( 9495 this.project(maxBounds.getNorthEast(), zoom), 9496 this.project(maxBounds.getSouthWest(), zoom) 9497 ), 9498 minOffset = projectedMaxBounds.min.subtract(pxBounds.min), 9499 maxOffset = projectedMaxBounds.max.subtract(pxBounds.max), 9500 9501 dx = this._rebound(minOffset.x, -maxOffset.x), 9502 dy = this._rebound(minOffset.y, -maxOffset.y); 9503 9504 return new Point(dx, dy); 9505 }, 9506 9507 _rebound: function (left, right) { 9508 return left + right > 0 ? 9509 Math.round(left - right) / 2 : 9510 Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right)); 9511 }, 9512 9513 _limitZoom: function (zoom) { 9514 var min = this.getMinZoom(), 9515 max = this.getMaxZoom(), 9516 snap = any3d ? this.options.zoomSnap : 1; 9517 if (snap) { 9518 zoom = Math.round(zoom / snap) * snap; 9519 } 9520 return Math.max(min, Math.min(max, zoom)); 9521 }, 9522 9523 _onPanTransitionStep: function () { 9524 this.fire('move'); 9525 }, 9526 9527 _onPanTransitionEnd: function () { 9528 removeClass(this._mapPane, 'leaflet-pan-anim'); 9529 this.fire('moveend'); 9530 }, 9531 9532 _tryAnimatedPan: function (center, options) { 9533 // difference between the new and current centers in pixels 9534 var offset = this._getCenterOffset(center)._trunc(); 9535 9536 // don't animate too far unless animate: true specified in options 9537 if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; } 9538 9539 this.panBy(offset, options); 9540 9541 return true; 9542 }, 9543 9544 _createAnimProxy: function () { 9545 9546 var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated'); 9547 this._panes.mapPane.appendChild(proxy); 9548 9549 this.on('zoomanim', function (e) { 9550 var prop = TRANSFORM, 9551 transform = this._proxy.style[prop]; 9552 9553 setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1)); 9554 9555 // workaround for case when transform is the same and so transitionend event is not fired 9556 if (transform === this._proxy.style[prop] && this._animatingZoom) { 9557 this._onZoomTransitionEnd(); 9558 } 9559 }, this); 9560 9561 this.on('load moveend', this._animMoveEnd, this); 9562 9563 this._on('unload', this._destroyAnimProxy, this); 9564 }, 9565 9566 _destroyAnimProxy: function () { 9567 remove(this._proxy); 9568 this.off('load moveend', this._animMoveEnd, this); 9569 delete this._proxy; 9570 }, 9571 9572 _animMoveEnd: function () { 9573 var c = this.getCenter(), 9574 z = this.getZoom(); 9575 setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1)); 9576 }, 9577 9578 _catchTransitionEnd: function (e) { 9579 if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) { 9580 this._onZoomTransitionEnd(); 9581 } 9582 }, 9583 9584 _nothingToAnimate: function () { 9585 return !this._container.getElementsByClassName('leaflet-zoom-animated').length; 9586 }, 9587 9588 _tryAnimatedZoom: function (center, zoom, options) { 9589 9590 if (this._animatingZoom) { return true; } 9591 9592 options = options || {}; 9593 9594 // don't animate if disabled, not supported or zoom difference is too large 9595 if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() || 9596 Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; } 9597 9598 // offset is the pixel coords of the zoom origin relative to the current center 9599 var scale = this.getZoomScale(zoom), 9600 offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale); 9601 9602 // don't animate if the zoom origin isn't within one screen from the current center, unless forced 9603 if (options.animate !== true && !this.getSize().contains(offset)) { return false; } 9604 9605 requestAnimFrame(function () { 9606 this 9607 ._moveStart(true, false) 9608 ._animateZoom(center, zoom, true); 9609 }, this); 9610 9611 return true; 9612 }, 9613 9614 _animateZoom: function (center, zoom, startAnim, noUpdate) { 9615 if (!this._mapPane) { return; } 9616 9617 if (startAnim) { 9618 this._animatingZoom = true; 9619 9620 // remember what center/zoom to set after animation 9621 this._animateToCenter = center; 9622 this._animateToZoom = zoom; 9623 9624 addClass(this._mapPane, 'leaflet-zoom-anim'); 9625 } 9626 9627 // @section Other Events 9628 // @event zoomanim: ZoomAnimEvent 9629 // Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom. 9630 this.fire('zoomanim', { 9631 center: center, 9632 zoom: zoom, 9633 noUpdate: noUpdate 9634 }); 9635 9636 // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693 9637 setTimeout(bind(this._onZoomTransitionEnd, this), 250); 9638 }, 9639 9640 _onZoomTransitionEnd: function () { 9641 if (!this._animatingZoom) { return; } 9642 9643 if (this._mapPane) { 9644 removeClass(this._mapPane, 'leaflet-zoom-anim'); 9645 } 9646 9647 this._animatingZoom = false; 9648 9649 this._move(this._animateToCenter, this._animateToZoom); 9650 9651 // This anim frame should prevent an obscure iOS webkit tile loading race condition. 9652 requestAnimFrame(function () { 9653 this._moveEnd(true); 9654 }, this); 9655 } 9656}); 9657 9658// @section 9659 9660// @factory L.map(id: String, options?: Map options) 9661// Instantiates a map object given the DOM ID of a `<div>` element 9662// and optionally an object literal with `Map options`. 9663// 9664// @alternative 9665// @factory L.map(el: HTMLElement, options?: Map options) 9666// Instantiates a map object given an instance of a `<div>` HTML element 9667// and optionally an object literal with `Map options`. 9668function createMap(id, options) { 9669 return new Map(id, options); 9670} 9671 9672/* 9673 * @class Control 9674 * @aka L.Control 9675 * @inherits Class 9676 * 9677 * L.Control is a base class for implementing map controls. Handles positioning. 9678 * All other controls extend from this class. 9679 */ 9680 9681var Control = Class.extend({ 9682 // @section 9683 // @aka Control options 9684 options: { 9685 // @option position: String = 'topright' 9686 // The position of the control (one of the map corners). Possible values are `'topleft'`, 9687 // `'topright'`, `'bottomleft'` or `'bottomright'` 9688 position: 'topright' 9689 }, 9690 9691 initialize: function (options) { 9692 setOptions(this, options); 9693 }, 9694 9695 /* @section 9696 * Classes extending L.Control will inherit the following methods: 9697 * 9698 * @method getPosition: string 9699 * Returns the position of the control. 9700 */ 9701 getPosition: function () { 9702 return this.options.position; 9703 }, 9704 9705 // @method setPosition(position: string): this 9706 // Sets the position of the control. 9707 setPosition: function (position) { 9708 var map = this._map; 9709 9710 if (map) { 9711 map.removeControl(this); 9712 } 9713 9714 this.options.position = position; 9715 9716 if (map) { 9717 map.addControl(this); 9718 } 9719 9720 return this; 9721 }, 9722 9723 // @method getContainer: HTMLElement 9724 // Returns the HTMLElement that contains the control. 9725 getContainer: function () { 9726 return this._container; 9727 }, 9728 9729 // @method addTo(map: Map): this 9730 // Adds the control to the given map. 9731 addTo: function (map) { 9732 this.remove(); 9733 this._map = map; 9734 9735 var container = this._container = this.onAdd(map), 9736 pos = this.getPosition(), 9737 corner = map._controlCorners[pos]; 9738 9739 addClass(container, 'leaflet-control'); 9740 9741 if (pos.indexOf('bottom') !== -1) { 9742 corner.insertBefore(container, corner.firstChild); 9743 } else { 9744 corner.appendChild(container); 9745 } 9746 9747 this._map.on('unload', this.remove, this); 9748 9749 return this; 9750 }, 9751 9752 // @method remove: this 9753 // Removes the control from the map it is currently active on. 9754 remove: function () { 9755 if (!this._map) { 9756 return this; 9757 } 9758 9759 remove(this._container); 9760 9761 if (this.onRemove) { 9762 this.onRemove(this._map); 9763 } 9764 9765 this._map.off('unload', this.remove, this); 9766 this._map = null; 9767 9768 return this; 9769 }, 9770 9771 _refocusOnMap: function (e) { 9772 // if map exists and event is not a keyboard event 9773 if (this._map && e && e.screenX > 0 && e.screenY > 0) { 9774 this._map.getContainer().focus(); 9775 } 9776 } 9777}); 9778 9779var control = function (options) { 9780 return new Control(options); 9781}; 9782 9783/* @section Extension methods 9784 * @uninheritable 9785 * 9786 * Every control should extend from `L.Control` and (re-)implement the following methods. 9787 * 9788 * @method onAdd(map: Map): HTMLElement 9789 * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo). 9790 * 9791 * @method onRemove(map: Map) 9792 * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove). 9793 */ 9794 9795/* @namespace Map 9796 * @section Methods for Layers and Controls 9797 */ 9798Map.include({ 9799 // @method addControl(control: Control): this 9800 // Adds the given control to the map 9801 addControl: function (control) { 9802 control.addTo(this); 9803 return this; 9804 }, 9805 9806 // @method removeControl(control: Control): this 9807 // Removes the given control from the map 9808 removeControl: function (control) { 9809 control.remove(); 9810 return this; 9811 }, 9812 9813 _initControlPos: function () { 9814 var corners = this._controlCorners = {}, 9815 l = 'leaflet-', 9816 container = this._controlContainer = 9817 create$1('div', l + 'control-container', this._container); 9818 9819 function createCorner(vSide, hSide) { 9820 var className = l + vSide + ' ' + l + hSide; 9821 9822 corners[vSide + hSide] = create$1('div', className, container); 9823 } 9824 9825 createCorner('top', 'left'); 9826 createCorner('top', 'right'); 9827 createCorner('bottom', 'left'); 9828 createCorner('bottom', 'right'); 9829 }, 9830 9831 _clearControlPos: function () { 9832 for (var i in this._controlCorners) { 9833 remove(this._controlCorners[i]); 9834 } 9835 remove(this._controlContainer); 9836 delete this._controlCorners; 9837 delete this._controlContainer; 9838 } 9839}); 9840 9841/* 9842 * @class Control.Layers 9843 * @aka L.Control.Layers 9844 * @inherits Control 9845 * 9846 * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`. 9847 * 9848 * @example 9849 * 9850 * ```js 9851 * var baseLayers = { 9852 * "Mapbox": mapbox, 9853 * "OpenStreetMap": osm 9854 * }; 9855 * 9856 * var overlays = { 9857 * "Marker": marker, 9858 * "Roads": roadsLayer 9859 * }; 9860 * 9861 * L.control.layers(baseLayers, overlays).addTo(map); 9862 * ``` 9863 * 9864 * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values: 9865 * 9866 * ```js 9867 * { 9868 * "<someName1>": layer1, 9869 * "<someName2>": layer2 9870 * } 9871 * ``` 9872 * 9873 * The layer names can contain HTML, which allows you to add additional styling to the items: 9874 * 9875 * ```js 9876 * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer} 9877 * ``` 9878 */ 9879 9880var Layers = Control.extend({ 9881 // @section 9882 // @aka Control.Layers options 9883 options: { 9884 // @option collapsed: Boolean = true 9885 // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch. 9886 collapsed: true, 9887 position: 'topright', 9888 9889 // @option autoZIndex: Boolean = true 9890 // If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off. 9891 autoZIndex: true, 9892 9893 // @option hideSingleBase: Boolean = false 9894 // If `true`, the base layers in the control will be hidden when there is only one. 9895 hideSingleBase: false, 9896 9897 // @option sortLayers: Boolean = false 9898 // Whether to sort the layers. When `false`, layers will keep the order 9899 // in which they were added to the control. 9900 sortLayers: false, 9901 9902 // @option sortFunction: Function = * 9903 // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) 9904 // that will be used for sorting the layers, when `sortLayers` is `true`. 9905 // The function receives both the `L.Layer` instances and their names, as in 9906 // `sortFunction(layerA, layerB, nameA, nameB)`. 9907 // By default, it sorts layers alphabetically by their name. 9908 sortFunction: function (layerA, layerB, nameA, nameB) { 9909 return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0); 9910 } 9911 }, 9912 9913 initialize: function (baseLayers, overlays, options) { 9914 setOptions(this, options); 9915 9916 this._layerControlInputs = []; 9917 this._layers = []; 9918 this._lastZIndex = 0; 9919 this._handlingClick = false; 9920 9921 for (var i in baseLayers) { 9922 this._addLayer(baseLayers[i], i); 9923 } 9924 9925 for (i in overlays) { 9926 this._addLayer(overlays[i], i, true); 9927 } 9928 }, 9929 9930 onAdd: function (map) { 9931 this._initLayout(); 9932 this._update(); 9933 9934 this._map = map; 9935 map.on('zoomend', this._checkDisabledLayers, this); 9936 9937 for (var i = 0; i < this._layers.length; i++) { 9938 this._layers[i].layer.on('add remove', this._onLayerChange, this); 9939 } 9940 9941 return this._container; 9942 }, 9943 9944 addTo: function (map) { 9945 Control.prototype.addTo.call(this, map); 9946 // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height. 9947 return this._expandIfNotCollapsed(); 9948 }, 9949 9950 onRemove: function () { 9951 this._map.off('zoomend', this._checkDisabledLayers, this); 9952 9953 for (var i = 0; i < this._layers.length; i++) { 9954 this._layers[i].layer.off('add remove', this._onLayerChange, this); 9955 } 9956 }, 9957 9958 // @method addBaseLayer(layer: Layer, name: String): this 9959 // Adds a base layer (radio button entry) with the given name to the control. 9960 addBaseLayer: function (layer, name) { 9961 this._addLayer(layer, name); 9962 return (this._map) ? this._update() : this; 9963 }, 9964 9965 // @method addOverlay(layer: Layer, name: String): this 9966 // Adds an overlay (checkbox entry) with the given name to the control. 9967 addOverlay: function (layer, name) { 9968 this._addLayer(layer, name, true); 9969 return (this._map) ? this._update() : this; 9970 }, 9971 9972 // @method removeLayer(layer: Layer): this 9973 // Remove the given layer from the control. 9974 removeLayer: function (layer) { 9975 layer.off('add remove', this._onLayerChange, this); 9976 9977 var obj = this._getLayer(stamp(layer)); 9978 if (obj) { 9979 this._layers.splice(this._layers.indexOf(obj), 1); 9980 } 9981 return (this._map) ? this._update() : this; 9982 }, 9983 9984 // @method expand(): this 9985 // Expand the control container if collapsed. 9986 expand: function () { 9987 addClass(this._container, 'leaflet-control-layers-expanded'); 9988 this._section.style.height = null; 9989 var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50); 9990 if (acceptableHeight < this._section.clientHeight) { 9991 addClass(this._section, 'leaflet-control-layers-scrollbar'); 9992 this._section.style.height = acceptableHeight + 'px'; 9993 } else { 9994 removeClass(this._section, 'leaflet-control-layers-scrollbar'); 9995 } 9996 this._checkDisabledLayers(); 9997 return this; 9998 }, 9999 10000 // @method collapse(): this 10001 // Collapse the control container if expanded. 10002 collapse: function () { 10003 removeClass(this._container, 'leaflet-control-layers-expanded'); 10004 return this; 10005 }, 10006 10007 _initLayout: function () { 10008 var className = 'leaflet-control-layers', 10009 container = this._container = create$1('div', className), 10010 collapsed = this.options.collapsed; 10011 10012 // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released 10013 container.setAttribute('aria-haspopup', true); 10014 10015 disableClickPropagation(container); 10016 disableScrollPropagation(container); 10017 10018 var section = this._section = create$1('section', className + '-list'); 10019 10020 if (collapsed) { 10021 this._map.on('click', this.collapse, this); 10022 10023 if (!android) { 10024 on(container, { 10025 mouseenter: this.expand, 10026 mouseleave: this.collapse 10027 }, this); 10028 } 10029 } 10030 10031 var link = this._layersLink = create$1('a', className + '-toggle', container); 10032 link.href = '#'; 10033 link.title = 'Layers'; 10034 10035 if (touch) { 10036 on(link, 'click', stop); 10037 on(link, 'click', this.expand, this); 10038 } else { 10039 on(link, 'focus', this.expand, this); 10040 } 10041 10042 if (!collapsed) { 10043 this.expand(); 10044 } 10045 10046 this._baseLayersList = create$1('div', className + '-base', section); 10047 this._separator = create$1('div', className + '-separator', section); 10048 this._overlaysList = create$1('div', className + '-overlays', section); 10049 10050 container.appendChild(section); 10051 }, 10052 10053 _getLayer: function (id) { 10054 for (var i = 0; i < this._layers.length; i++) { 10055 10056 if (this._layers[i] && stamp(this._layers[i].layer) === id) { 10057 return this._layers[i]; 10058 } 10059 } 10060 }, 10061 10062 _addLayer: function (layer, name, overlay) { 10063 if (this._map) { 10064 layer.on('add remove', this._onLayerChange, this); 10065 } 10066 10067 this._layers.push({ 10068 layer: layer, 10069 name: name, 10070 overlay: overlay 10071 }); 10072 10073 if (this.options.sortLayers) { 10074 this._layers.sort(bind(function (a, b) { 10075 return this.options.sortFunction(a.layer, b.layer, a.name, b.name); 10076 }, this)); 10077 } 10078 10079 if (this.options.autoZIndex && layer.setZIndex) { 10080 this._lastZIndex++; 10081 layer.setZIndex(this._lastZIndex); 10082 } 10083 10084 this._expandIfNotCollapsed(); 10085 }, 10086 10087 _update: function () { 10088 if (!this._container) { return this; } 10089 10090 empty(this._baseLayersList); 10091 empty(this._overlaysList); 10092 10093 this._layerControlInputs = []; 10094 var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0; 10095 10096 for (i = 0; i < this._layers.length; i++) { 10097 obj = this._layers[i]; 10098 this._addItem(obj); 10099 overlaysPresent = overlaysPresent || obj.overlay; 10100 baseLayersPresent = baseLayersPresent || !obj.overlay; 10101 baseLayersCount += !obj.overlay ? 1 : 0; 10102 } 10103 10104 // Hide base layers section if there's only one layer. 10105 if (this.options.hideSingleBase) { 10106 baseLayersPresent = baseLayersPresent && baseLayersCount > 1; 10107 this._baseLayersList.style.display = baseLayersPresent ? '' : 'none'; 10108 } 10109 10110 this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none'; 10111 10112 return this; 10113 }, 10114 10115 _onLayerChange: function (e) { 10116 if (!this._handlingClick) { 10117 this._update(); 10118 } 10119 10120 var obj = this._getLayer(stamp(e.target)); 10121 10122 // @namespace Map 10123 // @section Layer events 10124 // @event baselayerchange: LayersControlEvent 10125 // Fired when the base layer is changed through the [layer control](#control-layers). 10126 // @event overlayadd: LayersControlEvent 10127 // Fired when an overlay is selected through the [layer control](#control-layers). 10128 // @event overlayremove: LayersControlEvent 10129 // Fired when an overlay is deselected through the [layer control](#control-layers). 10130 // @namespace Control.Layers 10131 var type = obj.overlay ? 10132 (e.type === 'add' ? 'overlayadd' : 'overlayremove') : 10133 (e.type === 'add' ? 'baselayerchange' : null); 10134 10135 if (type) { 10136 this._map.fire(type, obj); 10137 } 10138 }, 10139 10140 // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe) 10141 _createRadioElement: function (name, checked) { 10142 10143 var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + 10144 name + '"' + (checked ? ' checked="checked"' : '') + '/>'; 10145 10146 var radioFragment = document.createElement('div'); 10147 radioFragment.innerHTML = radioHtml; 10148 10149 return radioFragment.firstChild; 10150 }, 10151 10152 _addItem: function (obj) { 10153 var label = document.createElement('label'), 10154 checked = this._map.hasLayer(obj.layer), 10155 input; 10156 10157 if (obj.overlay) { 10158 input = document.createElement('input'); 10159 input.type = 'checkbox'; 10160 input.className = 'leaflet-control-layers-selector'; 10161 input.defaultChecked = checked; 10162 } else { 10163 input = this._createRadioElement('leaflet-base-layers_' + stamp(this), checked); 10164 } 10165 10166 this._layerControlInputs.push(input); 10167 input.layerId = stamp(obj.layer); 10168 10169 on(input, 'click', this._onInputClick, this); 10170 10171 var name = document.createElement('span'); 10172 name.innerHTML = ' ' + obj.name; 10173 10174 // Helps from preventing layer control flicker when checkboxes are disabled 10175 // https://github.com/Leaflet/Leaflet/issues/2771 10176 var holder = document.createElement('div'); 10177 10178 label.appendChild(holder); 10179 holder.appendChild(input); 10180 holder.appendChild(name); 10181 10182 var container = obj.overlay ? this._overlaysList : this._baseLayersList; 10183 container.appendChild(label); 10184 10185 this._checkDisabledLayers(); 10186 return label; 10187 }, 10188 10189 _onInputClick: function () { 10190 var inputs = this._layerControlInputs, 10191 input, layer; 10192 var addedLayers = [], 10193 removedLayers = []; 10194 10195 this._handlingClick = true; 10196 10197 for (var i = inputs.length - 1; i >= 0; i--) { 10198 input = inputs[i]; 10199 layer = this._getLayer(input.layerId).layer; 10200 10201 if (input.checked) { 10202 addedLayers.push(layer); 10203 } else if (!input.checked) { 10204 removedLayers.push(layer); 10205 } 10206 } 10207 10208 // Bugfix issue 2318: Should remove all old layers before readding new ones 10209 for (i = 0; i < removedLayers.length; i++) { 10210 if (this._map.hasLayer(removedLayers[i])) { 10211 this._map.removeLayer(removedLayers[i]); 10212 } 10213 } 10214 for (i = 0; i < addedLayers.length; i++) { 10215 if (!this._map.hasLayer(addedLayers[i])) { 10216 this._map.addLayer(addedLayers[i]); 10217 } 10218 } 10219 10220 this._handlingClick = false; 10221 10222 this._refocusOnMap(); 10223 }, 10224 10225 _checkDisabledLayers: function () { 10226 var inputs = this._layerControlInputs, 10227 input, 10228 layer, 10229 zoom = this._map.getZoom(); 10230 10231 for (var i = inputs.length - 1; i >= 0; i--) { 10232 input = inputs[i]; 10233 layer = this._getLayer(input.layerId).layer; 10234 input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) || 10235 (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom); 10236 10237 } 10238 }, 10239 10240 _expandIfNotCollapsed: function () { 10241 if (this._map && !this.options.collapsed) { 10242 this.expand(); 10243 } 10244 return this; 10245 }, 10246 10247 _expand: function () { 10248 // Backward compatibility, remove me in 1.1. 10249 return this.expand(); 10250 }, 10251 10252 _collapse: function () { 10253 // Backward compatibility, remove me in 1.1. 10254 return this.collapse(); 10255 } 10256 10257}); 10258 10259 10260// @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options) 10261// Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation. 10262var layers = function (baseLayers, overlays, options) { 10263 return new Layers(baseLayers, overlays, options); 10264}; 10265 10266/* 10267 * @class Control.Zoom 10268 * @aka L.Control.Zoom 10269 * @inherits Control 10270 * 10271 * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`. 10272 */ 10273 10274var Zoom = Control.extend({ 10275 // @section 10276 // @aka Control.Zoom options 10277 options: { 10278 position: 'topleft', 10279 10280 // @option zoomInText: String = '+' 10281 // The text set on the 'zoom in' button. 10282 zoomInText: '+', 10283 10284 // @option zoomInTitle: String = 'Zoom in' 10285 // The title set on the 'zoom in' button. 10286 zoomInTitle: 'Zoom in', 10287 10288 // @option zoomOutText: String = '−' 10289 // The text set on the 'zoom out' button. 10290 zoomOutText: '−', 10291 10292 // @option zoomOutTitle: String = 'Zoom out' 10293 // The title set on the 'zoom out' button. 10294 zoomOutTitle: 'Zoom out' 10295 }, 10296 10297 onAdd: function (map) { 10298 var zoomName = 'leaflet-control-zoom', 10299 container = create$1('div', zoomName + ' leaflet-bar'), 10300 options = this.options; 10301 10302 this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle, 10303 zoomName + '-in', container, this._zoomIn); 10304 this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle, 10305 zoomName + '-out', container, this._zoomOut); 10306 10307 this._updateDisabled(); 10308 map.on('zoomend zoomlevelschange', this._updateDisabled, this); 10309 10310 return container; 10311 }, 10312 10313 onRemove: function (map) { 10314 map.off('zoomend zoomlevelschange', this._updateDisabled, this); 10315 }, 10316 10317 disable: function () { 10318 this._disabled = true; 10319 this._updateDisabled(); 10320 return this; 10321 }, 10322 10323 enable: function () { 10324 this._disabled = false; 10325 this._updateDisabled(); 10326 return this; 10327 }, 10328 10329 _zoomIn: function (e) { 10330 if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) { 10331 this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); 10332 } 10333 }, 10334 10335 _zoomOut: function (e) { 10336 if (!this._disabled && this._map._zoom > this._map.getMinZoom()) { 10337 this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); 10338 } 10339 }, 10340 10341 _createButton: function (html, title, className, container, fn) { 10342 var link = create$1('a', className, container); 10343 link.innerHTML = html; 10344 link.href = '#'; 10345 link.title = title; 10346 10347 /* 10348 * Will force screen readers like VoiceOver to read this as "Zoom in - button" 10349 */ 10350 link.setAttribute('role', 'button'); 10351 link.setAttribute('aria-label', title); 10352 10353 disableClickPropagation(link); 10354 on(link, 'click', stop); 10355 on(link, 'click', fn, this); 10356 on(link, 'click', this._refocusOnMap, this); 10357 10358 return link; 10359 }, 10360 10361 _updateDisabled: function () { 10362 var map = this._map, 10363 className = 'leaflet-disabled'; 10364 10365 removeClass(this._zoomInButton, className); 10366 removeClass(this._zoomOutButton, className); 10367 10368 if (this._disabled || map._zoom === map.getMinZoom()) { 10369 addClass(this._zoomOutButton, className); 10370 } 10371 if (this._disabled || map._zoom === map.getMaxZoom()) { 10372 addClass(this._zoomInButton, className); 10373 } 10374 } 10375}); 10376 10377// @namespace Map 10378// @section Control options 10379// @option zoomControl: Boolean = true 10380// Whether a [zoom control](#control-zoom) is added to the map by default. 10381Map.mergeOptions({ 10382 zoomControl: true 10383}); 10384 10385Map.addInitHook(function () { 10386 if (this.options.zoomControl) { 10387 // @section Controls 10388 // @property zoomControl: Control.Zoom 10389 // The default zoom control (only available if the 10390 // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map). 10391 this.zoomControl = new Zoom(); 10392 this.addControl(this.zoomControl); 10393 } 10394}); 10395 10396// @namespace Control.Zoom 10397// @factory L.control.zoom(options: Control.Zoom options) 10398// Creates a zoom control 10399var zoom = function (options) { 10400 return new Zoom(options); 10401}; 10402 10403/* 10404 * @class Control.Scale 10405 * @aka L.Control.Scale 10406 * @inherits Control 10407 * 10408 * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`. 10409 * 10410 * @example 10411 * 10412 * ```js 10413 * L.control.scale().addTo(map); 10414 * ``` 10415 */ 10416 10417var Scale = Control.extend({ 10418 // @section 10419 // @aka Control.Scale options 10420 options: { 10421 position: 'bottomleft', 10422 10423 // @option maxWidth: Number = 100 10424 // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500). 10425 maxWidth: 100, 10426 10427 // @option metric: Boolean = True 10428 // Whether to show the metric scale line (m/km). 10429 metric: true, 10430 10431 // @option imperial: Boolean = True 10432 // Whether to show the imperial scale line (mi/ft). 10433 imperial: true 10434 10435 // @option updateWhenIdle: Boolean = false 10436 // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)). 10437 }, 10438 10439 onAdd: function (map) { 10440 var className = 'leaflet-control-scale', 10441 container = create$1('div', className), 10442 options = this.options; 10443 10444 this._addScales(options, className + '-line', container); 10445 10446 map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this); 10447 map.whenReady(this._update, this); 10448 10449 return container; 10450 }, 10451 10452 onRemove: function (map) { 10453 map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this); 10454 }, 10455 10456 _addScales: function (options, className, container) { 10457 if (options.metric) { 10458 this._mScale = create$1('div', className, container); 10459 } 10460 if (options.imperial) { 10461 this._iScale = create$1('div', className, container); 10462 } 10463 }, 10464 10465 _update: function () { 10466 var map = this._map, 10467 y = map.getSize().y / 2; 10468 10469 var maxMeters = map.distance( 10470 map.containerPointToLatLng([0, y]), 10471 map.containerPointToLatLng([this.options.maxWidth, y])); 10472 10473 this._updateScales(maxMeters); 10474 }, 10475 10476 _updateScales: function (maxMeters) { 10477 if (this.options.metric && maxMeters) { 10478 this._updateMetric(maxMeters); 10479 } 10480 if (this.options.imperial && maxMeters) { 10481 this._updateImperial(maxMeters); 10482 } 10483 }, 10484 10485 _updateMetric: function (maxMeters) { 10486 var meters = this._getRoundNum(maxMeters), 10487 label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km'; 10488 10489 this._updateScale(this._mScale, label, meters / maxMeters); 10490 }, 10491 10492 _updateImperial: function (maxMeters) { 10493 var maxFeet = maxMeters * 3.2808399, 10494 maxMiles, miles, feet; 10495 10496 if (maxFeet > 5280) { 10497 maxMiles = maxFeet / 5280; 10498 miles = this._getRoundNum(maxMiles); 10499 this._updateScale(this._iScale, miles + ' mi', miles / maxMiles); 10500 10501 } else { 10502 feet = this._getRoundNum(maxFeet); 10503 this._updateScale(this._iScale, feet + ' ft', feet / maxFeet); 10504 } 10505 }, 10506 10507 _updateScale: function (scale, text, ratio) { 10508 scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px'; 10509 scale.innerHTML = text; 10510 }, 10511 10512 _getRoundNum: function (num) { 10513 var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1), 10514 d = num / pow10; 10515 10516 d = d >= 10 ? 10 : 10517 d >= 5 ? 5 : 10518 d >= 3 ? 3 : 10519 d >= 2 ? 2 : 1; 10520 10521 return pow10 * d; 10522 } 10523}); 10524 10525 10526// @factory L.control.scale(options?: Control.Scale options) 10527// Creates an scale control with the given options. 10528var scale = function (options) { 10529 return new Scale(options); 10530}; 10531 10532/* 10533 * @class Control.Attribution 10534 * @aka L.Control.Attribution 10535 * @inherits Control 10536 * 10537 * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control. 10538 */ 10539 10540var Attribution = Control.extend({ 10541 // @section 10542 // @aka Control.Attribution options 10543 options: { 10544 position: 'bottomright', 10545 10546 // @option prefix: String = 'Leaflet' 10547 // The HTML text shown before the attributions. Pass `false` to disable. 10548 prefix: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>' 10549 }, 10550 10551 initialize: function (options) { 10552 setOptions(this, options); 10553 10554 this._attributions = {}; 10555 }, 10556 10557 onAdd: function (map) { 10558 map.attributionControl = this; 10559 this._container = create$1('div', 'leaflet-control-attribution'); 10560 disableClickPropagation(this._container); 10561 10562 // TODO ugly, refactor 10563 for (var i in map._layers) { 10564 if (map._layers[i].getAttribution) { 10565 this.addAttribution(map._layers[i].getAttribution()); 10566 } 10567 } 10568 10569 this._update(); 10570 10571 return this._container; 10572 }, 10573 10574 // @method setPrefix(prefix: String): this 10575 // Sets the text before the attributions. 10576 setPrefix: function (prefix) { 10577 this.options.prefix = prefix; 10578 this._update(); 10579 return this; 10580 }, 10581 10582 // @method addAttribution(text: String): this 10583 // Adds an attribution text (e.g. `'Vector data © Mapbox'`). 10584 addAttribution: function (text) { 10585 if (!text) { return this; } 10586 10587 if (!this._attributions[text]) { 10588 this._attributions[text] = 0; 10589 } 10590 this._attributions[text]++; 10591 10592 this._update(); 10593 10594 return this; 10595 }, 10596 10597 // @method removeAttribution(text: String): this 10598 // Removes an attribution text. 10599 removeAttribution: function (text) { 10600 if (!text) { return this; } 10601 10602 if (this._attributions[text]) { 10603 this._attributions[text]--; 10604 this._update(); 10605 } 10606 10607 return this; 10608 }, 10609 10610 _update: function () { 10611 if (!this._map) { return; } 10612 10613 var attribs = []; 10614 10615 for (var i in this._attributions) { 10616 if (this._attributions[i]) { 10617 attribs.push(i); 10618 } 10619 } 10620 10621 var prefixAndAttribs = []; 10622 10623 if (this.options.prefix) { 10624 prefixAndAttribs.push(this.options.prefix); 10625 } 10626 if (attribs.length) { 10627 prefixAndAttribs.push(attribs.join(', ')); 10628 } 10629 10630 this._container.innerHTML = prefixAndAttribs.join(' | '); 10631 } 10632}); 10633 10634// @namespace Map 10635// @section Control options 10636// @option attributionControl: Boolean = true 10637// Whether a [attribution control](#control-attribution) is added to the map by default. 10638Map.mergeOptions({ 10639 attributionControl: true 10640}); 10641 10642Map.addInitHook(function () { 10643 if (this.options.attributionControl) { 10644 new Attribution().addTo(this); 10645 } 10646}); 10647 10648// @namespace Control.Attribution 10649// @factory L.control.attribution(options: Control.Attribution options) 10650// Creates an attribution control. 10651var attribution = function (options) { 10652 return new Attribution(options); 10653}; 10654 10655Control.Layers = Layers; 10656Control.Zoom = Zoom; 10657Control.Scale = Scale; 10658Control.Attribution = Attribution; 10659 10660control.layers = layers; 10661control.zoom = zoom; 10662control.scale = scale; 10663control.attribution = attribution; 10664 10665/* 10666 L.Handler is a base class for handler classes that are used internally to inject 10667 interaction features like dragging to classes like Map and Marker. 10668*/ 10669 10670// @class Handler 10671// @aka L.Handler 10672// Abstract class for map interaction handlers 10673 10674var Handler = Class.extend({ 10675 initialize: function (map) { 10676 this._map = map; 10677 }, 10678 10679 // @method enable(): this 10680 // Enables the handler 10681 enable: function () { 10682 if (this._enabled) { return this; } 10683 10684 this._enabled = true; 10685 this.addHooks(); 10686 return this; 10687 }, 10688 10689 // @method disable(): this 10690 // Disables the handler 10691 disable: function () { 10692 if (!this._enabled) { return this; } 10693 10694 this._enabled = false; 10695 this.removeHooks(); 10696 return this; 10697 }, 10698 10699 // @method enabled(): Boolean 10700 // Returns `true` if the handler is enabled 10701 enabled: function () { 10702 return !!this._enabled; 10703 } 10704 10705 // @section Extension methods 10706 // Classes inheriting from `Handler` must implement the two following methods: 10707 // @method addHooks() 10708 // Called when the handler is enabled, should add event hooks. 10709 // @method removeHooks() 10710 // Called when the handler is disabled, should remove the event hooks added previously. 10711}); 10712 10713// @section There is static function which can be called without instantiating L.Handler: 10714// @function addTo(map: Map, name: String): this 10715// Adds a new Handler to the given map with the given name. 10716Handler.addTo = function (map, name) { 10717 map.addHandler(name, this); 10718 return this; 10719}; 10720 10721var Mixin = {Events: Events}; 10722 10723/* 10724 * @class Draggable 10725 * @aka L.Draggable 10726 * @inherits Evented 10727 * 10728 * A class for making DOM elements draggable (including touch support). 10729 * Used internally for map and marker dragging. Only works for elements 10730 * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition). 10731 * 10732 * @example 10733 * ```js 10734 * var draggable = new L.Draggable(elementToDrag); 10735 * draggable.enable(); 10736 * ``` 10737 */ 10738 10739var START = touch ? 'touchstart mousedown' : 'mousedown'; 10740var END = { 10741 mousedown: 'mouseup', 10742 touchstart: 'touchend', 10743 pointerdown: 'touchend', 10744 MSPointerDown: 'touchend' 10745}; 10746var MOVE = { 10747 mousedown: 'mousemove', 10748 touchstart: 'touchmove', 10749 pointerdown: 'touchmove', 10750 MSPointerDown: 'touchmove' 10751}; 10752 10753 10754var Draggable = Evented.extend({ 10755 10756 options: { 10757 // @section 10758 // @aka Draggable options 10759 // @option clickTolerance: Number = 3 10760 // The max number of pixels a user can shift the mouse pointer during a click 10761 // for it to be considered a valid click (as opposed to a mouse drag). 10762 clickTolerance: 3 10763 }, 10764 10765 // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options) 10766 // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default). 10767 initialize: function (element, dragStartTarget, preventOutline$$1, options) { 10768 setOptions(this, options); 10769 10770 this._element = element; 10771 this._dragStartTarget = dragStartTarget || element; 10772 this._preventOutline = preventOutline$$1; 10773 }, 10774 10775 // @method enable() 10776 // Enables the dragging ability 10777 enable: function () { 10778 if (this._enabled) { return; } 10779 10780 on(this._dragStartTarget, START, this._onDown, this); 10781 10782 this._enabled = true; 10783 }, 10784 10785 // @method disable() 10786 // Disables the dragging ability 10787 disable: function () { 10788 if (!this._enabled) { return; } 10789 10790 // If we're currently dragging this draggable, 10791 // disabling it counts as first ending the drag. 10792 if (Draggable._dragging === this) { 10793 this.finishDrag(); 10794 } 10795 10796 off(this._dragStartTarget, START, this._onDown, this); 10797 10798 this._enabled = false; 10799 this._moved = false; 10800 }, 10801 10802 _onDown: function (e) { 10803 // Ignore simulated events, since we handle both touch and 10804 // mouse explicitly; otherwise we risk getting duplicates of 10805 // touch events, see #4315. 10806 // Also ignore the event if disabled; this happens in IE11 10807 // under some circumstances, see #3666. 10808 if (e._simulated || !this._enabled) { return; } 10809 10810 this._moved = false; 10811 10812 if (hasClass(this._element, 'leaflet-zoom-anim')) { return; } 10813 10814 if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; } 10815 Draggable._dragging = this; // Prevent dragging multiple objects at once. 10816 10817 if (this._preventOutline) { 10818 preventOutline(this._element); 10819 } 10820 10821 disableImageDrag(); 10822 disableTextSelection(); 10823 10824 if (this._moving) { return; } 10825 10826 // @event down: Event 10827 // Fired when a drag is about to start. 10828 this.fire('down'); 10829 10830 var first = e.touches ? e.touches[0] : e, 10831 sizedParent = getSizedParentNode(this._element); 10832 10833 this._startPoint = new Point(first.clientX, first.clientY); 10834 10835 // Cache the scale, so that we can continuously compensate for it during drag (_onMove). 10836 this._parentScale = getScale(sizedParent); 10837 10838 on(document, MOVE[e.type], this._onMove, this); 10839 on(document, END[e.type], this._onUp, this); 10840 }, 10841 10842 _onMove: function (e) { 10843 // Ignore simulated events, since we handle both touch and 10844 // mouse explicitly; otherwise we risk getting duplicates of 10845 // touch events, see #4315. 10846 // Also ignore the event if disabled; this happens in IE11 10847 // under some circumstances, see #3666. 10848 if (e._simulated || !this._enabled) { return; } 10849 10850 if (e.touches && e.touches.length > 1) { 10851 this._moved = true; 10852 return; 10853 } 10854 10855 var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e), 10856 offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint); 10857 10858 if (!offset.x && !offset.y) { return; } 10859 if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; } 10860 10861 // We assume that the parent container's position, border and scale do not change for the duration of the drag. 10862 // Therefore there is no need to account for the position and border (they are eliminated by the subtraction) 10863 // and we can use the cached value for the scale. 10864 offset.x /= this._parentScale.x; 10865 offset.y /= this._parentScale.y; 10866 10867 preventDefault(e); 10868 10869 if (!this._moved) { 10870 // @event dragstart: Event 10871 // Fired when a drag starts 10872 this.fire('dragstart'); 10873 10874 this._moved = true; 10875 this._startPos = getPosition(this._element).subtract(offset); 10876 10877 addClass(document.body, 'leaflet-dragging'); 10878 10879 this._lastTarget = e.target || e.srcElement; 10880 // IE and Edge do not give the <use> element, so fetch it 10881 // if necessary 10882 if ((window.SVGElementInstance) && (this._lastTarget instanceof SVGElementInstance)) { 10883 this._lastTarget = this._lastTarget.correspondingUseElement; 10884 } 10885 addClass(this._lastTarget, 'leaflet-drag-target'); 10886 } 10887 10888 this._newPos = this._startPos.add(offset); 10889 this._moving = true; 10890 10891 cancelAnimFrame(this._animRequest); 10892 this._lastEvent = e; 10893 this._animRequest = requestAnimFrame(this._updatePosition, this, true); 10894 }, 10895 10896 _updatePosition: function () { 10897 var e = {originalEvent: this._lastEvent}; 10898 10899 // @event predrag: Event 10900 // Fired continuously during dragging *before* each corresponding 10901 // update of the element's position. 10902 this.fire('predrag', e); 10903 setPosition(this._element, this._newPos); 10904 10905 // @event drag: Event 10906 // Fired continuously during dragging. 10907 this.fire('drag', e); 10908 }, 10909 10910 _onUp: function (e) { 10911 // Ignore simulated events, since we handle both touch and 10912 // mouse explicitly; otherwise we risk getting duplicates of 10913 // touch events, see #4315. 10914 // Also ignore the event if disabled; this happens in IE11 10915 // under some circumstances, see #3666. 10916 if (e._simulated || !this._enabled) { return; } 10917 this.finishDrag(); 10918 }, 10919 10920 finishDrag: function () { 10921 removeClass(document.body, 'leaflet-dragging'); 10922 10923 if (this._lastTarget) { 10924 removeClass(this._lastTarget, 'leaflet-drag-target'); 10925 this._lastTarget = null; 10926 } 10927 10928 for (var i in MOVE) { 10929 off(document, MOVE[i], this._onMove, this); 10930 off(document, END[i], this._onUp, this); 10931 } 10932 10933 enableImageDrag(); 10934 enableTextSelection(); 10935 10936 if (this._moved && this._moving) { 10937 // ensure drag is not fired after dragend 10938 cancelAnimFrame(this._animRequest); 10939 10940 // @event dragend: DragEndEvent 10941 // Fired when the drag ends. 10942 this.fire('dragend', { 10943 distance: this._newPos.distanceTo(this._startPos) 10944 }); 10945 } 10946 10947 this._moving = false; 10948 Draggable._dragging = false; 10949 } 10950 10951}); 10952 10953/* 10954 * @namespace LineUtil 10955 * 10956 * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast. 10957 */ 10958 10959// Simplify polyline with vertex reduction and Douglas-Peucker simplification. 10960// Improves rendering performance dramatically by lessening the number of points to draw. 10961 10962// @function simplify(points: Point[], tolerance: Number): Point[] 10963// Dramatically reduces the number of points in a polyline while retaining 10964// its shape and returns a new array of simplified points, using the 10965// [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm). 10966// Used for a huge performance boost when processing/displaying Leaflet polylines for 10967// each zoom level and also reducing visual noise. tolerance affects the amount of 10968// simplification (lesser value means higher quality but slower and with more points). 10969// Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/). 10970function simplify(points, tolerance) { 10971 if (!tolerance || !points.length) { 10972 return points.slice(); 10973 } 10974 10975 var sqTolerance = tolerance * tolerance; 10976 10977 // stage 1: vertex reduction 10978 points = _reducePoints(points, sqTolerance); 10979 10980 // stage 2: Douglas-Peucker simplification 10981 points = _simplifyDP(points, sqTolerance); 10982 10983 return points; 10984} 10985 10986// @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number 10987// Returns the distance between point `p` and segment `p1` to `p2`. 10988function pointToSegmentDistance(p, p1, p2) { 10989 return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true)); 10990} 10991 10992// @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number 10993// Returns the closest point from a point `p` on a segment `p1` to `p2`. 10994function closestPointOnSegment(p, p1, p2) { 10995 return _sqClosestPointOnSegment(p, p1, p2); 10996} 10997 10998// Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm 10999function _simplifyDP(points, sqTolerance) { 11000 11001 var len = points.length, 11002 ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array, 11003 markers = new ArrayConstructor(len); 11004 11005 markers[0] = markers[len - 1] = 1; 11006 11007 _simplifyDPStep(points, markers, sqTolerance, 0, len - 1); 11008 11009 var i, 11010 newPoints = []; 11011 11012 for (i = 0; i < len; i++) { 11013 if (markers[i]) { 11014 newPoints.push(points[i]); 11015 } 11016 } 11017 11018 return newPoints; 11019} 11020 11021function _simplifyDPStep(points, markers, sqTolerance, first, last) { 11022 11023 var maxSqDist = 0, 11024 index, i, sqDist; 11025 11026 for (i = first + 1; i <= last - 1; i++) { 11027 sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true); 11028 11029 if (sqDist > maxSqDist) { 11030 index = i; 11031 maxSqDist = sqDist; 11032 } 11033 } 11034 11035 if (maxSqDist > sqTolerance) { 11036 markers[index] = 1; 11037 11038 _simplifyDPStep(points, markers, sqTolerance, first, index); 11039 _simplifyDPStep(points, markers, sqTolerance, index, last); 11040 } 11041} 11042 11043// reduce points that are too close to each other to a single point 11044function _reducePoints(points, sqTolerance) { 11045 var reducedPoints = [points[0]]; 11046 11047 for (var i = 1, prev = 0, len = points.length; i < len; i++) { 11048 if (_sqDist(points[i], points[prev]) > sqTolerance) { 11049 reducedPoints.push(points[i]); 11050 prev = i; 11051 } 11052 } 11053 if (prev < len - 1) { 11054 reducedPoints.push(points[len - 1]); 11055 } 11056 return reducedPoints; 11057} 11058 11059var _lastCode; 11060 11061// @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean 11062// Clips the segment a to b by rectangular bounds with the 11063// [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm) 11064// (modifying the segment points directly!). Used by Leaflet to only show polyline 11065// points that are on the screen or near, increasing performance. 11066function clipSegment(a, b, bounds, useLastCode, round) { 11067 var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds), 11068 codeB = _getBitCode(b, bounds), 11069 11070 codeOut, p, newCode; 11071 11072 // save 2nd code to avoid calculating it on the next segment 11073 _lastCode = codeB; 11074 11075 while (true) { 11076 // if a,b is inside the clip window (trivial accept) 11077 if (!(codeA | codeB)) { 11078 return [a, b]; 11079 } 11080 11081 // if a,b is outside the clip window (trivial reject) 11082 if (codeA & codeB) { 11083 return false; 11084 } 11085 11086 // other cases 11087 codeOut = codeA || codeB; 11088 p = _getEdgeIntersection(a, b, codeOut, bounds, round); 11089 newCode = _getBitCode(p, bounds); 11090 11091 if (codeOut === codeA) { 11092 a = p; 11093 codeA = newCode; 11094 } else { 11095 b = p; 11096 codeB = newCode; 11097 } 11098 } 11099} 11100 11101function _getEdgeIntersection(a, b, code, bounds, round) { 11102 var dx = b.x - a.x, 11103 dy = b.y - a.y, 11104 min = bounds.min, 11105 max = bounds.max, 11106 x, y; 11107 11108 if (code & 8) { // top 11109 x = a.x + dx * (max.y - a.y) / dy; 11110 y = max.y; 11111 11112 } else if (code & 4) { // bottom 11113 x = a.x + dx * (min.y - a.y) / dy; 11114 y = min.y; 11115 11116 } else if (code & 2) { // right 11117 x = max.x; 11118 y = a.y + dy * (max.x - a.x) / dx; 11119 11120 } else if (code & 1) { // left 11121 x = min.x; 11122 y = a.y + dy * (min.x - a.x) / dx; 11123 } 11124 11125 return new Point(x, y, round); 11126} 11127 11128function _getBitCode(p, bounds) { 11129 var code = 0; 11130 11131 if (p.x < bounds.min.x) { // left 11132 code |= 1; 11133 } else if (p.x > bounds.max.x) { // right 11134 code |= 2; 11135 } 11136 11137 if (p.y < bounds.min.y) { // bottom 11138 code |= 4; 11139 } else if (p.y > bounds.max.y) { // top 11140 code |= 8; 11141 } 11142 11143 return code; 11144} 11145 11146// square distance (to avoid unnecessary Math.sqrt calls) 11147function _sqDist(p1, p2) { 11148 var dx = p2.x - p1.x, 11149 dy = p2.y - p1.y; 11150 return dx * dx + dy * dy; 11151} 11152 11153// return closest point on segment or distance to that point 11154function _sqClosestPointOnSegment(p, p1, p2, sqDist) { 11155 var x = p1.x, 11156 y = p1.y, 11157 dx = p2.x - x, 11158 dy = p2.y - y, 11159 dot = dx * dx + dy * dy, 11160 t; 11161 11162 if (dot > 0) { 11163 t = ((p.x - x) * dx + (p.y - y) * dy) / dot; 11164 11165 if (t > 1) { 11166 x = p2.x; 11167 y = p2.y; 11168 } else if (t > 0) { 11169 x += dx * t; 11170 y += dy * t; 11171 } 11172 } 11173 11174 dx = p.x - x; 11175 dy = p.y - y; 11176 11177 return sqDist ? dx * dx + dy * dy : new Point(x, y); 11178} 11179 11180 11181// @function isFlat(latlngs: LatLng[]): Boolean 11182// Returns true if `latlngs` is a flat array, false is nested. 11183function isFlat(latlngs) { 11184 return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined'); 11185} 11186 11187function _flat(latlngs) { 11188 console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.'); 11189 return isFlat(latlngs); 11190} 11191 11192 11193var LineUtil = (Object.freeze || Object)({ 11194 simplify: simplify, 11195 pointToSegmentDistance: pointToSegmentDistance, 11196 closestPointOnSegment: closestPointOnSegment, 11197 clipSegment: clipSegment, 11198 _getEdgeIntersection: _getEdgeIntersection, 11199 _getBitCode: _getBitCode, 11200 _sqClosestPointOnSegment: _sqClosestPointOnSegment, 11201 isFlat: isFlat, 11202 _flat: _flat 11203}); 11204 11205/* 11206 * @namespace PolyUtil 11207 * Various utility functions for polygon geometries. 11208 */ 11209 11210/* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[] 11211 * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)). 11212 * Used by Leaflet to only show polygon points that are on the screen or near, increasing 11213 * performance. Note that polygon points needs different algorithm for clipping 11214 * than polyline, so there's a separate method for it. 11215 */ 11216function clipPolygon(points, bounds, round) { 11217 var clippedPoints, 11218 edges = [1, 4, 2, 8], 11219 i, j, k, 11220 a, b, 11221 len, edge, p; 11222 11223 for (i = 0, len = points.length; i < len; i++) { 11224 points[i]._code = _getBitCode(points[i], bounds); 11225 } 11226 11227 // for each edge (left, bottom, right, top) 11228 for (k = 0; k < 4; k++) { 11229 edge = edges[k]; 11230 clippedPoints = []; 11231 11232 for (i = 0, len = points.length, j = len - 1; i < len; j = i++) { 11233 a = points[i]; 11234 b = points[j]; 11235 11236 // if a is inside the clip window 11237 if (!(a._code & edge)) { 11238 // if b is outside the clip window (a->b goes out of screen) 11239 if (b._code & edge) { 11240 p = _getEdgeIntersection(b, a, edge, bounds, round); 11241 p._code = _getBitCode(p, bounds); 11242 clippedPoints.push(p); 11243 } 11244 clippedPoints.push(a); 11245 11246 // else if b is inside the clip window (a->b enters the screen) 11247 } else if (!(b._code & edge)) { 11248 p = _getEdgeIntersection(b, a, edge, bounds, round); 11249 p._code = _getBitCode(p, bounds); 11250 clippedPoints.push(p); 11251 } 11252 } 11253 points = clippedPoints; 11254 } 11255 11256 return points; 11257} 11258 11259 11260var PolyUtil = (Object.freeze || Object)({ 11261 clipPolygon: clipPolygon 11262}); 11263 11264/* 11265 * @namespace Projection 11266 * @section 11267 * Leaflet comes with a set of already defined Projections out of the box: 11268 * 11269 * @projection L.Projection.LonLat 11270 * 11271 * Equirectangular, or Plate Carree projection — the most simple projection, 11272 * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as 11273 * latitude. Also suitable for flat worlds, e.g. game maps. Used by the 11274 * `EPSG:4326` and `Simple` CRS. 11275 */ 11276 11277var LonLat = { 11278 project: function (latlng) { 11279 return new Point(latlng.lng, latlng.lat); 11280 }, 11281 11282 unproject: function (point) { 11283 return new LatLng(point.y, point.x); 11284 }, 11285 11286 bounds: new Bounds([-180, -90], [180, 90]) 11287}; 11288 11289/* 11290 * @namespace Projection 11291 * @projection L.Projection.Mercator 11292 * 11293 * Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS. 11294 */ 11295 11296var Mercator = { 11297 R: 6378137, 11298 R_MINOR: 6356752.314245179, 11299 11300 bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]), 11301 11302 project: function (latlng) { 11303 var d = Math.PI / 180, 11304 r = this.R, 11305 y = latlng.lat * d, 11306 tmp = this.R_MINOR / r, 11307 e = Math.sqrt(1 - tmp * tmp), 11308 con = e * Math.sin(y); 11309 11310 var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2); 11311 y = -r * Math.log(Math.max(ts, 1E-10)); 11312 11313 return new Point(latlng.lng * d * r, y); 11314 }, 11315 11316 unproject: function (point) { 11317 var d = 180 / Math.PI, 11318 r = this.R, 11319 tmp = this.R_MINOR / r, 11320 e = Math.sqrt(1 - tmp * tmp), 11321 ts = Math.exp(-point.y / r), 11322 phi = Math.PI / 2 - 2 * Math.atan(ts); 11323 11324 for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) { 11325 con = e * Math.sin(phi); 11326 con = Math.pow((1 - con) / (1 + con), e / 2); 11327 dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi; 11328 phi += dphi; 11329 } 11330 11331 return new LatLng(phi * d, point.x * d / r); 11332 } 11333}; 11334 11335/* 11336 * @class Projection 11337 11338 * An object with methods for projecting geographical coordinates of the world onto 11339 * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection). 11340 11341 * @property bounds: Bounds 11342 * The bounds (specified in CRS units) where the projection is valid 11343 11344 * @method project(latlng: LatLng): Point 11345 * Projects geographical coordinates into a 2D point. 11346 * Only accepts actual `L.LatLng` instances, not arrays. 11347 11348 * @method unproject(point: Point): LatLng 11349 * The inverse of `project`. Projects a 2D point into a geographical location. 11350 * Only accepts actual `L.Point` instances, not arrays. 11351 11352 * Note that the projection instances do not inherit from Leafet's `Class` object, 11353 * and can't be instantiated. Also, new classes can't inherit from them, 11354 * and methods can't be added to them with the `include` function. 11355 11356 */ 11357 11358 11359 11360 11361var index = (Object.freeze || Object)({ 11362 LonLat: LonLat, 11363 Mercator: Mercator, 11364 SphericalMercator: SphericalMercator 11365}); 11366 11367/* 11368 * @namespace CRS 11369 * @crs L.CRS.EPSG3395 11370 * 11371 * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection. 11372 */ 11373var EPSG3395 = extend({}, Earth, { 11374 code: 'EPSG:3395', 11375 projection: Mercator, 11376 11377 transformation: (function () { 11378 var scale = 0.5 / (Math.PI * Mercator.R); 11379 return toTransformation(scale, 0.5, -scale, 0.5); 11380 }()) 11381}); 11382 11383/* 11384 * @namespace CRS 11385 * @crs L.CRS.EPSG4326 11386 * 11387 * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection. 11388 * 11389 * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic), 11390 * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer` 11391 * with this CRS, ensure that there are two 256x256 pixel tiles covering the 11392 * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90), 11393 * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set. 11394 */ 11395 11396var EPSG4326 = extend({}, Earth, { 11397 code: 'EPSG:4326', 11398 projection: LonLat, 11399 transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5) 11400}); 11401 11402/* 11403 * @namespace CRS 11404 * @crs L.CRS.Simple 11405 * 11406 * A simple CRS that maps longitude and latitude into `x` and `y` directly. 11407 * May be used for maps of flat surfaces (e.g. game maps). Note that the `y` 11408 * axis should still be inverted (going from bottom to top). `distance()` returns 11409 * simple euclidean distance. 11410 */ 11411 11412var Simple = extend({}, CRS, { 11413 projection: LonLat, 11414 transformation: toTransformation(1, 0, -1, 0), 11415 11416 scale: function (zoom) { 11417 return Math.pow(2, zoom); 11418 }, 11419 11420 zoom: function (scale) { 11421 return Math.log(scale) / Math.LN2; 11422 }, 11423 11424 distance: function (latlng1, latlng2) { 11425 var dx = latlng2.lng - latlng1.lng, 11426 dy = latlng2.lat - latlng1.lat; 11427 11428 return Math.sqrt(dx * dx + dy * dy); 11429 }, 11430 11431 infinite: true 11432}); 11433 11434CRS.Earth = Earth; 11435CRS.EPSG3395 = EPSG3395; 11436CRS.EPSG3857 = EPSG3857; 11437CRS.EPSG900913 = EPSG900913; 11438CRS.EPSG4326 = EPSG4326; 11439CRS.Simple = Simple; 11440 11441/* 11442 * @class Layer 11443 * @inherits Evented 11444 * @aka L.Layer 11445 * @aka ILayer 11446 * 11447 * A set of methods from the Layer base class that all Leaflet layers use. 11448 * Inherits all methods, options and events from `L.Evented`. 11449 * 11450 * @example 11451 * 11452 * ```js 11453 * var layer = L.marker(latlng).addTo(map); 11454 * layer.addTo(map); 11455 * layer.remove(); 11456 * ``` 11457 * 11458 * @event add: Event 11459 * Fired after the layer is added to a map 11460 * 11461 * @event remove: Event 11462 * Fired after the layer is removed from a map 11463 */ 11464 11465 11466var Layer = Evented.extend({ 11467 11468 // Classes extending `L.Layer` will inherit the following options: 11469 options: { 11470 // @option pane: String = 'overlayPane' 11471 // By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default. 11472 pane: 'overlayPane', 11473 11474 // @option attribution: String = null 11475 // String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers. 11476 attribution: null, 11477 11478 bubblingMouseEvents: true 11479 }, 11480 11481 /* @section 11482 * Classes extending `L.Layer` will inherit the following methods: 11483 * 11484 * @method addTo(map: Map|LayerGroup): this 11485 * Adds the layer to the given map or layer group. 11486 */ 11487 addTo: function (map) { 11488 map.addLayer(this); 11489 return this; 11490 }, 11491 11492 // @method remove: this 11493 // Removes the layer from the map it is currently active on. 11494 remove: function () { 11495 return this.removeFrom(this._map || this._mapToAdd); 11496 }, 11497 11498 // @method removeFrom(map: Map): this 11499 // Removes the layer from the given map 11500 removeFrom: function (obj) { 11501 if (obj) { 11502 obj.removeLayer(this); 11503 } 11504 return this; 11505 }, 11506 11507 // @method getPane(name? : String): HTMLElement 11508 // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer. 11509 getPane: function (name) { 11510 return this._map.getPane(name ? (this.options[name] || name) : this.options.pane); 11511 }, 11512 11513 addInteractiveTarget: function (targetEl) { 11514 this._map._targets[stamp(targetEl)] = this; 11515 return this; 11516 }, 11517 11518 removeInteractiveTarget: function (targetEl) { 11519 delete this._map._targets[stamp(targetEl)]; 11520 return this; 11521 }, 11522 11523 // @method getAttribution: String 11524 // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution). 11525 getAttribution: function () { 11526 return this.options.attribution; 11527 }, 11528 11529 _layerAdd: function (e) { 11530 var map = e.target; 11531 11532 // check in case layer gets added and then removed before the map is ready 11533 if (!map.hasLayer(this)) { return; } 11534 11535 this._map = map; 11536 this._zoomAnimated = map._zoomAnimated; 11537 11538 if (this.getEvents) { 11539 var events = this.getEvents(); 11540 map.on(events, this); 11541 this.once('remove', function () { 11542 map.off(events, this); 11543 }, this); 11544 } 11545 11546 this.onAdd(map); 11547 11548 if (this.getAttribution && map.attributionControl) { 11549 map.attributionControl.addAttribution(this.getAttribution()); 11550 } 11551 11552 this.fire('add'); 11553 map.fire('layeradd', {layer: this}); 11554 } 11555}); 11556 11557/* @section Extension methods 11558 * @uninheritable 11559 * 11560 * Every layer should extend from `L.Layer` and (re-)implement the following methods. 11561 * 11562 * @method onAdd(map: Map): this 11563 * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer). 11564 * 11565 * @method onRemove(map: Map): this 11566 * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer). 11567 * 11568 * @method getEvents(): Object 11569 * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer. 11570 * 11571 * @method getAttribution(): String 11572 * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible. 11573 * 11574 * @method beforeAdd(map: Map): this 11575 * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only. 11576 */ 11577 11578 11579/* @namespace Map 11580 * @section Layer events 11581 * 11582 * @event layeradd: LayerEvent 11583 * Fired when a new layer is added to the map. 11584 * 11585 * @event layerremove: LayerEvent 11586 * Fired when some layer is removed from the map 11587 * 11588 * @section Methods for Layers and Controls 11589 */ 11590Map.include({ 11591 // @method addLayer(layer: Layer): this 11592 // Adds the given layer to the map 11593 addLayer: function (layer) { 11594 if (!layer._layerAdd) { 11595 throw new Error('The provided object is not a Layer.'); 11596 } 11597 11598 var id = stamp(layer); 11599 if (this._layers[id]) { return this; } 11600 this._layers[id] = layer; 11601 11602 layer._mapToAdd = this; 11603 11604 if (layer.beforeAdd) { 11605 layer.beforeAdd(this); 11606 } 11607 11608 this.whenReady(layer._layerAdd, layer); 11609 11610 return this; 11611 }, 11612 11613 // @method removeLayer(layer: Layer): this 11614 // Removes the given layer from the map. 11615 removeLayer: function (layer) { 11616 var id = stamp(layer); 11617 11618 if (!this._layers[id]) { return this; } 11619 11620 if (this._loaded) { 11621 layer.onRemove(this); 11622 } 11623 11624 if (layer.getAttribution && this.attributionControl) { 11625 this.attributionControl.removeAttribution(layer.getAttribution()); 11626 } 11627 11628 delete this._layers[id]; 11629 11630 if (this._loaded) { 11631 this.fire('layerremove', {layer: layer}); 11632 layer.fire('remove'); 11633 } 11634 11635 layer._map = layer._mapToAdd = null; 11636 11637 return this; 11638 }, 11639 11640 // @method hasLayer(layer: Layer): Boolean 11641 // Returns `true` if the given layer is currently added to the map 11642 hasLayer: function (layer) { 11643 return !!layer && (stamp(layer) in this._layers); 11644 }, 11645 11646 /* @method eachLayer(fn: Function, context?: Object): this 11647 * Iterates over the layers of the map, optionally specifying context of the iterator function. 11648 * ``` 11649 * map.eachLayer(function(layer){ 11650 * layer.bindPopup('Hello'); 11651 * }); 11652 * ``` 11653 */ 11654 eachLayer: function (method, context) { 11655 for (var i in this._layers) { 11656 method.call(context, this._layers[i]); 11657 } 11658 return this; 11659 }, 11660 11661 _addLayers: function (layers) { 11662 layers = layers ? (isArray(layers) ? layers : [layers]) : []; 11663 11664 for (var i = 0, len = layers.length; i < len; i++) { 11665 this.addLayer(layers[i]); 11666 } 11667 }, 11668 11669 _addZoomLimit: function (layer) { 11670 if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) { 11671 this._zoomBoundLayers[stamp(layer)] = layer; 11672 this._updateZoomLevels(); 11673 } 11674 }, 11675 11676 _removeZoomLimit: function (layer) { 11677 var id = stamp(layer); 11678 11679 if (this._zoomBoundLayers[id]) { 11680 delete this._zoomBoundLayers[id]; 11681 this._updateZoomLevels(); 11682 } 11683 }, 11684 11685 _updateZoomLevels: function () { 11686 var minZoom = Infinity, 11687 maxZoom = -Infinity, 11688 oldZoomSpan = this._getZoomSpan(); 11689 11690 for (var i in this._zoomBoundLayers) { 11691 var options = this._zoomBoundLayers[i].options; 11692 11693 minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom); 11694 maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom); 11695 } 11696 11697 this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom; 11698 this._layersMinZoom = minZoom === Infinity ? undefined : minZoom; 11699 11700 // @section Map state change events 11701 // @event zoomlevelschange: Event 11702 // Fired when the number of zoomlevels on the map is changed due 11703 // to adding or removing a layer. 11704 if (oldZoomSpan !== this._getZoomSpan()) { 11705 this.fire('zoomlevelschange'); 11706 } 11707 11708 if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) { 11709 this.setZoom(this._layersMaxZoom); 11710 } 11711 if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) { 11712 this.setZoom(this._layersMinZoom); 11713 } 11714 } 11715}); 11716 11717/* 11718 * @class LayerGroup 11719 * @aka L.LayerGroup 11720 * @inherits Layer 11721 * 11722 * Used to group several layers and handle them as one. If you add it to the map, 11723 * any layers added or removed from the group will be added/removed on the map as 11724 * well. Extends `Layer`. 11725 * 11726 * @example 11727 * 11728 * ```js 11729 * L.layerGroup([marker1, marker2]) 11730 * .addLayer(polyline) 11731 * .addTo(map); 11732 * ``` 11733 */ 11734 11735var LayerGroup = Layer.extend({ 11736 11737 initialize: function (layers, options) { 11738 setOptions(this, options); 11739 11740 this._layers = {}; 11741 11742 var i, len; 11743 11744 if (layers) { 11745 for (i = 0, len = layers.length; i < len; i++) { 11746 this.addLayer(layers[i]); 11747 } 11748 } 11749 }, 11750 11751 // @method addLayer(layer: Layer): this 11752 // Adds the given layer to the group. 11753 addLayer: function (layer) { 11754 var id = this.getLayerId(layer); 11755 11756 this._layers[id] = layer; 11757 11758 if (this._map) { 11759 this._map.addLayer(layer); 11760 } 11761 11762 return this; 11763 }, 11764 11765 // @method removeLayer(layer: Layer): this 11766 // Removes the given layer from the group. 11767 // @alternative 11768 // @method removeLayer(id: Number): this 11769 // Removes the layer with the given internal ID from the group. 11770 removeLayer: function (layer) { 11771 var id = layer in this._layers ? layer : this.getLayerId(layer); 11772 11773 if (this._map && this._layers[id]) { 11774 this._map.removeLayer(this._layers[id]); 11775 } 11776 11777 delete this._layers[id]; 11778 11779 return this; 11780 }, 11781 11782 // @method hasLayer(layer: Layer): Boolean 11783 // Returns `true` if the given layer is currently added to the group. 11784 // @alternative 11785 // @method hasLayer(id: Number): Boolean 11786 // Returns `true` if the given internal ID is currently added to the group. 11787 hasLayer: function (layer) { 11788 return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers); 11789 }, 11790 11791 // @method clearLayers(): this 11792 // Removes all the layers from the group. 11793 clearLayers: function () { 11794 return this.eachLayer(this.removeLayer, this); 11795 }, 11796 11797 // @method invoke(methodName: String, …): this 11798 // Calls `methodName` on every layer contained in this group, passing any 11799 // additional parameters. Has no effect if the layers contained do not 11800 // implement `methodName`. 11801 invoke: function (methodName) { 11802 var args = Array.prototype.slice.call(arguments, 1), 11803 i, layer; 11804 11805 for (i in this._layers) { 11806 layer = this._layers[i]; 11807 11808 if (layer[methodName]) { 11809 layer[methodName].apply(layer, args); 11810 } 11811 } 11812 11813 return this; 11814 }, 11815 11816 onAdd: function (map) { 11817 this.eachLayer(map.addLayer, map); 11818 }, 11819 11820 onRemove: function (map) { 11821 this.eachLayer(map.removeLayer, map); 11822 }, 11823 11824 // @method eachLayer(fn: Function, context?: Object): this 11825 // Iterates over the layers of the group, optionally specifying context of the iterator function. 11826 // ```js 11827 // group.eachLayer(function (layer) { 11828 // layer.bindPopup('Hello'); 11829 // }); 11830 // ``` 11831 eachLayer: function (method, context) { 11832 for (var i in this._layers) { 11833 method.call(context, this._layers[i]); 11834 } 11835 return this; 11836 }, 11837 11838 // @method getLayer(id: Number): Layer 11839 // Returns the layer with the given internal ID. 11840 getLayer: function (id) { 11841 return this._layers[id]; 11842 }, 11843 11844 // @method getLayers(): Layer[] 11845 // Returns an array of all the layers added to the group. 11846 getLayers: function () { 11847 var layers = []; 11848 this.eachLayer(layers.push, layers); 11849 return layers; 11850 }, 11851 11852 // @method setZIndex(zIndex: Number): this 11853 // Calls `setZIndex` on every layer contained in this group, passing the z-index. 11854 setZIndex: function (zIndex) { 11855 return this.invoke('setZIndex', zIndex); 11856 }, 11857 11858 // @method getLayerId(layer: Layer): Number 11859 // Returns the internal ID for a layer 11860 getLayerId: function (layer) { 11861 return stamp(layer); 11862 } 11863}); 11864 11865 11866// @factory L.layerGroup(layers?: Layer[], options?: Object) 11867// Create a layer group, optionally given an initial set of layers and an `options` object. 11868var layerGroup = function (layers, options) { 11869 return new LayerGroup(layers, options); 11870}; 11871 11872/* 11873 * @class FeatureGroup 11874 * @aka L.FeatureGroup 11875 * @inherits LayerGroup 11876 * 11877 * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers: 11878 * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip)) 11879 * * Events are propagated to the `FeatureGroup`, so if the group has an event 11880 * handler, it will handle events from any of the layers. This includes mouse events 11881 * and custom events. 11882 * * Has `layeradd` and `layerremove` events 11883 * 11884 * @example 11885 * 11886 * ```js 11887 * L.featureGroup([marker1, marker2, polyline]) 11888 * .bindPopup('Hello world!') 11889 * .on('click', function() { alert('Clicked on a member of the group!'); }) 11890 * .addTo(map); 11891 * ``` 11892 */ 11893 11894var FeatureGroup = LayerGroup.extend({ 11895 11896 addLayer: function (layer) { 11897 if (this.hasLayer(layer)) { 11898 return this; 11899 } 11900 11901 layer.addEventParent(this); 11902 11903 LayerGroup.prototype.addLayer.call(this, layer); 11904 11905 // @event layeradd: LayerEvent 11906 // Fired when a layer is added to this `FeatureGroup` 11907 return this.fire('layeradd', {layer: layer}); 11908 }, 11909 11910 removeLayer: function (layer) { 11911 if (!this.hasLayer(layer)) { 11912 return this; 11913 } 11914 if (layer in this._layers) { 11915 layer = this._layers[layer]; 11916 } 11917 11918 layer.removeEventParent(this); 11919 11920 LayerGroup.prototype.removeLayer.call(this, layer); 11921 11922 // @event layerremove: LayerEvent 11923 // Fired when a layer is removed from this `FeatureGroup` 11924 return this.fire('layerremove', {layer: layer}); 11925 }, 11926 11927 // @method setStyle(style: Path options): this 11928 // Sets the given path options to each layer of the group that has a `setStyle` method. 11929 setStyle: function (style) { 11930 return this.invoke('setStyle', style); 11931 }, 11932 11933 // @method bringToFront(): this 11934 // Brings the layer group to the top of all other layers 11935 bringToFront: function () { 11936 return this.invoke('bringToFront'); 11937 }, 11938 11939 // @method bringToBack(): this 11940 // Brings the layer group to the back of all other layers 11941 bringToBack: function () { 11942 return this.invoke('bringToBack'); 11943 }, 11944 11945 // @method getBounds(): LatLngBounds 11946 // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children). 11947 getBounds: function () { 11948 var bounds = new LatLngBounds(); 11949 11950 for (var id in this._layers) { 11951 var layer = this._layers[id]; 11952 bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng()); 11953 } 11954 return bounds; 11955 } 11956}); 11957 11958// @factory L.featureGroup(layers: Layer[]) 11959// Create a feature group, optionally given an initial set of layers. 11960var featureGroup = function (layers) { 11961 return new FeatureGroup(layers); 11962}; 11963 11964/* 11965 * @class Icon 11966 * @aka L.Icon 11967 * 11968 * Represents an icon to provide when creating a marker. 11969 * 11970 * @example 11971 * 11972 * ```js 11973 * var myIcon = L.icon({ 11974 * iconUrl: 'my-icon.png', 11975 * iconRetinaUrl: '[email protected]', 11976 * iconSize: [38, 95], 11977 * iconAnchor: [22, 94], 11978 * popupAnchor: [-3, -76], 11979 * shadowUrl: 'my-icon-shadow.png', 11980 * shadowRetinaUrl: '[email protected]', 11981 * shadowSize: [68, 95], 11982 * shadowAnchor: [22, 94] 11983 * }); 11984 * 11985 * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); 11986 * ``` 11987 * 11988 * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default. 11989 * 11990 */ 11991 11992var Icon = Class.extend({ 11993 11994 /* @section 11995 * @aka Icon options 11996 * 11997 * @option iconUrl: String = null 11998 * **(required)** The URL to the icon image (absolute or relative to your script path). 11999 * 12000 * @option iconRetinaUrl: String = null 12001 * The URL to a retina sized version of the icon image (absolute or relative to your 12002 * script path). Used for Retina screen devices. 12003 * 12004 * @option iconSize: Point = null 12005 * Size of the icon image in pixels. 12006 * 12007 * @option iconAnchor: Point = null 12008 * The coordinates of the "tip" of the icon (relative to its top left corner). The icon 12009 * will be aligned so that this point is at the marker's geographical location. Centered 12010 * by default if size is specified, also can be set in CSS with negative margins. 12011 * 12012 * @option popupAnchor: Point = [0, 0] 12013 * The coordinates of the point from which popups will "open", relative to the icon anchor. 12014 * 12015 * @option tooltipAnchor: Point = [0, 0] 12016 * The coordinates of the point from which tooltips will "open", relative to the icon anchor. 12017 * 12018 * @option shadowUrl: String = null 12019 * The URL to the icon shadow image. If not specified, no shadow image will be created. 12020 * 12021 * @option shadowRetinaUrl: String = null 12022 * 12023 * @option shadowSize: Point = null 12024 * Size of the shadow image in pixels. 12025 * 12026 * @option shadowAnchor: Point = null 12027 * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same 12028 * as iconAnchor if not specified). 12029 * 12030 * @option className: String = '' 12031 * A custom class name to assign to both icon and shadow images. Empty by default. 12032 */ 12033 12034 options: { 12035 popupAnchor: [0, 0], 12036 tooltipAnchor: [0, 0] 12037 }, 12038 12039 initialize: function (options) { 12040 setOptions(this, options); 12041 }, 12042 12043 // @method createIcon(oldIcon?: HTMLElement): HTMLElement 12044 // Called internally when the icon has to be shown, returns a `<img>` HTML element 12045 // styled according to the options. 12046 createIcon: function (oldIcon) { 12047 return this._createIcon('icon', oldIcon); 12048 }, 12049 12050 // @method createShadow(oldIcon?: HTMLElement): HTMLElement 12051 // As `createIcon`, but for the shadow beneath it. 12052 createShadow: function (oldIcon) { 12053 return this._createIcon('shadow', oldIcon); 12054 }, 12055 12056 _createIcon: function (name, oldIcon) { 12057 var src = this._getIconUrl(name); 12058 12059 if (!src) { 12060 if (name === 'icon') { 12061 throw new Error('iconUrl not set in Icon options (see the docs).'); 12062 } 12063 return null; 12064 } 12065 12066 var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null); 12067 this._setIconStyles(img, name); 12068 12069 return img; 12070 }, 12071 12072 _setIconStyles: function (img, name) { 12073 var options = this.options; 12074 var sizeOption = options[name + 'Size']; 12075 12076 if (typeof sizeOption === 'number') { 12077 sizeOption = [sizeOption, sizeOption]; 12078 } 12079 12080 var size = toPoint(sizeOption), 12081 anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor || 12082 size && size.divideBy(2, true)); 12083 12084 img.className = 'leaflet-marker-' + name + ' ' + (options.className || ''); 12085 12086 if (anchor) { 12087 img.style.marginLeft = (-anchor.x) + 'px'; 12088 img.style.marginTop = (-anchor.y) + 'px'; 12089 } 12090 12091 if (size) { 12092 img.style.width = size.x + 'px'; 12093 img.style.height = size.y + 'px'; 12094 } 12095 }, 12096 12097 _createImg: function (src, el) { 12098 el = el || document.createElement('img'); 12099 el.src = src; 12100 return el; 12101 }, 12102 12103 _getIconUrl: function (name) { 12104 return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url']; 12105 } 12106}); 12107 12108 12109// @factory L.icon(options: Icon options) 12110// Creates an icon instance with the given options. 12111function icon(options) { 12112 return new Icon(options); 12113} 12114 12115/* 12116 * @miniclass Icon.Default (Icon) 12117 * @aka L.Icon.Default 12118 * @section 12119 * 12120 * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when 12121 * no icon is specified. Points to the blue marker image distributed with Leaflet 12122 * releases. 12123 * 12124 * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options` 12125 * (which is a set of `Icon options`). 12126 * 12127 * If you want to _completely_ replace the default icon, override the 12128 * `L.Marker.prototype.options.icon` with your own icon instead. 12129 */ 12130 12131var IconDefault = Icon.extend({ 12132 12133 options: { 12134 iconUrl: 'marker-icon.png', 12135 iconRetinaUrl: 'marker-icon-2x.png', 12136 shadowUrl: 'marker-shadow.png', 12137 iconSize: [25, 41], 12138 iconAnchor: [12, 41], 12139 popupAnchor: [1, -34], 12140 tooltipAnchor: [16, -28], 12141 shadowSize: [41, 41] 12142 }, 12143 12144 _getIconUrl: function (name) { 12145 if (!IconDefault.imagePath) { // Deprecated, backwards-compatibility only 12146 IconDefault.imagePath = this._detectIconPath(); 12147 } 12148 12149 // @option imagePath: String 12150 // `Icon.Default` will try to auto-detect the location of the 12151 // blue icon images. If you are placing these images in a non-standard 12152 // way, set this option to point to the right path. 12153 return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name); 12154 }, 12155 12156 _detectIconPath: function () { 12157 var el = create$1('div', 'leaflet-default-icon-path', document.body); 12158 var path = getStyle(el, 'background-image') || 12159 getStyle(el, 'backgroundImage'); // IE8 12160 12161 document.body.removeChild(el); 12162 12163 if (path === null || path.indexOf('url') !== 0) { 12164 path = ''; 12165 } else { 12166 path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, ''); 12167 } 12168 12169 return path; 12170 } 12171}); 12172 12173/* 12174 * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable. 12175 */ 12176 12177 12178/* @namespace Marker 12179 * @section Interaction handlers 12180 * 12181 * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example: 12182 * 12183 * ```js 12184 * marker.dragging.disable(); 12185 * ``` 12186 * 12187 * @property dragging: Handler 12188 * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)). 12189 */ 12190 12191var MarkerDrag = Handler.extend({ 12192 initialize: function (marker) { 12193 this._marker = marker; 12194 }, 12195 12196 addHooks: function () { 12197 var icon = this._marker._icon; 12198 12199 if (!this._draggable) { 12200 this._draggable = new Draggable(icon, icon, true); 12201 } 12202 12203 this._draggable.on({ 12204 dragstart: this._onDragStart, 12205 predrag: this._onPreDrag, 12206 drag: this._onDrag, 12207 dragend: this._onDragEnd 12208 }, this).enable(); 12209 12210 addClass(icon, 'leaflet-marker-draggable'); 12211 }, 12212 12213 removeHooks: function () { 12214 this._draggable.off({ 12215 dragstart: this._onDragStart, 12216 predrag: this._onPreDrag, 12217 drag: this._onDrag, 12218 dragend: this._onDragEnd 12219 }, this).disable(); 12220 12221 if (this._marker._icon) { 12222 removeClass(this._marker._icon, 'leaflet-marker-draggable'); 12223 } 12224 }, 12225 12226 moved: function () { 12227 return this._draggable && this._draggable._moved; 12228 }, 12229 12230 _adjustPan: function (e) { 12231 var marker = this._marker, 12232 map = marker._map, 12233 speed = this._marker.options.autoPanSpeed, 12234 padding = this._marker.options.autoPanPadding, 12235 iconPos = getPosition(marker._icon), 12236 bounds = map.getPixelBounds(), 12237 origin = map.getPixelOrigin(); 12238 12239 var panBounds = toBounds( 12240 bounds.min._subtract(origin).add(padding), 12241 bounds.max._subtract(origin).subtract(padding) 12242 ); 12243 12244 if (!panBounds.contains(iconPos)) { 12245 // Compute incremental movement 12246 var movement = toPoint( 12247 (Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) - 12248 (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x), 12249 12250 (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) - 12251 (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y) 12252 ).multiplyBy(speed); 12253 12254 map.panBy(movement, {animate: false}); 12255 12256 this._draggable._newPos._add(movement); 12257 this._draggable._startPos._add(movement); 12258 12259 setPosition(marker._icon, this._draggable._newPos); 12260 this._onDrag(e); 12261 12262 this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); 12263 } 12264 }, 12265 12266 _onDragStart: function () { 12267 // @section Dragging events 12268 // @event dragstart: Event 12269 // Fired when the user starts dragging the marker. 12270 12271 // @event movestart: Event 12272 // Fired when the marker starts moving (because of dragging). 12273 12274 this._oldLatLng = this._marker.getLatLng(); 12275 this._marker 12276 .closePopup() 12277 .fire('movestart') 12278 .fire('dragstart'); 12279 }, 12280 12281 _onPreDrag: function (e) { 12282 if (this._marker.options.autoPan) { 12283 cancelAnimFrame(this._panRequest); 12284 this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); 12285 } 12286 }, 12287 12288 _onDrag: function (e) { 12289 var marker = this._marker, 12290 shadow = marker._shadow, 12291 iconPos = getPosition(marker._icon), 12292 latlng = marker._map.layerPointToLatLng(iconPos); 12293 12294 // update shadow position 12295 if (shadow) { 12296 setPosition(shadow, iconPos); 12297 } 12298 12299 marker._latlng = latlng; 12300 e.latlng = latlng; 12301 e.oldLatLng = this._oldLatLng; 12302 12303 // @event drag: Event 12304 // Fired repeatedly while the user drags the marker. 12305 marker 12306 .fire('move', e) 12307 .fire('drag', e); 12308 }, 12309 12310 _onDragEnd: function (e) { 12311 // @event dragend: DragEndEvent 12312 // Fired when the user stops dragging the marker. 12313 12314 cancelAnimFrame(this._panRequest); 12315 12316 // @event moveend: Event 12317 // Fired when the marker stops moving (because of dragging). 12318 delete this._oldLatLng; 12319 this._marker 12320 .fire('moveend') 12321 .fire('dragend', e); 12322 } 12323}); 12324 12325/* 12326 * @class Marker 12327 * @inherits Interactive layer 12328 * @aka L.Marker 12329 * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`. 12330 * 12331 * @example 12332 * 12333 * ```js 12334 * L.marker([50.5, 30.5]).addTo(map); 12335 * ``` 12336 */ 12337 12338var Marker = Layer.extend({ 12339 12340 // @section 12341 // @aka Marker options 12342 options: { 12343 // @option icon: Icon = * 12344 // Icon instance to use for rendering the marker. 12345 // See [Icon documentation](#L.Icon) for details on how to customize the marker icon. 12346 // If not specified, a common instance of `L.Icon.Default` is used. 12347 icon: new IconDefault(), 12348 12349 // Option inherited from "Interactive layer" abstract class 12350 interactive: true, 12351 12352 // @option keyboard: Boolean = true 12353 // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter. 12354 keyboard: true, 12355 12356 // @option title: String = '' 12357 // Text for the browser tooltip that appear on marker hover (no tooltip by default). 12358 title: '', 12359 12360 // @option alt: String = '' 12361 // Text for the `alt` attribute of the icon image (useful for accessibility). 12362 alt: '', 12363 12364 // @option zIndexOffset: Number = 0 12365 // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively). 12366 zIndexOffset: 0, 12367 12368 // @option opacity: Number = 1.0 12369 // The opacity of the marker. 12370 opacity: 1, 12371 12372 // @option riseOnHover: Boolean = false 12373 // If `true`, the marker will get on top of others when you hover the mouse over it. 12374 riseOnHover: false, 12375 12376 // @option riseOffset: Number = 250 12377 // The z-index offset used for the `riseOnHover` feature. 12378 riseOffset: 250, 12379 12380 // @option pane: String = 'markerPane' 12381 // `Map pane` where the markers icon will be added. 12382 pane: 'markerPane', 12383 12384 // @option pane: String = 'shadowPane' 12385 // `Map pane` where the markers shadow will be added. 12386 shadowPane: 'shadowPane', 12387 12388 // @option bubblingMouseEvents: Boolean = false 12389 // When `true`, a mouse event on this marker will trigger the same event on the map 12390 // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). 12391 bubblingMouseEvents: false, 12392 12393 // @section Draggable marker options 12394 // @option draggable: Boolean = false 12395 // Whether the marker is draggable with mouse/touch or not. 12396 draggable: false, 12397 12398 // @option autoPan: Boolean = false 12399 // Whether to pan the map when dragging this marker near its edge or not. 12400 autoPan: false, 12401 12402 // @option autoPanPadding: Point = Point(50, 50) 12403 // Distance (in pixels to the left/right and to the top/bottom) of the 12404 // map edge to start panning the map. 12405 autoPanPadding: [50, 50], 12406 12407 // @option autoPanSpeed: Number = 10 12408 // Number of pixels the map should pan by. 12409 autoPanSpeed: 10 12410 }, 12411 12412 /* @section 12413 * 12414 * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods: 12415 */ 12416 12417 initialize: function (latlng, options) { 12418 setOptions(this, options); 12419 this._latlng = toLatLng(latlng); 12420 }, 12421 12422 onAdd: function (map) { 12423 this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation; 12424 12425 if (this._zoomAnimated) { 12426 map.on('zoomanim', this._animateZoom, this); 12427 } 12428 12429 this._initIcon(); 12430 this.update(); 12431 }, 12432 12433 onRemove: function (map) { 12434 if (this.dragging && this.dragging.enabled()) { 12435 this.options.draggable = true; 12436 this.dragging.removeHooks(); 12437 } 12438 delete this.dragging; 12439 12440 if (this._zoomAnimated) { 12441 map.off('zoomanim', this._animateZoom, this); 12442 } 12443 12444 this._removeIcon(); 12445 this._removeShadow(); 12446 }, 12447 12448 getEvents: function () { 12449 return { 12450 zoom: this.update, 12451 viewreset: this.update 12452 }; 12453 }, 12454 12455 // @method getLatLng: LatLng 12456 // Returns the current geographical position of the marker. 12457 getLatLng: function () { 12458 return this._latlng; 12459 }, 12460 12461 // @method setLatLng(latlng: LatLng): this 12462 // Changes the marker position to the given point. 12463 setLatLng: function (latlng) { 12464 var oldLatLng = this._latlng; 12465 this._latlng = toLatLng(latlng); 12466 this.update(); 12467 12468 // @event move: Event 12469 // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`. 12470 return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng}); 12471 }, 12472 12473 // @method setZIndexOffset(offset: Number): this 12474 // Changes the [zIndex offset](#marker-zindexoffset) of the marker. 12475 setZIndexOffset: function (offset) { 12476 this.options.zIndexOffset = offset; 12477 return this.update(); 12478 }, 12479 12480 // @method getIcon: Icon 12481 // Returns the current icon used by the marker 12482 getIcon: function () { 12483 return this.options.icon; 12484 }, 12485 12486 // @method setIcon(icon: Icon): this 12487 // Changes the marker icon. 12488 setIcon: function (icon) { 12489 12490 this.options.icon = icon; 12491 12492 if (this._map) { 12493 this._initIcon(); 12494 this.update(); 12495 } 12496 12497 if (this._popup) { 12498 this.bindPopup(this._popup, this._popup.options); 12499 } 12500 12501 return this; 12502 }, 12503 12504 getElement: function () { 12505 return this._icon; 12506 }, 12507 12508 update: function () { 12509 12510 if (this._icon && this._map) { 12511 var pos = this._map.latLngToLayerPoint(this._latlng).round(); 12512 this._setPos(pos); 12513 } 12514 12515 return this; 12516 }, 12517 12518 _initIcon: function () { 12519 var options = this.options, 12520 classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'); 12521 12522 var icon = options.icon.createIcon(this._icon), 12523 addIcon = false; 12524 12525 // if we're not reusing the icon, remove the old one and init new one 12526 if (icon !== this._icon) { 12527 if (this._icon) { 12528 this._removeIcon(); 12529 } 12530 addIcon = true; 12531 12532 if (options.title) { 12533 icon.title = options.title; 12534 } 12535 12536 if (icon.tagName === 'IMG') { 12537 icon.alt = options.alt || ''; 12538 } 12539 } 12540 12541 addClass(icon, classToAdd); 12542 12543 if (options.keyboard) { 12544 icon.tabIndex = '0'; 12545 } 12546 12547 this._icon = icon; 12548 12549 if (options.riseOnHover) { 12550 this.on({ 12551 mouseover: this._bringToFront, 12552 mouseout: this._resetZIndex 12553 }); 12554 } 12555 12556 var newShadow = options.icon.createShadow(this._shadow), 12557 addShadow = false; 12558 12559 if (newShadow !== this._shadow) { 12560 this._removeShadow(); 12561 addShadow = true; 12562 } 12563 12564 if (newShadow) { 12565 addClass(newShadow, classToAdd); 12566 newShadow.alt = ''; 12567 } 12568 this._shadow = newShadow; 12569 12570 12571 if (options.opacity < 1) { 12572 this._updateOpacity(); 12573 } 12574 12575 12576 if (addIcon) { 12577 this.getPane().appendChild(this._icon); 12578 } 12579 this._initInteraction(); 12580 if (newShadow && addShadow) { 12581 this.getPane(options.shadowPane).appendChild(this._shadow); 12582 } 12583 }, 12584 12585 _removeIcon: function () { 12586 if (this.options.riseOnHover) { 12587 this.off({ 12588 mouseover: this._bringToFront, 12589 mouseout: this._resetZIndex 12590 }); 12591 } 12592 12593 remove(this._icon); 12594 this.removeInteractiveTarget(this._icon); 12595 12596 this._icon = null; 12597 }, 12598 12599 _removeShadow: function () { 12600 if (this._shadow) { 12601 remove(this._shadow); 12602 } 12603 this._shadow = null; 12604 }, 12605 12606 _setPos: function (pos) { 12607 12608 if (this._icon) { 12609 setPosition(this._icon, pos); 12610 } 12611 12612 if (this._shadow) { 12613 setPosition(this._shadow, pos); 12614 } 12615 12616 this._zIndex = pos.y + this.options.zIndexOffset; 12617 12618 this._resetZIndex(); 12619 }, 12620 12621 _updateZIndex: function (offset) { 12622 if (this._icon) { 12623 this._icon.style.zIndex = this._zIndex + offset; 12624 } 12625 }, 12626 12627 _animateZoom: function (opt) { 12628 var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round(); 12629 12630 this._setPos(pos); 12631 }, 12632 12633 _initInteraction: function () { 12634 12635 if (!this.options.interactive) { return; } 12636 12637 addClass(this._icon, 'leaflet-interactive'); 12638 12639 this.addInteractiveTarget(this._icon); 12640 12641 if (MarkerDrag) { 12642 var draggable = this.options.draggable; 12643 if (this.dragging) { 12644 draggable = this.dragging.enabled(); 12645 this.dragging.disable(); 12646 } 12647 12648 this.dragging = new MarkerDrag(this); 12649 12650 if (draggable) { 12651 this.dragging.enable(); 12652 } 12653 } 12654 }, 12655 12656 // @method setOpacity(opacity: Number): this 12657 // Changes the opacity of the marker. 12658 setOpacity: function (opacity) { 12659 this.options.opacity = opacity; 12660 if (this._map) { 12661 this._updateOpacity(); 12662 } 12663 12664 return this; 12665 }, 12666 12667 _updateOpacity: function () { 12668 var opacity = this.options.opacity; 12669 12670 if (this._icon) { 12671 setOpacity(this._icon, opacity); 12672 } 12673 12674 if (this._shadow) { 12675 setOpacity(this._shadow, opacity); 12676 } 12677 }, 12678 12679 _bringToFront: function () { 12680 this._updateZIndex(this.options.riseOffset); 12681 }, 12682 12683 _resetZIndex: function () { 12684 this._updateZIndex(0); 12685 }, 12686 12687 _getPopupAnchor: function () { 12688 return this.options.icon.options.popupAnchor; 12689 }, 12690 12691 _getTooltipAnchor: function () { 12692 return this.options.icon.options.tooltipAnchor; 12693 } 12694}); 12695 12696 12697// factory L.marker(latlng: LatLng, options? : Marker options) 12698 12699// @factory L.marker(latlng: LatLng, options? : Marker options) 12700// Instantiates a Marker object given a geographical point and optionally an options object. 12701function marker(latlng, options) { 12702 return new Marker(latlng, options); 12703} 12704 12705/* 12706 * @class Path 12707 * @aka L.Path 12708 * @inherits Interactive layer 12709 * 12710 * An abstract class that contains options and constants shared between vector 12711 * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`. 12712 */ 12713 12714var Path = Layer.extend({ 12715 12716 // @section 12717 // @aka Path options 12718 options: { 12719 // @option stroke: Boolean = true 12720 // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles. 12721 stroke: true, 12722 12723 // @option color: String = '#3388ff' 12724 // Stroke color 12725 color: '#3388ff', 12726 12727 // @option weight: Number = 3 12728 // Stroke width in pixels 12729 weight: 3, 12730 12731 // @option opacity: Number = 1.0 12732 // Stroke opacity 12733 opacity: 1, 12734 12735 // @option lineCap: String= 'round' 12736 // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke. 12737 lineCap: 'round', 12738 12739 // @option lineJoin: String = 'round' 12740 // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke. 12741 lineJoin: 'round', 12742 12743 // @option dashArray: String = null 12744 // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). 12745 dashArray: null, 12746 12747 // @option dashOffset: String = null 12748 // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). 12749 dashOffset: null, 12750 12751 // @option fill: Boolean = depends 12752 // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles. 12753 fill: false, 12754 12755 // @option fillColor: String = * 12756 // Fill color. Defaults to the value of the [`color`](#path-color) option 12757 fillColor: null, 12758 12759 // @option fillOpacity: Number = 0.2 12760 // Fill opacity. 12761 fillOpacity: 0.2, 12762 12763 // @option fillRule: String = 'evenodd' 12764 // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined. 12765 fillRule: 'evenodd', 12766 12767 // className: '', 12768 12769 // Option inherited from "Interactive layer" abstract class 12770 interactive: true, 12771 12772 // @option bubblingMouseEvents: Boolean = true 12773 // When `true`, a mouse event on this path will trigger the same event on the map 12774 // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). 12775 bubblingMouseEvents: true 12776 }, 12777 12778 beforeAdd: function (map) { 12779 // Renderer is set here because we need to call renderer.getEvents 12780 // before this.getEvents. 12781 this._renderer = map.getRenderer(this); 12782 }, 12783 12784 onAdd: function () { 12785 this._renderer._initPath(this); 12786 this._reset(); 12787 this._renderer._addPath(this); 12788 }, 12789 12790 onRemove: function () { 12791 this._renderer._removePath(this); 12792 }, 12793 12794 // @method redraw(): this 12795 // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses. 12796 redraw: function () { 12797 if (this._map) { 12798 this._renderer._updatePath(this); 12799 } 12800 return this; 12801 }, 12802 12803 // @method setStyle(style: Path options): this 12804 // Changes the appearance of a Path based on the options in the `Path options` object. 12805 setStyle: function (style) { 12806 setOptions(this, style); 12807 if (this._renderer) { 12808 this._renderer._updateStyle(this); 12809 if (this.options.stroke && style && style.hasOwnProperty('weight')) { 12810 this._updateBounds(); 12811 } 12812 } 12813 return this; 12814 }, 12815 12816 // @method bringToFront(): this 12817 // Brings the layer to the top of all path layers. 12818 bringToFront: function () { 12819 if (this._renderer) { 12820 this._renderer._bringToFront(this); 12821 } 12822 return this; 12823 }, 12824 12825 // @method bringToBack(): this 12826 // Brings the layer to the bottom of all path layers. 12827 bringToBack: function () { 12828 if (this._renderer) { 12829 this._renderer._bringToBack(this); 12830 } 12831 return this; 12832 }, 12833 12834 getElement: function () { 12835 return this._path; 12836 }, 12837 12838 _reset: function () { 12839 // defined in child classes 12840 this._project(); 12841 this._update(); 12842 }, 12843 12844 _clickTolerance: function () { 12845 // used when doing hit detection for Canvas layers 12846 return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance; 12847 } 12848}); 12849 12850/* 12851 * @class CircleMarker 12852 * @aka L.CircleMarker 12853 * @inherits Path 12854 * 12855 * A circle of a fixed size with radius specified in pixels. Extends `Path`. 12856 */ 12857 12858var CircleMarker = Path.extend({ 12859 12860 // @section 12861 // @aka CircleMarker options 12862 options: { 12863 fill: true, 12864 12865 // @option radius: Number = 10 12866 // Radius of the circle marker, in pixels 12867 radius: 10 12868 }, 12869 12870 initialize: function (latlng, options) { 12871 setOptions(this, options); 12872 this._latlng = toLatLng(latlng); 12873 this._radius = this.options.radius; 12874 }, 12875 12876 // @method setLatLng(latLng: LatLng): this 12877 // Sets the position of a circle marker to a new location. 12878 setLatLng: function (latlng) { 12879 var oldLatLng = this._latlng; 12880 this._latlng = toLatLng(latlng); 12881 this.redraw(); 12882 12883 // @event move: Event 12884 // Fired when the marker is moved via [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`. 12885 return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng}); 12886 }, 12887 12888 // @method getLatLng(): LatLng 12889 // Returns the current geographical position of the circle marker 12890 getLatLng: function () { 12891 return this._latlng; 12892 }, 12893 12894 // @method setRadius(radius: Number): this 12895 // Sets the radius of a circle marker. Units are in pixels. 12896 setRadius: function (radius) { 12897 this.options.radius = this._radius = radius; 12898 return this.redraw(); 12899 }, 12900 12901 // @method getRadius(): Number 12902 // Returns the current radius of the circle 12903 getRadius: function () { 12904 return this._radius; 12905 }, 12906 12907 setStyle : function (options) { 12908 var radius = options && options.radius || this._radius; 12909 Path.prototype.setStyle.call(this, options); 12910 this.setRadius(radius); 12911 return this; 12912 }, 12913 12914 _project: function () { 12915 this._point = this._map.latLngToLayerPoint(this._latlng); 12916 this._updateBounds(); 12917 }, 12918 12919 _updateBounds: function () { 12920 var r = this._radius, 12921 r2 = this._radiusY || r, 12922 w = this._clickTolerance(), 12923 p = [r + w, r2 + w]; 12924 this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p)); 12925 }, 12926 12927 _update: function () { 12928 if (this._map) { 12929 this._updatePath(); 12930 } 12931 }, 12932 12933 _updatePath: function () { 12934 this._renderer._updateCircle(this); 12935 }, 12936 12937 _empty: function () { 12938 return this._radius && !this._renderer._bounds.intersects(this._pxBounds); 12939 }, 12940 12941 // Needed by the `Canvas` renderer for interactivity 12942 _containsPoint: function (p) { 12943 return p.distanceTo(this._point) <= this._radius + this._clickTolerance(); 12944 } 12945}); 12946 12947 12948// @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options) 12949// Instantiates a circle marker object given a geographical point, and an optional options object. 12950function circleMarker(latlng, options) { 12951 return new CircleMarker(latlng, options); 12952} 12953 12954/* 12955 * @class Circle 12956 * @aka L.Circle 12957 * @inherits CircleMarker 12958 * 12959 * A class for drawing circle overlays on a map. Extends `CircleMarker`. 12960 * 12961 * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion). 12962 * 12963 * @example 12964 * 12965 * ```js 12966 * L.circle([50.5, 30.5], {radius: 200}).addTo(map); 12967 * ``` 12968 */ 12969 12970var Circle = CircleMarker.extend({ 12971 12972 initialize: function (latlng, options, legacyOptions) { 12973 if (typeof options === 'number') { 12974 // Backwards compatibility with 0.7.x factory (latlng, radius, options?) 12975 options = extend({}, legacyOptions, {radius: options}); 12976 } 12977 setOptions(this, options); 12978 this._latlng = toLatLng(latlng); 12979 12980 if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); } 12981 12982 // @section 12983 // @aka Circle options 12984 // @option radius: Number; Radius of the circle, in meters. 12985 this._mRadius = this.options.radius; 12986 }, 12987 12988 // @method setRadius(radius: Number): this 12989 // Sets the radius of a circle. Units are in meters. 12990 setRadius: function (radius) { 12991 this._mRadius = radius; 12992 return this.redraw(); 12993 }, 12994 12995 // @method getRadius(): Number 12996 // Returns the current radius of a circle. Units are in meters. 12997 getRadius: function () { 12998 return this._mRadius; 12999 }, 13000 13001 // @method getBounds(): LatLngBounds 13002 // Returns the `LatLngBounds` of the path. 13003 getBounds: function () { 13004 var half = [this._radius, this._radiusY || this._radius]; 13005 13006 return new LatLngBounds( 13007 this._map.layerPointToLatLng(this._point.subtract(half)), 13008 this._map.layerPointToLatLng(this._point.add(half))); 13009 }, 13010 13011 setStyle: Path.prototype.setStyle, 13012 13013 _project: function () { 13014 13015 var lng = this._latlng.lng, 13016 lat = this._latlng.lat, 13017 map = this._map, 13018 crs = map.options.crs; 13019 13020 if (crs.distance === Earth.distance) { 13021 var d = Math.PI / 180, 13022 latR = (this._mRadius / Earth.R) / d, 13023 top = map.project([lat + latR, lng]), 13024 bottom = map.project([lat - latR, lng]), 13025 p = top.add(bottom).divideBy(2), 13026 lat2 = map.unproject(p).lat, 13027 lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) / 13028 (Math.cos(lat * d) * Math.cos(lat2 * d))) / d; 13029 13030 if (isNaN(lngR) || lngR === 0) { 13031 lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425 13032 } 13033 13034 this._point = p.subtract(map.getPixelOrigin()); 13035 this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x; 13036 this._radiusY = p.y - top.y; 13037 13038 } else { 13039 var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0])); 13040 13041 this._point = map.latLngToLayerPoint(this._latlng); 13042 this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x; 13043 } 13044 13045 this._updateBounds(); 13046 } 13047}); 13048 13049// @factory L.circle(latlng: LatLng, options?: Circle options) 13050// Instantiates a circle object given a geographical point, and an options object 13051// which contains the circle radius. 13052// @alternative 13053// @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options) 13054// Obsolete way of instantiating a circle, for compatibility with 0.7.x code. 13055// Do not use in new applications or plugins. 13056function circle(latlng, options, legacyOptions) { 13057 return new Circle(latlng, options, legacyOptions); 13058} 13059 13060/* 13061 * @class Polyline 13062 * @aka L.Polyline 13063 * @inherits Path 13064 * 13065 * A class for drawing polyline overlays on a map. Extends `Path`. 13066 * 13067 * @example 13068 * 13069 * ```js 13070 * // create a red polyline from an array of LatLng points 13071 * var latlngs = [ 13072 * [45.51, -122.68], 13073 * [37.77, -122.43], 13074 * [34.04, -118.2] 13075 * ]; 13076 * 13077 * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map); 13078 * 13079 * // zoom the map to the polyline 13080 * map.fitBounds(polyline.getBounds()); 13081 * ``` 13082 * 13083 * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape: 13084 * 13085 * ```js 13086 * // create a red polyline from an array of arrays of LatLng points 13087 * var latlngs = [ 13088 * [[45.51, -122.68], 13089 * [37.77, -122.43], 13090 * [34.04, -118.2]], 13091 * [[40.78, -73.91], 13092 * [41.83, -87.62], 13093 * [32.76, -96.72]] 13094 * ]; 13095 * ``` 13096 */ 13097 13098 13099var Polyline = Path.extend({ 13100 13101 // @section 13102 // @aka Polyline options 13103 options: { 13104 // @option smoothFactor: Number = 1.0 13105 // How much to simplify the polyline on each zoom level. More means 13106 // better performance and smoother look, and less means more accurate representation. 13107 smoothFactor: 1.0, 13108 13109 // @option noClip: Boolean = false 13110 // Disable polyline clipping. 13111 noClip: false 13112 }, 13113 13114 initialize: function (latlngs, options) { 13115 setOptions(this, options); 13116 this._setLatLngs(latlngs); 13117 }, 13118 13119 // @method getLatLngs(): LatLng[] 13120 // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline. 13121 getLatLngs: function () { 13122 return this._latlngs; 13123 }, 13124 13125 // @method setLatLngs(latlngs: LatLng[]): this 13126 // Replaces all the points in the polyline with the given array of geographical points. 13127 setLatLngs: function (latlngs) { 13128 this._setLatLngs(latlngs); 13129 return this.redraw(); 13130 }, 13131 13132 // @method isEmpty(): Boolean 13133 // Returns `true` if the Polyline has no LatLngs. 13134 isEmpty: function () { 13135 return !this._latlngs.length; 13136 }, 13137 13138 // @method closestLayerPoint(p: Point): Point 13139 // Returns the point closest to `p` on the Polyline. 13140 closestLayerPoint: function (p) { 13141 var minDistance = Infinity, 13142 minPoint = null, 13143 closest = _sqClosestPointOnSegment, 13144 p1, p2; 13145 13146 for (var j = 0, jLen = this._parts.length; j < jLen; j++) { 13147 var points = this._parts[j]; 13148 13149 for (var i = 1, len = points.length; i < len; i++) { 13150 p1 = points[i - 1]; 13151 p2 = points[i]; 13152 13153 var sqDist = closest(p, p1, p2, true); 13154 13155 if (sqDist < minDistance) { 13156 minDistance = sqDist; 13157 minPoint = closest(p, p1, p2); 13158 } 13159 } 13160 } 13161 if (minPoint) { 13162 minPoint.distance = Math.sqrt(minDistance); 13163 } 13164 return minPoint; 13165 }, 13166 13167 // @method getCenter(): LatLng 13168 // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline. 13169 getCenter: function () { 13170 // throws error when not yet added to map as this center calculation requires projected coordinates 13171 if (!this._map) { 13172 throw new Error('Must add layer to map before using getCenter()'); 13173 } 13174 13175 var i, halfDist, segDist, dist, p1, p2, ratio, 13176 points = this._rings[0], 13177 len = points.length; 13178 13179 if (!len) { return null; } 13180 13181 // polyline centroid algorithm; only uses the first ring if there are multiple 13182 13183 for (i = 0, halfDist = 0; i < len - 1; i++) { 13184 halfDist += points[i].distanceTo(points[i + 1]) / 2; 13185 } 13186 13187 // The line is so small in the current view that all points are on the same pixel. 13188 if (halfDist === 0) { 13189 return this._map.layerPointToLatLng(points[0]); 13190 } 13191 13192 for (i = 0, dist = 0; i < len - 1; i++) { 13193 p1 = points[i]; 13194 p2 = points[i + 1]; 13195 segDist = p1.distanceTo(p2); 13196 dist += segDist; 13197 13198 if (dist > halfDist) { 13199 ratio = (dist - halfDist) / segDist; 13200 return this._map.layerPointToLatLng([ 13201 p2.x - ratio * (p2.x - p1.x), 13202 p2.y - ratio * (p2.y - p1.y) 13203 ]); 13204 } 13205 } 13206 }, 13207 13208 // @method getBounds(): LatLngBounds 13209 // Returns the `LatLngBounds` of the path. 13210 getBounds: function () { 13211 return this._bounds; 13212 }, 13213 13214 // @method addLatLng(latlng: LatLng, latlngs? LatLng[]): this 13215 // Adds a given point to the polyline. By default, adds to the first ring of 13216 // the polyline in case of a multi-polyline, but can be overridden by passing 13217 // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)). 13218 addLatLng: function (latlng, latlngs) { 13219 latlngs = latlngs || this._defaultShape(); 13220 latlng = toLatLng(latlng); 13221 latlngs.push(latlng); 13222 this._bounds.extend(latlng); 13223 return this.redraw(); 13224 }, 13225 13226 _setLatLngs: function (latlngs) { 13227 this._bounds = new LatLngBounds(); 13228 this._latlngs = this._convertLatLngs(latlngs); 13229 }, 13230 13231 _defaultShape: function () { 13232 return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0]; 13233 }, 13234 13235 // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way 13236 _convertLatLngs: function (latlngs) { 13237 var result = [], 13238 flat = isFlat(latlngs); 13239 13240 for (var i = 0, len = latlngs.length; i < len; i++) { 13241 if (flat) { 13242 result[i] = toLatLng(latlngs[i]); 13243 this._bounds.extend(result[i]); 13244 } else { 13245 result[i] = this._convertLatLngs(latlngs[i]); 13246 } 13247 } 13248 13249 return result; 13250 }, 13251 13252 _project: function () { 13253 var pxBounds = new Bounds(); 13254 this._rings = []; 13255 this._projectLatlngs(this._latlngs, this._rings, pxBounds); 13256 13257 if (this._bounds.isValid() && pxBounds.isValid()) { 13258 this._rawPxBounds = pxBounds; 13259 this._updateBounds(); 13260 } 13261 }, 13262 13263 _updateBounds: function () { 13264 var w = this._clickTolerance(), 13265 p = new Point(w, w); 13266 this._pxBounds = new Bounds([ 13267 this._rawPxBounds.min.subtract(p), 13268 this._rawPxBounds.max.add(p) 13269 ]); 13270 }, 13271 13272 // recursively turns latlngs into a set of rings with projected coordinates 13273 _projectLatlngs: function (latlngs, result, projectedBounds) { 13274 var flat = latlngs[0] instanceof LatLng, 13275 len = latlngs.length, 13276 i, ring; 13277 13278 if (flat) { 13279 ring = []; 13280 for (i = 0; i < len; i++) { 13281 ring[i] = this._map.latLngToLayerPoint(latlngs[i]); 13282 projectedBounds.extend(ring[i]); 13283 } 13284 result.push(ring); 13285 } else { 13286 for (i = 0; i < len; i++) { 13287 this._projectLatlngs(latlngs[i], result, projectedBounds); 13288 } 13289 } 13290 }, 13291 13292 // clip polyline by renderer bounds so that we have less to render for performance 13293 _clipPoints: function () { 13294 var bounds = this._renderer._bounds; 13295 13296 this._parts = []; 13297 if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { 13298 return; 13299 } 13300 13301 if (this.options.noClip) { 13302 this._parts = this._rings; 13303 return; 13304 } 13305 13306 var parts = this._parts, 13307 i, j, k, len, len2, segment, points; 13308 13309 for (i = 0, k = 0, len = this._rings.length; i < len; i++) { 13310 points = this._rings[i]; 13311 13312 for (j = 0, len2 = points.length; j < len2 - 1; j++) { 13313 segment = clipSegment(points[j], points[j + 1], bounds, j, true); 13314 13315 if (!segment) { continue; } 13316 13317 parts[k] = parts[k] || []; 13318 parts[k].push(segment[0]); 13319 13320 // if segment goes out of screen, or it's the last one, it's the end of the line part 13321 if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) { 13322 parts[k].push(segment[1]); 13323 k++; 13324 } 13325 } 13326 } 13327 }, 13328 13329 // simplify each clipped part of the polyline for performance 13330 _simplifyPoints: function () { 13331 var parts = this._parts, 13332 tolerance = this.options.smoothFactor; 13333 13334 for (var i = 0, len = parts.length; i < len; i++) { 13335 parts[i] = simplify(parts[i], tolerance); 13336 } 13337 }, 13338 13339 _update: function () { 13340 if (!this._map) { return; } 13341 13342 this._clipPoints(); 13343 this._simplifyPoints(); 13344 this._updatePath(); 13345 }, 13346 13347 _updatePath: function () { 13348 this._renderer._updatePoly(this); 13349 }, 13350 13351 // Needed by the `Canvas` renderer for interactivity 13352 _containsPoint: function (p, closed) { 13353 var i, j, k, len, len2, part, 13354 w = this._clickTolerance(); 13355 13356 if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } 13357 13358 // hit detection for polylines 13359 for (i = 0, len = this._parts.length; i < len; i++) { 13360 part = this._parts[i]; 13361 13362 for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { 13363 if (!closed && (j === 0)) { continue; } 13364 13365 if (pointToSegmentDistance(p, part[k], part[j]) <= w) { 13366 return true; 13367 } 13368 } 13369 } 13370 return false; 13371 } 13372}); 13373 13374// @factory L.polyline(latlngs: LatLng[], options?: Polyline options) 13375// Instantiates a polyline object given an array of geographical points and 13376// optionally an options object. You can create a `Polyline` object with 13377// multiple separate lines (`MultiPolyline`) by passing an array of arrays 13378// of geographic points. 13379function polyline(latlngs, options) { 13380 return new Polyline(latlngs, options); 13381} 13382 13383// Retrocompat. Allow plugins to support Leaflet versions before and after 1.1. 13384Polyline._flat = _flat; 13385 13386/* 13387 * @class Polygon 13388 * @aka L.Polygon 13389 * @inherits Polyline 13390 * 13391 * A class for drawing polygon overlays on a map. Extends `Polyline`. 13392 * 13393 * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points. 13394 * 13395 * 13396 * @example 13397 * 13398 * ```js 13399 * // create a red polygon from an array of LatLng points 13400 * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]]; 13401 * 13402 * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map); 13403 * 13404 * // zoom the map to the polygon 13405 * map.fitBounds(polygon.getBounds()); 13406 * ``` 13407 * 13408 * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape: 13409 * 13410 * ```js 13411 * var latlngs = [ 13412 * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring 13413 * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole 13414 * ]; 13415 * ``` 13416 * 13417 * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape. 13418 * 13419 * ```js 13420 * var latlngs = [ 13421 * [ // first polygon 13422 * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring 13423 * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole 13424 * ], 13425 * [ // second polygon 13426 * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]] 13427 * ] 13428 * ]; 13429 * ``` 13430 */ 13431 13432var Polygon = Polyline.extend({ 13433 13434 options: { 13435 fill: true 13436 }, 13437 13438 isEmpty: function () { 13439 return !this._latlngs.length || !this._latlngs[0].length; 13440 }, 13441 13442 getCenter: function () { 13443 // throws error when not yet added to map as this center calculation requires projected coordinates 13444 if (!this._map) { 13445 throw new Error('Must add layer to map before using getCenter()'); 13446 } 13447 13448 var i, j, p1, p2, f, area, x, y, center, 13449 points = this._rings[0], 13450 len = points.length; 13451 13452 if (!len) { return null; } 13453 13454 // polygon centroid algorithm; only uses the first ring if there are multiple 13455 13456 area = x = y = 0; 13457 13458 for (i = 0, j = len - 1; i < len; j = i++) { 13459 p1 = points[i]; 13460 p2 = points[j]; 13461 13462 f = p1.y * p2.x - p2.y * p1.x; 13463 x += (p1.x + p2.x) * f; 13464 y += (p1.y + p2.y) * f; 13465 area += f * 3; 13466 } 13467 13468 if (area === 0) { 13469 // Polygon is so small that all points are on same pixel. 13470 center = points[0]; 13471 } else { 13472 center = [x / area, y / area]; 13473 } 13474 return this._map.layerPointToLatLng(center); 13475 }, 13476 13477 _convertLatLngs: function (latlngs) { 13478 var result = Polyline.prototype._convertLatLngs.call(this, latlngs), 13479 len = result.length; 13480 13481 // remove last point if it equals first one 13482 if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) { 13483 result.pop(); 13484 } 13485 return result; 13486 }, 13487 13488 _setLatLngs: function (latlngs) { 13489 Polyline.prototype._setLatLngs.call(this, latlngs); 13490 if (isFlat(this._latlngs)) { 13491 this._latlngs = [this._latlngs]; 13492 } 13493 }, 13494 13495 _defaultShape: function () { 13496 return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0]; 13497 }, 13498 13499 _clipPoints: function () { 13500 // polygons need a different clipping algorithm so we redefine that 13501 13502 var bounds = this._renderer._bounds, 13503 w = this.options.weight, 13504 p = new Point(w, w); 13505 13506 // increase clip padding by stroke width to avoid stroke on clip edges 13507 bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p)); 13508 13509 this._parts = []; 13510 if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { 13511 return; 13512 } 13513 13514 if (this.options.noClip) { 13515 this._parts = this._rings; 13516 return; 13517 } 13518 13519 for (var i = 0, len = this._rings.length, clipped; i < len; i++) { 13520 clipped = clipPolygon(this._rings[i], bounds, true); 13521 if (clipped.length) { 13522 this._parts.push(clipped); 13523 } 13524 } 13525 }, 13526 13527 _updatePath: function () { 13528 this._renderer._updatePoly(this, true); 13529 }, 13530 13531 // Needed by the `Canvas` renderer for interactivity 13532 _containsPoint: function (p) { 13533 var inside = false, 13534 part, p1, p2, i, j, k, len, len2; 13535 13536 if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } 13537 13538 // ray casting algorithm for detecting if point is in polygon 13539 for (i = 0, len = this._parts.length; i < len; i++) { 13540 part = this._parts[i]; 13541 13542 for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { 13543 p1 = part[j]; 13544 p2 = part[k]; 13545 13546 if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { 13547 inside = !inside; 13548 } 13549 } 13550 } 13551 13552 // also check if it's on polygon stroke 13553 return inside || Polyline.prototype._containsPoint.call(this, p, true); 13554 } 13555 13556}); 13557 13558 13559// @factory L.polygon(latlngs: LatLng[], options?: Polyline options) 13560function polygon(latlngs, options) { 13561 return new Polygon(latlngs, options); 13562} 13563 13564/* 13565 * @class GeoJSON 13566 * @aka L.GeoJSON 13567 * @inherits FeatureGroup 13568 * 13569 * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse 13570 * GeoJSON data and display it on the map. Extends `FeatureGroup`. 13571 * 13572 * @example 13573 * 13574 * ```js 13575 * L.geoJSON(data, { 13576 * style: function (feature) { 13577 * return {color: feature.properties.color}; 13578 * } 13579 * }).bindPopup(function (layer) { 13580 * return layer.feature.properties.description; 13581 * }).addTo(map); 13582 * ``` 13583 */ 13584 13585var GeoJSON = FeatureGroup.extend({ 13586 13587 /* @section 13588 * @aka GeoJSON options 13589 * 13590 * @option pointToLayer: Function = * 13591 * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally 13592 * called when data is added, passing the GeoJSON point feature and its `LatLng`. 13593 * The default is to spawn a default `Marker`: 13594 * ```js 13595 * function(geoJsonPoint, latlng) { 13596 * return L.marker(latlng); 13597 * } 13598 * ``` 13599 * 13600 * @option style: Function = * 13601 * A `Function` defining the `Path options` for styling GeoJSON lines and polygons, 13602 * called internally when data is added. 13603 * The default value is to not override any defaults: 13604 * ```js 13605 * function (geoJsonFeature) { 13606 * return {} 13607 * } 13608 * ``` 13609 * 13610 * @option onEachFeature: Function = * 13611 * A `Function` that will be called once for each created `Feature`, after it has 13612 * been created and styled. Useful for attaching events and popups to features. 13613 * The default is to do nothing with the newly created layers: 13614 * ```js 13615 * function (feature, layer) {} 13616 * ``` 13617 * 13618 * @option filter: Function = * 13619 * A `Function` that will be used to decide whether to include a feature or not. 13620 * The default is to include all features: 13621 * ```js 13622 * function (geoJsonFeature) { 13623 * return true; 13624 * } 13625 * ``` 13626 * Note: dynamically changing the `filter` option will have effect only on newly 13627 * added data. It will _not_ re-evaluate already included features. 13628 * 13629 * @option coordsToLatLng: Function = * 13630 * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s. 13631 * The default is the `coordsToLatLng` static method. 13632 * 13633 * @option markersInheritOptions: Boolean = false 13634 * Whether default Markers for "Point" type Features inherit from group options. 13635 */ 13636 13637 initialize: function (geojson, options) { 13638 setOptions(this, options); 13639 13640 this._layers = {}; 13641 13642 if (geojson) { 13643 this.addData(geojson); 13644 } 13645 }, 13646 13647 // @method addData( <GeoJSON> data ): this 13648 // Adds a GeoJSON object to the layer. 13649 addData: function (geojson) { 13650 var features = isArray(geojson) ? geojson : geojson.features, 13651 i, len, feature; 13652 13653 if (features) { 13654 for (i = 0, len = features.length; i < len; i++) { 13655 // only add this if geometry or geometries are set and not null 13656 feature = features[i]; 13657 if (feature.geometries || feature.geometry || feature.features || feature.coordinates) { 13658 this.addData(feature); 13659 } 13660 } 13661 return this; 13662 } 13663 13664 var options = this.options; 13665 13666 if (options.filter && !options.filter(geojson)) { return this; } 13667 13668 var layer = geometryToLayer(geojson, options); 13669 if (!layer) { 13670 return this; 13671 } 13672 layer.feature = asFeature(geojson); 13673 13674 layer.defaultOptions = layer.options; 13675 this.resetStyle(layer); 13676 13677 if (options.onEachFeature) { 13678 options.onEachFeature(geojson, layer); 13679 } 13680 13681 return this.addLayer(layer); 13682 }, 13683 13684 // @method resetStyle( <Path> layer? ): this 13685 // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events. 13686 // If `layer` is omitted, the style of all features in the current layer is reset. 13687 resetStyle: function (layer) { 13688 if (layer === undefined) { 13689 return this.eachLayer(this.resetStyle, this); 13690 } 13691 // reset any custom styles 13692 layer.options = extend({}, layer.defaultOptions); 13693 this._setLayerStyle(layer, this.options.style); 13694 return this; 13695 }, 13696 13697 // @method setStyle( <Function> style ): this 13698 // Changes styles of GeoJSON vector layers with the given style function. 13699 setStyle: function (style) { 13700 return this.eachLayer(function (layer) { 13701 this._setLayerStyle(layer, style); 13702 }, this); 13703 }, 13704 13705 _setLayerStyle: function (layer, style) { 13706 if (layer.setStyle) { 13707 if (typeof style === 'function') { 13708 style = style(layer.feature); 13709 } 13710 layer.setStyle(style); 13711 } 13712 } 13713}); 13714 13715// @section 13716// There are several static functions which can be called without instantiating L.GeoJSON: 13717 13718// @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer 13719// Creates a `Layer` from a given GeoJSON feature. Can use a custom 13720// [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng) 13721// functions if provided as options. 13722function geometryToLayer(geojson, options) { 13723 13724 var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson, 13725 coords = geometry ? geometry.coordinates : null, 13726 layers = [], 13727 pointToLayer = options && options.pointToLayer, 13728 _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng, 13729 latlng, latlngs, i, len; 13730 13731 if (!coords && !geometry) { 13732 return null; 13733 } 13734 13735 switch (geometry.type) { 13736 case 'Point': 13737 latlng = _coordsToLatLng(coords); 13738 return _pointToLayer(pointToLayer, geojson, latlng, options); 13739 13740 case 'MultiPoint': 13741 for (i = 0, len = coords.length; i < len; i++) { 13742 latlng = _coordsToLatLng(coords[i]); 13743 layers.push(_pointToLayer(pointToLayer, geojson, latlng, options)); 13744 } 13745 return new FeatureGroup(layers); 13746 13747 case 'LineString': 13748 case 'MultiLineString': 13749 latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng); 13750 return new Polyline(latlngs, options); 13751 13752 case 'Polygon': 13753 case 'MultiPolygon': 13754 latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng); 13755 return new Polygon(latlngs, options); 13756 13757 case 'GeometryCollection': 13758 for (i = 0, len = geometry.geometries.length; i < len; i++) { 13759 var layer = geometryToLayer({ 13760 geometry: geometry.geometries[i], 13761 type: 'Feature', 13762 properties: geojson.properties 13763 }, options); 13764 13765 if (layer) { 13766 layers.push(layer); 13767 } 13768 } 13769 return new FeatureGroup(layers); 13770 13771 default: 13772 throw new Error('Invalid GeoJSON object.'); 13773 } 13774} 13775 13776function _pointToLayer(pointToLayerFn, geojson, latlng, options) { 13777 return pointToLayerFn ? 13778 pointToLayerFn(geojson, latlng) : 13779 new Marker(latlng, options && options.markersInheritOptions && options); 13780} 13781 13782// @function coordsToLatLng(coords: Array): LatLng 13783// Creates a `LatLng` object from an array of 2 numbers (longitude, latitude) 13784// or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points. 13785function coordsToLatLng(coords) { 13786 return new LatLng(coords[1], coords[0], coords[2]); 13787} 13788 13789// @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array 13790// Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array. 13791// `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). 13792// Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function. 13793function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) { 13794 var latlngs = []; 13795 13796 for (var i = 0, len = coords.length, latlng; i < len; i++) { 13797 latlng = levelsDeep ? 13798 coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) : 13799 (_coordsToLatLng || coordsToLatLng)(coords[i]); 13800 13801 latlngs.push(latlng); 13802 } 13803 13804 return latlngs; 13805} 13806 13807// @function latLngToCoords(latlng: LatLng, precision?: Number): Array 13808// Reverse of [`coordsToLatLng`](#geojson-coordstolatlng) 13809function latLngToCoords(latlng, precision) { 13810 precision = typeof precision === 'number' ? precision : 6; 13811 return latlng.alt !== undefined ? 13812 [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] : 13813 [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)]; 13814} 13815 13816// @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array 13817// Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs) 13818// `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default. 13819function latLngsToCoords(latlngs, levelsDeep, closed, precision) { 13820 var coords = []; 13821 13822 for (var i = 0, len = latlngs.length; i < len; i++) { 13823 coords.push(levelsDeep ? 13824 latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) : 13825 latLngToCoords(latlngs[i], precision)); 13826 } 13827 13828 if (!levelsDeep && closed) { 13829 coords.push(coords[0]); 13830 } 13831 13832 return coords; 13833} 13834 13835function getFeature(layer, newGeometry) { 13836 return layer.feature ? 13837 extend({}, layer.feature, {geometry: newGeometry}) : 13838 asFeature(newGeometry); 13839} 13840 13841// @function asFeature(geojson: Object): Object 13842// Normalize GeoJSON geometries/features into GeoJSON features. 13843function asFeature(geojson) { 13844 if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') { 13845 return geojson; 13846 } 13847 13848 return { 13849 type: 'Feature', 13850 properties: {}, 13851 geometry: geojson 13852 }; 13853} 13854 13855var PointToGeoJSON = { 13856 toGeoJSON: function (precision) { 13857 return getFeature(this, { 13858 type: 'Point', 13859 coordinates: latLngToCoords(this.getLatLng(), precision) 13860 }); 13861 } 13862}; 13863 13864// @namespace Marker 13865// @section Other methods 13866// @method toGeoJSON(precision?: Number): Object 13867// `precision` is the number of decimal places for coordinates. 13868// The default value is 6 places. 13869// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature). 13870Marker.include(PointToGeoJSON); 13871 13872// @namespace CircleMarker 13873// @method toGeoJSON(precision?: Number): Object 13874// `precision` is the number of decimal places for coordinates. 13875// The default value is 6 places. 13876// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature). 13877Circle.include(PointToGeoJSON); 13878CircleMarker.include(PointToGeoJSON); 13879 13880 13881// @namespace Polyline 13882// @method toGeoJSON(precision?: Number): Object 13883// `precision` is the number of decimal places for coordinates. 13884// The default value is 6 places. 13885// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature). 13886Polyline.include({ 13887 toGeoJSON: function (precision) { 13888 var multi = !isFlat(this._latlngs); 13889 13890 var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision); 13891 13892 return getFeature(this, { 13893 type: (multi ? 'Multi' : '') + 'LineString', 13894 coordinates: coords 13895 }); 13896 } 13897}); 13898 13899// @namespace Polygon 13900// @method toGeoJSON(precision?: Number): Object 13901// `precision` is the number of decimal places for coordinates. 13902// The default value is 6 places. 13903// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature). 13904Polygon.include({ 13905 toGeoJSON: function (precision) { 13906 var holes = !isFlat(this._latlngs), 13907 multi = holes && !isFlat(this._latlngs[0]); 13908 13909 var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision); 13910 13911 if (!holes) { 13912 coords = [coords]; 13913 } 13914 13915 return getFeature(this, { 13916 type: (multi ? 'Multi' : '') + 'Polygon', 13917 coordinates: coords 13918 }); 13919 } 13920}); 13921 13922 13923// @namespace LayerGroup 13924LayerGroup.include({ 13925 toMultiPoint: function (precision) { 13926 var coords = []; 13927 13928 this.eachLayer(function (layer) { 13929 coords.push(layer.toGeoJSON(precision).geometry.coordinates); 13930 }); 13931 13932 return getFeature(this, { 13933 type: 'MultiPoint', 13934 coordinates: coords 13935 }); 13936 }, 13937 13938 // @method toGeoJSON(precision?: Number): Object 13939 // `precision` is the number of decimal places for coordinates. 13940 // The default value is 6 places. 13941 // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`). 13942 toGeoJSON: function (precision) { 13943 13944 var type = this.feature && this.feature.geometry && this.feature.geometry.type; 13945 13946 if (type === 'MultiPoint') { 13947 return this.toMultiPoint(precision); 13948 } 13949 13950 var isGeometryCollection = type === 'GeometryCollection', 13951 jsons = []; 13952 13953 this.eachLayer(function (layer) { 13954 if (layer.toGeoJSON) { 13955 var json = layer.toGeoJSON(precision); 13956 if (isGeometryCollection) { 13957 jsons.push(json.geometry); 13958 } else { 13959 var feature = asFeature(json); 13960 // Squash nested feature collections 13961 if (feature.type === 'FeatureCollection') { 13962 jsons.push.apply(jsons, feature.features); 13963 } else { 13964 jsons.push(feature); 13965 } 13966 } 13967 } 13968 }); 13969 13970 if (isGeometryCollection) { 13971 return getFeature(this, { 13972 geometries: jsons, 13973 type: 'GeometryCollection' 13974 }); 13975 } 13976 13977 return { 13978 type: 'FeatureCollection', 13979 features: jsons 13980 }; 13981 } 13982}); 13983 13984// @namespace GeoJSON 13985// @factory L.geoJSON(geojson?: Object, options?: GeoJSON options) 13986// Creates a GeoJSON layer. Optionally accepts an object in 13987// [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map 13988// (you can alternatively add it later with `addData` method) and an `options` object. 13989function geoJSON(geojson, options) { 13990 return new GeoJSON(geojson, options); 13991} 13992 13993// Backward compatibility. 13994var geoJson = geoJSON; 13995 13996/* 13997 * @class ImageOverlay 13998 * @aka L.ImageOverlay 13999 * @inherits Interactive layer 14000 * 14001 * Used to load and display a single image over specific bounds of the map. Extends `Layer`. 14002 * 14003 * @example 14004 * 14005 * ```js 14006 * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg', 14007 * imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]]; 14008 * L.imageOverlay(imageUrl, imageBounds).addTo(map); 14009 * ``` 14010 */ 14011 14012var ImageOverlay = Layer.extend({ 14013 14014 // @section 14015 // @aka ImageOverlay options 14016 options: { 14017 // @option opacity: Number = 1.0 14018 // The opacity of the image overlay. 14019 opacity: 1, 14020 14021 // @option alt: String = '' 14022 // Text for the `alt` attribute of the image (useful for accessibility). 14023 alt: '', 14024 14025 // @option interactive: Boolean = false 14026 // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered. 14027 interactive: false, 14028 14029 // @option crossOrigin: Boolean|String = false 14030 // Whether the crossOrigin attribute will be added to the image. 14031 // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data. 14032 // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values. 14033 crossOrigin: false, 14034 14035 // @option errorOverlayUrl: String = '' 14036 // URL to the overlay image to show in place of the overlay that failed to load. 14037 errorOverlayUrl: '', 14038 14039 // @option zIndex: Number = 1 14040 // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer. 14041 zIndex: 1, 14042 14043 // @option className: String = '' 14044 // A custom class name to assign to the image. Empty by default. 14045 className: '' 14046 }, 14047 14048 initialize: function (url, bounds, options) { // (String, LatLngBounds, Object) 14049 this._url = url; 14050 this._bounds = toLatLngBounds(bounds); 14051 14052 setOptions(this, options); 14053 }, 14054 14055 onAdd: function () { 14056 if (!this._image) { 14057 this._initImage(); 14058 14059 if (this.options.opacity < 1) { 14060 this._updateOpacity(); 14061 } 14062 } 14063 14064 if (this.options.interactive) { 14065 addClass(this._image, 'leaflet-interactive'); 14066 this.addInteractiveTarget(this._image); 14067 } 14068 14069 this.getPane().appendChild(this._image); 14070 this._reset(); 14071 }, 14072 14073 onRemove: function () { 14074 remove(this._image); 14075 if (this.options.interactive) { 14076 this.removeInteractiveTarget(this._image); 14077 } 14078 }, 14079 14080 // @method setOpacity(opacity: Number): this 14081 // Sets the opacity of the overlay. 14082 setOpacity: function (opacity) { 14083 this.options.opacity = opacity; 14084 14085 if (this._image) { 14086 this._updateOpacity(); 14087 } 14088 return this; 14089 }, 14090 14091 setStyle: function (styleOpts) { 14092 if (styleOpts.opacity) { 14093 this.setOpacity(styleOpts.opacity); 14094 } 14095 return this; 14096 }, 14097 14098 // @method bringToFront(): this 14099 // Brings the layer to the top of all overlays. 14100 bringToFront: function () { 14101 if (this._map) { 14102 toFront(this._image); 14103 } 14104 return this; 14105 }, 14106 14107 // @method bringToBack(): this 14108 // Brings the layer to the bottom of all overlays. 14109 bringToBack: function () { 14110 if (this._map) { 14111 toBack(this._image); 14112 } 14113 return this; 14114 }, 14115 14116 // @method setUrl(url: String): this 14117 // Changes the URL of the image. 14118 setUrl: function (url) { 14119 this._url = url; 14120 14121 if (this._image) { 14122 this._image.src = url; 14123 } 14124 return this; 14125 }, 14126 14127 // @method setBounds(bounds: LatLngBounds): this 14128 // Update the bounds that this ImageOverlay covers 14129 setBounds: function (bounds) { 14130 this._bounds = toLatLngBounds(bounds); 14131 14132 if (this._map) { 14133 this._reset(); 14134 } 14135 return this; 14136 }, 14137 14138 getEvents: function () { 14139 var events = { 14140 zoom: this._reset, 14141 viewreset: this._reset 14142 }; 14143 14144 if (this._zoomAnimated) { 14145 events.zoomanim = this._animateZoom; 14146 } 14147 14148 return events; 14149 }, 14150 14151 // @method setZIndex(value: Number): this 14152 // Changes the [zIndex](#imageoverlay-zindex) of the image overlay. 14153 setZIndex: function (value) { 14154 this.options.zIndex = value; 14155 this._updateZIndex(); 14156 return this; 14157 }, 14158 14159 // @method getBounds(): LatLngBounds 14160 // Get the bounds that this ImageOverlay covers 14161 getBounds: function () { 14162 return this._bounds; 14163 }, 14164 14165 // @method getElement(): HTMLElement 14166 // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement) 14167 // used by this overlay. 14168 getElement: function () { 14169 return this._image; 14170 }, 14171 14172 _initImage: function () { 14173 var wasElementSupplied = this._url.tagName === 'IMG'; 14174 var img = this._image = wasElementSupplied ? this._url : create$1('img'); 14175 14176 addClass(img, 'leaflet-image-layer'); 14177 if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); } 14178 if (this.options.className) { addClass(img, this.options.className); } 14179 14180 img.onselectstart = falseFn; 14181 img.onmousemove = falseFn; 14182 14183 // @event load: Event 14184 // Fired when the ImageOverlay layer has loaded its image 14185 img.onload = bind(this.fire, this, 'load'); 14186 img.onerror = bind(this._overlayOnError, this, 'error'); 14187 14188 if (this.options.crossOrigin || this.options.crossOrigin === '') { 14189 img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin; 14190 } 14191 14192 if (this.options.zIndex) { 14193 this._updateZIndex(); 14194 } 14195 14196 if (wasElementSupplied) { 14197 this._url = img.src; 14198 return; 14199 } 14200 14201 img.src = this._url; 14202 img.alt = this.options.alt; 14203 }, 14204 14205 _animateZoom: function (e) { 14206 var scale = this._map.getZoomScale(e.zoom), 14207 offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min; 14208 14209 setTransform(this._image, offset, scale); 14210 }, 14211 14212 _reset: function () { 14213 var image = this._image, 14214 bounds = new Bounds( 14215 this._map.latLngToLayerPoint(this._bounds.getNorthWest()), 14216 this._map.latLngToLayerPoint(this._bounds.getSouthEast())), 14217 size = bounds.getSize(); 14218 14219 setPosition(image, bounds.min); 14220 14221 image.style.width = size.x + 'px'; 14222 image.style.height = size.y + 'px'; 14223 }, 14224 14225 _updateOpacity: function () { 14226 setOpacity(this._image, this.options.opacity); 14227 }, 14228 14229 _updateZIndex: function () { 14230 if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) { 14231 this._image.style.zIndex = this.options.zIndex; 14232 } 14233 }, 14234 14235 _overlayOnError: function () { 14236 // @event error: Event 14237 // Fired when the ImageOverlay layer fails to load its image 14238 this.fire('error'); 14239 14240 var errorUrl = this.options.errorOverlayUrl; 14241 if (errorUrl && this._url !== errorUrl) { 14242 this._url = errorUrl; 14243 this._image.src = errorUrl; 14244 } 14245 } 14246}); 14247 14248// @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options) 14249// Instantiates an image overlay object given the URL of the image and the 14250// geographical bounds it is tied to. 14251var imageOverlay = function (url, bounds, options) { 14252 return new ImageOverlay(url, bounds, options); 14253}; 14254 14255/* 14256 * @class VideoOverlay 14257 * @aka L.VideoOverlay 14258 * @inherits ImageOverlay 14259 * 14260 * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`. 14261 * 14262 * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video) 14263 * HTML5 element. 14264 * 14265 * @example 14266 * 14267 * ```js 14268 * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm', 14269 * videoBounds = [[ 32, -130], [ 13, -100]]; 14270 * L.videoOverlay(videoUrl, videoBounds ).addTo(map); 14271 * ``` 14272 */ 14273 14274var VideoOverlay = ImageOverlay.extend({ 14275 14276 // @section 14277 // @aka VideoOverlay options 14278 options: { 14279 // @option autoplay: Boolean = true 14280 // Whether the video starts playing automatically when loaded. 14281 autoplay: true, 14282 14283 // @option loop: Boolean = true 14284 // Whether the video will loop back to the beginning when played. 14285 loop: true, 14286 14287 // @option keepAspectRatio: Boolean = true 14288 // Whether the video will save aspect ratio after the projection. 14289 // Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit 14290 keepAspectRatio: true 14291 }, 14292 14293 _initImage: function () { 14294 var wasElementSupplied = this._url.tagName === 'VIDEO'; 14295 var vid = this._image = wasElementSupplied ? this._url : create$1('video'); 14296 14297 addClass(vid, 'leaflet-image-layer'); 14298 if (this._zoomAnimated) { addClass(vid, 'leaflet-zoom-animated'); } 14299 if (this.options.className) { addClass(vid, this.options.className); } 14300 14301 vid.onselectstart = falseFn; 14302 vid.onmousemove = falseFn; 14303 14304 // @event load: Event 14305 // Fired when the video has finished loading the first frame 14306 vid.onloadeddata = bind(this.fire, this, 'load'); 14307 14308 if (wasElementSupplied) { 14309 var sourceElements = vid.getElementsByTagName('source'); 14310 var sources = []; 14311 for (var j = 0; j < sourceElements.length; j++) { 14312 sources.push(sourceElements[j].src); 14313 } 14314 14315 this._url = (sourceElements.length > 0) ? sources : [vid.src]; 14316 return; 14317 } 14318 14319 if (!isArray(this._url)) { this._url = [this._url]; } 14320 14321 if (!this.options.keepAspectRatio && vid.style.hasOwnProperty('objectFit')) { vid.style['objectFit'] = 'fill'; } 14322 vid.autoplay = !!this.options.autoplay; 14323 vid.loop = !!this.options.loop; 14324 for (var i = 0; i < this._url.length; i++) { 14325 var source = create$1('source'); 14326 source.src = this._url[i]; 14327 vid.appendChild(source); 14328 } 14329 } 14330 14331 // @method getElement(): HTMLVideoElement 14332 // Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement) 14333 // used by this overlay. 14334}); 14335 14336 14337// @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options) 14338// Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the 14339// geographical bounds it is tied to. 14340 14341function videoOverlay(video, bounds, options) { 14342 return new VideoOverlay(video, bounds, options); 14343} 14344 14345/* 14346 * @class SVGOverlay 14347 * @aka L.SVGOverlay 14348 * @inherits ImageOverlay 14349 * 14350 * Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends `ImageOverlay`. 14351 * 14352 * An SVG overlay uses the [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element. 14353 * 14354 * @example 14355 * 14356 * ```js 14357 * var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 14358 * svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg"); 14359 * svgElement.setAttribute('viewBox', "0 0 200 200"); 14360 * svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>'; 14361 * var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ]; 14362 * L.svgOverlay(svgElement, svgElementBounds).addTo(map); 14363 * ``` 14364 */ 14365 14366var SVGOverlay = ImageOverlay.extend({ 14367 _initImage: function () { 14368 var el = this._image = this._url; 14369 14370 addClass(el, 'leaflet-image-layer'); 14371 if (this._zoomAnimated) { addClass(el, 'leaflet-zoom-animated'); } 14372 if (this.options.className) { addClass(el, this.options.className); } 14373 14374 el.onselectstart = falseFn; 14375 el.onmousemove = falseFn; 14376 } 14377 14378 // @method getElement(): SVGElement 14379 // Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement) 14380 // used by this overlay. 14381}); 14382 14383 14384// @factory L.svgOverlay(svg: String|SVGElement, bounds: LatLngBounds, options?: SVGOverlay options) 14385// Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to. 14386// A viewBox attribute is required on the SVG element to zoom in and out properly. 14387 14388function svgOverlay(el, bounds, options) { 14389 return new SVGOverlay(el, bounds, options); 14390} 14391 14392/* 14393 * @class DivOverlay 14394 * @inherits Layer 14395 * @aka L.DivOverlay 14396 * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins. 14397 */ 14398 14399// @namespace DivOverlay 14400var DivOverlay = Layer.extend({ 14401 14402 // @section 14403 // @aka DivOverlay options 14404 options: { 14405 // @option offset: Point = Point(0, 7) 14406 // The offset of the popup position. Useful to control the anchor 14407 // of the popup when opening it on some overlays. 14408 offset: [0, 7], 14409 14410 // @option className: String = '' 14411 // A custom CSS class name to assign to the popup. 14412 className: '', 14413 14414 // @option pane: String = 'popupPane' 14415 // `Map pane` where the popup will be added. 14416 pane: 'popupPane' 14417 }, 14418 14419 initialize: function (options, source) { 14420 setOptions(this, options); 14421 14422 this._source = source; 14423 }, 14424 14425 onAdd: function (map) { 14426 this._zoomAnimated = map._zoomAnimated; 14427 14428 if (!this._container) { 14429 this._initLayout(); 14430 } 14431 14432 if (map._fadeAnimated) { 14433 setOpacity(this._container, 0); 14434 } 14435 14436 clearTimeout(this._removeTimeout); 14437 this.getPane().appendChild(this._container); 14438 this.update(); 14439 14440 if (map._fadeAnimated) { 14441 setOpacity(this._container, 1); 14442 } 14443 14444 this.bringToFront(); 14445 }, 14446 14447 onRemove: function (map) { 14448 if (map._fadeAnimated) { 14449 setOpacity(this._container, 0); 14450 this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200); 14451 } else { 14452 remove(this._container); 14453 } 14454 }, 14455 14456 // @namespace Popup 14457 // @method getLatLng: LatLng 14458 // Returns the geographical point of popup. 14459 getLatLng: function () { 14460 return this._latlng; 14461 }, 14462 14463 // @method setLatLng(latlng: LatLng): this 14464 // Sets the geographical point where the popup will open. 14465 setLatLng: function (latlng) { 14466 this._latlng = toLatLng(latlng); 14467 if (this._map) { 14468 this._updatePosition(); 14469 this._adjustPan(); 14470 } 14471 return this; 14472 }, 14473 14474 // @method getContent: String|HTMLElement 14475 // Returns the content of the popup. 14476 getContent: function () { 14477 return this._content; 14478 }, 14479 14480 // @method setContent(htmlContent: String|HTMLElement|Function): this 14481 // Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup. 14482 setContent: function (content) { 14483 this._content = content; 14484 this.update(); 14485 return this; 14486 }, 14487 14488 // @method getElement: String|HTMLElement 14489 // Alias for [getContent()](#popup-getcontent) 14490 getElement: function () { 14491 return this._container; 14492 }, 14493 14494 // @method update: null 14495 // Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded. 14496 update: function () { 14497 if (!this._map) { return; } 14498 14499 this._container.style.visibility = 'hidden'; 14500 14501 this._updateContent(); 14502 this._updateLayout(); 14503 this._updatePosition(); 14504 14505 this._container.style.visibility = ''; 14506 14507 this._adjustPan(); 14508 }, 14509 14510 getEvents: function () { 14511 var events = { 14512 zoom: this._updatePosition, 14513 viewreset: this._updatePosition 14514 }; 14515 14516 if (this._zoomAnimated) { 14517 events.zoomanim = this._animateZoom; 14518 } 14519 return events; 14520 }, 14521 14522 // @method isOpen: Boolean 14523 // Returns `true` when the popup is visible on the map. 14524 isOpen: function () { 14525 return !!this._map && this._map.hasLayer(this); 14526 }, 14527 14528 // @method bringToFront: this 14529 // Brings this popup in front of other popups (in the same map pane). 14530 bringToFront: function () { 14531 if (this._map) { 14532 toFront(this._container); 14533 } 14534 return this; 14535 }, 14536 14537 // @method bringToBack: this 14538 // Brings this popup to the back of other popups (in the same map pane). 14539 bringToBack: function () { 14540 if (this._map) { 14541 toBack(this._container); 14542 } 14543 return this; 14544 }, 14545 14546 _prepareOpen: function (parent, layer, latlng) { 14547 if (!(layer instanceof Layer)) { 14548 latlng = layer; 14549 layer = parent; 14550 } 14551 14552 if (layer instanceof FeatureGroup) { 14553 for (var id in parent._layers) { 14554 layer = parent._layers[id]; 14555 break; 14556 } 14557 } 14558 14559 if (!latlng) { 14560 if (layer.getCenter) { 14561 latlng = layer.getCenter(); 14562 } else if (layer.getLatLng) { 14563 latlng = layer.getLatLng(); 14564 } else { 14565 throw new Error('Unable to get source layer LatLng.'); 14566 } 14567 } 14568 14569 // set overlay source to this layer 14570 this._source = layer; 14571 14572 // update the overlay (content, layout, ect...) 14573 this.update(); 14574 14575 return latlng; 14576 }, 14577 14578 _updateContent: function () { 14579 if (!this._content) { return; } 14580 14581 var node = this._contentNode; 14582 var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content; 14583 14584 if (typeof content === 'string') { 14585 node.innerHTML = content; 14586 } else { 14587 while (node.hasChildNodes()) { 14588 node.removeChild(node.firstChild); 14589 } 14590 node.appendChild(content); 14591 } 14592 this.fire('contentupdate'); 14593 }, 14594 14595 _updatePosition: function () { 14596 if (!this._map) { return; } 14597 14598 var pos = this._map.latLngToLayerPoint(this._latlng), 14599 offset = toPoint(this.options.offset), 14600 anchor = this._getAnchor(); 14601 14602 if (this._zoomAnimated) { 14603 setPosition(this._container, pos.add(anchor)); 14604 } else { 14605 offset = offset.add(pos).add(anchor); 14606 } 14607 14608 var bottom = this._containerBottom = -offset.y, 14609 left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x; 14610 14611 // bottom position the popup in case the height of the popup changes (images loading etc) 14612 this._container.style.bottom = bottom + 'px'; 14613 this._container.style.left = left + 'px'; 14614 }, 14615 14616 _getAnchor: function () { 14617 return [0, 0]; 14618 } 14619 14620}); 14621 14622/* 14623 * @class Popup 14624 * @inherits DivOverlay 14625 * @aka L.Popup 14626 * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to 14627 * open popups while making sure that only one popup is open at one time 14628 * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want. 14629 * 14630 * @example 14631 * 14632 * If you want to just bind a popup to marker click and then open it, it's really easy: 14633 * 14634 * ```js 14635 * marker.bindPopup(popupContent).openPopup(); 14636 * ``` 14637 * Path overlays like polylines also have a `bindPopup` method. 14638 * Here's a more complicated way to open a popup on a map: 14639 * 14640 * ```js 14641 * var popup = L.popup() 14642 * .setLatLng(latlng) 14643 * .setContent('<p>Hello world!<br />This is a nice popup.</p>') 14644 * .openOn(map); 14645 * ``` 14646 */ 14647 14648 14649// @namespace Popup 14650var Popup = DivOverlay.extend({ 14651 14652 // @section 14653 // @aka Popup options 14654 options: { 14655 // @option maxWidth: Number = 300 14656 // Max width of the popup, in pixels. 14657 maxWidth: 300, 14658 14659 // @option minWidth: Number = 50 14660 // Min width of the popup, in pixels. 14661 minWidth: 50, 14662 14663 // @option maxHeight: Number = null 14664 // If set, creates a scrollable container of the given height 14665 // inside a popup if its content exceeds it. 14666 maxHeight: null, 14667 14668 // @option autoPan: Boolean = true 14669 // Set it to `false` if you don't want the map to do panning animation 14670 // to fit the opened popup. 14671 autoPan: true, 14672 14673 // @option autoPanPaddingTopLeft: Point = null 14674 // The margin between the popup and the top left corner of the map 14675 // view after autopanning was performed. 14676 autoPanPaddingTopLeft: null, 14677 14678 // @option autoPanPaddingBottomRight: Point = null 14679 // The margin between the popup and the bottom right corner of the map 14680 // view after autopanning was performed. 14681 autoPanPaddingBottomRight: null, 14682 14683 // @option autoPanPadding: Point = Point(5, 5) 14684 // Equivalent of setting both top left and bottom right autopan padding to the same value. 14685 autoPanPadding: [5, 5], 14686 14687 // @option keepInView: Boolean = false 14688 // Set it to `true` if you want to prevent users from panning the popup 14689 // off of the screen while it is open. 14690 keepInView: false, 14691 14692 // @option closeButton: Boolean = true 14693 // Controls the presence of a close button in the popup. 14694 closeButton: true, 14695 14696 // @option autoClose: Boolean = true 14697 // Set it to `false` if you want to override the default behavior of 14698 // the popup closing when another popup is opened. 14699 autoClose: true, 14700 14701 // @option closeOnEscapeKey: Boolean = true 14702 // Set it to `false` if you want to override the default behavior of 14703 // the ESC key for closing of the popup. 14704 closeOnEscapeKey: true, 14705 14706 // @option closeOnClick: Boolean = * 14707 // Set it if you want to override the default behavior of the popup closing when user clicks 14708 // on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option. 14709 14710 // @option className: String = '' 14711 // A custom CSS class name to assign to the popup. 14712 className: '' 14713 }, 14714 14715 // @namespace Popup 14716 // @method openOn(map: Map): this 14717 // Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`. 14718 openOn: function (map) { 14719 map.openPopup(this); 14720 return this; 14721 }, 14722 14723 onAdd: function (map) { 14724 DivOverlay.prototype.onAdd.call(this, map); 14725 14726 // @namespace Map 14727 // @section Popup events 14728 // @event popupopen: PopupEvent 14729 // Fired when a popup is opened in the map 14730 map.fire('popupopen', {popup: this}); 14731 14732 if (this._source) { 14733 // @namespace Layer 14734 // @section Popup events 14735 // @event popupopen: PopupEvent 14736 // Fired when a popup bound to this layer is opened 14737 this._source.fire('popupopen', {popup: this}, true); 14738 // For non-path layers, we toggle the popup when clicking 14739 // again the layer, so prevent the map to reopen it. 14740 if (!(this._source instanceof Path)) { 14741 this._source.on('preclick', stopPropagation); 14742 } 14743 } 14744 }, 14745 14746 onRemove: function (map) { 14747 DivOverlay.prototype.onRemove.call(this, map); 14748 14749 // @namespace Map 14750 // @section Popup events 14751 // @event popupclose: PopupEvent 14752 // Fired when a popup in the map is closed 14753 map.fire('popupclose', {popup: this}); 14754 14755 if (this._source) { 14756 // @namespace Layer 14757 // @section Popup events 14758 // @event popupclose: PopupEvent 14759 // Fired when a popup bound to this layer is closed 14760 this._source.fire('popupclose', {popup: this}, true); 14761 if (!(this._source instanceof Path)) { 14762 this._source.off('preclick', stopPropagation); 14763 } 14764 } 14765 }, 14766 14767 getEvents: function () { 14768 var events = DivOverlay.prototype.getEvents.call(this); 14769 14770 if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) { 14771 events.preclick = this._close; 14772 } 14773 14774 if (this.options.keepInView) { 14775 events.moveend = this._adjustPan; 14776 } 14777 14778 return events; 14779 }, 14780 14781 _close: function () { 14782 if (this._map) { 14783 this._map.closePopup(this); 14784 } 14785 }, 14786 14787 _initLayout: function () { 14788 var prefix = 'leaflet-popup', 14789 container = this._container = create$1('div', 14790 prefix + ' ' + (this.options.className || '') + 14791 ' leaflet-zoom-animated'); 14792 14793 var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container); 14794 this._contentNode = create$1('div', prefix + '-content', wrapper); 14795 14796 disableClickPropagation(wrapper); 14797 disableScrollPropagation(this._contentNode); 14798 on(wrapper, 'contextmenu', stopPropagation); 14799 14800 this._tipContainer = create$1('div', prefix + '-tip-container', container); 14801 this._tip = create$1('div', prefix + '-tip', this._tipContainer); 14802 14803 if (this.options.closeButton) { 14804 var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container); 14805 closeButton.href = '#close'; 14806 closeButton.innerHTML = '×'; 14807 14808 on(closeButton, 'click', this._onCloseButtonClick, this); 14809 } 14810 }, 14811 14812 _updateLayout: function () { 14813 var container = this._contentNode, 14814 style = container.style; 14815 14816 style.width = ''; 14817 style.whiteSpace = 'nowrap'; 14818 14819 var width = container.offsetWidth; 14820 width = Math.min(width, this.options.maxWidth); 14821 width = Math.max(width, this.options.minWidth); 14822 14823 style.width = (width + 1) + 'px'; 14824 style.whiteSpace = ''; 14825 14826 style.height = ''; 14827 14828 var height = container.offsetHeight, 14829 maxHeight = this.options.maxHeight, 14830 scrolledClass = 'leaflet-popup-scrolled'; 14831 14832 if (maxHeight && height > maxHeight) { 14833 style.height = maxHeight + 'px'; 14834 addClass(container, scrolledClass); 14835 } else { 14836 removeClass(container, scrolledClass); 14837 } 14838 14839 this._containerWidth = this._container.offsetWidth; 14840 }, 14841 14842 _animateZoom: function (e) { 14843 var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center), 14844 anchor = this._getAnchor(); 14845 setPosition(this._container, pos.add(anchor)); 14846 }, 14847 14848 _adjustPan: function () { 14849 if (!this.options.autoPan) { return; } 14850 if (this._map._panAnim) { this._map._panAnim.stop(); } 14851 14852 var map = this._map, 14853 marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0, 14854 containerHeight = this._container.offsetHeight + marginBottom, 14855 containerWidth = this._containerWidth, 14856 layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom); 14857 14858 layerPos._add(getPosition(this._container)); 14859 14860 var containerPos = map.layerPointToContainerPoint(layerPos), 14861 padding = toPoint(this.options.autoPanPadding), 14862 paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding), 14863 paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding), 14864 size = map.getSize(), 14865 dx = 0, 14866 dy = 0; 14867 14868 if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right 14869 dx = containerPos.x + containerWidth - size.x + paddingBR.x; 14870 } 14871 if (containerPos.x - dx - paddingTL.x < 0) { // left 14872 dx = containerPos.x - paddingTL.x; 14873 } 14874 if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom 14875 dy = containerPos.y + containerHeight - size.y + paddingBR.y; 14876 } 14877 if (containerPos.y - dy - paddingTL.y < 0) { // top 14878 dy = containerPos.y - paddingTL.y; 14879 } 14880 14881 // @namespace Map 14882 // @section Popup events 14883 // @event autopanstart: Event 14884 // Fired when the map starts autopanning when opening a popup. 14885 if (dx || dy) { 14886 map 14887 .fire('autopanstart') 14888 .panBy([dx, dy]); 14889 } 14890 }, 14891 14892 _onCloseButtonClick: function (e) { 14893 this._close(); 14894 stop(e); 14895 }, 14896 14897 _getAnchor: function () { 14898 // Where should we anchor the popup on the source layer? 14899 return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]); 14900 } 14901 14902}); 14903 14904// @namespace Popup 14905// @factory L.popup(options?: Popup options, source?: Layer) 14906// Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers. 14907var popup = function (options, source) { 14908 return new Popup(options, source); 14909}; 14910 14911 14912/* @namespace Map 14913 * @section Interaction Options 14914 * @option closePopupOnClick: Boolean = true 14915 * Set it to `false` if you don't want popups to close when user clicks the map. 14916 */ 14917Map.mergeOptions({ 14918 closePopupOnClick: true 14919}); 14920 14921 14922// @namespace Map 14923// @section Methods for Layers and Controls 14924Map.include({ 14925 // @method openPopup(popup: Popup): this 14926 // Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability). 14927 // @alternative 14928 // @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this 14929 // Creates a popup with the specified content and options and opens it in the given point on a map. 14930 openPopup: function (popup, latlng, options) { 14931 if (!(popup instanceof Popup)) { 14932 popup = new Popup(options).setContent(popup); 14933 } 14934 14935 if (latlng) { 14936 popup.setLatLng(latlng); 14937 } 14938 14939 if (this.hasLayer(popup)) { 14940 return this; 14941 } 14942 14943 if (this._popup && this._popup.options.autoClose) { 14944 this.closePopup(); 14945 } 14946 14947 this._popup = popup; 14948 return this.addLayer(popup); 14949 }, 14950 14951 // @method closePopup(popup?: Popup): this 14952 // Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one). 14953 closePopup: function (popup) { 14954 if (!popup || popup === this._popup) { 14955 popup = this._popup; 14956 this._popup = null; 14957 } 14958 if (popup) { 14959 this.removeLayer(popup); 14960 } 14961 return this; 14962 } 14963}); 14964 14965/* 14966 * @namespace Layer 14967 * @section Popup methods example 14968 * 14969 * All layers share a set of methods convenient for binding popups to it. 14970 * 14971 * ```js 14972 * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map); 14973 * layer.openPopup(); 14974 * layer.closePopup(); 14975 * ``` 14976 * 14977 * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened. 14978 */ 14979 14980// @section Popup methods 14981Layer.include({ 14982 14983 // @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this 14984 // Binds a popup to the layer with the passed `content` and sets up the 14985 // necessary event listeners. If a `Function` is passed it will receive 14986 // the layer as the first argument and should return a `String` or `HTMLElement`. 14987 bindPopup: function (content, options) { 14988 14989 if (content instanceof Popup) { 14990 setOptions(content, options); 14991 this._popup = content; 14992 content._source = this; 14993 } else { 14994 if (!this._popup || options) { 14995 this._popup = new Popup(options, this); 14996 } 14997 this._popup.setContent(content); 14998 } 14999 15000 if (!this._popupHandlersAdded) { 15001 this.on({ 15002 click: this._openPopup, 15003 keypress: this._onKeyPress, 15004 remove: this.closePopup, 15005 move: this._movePopup 15006 }); 15007 this._popupHandlersAdded = true; 15008 } 15009 15010 return this; 15011 }, 15012 15013 // @method unbindPopup(): this 15014 // Removes the popup previously bound with `bindPopup`. 15015 unbindPopup: function () { 15016 if (this._popup) { 15017 this.off({ 15018 click: this._openPopup, 15019 keypress: this._onKeyPress, 15020 remove: this.closePopup, 15021 move: this._movePopup 15022 }); 15023 this._popupHandlersAdded = false; 15024 this._popup = null; 15025 } 15026 return this; 15027 }, 15028 15029 // @method openPopup(latlng?: LatLng): this 15030 // Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed. 15031 openPopup: function (layer, latlng) { 15032 if (this._popup && this._map) { 15033 latlng = this._popup._prepareOpen(this, layer, latlng); 15034 15035 // open the popup on the map 15036 this._map.openPopup(this._popup, latlng); 15037 } 15038 15039 return this; 15040 }, 15041 15042 // @method closePopup(): this 15043 // Closes the popup bound to this layer if it is open. 15044 closePopup: function () { 15045 if (this._popup) { 15046 this._popup._close(); 15047 } 15048 return this; 15049 }, 15050 15051 // @method togglePopup(): this 15052 // Opens or closes the popup bound to this layer depending on its current state. 15053 togglePopup: function (target) { 15054 if (this._popup) { 15055 if (this._popup._map) { 15056 this.closePopup(); 15057 } else { 15058 this.openPopup(target); 15059 } 15060 } 15061 return this; 15062 }, 15063 15064 // @method isPopupOpen(): boolean 15065 // Returns `true` if the popup bound to this layer is currently open. 15066 isPopupOpen: function () { 15067 return (this._popup ? this._popup.isOpen() : false); 15068 }, 15069 15070 // @method setPopupContent(content: String|HTMLElement|Popup): this 15071 // Sets the content of the popup bound to this layer. 15072 setPopupContent: function (content) { 15073 if (this._popup) { 15074 this._popup.setContent(content); 15075 } 15076 return this; 15077 }, 15078 15079 // @method getPopup(): Popup 15080 // Returns the popup bound to this layer. 15081 getPopup: function () { 15082 return this._popup; 15083 }, 15084 15085 _openPopup: function (e) { 15086 var layer = e.layer || e.target; 15087 15088 if (!this._popup) { 15089 return; 15090 } 15091 15092 if (!this._map) { 15093 return; 15094 } 15095 15096 // prevent map click 15097 stop(e); 15098 15099 // if this inherits from Path its a vector and we can just 15100 // open the popup at the new location 15101 if (layer instanceof Path) { 15102 this.openPopup(e.layer || e.target, e.latlng); 15103 return; 15104 } 15105 15106 // otherwise treat it like a marker and figure out 15107 // if we should toggle it open/closed 15108 if (this._map.hasLayer(this._popup) && this._popup._source === layer) { 15109 this.closePopup(); 15110 } else { 15111 this.openPopup(layer, e.latlng); 15112 } 15113 }, 15114 15115 _movePopup: function (e) { 15116 this._popup.setLatLng(e.latlng); 15117 }, 15118 15119 _onKeyPress: function (e) { 15120 if (e.originalEvent.keyCode === 13) { 15121 this._openPopup(e); 15122 } 15123 } 15124}); 15125 15126/* 15127 * @class Tooltip 15128 * @inherits DivOverlay 15129 * @aka L.Tooltip 15130 * Used to display small texts on top of map layers. 15131 * 15132 * @example 15133 * 15134 * ```js 15135 * marker.bindTooltip("my tooltip text").openTooltip(); 15136 * ``` 15137 * Note about tooltip offset. Leaflet takes two options in consideration 15138 * for computing tooltip offsetting: 15139 * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip. 15140 * Add a positive x offset to move the tooltip to the right, and a positive y offset to 15141 * move it to the bottom. Negatives will move to the left and top. 15142 * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You 15143 * should adapt this value if you use a custom icon. 15144 */ 15145 15146 15147// @namespace Tooltip 15148var Tooltip = DivOverlay.extend({ 15149 15150 // @section 15151 // @aka Tooltip options 15152 options: { 15153 // @option pane: String = 'tooltipPane' 15154 // `Map pane` where the tooltip will be added. 15155 pane: 'tooltipPane', 15156 15157 // @option offset: Point = Point(0, 0) 15158 // Optional offset of the tooltip position. 15159 offset: [0, 0], 15160 15161 // @option direction: String = 'auto' 15162 // Direction where to open the tooltip. Possible values are: `right`, `left`, 15163 // `top`, `bottom`, `center`, `auto`. 15164 // `auto` will dynamically switch between `right` and `left` according to the tooltip 15165 // position on the map. 15166 direction: 'auto', 15167 15168 // @option permanent: Boolean = false 15169 // Whether to open the tooltip permanently or only on mouseover. 15170 permanent: false, 15171 15172 // @option sticky: Boolean = false 15173 // If true, the tooltip will follow the mouse instead of being fixed at the feature center. 15174 sticky: false, 15175 15176 // @option interactive: Boolean = false 15177 // If true, the tooltip will listen to the feature events. 15178 interactive: false, 15179 15180 // @option opacity: Number = 0.9 15181 // Tooltip container opacity. 15182 opacity: 0.9 15183 }, 15184 15185 onAdd: function (map) { 15186 DivOverlay.prototype.onAdd.call(this, map); 15187 this.setOpacity(this.options.opacity); 15188 15189 // @namespace Map 15190 // @section Tooltip events 15191 // @event tooltipopen: TooltipEvent 15192 // Fired when a tooltip is opened in the map. 15193 map.fire('tooltipopen', {tooltip: this}); 15194 15195 if (this._source) { 15196 // @namespace Layer 15197 // @section Tooltip events 15198 // @event tooltipopen: TooltipEvent 15199 // Fired when a tooltip bound to this layer is opened. 15200 this._source.fire('tooltipopen', {tooltip: this}, true); 15201 } 15202 }, 15203 15204 onRemove: function (map) { 15205 DivOverlay.prototype.onRemove.call(this, map); 15206 15207 // @namespace Map 15208 // @section Tooltip events 15209 // @event tooltipclose: TooltipEvent 15210 // Fired when a tooltip in the map is closed. 15211 map.fire('tooltipclose', {tooltip: this}); 15212 15213 if (this._source) { 15214 // @namespace Layer 15215 // @section Tooltip events 15216 // @event tooltipclose: TooltipEvent 15217 // Fired when a tooltip bound to this layer is closed. 15218 this._source.fire('tooltipclose', {tooltip: this}, true); 15219 } 15220 }, 15221 15222 getEvents: function () { 15223 var events = DivOverlay.prototype.getEvents.call(this); 15224 15225 if (touch && !this.options.permanent) { 15226 events.preclick = this._close; 15227 } 15228 15229 return events; 15230 }, 15231 15232 _close: function () { 15233 if (this._map) { 15234 this._map.closeTooltip(this); 15235 } 15236 }, 15237 15238 _initLayout: function () { 15239 var prefix = 'leaflet-tooltip', 15240 className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'); 15241 15242 this._contentNode = this._container = create$1('div', className); 15243 }, 15244 15245 _updateLayout: function () {}, 15246 15247 _adjustPan: function () {}, 15248 15249 _setPosition: function (pos) { 15250 var map = this._map, 15251 container = this._container, 15252 centerPoint = map.latLngToContainerPoint(map.getCenter()), 15253 tooltipPoint = map.layerPointToContainerPoint(pos), 15254 direction = this.options.direction, 15255 tooltipWidth = container.offsetWidth, 15256 tooltipHeight = container.offsetHeight, 15257 offset = toPoint(this.options.offset), 15258 anchor = this._getAnchor(); 15259 15260 if (direction === 'top') { 15261 pos = pos.add(toPoint(-tooltipWidth / 2 + offset.x, -tooltipHeight + offset.y + anchor.y, true)); 15262 } else if (direction === 'bottom') { 15263 pos = pos.subtract(toPoint(tooltipWidth / 2 - offset.x, -offset.y, true)); 15264 } else if (direction === 'center') { 15265 pos = pos.subtract(toPoint(tooltipWidth / 2 + offset.x, tooltipHeight / 2 - anchor.y + offset.y, true)); 15266 } else if (direction === 'right' || direction === 'auto' && tooltipPoint.x < centerPoint.x) { 15267 direction = 'right'; 15268 pos = pos.add(toPoint(offset.x + anchor.x, anchor.y - tooltipHeight / 2 + offset.y, true)); 15269 } else { 15270 direction = 'left'; 15271 pos = pos.subtract(toPoint(tooltipWidth + anchor.x - offset.x, tooltipHeight / 2 - anchor.y - offset.y, true)); 15272 } 15273 15274 removeClass(container, 'leaflet-tooltip-right'); 15275 removeClass(container, 'leaflet-tooltip-left'); 15276 removeClass(container, 'leaflet-tooltip-top'); 15277 removeClass(container, 'leaflet-tooltip-bottom'); 15278 addClass(container, 'leaflet-tooltip-' + direction); 15279 setPosition(container, pos); 15280 }, 15281 15282 _updatePosition: function () { 15283 var pos = this._map.latLngToLayerPoint(this._latlng); 15284 this._setPosition(pos); 15285 }, 15286 15287 setOpacity: function (opacity) { 15288 this.options.opacity = opacity; 15289 15290 if (this._container) { 15291 setOpacity(this._container, opacity); 15292 } 15293 }, 15294 15295 _animateZoom: function (e) { 15296 var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center); 15297 this._setPosition(pos); 15298 }, 15299 15300 _getAnchor: function () { 15301 // Where should we anchor the tooltip on the source layer? 15302 return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]); 15303 } 15304 15305}); 15306 15307// @namespace Tooltip 15308// @factory L.tooltip(options?: Tooltip options, source?: Layer) 15309// Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers. 15310var tooltip = function (options, source) { 15311 return new Tooltip(options, source); 15312}; 15313 15314// @namespace Map 15315// @section Methods for Layers and Controls 15316Map.include({ 15317 15318 // @method openTooltip(tooltip: Tooltip): this 15319 // Opens the specified tooltip. 15320 // @alternative 15321 // @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this 15322 // Creates a tooltip with the specified content and options and open it. 15323 openTooltip: function (tooltip, latlng, options) { 15324 if (!(tooltip instanceof Tooltip)) { 15325 tooltip = new Tooltip(options).setContent(tooltip); 15326 } 15327 15328 if (latlng) { 15329 tooltip.setLatLng(latlng); 15330 } 15331 15332 if (this.hasLayer(tooltip)) { 15333 return this; 15334 } 15335 15336 return this.addLayer(tooltip); 15337 }, 15338 15339 // @method closeTooltip(tooltip?: Tooltip): this 15340 // Closes the tooltip given as parameter. 15341 closeTooltip: function (tooltip) { 15342 if (tooltip) { 15343 this.removeLayer(tooltip); 15344 } 15345 return this; 15346 } 15347 15348}); 15349 15350/* 15351 * @namespace Layer 15352 * @section Tooltip methods example 15353 * 15354 * All layers share a set of methods convenient for binding tooltips to it. 15355 * 15356 * ```js 15357 * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map); 15358 * layer.openTooltip(); 15359 * layer.closeTooltip(); 15360 * ``` 15361 */ 15362 15363// @section Tooltip methods 15364Layer.include({ 15365 15366 // @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this 15367 // Binds a tooltip to the layer with the passed `content` and sets up the 15368 // necessary event listeners. If a `Function` is passed it will receive 15369 // the layer as the first argument and should return a `String` or `HTMLElement`. 15370 bindTooltip: function (content, options) { 15371 15372 if (content instanceof Tooltip) { 15373 setOptions(content, options); 15374 this._tooltip = content; 15375 content._source = this; 15376 } else { 15377 if (!this._tooltip || options) { 15378 this._tooltip = new Tooltip(options, this); 15379 } 15380 this._tooltip.setContent(content); 15381 15382 } 15383 15384 this._initTooltipInteractions(); 15385 15386 if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) { 15387 this.openTooltip(); 15388 } 15389 15390 return this; 15391 }, 15392 15393 // @method unbindTooltip(): this 15394 // Removes the tooltip previously bound with `bindTooltip`. 15395 unbindTooltip: function () { 15396 if (this._tooltip) { 15397 this._initTooltipInteractions(true); 15398 this.closeTooltip(); 15399 this._tooltip = null; 15400 } 15401 return this; 15402 }, 15403 15404 _initTooltipInteractions: function (remove$$1) { 15405 if (!remove$$1 && this._tooltipHandlersAdded) { return; } 15406 var onOff = remove$$1 ? 'off' : 'on', 15407 events = { 15408 remove: this.closeTooltip, 15409 move: this._moveTooltip 15410 }; 15411 if (!this._tooltip.options.permanent) { 15412 events.mouseover = this._openTooltip; 15413 events.mouseout = this.closeTooltip; 15414 if (this._tooltip.options.sticky) { 15415 events.mousemove = this._moveTooltip; 15416 } 15417 if (touch) { 15418 events.click = this._openTooltip; 15419 } 15420 } else { 15421 events.add = this._openTooltip; 15422 } 15423 this[onOff](events); 15424 this._tooltipHandlersAdded = !remove$$1; 15425 }, 15426 15427 // @method openTooltip(latlng?: LatLng): this 15428 // Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed. 15429 openTooltip: function (layer, latlng) { 15430 if (this._tooltip && this._map) { 15431 latlng = this._tooltip._prepareOpen(this, layer, latlng); 15432 15433 // open the tooltip on the map 15434 this._map.openTooltip(this._tooltip, latlng); 15435 15436 // Tooltip container may not be defined if not permanent and never 15437 // opened. 15438 if (this._tooltip.options.interactive && this._tooltip._container) { 15439 addClass(this._tooltip._container, 'leaflet-clickable'); 15440 this.addInteractiveTarget(this._tooltip._container); 15441 } 15442 } 15443 15444 return this; 15445 }, 15446 15447 // @method closeTooltip(): this 15448 // Closes the tooltip bound to this layer if it is open. 15449 closeTooltip: function () { 15450 if (this._tooltip) { 15451 this._tooltip._close(); 15452 if (this._tooltip.options.interactive && this._tooltip._container) { 15453 removeClass(this._tooltip._container, 'leaflet-clickable'); 15454 this.removeInteractiveTarget(this._tooltip._container); 15455 } 15456 } 15457 return this; 15458 }, 15459 15460 // @method toggleTooltip(): this 15461 // Opens or closes the tooltip bound to this layer depending on its current state. 15462 toggleTooltip: function (target) { 15463 if (this._tooltip) { 15464 if (this._tooltip._map) { 15465 this.closeTooltip(); 15466 } else { 15467 this.openTooltip(target); 15468 } 15469 } 15470 return this; 15471 }, 15472 15473 // @method isTooltipOpen(): boolean 15474 // Returns `true` if the tooltip bound to this layer is currently open. 15475 isTooltipOpen: function () { 15476 return this._tooltip.isOpen(); 15477 }, 15478 15479 // @method setTooltipContent(content: String|HTMLElement|Tooltip): this 15480 // Sets the content of the tooltip bound to this layer. 15481 setTooltipContent: function (content) { 15482 if (this._tooltip) { 15483 this._tooltip.setContent(content); 15484 } 15485 return this; 15486 }, 15487 15488 // @method getTooltip(): Tooltip 15489 // Returns the tooltip bound to this layer. 15490 getTooltip: function () { 15491 return this._tooltip; 15492 }, 15493 15494 _openTooltip: function (e) { 15495 var layer = e.layer || e.target; 15496 15497 if (!this._tooltip || !this._map) { 15498 return; 15499 } 15500 this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined); 15501 }, 15502 15503 _moveTooltip: function (e) { 15504 var latlng = e.latlng, containerPoint, layerPoint; 15505 if (this._tooltip.options.sticky && e.originalEvent) { 15506 containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent); 15507 layerPoint = this._map.containerPointToLayerPoint(containerPoint); 15508 latlng = this._map.layerPointToLatLng(layerPoint); 15509 } 15510 this._tooltip.setLatLng(latlng); 15511 } 15512}); 15513 15514/* 15515 * @class DivIcon 15516 * @aka L.DivIcon 15517 * @inherits Icon 15518 * 15519 * Represents a lightweight icon for markers that uses a simple `<div>` 15520 * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options. 15521 * 15522 * @example 15523 * ```js 15524 * var myIcon = L.divIcon({className: 'my-div-icon'}); 15525 * // you can set .my-div-icon styles in CSS 15526 * 15527 * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); 15528 * ``` 15529 * 15530 * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow. 15531 */ 15532 15533var DivIcon = Icon.extend({ 15534 options: { 15535 // @section 15536 // @aka DivIcon options 15537 iconSize: [12, 12], // also can be set through CSS 15538 15539 // iconAnchor: (Point), 15540 // popupAnchor: (Point), 15541 15542 // @option html: String|HTMLElement = '' 15543 // Custom HTML code to put inside the div element, empty by default. Alternatively, 15544 // an instance of `HTMLElement`. 15545 html: false, 15546 15547 // @option bgPos: Point = [0, 0] 15548 // Optional relative position of the background, in pixels 15549 bgPos: null, 15550 15551 className: 'leaflet-div-icon' 15552 }, 15553 15554 createIcon: function (oldIcon) { 15555 var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'), 15556 options = this.options; 15557 15558 if (options.html instanceof Element) { 15559 empty(div); 15560 div.appendChild(options.html); 15561 } else { 15562 div.innerHTML = options.html !== false ? options.html : ''; 15563 } 15564 15565 if (options.bgPos) { 15566 var bgPos = toPoint(options.bgPos); 15567 div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px'; 15568 } 15569 this._setIconStyles(div, 'icon'); 15570 15571 return div; 15572 }, 15573 15574 createShadow: function () { 15575 return null; 15576 } 15577}); 15578 15579// @factory L.divIcon(options: DivIcon options) 15580// Creates a `DivIcon` instance with the given options. 15581function divIcon(options) { 15582 return new DivIcon(options); 15583} 15584 15585Icon.Default = IconDefault; 15586 15587/* 15588 * @class GridLayer 15589 * @inherits Layer 15590 * @aka L.GridLayer 15591 * 15592 * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`. 15593 * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you. 15594 * 15595 * 15596 * @section Synchronous usage 15597 * @example 15598 * 15599 * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile. 15600 * 15601 * ```js 15602 * var CanvasLayer = L.GridLayer.extend({ 15603 * createTile: function(coords){ 15604 * // create a <canvas> element for drawing 15605 * var tile = L.DomUtil.create('canvas', 'leaflet-tile'); 15606 * 15607 * // setup tile width and height according to the options 15608 * var size = this.getTileSize(); 15609 * tile.width = size.x; 15610 * tile.height = size.y; 15611 * 15612 * // get a canvas context and draw something on it using coords.x, coords.y and coords.z 15613 * var ctx = tile.getContext('2d'); 15614 * 15615 * // return the tile so it can be rendered on screen 15616 * return tile; 15617 * } 15618 * }); 15619 * ``` 15620 * 15621 * @section Asynchronous usage 15622 * @example 15623 * 15624 * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback. 15625 * 15626 * ```js 15627 * var CanvasLayer = L.GridLayer.extend({ 15628 * createTile: function(coords, done){ 15629 * var error; 15630 * 15631 * // create a <canvas> element for drawing 15632 * var tile = L.DomUtil.create('canvas', 'leaflet-tile'); 15633 * 15634 * // setup tile width and height according to the options 15635 * var size = this.getTileSize(); 15636 * tile.width = size.x; 15637 * tile.height = size.y; 15638 * 15639 * // draw something asynchronously and pass the tile to the done() callback 15640 * setTimeout(function() { 15641 * done(error, tile); 15642 * }, 1000); 15643 * 15644 * return tile; 15645 * } 15646 * }); 15647 * ``` 15648 * 15649 * @section 15650 */ 15651 15652 15653var GridLayer = Layer.extend({ 15654 15655 // @section 15656 // @aka GridLayer options 15657 options: { 15658 // @option tileSize: Number|Point = 256 15659 // Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise. 15660 tileSize: 256, 15661 15662 // @option opacity: Number = 1.0 15663 // Opacity of the tiles. Can be used in the `createTile()` function. 15664 opacity: 1, 15665 15666 // @option updateWhenIdle: Boolean = (depends) 15667 // Load new tiles only when panning ends. 15668 // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation. 15669 // `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the 15670 // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers. 15671 updateWhenIdle: mobile, 15672 15673 // @option updateWhenZooming: Boolean = true 15674 // By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends. 15675 updateWhenZooming: true, 15676 15677 // @option updateInterval: Number = 200 15678 // Tiles will not update more than once every `updateInterval` milliseconds when panning. 15679 updateInterval: 200, 15680 15681 // @option zIndex: Number = 1 15682 // The explicit zIndex of the tile layer. 15683 zIndex: 1, 15684 15685 // @option bounds: LatLngBounds = undefined 15686 // If set, tiles will only be loaded inside the set `LatLngBounds`. 15687 bounds: null, 15688 15689 // @option minZoom: Number = 0 15690 // The minimum zoom level down to which this layer will be displayed (inclusive). 15691 minZoom: 0, 15692 15693 // @option maxZoom: Number = undefined 15694 // The maximum zoom level up to which this layer will be displayed (inclusive). 15695 maxZoom: undefined, 15696 15697 // @option maxNativeZoom: Number = undefined 15698 // Maximum zoom number the tile source has available. If it is specified, 15699 // the tiles on all zoom levels higher than `maxNativeZoom` will be loaded 15700 // from `maxNativeZoom` level and auto-scaled. 15701 maxNativeZoom: undefined, 15702 15703 // @option minNativeZoom: Number = undefined 15704 // Minimum zoom number the tile source has available. If it is specified, 15705 // the tiles on all zoom levels lower than `minNativeZoom` will be loaded 15706 // from `minNativeZoom` level and auto-scaled. 15707 minNativeZoom: undefined, 15708 15709 // @option noWrap: Boolean = false 15710 // Whether the layer is wrapped around the antimeridian. If `true`, the 15711 // GridLayer will only be displayed once at low zoom levels. Has no 15712 // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used 15713 // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting 15714 // tiles outside the CRS limits. 15715 noWrap: false, 15716 15717 // @option pane: String = 'tilePane' 15718 // `Map pane` where the grid layer will be added. 15719 pane: 'tilePane', 15720 15721 // @option className: String = '' 15722 // A custom class name to assign to the tile layer. Empty by default. 15723 className: '', 15724 15725 // @option keepBuffer: Number = 2 15726 // When panning the map, keep this many rows and columns of tiles before unloading them. 15727 keepBuffer: 2 15728 }, 15729 15730 initialize: function (options) { 15731 setOptions(this, options); 15732 }, 15733 15734 onAdd: function () { 15735 this._initContainer(); 15736 15737 this._levels = {}; 15738 this._tiles = {}; 15739 15740 this._resetView(); 15741 this._update(); 15742 }, 15743 15744 beforeAdd: function (map) { 15745 map._addZoomLimit(this); 15746 }, 15747 15748 onRemove: function (map) { 15749 this._removeAllTiles(); 15750 remove(this._container); 15751 map._removeZoomLimit(this); 15752 this._container = null; 15753 this._tileZoom = undefined; 15754 }, 15755 15756 // @method bringToFront: this 15757 // Brings the tile layer to the top of all tile layers. 15758 bringToFront: function () { 15759 if (this._map) { 15760 toFront(this._container); 15761 this._setAutoZIndex(Math.max); 15762 } 15763 return this; 15764 }, 15765 15766 // @method bringToBack: this 15767 // Brings the tile layer to the bottom of all tile layers. 15768 bringToBack: function () { 15769 if (this._map) { 15770 toBack(this._container); 15771 this._setAutoZIndex(Math.min); 15772 } 15773 return this; 15774 }, 15775 15776 // @method getContainer: HTMLElement 15777 // Returns the HTML element that contains the tiles for this layer. 15778 getContainer: function () { 15779 return this._container; 15780 }, 15781 15782 // @method setOpacity(opacity: Number): this 15783 // Changes the [opacity](#gridlayer-opacity) of the grid layer. 15784 setOpacity: function (opacity) { 15785 this.options.opacity = opacity; 15786 this._updateOpacity(); 15787 return this; 15788 }, 15789 15790 // @method setZIndex(zIndex: Number): this 15791 // Changes the [zIndex](#gridlayer-zindex) of the grid layer. 15792 setZIndex: function (zIndex) { 15793 this.options.zIndex = zIndex; 15794 this._updateZIndex(); 15795 15796 return this; 15797 }, 15798 15799 // @method isLoading: Boolean 15800 // Returns `true` if any tile in the grid layer has not finished loading. 15801 isLoading: function () { 15802 return this._loading; 15803 }, 15804 15805 // @method redraw: this 15806 // Causes the layer to clear all the tiles and request them again. 15807 redraw: function () { 15808 if (this._map) { 15809 this._removeAllTiles(); 15810 this._update(); 15811 } 15812 return this; 15813 }, 15814 15815 getEvents: function () { 15816 var events = { 15817 viewprereset: this._invalidateAll, 15818 viewreset: this._resetView, 15819 zoom: this._resetView, 15820 moveend: this._onMoveEnd 15821 }; 15822 15823 if (!this.options.updateWhenIdle) { 15824 // update tiles on move, but not more often than once per given interval 15825 if (!this._onMove) { 15826 this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this); 15827 } 15828 15829 events.move = this._onMove; 15830 } 15831 15832 if (this._zoomAnimated) { 15833 events.zoomanim = this._animateZoom; 15834 } 15835 15836 return events; 15837 }, 15838 15839 // @section Extension methods 15840 // Layers extending `GridLayer` shall reimplement the following method. 15841 // @method createTile(coords: Object, done?: Function): HTMLElement 15842 // Called only internally, must be overridden by classes extending `GridLayer`. 15843 // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback 15844 // is specified, it must be called when the tile has finished loading and drawing. 15845 createTile: function () { 15846 return document.createElement('div'); 15847 }, 15848 15849 // @section 15850 // @method getTileSize: Point 15851 // Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method. 15852 getTileSize: function () { 15853 var s = this.options.tileSize; 15854 return s instanceof Point ? s : new Point(s, s); 15855 }, 15856 15857 _updateZIndex: function () { 15858 if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) { 15859 this._container.style.zIndex = this.options.zIndex; 15860 } 15861 }, 15862 15863 _setAutoZIndex: function (compare) { 15864 // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back) 15865 15866 var layers = this.getPane().children, 15867 edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min 15868 15869 for (var i = 0, len = layers.length, zIndex; i < len; i++) { 15870 15871 zIndex = layers[i].style.zIndex; 15872 15873 if (layers[i] !== this._container && zIndex) { 15874 edgeZIndex = compare(edgeZIndex, +zIndex); 15875 } 15876 } 15877 15878 if (isFinite(edgeZIndex)) { 15879 this.options.zIndex = edgeZIndex + compare(-1, 1); 15880 this._updateZIndex(); 15881 } 15882 }, 15883 15884 _updateOpacity: function () { 15885 if (!this._map) { return; } 15886 15887 // IE doesn't inherit filter opacity properly, so we're forced to set it on tiles 15888 if (ielt9) { return; } 15889 15890 setOpacity(this._container, this.options.opacity); 15891 15892 var now = +new Date(), 15893 nextFrame = false, 15894 willPrune = false; 15895 15896 for (var key in this._tiles) { 15897 var tile = this._tiles[key]; 15898 if (!tile.current || !tile.loaded) { continue; } 15899 15900 var fade = Math.min(1, (now - tile.loaded) / 200); 15901 15902 setOpacity(tile.el, fade); 15903 if (fade < 1) { 15904 nextFrame = true; 15905 } else { 15906 if (tile.active) { 15907 willPrune = true; 15908 } else { 15909 this._onOpaqueTile(tile); 15910 } 15911 tile.active = true; 15912 } 15913 } 15914 15915 if (willPrune && !this._noPrune) { this._pruneTiles(); } 15916 15917 if (nextFrame) { 15918 cancelAnimFrame(this._fadeFrame); 15919 this._fadeFrame = requestAnimFrame(this._updateOpacity, this); 15920 } 15921 }, 15922 15923 _onOpaqueTile: falseFn, 15924 15925 _initContainer: function () { 15926 if (this._container) { return; } 15927 15928 this._container = create$1('div', 'leaflet-layer ' + (this.options.className || '')); 15929 this._updateZIndex(); 15930 15931 if (this.options.opacity < 1) { 15932 this._updateOpacity(); 15933 } 15934 15935 this.getPane().appendChild(this._container); 15936 }, 15937 15938 _updateLevels: function () { 15939 15940 var zoom = this._tileZoom, 15941 maxZoom = this.options.maxZoom; 15942 15943 if (zoom === undefined) { return undefined; } 15944 15945 for (var z in this._levels) { 15946 if (this._levels[z].el.children.length || z === zoom) { 15947 this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z); 15948 this._onUpdateLevel(z); 15949 } else { 15950 remove(this._levels[z].el); 15951 this._removeTilesAtZoom(z); 15952 this._onRemoveLevel(z); 15953 delete this._levels[z]; 15954 } 15955 } 15956 15957 var level = this._levels[zoom], 15958 map = this._map; 15959 15960 if (!level) { 15961 level = this._levels[zoom] = {}; 15962 15963 level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container); 15964 level.el.style.zIndex = maxZoom; 15965 15966 level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round(); 15967 level.zoom = zoom; 15968 15969 this._setZoomTransform(level, map.getCenter(), map.getZoom()); 15970 15971 // force the browser to consider the newly added element for transition 15972 falseFn(level.el.offsetWidth); 15973 15974 this._onCreateLevel(level); 15975 } 15976 15977 this._level = level; 15978 15979 return level; 15980 }, 15981 15982 _onUpdateLevel: falseFn, 15983 15984 _onRemoveLevel: falseFn, 15985 15986 _onCreateLevel: falseFn, 15987 15988 _pruneTiles: function () { 15989 if (!this._map) { 15990 return; 15991 } 15992 15993 var key, tile; 15994 15995 var zoom = this._map.getZoom(); 15996 if (zoom > this.options.maxZoom || 15997 zoom < this.options.minZoom) { 15998 this._removeAllTiles(); 15999 return; 16000 } 16001 16002 for (key in this._tiles) { 16003 tile = this._tiles[key]; 16004 tile.retain = tile.current; 16005 } 16006 16007 for (key in this._tiles) { 16008 tile = this._tiles[key]; 16009 if (tile.current && !tile.active) { 16010 var coords = tile.coords; 16011 if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) { 16012 this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2); 16013 } 16014 } 16015 } 16016 16017 for (key in this._tiles) { 16018 if (!this._tiles[key].retain) { 16019 this._removeTile(key); 16020 } 16021 } 16022 }, 16023 16024 _removeTilesAtZoom: function (zoom) { 16025 for (var key in this._tiles) { 16026 if (this._tiles[key].coords.z !== zoom) { 16027 continue; 16028 } 16029 this._removeTile(key); 16030 } 16031 }, 16032 16033 _removeAllTiles: function () { 16034 for (var key in this._tiles) { 16035 this._removeTile(key); 16036 } 16037 }, 16038 16039 _invalidateAll: function () { 16040 for (var z in this._levels) { 16041 remove(this._levels[z].el); 16042 this._onRemoveLevel(z); 16043 delete this._levels[z]; 16044 } 16045 this._removeAllTiles(); 16046 16047 this._tileZoom = undefined; 16048 }, 16049 16050 _retainParent: function (x, y, z, minZoom) { 16051 var x2 = Math.floor(x / 2), 16052 y2 = Math.floor(y / 2), 16053 z2 = z - 1, 16054 coords2 = new Point(+x2, +y2); 16055 coords2.z = +z2; 16056 16057 var key = this._tileCoordsToKey(coords2), 16058 tile = this._tiles[key]; 16059 16060 if (tile && tile.active) { 16061 tile.retain = true; 16062 return true; 16063 16064 } else if (tile && tile.loaded) { 16065 tile.retain = true; 16066 } 16067 16068 if (z2 > minZoom) { 16069 return this._retainParent(x2, y2, z2, minZoom); 16070 } 16071 16072 return false; 16073 }, 16074 16075 _retainChildren: function (x, y, z, maxZoom) { 16076 16077 for (var i = 2 * x; i < 2 * x + 2; i++) { 16078 for (var j = 2 * y; j < 2 * y + 2; j++) { 16079 16080 var coords = new Point(i, j); 16081 coords.z = z + 1; 16082 16083 var key = this._tileCoordsToKey(coords), 16084 tile = this._tiles[key]; 16085 16086 if (tile && tile.active) { 16087 tile.retain = true; 16088 continue; 16089 16090 } else if (tile && tile.loaded) { 16091 tile.retain = true; 16092 } 16093 16094 if (z + 1 < maxZoom) { 16095 this._retainChildren(i, j, z + 1, maxZoom); 16096 } 16097 } 16098 } 16099 }, 16100 16101 _resetView: function (e) { 16102 var animating = e && (e.pinch || e.flyTo); 16103 this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating); 16104 }, 16105 16106 _animateZoom: function (e) { 16107 this._setView(e.center, e.zoom, true, e.noUpdate); 16108 }, 16109 16110 _clampZoom: function (zoom) { 16111 var options = this.options; 16112 16113 if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) { 16114 return options.minNativeZoom; 16115 } 16116 16117 if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) { 16118 return options.maxNativeZoom; 16119 } 16120 16121 return zoom; 16122 }, 16123 16124 _setView: function (center, zoom, noPrune, noUpdate) { 16125 var tileZoom = this._clampZoom(Math.round(zoom)); 16126 if ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) || 16127 (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) { 16128 tileZoom = undefined; 16129 } 16130 16131 var tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom); 16132 16133 if (!noUpdate || tileZoomChanged) { 16134 16135 this._tileZoom = tileZoom; 16136 16137 if (this._abortLoading) { 16138 this._abortLoading(); 16139 } 16140 16141 this._updateLevels(); 16142 this._resetGrid(); 16143 16144 if (tileZoom !== undefined) { 16145 this._update(center); 16146 } 16147 16148 if (!noPrune) { 16149 this._pruneTiles(); 16150 } 16151 16152 // Flag to prevent _updateOpacity from pruning tiles during 16153 // a zoom anim or a pinch gesture 16154 this._noPrune = !!noPrune; 16155 } 16156 16157 this._setZoomTransforms(center, zoom); 16158 }, 16159 16160 _setZoomTransforms: function (center, zoom) { 16161 for (var i in this._levels) { 16162 this._setZoomTransform(this._levels[i], center, zoom); 16163 } 16164 }, 16165 16166 _setZoomTransform: function (level, center, zoom) { 16167 var scale = this._map.getZoomScale(zoom, level.zoom), 16168 translate = level.origin.multiplyBy(scale) 16169 .subtract(this._map._getNewPixelOrigin(center, zoom)).round(); 16170 16171 if (any3d) { 16172 setTransform(level.el, translate, scale); 16173 } else { 16174 setPosition(level.el, translate); 16175 } 16176 }, 16177 16178 _resetGrid: function () { 16179 var map = this._map, 16180 crs = map.options.crs, 16181 tileSize = this._tileSize = this.getTileSize(), 16182 tileZoom = this._tileZoom; 16183 16184 var bounds = this._map.getPixelWorldBounds(this._tileZoom); 16185 if (bounds) { 16186 this._globalTileRange = this._pxBoundsToTileRange(bounds); 16187 } 16188 16189 this._wrapX = crs.wrapLng && !this.options.noWrap && [ 16190 Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x), 16191 Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y) 16192 ]; 16193 this._wrapY = crs.wrapLat && !this.options.noWrap && [ 16194 Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x), 16195 Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y) 16196 ]; 16197 }, 16198 16199 _onMoveEnd: function () { 16200 if (!this._map || this._map._animatingZoom) { return; } 16201 16202 this._update(); 16203 }, 16204 16205 _getTiledPixelBounds: function (center) { 16206 var map = this._map, 16207 mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(), 16208 scale = map.getZoomScale(mapZoom, this._tileZoom), 16209 pixelCenter = map.project(center, this._tileZoom).floor(), 16210 halfSize = map.getSize().divideBy(scale * 2); 16211 16212 return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize)); 16213 }, 16214 16215 // Private method to load tiles in the grid's active zoom level according to map bounds 16216 _update: function (center) { 16217 var map = this._map; 16218 if (!map) { return; } 16219 var zoom = this._clampZoom(map.getZoom()); 16220 16221 if (center === undefined) { center = map.getCenter(); } 16222 if (this._tileZoom === undefined) { return; } // if out of minzoom/maxzoom 16223 16224 var pixelBounds = this._getTiledPixelBounds(center), 16225 tileRange = this._pxBoundsToTileRange(pixelBounds), 16226 tileCenter = tileRange.getCenter(), 16227 queue = [], 16228 margin = this.options.keepBuffer, 16229 noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]), 16230 tileRange.getTopRight().add([margin, -margin])); 16231 16232 // Sanity check: panic if the tile range contains Infinity somewhere. 16233 if (!(isFinite(tileRange.min.x) && 16234 isFinite(tileRange.min.y) && 16235 isFinite(tileRange.max.x) && 16236 isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); } 16237 16238 for (var key in this._tiles) { 16239 var c = this._tiles[key].coords; 16240 if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) { 16241 this._tiles[key].current = false; 16242 } 16243 } 16244 16245 // _update just loads more tiles. If the tile zoom level differs too much 16246 // from the map's, let _setView reset levels and prune old tiles. 16247 if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; } 16248 16249 // create a queue of coordinates to load tiles from 16250 for (var j = tileRange.min.y; j <= tileRange.max.y; j++) { 16251 for (var i = tileRange.min.x; i <= tileRange.max.x; i++) { 16252 var coords = new Point(i, j); 16253 coords.z = this._tileZoom; 16254 16255 if (!this._isValidTile(coords)) { continue; } 16256 16257 var tile = this._tiles[this._tileCoordsToKey(coords)]; 16258 if (tile) { 16259 tile.current = true; 16260 } else { 16261 queue.push(coords); 16262 } 16263 } 16264 } 16265 16266 // sort tile queue to load tiles in order of their distance to center 16267 queue.sort(function (a, b) { 16268 return a.distanceTo(tileCenter) - b.distanceTo(tileCenter); 16269 }); 16270 16271 if (queue.length !== 0) { 16272 // if it's the first batch of tiles to load 16273 if (!this._loading) { 16274 this._loading = true; 16275 // @event loading: Event 16276 // Fired when the grid layer starts loading tiles. 16277 this.fire('loading'); 16278 } 16279 16280 // create DOM fragment to append tiles in one batch 16281 var fragment = document.createDocumentFragment(); 16282 16283 for (i = 0; i < queue.length; i++) { 16284 this._addTile(queue[i], fragment); 16285 } 16286 16287 this._level.el.appendChild(fragment); 16288 } 16289 }, 16290 16291 _isValidTile: function (coords) { 16292 var crs = this._map.options.crs; 16293 16294 if (!crs.infinite) { 16295 // don't load tile if it's out of bounds and not wrapped 16296 var bounds = this._globalTileRange; 16297 if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) || 16298 (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; } 16299 } 16300 16301 if (!this.options.bounds) { return true; } 16302 16303 // don't load tile if it doesn't intersect the bounds in options 16304 var tileBounds = this._tileCoordsToBounds(coords); 16305 return toLatLngBounds(this.options.bounds).overlaps(tileBounds); 16306 }, 16307 16308 _keyToBounds: function (key) { 16309 return this._tileCoordsToBounds(this._keyToTileCoords(key)); 16310 }, 16311 16312 _tileCoordsToNwSe: function (coords) { 16313 var map = this._map, 16314 tileSize = this.getTileSize(), 16315 nwPoint = coords.scaleBy(tileSize), 16316 sePoint = nwPoint.add(tileSize), 16317 nw = map.unproject(nwPoint, coords.z), 16318 se = map.unproject(sePoint, coords.z); 16319 return [nw, se]; 16320 }, 16321 16322 // converts tile coordinates to its geographical bounds 16323 _tileCoordsToBounds: function (coords) { 16324 var bp = this._tileCoordsToNwSe(coords), 16325 bounds = new LatLngBounds(bp[0], bp[1]); 16326 16327 if (!this.options.noWrap) { 16328 bounds = this._map.wrapLatLngBounds(bounds); 16329 } 16330 return bounds; 16331 }, 16332 // converts tile coordinates to key for the tile cache 16333 _tileCoordsToKey: function (coords) { 16334 return coords.x + ':' + coords.y + ':' + coords.z; 16335 }, 16336 16337 // converts tile cache key to coordinates 16338 _keyToTileCoords: function (key) { 16339 var k = key.split(':'), 16340 coords = new Point(+k[0], +k[1]); 16341 coords.z = +k[2]; 16342 return coords; 16343 }, 16344 16345 _removeTile: function (key) { 16346 var tile = this._tiles[key]; 16347 if (!tile) { return; } 16348 16349 remove(tile.el); 16350 16351 delete this._tiles[key]; 16352 16353 // @event tileunload: TileEvent 16354 // Fired when a tile is removed (e.g. when a tile goes off the screen). 16355 this.fire('tileunload', { 16356 tile: tile.el, 16357 coords: this._keyToTileCoords(key) 16358 }); 16359 }, 16360 16361 _initTile: function (tile) { 16362 addClass(tile, 'leaflet-tile'); 16363 16364 var tileSize = this.getTileSize(); 16365 tile.style.width = tileSize.x + 'px'; 16366 tile.style.height = tileSize.y + 'px'; 16367 16368 tile.onselectstart = falseFn; 16369 tile.onmousemove = falseFn; 16370 16371 // update opacity on tiles in IE7-8 because of filter inheritance problems 16372 if (ielt9 && this.options.opacity < 1) { 16373 setOpacity(tile, this.options.opacity); 16374 } 16375 16376 // without this hack, tiles disappear after zoom on Chrome for Android 16377 // https://github.com/Leaflet/Leaflet/issues/2078 16378 if (android && !android23) { 16379 tile.style.WebkitBackfaceVisibility = 'hidden'; 16380 } 16381 }, 16382 16383 _addTile: function (coords, container) { 16384 var tilePos = this._getTilePos(coords), 16385 key = this._tileCoordsToKey(coords); 16386 16387 var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords)); 16388 16389 this._initTile(tile); 16390 16391 // if createTile is defined with a second argument ("done" callback), 16392 // we know that tile is async and will be ready later; otherwise 16393 if (this.createTile.length < 2) { 16394 // mark tile as ready, but delay one frame for opacity animation to happen 16395 requestAnimFrame(bind(this._tileReady, this, coords, null, tile)); 16396 } 16397 16398 setPosition(tile, tilePos); 16399 16400 // save tile in cache 16401 this._tiles[key] = { 16402 el: tile, 16403 coords: coords, 16404 current: true 16405 }; 16406 16407 container.appendChild(tile); 16408 // @event tileloadstart: TileEvent 16409 // Fired when a tile is requested and starts loading. 16410 this.fire('tileloadstart', { 16411 tile: tile, 16412 coords: coords 16413 }); 16414 }, 16415 16416 _tileReady: function (coords, err, tile) { 16417 if (err) { 16418 // @event tileerror: TileErrorEvent 16419 // Fired when there is an error loading a tile. 16420 this.fire('tileerror', { 16421 error: err, 16422 tile: tile, 16423 coords: coords 16424 }); 16425 } 16426 16427 var key = this._tileCoordsToKey(coords); 16428 16429 tile = this._tiles[key]; 16430 if (!tile) { return; } 16431 16432 tile.loaded = +new Date(); 16433 if (this._map._fadeAnimated) { 16434 setOpacity(tile.el, 0); 16435 cancelAnimFrame(this._fadeFrame); 16436 this._fadeFrame = requestAnimFrame(this._updateOpacity, this); 16437 } else { 16438 tile.active = true; 16439 this._pruneTiles(); 16440 } 16441 16442 if (!err) { 16443 addClass(tile.el, 'leaflet-tile-loaded'); 16444 16445 // @event tileload: TileEvent 16446 // Fired when a tile loads. 16447 this.fire('tileload', { 16448 tile: tile.el, 16449 coords: coords 16450 }); 16451 } 16452 16453 if (this._noTilesToLoad()) { 16454 this._loading = false; 16455 // @event load: Event 16456 // Fired when the grid layer loaded all visible tiles. 16457 this.fire('load'); 16458 16459 if (ielt9 || !this._map._fadeAnimated) { 16460 requestAnimFrame(this._pruneTiles, this); 16461 } else { 16462 // Wait a bit more than 0.2 secs (the duration of the tile fade-in) 16463 // to trigger a pruning. 16464 setTimeout(bind(this._pruneTiles, this), 250); 16465 } 16466 } 16467 }, 16468 16469 _getTilePos: function (coords) { 16470 return coords.scaleBy(this.getTileSize()).subtract(this._level.origin); 16471 }, 16472 16473 _wrapCoords: function (coords) { 16474 var newCoords = new Point( 16475 this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x, 16476 this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y); 16477 newCoords.z = coords.z; 16478 return newCoords; 16479 }, 16480 16481 _pxBoundsToTileRange: function (bounds) { 16482 var tileSize = this.getTileSize(); 16483 return new Bounds( 16484 bounds.min.unscaleBy(tileSize).floor(), 16485 bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1])); 16486 }, 16487 16488 _noTilesToLoad: function () { 16489 for (var key in this._tiles) { 16490 if (!this._tiles[key].loaded) { return false; } 16491 } 16492 return true; 16493 } 16494}); 16495 16496// @factory L.gridLayer(options?: GridLayer options) 16497// Creates a new instance of GridLayer with the supplied options. 16498function gridLayer(options) { 16499 return new GridLayer(options); 16500} 16501 16502/* 16503 * @class TileLayer 16504 * @inherits GridLayer 16505 * @aka L.TileLayer 16506 * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`. 16507 * 16508 * @example 16509 * 16510 * ```js 16511 * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map); 16512 * ``` 16513 * 16514 * @section URL template 16515 * @example 16516 * 16517 * A string of the following form: 16518 * 16519 * ``` 16520 * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png' 16521 * ``` 16522 * 16523 * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "@2x" to the URL to load retina tiles. 16524 * 16525 * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this: 16526 * 16527 * ``` 16528 * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'}); 16529 * ``` 16530 */ 16531 16532 16533var TileLayer = GridLayer.extend({ 16534 16535 // @section 16536 // @aka TileLayer options 16537 options: { 16538 // @option minZoom: Number = 0 16539 // The minimum zoom level down to which this layer will be displayed (inclusive). 16540 minZoom: 0, 16541 16542 // @option maxZoom: Number = 18 16543 // The maximum zoom level up to which this layer will be displayed (inclusive). 16544 maxZoom: 18, 16545 16546 // @option subdomains: String|String[] = 'abc' 16547 // Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings. 16548 subdomains: 'abc', 16549 16550 // @option errorTileUrl: String = '' 16551 // URL to the tile image to show in place of the tile that failed to load. 16552 errorTileUrl: '', 16553 16554 // @option zoomOffset: Number = 0 16555 // The zoom number used in tile URLs will be offset with this value. 16556 zoomOffset: 0, 16557 16558 // @option tms: Boolean = false 16559 // If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services). 16560 tms: false, 16561 16562 // @option zoomReverse: Boolean = false 16563 // If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`) 16564 zoomReverse: false, 16565 16566 // @option detectRetina: Boolean = false 16567 // If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution. 16568 detectRetina: false, 16569 16570 // @option crossOrigin: Boolean|String = false 16571 // Whether the crossOrigin attribute will be added to the tiles. 16572 // If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data. 16573 // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values. 16574 crossOrigin: false 16575 }, 16576 16577 initialize: function (url, options) { 16578 16579 this._url = url; 16580 16581 options = setOptions(this, options); 16582 16583 // detecting retina displays, adjusting tileSize and zoom levels 16584 if (options.detectRetina && retina && options.maxZoom > 0) { 16585 16586 options.tileSize = Math.floor(options.tileSize / 2); 16587 16588 if (!options.zoomReverse) { 16589 options.zoomOffset++; 16590 options.maxZoom--; 16591 } else { 16592 options.zoomOffset--; 16593 options.minZoom++; 16594 } 16595 16596 options.minZoom = Math.max(0, options.minZoom); 16597 } 16598 16599 if (typeof options.subdomains === 'string') { 16600 options.subdomains = options.subdomains.split(''); 16601 } 16602 16603 // for https://github.com/Leaflet/Leaflet/issues/137 16604 if (!android) { 16605 this.on('tileunload', this._onTileRemove); 16606 } 16607 }, 16608 16609 // @method setUrl(url: String, noRedraw?: Boolean): this 16610 // Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`). 16611 // If the URL does not change, the layer will not be redrawn unless 16612 // the noRedraw parameter is set to false. 16613 setUrl: function (url, noRedraw) { 16614 if (this._url === url && noRedraw === undefined) { 16615 noRedraw = true; 16616 } 16617 16618 this._url = url; 16619 16620 if (!noRedraw) { 16621 this.redraw(); 16622 } 16623 return this; 16624 }, 16625 16626 // @method createTile(coords: Object, done?: Function): HTMLElement 16627 // Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile) 16628 // to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done` 16629 // callback is called when the tile has been loaded. 16630 createTile: function (coords, done) { 16631 var tile = document.createElement('img'); 16632 16633 on(tile, 'load', bind(this._tileOnLoad, this, done, tile)); 16634 on(tile, 'error', bind(this._tileOnError, this, done, tile)); 16635 16636 if (this.options.crossOrigin || this.options.crossOrigin === '') { 16637 tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin; 16638 } 16639 16640 /* 16641 Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons 16642 http://www.w3.org/TR/WCAG20-TECHS/H67 16643 */ 16644 tile.alt = ''; 16645 16646 /* 16647 Set role="presentation" to force screen readers to ignore this 16648 https://www.w3.org/TR/wai-aria/roles#textalternativecomputation 16649 */ 16650 tile.setAttribute('role', 'presentation'); 16651 16652 tile.src = this.getTileUrl(coords); 16653 16654 return tile; 16655 }, 16656 16657 // @section Extension methods 16658 // @uninheritable 16659 // Layers extending `TileLayer` might reimplement the following method. 16660 // @method getTileUrl(coords: Object): String 16661 // Called only internally, returns the URL for a tile given its coordinates. 16662 // Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes. 16663 getTileUrl: function (coords) { 16664 var data = { 16665 r: retina ? '@2x' : '', 16666 s: this._getSubdomain(coords), 16667 x: coords.x, 16668 y: coords.y, 16669 z: this._getZoomForUrl() 16670 }; 16671 if (this._map && !this._map.options.crs.infinite) { 16672 var invertedY = this._globalTileRange.max.y - coords.y; 16673 if (this.options.tms) { 16674 data['y'] = invertedY; 16675 } 16676 data['-y'] = invertedY; 16677 } 16678 16679 return template(this._url, extend(data, this.options)); 16680 }, 16681 16682 _tileOnLoad: function (done, tile) { 16683 // For https://github.com/Leaflet/Leaflet/issues/3332 16684 if (ielt9) { 16685 setTimeout(bind(done, this, null, tile), 0); 16686 } else { 16687 done(null, tile); 16688 } 16689 }, 16690 16691 _tileOnError: function (done, tile, e) { 16692 var errorUrl = this.options.errorTileUrl; 16693 if (errorUrl && tile.getAttribute('src') !== errorUrl) { 16694 tile.src = errorUrl; 16695 } 16696 done(e, tile); 16697 }, 16698 16699 _onTileRemove: function (e) { 16700 e.tile.onload = null; 16701 }, 16702 16703 _getZoomForUrl: function () { 16704 var zoom = this._tileZoom, 16705 maxZoom = this.options.maxZoom, 16706 zoomReverse = this.options.zoomReverse, 16707 zoomOffset = this.options.zoomOffset; 16708 16709 if (zoomReverse) { 16710 zoom = maxZoom - zoom; 16711 } 16712 16713 return zoom + zoomOffset; 16714 }, 16715 16716 _getSubdomain: function (tilePoint) { 16717 var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length; 16718 return this.options.subdomains[index]; 16719 }, 16720 16721 // stops loading all tiles in the background layer 16722 _abortLoading: function () { 16723 var i, tile; 16724 for (i in this._tiles) { 16725 if (this._tiles[i].coords.z !== this._tileZoom) { 16726 tile = this._tiles[i].el; 16727 16728 tile.onload = falseFn; 16729 tile.onerror = falseFn; 16730 16731 if (!tile.complete) { 16732 tile.src = emptyImageUrl; 16733 remove(tile); 16734 delete this._tiles[i]; 16735 } 16736 } 16737 } 16738 }, 16739 16740 _removeTile: function (key) { 16741 var tile = this._tiles[key]; 16742 if (!tile) { return; } 16743 16744 // Cancels any pending http requests associated with the tile 16745 // unless we're on Android's stock browser, 16746 // see https://github.com/Leaflet/Leaflet/issues/137 16747 if (!androidStock) { 16748 tile.el.setAttribute('src', emptyImageUrl); 16749 } 16750 16751 return GridLayer.prototype._removeTile.call(this, key); 16752 }, 16753 16754 _tileReady: function (coords, err, tile) { 16755 if (!this._map || (tile && tile.getAttribute('src') === emptyImageUrl)) { 16756 return; 16757 } 16758 16759 return GridLayer.prototype._tileReady.call(this, coords, err, tile); 16760 } 16761}); 16762 16763 16764// @factory L.tilelayer(urlTemplate: String, options?: TileLayer options) 16765// Instantiates a tile layer object given a `URL template` and optionally an options object. 16766 16767function tileLayer(url, options) { 16768 return new TileLayer(url, options); 16769} 16770 16771/* 16772 * @class TileLayer.WMS 16773 * @inherits TileLayer 16774 * @aka L.TileLayer.WMS 16775 * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`. 16776 * 16777 * @example 16778 * 16779 * ```js 16780 * var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", { 16781 * layers: 'nexrad-n0r-900913', 16782 * format: 'image/png', 16783 * transparent: true, 16784 * attribution: "Weather data © 2012 IEM Nexrad" 16785 * }); 16786 * ``` 16787 */ 16788 16789var TileLayerWMS = TileLayer.extend({ 16790 16791 // @section 16792 // @aka TileLayer.WMS options 16793 // If any custom options not documented here are used, they will be sent to the 16794 // WMS server as extra parameters in each request URL. This can be useful for 16795 // [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html). 16796 defaultWmsParams: { 16797 service: 'WMS', 16798 request: 'GetMap', 16799 16800 // @option layers: String = '' 16801 // **(required)** Comma-separated list of WMS layers to show. 16802 layers: '', 16803 16804 // @option styles: String = '' 16805 // Comma-separated list of WMS styles. 16806 styles: '', 16807 16808 // @option format: String = 'image/jpeg' 16809 // WMS image format (use `'image/png'` for layers with transparency). 16810 format: 'image/jpeg', 16811 16812 // @option transparent: Boolean = false 16813 // If `true`, the WMS service will return images with transparency. 16814 transparent: false, 16815 16816 // @option version: String = '1.1.1' 16817 // Version of the WMS service to use 16818 version: '1.1.1' 16819 }, 16820 16821 options: { 16822 // @option crs: CRS = null 16823 // Coordinate Reference System to use for the WMS requests, defaults to 16824 // map CRS. Don't change this if you're not sure what it means. 16825 crs: null, 16826 16827 // @option uppercase: Boolean = false 16828 // If `true`, WMS request parameter keys will be uppercase. 16829 uppercase: false 16830 }, 16831 16832 initialize: function (url, options) { 16833 16834 this._url = url; 16835 16836 var wmsParams = extend({}, this.defaultWmsParams); 16837 16838 // all keys that are not TileLayer options go to WMS params 16839 for (var i in options) { 16840 if (!(i in this.options)) { 16841 wmsParams[i] = options[i]; 16842 } 16843 } 16844 16845 options = setOptions(this, options); 16846 16847 var realRetina = options.detectRetina && retina ? 2 : 1; 16848 var tileSize = this.getTileSize(); 16849 wmsParams.width = tileSize.x * realRetina; 16850 wmsParams.height = tileSize.y * realRetina; 16851 16852 this.wmsParams = wmsParams; 16853 }, 16854 16855 onAdd: function (map) { 16856 16857 this._crs = this.options.crs || map.options.crs; 16858 this._wmsVersion = parseFloat(this.wmsParams.version); 16859 16860 var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs'; 16861 this.wmsParams[projectionKey] = this._crs.code; 16862 16863 TileLayer.prototype.onAdd.call(this, map); 16864 }, 16865 16866 getTileUrl: function (coords) { 16867 16868 var tileBounds = this._tileCoordsToNwSe(coords), 16869 crs = this._crs, 16870 bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])), 16871 min = bounds.min, 16872 max = bounds.max, 16873 bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ? 16874 [min.y, min.x, max.y, max.x] : 16875 [min.x, min.y, max.x, max.y]).join(','), 16876 url = TileLayer.prototype.getTileUrl.call(this, coords); 16877 return url + 16878 getParamString(this.wmsParams, url, this.options.uppercase) + 16879 (this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox; 16880 }, 16881 16882 // @method setParams(params: Object, noRedraw?: Boolean): this 16883 // Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true). 16884 setParams: function (params, noRedraw) { 16885 16886 extend(this.wmsParams, params); 16887 16888 if (!noRedraw) { 16889 this.redraw(); 16890 } 16891 16892 return this; 16893 } 16894}); 16895 16896 16897// @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options) 16898// Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object. 16899function tileLayerWMS(url, options) { 16900 return new TileLayerWMS(url, options); 16901} 16902 16903TileLayer.WMS = TileLayerWMS; 16904tileLayer.wms = tileLayerWMS; 16905 16906/* 16907 * @class Renderer 16908 * @inherits Layer 16909 * @aka L.Renderer 16910 * 16911 * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the 16912 * DOM container of the renderer, its bounds, and its zoom animation. 16913 * 16914 * A `Renderer` works as an implicit layer group for all `Path`s - the renderer 16915 * itself can be added or removed to the map. All paths use a renderer, which can 16916 * be implicit (the map will decide the type of renderer and use it automatically) 16917 * or explicit (using the [`renderer`](#path-renderer) option of the path). 16918 * 16919 * Do not use this class directly, use `SVG` and `Canvas` instead. 16920 * 16921 * @event update: Event 16922 * Fired when the renderer updates its bounds, center and zoom, for example when 16923 * its map has moved 16924 */ 16925 16926var Renderer = Layer.extend({ 16927 16928 // @section 16929 // @aka Renderer options 16930 options: { 16931 // @option padding: Number = 0.1 16932 // How much to extend the clip area around the map view (relative to its size) 16933 // e.g. 0.1 would be 10% of map view in each direction 16934 padding: 0.1, 16935 16936 // @option tolerance: Number = 0 16937 // How much to extend click tolerance round a path/object on the map 16938 tolerance : 0 16939 }, 16940 16941 initialize: function (options) { 16942 setOptions(this, options); 16943 stamp(this); 16944 this._layers = this._layers || {}; 16945 }, 16946 16947 onAdd: function () { 16948 if (!this._container) { 16949 this._initContainer(); // defined by renderer implementations 16950 16951 if (this._zoomAnimated) { 16952 addClass(this._container, 'leaflet-zoom-animated'); 16953 } 16954 } 16955 16956 this.getPane().appendChild(this._container); 16957 this._update(); 16958 this.on('update', this._updatePaths, this); 16959 }, 16960 16961 onRemove: function () { 16962 this.off('update', this._updatePaths, this); 16963 this._destroyContainer(); 16964 }, 16965 16966 getEvents: function () { 16967 var events = { 16968 viewreset: this._reset, 16969 zoom: this._onZoom, 16970 moveend: this._update, 16971 zoomend: this._onZoomEnd 16972 }; 16973 if (this._zoomAnimated) { 16974 events.zoomanim = this._onAnimZoom; 16975 } 16976 return events; 16977 }, 16978 16979 _onAnimZoom: function (ev) { 16980 this._updateTransform(ev.center, ev.zoom); 16981 }, 16982 16983 _onZoom: function () { 16984 this._updateTransform(this._map.getCenter(), this._map.getZoom()); 16985 }, 16986 16987 _updateTransform: function (center, zoom) { 16988 var scale = this._map.getZoomScale(zoom, this._zoom), 16989 position = getPosition(this._container), 16990 viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding), 16991 currentCenterPoint = this._map.project(this._center, zoom), 16992 destCenterPoint = this._map.project(center, zoom), 16993 centerOffset = destCenterPoint.subtract(currentCenterPoint), 16994 16995 topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset); 16996 16997 if (any3d) { 16998 setTransform(this._container, topLeftOffset, scale); 16999 } else { 17000 setPosition(this._container, topLeftOffset); 17001 } 17002 }, 17003 17004 _reset: function () { 17005 this._update(); 17006 this._updateTransform(this._center, this._zoom); 17007 17008 for (var id in this._layers) { 17009 this._layers[id]._reset(); 17010 } 17011 }, 17012 17013 _onZoomEnd: function () { 17014 for (var id in this._layers) { 17015 this._layers[id]._project(); 17016 } 17017 }, 17018 17019 _updatePaths: function () { 17020 for (var id in this._layers) { 17021 this._layers[id]._update(); 17022 } 17023 }, 17024 17025 _update: function () { 17026 // Update pixel bounds of renderer container (for positioning/sizing/clipping later) 17027 // Subclasses are responsible of firing the 'update' event. 17028 var p = this.options.padding, 17029 size = this._map.getSize(), 17030 min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round(); 17031 17032 this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round()); 17033 17034 this._center = this._map.getCenter(); 17035 this._zoom = this._map.getZoom(); 17036 } 17037}); 17038 17039/* 17040 * @class Canvas 17041 * @inherits Renderer 17042 * @aka L.Canvas 17043 * 17044 * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API). 17045 * Inherits `Renderer`. 17046 * 17047 * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not 17048 * available in all web browsers, notably IE8, and overlapping geometries might 17049 * not display properly in some edge cases. 17050 * 17051 * @example 17052 * 17053 * Use Canvas by default for all paths in the map: 17054 * 17055 * ```js 17056 * var map = L.map('map', { 17057 * renderer: L.canvas() 17058 * }); 17059 * ``` 17060 * 17061 * Use a Canvas renderer with extra padding for specific vector geometries: 17062 * 17063 * ```js 17064 * var map = L.map('map'); 17065 * var myRenderer = L.canvas({ padding: 0.5 }); 17066 * var line = L.polyline( coordinates, { renderer: myRenderer } ); 17067 * var circle = L.circle( center, { renderer: myRenderer } ); 17068 * ``` 17069 */ 17070 17071var Canvas = Renderer.extend({ 17072 getEvents: function () { 17073 var events = Renderer.prototype.getEvents.call(this); 17074 events.viewprereset = this._onViewPreReset; 17075 return events; 17076 }, 17077 17078 _onViewPreReset: function () { 17079 // Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once 17080 this._postponeUpdatePaths = true; 17081 }, 17082 17083 onAdd: function () { 17084 Renderer.prototype.onAdd.call(this); 17085 17086 // Redraw vectors since canvas is cleared upon removal, 17087 // in case of removing the renderer itself from the map. 17088 this._draw(); 17089 }, 17090 17091 _initContainer: function () { 17092 var container = this._container = document.createElement('canvas'); 17093 17094 on(container, 'mousemove', this._onMouseMove, this); 17095 on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this); 17096 on(container, 'mouseout', this._handleMouseOut, this); 17097 17098 this._ctx = container.getContext('2d'); 17099 }, 17100 17101 _destroyContainer: function () { 17102 cancelAnimFrame(this._redrawRequest); 17103 delete this._ctx; 17104 remove(this._container); 17105 off(this._container); 17106 delete this._container; 17107 }, 17108 17109 _updatePaths: function () { 17110 if (this._postponeUpdatePaths) { return; } 17111 17112 var layer; 17113 this._redrawBounds = null; 17114 for (var id in this._layers) { 17115 layer = this._layers[id]; 17116 layer._update(); 17117 } 17118 this._redraw(); 17119 }, 17120 17121 _update: function () { 17122 if (this._map._animatingZoom && this._bounds) { return; } 17123 17124 Renderer.prototype._update.call(this); 17125 17126 var b = this._bounds, 17127 container = this._container, 17128 size = b.getSize(), 17129 m = retina ? 2 : 1; 17130 17131 setPosition(container, b.min); 17132 17133 // set canvas size (also clearing it); use double size on retina 17134 container.width = m * size.x; 17135 container.height = m * size.y; 17136 container.style.width = size.x + 'px'; 17137 container.style.height = size.y + 'px'; 17138 17139 if (retina) { 17140 this._ctx.scale(2, 2); 17141 } 17142 17143 // translate so we use the same path coordinates after canvas element moves 17144 this._ctx.translate(-b.min.x, -b.min.y); 17145 17146 // Tell paths to redraw themselves 17147 this.fire('update'); 17148 }, 17149 17150 _reset: function () { 17151 Renderer.prototype._reset.call(this); 17152 17153 if (this._postponeUpdatePaths) { 17154 this._postponeUpdatePaths = false; 17155 this._updatePaths(); 17156 } 17157 }, 17158 17159 _initPath: function (layer) { 17160 this._updateDashArray(layer); 17161 this._layers[stamp(layer)] = layer; 17162 17163 var order = layer._order = { 17164 layer: layer, 17165 prev: this._drawLast, 17166 next: null 17167 }; 17168 if (this._drawLast) { this._drawLast.next = order; } 17169 this._drawLast = order; 17170 this._drawFirst = this._drawFirst || this._drawLast; 17171 }, 17172 17173 _addPath: function (layer) { 17174 this._requestRedraw(layer); 17175 }, 17176 17177 _removePath: function (layer) { 17178 var order = layer._order; 17179 var next = order.next; 17180 var prev = order.prev; 17181 17182 if (next) { 17183 next.prev = prev; 17184 } else { 17185 this._drawLast = prev; 17186 } 17187 if (prev) { 17188 prev.next = next; 17189 } else { 17190 this._drawFirst = next; 17191 } 17192 17193 delete layer._order; 17194 17195 delete this._layers[stamp(layer)]; 17196 17197 this._requestRedraw(layer); 17198 }, 17199 17200 _updatePath: function (layer) { 17201 // Redraw the union of the layer's old pixel 17202 // bounds and the new pixel bounds. 17203 this._extendRedrawBounds(layer); 17204 layer._project(); 17205 layer._update(); 17206 // The redraw will extend the redraw bounds 17207 // with the new pixel bounds. 17208 this._requestRedraw(layer); 17209 }, 17210 17211 _updateStyle: function (layer) { 17212 this._updateDashArray(layer); 17213 this._requestRedraw(layer); 17214 }, 17215 17216 _updateDashArray: function (layer) { 17217 if (typeof layer.options.dashArray === 'string') { 17218 var parts = layer.options.dashArray.split(/[, ]+/), 17219 dashArray = [], 17220 dashValue, 17221 i; 17222 for (i = 0; i < parts.length; i++) { 17223 dashValue = Number(parts[i]); 17224 // Ignore dash array containing invalid lengths 17225 if (isNaN(dashValue)) { return; } 17226 dashArray.push(dashValue); 17227 } 17228 layer.options._dashArray = dashArray; 17229 } else { 17230 layer.options._dashArray = layer.options.dashArray; 17231 } 17232 }, 17233 17234 _requestRedraw: function (layer) { 17235 if (!this._map) { return; } 17236 17237 this._extendRedrawBounds(layer); 17238 this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this); 17239 }, 17240 17241 _extendRedrawBounds: function (layer) { 17242 if (layer._pxBounds) { 17243 var padding = (layer.options.weight || 0) + 1; 17244 this._redrawBounds = this._redrawBounds || new Bounds(); 17245 this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding])); 17246 this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding])); 17247 } 17248 }, 17249 17250 _redraw: function () { 17251 this._redrawRequest = null; 17252 17253 if (this._redrawBounds) { 17254 this._redrawBounds.min._floor(); 17255 this._redrawBounds.max._ceil(); 17256 } 17257 17258 this._clear(); // clear layers in redraw bounds 17259 this._draw(); // draw layers 17260 17261 this._redrawBounds = null; 17262 }, 17263 17264 _clear: function () { 17265 var bounds = this._redrawBounds; 17266 if (bounds) { 17267 var size = bounds.getSize(); 17268 this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y); 17269 } else { 17270 this._ctx.clearRect(0, 0, this._container.width, this._container.height); 17271 } 17272 }, 17273 17274 _draw: function () { 17275 var layer, bounds = this._redrawBounds; 17276 this._ctx.save(); 17277 if (bounds) { 17278 var size = bounds.getSize(); 17279 this._ctx.beginPath(); 17280 this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y); 17281 this._ctx.clip(); 17282 } 17283 17284 this._drawing = true; 17285 17286 for (var order = this._drawFirst; order; order = order.next) { 17287 layer = order.layer; 17288 if (!bounds || (layer._pxBounds && layer._pxBounds.intersects(bounds))) { 17289 layer._updatePath(); 17290 } 17291 } 17292 17293 this._drawing = false; 17294 17295 this._ctx.restore(); // Restore state before clipping. 17296 }, 17297 17298 _updatePoly: function (layer, closed) { 17299 if (!this._drawing) { return; } 17300 17301 var i, j, len2, p, 17302 parts = layer._parts, 17303 len = parts.length, 17304 ctx = this._ctx; 17305 17306 if (!len) { return; } 17307 17308 ctx.beginPath(); 17309 17310 for (i = 0; i < len; i++) { 17311 for (j = 0, len2 = parts[i].length; j < len2; j++) { 17312 p = parts[i][j]; 17313 ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y); 17314 } 17315 if (closed) { 17316 ctx.closePath(); 17317 } 17318 } 17319 17320 this._fillStroke(ctx, layer); 17321 17322 // TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature 17323 }, 17324 17325 _updateCircle: function (layer) { 17326 17327 if (!this._drawing || layer._empty()) { return; } 17328 17329 var p = layer._point, 17330 ctx = this._ctx, 17331 r = Math.max(Math.round(layer._radius), 1), 17332 s = (Math.max(Math.round(layer._radiusY), 1) || r) / r; 17333 17334 if (s !== 1) { 17335 ctx.save(); 17336 ctx.scale(1, s); 17337 } 17338 17339 ctx.beginPath(); 17340 ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false); 17341 17342 if (s !== 1) { 17343 ctx.restore(); 17344 } 17345 17346 this._fillStroke(ctx, layer); 17347 }, 17348 17349 _fillStroke: function (ctx, layer) { 17350 var options = layer.options; 17351 17352 if (options.fill) { 17353 ctx.globalAlpha = options.fillOpacity; 17354 ctx.fillStyle = options.fillColor || options.color; 17355 ctx.fill(options.fillRule || 'evenodd'); 17356 } 17357 17358 if (options.stroke && options.weight !== 0) { 17359 if (ctx.setLineDash) { 17360 ctx.setLineDash(layer.options && layer.options._dashArray || []); 17361 } 17362 ctx.globalAlpha = options.opacity; 17363 ctx.lineWidth = options.weight; 17364 ctx.strokeStyle = options.color; 17365 ctx.lineCap = options.lineCap; 17366 ctx.lineJoin = options.lineJoin; 17367 ctx.stroke(); 17368 } 17369 }, 17370 17371 // Canvas obviously doesn't have mouse events for individual drawn objects, 17372 // so we emulate that by calculating what's under the mouse on mousemove/click manually 17373 17374 _onClick: function (e) { 17375 var point = this._map.mouseEventToLayerPoint(e), layer, clickedLayer; 17376 17377 for (var order = this._drawFirst; order; order = order.next) { 17378 layer = order.layer; 17379 if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) { 17380 clickedLayer = layer; 17381 } 17382 } 17383 if (clickedLayer) { 17384 fakeStop(e); 17385 this._fireEvent([clickedLayer], e); 17386 } 17387 }, 17388 17389 _onMouseMove: function (e) { 17390 if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; } 17391 17392 var point = this._map.mouseEventToLayerPoint(e); 17393 this._handleMouseHover(e, point); 17394 }, 17395 17396 17397 _handleMouseOut: function (e) { 17398 var layer = this._hoveredLayer; 17399 if (layer) { 17400 // if we're leaving the layer, fire mouseout 17401 removeClass(this._container, 'leaflet-interactive'); 17402 this._fireEvent([layer], e, 'mouseout'); 17403 this._hoveredLayer = null; 17404 this._mouseHoverThrottled = false; 17405 } 17406 }, 17407 17408 _handleMouseHover: function (e, point) { 17409 if (this._mouseHoverThrottled) { 17410 return; 17411 } 17412 17413 var layer, candidateHoveredLayer; 17414 17415 for (var order = this._drawFirst; order; order = order.next) { 17416 layer = order.layer; 17417 if (layer.options.interactive && layer._containsPoint(point)) { 17418 candidateHoveredLayer = layer; 17419 } 17420 } 17421 17422 if (candidateHoveredLayer !== this._hoveredLayer) { 17423 this._handleMouseOut(e); 17424 17425 if (candidateHoveredLayer) { 17426 addClass(this._container, 'leaflet-interactive'); // change cursor 17427 this._fireEvent([candidateHoveredLayer], e, 'mouseover'); 17428 this._hoveredLayer = candidateHoveredLayer; 17429 } 17430 } 17431 17432 if (this._hoveredLayer) { 17433 this._fireEvent([this._hoveredLayer], e); 17434 } 17435 17436 this._mouseHoverThrottled = true; 17437 setTimeout(L.bind(function () { 17438 this._mouseHoverThrottled = false; 17439 }, this), 32); 17440 }, 17441 17442 _fireEvent: function (layers, e, type) { 17443 this._map._fireDOMEvent(e, type || e.type, layers); 17444 }, 17445 17446 _bringToFront: function (layer) { 17447 var order = layer._order; 17448 17449 if (!order) { return; } 17450 17451 var next = order.next; 17452 var prev = order.prev; 17453 17454 if (next) { 17455 next.prev = prev; 17456 } else { 17457 // Already last 17458 return; 17459 } 17460 if (prev) { 17461 prev.next = next; 17462 } else if (next) { 17463 // Update first entry unless this is the 17464 // single entry 17465 this._drawFirst = next; 17466 } 17467 17468 order.prev = this._drawLast; 17469 this._drawLast.next = order; 17470 17471 order.next = null; 17472 this._drawLast = order; 17473 17474 this._requestRedraw(layer); 17475 }, 17476 17477 _bringToBack: function (layer) { 17478 var order = layer._order; 17479 17480 if (!order) { return; } 17481 17482 var next = order.next; 17483 var prev = order.prev; 17484 17485 if (prev) { 17486 prev.next = next; 17487 } else { 17488 // Already first 17489 return; 17490 } 17491 if (next) { 17492 next.prev = prev; 17493 } else if (prev) { 17494 // Update last entry unless this is the 17495 // single entry 17496 this._drawLast = prev; 17497 } 17498 17499 order.prev = null; 17500 17501 order.next = this._drawFirst; 17502 this._drawFirst.prev = order; 17503 this._drawFirst = order; 17504 17505 this._requestRedraw(layer); 17506 } 17507}); 17508 17509// @factory L.canvas(options?: Renderer options) 17510// Creates a Canvas renderer with the given options. 17511function canvas$1(options) { 17512 return canvas ? new Canvas(options) : null; 17513} 17514 17515/* 17516 * Thanks to Dmitry Baranovsky and his Raphael library for inspiration! 17517 */ 17518 17519 17520var vmlCreate = (function () { 17521 try { 17522 document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml'); 17523 return function (name) { 17524 return document.createElement('<lvml:' + name + ' class="lvml">'); 17525 }; 17526 } catch (e) { 17527 return function (name) { 17528 return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">'); 17529 }; 17530 } 17531})(); 17532 17533 17534/* 17535 * @class SVG 17536 * 17537 * 17538 * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility 17539 * with old versions of Internet Explorer. 17540 */ 17541 17542// mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences 17543var vmlMixin = { 17544 17545 _initContainer: function () { 17546 this._container = create$1('div', 'leaflet-vml-container'); 17547 }, 17548 17549 _update: function () { 17550 if (this._map._animatingZoom) { return; } 17551 Renderer.prototype._update.call(this); 17552 this.fire('update'); 17553 }, 17554 17555 _initPath: function (layer) { 17556 var container = layer._container = vmlCreate('shape'); 17557 17558 addClass(container, 'leaflet-vml-shape ' + (this.options.className || '')); 17559 17560 container.coordsize = '1 1'; 17561 17562 layer._path = vmlCreate('path'); 17563 container.appendChild(layer._path); 17564 17565 this._updateStyle(layer); 17566 this._layers[stamp(layer)] = layer; 17567 }, 17568 17569 _addPath: function (layer) { 17570 var container = layer._container; 17571 this._container.appendChild(container); 17572 17573 if (layer.options.interactive) { 17574 layer.addInteractiveTarget(container); 17575 } 17576 }, 17577 17578 _removePath: function (layer) { 17579 var container = layer._container; 17580 remove(container); 17581 layer.removeInteractiveTarget(container); 17582 delete this._layers[stamp(layer)]; 17583 }, 17584 17585 _updateStyle: function (layer) { 17586 var stroke = layer._stroke, 17587 fill = layer._fill, 17588 options = layer.options, 17589 container = layer._container; 17590 17591 container.stroked = !!options.stroke; 17592 container.filled = !!options.fill; 17593 17594 if (options.stroke) { 17595 if (!stroke) { 17596 stroke = layer._stroke = vmlCreate('stroke'); 17597 } 17598 container.appendChild(stroke); 17599 stroke.weight = options.weight + 'px'; 17600 stroke.color = options.color; 17601 stroke.opacity = options.opacity; 17602 17603 if (options.dashArray) { 17604 stroke.dashStyle = isArray(options.dashArray) ? 17605 options.dashArray.join(' ') : 17606 options.dashArray.replace(/( *, *)/g, ' '); 17607 } else { 17608 stroke.dashStyle = ''; 17609 } 17610 stroke.endcap = options.lineCap.replace('butt', 'flat'); 17611 stroke.joinstyle = options.lineJoin; 17612 17613 } else if (stroke) { 17614 container.removeChild(stroke); 17615 layer._stroke = null; 17616 } 17617 17618 if (options.fill) { 17619 if (!fill) { 17620 fill = layer._fill = vmlCreate('fill'); 17621 } 17622 container.appendChild(fill); 17623 fill.color = options.fillColor || options.color; 17624 fill.opacity = options.fillOpacity; 17625 17626 } else if (fill) { 17627 container.removeChild(fill); 17628 layer._fill = null; 17629 } 17630 }, 17631 17632 _updateCircle: function (layer) { 17633 var p = layer._point.round(), 17634 r = Math.round(layer._radius), 17635 r2 = Math.round(layer._radiusY || r); 17636 17637 this._setPath(layer, layer._empty() ? 'M0 0' : 17638 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360)); 17639 }, 17640 17641 _setPath: function (layer, path) { 17642 layer._path.v = path; 17643 }, 17644 17645 _bringToFront: function (layer) { 17646 toFront(layer._container); 17647 }, 17648 17649 _bringToBack: function (layer) { 17650 toBack(layer._container); 17651 } 17652}; 17653 17654var create$2 = vml ? vmlCreate : svgCreate; 17655 17656/* 17657 * @class SVG 17658 * @inherits Renderer 17659 * @aka L.SVG 17660 * 17661 * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG). 17662 * Inherits `Renderer`. 17663 * 17664 * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not 17665 * available in all web browsers, notably Android 2.x and 3.x. 17666 * 17667 * Although SVG is not available on IE7 and IE8, these browsers support 17668 * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language) 17669 * (a now deprecated technology), and the SVG renderer will fall back to VML in 17670 * this case. 17671 * 17672 * @example 17673 * 17674 * Use SVG by default for all paths in the map: 17675 * 17676 * ```js 17677 * var map = L.map('map', { 17678 * renderer: L.svg() 17679 * }); 17680 * ``` 17681 * 17682 * Use a SVG renderer with extra padding for specific vector geometries: 17683 * 17684 * ```js 17685 * var map = L.map('map'); 17686 * var myRenderer = L.svg({ padding: 0.5 }); 17687 * var line = L.polyline( coordinates, { renderer: myRenderer } ); 17688 * var circle = L.circle( center, { renderer: myRenderer } ); 17689 * ``` 17690 */ 17691 17692var SVG = Renderer.extend({ 17693 17694 getEvents: function () { 17695 var events = Renderer.prototype.getEvents.call(this); 17696 events.zoomstart = this._onZoomStart; 17697 return events; 17698 }, 17699 17700 _initContainer: function () { 17701 this._container = create$2('svg'); 17702 17703 // makes it possible to click through svg root; we'll reset it back in individual paths 17704 this._container.setAttribute('pointer-events', 'none'); 17705 17706 this._rootGroup = create$2('g'); 17707 this._container.appendChild(this._rootGroup); 17708 }, 17709 17710 _destroyContainer: function () { 17711 remove(this._container); 17712 off(this._container); 17713 delete this._container; 17714 delete this._rootGroup; 17715 delete this._svgSize; 17716 }, 17717 17718 _onZoomStart: function () { 17719 // Drag-then-pinch interactions might mess up the center and zoom. 17720 // In this case, the easiest way to prevent this is re-do the renderer 17721 // bounds and padding when the zooming starts. 17722 this._update(); 17723 }, 17724 17725 _update: function () { 17726 if (this._map._animatingZoom && this._bounds) { return; } 17727 17728 Renderer.prototype._update.call(this); 17729 17730 var b = this._bounds, 17731 size = b.getSize(), 17732 container = this._container; 17733 17734 // set size of svg-container if changed 17735 if (!this._svgSize || !this._svgSize.equals(size)) { 17736 this._svgSize = size; 17737 container.setAttribute('width', size.x); 17738 container.setAttribute('height', size.y); 17739 } 17740 17741 // movement: update container viewBox so that we don't have to change coordinates of individual layers 17742 setPosition(container, b.min); 17743 container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' ')); 17744 17745 this.fire('update'); 17746 }, 17747 17748 // methods below are called by vector layers implementations 17749 17750 _initPath: function (layer) { 17751 var path = layer._path = create$2('path'); 17752 17753 // @namespace Path 17754 // @option className: String = null 17755 // Custom class name set on an element. Only for SVG renderer. 17756 if (layer.options.className) { 17757 addClass(path, layer.options.className); 17758 } 17759 17760 if (layer.options.interactive) { 17761 addClass(path, 'leaflet-interactive'); 17762 } 17763 17764 this._updateStyle(layer); 17765 this._layers[stamp(layer)] = layer; 17766 }, 17767 17768 _addPath: function (layer) { 17769 if (!this._rootGroup) { this._initContainer(); } 17770 this._rootGroup.appendChild(layer._path); 17771 layer.addInteractiveTarget(layer._path); 17772 }, 17773 17774 _removePath: function (layer) { 17775 remove(layer._path); 17776 layer.removeInteractiveTarget(layer._path); 17777 delete this._layers[stamp(layer)]; 17778 }, 17779 17780 _updatePath: function (layer) { 17781 layer._project(); 17782 layer._update(); 17783 }, 17784 17785 _updateStyle: function (layer) { 17786 var path = layer._path, 17787 options = layer.options; 17788 17789 if (!path) { return; } 17790 17791 if (options.stroke) { 17792 path.setAttribute('stroke', options.color); 17793 path.setAttribute('stroke-opacity', options.opacity); 17794 path.setAttribute('stroke-width', options.weight); 17795 path.setAttribute('stroke-linecap', options.lineCap); 17796 path.setAttribute('stroke-linejoin', options.lineJoin); 17797 17798 if (options.dashArray) { 17799 path.setAttribute('stroke-dasharray', options.dashArray); 17800 } else { 17801 path.removeAttribute('stroke-dasharray'); 17802 } 17803 17804 if (options.dashOffset) { 17805 path.setAttribute('stroke-dashoffset', options.dashOffset); 17806 } else { 17807 path.removeAttribute('stroke-dashoffset'); 17808 } 17809 } else { 17810 path.setAttribute('stroke', 'none'); 17811 } 17812 17813 if (options.fill) { 17814 path.setAttribute('fill', options.fillColor || options.color); 17815 path.setAttribute('fill-opacity', options.fillOpacity); 17816 path.setAttribute('fill-rule', options.fillRule || 'evenodd'); 17817 } else { 17818 path.setAttribute('fill', 'none'); 17819 } 17820 }, 17821 17822 _updatePoly: function (layer, closed) { 17823 this._setPath(layer, pointsToPath(layer._parts, closed)); 17824 }, 17825 17826 _updateCircle: function (layer) { 17827 var p = layer._point, 17828 r = Math.max(Math.round(layer._radius), 1), 17829 r2 = Math.max(Math.round(layer._radiusY), 1) || r, 17830 arc = 'a' + r + ',' + r2 + ' 0 1,0 '; 17831 17832 // drawing a circle with two half-arcs 17833 var d = layer._empty() ? 'M0 0' : 17834 'M' + (p.x - r) + ',' + p.y + 17835 arc + (r * 2) + ',0 ' + 17836 arc + (-r * 2) + ',0 '; 17837 17838 this._setPath(layer, d); 17839 }, 17840 17841 _setPath: function (layer, path) { 17842 layer._path.setAttribute('d', path); 17843 }, 17844 17845 // SVG does not have the concept of zIndex so we resort to changing the DOM order of elements 17846 _bringToFront: function (layer) { 17847 toFront(layer._path); 17848 }, 17849 17850 _bringToBack: function (layer) { 17851 toBack(layer._path); 17852 } 17853}); 17854 17855if (vml) { 17856 SVG.include(vmlMixin); 17857} 17858 17859// @namespace SVG 17860// @factory L.svg(options?: Renderer options) 17861// Creates a SVG renderer with the given options. 17862function svg$1(options) { 17863 return svg || vml ? new SVG(options) : null; 17864} 17865 17866Map.include({ 17867 // @namespace Map; @method getRenderer(layer: Path): Renderer 17868 // Returns the instance of `Renderer` that should be used to render the given 17869 // `Path`. It will ensure that the `renderer` options of the map and paths 17870 // are respected, and that the renderers do exist on the map. 17871 getRenderer: function (layer) { 17872 // @namespace Path; @option renderer: Renderer 17873 // Use this specific instance of `Renderer` for this path. Takes 17874 // precedence over the map's [default renderer](#map-renderer). 17875 var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer; 17876 17877 if (!renderer) { 17878 renderer = this._renderer = this._createRenderer(); 17879 } 17880 17881 if (!this.hasLayer(renderer)) { 17882 this.addLayer(renderer); 17883 } 17884 return renderer; 17885 }, 17886 17887 _getPaneRenderer: function (name) { 17888 if (name === 'overlayPane' || name === undefined) { 17889 return false; 17890 } 17891 17892 var renderer = this._paneRenderers[name]; 17893 if (renderer === undefined) { 17894 renderer = this._createRenderer({pane: name}); 17895 this._paneRenderers[name] = renderer; 17896 } 17897 return renderer; 17898 }, 17899 17900 _createRenderer: function (options) { 17901 // @namespace Map; @option preferCanvas: Boolean = false 17902 // Whether `Path`s should be rendered on a `Canvas` renderer. 17903 // By default, all `Path`s are rendered in a `SVG` renderer. 17904 return (this.options.preferCanvas && canvas$1(options)) || svg$1(options); 17905 } 17906}); 17907 17908/* 17909 * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object. 17910 */ 17911 17912/* 17913 * @class Rectangle 17914 * @aka L.Rectangle 17915 * @inherits Polygon 17916 * 17917 * A class for drawing rectangle overlays on a map. Extends `Polygon`. 17918 * 17919 * @example 17920 * 17921 * ```js 17922 * // define rectangle geographical bounds 17923 * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]]; 17924 * 17925 * // create an orange rectangle 17926 * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map); 17927 * 17928 * // zoom the map to the rectangle bounds 17929 * map.fitBounds(bounds); 17930 * ``` 17931 * 17932 */ 17933 17934 17935var Rectangle = Polygon.extend({ 17936 initialize: function (latLngBounds, options) { 17937 Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options); 17938 }, 17939 17940 // @method setBounds(latLngBounds: LatLngBounds): this 17941 // Redraws the rectangle with the passed bounds. 17942 setBounds: function (latLngBounds) { 17943 return this.setLatLngs(this._boundsToLatLngs(latLngBounds)); 17944 }, 17945 17946 _boundsToLatLngs: function (latLngBounds) { 17947 latLngBounds = toLatLngBounds(latLngBounds); 17948 return [ 17949 latLngBounds.getSouthWest(), 17950 latLngBounds.getNorthWest(), 17951 latLngBounds.getNorthEast(), 17952 latLngBounds.getSouthEast() 17953 ]; 17954 } 17955}); 17956 17957 17958// @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options) 17959function rectangle(latLngBounds, options) { 17960 return new Rectangle(latLngBounds, options); 17961} 17962 17963SVG.create = create$2; 17964SVG.pointsToPath = pointsToPath; 17965 17966GeoJSON.geometryToLayer = geometryToLayer; 17967GeoJSON.coordsToLatLng = coordsToLatLng; 17968GeoJSON.coordsToLatLngs = coordsToLatLngs; 17969GeoJSON.latLngToCoords = latLngToCoords; 17970GeoJSON.latLngsToCoords = latLngsToCoords; 17971GeoJSON.getFeature = getFeature; 17972GeoJSON.asFeature = asFeature; 17973 17974/* 17975 * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map 17976 * (zoom to a selected bounding box), enabled by default. 17977 */ 17978 17979// @namespace Map 17980// @section Interaction Options 17981Map.mergeOptions({ 17982 // @option boxZoom: Boolean = true 17983 // Whether the map can be zoomed to a rectangular area specified by 17984 // dragging the mouse while pressing the shift key. 17985 boxZoom: true 17986}); 17987 17988var BoxZoom = Handler.extend({ 17989 initialize: function (map) { 17990 this._map = map; 17991 this._container = map._container; 17992 this._pane = map._panes.overlayPane; 17993 this._resetStateTimeout = 0; 17994 map.on('unload', this._destroy, this); 17995 }, 17996 17997 addHooks: function () { 17998 on(this._container, 'mousedown', this._onMouseDown, this); 17999 }, 18000 18001 removeHooks: function () { 18002 off(this._container, 'mousedown', this._onMouseDown, this); 18003 }, 18004 18005 moved: function () { 18006 return this._moved; 18007 }, 18008 18009 _destroy: function () { 18010 remove(this._pane); 18011 delete this._pane; 18012 }, 18013 18014 _resetState: function () { 18015 this._resetStateTimeout = 0; 18016 this._moved = false; 18017 }, 18018 18019 _clearDeferredResetState: function () { 18020 if (this._resetStateTimeout !== 0) { 18021 clearTimeout(this._resetStateTimeout); 18022 this._resetStateTimeout = 0; 18023 } 18024 }, 18025 18026 _onMouseDown: function (e) { 18027 if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; } 18028 18029 // Clear the deferred resetState if it hasn't executed yet, otherwise it 18030 // will interrupt the interaction and orphan a box element in the container. 18031 this._clearDeferredResetState(); 18032 this._resetState(); 18033 18034 disableTextSelection(); 18035 disableImageDrag(); 18036 18037 this._startPoint = this._map.mouseEventToContainerPoint(e); 18038 18039 on(document, { 18040 contextmenu: stop, 18041 mousemove: this._onMouseMove, 18042 mouseup: this._onMouseUp, 18043 keydown: this._onKeyDown 18044 }, this); 18045 }, 18046 18047 _onMouseMove: function (e) { 18048 if (!this._moved) { 18049 this._moved = true; 18050 18051 this._box = create$1('div', 'leaflet-zoom-box', this._container); 18052 addClass(this._container, 'leaflet-crosshair'); 18053 18054 this._map.fire('boxzoomstart'); 18055 } 18056 18057 this._point = this._map.mouseEventToContainerPoint(e); 18058 18059 var bounds = new Bounds(this._point, this._startPoint), 18060 size = bounds.getSize(); 18061 18062 setPosition(this._box, bounds.min); 18063 18064 this._box.style.width = size.x + 'px'; 18065 this._box.style.height = size.y + 'px'; 18066 }, 18067 18068 _finish: function () { 18069 if (this._moved) { 18070 remove(this._box); 18071 removeClass(this._container, 'leaflet-crosshair'); 18072 } 18073 18074 enableTextSelection(); 18075 enableImageDrag(); 18076 18077 off(document, { 18078 contextmenu: stop, 18079 mousemove: this._onMouseMove, 18080 mouseup: this._onMouseUp, 18081 keydown: this._onKeyDown 18082 }, this); 18083 }, 18084 18085 _onMouseUp: function (e) { 18086 if ((e.which !== 1) && (e.button !== 1)) { return; } 18087 18088 this._finish(); 18089 18090 if (!this._moved) { return; } 18091 // Postpone to next JS tick so internal click event handling 18092 // still see it as "moved". 18093 this._clearDeferredResetState(); 18094 this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0); 18095 18096 var bounds = new LatLngBounds( 18097 this._map.containerPointToLatLng(this._startPoint), 18098 this._map.containerPointToLatLng(this._point)); 18099 18100 this._map 18101 .fitBounds(bounds) 18102 .fire('boxzoomend', {boxZoomBounds: bounds}); 18103 }, 18104 18105 _onKeyDown: function (e) { 18106 if (e.keyCode === 27) { 18107 this._finish(); 18108 } 18109 } 18110}); 18111 18112// @section Handlers 18113// @property boxZoom: Handler 18114// Box (shift-drag with mouse) zoom handler. 18115Map.addInitHook('addHandler', 'boxZoom', BoxZoom); 18116 18117/* 18118 * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default. 18119 */ 18120 18121// @namespace Map 18122// @section Interaction Options 18123 18124Map.mergeOptions({ 18125 // @option doubleClickZoom: Boolean|String = true 18126 // Whether the map can be zoomed in by double clicking on it and 18127 // zoomed out by double clicking while holding shift. If passed 18128 // `'center'`, double-click zoom will zoom to the center of the 18129 // view regardless of where the mouse was. 18130 doubleClickZoom: true 18131}); 18132 18133var DoubleClickZoom = Handler.extend({ 18134 addHooks: function () { 18135 this._map.on('dblclick', this._onDoubleClick, this); 18136 }, 18137 18138 removeHooks: function () { 18139 this._map.off('dblclick', this._onDoubleClick, this); 18140 }, 18141 18142 _onDoubleClick: function (e) { 18143 var map = this._map, 18144 oldZoom = map.getZoom(), 18145 delta = map.options.zoomDelta, 18146 zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta; 18147 18148 if (map.options.doubleClickZoom === 'center') { 18149 map.setZoom(zoom); 18150 } else { 18151 map.setZoomAround(e.containerPoint, zoom); 18152 } 18153 } 18154}); 18155 18156// @section Handlers 18157// 18158// Map properties include interaction handlers that allow you to control 18159// interaction behavior in runtime, enabling or disabling certain features such 18160// as dragging or touch zoom (see `Handler` methods). For example: 18161// 18162// ```js 18163// map.doubleClickZoom.disable(); 18164// ``` 18165// 18166// @property doubleClickZoom: Handler 18167// Double click zoom handler. 18168Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom); 18169 18170/* 18171 * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default. 18172 */ 18173 18174// @namespace Map 18175// @section Interaction Options 18176Map.mergeOptions({ 18177 // @option dragging: Boolean = true 18178 // Whether the map be draggable with mouse/touch or not. 18179 dragging: true, 18180 18181 // @section Panning Inertia Options 18182 // @option inertia: Boolean = * 18183 // If enabled, panning of the map will have an inertia effect where 18184 // the map builds momentum while dragging and continues moving in 18185 // the same direction for some time. Feels especially nice on touch 18186 // devices. Enabled by default unless running on old Android devices. 18187 inertia: !android23, 18188 18189 // @option inertiaDeceleration: Number = 3000 18190 // The rate with which the inertial movement slows down, in pixels/second². 18191 inertiaDeceleration: 3400, // px/s^2 18192 18193 // @option inertiaMaxSpeed: Number = Infinity 18194 // Max speed of the inertial movement, in pixels/second. 18195 inertiaMaxSpeed: Infinity, // px/s 18196 18197 // @option easeLinearity: Number = 0.2 18198 easeLinearity: 0.2, 18199 18200 // TODO refactor, move to CRS 18201 // @option worldCopyJump: Boolean = false 18202 // With this option enabled, the map tracks when you pan to another "copy" 18203 // of the world and seamlessly jumps to the original one so that all overlays 18204 // like markers and vector layers are still visible. 18205 worldCopyJump: false, 18206 18207 // @option maxBoundsViscosity: Number = 0.0 18208 // If `maxBounds` is set, this option will control how solid the bounds 18209 // are when dragging the map around. The default value of `0.0` allows the 18210 // user to drag outside the bounds at normal speed, higher values will 18211 // slow down map dragging outside bounds, and `1.0` makes the bounds fully 18212 // solid, preventing the user from dragging outside the bounds. 18213 maxBoundsViscosity: 0.0 18214}); 18215 18216var Drag = Handler.extend({ 18217 addHooks: function () { 18218 if (!this._draggable) { 18219 var map = this._map; 18220 18221 this._draggable = new Draggable(map._mapPane, map._container); 18222 18223 this._draggable.on({ 18224 dragstart: this._onDragStart, 18225 drag: this._onDrag, 18226 dragend: this._onDragEnd 18227 }, this); 18228 18229 this._draggable.on('predrag', this._onPreDragLimit, this); 18230 if (map.options.worldCopyJump) { 18231 this._draggable.on('predrag', this._onPreDragWrap, this); 18232 map.on('zoomend', this._onZoomEnd, this); 18233 18234 map.whenReady(this._onZoomEnd, this); 18235 } 18236 } 18237 addClass(this._map._container, 'leaflet-grab leaflet-touch-drag'); 18238 this._draggable.enable(); 18239 this._positions = []; 18240 this._times = []; 18241 }, 18242 18243 removeHooks: function () { 18244 removeClass(this._map._container, 'leaflet-grab'); 18245 removeClass(this._map._container, 'leaflet-touch-drag'); 18246 this._draggable.disable(); 18247 }, 18248 18249 moved: function () { 18250 return this._draggable && this._draggable._moved; 18251 }, 18252 18253 moving: function () { 18254 return this._draggable && this._draggable._moving; 18255 }, 18256 18257 _onDragStart: function () { 18258 var map = this._map; 18259 18260 map._stop(); 18261 if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) { 18262 var bounds = toLatLngBounds(this._map.options.maxBounds); 18263 18264 this._offsetLimit = toBounds( 18265 this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1), 18266 this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1) 18267 .add(this._map.getSize())); 18268 18269 this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity)); 18270 } else { 18271 this._offsetLimit = null; 18272 } 18273 18274 map 18275 .fire('movestart') 18276 .fire('dragstart'); 18277 18278 if (map.options.inertia) { 18279 this._positions = []; 18280 this._times = []; 18281 } 18282 }, 18283 18284 _onDrag: function (e) { 18285 if (this._map.options.inertia) { 18286 var time = this._lastTime = +new Date(), 18287 pos = this._lastPos = this._draggable._absPos || this._draggable._newPos; 18288 18289 this._positions.push(pos); 18290 this._times.push(time); 18291 18292 this._prunePositions(time); 18293 } 18294 18295 this._map 18296 .fire('move', e) 18297 .fire('drag', e); 18298 }, 18299 18300 _prunePositions: function (time) { 18301 while (this._positions.length > 1 && time - this._times[0] > 50) { 18302 this._positions.shift(); 18303 this._times.shift(); 18304 } 18305 }, 18306 18307 _onZoomEnd: function () { 18308 var pxCenter = this._map.getSize().divideBy(2), 18309 pxWorldCenter = this._map.latLngToLayerPoint([0, 0]); 18310 18311 this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x; 18312 this._worldWidth = this._map.getPixelWorldBounds().getSize().x; 18313 }, 18314 18315 _viscousLimit: function (value, threshold) { 18316 return value - (value - threshold) * this._viscosity; 18317 }, 18318 18319 _onPreDragLimit: function () { 18320 if (!this._viscosity || !this._offsetLimit) { return; } 18321 18322 var offset = this._draggable._newPos.subtract(this._draggable._startPos); 18323 18324 var limit = this._offsetLimit; 18325 if (offset.x < limit.min.x) { offset.x = this._viscousLimit(offset.x, limit.min.x); } 18326 if (offset.y < limit.min.y) { offset.y = this._viscousLimit(offset.y, limit.min.y); } 18327 if (offset.x > limit.max.x) { offset.x = this._viscousLimit(offset.x, limit.max.x); } 18328 if (offset.y > limit.max.y) { offset.y = this._viscousLimit(offset.y, limit.max.y); } 18329 18330 this._draggable._newPos = this._draggable._startPos.add(offset); 18331 }, 18332 18333 _onPreDragWrap: function () { 18334 // TODO refactor to be able to adjust map pane position after zoom 18335 var worldWidth = this._worldWidth, 18336 halfWidth = Math.round(worldWidth / 2), 18337 dx = this._initialWorldOffset, 18338 x = this._draggable._newPos.x, 18339 newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx, 18340 newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx, 18341 newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2; 18342 18343 this._draggable._absPos = this._draggable._newPos.clone(); 18344 this._draggable._newPos.x = newX; 18345 }, 18346 18347 _onDragEnd: function (e) { 18348 var map = this._map, 18349 options = map.options, 18350 18351 noInertia = !options.inertia || this._times.length < 2; 18352 18353 map.fire('dragend', e); 18354 18355 if (noInertia) { 18356 map.fire('moveend'); 18357 18358 } else { 18359 this._prunePositions(+new Date()); 18360 18361 var direction = this._lastPos.subtract(this._positions[0]), 18362 duration = (this._lastTime - this._times[0]) / 1000, 18363 ease = options.easeLinearity, 18364 18365 speedVector = direction.multiplyBy(ease / duration), 18366 speed = speedVector.distanceTo([0, 0]), 18367 18368 limitedSpeed = Math.min(options.inertiaMaxSpeed, speed), 18369 limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed), 18370 18371 decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease), 18372 offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round(); 18373 18374 if (!offset.x && !offset.y) { 18375 map.fire('moveend'); 18376 18377 } else { 18378 offset = map._limitOffset(offset, map.options.maxBounds); 18379 18380 requestAnimFrame(function () { 18381 map.panBy(offset, { 18382 duration: decelerationDuration, 18383 easeLinearity: ease, 18384 noMoveStart: true, 18385 animate: true 18386 }); 18387 }); 18388 } 18389 } 18390 } 18391}); 18392 18393// @section Handlers 18394// @property dragging: Handler 18395// Map dragging handler (by both mouse and touch). 18396Map.addInitHook('addHandler', 'dragging', Drag); 18397 18398/* 18399 * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default. 18400 */ 18401 18402// @namespace Map 18403// @section Keyboard Navigation Options 18404Map.mergeOptions({ 18405 // @option keyboard: Boolean = true 18406 // Makes the map focusable and allows users to navigate the map with keyboard 18407 // arrows and `+`/`-` keys. 18408 keyboard: true, 18409 18410 // @option keyboardPanDelta: Number = 80 18411 // Amount of pixels to pan when pressing an arrow key. 18412 keyboardPanDelta: 80 18413}); 18414 18415var Keyboard = Handler.extend({ 18416 18417 keyCodes: { 18418 left: [37], 18419 right: [39], 18420 down: [40], 18421 up: [38], 18422 zoomIn: [187, 107, 61, 171], 18423 zoomOut: [189, 109, 54, 173] 18424 }, 18425 18426 initialize: function (map) { 18427 this._map = map; 18428 18429 this._setPanDelta(map.options.keyboardPanDelta); 18430 this._setZoomDelta(map.options.zoomDelta); 18431 }, 18432 18433 addHooks: function () { 18434 var container = this._map._container; 18435 18436 // make the container focusable by tabbing 18437 if (container.tabIndex <= 0) { 18438 container.tabIndex = '0'; 18439 } 18440 18441 on(container, { 18442 focus: this._onFocus, 18443 blur: this._onBlur, 18444 mousedown: this._onMouseDown 18445 }, this); 18446 18447 this._map.on({ 18448 focus: this._addHooks, 18449 blur: this._removeHooks 18450 }, this); 18451 }, 18452 18453 removeHooks: function () { 18454 this._removeHooks(); 18455 18456 off(this._map._container, { 18457 focus: this._onFocus, 18458 blur: this._onBlur, 18459 mousedown: this._onMouseDown 18460 }, this); 18461 18462 this._map.off({ 18463 focus: this._addHooks, 18464 blur: this._removeHooks 18465 }, this); 18466 }, 18467 18468 _onMouseDown: function () { 18469 if (this._focused) { return; } 18470 18471 var body = document.body, 18472 docEl = document.documentElement, 18473 top = body.scrollTop || docEl.scrollTop, 18474 left = body.scrollLeft || docEl.scrollLeft; 18475 18476 this._map._container.focus(); 18477 18478 window.scrollTo(left, top); 18479 }, 18480 18481 _onFocus: function () { 18482 this._focused = true; 18483 this._map.fire('focus'); 18484 }, 18485 18486 _onBlur: function () { 18487 this._focused = false; 18488 this._map.fire('blur'); 18489 }, 18490 18491 _setPanDelta: function (panDelta) { 18492 var keys = this._panKeys = {}, 18493 codes = this.keyCodes, 18494 i, len; 18495 18496 for (i = 0, len = codes.left.length; i < len; i++) { 18497 keys[codes.left[i]] = [-1 * panDelta, 0]; 18498 } 18499 for (i = 0, len = codes.right.length; i < len; i++) { 18500 keys[codes.right[i]] = [panDelta, 0]; 18501 } 18502 for (i = 0, len = codes.down.length; i < len; i++) { 18503 keys[codes.down[i]] = [0, panDelta]; 18504 } 18505 for (i = 0, len = codes.up.length; i < len; i++) { 18506 keys[codes.up[i]] = [0, -1 * panDelta]; 18507 } 18508 }, 18509 18510 _setZoomDelta: function (zoomDelta) { 18511 var keys = this._zoomKeys = {}, 18512 codes = this.keyCodes, 18513 i, len; 18514 18515 for (i = 0, len = codes.zoomIn.length; i < len; i++) { 18516 keys[codes.zoomIn[i]] = zoomDelta; 18517 } 18518 for (i = 0, len = codes.zoomOut.length; i < len; i++) { 18519 keys[codes.zoomOut[i]] = -zoomDelta; 18520 } 18521 }, 18522 18523 _addHooks: function () { 18524 on(document, 'keydown', this._onKeyDown, this); 18525 }, 18526 18527 _removeHooks: function () { 18528 off(document, 'keydown', this._onKeyDown, this); 18529 }, 18530 18531 _onKeyDown: function (e) { 18532 if (e.altKey || e.ctrlKey || e.metaKey) { return; } 18533 18534 var key = e.keyCode, 18535 map = this._map, 18536 offset; 18537 18538 if (key in this._panKeys) { 18539 if (!map._panAnim || !map._panAnim._inProgress) { 18540 offset = this._panKeys[key]; 18541 if (e.shiftKey) { 18542 offset = toPoint(offset).multiplyBy(3); 18543 } 18544 18545 map.panBy(offset); 18546 18547 if (map.options.maxBounds) { 18548 map.panInsideBounds(map.options.maxBounds); 18549 } 18550 } 18551 } else if (key in this._zoomKeys) { 18552 map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]); 18553 18554 } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) { 18555 map.closePopup(); 18556 18557 } else { 18558 return; 18559 } 18560 18561 stop(e); 18562 } 18563}); 18564 18565// @section Handlers 18566// @section Handlers 18567// @property keyboard: Handler 18568// Keyboard navigation handler. 18569Map.addInitHook('addHandler', 'keyboard', Keyboard); 18570 18571/* 18572 * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map. 18573 */ 18574 18575// @namespace Map 18576// @section Interaction Options 18577Map.mergeOptions({ 18578 // @section Mousewheel options 18579 // @option scrollWheelZoom: Boolean|String = true 18580 // Whether the map can be zoomed by using the mouse wheel. If passed `'center'`, 18581 // it will zoom to the center of the view regardless of where the mouse was. 18582 scrollWheelZoom: true, 18583 18584 // @option wheelDebounceTime: Number = 40 18585 // Limits the rate at which a wheel can fire (in milliseconds). By default 18586 // user can't zoom via wheel more often than once per 40 ms. 18587 wheelDebounceTime: 40, 18588 18589 // @option wheelPxPerZoomLevel: Number = 60 18590 // How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta)) 18591 // mean a change of one full zoom level. Smaller values will make wheel-zooming 18592 // faster (and vice versa). 18593 wheelPxPerZoomLevel: 60 18594}); 18595 18596var ScrollWheelZoom = Handler.extend({ 18597 addHooks: function () { 18598 on(this._map._container, 'mousewheel', this._onWheelScroll, this); 18599 18600 this._delta = 0; 18601 }, 18602 18603 removeHooks: function () { 18604 off(this._map._container, 'mousewheel', this._onWheelScroll, this); 18605 }, 18606 18607 _onWheelScroll: function (e) { 18608 var delta = getWheelDelta(e); 18609 18610 var debounce = this._map.options.wheelDebounceTime; 18611 18612 this._delta += delta; 18613 this._lastMousePos = this._map.mouseEventToContainerPoint(e); 18614 18615 if (!this._startTime) { 18616 this._startTime = +new Date(); 18617 } 18618 18619 var left = Math.max(debounce - (+new Date() - this._startTime), 0); 18620 18621 clearTimeout(this._timer); 18622 this._timer = setTimeout(bind(this._performZoom, this), left); 18623 18624 stop(e); 18625 }, 18626 18627 _performZoom: function () { 18628 var map = this._map, 18629 zoom = map.getZoom(), 18630 snap = this._map.options.zoomSnap || 0; 18631 18632 map._stop(); // stop panning and fly animations if any 18633 18634 // map the delta with a sigmoid function to -4..4 range leaning on -1..1 18635 var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4), 18636 d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2, 18637 d4 = snap ? Math.ceil(d3 / snap) * snap : d3, 18638 delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom; 18639 18640 this._delta = 0; 18641 this._startTime = null; 18642 18643 if (!delta) { return; } 18644 18645 if (map.options.scrollWheelZoom === 'center') { 18646 map.setZoom(zoom + delta); 18647 } else { 18648 map.setZoomAround(this._lastMousePos, zoom + delta); 18649 } 18650 } 18651}); 18652 18653// @section Handlers 18654// @property scrollWheelZoom: Handler 18655// Scroll wheel zoom handler. 18656Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom); 18657 18658/* 18659 * L.Map.Tap is used to enable mobile hacks like quick taps and long hold. 18660 */ 18661 18662// @namespace Map 18663// @section Interaction Options 18664Map.mergeOptions({ 18665 // @section Touch interaction options 18666 // @option tap: Boolean = true 18667 // Enables mobile hacks for supporting instant taps (fixing 200ms click 18668 // delay on iOS/Android) and touch holds (fired as `contextmenu` events). 18669 tap: true, 18670 18671 // @option tapTolerance: Number = 15 18672 // The max number of pixels a user can shift his finger during touch 18673 // for it to be considered a valid tap. 18674 tapTolerance: 15 18675}); 18676 18677var Tap = Handler.extend({ 18678 addHooks: function () { 18679 on(this._map._container, 'touchstart', this._onDown, this); 18680 }, 18681 18682 removeHooks: function () { 18683 off(this._map._container, 'touchstart', this._onDown, this); 18684 }, 18685 18686 _onDown: function (e) { 18687 if (!e.touches) { return; } 18688 18689 preventDefault(e); 18690 18691 this._fireClick = true; 18692 18693 // don't simulate click or track longpress if more than 1 touch 18694 if (e.touches.length > 1) { 18695 this._fireClick = false; 18696 clearTimeout(this._holdTimeout); 18697 return; 18698 } 18699 18700 var first = e.touches[0], 18701 el = first.target; 18702 18703 this._startPos = this._newPos = new Point(first.clientX, first.clientY); 18704 18705 // if touching a link, highlight it 18706 if (el.tagName && el.tagName.toLowerCase() === 'a') { 18707 addClass(el, 'leaflet-active'); 18708 } 18709 18710 // simulate long hold but setting a timeout 18711 this._holdTimeout = setTimeout(bind(function () { 18712 if (this._isTapValid()) { 18713 this._fireClick = false; 18714 this._onUp(); 18715 this._simulateEvent('contextmenu', first); 18716 } 18717 }, this), 1000); 18718 18719 this._simulateEvent('mousedown', first); 18720 18721 on(document, { 18722 touchmove: this._onMove, 18723 touchend: this._onUp 18724 }, this); 18725 }, 18726 18727 _onUp: function (e) { 18728 clearTimeout(this._holdTimeout); 18729 18730 off(document, { 18731 touchmove: this._onMove, 18732 touchend: this._onUp 18733 }, this); 18734 18735 if (this._fireClick && e && e.changedTouches) { 18736 18737 var first = e.changedTouches[0], 18738 el = first.target; 18739 18740 if (el && el.tagName && el.tagName.toLowerCase() === 'a') { 18741 removeClass(el, 'leaflet-active'); 18742 } 18743 18744 this._simulateEvent('mouseup', first); 18745 18746 // simulate click if the touch didn't move too much 18747 if (this._isTapValid()) { 18748 this._simulateEvent('click', first); 18749 } 18750 } 18751 }, 18752 18753 _isTapValid: function () { 18754 return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance; 18755 }, 18756 18757 _onMove: function (e) { 18758 var first = e.touches[0]; 18759 this._newPos = new Point(first.clientX, first.clientY); 18760 this._simulateEvent('mousemove', first); 18761 }, 18762 18763 _simulateEvent: function (type, e) { 18764 var simulatedEvent = document.createEvent('MouseEvents'); 18765 18766 simulatedEvent._simulated = true; 18767 e.target._simulatedClick = true; 18768 18769 simulatedEvent.initMouseEvent( 18770 type, true, true, window, 1, 18771 e.screenX, e.screenY, 18772 e.clientX, e.clientY, 18773 false, false, false, false, 0, null); 18774 18775 e.target.dispatchEvent(simulatedEvent); 18776 } 18777}); 18778 18779// @section Handlers 18780// @property tap: Handler 18781// Mobile touch hacks (quick tap and touch hold) handler. 18782if (touch && !pointer) { 18783 Map.addInitHook('addHandler', 'tap', Tap); 18784} 18785 18786/* 18787 * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers. 18788 */ 18789 18790// @namespace Map 18791// @section Interaction Options 18792Map.mergeOptions({ 18793 // @section Touch interaction options 18794 // @option touchZoom: Boolean|String = * 18795 // Whether the map can be zoomed by touch-dragging with two fingers. If 18796 // passed `'center'`, it will zoom to the center of the view regardless of 18797 // where the touch events (fingers) were. Enabled for touch-capable web 18798 // browsers except for old Androids. 18799 touchZoom: touch && !android23, 18800 18801 // @option bounceAtZoomLimits: Boolean = true 18802 // Set it to false if you don't want the map to zoom beyond min/max zoom 18803 // and then bounce back when pinch-zooming. 18804 bounceAtZoomLimits: true 18805}); 18806 18807var TouchZoom = Handler.extend({ 18808 addHooks: function () { 18809 addClass(this._map._container, 'leaflet-touch-zoom'); 18810 on(this._map._container, 'touchstart', this._onTouchStart, this); 18811 }, 18812 18813 removeHooks: function () { 18814 removeClass(this._map._container, 'leaflet-touch-zoom'); 18815 off(this._map._container, 'touchstart', this._onTouchStart, this); 18816 }, 18817 18818 _onTouchStart: function (e) { 18819 var map = this._map; 18820 if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; } 18821 18822 var p1 = map.mouseEventToContainerPoint(e.touches[0]), 18823 p2 = map.mouseEventToContainerPoint(e.touches[1]); 18824 18825 this._centerPoint = map.getSize()._divideBy(2); 18826 this._startLatLng = map.containerPointToLatLng(this._centerPoint); 18827 if (map.options.touchZoom !== 'center') { 18828 this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2)); 18829 } 18830 18831 this._startDist = p1.distanceTo(p2); 18832 this._startZoom = map.getZoom(); 18833 18834 this._moved = false; 18835 this._zooming = true; 18836 18837 map._stop(); 18838 18839 on(document, 'touchmove', this._onTouchMove, this); 18840 on(document, 'touchend', this._onTouchEnd, this); 18841 18842 preventDefault(e); 18843 }, 18844 18845 _onTouchMove: function (e) { 18846 if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; } 18847 18848 var map = this._map, 18849 p1 = map.mouseEventToContainerPoint(e.touches[0]), 18850 p2 = map.mouseEventToContainerPoint(e.touches[1]), 18851 scale = p1.distanceTo(p2) / this._startDist; 18852 18853 this._zoom = map.getScaleZoom(scale, this._startZoom); 18854 18855 if (!map.options.bounceAtZoomLimits && ( 18856 (this._zoom < map.getMinZoom() && scale < 1) || 18857 (this._zoom > map.getMaxZoom() && scale > 1))) { 18858 this._zoom = map._limitZoom(this._zoom); 18859 } 18860 18861 if (map.options.touchZoom === 'center') { 18862 this._center = this._startLatLng; 18863 if (scale === 1) { return; } 18864 } else { 18865 // Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng 18866 var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint); 18867 if (scale === 1 && delta.x === 0 && delta.y === 0) { return; } 18868 this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom); 18869 } 18870 18871 if (!this._moved) { 18872 map._moveStart(true, false); 18873 this._moved = true; 18874 } 18875 18876 cancelAnimFrame(this._animRequest); 18877 18878 var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false}); 18879 this._animRequest = requestAnimFrame(moveFn, this, true); 18880 18881 preventDefault(e); 18882 }, 18883 18884 _onTouchEnd: function () { 18885 if (!this._moved || !this._zooming) { 18886 this._zooming = false; 18887 return; 18888 } 18889 18890 this._zooming = false; 18891 cancelAnimFrame(this._animRequest); 18892 18893 off(document, 'touchmove', this._onTouchMove); 18894 off(document, 'touchend', this._onTouchEnd); 18895 18896 // Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate. 18897 if (this._map.options.zoomAnimation) { 18898 this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap); 18899 } else { 18900 this._map._resetView(this._center, this._map._limitZoom(this._zoom)); 18901 } 18902 } 18903}); 18904 18905// @section Handlers 18906// @property touchZoom: Handler 18907// Touch zoom handler. 18908Map.addInitHook('addHandler', 'touchZoom', TouchZoom); 18909 18910Map.BoxZoom = BoxZoom; 18911Map.DoubleClickZoom = DoubleClickZoom; 18912Map.Drag = Drag; 18913Map.Keyboard = Keyboard; 18914Map.ScrollWheelZoom = ScrollWheelZoom; 18915Map.Tap = Tap; 18916Map.TouchZoom = TouchZoom; 18917 18918Object.freeze = freeze; 18919 18920exports.version = version; 18921exports.Control = Control; 18922exports.control = control; 18923exports.Browser = Browser; 18924exports.Evented = Evented; 18925exports.Mixin = Mixin; 18926exports.Util = Util; 18927exports.Class = Class; 18928exports.Handler = Handler; 18929exports.extend = extend; 18930exports.bind = bind; 18931exports.stamp = stamp; 18932exports.setOptions = setOptions; 18933exports.DomEvent = DomEvent; 18934exports.DomUtil = DomUtil; 18935exports.PosAnimation = PosAnimation; 18936exports.Draggable = Draggable; 18937exports.LineUtil = LineUtil; 18938exports.PolyUtil = PolyUtil; 18939exports.Point = Point; 18940exports.point = toPoint; 18941exports.Bounds = Bounds; 18942exports.bounds = toBounds; 18943exports.Transformation = Transformation; 18944exports.transformation = toTransformation; 18945exports.Projection = index; 18946exports.LatLng = LatLng; 18947exports.latLng = toLatLng; 18948exports.LatLngBounds = LatLngBounds; 18949exports.latLngBounds = toLatLngBounds; 18950exports.CRS = CRS; 18951exports.GeoJSON = GeoJSON; 18952exports.geoJSON = geoJSON; 18953exports.geoJson = geoJson; 18954exports.Layer = Layer; 18955exports.LayerGroup = LayerGroup; 18956exports.layerGroup = layerGroup; 18957exports.FeatureGroup = FeatureGroup; 18958exports.featureGroup = featureGroup; 18959exports.ImageOverlay = ImageOverlay; 18960exports.imageOverlay = imageOverlay; 18961exports.VideoOverlay = VideoOverlay; 18962exports.videoOverlay = videoOverlay; 18963exports.SVGOverlay = SVGOverlay; 18964exports.svgOverlay = svgOverlay; 18965exports.DivOverlay = DivOverlay; 18966exports.Popup = Popup; 18967exports.popup = popup; 18968exports.Tooltip = Tooltip; 18969exports.tooltip = tooltip; 18970exports.Icon = Icon; 18971exports.icon = icon; 18972exports.DivIcon = DivIcon; 18973exports.divIcon = divIcon; 18974exports.Marker = Marker; 18975exports.marker = marker; 18976exports.TileLayer = TileLayer; 18977exports.tileLayer = tileLayer; 18978exports.GridLayer = GridLayer; 18979exports.gridLayer = gridLayer; 18980exports.SVG = SVG; 18981exports.svg = svg$1; 18982exports.Renderer = Renderer; 18983exports.Canvas = Canvas; 18984exports.canvas = canvas$1; 18985exports.Path = Path; 18986exports.CircleMarker = CircleMarker; 18987exports.circleMarker = circleMarker; 18988exports.Circle = Circle; 18989exports.circle = circle; 18990exports.Polyline = Polyline; 18991exports.polyline = polyline; 18992exports.Polygon = Polygon; 18993exports.polygon = polygon; 18994exports.Rectangle = Rectangle; 18995exports.rectangle = rectangle; 18996exports.Map = Map; 18997exports.map = createMap; 18998 18999var oldL = window.L; 19000exports.noConflict = function() { 19001 window.L = oldL; 19002 return this; 19003} 19004 19005// Always export us to window global (see #2364) 19006window.L = exports; 19007 19008}))); 19009//# sourceMappingURL=leaflet-src.js.map 19010 19011 19012/***/ }), 19013
vendor: 541,016 bytes, lines 19014-36129
19014/***/ "./node_modules/lodash/lodash.js": 19015/*!***************************************!*\ 19016 !*** ./node_modules/lodash/lodash.js ***! 19017 \***************************************/ 19018/*! no static exports found */ 19019/***/ (function(module, exports, __webpack_require__) { 19020 19021/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** 19022 * @license 19023 * Lodash <https://lodash.com/> 19024 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 19025 * Released under MIT license <https://lodash.com/license> 19026 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 19027 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 19028 */ 19029;(function() { 19030 19031 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 19032 var undefined; 19033 19034 /** Used as the semantic version number. */ 19035 var VERSION = '4.17.15'; 19036 19037 /** Used as the size to enable large array optimizations. */ 19038 var LARGE_ARRAY_SIZE = 200; 19039 19040 /** Error message constants. */ 19041 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 19042 FUNC_ERROR_TEXT = 'Expected a function'; 19043 19044 /** Used to stand-in for `undefined` hash values. */ 19045 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 19046 19047 /** Used as the maximum memoize cache size. */ 19048 var MAX_MEMOIZE_SIZE = 500; 19049 19050 /** Used as the internal argument placeholder. */ 19051 var PLACEHOLDER = '__lodash_placeholder__'; 19052 19053 /** Used to compose bitmasks for cloning. */ 19054 var CLONE_DEEP_FLAG = 1, 19055 CLONE_FLAT_FLAG = 2, 19056 CLONE_SYMBOLS_FLAG = 4; 19057 19058 /** Used to compose bitmasks for value comparisons. */ 19059 var COMPARE_PARTIAL_FLAG = 1, 19060 COMPARE_UNORDERED_FLAG = 2; 19061 19062 /** Used to compose bitmasks for function metadata. */ 19063 var WRAP_BIND_FLAG = 1, 19064 WRAP_BIND_KEY_FLAG = 2, 19065 WRAP_CURRY_BOUND_FLAG = 4, 19066 WRAP_CURRY_FLAG = 8, 19067 WRAP_CURRY_RIGHT_FLAG = 16, 19068 WRAP_PARTIAL_FLAG = 32, 19069 WRAP_PARTIAL_RIGHT_FLAG = 64, 19070 WRAP_ARY_FLAG = 128, 19071 WRAP_REARG_FLAG = 256, 19072 WRAP_FLIP_FLAG = 512; 19073 19074 /** Used as default options for `_.truncate`. */ 19075 var DEFAULT_TRUNC_LENGTH = 30, 19076 DEFAULT_TRUNC_OMISSION = '...'; 19077 19078 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 19079 var HOT_COUNT = 800, 19080 HOT_SPAN = 16; 19081 19082 /** Used to indicate the type of lazy iteratees. */ 19083 var LAZY_FILTER_FLAG = 1, 19084 LAZY_MAP_FLAG = 2, 19085 LAZY_WHILE_FLAG = 3; 19086 19087 /** Used as references for various `Number` constants. */ 19088 var INFINITY = 1 / 0, 19089 MAX_SAFE_INTEGER = 9007199254740991, 19090 MAX_INTEGER = 1.7976931348623157e+308, 19091 NAN = 0 / 0; 19092 19093 /** Used as references for the maximum length and index of an array. */ 19094 var MAX_ARRAY_LENGTH = 4294967295, 19095 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 19096 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 19097 19098 /** Used to associate wrap methods with their bit flags. */ 19099 var wrapFlags = [ 19100 ['ary', WRAP_ARY_FLAG], 19101 ['bind', WRAP_BIND_FLAG], 19102 ['bindKey', WRAP_BIND_KEY_FLAG], 19103 ['curry', WRAP_CURRY_FLAG], 19104 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 19105 ['flip', WRAP_FLIP_FLAG], 19106 ['partial', WRAP_PARTIAL_FLAG], 19107 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 19108 ['rearg', WRAP_REARG_FLAG] 19109 ]; 19110 19111 /** `Object#toString` result references. */ 19112 var argsTag = '[object Arguments]', 19113 arrayTag = '[object Array]', 19114 asyncTag = '[object AsyncFunction]', 19115 boolTag = '[object Boolean]', 19116 dateTag = '[object Date]', 19117 domExcTag = '[object DOMException]', 19118 errorTag = '[object Error]', 19119 funcTag = '[object Function]', 19120 genTag = '[object GeneratorFunction]', 19121 mapTag = '[object Map]', 19122 numberTag = '[object Number]', 19123 nullTag = '[object Null]', 19124 objectTag = '[object Object]', 19125 promiseTag = '[object Promise]', 19126 proxyTag = '[object Proxy]', 19127 regexpTag = '[object RegExp]', 19128 setTag = '[object Set]', 19129 stringTag = '[object String]', 19130 symbolTag = '[object Symbol]', 19131 undefinedTag = '[object Undefined]', 19132 weakMapTag = '[object WeakMap]', 19133 weakSetTag = '[object WeakSet]'; 19134 19135 var arrayBufferTag = '[object ArrayBuffer]', 19136 dataViewTag = '[object DataView]', 19137 float32Tag = '[object Float32Array]', 19138 float64Tag = '[object Float64Array]', 19139 int8Tag = '[object Int8Array]', 19140 int16Tag = '[object Int16Array]', 19141 int32Tag = '[object Int32Array]', 19142 uint8Tag = '[object Uint8Array]', 19143 uint8ClampedTag = '[object Uint8ClampedArray]', 19144 uint16Tag = '[object Uint16Array]', 19145 uint32Tag = '[object Uint32Array]'; 19146 19147 /** Used to match empty string literals in compiled template source. */ 19148 var reEmptyStringLeading = /\b__p \+= '';/g, 19149 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 19150 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 19151 19152 /** Used to match HTML entities and HTML characters. */ 19153 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 19154 reUnescapedHtml = /[&<>"']/g, 19155 reHasEscapedHtml = RegExp(reEscapedHtml.source), 19156 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 19157 19158 /** Used to match template delimiters. */ 19159 var reEscape = /<%-([\s\S]+?)%>/g, 19160 reEvaluate = /<%([\s\S]+?)%>/g, 19161 reInterpolate = /<%=([\s\S]+?)%>/g; 19162 19163 /** Used to match property names within property paths. */ 19164 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 19165 reIsPlainProp = /^\w*$/, 19166 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 19167 19168 /** 19169 * Used to match `RegExp` 19170 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 19171 */ 19172 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 19173 reHasRegExpChar = RegExp(reRegExpChar.source); 19174 19175 /** Used to match leading and trailing whitespace. */ 19176 var reTrim = /^\s+|\s+$/g, 19177 reTrimStart = /^\s+/, 19178 reTrimEnd = /\s+$/; 19179 19180 /** Used to match wrap detail comments. */ 19181 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 19182 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 19183 reSplitDetails = /,? & /; 19184 19185 /** Used to match words composed of alphanumeric characters. */ 19186 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 19187 19188 /** Used to match backslashes in property paths. */ 19189 var reEscapeChar = /\\(\\)?/g; 19190 19191 /** 19192 * Used to match 19193 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 19194 */ 19195 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 19196 19197 /** Used to match `RegExp` flags from their coerced string values. */ 19198 var reFlags = /\w*$/; 19199 19200 /** Used to detect bad signed hexadecimal string values. */ 19201 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 19202 19203 /** Used to detect binary string values. */ 19204 var reIsBinary = /^0b[01]+$/i; 19205 19206 /** Used to detect host constructors (Safari). */ 19207 var reIsHostCtor = /^\[object .+?Constructor\]$/; 19208 19209 /** Used to detect octal string values. */ 19210 var reIsOctal = /^0o[0-7]+$/i; 19211 19212 /** Used to detect unsigned integer values. */ 19213 var reIsUint = /^(?:0|[1-9]\d*)$/; 19214 19215 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 19216 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 19217 19218 /** Used to ensure capturing order of template delimiters. */ 19219 var reNoMatch = /($^)/; 19220 19221 /** Used to match unescaped characters in compiled string literals. */ 19222 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 19223 19224 /** Used to compose unicode character classes. */ 19225 var rsAstralRange = '\\ud800-\\udfff', 19226 rsComboMarksRange = '\\u0300-\\u036f', 19227 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 19228 rsComboSymbolsRange = '\\u20d0-\\u20ff', 19229 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 19230 rsDingbatRange = '\\u2700-\\u27bf', 19231 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 19232 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 19233 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 19234 rsPunctuationRange = '\\u2000-\\u206f', 19235 rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', 19236 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 19237 rsVarRange = '\\ufe0e\\ufe0f', 19238 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 19239 19240 /** Used to compose unicode capture groups. */ 19241 var rsApos = "['\u2019]", 19242 rsAstral = '[' + rsAstralRange + ']', 19243 rsBreak = '[' + rsBreakRange + ']', 19244 rsCombo = '[' + rsComboRange + ']', 19245 rsDigits = '\\d+', 19246 rsDingbat = '[' + rsDingbatRange + ']', 19247 rsLower = '[' + rsLowerRange + ']', 19248 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 19249 rsFitz = '\\ud83c[\\udffb-\\udfff]', 19250 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 19251 rsNonAstral = '[^' + rsAstralRange + ']', 19252 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 19253 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 19254 rsUpper = '[' + rsUpperRange + ']', 19255 rsZWJ = '\\u200d'; 19256 19257 /** Used to compose unicode regexes. */ 19258 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 19259 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 19260 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 19261 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 19262 reOptMod = rsModifier + '?', 19263 rsOptVar = '[' + rsVarRange + ']?', 19264 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 19265 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 19266 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 19267 rsSeq = rsOptVar + reOptMod + rsOptJoin, 19268 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 19269 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 19270 19271 /** Used to match apostrophes. */ 19272 var reApos = RegExp(rsApos, 'g'); 19273 19274 /** 19275 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 19276 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 19277 */ 19278 var reComboMark = RegExp(rsCombo, 'g'); 19279 19280 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 19281 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 19282 19283 /** Used to match complex or compound words. */ 19284 var reUnicodeWord = RegExp([ 19285 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 19286 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 19287 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 19288 rsUpper + '+' + rsOptContrUpper, 19289 rsOrdUpper, 19290 rsOrdLower, 19291 rsDigits, 19292 rsEmoji 19293 ].join('|'), 'g'); 19294 19295 /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ 19296 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 19297 19298 /** Used to detect strings that need a more robust regexp to match words. */ 19299 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; 19300 19301 /** Used to assign default `context` object properties. */ 19302 var contextProps = [ 19303 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 19304 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 19305 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 19306 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 19307 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 19308 ]; 19309 19310 /** Used to make template sourceURLs easier to identify. */ 19311 var templateCounter = -1; 19312 19313 /** Used to identify `toStringTag` values of typed arrays. */ 19314 var typedArrayTags = {}; 19315 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 19316 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 19317 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 19318 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 19319 typedArrayTags[uint32Tag] = true; 19320 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 19321 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 19322 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 19323 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 19324 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 19325 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 19326 typedArrayTags[setTag] = typedArrayTags[stringTag] = 19327 typedArrayTags[weakMapTag] = false; 19328 19329 /** Used to identify `toStringTag` values supported by `_.clone`. */ 19330 var cloneableTags = {}; 19331 cloneableTags[argsTag] = cloneableTags[arrayTag] = 19332 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 19333 cloneableTags[boolTag] = cloneableTags[dateTag] = 19334 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 19335 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 19336 cloneableTags[int32Tag] = cloneableTags[mapTag] = 19337 cloneableTags[numberTag] = cloneableTags[objectTag] = 19338 cloneableTags[regexpTag] = cloneableTags[setTag] = 19339 cloneableTags[stringTag] = cloneableTags[symbolTag] = 19340 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 19341 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 19342 cloneableTags[errorTag] = cloneableTags[funcTag] = 19343 cloneableTags[weakMapTag] = false; 19344 19345 /** Used to map Latin Unicode letters to basic Latin letters. */ 19346 var deburredLetters = { 19347 // Latin-1 Supplement block. 19348 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 19349 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 19350 '\xc7': 'C', '\xe7': 'c', 19351 '\xd0': 'D', '\xf0': 'd', 19352 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 19353 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 19354 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 19355 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 19356 '\xd1': 'N', '\xf1': 'n', 19357 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 19358 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 19359 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 19360 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 19361 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 19362 '\xc6': 'Ae', '\xe6': 'ae', 19363 '\xde': 'Th', '\xfe': 'th', 19364 '\xdf': 'ss', 19365 // Latin Extended-A block. 19366 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 19367 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 19368 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 19369 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 19370 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 19371 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 19372 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 19373 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 19374 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 19375 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 19376 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 19377 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 19378 '\u0134': 'J', '\u0135': 'j', 19379 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 19380 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 19381 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 19382 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 19383 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 19384 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 19385 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 19386 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 19387 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 19388 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 19389 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 19390 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 19391 '\u0163': 't', '\u0165': 't', '\u0167': 't', 19392 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 19393 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 19394 '\u0174': 'W', '\u0175': 'w', 19395 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 19396 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 19397 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 19398 '\u0132': 'IJ', '\u0133': 'ij', 19399 '\u0152': 'Oe', '\u0153': 'oe', 19400 '\u0149': "'n", '\u017f': 's' 19401 }; 19402 19403 /** Used to map characters to HTML entities. */ 19404 var htmlEscapes = { 19405 '&': '&', 19406 '<': '<', 19407 '>': '>', 19408 '"': '"', 19409 "'": ''' 19410 }; 19411 19412 /** Used to map HTML entities to characters. */ 19413 var htmlUnescapes = { 19414 '&': '&', 19415 '<': '<', 19416 '>': '>', 19417 '"': '"', 19418 ''': "'" 19419 }; 19420 19421 /** Used to escape characters for inclusion in compiled string literals. */ 19422 var stringEscapes = { 19423 '\\': '\\', 19424 "'": "'", 19425 '\n': 'n', 19426 '\r': 'r', 19427 '\u2028': 'u2028', 19428 '\u2029': 'u2029' 19429 }; 19430 19431 /** Built-in method references without a dependency on `root`. */ 19432 var freeParseFloat = parseFloat, 19433 freeParseInt = parseInt; 19434 19435 /** Detect free variable `global` from Node.js. */ 19436 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 19437 19438 /** Detect free variable `self`. */ 19439 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 19440 19441 /** Used as a reference to the global object. */ 19442 var root = freeGlobal || freeSelf || Function('return this')(); 19443 19444 /** Detect free variable `exports`. */ 19445 var freeExports = true && exports && !exports.nodeType && exports; 19446 19447 /** Detect free variable `module`. */ 19448 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; 19449 19450 /** Detect the popular CommonJS extension `module.exports`. */ 19451 var moduleExports = freeModule && freeModule.exports === freeExports; 19452 19453 /** Detect free variable `process` from Node.js. */ 19454 var freeProcess = moduleExports && freeGlobal.process; 19455 19456 /** Used to access faster Node.js helpers. */ 19457 var nodeUtil = (function() { 19458 try { 19459 // Use `util.types` for Node.js 10+. 19460 var types = freeModule && freeModule.require && freeModule.require('util').types; 19461 19462 if (types) { 19463 return types; 19464 } 19465 19466 // Legacy `process.binding('util')` for Node.js < 10. 19467 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 19468 } catch (e) {} 19469 }()); 19470 19471 /* Node.js helper references. */ 19472 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 19473 nodeIsDate = nodeUtil && nodeUtil.isDate, 19474 nodeIsMap = nodeUtil && nodeUtil.isMap, 19475 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 19476 nodeIsSet = nodeUtil && nodeUtil.isSet, 19477 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 19478 19479 /*--------------------------------------------------------------------------*/ 19480 19481 /** 19482 * A faster alternative to `Function#apply`, this function invokes `func` 19483 * with the `this` binding of `thisArg` and the arguments of `args`. 19484 * 19485 * @private 19486 * @param {Function} func The function to invoke. 19487 * @param {*} thisArg The `this` binding of `func`. 19488 * @param {Array} args The arguments to invoke `func` with. 19489 * @returns {*} Returns the result of `func`. 19490 */ 19491 function apply(func, thisArg, args) { 19492 switch (args.length) { 19493 case 0: return func.call(thisArg); 19494 case 1: return func.call(thisArg, args[0]); 19495 case 2: return func.call(thisArg, args[0], args[1]); 19496 case 3: return func.call(thisArg, args[0], args[1], args[2]); 19497 } 19498 return func.apply(thisArg, args); 19499 } 19500 19501 /** 19502 * A specialized version of `baseAggregator` for arrays. 19503 * 19504 * @private 19505 * @param {Array} [array] The array to iterate over. 19506 * @param {Function} setter The function to set `accumulator` values. 19507 * @param {Function} iteratee The iteratee to transform keys. 19508 * @param {Object} accumulator The initial aggregated object. 19509 * @returns {Function} Returns `accumulator`. 19510 */ 19511 function arrayAggregator(array, setter, iteratee, accumulator) { 19512 var index = -1, 19513 length = array == null ? 0 : array.length; 19514 19515 while (++index < length) { 19516 var value = array[index]; 19517 setter(accumulator, value, iteratee(value), array); 19518 } 19519 return accumulator; 19520 } 19521 19522 /** 19523 * A specialized version of `_.forEach` for arrays without support for 19524 * iteratee shorthands. 19525 * 19526 * @private 19527 * @param {Array} [array] The array to iterate over. 19528 * @param {Function} iteratee The function invoked per iteration. 19529 * @returns {Array} Returns `array`. 19530 */ 19531 function arrayEach(array, iteratee) { 19532 var index = -1, 19533 length = array == null ? 0 : array.length; 19534 19535 while (++index < length) { 19536 if (iteratee(array[index], index, array) === false) { 19537 break; 19538 } 19539 } 19540 return array; 19541 } 19542 19543 /** 19544 * A specialized version of `_.forEachRight` for arrays without support for 19545 * iteratee shorthands. 19546 * 19547 * @private 19548 * @param {Array} [array] The array to iterate over. 19549 * @param {Function} iteratee The function invoked per iteration. 19550 * @returns {Array} Returns `array`. 19551 */ 19552 function arrayEachRight(array, iteratee) { 19553 var length = array == null ? 0 : array.length; 19554 19555 while (length--) { 19556 if (iteratee(array[length], length, array) === false) { 19557 break; 19558 } 19559 } 19560 return array; 19561 } 19562 19563 /** 19564 * A specialized version of `_.every` for arrays without support for 19565 * iteratee shorthands. 19566 * 19567 * @private 19568 * @param {Array} [array] The array to iterate over. 19569 * @param {Function} predicate The function invoked per iteration. 19570 * @returns {boolean} Returns `true` if all elements pass the predicate check, 19571 * else `false`. 19572 */ 19573 function arrayEvery(array, predicate) { 19574 var index = -1, 19575 length = array == null ? 0 : array.length; 19576 19577 while (++index < length) { 19578 if (!predicate(array[index], index, array)) { 19579 return false; 19580 } 19581 } 19582 return true; 19583 } 19584 19585 /** 19586 * A specialized version of `_.filter` for arrays without support for 19587 * iteratee shorthands. 19588 * 19589 * @private 19590 * @param {Array} [array] The array to iterate over. 19591 * @param {Function} predicate The function invoked per iteration. 19592 * @returns {Array} Returns the new filtered array. 19593 */ 19594 function arrayFilter(array, predicate) { 19595 var index = -1, 19596 length = array == null ? 0 : array.length, 19597 resIndex = 0, 19598 result = []; 19599 19600 while (++index < length) { 19601 var value = array[index]; 19602 if (predicate(value, index, array)) { 19603 result[resIndex++] = value; 19604 } 19605 } 19606 return result; 19607 } 19608 19609 /** 19610 * A specialized version of `_.includes` for arrays without support for 19611 * specifying an index to search from. 19612 * 19613 * @private 19614 * @param {Array} [array] The array to inspect. 19615 * @param {*} target The value to search for. 19616 * @returns {boolean} Returns `true` if `target` is found, else `false`. 19617 */ 19618 function arrayIncludes(array, value) { 19619 var length = array == null ? 0 : array.length; 19620 return !!length && baseIndexOf(array, value, 0) > -1; 19621 } 19622 19623 /** 19624 * This function is like `arrayIncludes` except that it accepts a comparator. 19625 * 19626 * @private 19627 * @param {Array} [array] The array to inspect. 19628 * @param {*} target The value to search for. 19629 * @param {Function} comparator The comparator invoked per element. 19630 * @returns {boolean} Returns `true` if `target` is found, else `false`. 19631 */ 19632 function arrayIncludesWith(array, value, comparator) { 19633 var index = -1, 19634 length = array == null ? 0 : array.length; 19635 19636 while (++index < length) { 19637 if (comparator(value, array[index])) { 19638 return true; 19639 } 19640 } 19641 return false; 19642 } 19643 19644 /** 19645 * A specialized version of `_.map` for arrays without support for iteratee 19646 * shorthands. 19647 * 19648 * @private 19649 * @param {Array} [array] The array to iterate over. 19650 * @param {Function} iteratee The function invoked per iteration. 19651 * @returns {Array} Returns the new mapped array. 19652 */ 19653 function arrayMap(array, iteratee) { 19654 var index = -1, 19655 length = array == null ? 0 : array.length, 19656 result = Array(length); 19657 19658 while (++index < length) { 19659 result[index] = iteratee(array[index], index, array); 19660 } 19661 return result; 19662 } 19663 19664 /** 19665 * Appends the elements of `values` to `array`. 19666 * 19667 * @private 19668 * @param {Array} array The array to modify. 19669 * @param {Array} values The values to append. 19670 * @returns {Array} Returns `array`. 19671 */ 19672 function arrayPush(array, values) { 19673 var index = -1, 19674 length = values.length, 19675 offset = array.length; 19676 19677 while (++index < length) { 19678 array[offset + index] = values[index]; 19679 } 19680 return array; 19681 } 19682 19683 /** 19684 * A specialized version of `_.reduce` for arrays without support for 19685 * iteratee shorthands. 19686 * 19687 * @private 19688 * @param {Array} [array] The array to iterate over. 19689 * @param {Function} iteratee The function invoked per iteration. 19690 * @param {*} [accumulator] The initial value. 19691 * @param {boolean} [initAccum] Specify using the first element of `array` as 19692 * the initial value. 19693 * @returns {*} Returns the accumulated value. 19694 */ 19695 function arrayReduce(array, iteratee, accumulator, initAccum) { 19696 var index = -1, 19697 length = array == null ? 0 : array.length; 19698 19699 if (initAccum && length) { 19700 accumulator = array[++index]; 19701 } 19702 while (++index < length) { 19703 accumulator = iteratee(accumulator, array[index], index, array); 19704 } 19705 return accumulator; 19706 } 19707 19708 /** 19709 * A specialized version of `_.reduceRight` for arrays without support for 19710 * iteratee shorthands. 19711 * 19712 * @private 19713 * @param {Array} [array] The array to iterate over. 19714 * @param {Function} iteratee The function invoked per iteration. 19715 * @param {*} [accumulator] The initial value. 19716 * @param {boolean} [initAccum] Specify using the last element of `array` as 19717 * the initial value. 19718 * @returns {*} Returns the accumulated value. 19719 */ 19720 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 19721 var length = array == null ? 0 : array.length; 19722 if (initAccum && length) { 19723 accumulator = array[--length]; 19724 } 19725 while (length--) { 19726 accumulator = iteratee(accumulator, array[length], length, array); 19727 } 19728 return accumulator; 19729 } 19730 19731 /** 19732 * A specialized version of `_.some` for arrays without support for iteratee 19733 * shorthands. 19734 * 19735 * @private 19736 * @param {Array} [array] The array to iterate over. 19737 * @param {Function} predicate The function invoked per iteration. 19738 * @returns {boolean} Returns `true` if any element passes the predicate check, 19739 * else `false`. 19740 */ 19741 function arraySome(array, predicate) { 19742 var index = -1, 19743 length = array == null ? 0 : array.length; 19744 19745 while (++index < length) { 19746 if (predicate(array[index], index, array)) { 19747 return true; 19748 } 19749 } 19750 return false; 19751 } 19752 19753 /** 19754 * Gets the size of an ASCII `string`. 19755 * 19756 * @private 19757 * @param {string} string The string inspect. 19758 * @returns {number} Returns the string size. 19759 */ 19760 var asciiSize = baseProperty('length'); 19761 19762 /** 19763 * Converts an ASCII `string` to an array. 19764 * 19765 * @private 19766 * @param {string} string The string to convert. 19767 * @returns {Array} Returns the converted array. 19768 */ 19769 function asciiToArray(string) { 19770 return string.split(''); 19771 } 19772 19773 /** 19774 * Splits an ASCII `string` into an array of its words. 19775 * 19776 * @private 19777 * @param {string} The string to inspect. 19778 * @returns {Array} Returns the words of `string`. 19779 */ 19780 function asciiWords(string) { 19781 return string.match(reAsciiWord) || []; 19782 } 19783 19784 /** 19785 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 19786 * without support for iteratee shorthands, which iterates over `collection` 19787 * using `eachFunc`. 19788 * 19789 * @private 19790 * @param {Array|Object} collection The collection to inspect. 19791 * @param {Function} predicate The function invoked per iteration. 19792 * @param {Function} eachFunc The function to iterate over `collection`. 19793 * @returns {*} Returns the found element or its key, else `undefined`. 19794 */ 19795 function baseFindKey(collection, predicate, eachFunc) { 19796 var result; 19797 eachFunc(collection, function(value, key, collection) { 19798 if (predicate(value, key, collection)) { 19799 result = key; 19800 return false; 19801 } 19802 }); 19803 return result; 19804 } 19805 19806 /** 19807 * The base implementation of `_.findIndex` and `_.findLastIndex` without 19808 * support for iteratee shorthands. 19809 * 19810 * @private 19811 * @param {Array} array The array to inspect. 19812 * @param {Function} predicate The function invoked per iteration. 19813 * @param {number} fromIndex The index to search from. 19814 * @param {boolean} [fromRight] Specify iterating from right to left. 19815 * @returns {number} Returns the index of the matched value, else `-1`. 19816 */ 19817 function baseFindIndex(array, predicate, fromIndex, fromRight) { 19818 var length = array.length, 19819 index = fromIndex + (fromRight ? 1 : -1); 19820 19821 while ((fromRight ? index-- : ++index < length)) { 19822 if (predicate(array[index], index, array)) { 19823 return index; 19824 } 19825 } 19826 return -1; 19827 } 19828 19829 /** 19830 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 19831 * 19832 * @private 19833 * @param {Array} array The array to inspect. 19834 * @param {*} value The value to search for. 19835 * @param {number} fromIndex The index to search from. 19836 * @returns {number} Returns the index of the matched value, else `-1`. 19837 */ 19838 function baseIndexOf(array, value, fromIndex) { 19839 return value === value 19840 ? strictIndexOf(array, value, fromIndex) 19841 : baseFindIndex(array, baseIsNaN, fromIndex); 19842 } 19843 19844 /** 19845 * This function is like `baseIndexOf` except that it accepts a comparator. 19846 * 19847 * @private 19848 * @param {Array} array The array to inspect. 19849 * @param {*} value The value to search for. 19850 * @param {number} fromIndex The index to search from. 19851 * @param {Function} comparator The comparator invoked per element. 19852 * @returns {number} Returns the index of the matched value, else `-1`. 19853 */ 19854 function baseIndexOfWith(array, value, fromIndex, comparator) { 19855 var index = fromIndex - 1, 19856 length = array.length; 19857 19858 while (++index < length) { 19859 if (comparator(array[index], value)) { 19860 return index; 19861 } 19862 } 19863 return -1; 19864 } 19865 19866 /** 19867 * The base implementation of `_.isNaN` without support for number objects. 19868 * 19869 * @private 19870 * @param {*} value The value to check. 19871 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 19872 */ 19873 function baseIsNaN(value) { 19874 return value !== value; 19875 } 19876 19877 /** 19878 * The base implementation of `_.mean` and `_.meanBy` without support for 19879 * iteratee shorthands. 19880 * 19881 * @private 19882 * @param {Array} array The array to iterate over. 19883 * @param {Function} iteratee The function invoked per iteration. 19884 * @returns {number} Returns the mean. 19885 */ 19886 function baseMean(array, iteratee) { 19887 var length = array == null ? 0 : array.length; 19888 return length ? (baseSum(array, iteratee) / length) : NAN; 19889 } 19890 19891 /** 19892 * The base implementation of `_.property` without support for deep paths. 19893 * 19894 * @private 19895 * @param {string} key The key of the property to get. 19896 * @returns {Function} Returns the new accessor function. 19897 */ 19898 function baseProperty(key) { 19899 return function(object) { 19900 return object == null ? undefined : object[key]; 19901 }; 19902 } 19903 19904 /** 19905 * The base implementation of `_.propertyOf` without support for deep paths. 19906 * 19907 * @private 19908 * @param {Object} object The object to query. 19909 * @returns {Function} Returns the new accessor function. 19910 */ 19911 function basePropertyOf(object) { 19912 return function(key) { 19913 return object == null ? undefined : object[key]; 19914 }; 19915 } 19916 19917 /** 19918 * The base implementation of `_.reduce` and `_.reduceRight`, without support 19919 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 19920 * 19921 * @private 19922 * @param {Array|Object} collection The collection to iterate over. 19923 * @param {Function} iteratee The function invoked per iteration. 19924 * @param {*} accumulator The initial value. 19925 * @param {boolean} initAccum Specify using the first or last element of 19926 * `collection` as the initial value. 19927 * @param {Function} eachFunc The function to iterate over `collection`. 19928 * @returns {*} Returns the accumulated value. 19929 */ 19930 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 19931 eachFunc(collection, function(value, index, collection) { 19932 accumulator = initAccum 19933 ? (initAccum = false, value) 19934 : iteratee(accumulator, value, index, collection); 19935 }); 19936 return accumulator; 19937 } 19938 19939 /** 19940 * The base implementation of `_.sortBy` which uses `comparer` to define the 19941 * sort order of `array` and replaces criteria objects with their corresponding 19942 * values. 19943 * 19944 * @private 19945 * @param {Array} array The array to sort. 19946 * @param {Function} comparer The function to define sort order. 19947 * @returns {Array} Returns `array`. 19948 */ 19949 function baseSortBy(array, comparer) { 19950 var length = array.length; 19951 19952 array.sort(comparer); 19953 while (length--) { 19954 array[length] = array[length].value; 19955 } 19956 return array; 19957 } 19958 19959 /** 19960 * The base implementation of `_.sum` and `_.sumBy` without support for 19961 * iteratee shorthands. 19962 * 19963 * @private 19964 * @param {Array} array The array to iterate over. 19965 * @param {Function} iteratee The function invoked per iteration. 19966 * @returns {number} Returns the sum. 19967 */ 19968 function baseSum(array, iteratee) { 19969 var result, 19970 index = -1, 19971 length = array.length; 19972 19973 while (++index < length) { 19974 var current = iteratee(array[index]); 19975 if (current !== undefined) { 19976 result = result === undefined ? current : (result + current); 19977 } 19978 } 19979 return result; 19980 } 19981 19982 /** 19983 * The base implementation of `_.times` without support for iteratee shorthands 19984 * or max array length checks. 19985 * 19986 * @private 19987 * @param {number} n The number of times to invoke `iteratee`. 19988 * @param {Function} iteratee The function invoked per iteration. 19989 * @returns {Array} Returns the array of results. 19990 */ 19991 function baseTimes(n, iteratee) { 19992 var index = -1, 19993 result = Array(n); 19994 19995 while (++index < n) { 19996 result[index] = iteratee(index); 19997 } 19998 return result; 19999 } 20000 20001 /** 20002 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 20003 * of key-value pairs for `object` corresponding to the property names of `props`. 20004 * 20005 * @private 20006 * @param {Object} object The object to query. 20007 * @param {Array} props The property names to get values for. 20008 * @returns {Object} Returns the key-value pairs. 20009 */ 20010 function baseToPairs(object, props) { 20011 return arrayMap(props, function(key) { 20012 return [key, object[key]]; 20013 }); 20014 } 20015 20016 /** 20017 * The base implementation of `_.unary` without support for storing metadata. 20018 * 20019 * @private 20020 * @param {Function} func The function to cap arguments for. 20021 * @returns {Function} Returns the new capped function. 20022 */ 20023 function baseUnary(func) { 20024 return function(value) { 20025 return func(value); 20026 }; 20027 } 20028 20029 /** 20030 * The base implementation of `_.values` and `_.valuesIn` which creates an 20031 * array of `object` property values corresponding to the property names 20032 * of `props`. 20033 * 20034 * @private 20035 * @param {Object} object The object to query. 20036 * @param {Array} props The property names to get values for. 20037 * @returns {Object} Returns the array of property values. 20038 */ 20039 function baseValues(object, props) { 20040 return arrayMap(props, function(key) { 20041 return object[key]; 20042 }); 20043 } 20044 20045 /** 20046 * Checks if a `cache` value for `key` exists. 20047 * 20048 * @private 20049 * @param {Object} cache The cache to query. 20050 * @param {string} key The key of the entry to check. 20051 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 20052 */ 20053 function cacheHas(cache, key) { 20054 return cache.has(key); 20055 } 20056 20057 /** 20058 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 20059 * that is not found in the character symbols. 20060 * 20061 * @private 20062 * @param {Array} strSymbols The string symbols to inspect. 20063 * @param {Array} chrSymbols The character symbols to find. 20064 * @returns {number} Returns the index of the first unmatched string symbol. 20065 */ 20066 function charsStartIndex(strSymbols, chrSymbols) { 20067 var index = -1, 20068 length = strSymbols.length; 20069 20070 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 20071 return index; 20072 } 20073 20074 /** 20075 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 20076 * that is not found in the character symbols. 20077 * 20078 * @private 20079 * @param {Array} strSymbols The string symbols to inspect. 20080 * @param {Array} chrSymbols The character symbols to find. 20081 * @returns {number} Returns the index of the last unmatched string symbol. 20082 */ 20083 function charsEndIndex(strSymbols, chrSymbols) { 20084 var index = strSymbols.length; 20085 20086 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 20087 return index; 20088 } 20089 20090 /** 20091 * Gets the number of `placeholder` occurrences in `array`. 20092 * 20093 * @private 20094 * @param {Array} array The array to inspect. 20095 * @param {*} placeholder The placeholder to search for. 20096 * @returns {number} Returns the placeholder count. 20097 */ 20098 function countHolders(array, placeholder) { 20099 var length = array.length, 20100 result = 0; 20101 20102 while (length--) { 20103 if (array[length] === placeholder) { 20104 ++result; 20105 } 20106 } 20107 return result; 20108 } 20109 20110 /** 20111 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 20112 * letters to basic Latin letters. 20113 * 20114 * @private 20115 * @param {string} letter The matched letter to deburr. 20116 * @returns {string} Returns the deburred letter. 20117 */ 20118 var deburrLetter = basePropertyOf(deburredLetters); 20119 20120 /** 20121 * Used by `_.escape` to convert characters to HTML entities. 20122 * 20123 * @private 20124 * @param {string} chr The matched character to escape. 20125 * @returns {string} Returns the escaped character. 20126 */ 20127 var escapeHtmlChar = basePropertyOf(htmlEscapes); 20128 20129 /** 20130 * Used by `_.template` to escape characters for inclusion in compiled string literals. 20131 * 20132 * @private 20133 * @param {string} chr The matched character to escape. 20134 * @returns {string} Returns the escaped character. 20135 */ 20136 function escapeStringChar(chr) { 20137 return '\\' + stringEscapes[chr]; 20138 } 20139 20140 /** 20141 * Gets the value at `key` of `object`. 20142 * 20143 * @private 20144 * @param {Object} [object] The object to query. 20145 * @param {string} key The key of the property to get. 20146 * @returns {*} Returns the property value. 20147 */ 20148 function getValue(object, key) { 20149 return object == null ? undefined : object[key]; 20150 } 20151 20152 /** 20153 * Checks if `string` contains Unicode symbols. 20154 * 20155 * @private 20156 * @param {string} string The string to inspect. 20157 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 20158 */ 20159 function hasUnicode(string) { 20160 return reHasUnicode.test(string); 20161 } 20162 20163 /** 20164 * Checks if `string` contains a word composed of Unicode symbols. 20165 * 20166 * @private 20167 * @param {string} string The string to inspect. 20168 * @returns {boolean} Returns `true` if a word is found, else `false`. 20169 */ 20170 function hasUnicodeWord(string) { 20171 return reHasUnicodeWord.test(string); 20172 } 20173 20174 /** 20175 * Converts `iterator` to an array. 20176 * 20177 * @private 20178 * @param {Object} iterator The iterator to convert. 20179 * @returns {Array} Returns the converted array. 20180 */ 20181 function iteratorToArray(iterator) { 20182 var data, 20183 result = []; 20184 20185 while (!(data = iterator.next()).done) { 20186 result.push(data.value); 20187 } 20188 return result; 20189 } 20190 20191 /** 20192 * Converts `map` to its key-value pairs. 20193 * 20194 * @private 20195 * @param {Object} map The map to convert. 20196 * @returns {Array} Returns the key-value pairs. 20197 */ 20198 function mapToArray(map) { 20199 var index = -1, 20200 result = Array(map.size); 20201 20202 map.forEach(function(value, key) { 20203 result[++index] = [key, value]; 20204 }); 20205 return result; 20206 } 20207 20208 /** 20209 * Creates a unary function that invokes `func` with its argument transformed. 20210 * 20211 * @private 20212 * @param {Function} func The function to wrap. 20213 * @param {Function} transform The argument transform. 20214 * @returns {Function} Returns the new function. 20215 */ 20216 function overArg(func, transform) { 20217 return function(arg) { 20218 return func(transform(arg)); 20219 }; 20220 } 20221 20222 /** 20223 * Replaces all `placeholder` elements in `array` with an internal placeholder 20224 * and returns an array of their indexes. 20225 * 20226 * @private 20227 * @param {Array} array The array to modify. 20228 * @param {*} placeholder The placeholder to replace. 20229 * @returns {Array} Returns the new array of placeholder indexes. 20230 */ 20231 function replaceHolders(array, placeholder) { 20232 var index = -1, 20233 length = array.length, 20234 resIndex = 0, 20235 result = []; 20236 20237 while (++index < length) { 20238 var value = array[index]; 20239 if (value === placeholder || value === PLACEHOLDER) { 20240 array[index] = PLACEHOLDER; 20241 result[resIndex++] = index; 20242 } 20243 } 20244 return result; 20245 } 20246 20247 /** 20248 * Converts `set` to an array of its values. 20249 * 20250 * @private 20251 * @param {Object} set The set to convert. 20252 * @returns {Array} Returns the values. 20253 */ 20254 function setToArray(set) { 20255 var index = -1, 20256 result = Array(set.size); 20257 20258 set.forEach(function(value) { 20259 result[++index] = value; 20260 }); 20261 return result; 20262 } 20263 20264 /** 20265 * Converts `set` to its value-value pairs. 20266 * 20267 * @private 20268 * @param {Object} set The set to convert. 20269 * @returns {Array} Returns the value-value pairs. 20270 */ 20271 function setToPairs(set) { 20272 var index = -1, 20273 result = Array(set.size); 20274 20275 set.forEach(function(value) { 20276 result[++index] = [value, value]; 20277 }); 20278 return result; 20279 } 20280 20281 /** 20282 * A specialized version of `_.indexOf` which performs strict equality 20283 * comparisons of values, i.e. `===`. 20284 * 20285 * @private 20286 * @param {Array} array The array to inspect. 20287 * @param {*} value The value to search for. 20288 * @param {number} fromIndex The index to search from. 20289 * @returns {number} Returns the index of the matched value, else `-1`. 20290 */ 20291 function strictIndexOf(array, value, fromIndex) { 20292 var index = fromIndex - 1, 20293 length = array.length; 20294 20295 while (++index < length) { 20296 if (array[index] === value) { 20297 return index; 20298 } 20299 } 20300 return -1; 20301 } 20302 20303 /** 20304 * A specialized version of `_.lastIndexOf` which performs strict equality 20305 * comparisons of values, i.e. `===`. 20306 * 20307 * @private 20308 * @param {Array} array The array to inspect. 20309 * @param {*} value The value to search for. 20310 * @param {number} fromIndex The index to search from. 20311 * @returns {number} Returns the index of the matched value, else `-1`. 20312 */ 20313 function strictLastIndexOf(array, value, fromIndex) { 20314 var index = fromIndex + 1; 20315 while (index--) { 20316 if (array[index] === value) { 20317 return index; 20318 } 20319 } 20320 return index; 20321 } 20322 20323 /** 20324 * Gets the number of symbols in `string`. 20325 * 20326 * @private 20327 * @param {string} string The string to inspect. 20328 * @returns {number} Returns the string size. 20329 */ 20330 function stringSize(string) { 20331 return hasUnicode(string) 20332 ? unicodeSize(string) 20333 : asciiSize(string); 20334 } 20335 20336 /** 20337 * Converts `string` to an array. 20338 * 20339 * @private 20340 * @param {string} string The string to convert. 20341 * @returns {Array} Returns the converted array. 20342 */ 20343 function stringToArray(string) { 20344 return hasUnicode(string) 20345 ? unicodeToArray(string) 20346 : asciiToArray(string); 20347 } 20348 20349 /** 20350 * Used by `_.unescape` to convert HTML entities to characters. 20351 * 20352 * @private 20353 * @param {string} chr The matched character to unescape. 20354 * @returns {string} Returns the unescaped character. 20355 */ 20356 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 20357 20358 /** 20359 * Gets the size of a Unicode `string`. 20360 * 20361 * @private 20362 * @param {string} string The string inspect. 20363 * @returns {number} Returns the string size. 20364 */ 20365 function unicodeSize(string) { 20366 var result = reUnicode.lastIndex = 0; 20367 while (reUnicode.test(string)) { 20368 ++result; 20369 } 20370 return result; 20371 } 20372 20373 /** 20374 * Converts a Unicode `string` to an array. 20375 * 20376 * @private 20377 * @param {string} string The string to convert. 20378 * @returns {Array} Returns the converted array. 20379 */ 20380 function unicodeToArray(string) { 20381 return string.match(reUnicode) || []; 20382 } 20383 20384 /** 20385 * Splits a Unicode `string` into an array of its words. 20386 * 20387 * @private 20388 * @param {string} The string to inspect. 20389 * @returns {Array} Returns the words of `string`. 20390 */ 20391 function unicodeWords(string) { 20392 return string.match(reUnicodeWord) || []; 20393 } 20394 20395 /*--------------------------------------------------------------------------*/ 20396 20397 /** 20398 * Create a new pristine `lodash` function using the `context` object. 20399 * 20400 * @static 20401 * @memberOf _ 20402 * @since 1.1.0 20403 * @category Util 20404 * @param {Object} [context=root] The context object. 20405 * @returns {Function} Returns a new `lodash` function. 20406 * @example 20407 * 20408 * _.mixin({ 'foo': _.constant('foo') }); 20409 * 20410 * var lodash = _.runInContext(); 20411 * lodash.mixin({ 'bar': lodash.constant('bar') }); 20412 * 20413 * _.isFunction(_.foo); 20414 * // => true 20415 * _.isFunction(_.bar); 20416 * // => false 20417 * 20418 * lodash.isFunction(lodash.foo); 20419 * // => false 20420 * lodash.isFunction(lodash.bar); 20421 * // => true 20422 * 20423 * // Create a suped-up `defer` in Node.js. 20424 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 20425 */ 20426 var runInContext = (function runInContext(context) { 20427 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 20428 20429 /** Built-in constructor references. */ 20430 var Array = context.Array, 20431 Date = context.Date, 20432 Error = context.Error, 20433 Function = context.Function, 20434 Math = context.Math, 20435 Object = context.Object, 20436 RegExp = context.RegExp, 20437 String = context.String, 20438 TypeError = context.TypeError; 20439 20440 /** Used for built-in method references. */ 20441 var arrayProto = Array.prototype, 20442 funcProto = Function.prototype, 20443 objectProto = Object.prototype; 20444 20445 /** Used to detect overreaching core-js shims. */ 20446 var coreJsData = context['__core-js_shared__']; 20447 20448 /** Used to resolve the decompiled source of functions. */ 20449 var funcToString = funcProto.toString; 20450 20451 /** Used to check objects for own properties. */ 20452 var hasOwnProperty = objectProto.hasOwnProperty; 20453 20454 /** Used to generate unique IDs. */ 20455 var idCounter = 0; 20456 20457 /** Used to detect methods masquerading as native. */ 20458 var maskSrcKey = (function() { 20459 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 20460 return uid ? ('Symbol(src)_1.' + uid) : ''; 20461 }()); 20462 20463 /** 20464 * Used to resolve the 20465 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 20466 * of values. 20467 */ 20468 var nativeObjectToString = objectProto.toString; 20469 20470 /** Used to infer the `Object` constructor. */ 20471 var objectCtorString = funcToString.call(Object); 20472 20473 /** Used to restore the original `_` reference in `_.noConflict`. */ 20474 var oldDash = root._; 20475 20476 /** Used to detect if a method is native. */ 20477 var reIsNative = RegExp('^' + 20478 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 20479 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 20480 ); 20481 20482 /** Built-in value references. */ 20483 var Buffer = moduleExports ? context.Buffer : undefined, 20484 Symbol = context.Symbol, 20485 Uint8Array = context.Uint8Array, 20486 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 20487 getPrototype = overArg(Object.getPrototypeOf, Object), 20488 objectCreate = Object.create, 20489 propertyIsEnumerable = objectProto.propertyIsEnumerable, 20490 splice = arrayProto.splice, 20491 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 20492 symIterator = Symbol ? Symbol.iterator : undefined, 20493 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 20494 20495 var defineProperty = (function() { 20496 try { 20497 var func = getNative(Object, 'defineProperty'); 20498 func({}, '', {}); 20499 return func; 20500 } catch (e) {} 20501 }()); 20502 20503 /** Mocked built-ins. */ 20504 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 20505 ctxNow = Date && Date.now !== root.Date.now && Date.now, 20506 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 20507 20508 /* Built-in method references for those with the same name as other `lodash` methods. */ 20509 var nativeCeil = Math.ceil, 20510 nativeFloor = Math.floor, 20511 nativeGetSymbols = Object.getOwnPropertySymbols, 20512 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 20513 nativeIsFinite = context.isFinite, 20514 nativeJoin = arrayProto.join, 20515 nativeKeys = overArg(Object.keys, Object), 20516 nativeMax = Math.max, 20517 nativeMin = Math.min, 20518 nativeNow = Date.now, 20519 nativeParseInt = context.parseInt, 20520 nativeRandom = Math.random, 20521 nativeReverse = arrayProto.reverse; 20522 20523 /* Built-in method references that are verified to be native. */ 20524 var DataView = getNative(context, 'DataView'), 20525 Map = getNative(context, 'Map'), 20526 Promise = getNative(context, 'Promise'), 20527 Set = getNative(context, 'Set'), 20528 WeakMap = getNative(context, 'WeakMap'), 20529 nativeCreate = getNative(Object, 'create'); 20530 20531 /** Used to store function metadata. */ 20532 var metaMap = WeakMap && new WeakMap; 20533 20534 /** Used to lookup unminified function names. */ 20535 var realNames = {}; 20536 20537 /** Used to detect maps, sets, and weakmaps. */ 20538 var dataViewCtorString = toSource(DataView), 20539 mapCtorString = toSource(Map), 20540 promiseCtorString = toSource(Promise), 20541 setCtorString = toSource(Set), 20542 weakMapCtorString = toSource(WeakMap); 20543 20544 /** Used to convert symbols to primitives and strings. */ 20545 var symbolProto = Symbol ? Symbol.prototype : undefined, 20546 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 20547 symbolToString = symbolProto ? symbolProto.toString : undefined; 20548 20549 /*------------------------------------------------------------------------*/ 20550 20551 /** 20552 * Creates a `lodash` object which wraps `value` to enable implicit method 20553 * chain sequences. Methods that operate on and return arrays, collections, 20554 * and functions can be chained together. Methods that retrieve a single value 20555 * or may return a primitive value will automatically end the chain sequence 20556 * and return the unwrapped value. Otherwise, the value must be unwrapped 20557 * with `_#value`. 20558 * 20559 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 20560 * enabled using `_.chain`. 20561 * 20562 * The execution of chained methods is lazy, that is, it's deferred until 20563 * `_#value` is implicitly or explicitly called. 20564 * 20565 * Lazy evaluation allows several methods to support shortcut fusion. 20566 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 20567 * the creation of intermediate arrays and can greatly reduce the number of 20568 * iteratee executions. Sections of a chain sequence qualify for shortcut 20569 * fusion if the section is applied to an array and iteratees accept only 20570 * one argument. The heuristic for whether a section qualifies for shortcut 20571 * fusion is subject to change. 20572 * 20573 * Chaining is supported in custom builds as long as the `_#value` method is 20574 * directly or indirectly included in the build. 20575 * 20576 * In addition to lodash methods, wrappers have `Array` and `String` methods. 20577 * 20578 * The wrapper `Array` methods are: 20579 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 20580 * 20581 * The wrapper `String` methods are: 20582 * `replace` and `split` 20583 * 20584 * The wrapper methods that support shortcut fusion are: 20585 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 20586 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 20587 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 20588 * 20589 * The chainable wrapper methods are: 20590 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 20591 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 20592 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 20593 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 20594 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 20595 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 20596 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 20597 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 20598 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 20599 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 20600 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 20601 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 20602 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 20603 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 20604 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 20605 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 20606 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 20607 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 20608 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 20609 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 20610 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 20611 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 20612 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 20613 * `zipObject`, `zipObjectDeep`, and `zipWith` 20614 * 20615 * The wrapper methods that are **not** chainable by default are: 20616 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 20617 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 20618 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 20619 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 20620 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 20621 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 20622 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 20623 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 20624 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 20625 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 20626 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 20627 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 20628 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 20629 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 20630 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 20631 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 20632 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 20633 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 20634 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 20635 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 20636 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 20637 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 20638 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 20639 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 20640 * `upperFirst`, `value`, and `words` 20641 * 20642 * @name _ 20643 * @constructor 20644 * @category Seq 20645 * @param {*} value The value to wrap in a `lodash` instance. 20646 * @returns {Object} Returns the new `lodash` wrapper instance. 20647 * @example 20648 * 20649 * function square(n) { 20650 * return n * n; 20651 * } 20652 * 20653 * var wrapped = _([1, 2, 3]); 20654 * 20655 * // Returns an unwrapped value. 20656 * wrapped.reduce(_.add); 20657 * // => 6 20658 * 20659 * // Returns a wrapped value. 20660 * var squares = wrapped.map(square); 20661 * 20662 * _.isArray(squares); 20663 * // => false 20664 * 20665 * _.isArray(squares.value()); 20666 * // => true 20667 */ 20668 function lodash(value) { 20669 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 20670 if (value instanceof LodashWrapper) { 20671 return value; 20672 } 20673 if (hasOwnProperty.call(value, '__wrapped__')) { 20674 return wrapperClone(value); 20675 } 20676 } 20677 return new LodashWrapper(value); 20678 } 20679 20680 /** 20681 * The base implementation of `_.create` without support for assigning 20682 * properties to the created object. 20683 * 20684 * @private 20685 * @param {Object} proto The object to inherit from. 20686 * @returns {Object} Returns the new object. 20687 */ 20688 var baseCreate = (function() { 20689 function object() {} 20690 return function(proto) { 20691 if (!isObject(proto)) { 20692 return {}; 20693 } 20694 if (objectCreate) { 20695 return objectCreate(proto); 20696 } 20697 object.prototype = proto; 20698 var result = new object; 20699 object.prototype = undefined; 20700 return result; 20701 }; 20702 }()); 20703 20704 /** 20705 * The function whose prototype chain sequence wrappers inherit from. 20706 * 20707 * @private 20708 */ 20709 function baseLodash() { 20710 // No operation performed. 20711 } 20712 20713 /** 20714 * The base constructor for creating `lodash` wrapper objects. 20715 * 20716 * @private 20717 * @param {*} value The value to wrap. 20718 * @param {boolean} [chainAll] Enable explicit method chain sequences. 20719 */ 20720 function LodashWrapper(value, chainAll) { 20721 this.__wrapped__ = value; 20722 this.__actions__ = []; 20723 this.__chain__ = !!chainAll; 20724 this.__index__ = 0; 20725 this.__values__ = undefined; 20726 } 20727 20728 /** 20729 * By default, the template delimiters used by lodash are like those in 20730 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 20731 * following template settings to use alternative delimiters. 20732 * 20733 * @static 20734 * @memberOf _ 20735 * @type {Object} 20736 */ 20737 lodash.templateSettings = { 20738 20739 /** 20740 * Used to detect `data` property values to be HTML-escaped. 20741 * 20742 * @memberOf _.templateSettings 20743 * @type {RegExp} 20744 */ 20745 'escape': reEscape, 20746 20747 /** 20748 * Used to detect code to be evaluated. 20749 * 20750 * @memberOf _.templateSettings 20751 * @type {RegExp} 20752 */ 20753 'evaluate': reEvaluate, 20754 20755 /** 20756 * Used to detect `data` property values to inject. 20757 * 20758 * @memberOf _.templateSettings 20759 * @type {RegExp} 20760 */ 20761 'interpolate': reInterpolate, 20762 20763 /** 20764 * Used to reference the data object in the template text. 20765 * 20766 * @memberOf _.templateSettings 20767 * @type {string} 20768 */ 20769 'variable': '', 20770 20771 /** 20772 * Used to import variables into the compiled template. 20773 * 20774 * @memberOf _.templateSettings 20775 * @type {Object} 20776 */ 20777 'imports': { 20778 20779 /** 20780 * A reference to the `lodash` function. 20781 * 20782 * @memberOf _.templateSettings.imports 20783 * @type {Function} 20784 */ 20785 '_': lodash 20786 } 20787 }; 20788 20789 // Ensure wrappers are instances of `baseLodash`. 20790 lodash.prototype = baseLodash.prototype; 20791 lodash.prototype.constructor = lodash; 20792 20793 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 20794 LodashWrapper.prototype.constructor = LodashWrapper; 20795 20796 /*------------------------------------------------------------------------*/ 20797 20798 /** 20799 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 20800 * 20801 * @private 20802 * @constructor 20803 * @param {*} value The value to wrap. 20804 */ 20805 function LazyWrapper(value) { 20806 this.__wrapped__ = value; 20807 this.__actions__ = []; 20808 this.__dir__ = 1; 20809 this.__filtered__ = false; 20810 this.__iteratees__ = []; 20811 this.__takeCount__ = MAX_ARRAY_LENGTH; 20812 this.__views__ = []; 20813 } 20814 20815 /** 20816 * Creates a clone of the lazy wrapper object. 20817 * 20818 * @private 20819 * @name clone 20820 * @memberOf LazyWrapper 20821 * @returns {Object} Returns the cloned `LazyWrapper` object. 20822 */ 20823 function lazyClone() { 20824 var result = new LazyWrapper(this.__wrapped__); 20825 result.__actions__ = copyArray(this.__actions__); 20826 result.__dir__ = this.__dir__; 20827 result.__filtered__ = this.__filtered__; 20828 result.__iteratees__ = copyArray(this.__iteratees__); 20829 result.__takeCount__ = this.__takeCount__; 20830 result.__views__ = copyArray(this.__views__); 20831 return result; 20832 } 20833 20834 /** 20835 * Reverses the direction of lazy iteration. 20836 * 20837 * @private 20838 * @name reverse 20839 * @memberOf LazyWrapper 20840 * @returns {Object} Returns the new reversed `LazyWrapper` object. 20841 */ 20842 function lazyReverse() { 20843 if (this.__filtered__) { 20844 var result = new LazyWrapper(this); 20845 result.__dir__ = -1; 20846 result.__filtered__ = true; 20847 } else { 20848 result = this.clone(); 20849 result.__dir__ *= -1; 20850 } 20851 return result; 20852 } 20853 20854 /** 20855 * Extracts the unwrapped value from its lazy wrapper. 20856 * 20857 * @private 20858 * @name value 20859 * @memberOf LazyWrapper 20860 * @returns {*} Returns the unwrapped value. 20861 */ 20862 function lazyValue() { 20863 var array = this.__wrapped__.value(), 20864 dir = this.__dir__, 20865 isArr = isArray(array), 20866 isRight = dir < 0, 20867 arrLength = isArr ? array.length : 0, 20868 view = getView(0, arrLength, this.__views__), 20869 start = view.start, 20870 end = view.end, 20871 length = end - start, 20872 index = isRight ? end : (start - 1), 20873 iteratees = this.__iteratees__, 20874 iterLength = iteratees.length, 20875 resIndex = 0, 20876 takeCount = nativeMin(length, this.__takeCount__); 20877 20878 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 20879 return baseWrapperValue(array, this.__actions__); 20880 } 20881 var result = []; 20882 20883 outer: 20884 while (length-- && resIndex < takeCount) { 20885 index += dir; 20886 20887 var iterIndex = -1, 20888 value = array[index]; 20889 20890 while (++iterIndex < iterLength) { 20891 var data = iteratees[iterIndex], 20892 iteratee = data.iteratee, 20893 type = data.type, 20894 computed = iteratee(value); 20895 20896 if (type == LAZY_MAP_FLAG) { 20897 value = computed; 20898 } else if (!computed) { 20899 if (type == LAZY_FILTER_FLAG) { 20900 continue outer; 20901 } else { 20902 break outer; 20903 } 20904 } 20905 } 20906 result[resIndex++] = value; 20907 } 20908 return result; 20909 } 20910 20911 // Ensure `LazyWrapper` is an instance of `baseLodash`. 20912 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 20913 LazyWrapper.prototype.constructor = LazyWrapper; 20914 20915 /*------------------------------------------------------------------------*/ 20916 20917 /** 20918 * Creates a hash object. 20919 * 20920 * @private 20921 * @constructor 20922 * @param {Array} [entries] The key-value pairs to cache. 20923 */ 20924 function Hash(entries) { 20925 var index = -1, 20926 length = entries == null ? 0 : entries.length; 20927 20928 this.clear(); 20929 while (++index < length) { 20930 var entry = entries[index]; 20931 this.set(entry[0], entry[1]); 20932 } 20933 } 20934 20935 /** 20936 * Removes all key-value entries from the hash. 20937 * 20938 * @private 20939 * @name clear 20940 * @memberOf Hash 20941 */ 20942 function hashClear() { 20943 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 20944 this.size = 0; 20945 } 20946 20947 /** 20948 * Removes `key` and its value from the hash. 20949 * 20950 * @private 20951 * @name delete 20952 * @memberOf Hash 20953 * @param {Object} hash The hash to modify. 20954 * @param {string} key The key of the value to remove. 20955 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 20956 */ 20957 function hashDelete(key) { 20958 var result = this.has(key) && delete this.__data__[key]; 20959 this.size -= result ? 1 : 0; 20960 return result; 20961 } 20962 20963 /** 20964 * Gets the hash value for `key`. 20965 * 20966 * @private 20967 * @name get 20968 * @memberOf Hash 20969 * @param {string} key The key of the value to get. 20970 * @returns {*} Returns the entry value. 20971 */ 20972 function hashGet(key) { 20973 var data = this.__data__; 20974 if (nativeCreate) { 20975 var result = data[key]; 20976 return result === HASH_UNDEFINED ? undefined : result; 20977 } 20978 return hasOwnProperty.call(data, key) ? data[key] : undefined; 20979 } 20980 20981 /** 20982 * Checks if a hash value for `key` exists. 20983 * 20984 * @private 20985 * @name has 20986 * @memberOf Hash 20987 * @param {string} key The key of the entry to check. 20988 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 20989 */ 20990 function hashHas(key) { 20991 var data = this.__data__; 20992 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 20993 } 20994 20995 /** 20996 * Sets the hash `key` to `value`. 20997 * 20998 * @private 20999 * @name set 21000 * @memberOf Hash 21001 * @param {string} key The key of the value to set. 21002 * @param {*} value The value to set. 21003 * @returns {Object} Returns the hash instance. 21004 */ 21005 function hashSet(key, value) { 21006 var data = this.__data__; 21007 this.size += this.has(key) ? 0 : 1; 21008 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 21009 return this; 21010 } 21011 21012 // Add methods to `Hash`. 21013 Hash.prototype.clear = hashClear; 21014 Hash.prototype['delete'] = hashDelete; 21015 Hash.prototype.get = hashGet; 21016 Hash.prototype.has = hashHas; 21017 Hash.prototype.set = hashSet; 21018 21019 /*------------------------------------------------------------------------*/ 21020 21021 /** 21022 * Creates an list cache object. 21023 * 21024 * @private 21025 * @constructor 21026 * @param {Array} [entries] The key-value pairs to cache. 21027 */ 21028 function ListCache(entries) { 21029 var index = -1, 21030 length = entries == null ? 0 : entries.length; 21031 21032 this.clear(); 21033 while (++index < length) { 21034 var entry = entries[index]; 21035 this.set(entry[0], entry[1]); 21036 } 21037 } 21038 21039 /** 21040 * Removes all key-value entries from the list cache. 21041 * 21042 * @private 21043 * @name clear 21044 * @memberOf ListCache 21045 */ 21046 function listCacheClear() { 21047 this.__data__ = []; 21048 this.size = 0; 21049 } 21050 21051 /** 21052 * Removes `key` and its value from the list cache. 21053 * 21054 * @private 21055 * @name delete 21056 * @memberOf ListCache 21057 * @param {string} key The key of the value to remove. 21058 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21059 */ 21060 function listCacheDelete(key) { 21061 var data = this.__data__, 21062 index = assocIndexOf(data, key); 21063 21064 if (index < 0) { 21065 return false; 21066 } 21067 var lastIndex = data.length - 1; 21068 if (index == lastIndex) { 21069 data.pop(); 21070 } else { 21071 splice.call(data, index, 1); 21072 } 21073 --this.size; 21074 return true; 21075 } 21076 21077 /** 21078 * Gets the list cache value for `key`. 21079 * 21080 * @private 21081 * @name get 21082 * @memberOf ListCache 21083 * @param {string} key The key of the value to get. 21084 * @returns {*} Returns the entry value. 21085 */ 21086 function listCacheGet(key) { 21087 var data = this.__data__, 21088 index = assocIndexOf(data, key); 21089 21090 return index < 0 ? undefined : data[index][1]; 21091 } 21092 21093 /** 21094 * Checks if a list cache value for `key` exists. 21095 * 21096 * @private 21097 * @name has 21098 * @memberOf ListCache 21099 * @param {string} key The key of the entry to check. 21100 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21101 */ 21102 function listCacheHas(key) { 21103 return assocIndexOf(this.__data__, key) > -1; 21104 } 21105 21106 /** 21107 * Sets the list cache `key` to `value`. 21108 * 21109 * @private 21110 * @name set 21111 * @memberOf ListCache 21112 * @param {string} key The key of the value to set. 21113 * @param {*} value The value to set. 21114 * @returns {Object} Returns the list cache instance. 21115 */ 21116 function listCacheSet(key, value) { 21117 var data = this.__data__, 21118 index = assocIndexOf(data, key); 21119 21120 if (index < 0) { 21121 ++this.size; 21122 data.push([key, value]); 21123 } else { 21124 data[index][1] = value; 21125 } 21126 return this; 21127 } 21128 21129 // Add methods to `ListCache`. 21130 ListCache.prototype.clear = listCacheClear; 21131 ListCache.prototype['delete'] = listCacheDelete; 21132 ListCache.prototype.get = listCacheGet; 21133 ListCache.prototype.has = listCacheHas; 21134 ListCache.prototype.set = listCacheSet; 21135 21136 /*------------------------------------------------------------------------*/ 21137 21138 /** 21139 * Creates a map cache object to store key-value pairs. 21140 * 21141 * @private 21142 * @constructor 21143 * @param {Array} [entries] The key-value pairs to cache. 21144 */ 21145 function MapCache(entries) { 21146 var index = -1, 21147 length = entries == null ? 0 : entries.length; 21148 21149 this.clear(); 21150 while (++index < length) { 21151 var entry = entries[index]; 21152 this.set(entry[0], entry[1]); 21153 } 21154 } 21155 21156 /** 21157 * Removes all key-value entries from the map. 21158 * 21159 * @private 21160 * @name clear 21161 * @memberOf MapCache 21162 */ 21163 function mapCacheClear() { 21164 this.size = 0; 21165 this.__data__ = { 21166 'hash': new Hash, 21167 'map': new (Map || ListCache), 21168 'string': new Hash 21169 }; 21170 } 21171 21172 /** 21173 * Removes `key` and its value from the map. 21174 * 21175 * @private 21176 * @name delete 21177 * @memberOf MapCache 21178 * @param {string} key The key of the value to remove. 21179 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21180 */ 21181 function mapCacheDelete(key) { 21182 var result = getMapData(this, key)['delete'](key); 21183 this.size -= result ? 1 : 0; 21184 return result; 21185 } 21186 21187 /** 21188 * Gets the map value for `key`. 21189 * 21190 * @private 21191 * @name get 21192 * @memberOf MapCache 21193 * @param {string} key The key of the value to get. 21194 * @returns {*} Returns the entry value. 21195 */ 21196 function mapCacheGet(key) { 21197 return getMapData(this, key).get(key); 21198 } 21199 21200 /** 21201 * Checks if a map value for `key` exists. 21202 * 21203 * @private 21204 * @name has 21205 * @memberOf MapCache 21206 * @param {string} key The key of the entry to check. 21207 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21208 */ 21209 function mapCacheHas(key) { 21210 return getMapData(this, key).has(key); 21211 } 21212 21213 /** 21214 * Sets the map `key` to `value`. 21215 * 21216 * @private 21217 * @name set 21218 * @memberOf MapCache 21219 * @param {string} key The key of the value to set. 21220 * @param {*} value The value to set. 21221 * @returns {Object} Returns the map cache instance. 21222 */ 21223 function mapCacheSet(key, value) { 21224 var data = getMapData(this, key), 21225 size = data.size; 21226 21227 data.set(key, value); 21228 this.size += data.size == size ? 0 : 1; 21229 return this; 21230 } 21231 21232 // Add methods to `MapCache`. 21233 MapCache.prototype.clear = mapCacheClear; 21234 MapCache.prototype['delete'] = mapCacheDelete; 21235 MapCache.prototype.get = mapCacheGet; 21236 MapCache.prototype.has = mapCacheHas; 21237 MapCache.prototype.set = mapCacheSet; 21238 21239 /*------------------------------------------------------------------------*/ 21240 21241 /** 21242 * 21243 * Creates an array cache object to store unique values. 21244 * 21245 * @private 21246 * @constructor 21247 * @param {Array} [values] The values to cache. 21248 */ 21249 function SetCache(values) { 21250 var index = -1, 21251 length = values == null ? 0 : values.length; 21252 21253 this.__data__ = new MapCache; 21254 while (++index < length) { 21255 this.add(values[index]); 21256 } 21257 } 21258 21259 /** 21260 * Adds `value` to the array cache. 21261 * 21262 * @private 21263 * @name add 21264 * @memberOf SetCache 21265 * @alias push 21266 * @param {*} value The value to cache. 21267 * @returns {Object} Returns the cache instance. 21268 */ 21269 function setCacheAdd(value) { 21270 this.__data__.set(value, HASH_UNDEFINED); 21271 return this; 21272 } 21273 21274 /** 21275 * Checks if `value` is in the array cache. 21276 * 21277 * @private 21278 * @name has 21279 * @memberOf SetCache 21280 * @param {*} value The value to search for. 21281 * @returns {number} Returns `true` if `value` is found, else `false`. 21282 */ 21283 function setCacheHas(value) { 21284 return this.__data__.has(value); 21285 } 21286 21287 // Add methods to `SetCache`. 21288 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 21289 SetCache.prototype.has = setCacheHas; 21290 21291 /*------------------------------------------------------------------------*/ 21292 21293 /** 21294 * Creates a stack cache object to store key-value pairs. 21295 * 21296 * @private 21297 * @constructor 21298 * @param {Array} [entries] The key-value pairs to cache. 21299 */ 21300 function Stack(entries) { 21301 var data = this.__data__ = new ListCache(entries); 21302 this.size = data.size; 21303 } 21304 21305 /** 21306 * Removes all key-value entries from the stack. 21307 * 21308 * @private 21309 * @name clear 21310 * @memberOf Stack 21311 */ 21312 function stackClear() { 21313 this.__data__ = new ListCache; 21314 this.size = 0; 21315 } 21316 21317 /** 21318 * Removes `key` and its value from the stack. 21319 * 21320 * @private 21321 * @name delete 21322 * @memberOf Stack 21323 * @param {string} key The key of the value to remove. 21324 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21325 */ 21326 function stackDelete(key) { 21327 var data = this.__data__, 21328 result = data['delete'](key); 21329 21330 this.size = data.size; 21331 return result; 21332 } 21333 21334 /** 21335 * Gets the stack value for `key`. 21336 * 21337 * @private 21338 * @name get 21339 * @memberOf Stack 21340 * @param {string} key The key of the value to get. 21341 * @returns {*} Returns the entry value. 21342 */ 21343 function stackGet(key) { 21344 return this.__data__.get(key); 21345 } 21346 21347 /** 21348 * Checks if a stack value for `key` exists. 21349 * 21350 * @private 21351 * @name has 21352 * @memberOf Stack 21353 * @param {string} key The key of the entry to check. 21354 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21355 */ 21356 function stackHas(key) { 21357 return this.__data__.has(key); 21358 } 21359 21360 /** 21361 * Sets the stack `key` to `value`. 21362 * 21363 * @private 21364 * @name set 21365 * @memberOf Stack 21366 * @param {string} key The key of the value to set. 21367 * @param {*} value The value to set. 21368 * @returns {Object} Returns the stack cache instance. 21369 */ 21370 function stackSet(key, value) { 21371 var data = this.__data__; 21372 if (data instanceof ListCache) { 21373 var pairs = data.__data__; 21374 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 21375 pairs.push([key, value]); 21376 this.size = ++data.size; 21377 return this; 21378 } 21379 data = this.__data__ = new MapCache(pairs); 21380 } 21381 data.set(key, value); 21382 this.size = data.size; 21383 return this; 21384 } 21385 21386 // Add methods to `Stack`. 21387 Stack.prototype.clear = stackClear; 21388 Stack.prototype['delete'] = stackDelete; 21389 Stack.prototype.get = stackGet; 21390 Stack.prototype.has = stackHas; 21391 Stack.prototype.set = stackSet; 21392 21393 /*------------------------------------------------------------------------*/ 21394 21395 /** 21396 * Creates an array of the enumerable property names of the array-like `value`. 21397 * 21398 * @private 21399 * @param {*} value The value to query. 21400 * @param {boolean} inherited Specify returning inherited property names. 21401 * @returns {Array} Returns the array of property names. 21402 */ 21403 function arrayLikeKeys(value, inherited) { 21404 var isArr = isArray(value), 21405 isArg = !isArr && isArguments(value), 21406 isBuff = !isArr && !isArg && isBuffer(value), 21407 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 21408 skipIndexes = isArr || isArg || isBuff || isType, 21409 result = skipIndexes ? baseTimes(value.length, String) : [], 21410 length = result.length; 21411 21412 for (var key in value) { 21413 if ((inherited || hasOwnProperty.call(value, key)) && 21414 !(skipIndexes && ( 21415 // Safari 9 has enumerable `arguments.length` in strict mode. 21416 key == 'length' || 21417 // Node.js 0.10 has enumerable non-index properties on buffers. 21418 (isBuff && (key == 'offset' || key == 'parent')) || 21419 // PhantomJS 2 has enumerable non-index properties on typed arrays. 21420 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 21421 // Skip index properties. 21422 isIndex(key, length) 21423 ))) { 21424 result.push(key); 21425 } 21426 } 21427 return result; 21428 } 21429 21430 /** 21431 * A specialized version of `_.sample` for arrays. 21432 * 21433 * @private 21434 * @param {Array} array The array to sample. 21435 * @returns {*} Returns the random element. 21436 */ 21437 function arraySample(array) { 21438 var length = array.length; 21439 return length ? array[baseRandom(0, length - 1)] : undefined; 21440 } 21441 21442 /** 21443 * A specialized version of `_.sampleSize` for arrays. 21444 * 21445 * @private 21446 * @param {Array} array The array to sample. 21447 * @param {number} n The number of elements to sample. 21448 * @returns {Array} Returns the random elements. 21449 */ 21450 function arraySampleSize(array, n) { 21451 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 21452 } 21453 21454 /** 21455 * A specialized version of `_.shuffle` for arrays. 21456 * 21457 * @private 21458 * @param {Array} array The array to shuffle. 21459 * @returns {Array} Returns the new shuffled array. 21460 */ 21461 function arrayShuffle(array) { 21462 return shuffleSelf(copyArray(array)); 21463 } 21464 21465 /** 21466 * This function is like `assignValue` except that it doesn't assign 21467 * `undefined` values. 21468 * 21469 * @private 21470 * @param {Object} object The object to modify. 21471 * @param {string} key The key of the property to assign. 21472 * @param {*} value The value to assign. 21473 */ 21474 function assignMergeValue(object, key, value) { 21475 if ((value !== undefined && !eq(object[key], value)) || 21476 (value === undefined && !(key in object))) { 21477 baseAssignValue(object, key, value); 21478 } 21479 } 21480 21481 /** 21482 * Assigns `value` to `key` of `object` if the existing value is not equivalent 21483 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 21484 * for equality comparisons. 21485 * 21486 * @private 21487 * @param {Object} object The object to modify. 21488 * @param {string} key The key of the property to assign. 21489 * @param {*} value The value to assign. 21490 */ 21491 function assignValue(object, key, value) { 21492 var objValue = object[key]; 21493 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 21494 (value === undefined && !(key in object))) { 21495 baseAssignValue(object, key, value); 21496 } 21497 } 21498 21499 /** 21500 * Gets the index at which the `key` is found in `array` of key-value pairs. 21501 * 21502 * @private 21503 * @param {Array} array The array to inspect. 21504 * @param {*} key The key to search for. 21505 * @returns {number} Returns the index of the matched value, else `-1`. 21506 */ 21507 function assocIndexOf(array, key) { 21508 var length = array.length; 21509 while (length--) { 21510 if (eq(array[length][0], key)) { 21511 return length; 21512 } 21513 } 21514 return -1; 21515 } 21516 21517 /** 21518 * Aggregates elements of `collection` on `accumulator` with keys transformed 21519 * by `iteratee` and values set by `setter`. 21520 * 21521 * @private 21522 * @param {Array|Object} collection The collection to iterate over. 21523 * @param {Function} setter The function to set `accumulator` values. 21524 * @param {Function} iteratee The iteratee to transform keys. 21525 * @param {Object} accumulator The initial aggregated object. 21526 * @returns {Function} Returns `accumulator`. 21527 */ 21528 function baseAggregator(collection, setter, iteratee, accumulator) { 21529 baseEach(collection, function(value, key, collection) { 21530 setter(accumulator, value, iteratee(value), collection); 21531 }); 21532 return accumulator; 21533 } 21534 21535 /** 21536 * The base implementation of `_.assign` without support for multiple sources 21537 * or `customizer` functions. 21538 * 21539 * @private 21540 * @param {Object} object The destination object. 21541 * @param {Object} source The source object. 21542 * @returns {Object} Returns `object`. 21543 */ 21544 function baseAssign(object, source) { 21545 return object && copyObject(source, keys(source), object); 21546 } 21547 21548 /** 21549 * The base implementation of `_.assignIn` without support for multiple sources 21550 * or `customizer` functions. 21551 * 21552 * @private 21553 * @param {Object} object The destination object. 21554 * @param {Object} source The source object. 21555 * @returns {Object} Returns `object`. 21556 */ 21557 function baseAssignIn(object, source) { 21558 return object && copyObject(source, keysIn(source), object); 21559 } 21560 21561 /** 21562 * The base implementation of `assignValue` and `assignMergeValue` without 21563 * value checks. 21564 * 21565 * @private 21566 * @param {Object} object The object to modify. 21567 * @param {string} key The key of the property to assign. 21568 * @param {*} value The value to assign. 21569 */ 21570 function baseAssignValue(object, key, value) { 21571 if (key == '__proto__' && defineProperty) { 21572 defineProperty(object, key, { 21573 'configurable': true, 21574 'enumerable': true, 21575 'value': value, 21576 'writable': true 21577 }); 21578 } else { 21579 object[key] = value; 21580 } 21581 } 21582 21583 /** 21584 * The base implementation of `_.at` without support for individual paths. 21585 * 21586 * @private 21587 * @param {Object} object The object to iterate over. 21588 * @param {string[]} paths The property paths to pick. 21589 * @returns {Array} Returns the picked elements. 21590 */ 21591 function baseAt(object, paths) { 21592 var index = -1, 21593 length = paths.length, 21594 result = Array(length), 21595 skip = object == null; 21596 21597 while (++index < length) { 21598 result[index] = skip ? undefined : get(object, paths[index]); 21599 } 21600 return result; 21601 } 21602 21603 /** 21604 * The base implementation of `_.clamp` which doesn't coerce arguments. 21605 * 21606 * @private 21607 * @param {number} number The number to clamp. 21608 * @param {number} [lower] The lower bound. 21609 * @param {number} upper The upper bound. 21610 * @returns {number} Returns the clamped number. 21611 */ 21612 function baseClamp(number, lower, upper) { 21613 if (number === number) { 21614 if (upper !== undefined) { 21615 number = number <= upper ? number : upper; 21616 } 21617 if (lower !== undefined) { 21618 number = number >= lower ? number : lower; 21619 } 21620 } 21621 return number; 21622 } 21623 21624 /** 21625 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 21626 * traversed objects. 21627 * 21628 * @private 21629 * @param {*} value The value to clone. 21630 * @param {boolean} bitmask The bitmask flags. 21631 * 1 - Deep clone 21632 * 2 - Flatten inherited properties 21633 * 4 - Clone symbols 21634 * @param {Function} [customizer] The function to customize cloning. 21635 * @param {string} [key] The key of `value`. 21636 * @param {Object} [object] The parent object of `value`. 21637 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 21638 * @returns {*} Returns the cloned value. 21639 */ 21640 function baseClone(value, bitmask, customizer, key, object, stack) { 21641 var result, 21642 isDeep = bitmask & CLONE_DEEP_FLAG, 21643 isFlat = bitmask & CLONE_FLAT_FLAG, 21644 isFull = bitmask & CLONE_SYMBOLS_FLAG; 21645 21646 if (customizer) { 21647 result = object ? customizer(value, key, object, stack) : customizer(value); 21648 } 21649 if (result !== undefined) { 21650 return result; 21651 } 21652 if (!isObject(value)) { 21653 return value; 21654 } 21655 var isArr = isArray(value); 21656 if (isArr) { 21657 result = initCloneArray(value); 21658 if (!isDeep) { 21659 return copyArray(value, result); 21660 } 21661 } else { 21662 var tag = getTag(value), 21663 isFunc = tag == funcTag || tag == genTag; 21664 21665 if (isBuffer(value)) { 21666 return cloneBuffer(value, isDeep); 21667 } 21668 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 21669 result = (isFlat || isFunc) ? {} : initCloneObject(value); 21670 if (!isDeep) { 21671 return isFlat 21672 ? copySymbolsIn(value, baseAssignIn(result, value)) 21673 : copySymbols(value, baseAssign(result, value)); 21674 } 21675 } else { 21676 if (!cloneableTags[tag]) { 21677 return object ? value : {}; 21678 } 21679 result = initCloneByTag(value, tag, isDeep); 21680 } 21681 } 21682 // Check for circular references and return its corresponding clone. 21683 stack || (stack = new Stack); 21684 var stacked = stack.get(value); 21685 if (stacked) { 21686 return stacked; 21687 } 21688 stack.set(value, result); 21689 21690 if (isSet(value)) { 21691 value.forEach(function(subValue) { 21692 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 21693 }); 21694 } else if (isMap(value)) { 21695 value.forEach(function(subValue, key) { 21696 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 21697 }); 21698 } 21699 21700 var keysFunc = isFull 21701 ? (isFlat ? getAllKeysIn : getAllKeys) 21702 : (isFlat ? keysIn : keys); 21703 21704 var props = isArr ? undefined : keysFunc(value); 21705 arrayEach(props || value, function(subValue, key) { 21706 if (props) { 21707 key = subValue; 21708 subValue = value[key]; 21709 } 21710 // Recursively populate clone (susceptible to call stack limits). 21711 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 21712 }); 21713 return result; 21714 } 21715 21716 /** 21717 * The base implementation of `_.conforms` which doesn't clone `source`. 21718 * 21719 * @private 21720 * @param {Object} source The object of property predicates to conform to. 21721 * @returns {Function} Returns the new spec function. 21722 */ 21723 function baseConforms(source) { 21724 var props = keys(source); 21725 return function(object) { 21726 return baseConformsTo(object, source, props); 21727 }; 21728 } 21729 21730 /** 21731 * The base implementation of `_.conformsTo` which accepts `props` to check. 21732 * 21733 * @private 21734 * @param {Object} object The object to inspect. 21735 * @param {Object} source The object of property predicates to conform to. 21736 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 21737 */ 21738 function baseConformsTo(object, source, props) { 21739 var length = props.length; 21740 if (object == null) { 21741 return !length; 21742 } 21743 object = Object(object); 21744 while (length--) { 21745 var key = props[length], 21746 predicate = source[key], 21747 value = object[key]; 21748 21749 if ((value === undefined && !(key in object)) || !predicate(value)) { 21750 return false; 21751 } 21752 } 21753 return true; 21754 } 21755 21756 /** 21757 * The base implementation of `_.delay` and `_.defer` which accepts `args` 21758 * to provide to `func`. 21759 * 21760 * @private 21761 * @param {Function} func The function to delay. 21762 * @param {number} wait The number of milliseconds to delay invocation. 21763 * @param {Array} args The arguments to provide to `func`. 21764 * @returns {number|Object} Returns the timer id or timeout object. 21765 */ 21766 function baseDelay(func, wait, args) { 21767 if (typeof func != 'function') { 21768 throw new TypeError(FUNC_ERROR_TEXT); 21769 } 21770 return setTimeout(function() { func.apply(undefined, args); }, wait); 21771 } 21772 21773 /** 21774 * The base implementation of methods like `_.difference` without support 21775 * for excluding multiple arrays or iteratee shorthands. 21776 * 21777 * @private 21778 * @param {Array} array The array to inspect. 21779 * @param {Array} values The values to exclude. 21780 * @param {Function} [iteratee] The iteratee invoked per element. 21781 * @param {Function} [comparator] The comparator invoked per element. 21782 * @returns {Array} Returns the new array of filtered values. 21783 */ 21784 function baseDifference(array, values, iteratee, comparator) { 21785 var index = -1, 21786 includes = arrayIncludes, 21787 isCommon = true, 21788 length = array.length, 21789 result = [], 21790 valuesLength = values.length; 21791 21792 if (!length) { 21793 return result; 21794 } 21795 if (iteratee) { 21796 values = arrayMap(values, baseUnary(iteratee)); 21797 } 21798 if (comparator) { 21799 includes = arrayIncludesWith; 21800 isCommon = false; 21801 } 21802 else if (values.length >= LARGE_ARRAY_SIZE) { 21803 includes = cacheHas; 21804 isCommon = false; 21805 values = new SetCache(values); 21806 } 21807 outer: 21808 while (++index < length) { 21809 var value = array[index], 21810 computed = iteratee == null ? value : iteratee(value); 21811 21812 value = (comparator || value !== 0) ? value : 0; 21813 if (isCommon && computed === computed) { 21814 var valuesIndex = valuesLength; 21815 while (valuesIndex--) { 21816 if (values[valuesIndex] === computed) { 21817 continue outer; 21818 } 21819 } 21820 result.push(value); 21821 } 21822 else if (!includes(values, computed, comparator)) { 21823 result.push(value); 21824 } 21825 } 21826 return result; 21827 } 21828 21829 /** 21830 * The base implementation of `_.forEach` without support for iteratee shorthands. 21831 * 21832 * @private 21833 * @param {Array|Object} collection The collection to iterate over. 21834 * @param {Function} iteratee The function invoked per iteration. 21835 * @returns {Array|Object} Returns `collection`. 21836 */ 21837 var baseEach = createBaseEach(baseForOwn); 21838 21839 /** 21840 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 21841 * 21842 * @private 21843 * @param {Array|Object} collection The collection to iterate over. 21844 * @param {Function} iteratee The function invoked per iteration. 21845 * @returns {Array|Object} Returns `collection`. 21846 */ 21847 var baseEachRight = createBaseEach(baseForOwnRight, true); 21848 21849 /** 21850 * The base implementation of `_.every` without support for iteratee shorthands. 21851 * 21852 * @private 21853 * @param {Array|Object} collection The collection to iterate over. 21854 * @param {Function} predicate The function invoked per iteration. 21855 * @returns {boolean} Returns `true` if all elements pass the predicate check, 21856 * else `false` 21857 */ 21858 function baseEvery(collection, predicate) { 21859 var result = true; 21860 baseEach(collection, function(value, index, collection) { 21861 result = !!predicate(value, index, collection); 21862 return result; 21863 }); 21864 return result; 21865 } 21866 21867 /** 21868 * The base implementation of methods like `_.max` and `_.min` which accepts a 21869 * `comparator` to determine the extremum value. 21870 * 21871 * @private 21872 * @param {Array} array The array to iterate over. 21873 * @param {Function} iteratee The iteratee invoked per iteration. 21874 * @param {Function} comparator The comparator used to compare values. 21875 * @returns {*} Returns the extremum value. 21876 */ 21877 function baseExtremum(array, iteratee, comparator) { 21878 var index = -1, 21879 length = array.length; 21880 21881 while (++index < length) { 21882 var value = array[index], 21883 current = iteratee(value); 21884 21885 if (current != null && (computed === undefined 21886 ? (current === current && !isSymbol(current)) 21887 : comparator(current, computed) 21888 )) { 21889 var computed = current, 21890 result = value; 21891 } 21892 } 21893 return result; 21894 } 21895 21896 /** 21897 * The base implementation of `_.fill` without an iteratee call guard. 21898 * 21899 * @private 21900 * @param {Array} array The array to fill. 21901 * @param {*} value The value to fill `array` with. 21902 * @param {number} [start=0] The start position. 21903 * @param {number} [end=array.length] The end position. 21904 * @returns {Array} Returns `array`. 21905 */ 21906 function baseFill(array, value, start, end) { 21907 var length = array.length; 21908 21909 start = toInteger(start); 21910 if (start < 0) { 21911 start = -start > length ? 0 : (length + start); 21912 } 21913 end = (end === undefined || end > length) ? length : toInteger(end); 21914 if (end < 0) { 21915 end += length; 21916 } 21917 end = start > end ? 0 : toLength(end); 21918 while (start < end) { 21919 array[start++] = value; 21920 } 21921 return array; 21922 } 21923 21924 /** 21925 * The base implementation of `_.filter` without support for iteratee shorthands. 21926 * 21927 * @private 21928 * @param {Array|Object} collection The collection to iterate over. 21929 * @param {Function} predicate The function invoked per iteration. 21930 * @returns {Array} Returns the new filtered array. 21931 */ 21932 function baseFilter(collection, predicate) { 21933 var result = []; 21934 baseEach(collection, function(value, index, collection) { 21935 if (predicate(value, index, collection)) { 21936 result.push(value); 21937 } 21938 }); 21939 return result; 21940 } 21941 21942 /** 21943 * The base implementation of `_.flatten` with support for restricting flattening. 21944 * 21945 * @private 21946 * @param {Array} array The array to flatten. 21947 * @param {number} depth The maximum recursion depth. 21948 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 21949 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 21950 * @param {Array} [result=[]] The initial result value. 21951 * @returns {Array} Returns the new flattened array. 21952 */ 21953 function baseFlatten(array, depth, predicate, isStrict, result) { 21954 var index = -1, 21955 length = array.length; 21956 21957 predicate || (predicate = isFlattenable); 21958 result || (result = []); 21959 21960 while (++index < length) { 21961 var value = array[index]; 21962 if (depth > 0 && predicate(value)) { 21963 if (depth > 1) { 21964 // Recursively flatten arrays (susceptible to call stack limits). 21965 baseFlatten(value, depth - 1, predicate, isStrict, result); 21966 } else { 21967 arrayPush(result, value); 21968 } 21969 } else if (!isStrict) { 21970 result[result.length] = value; 21971 } 21972 } 21973 return result; 21974 } 21975 21976 /** 21977 * The base implementation of `baseForOwn` which iterates over `object` 21978 * properties returned by `keysFunc` and invokes `iteratee` for each property. 21979 * Iteratee functions may exit iteration early by explicitly returning `false`. 21980 * 21981 * @private 21982 * @param {Object} object The object to iterate over. 21983 * @param {Function} iteratee The function invoked per iteration. 21984 * @param {Function} keysFunc The function to get the keys of `object`. 21985 * @returns {Object} Returns `object`. 21986 */ 21987 var baseFor = createBaseFor(); 21988 21989 /** 21990 * This function is like `baseFor` except that it iterates over properties 21991 * in the opposite order. 21992 * 21993 * @private 21994 * @param {Object} object The object to iterate over. 21995 * @param {Function} iteratee The function invoked per iteration. 21996 * @param {Function} keysFunc The function to get the keys of `object`. 21997 * @returns {Object} Returns `object`. 21998 */ 21999 var baseForRight = createBaseFor(true); 22000 22001 /** 22002 * The base implementation of `_.forOwn` without support for iteratee shorthands. 22003 * 22004 * @private 22005 * @param {Object} object The object to iterate over. 22006 * @param {Function} iteratee The function invoked per iteration. 22007 * @returns {Object} Returns `object`. 22008 */ 22009 function baseForOwn(object, iteratee) { 22010 return object && baseFor(object, iteratee, keys); 22011 } 22012 22013 /** 22014 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 22015 * 22016 * @private 22017 * @param {Object} object The object to iterate over. 22018 * @param {Function} iteratee The function invoked per iteration. 22019 * @returns {Object} Returns `object`. 22020 */ 22021 function baseForOwnRight(object, iteratee) { 22022 return object && baseForRight(object, iteratee, keys); 22023 } 22024 22025 /** 22026 * The base implementation of `_.functions` which creates an array of 22027 * `object` function property names filtered from `props`. 22028 * 22029 * @private 22030 * @param {Object} object The object to inspect. 22031 * @param {Array} props The property names to filter. 22032 * @returns {Array} Returns the function names. 22033 */ 22034 function baseFunctions(object, props) { 22035 return arrayFilter(props, function(key) { 22036 return isFunction(object[key]); 22037 }); 22038 } 22039 22040 /** 22041 * The base implementation of `_.get` without support for default values. 22042 * 22043 * @private 22044 * @param {Object} object The object to query. 22045 * @param {Array|string} path The path of the property to get. 22046 * @returns {*} Returns the resolved value. 22047 */ 22048 function baseGet(object, path) { 22049 path = castPath(path, object); 22050 22051 var index = 0, 22052 length = path.length; 22053 22054 while (object != null && index < length) { 22055 object = object[toKey(path[index++])]; 22056 } 22057 return (index && index == length) ? object : undefined; 22058 } 22059 22060 /** 22061 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 22062 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 22063 * symbols of `object`. 22064 * 22065 * @private 22066 * @param {Object} object The object to query. 22067 * @param {Function} keysFunc The function to get the keys of `object`. 22068 * @param {Function} symbolsFunc The function to get the symbols of `object`. 22069 * @returns {Array} Returns the array of property names and symbols. 22070 */ 22071 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 22072 var result = keysFunc(object); 22073 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 22074 } 22075 22076 /** 22077 * The base implementation of `getTag` without fallbacks for buggy environments. 22078 * 22079 * @private 22080 * @param {*} value The value to query. 22081 * @returns {string} Returns the `toStringTag`. 22082 */ 22083 function baseGetTag(value) { 22084 if (value == null) { 22085 return value === undefined ? undefinedTag : nullTag; 22086 } 22087 return (symToStringTag && symToStringTag in Object(value)) 22088 ? getRawTag(value) 22089 : objectToString(value); 22090 } 22091 22092 /** 22093 * The base implementation of `_.gt` which doesn't coerce arguments. 22094 * 22095 * @private 22096 * @param {*} value The value to compare. 22097 * @param {*} other The other value to compare. 22098 * @returns {boolean} Returns `true` if `value` is greater than `other`, 22099 * else `false`. 22100 */ 22101 function baseGt(value, other) { 22102 return value > other; 22103 } 22104 22105 /** 22106 * The base implementation of `_.has` without support for deep paths. 22107 * 22108 * @private 22109 * @param {Object} [object] The object to query. 22110 * @param {Array|string} key The key to check. 22111 * @returns {boolean} Returns `true` if `key` exists, else `false`. 22112 */ 22113 function baseHas(object, key) { 22114 return object != null && hasOwnProperty.call(object, key); 22115 } 22116 22117 /** 22118 * The base implementation of `_.hasIn` without support for deep paths. 22119 * 22120 * @private 22121 * @param {Object} [object] The object to query. 22122 * @param {Array|string} key The key to check. 22123 * @returns {boolean} Returns `true` if `key` exists, else `false`. 22124 */ 22125 function baseHasIn(object, key) { 22126 return object != null && key in Object(object); 22127 } 22128 22129 /** 22130 * The base implementation of `_.inRange` which doesn't coerce arguments. 22131 * 22132 * @private 22133 * @param {number} number The number to check. 22134 * @param {number} start The start of the range. 22135 * @param {number} end The end of the range. 22136 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 22137 */ 22138 function baseInRange(number, start, end) { 22139 return number >= nativeMin(start, end) && number < nativeMax(start, end); 22140 } 22141 22142 /** 22143 * The base implementation of methods like `_.intersection`, without support 22144 * for iteratee shorthands, that accepts an array of arrays to inspect. 22145 * 22146 * @private 22147 * @param {Array} arrays The arrays to inspect. 22148 * @param {Function} [iteratee] The iteratee invoked per element. 22149 * @param {Function} [comparator] The comparator invoked per element. 22150 * @returns {Array} Returns the new array of shared values. 22151 */ 22152 function baseIntersection(arrays, iteratee, comparator) { 22153 var includes = comparator ? arrayIncludesWith : arrayIncludes, 22154 length = arrays[0].length, 22155 othLength = arrays.length, 22156 othIndex = othLength, 22157 caches = Array(othLength), 22158 maxLength = Infinity, 22159 result = []; 22160 22161 while (othIndex--) { 22162 var array = arrays[othIndex]; 22163 if (othIndex && iteratee) { 22164 array = arrayMap(array, baseUnary(iteratee)); 22165 } 22166 maxLength = nativeMin(array.length, maxLength); 22167 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 22168 ? new SetCache(othIndex && array) 22169 : undefined; 22170 } 22171 array = arrays[0]; 22172 22173 var index = -1, 22174 seen = caches[0]; 22175 22176 outer: 22177 while (++index < length && result.length < maxLength) { 22178 var value = array[index], 22179 computed = iteratee ? iteratee(value) : value; 22180 22181 value = (comparator || value !== 0) ? value : 0; 22182 if (!(seen 22183 ? cacheHas(seen, computed) 22184 : includes(result, computed, comparator) 22185 )) { 22186 othIndex = othLength; 22187 while (--othIndex) { 22188 var cache = caches[othIndex]; 22189 if (!(cache 22190 ? cacheHas(cache, computed) 22191 : includes(arrays[othIndex], computed, comparator)) 22192 ) { 22193 continue outer; 22194 } 22195 } 22196 if (seen) { 22197 seen.push(computed); 22198 } 22199 result.push(value); 22200 } 22201 } 22202 return result; 22203 } 22204 22205 /** 22206 * The base implementation of `_.invert` and `_.invertBy` which inverts 22207 * `object` with values transformed by `iteratee` and set by `setter`. 22208 * 22209 * @private 22210 * @param {Object} object The object to iterate over. 22211 * @param {Function} setter The function to set `accumulator` values. 22212 * @param {Function} iteratee The iteratee to transform values. 22213 * @param {Object} accumulator The initial inverted object. 22214 * @returns {Function} Returns `accumulator`. 22215 */ 22216 function baseInverter(object, setter, iteratee, accumulator) { 22217 baseForOwn(object, function(value, key, object) { 22218 setter(accumulator, iteratee(value), key, object); 22219 }); 22220 return accumulator; 22221 } 22222 22223 /** 22224 * The base implementation of `_.invoke` without support for individual 22225 * method arguments. 22226 * 22227 * @private 22228 * @param {Object} object The object to query. 22229 * @param {Array|string} path The path of the method to invoke. 22230 * @param {Array} args The arguments to invoke the method with. 22231 * @returns {*} Returns the result of the invoked method. 22232 */ 22233 function baseInvoke(object, path, args) { 22234 path = castPath(path, object); 22235 object = parent(object, path); 22236 var func = object == null ? object : object[toKey(last(path))]; 22237 return func == null ? undefined : apply(func, object, args); 22238 } 22239 22240 /** 22241 * The base implementation of `_.isArguments`. 22242 * 22243 * @private 22244 * @param {*} value The value to check. 22245 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 22246 */ 22247 function baseIsArguments(value) { 22248 return isObjectLike(value) && baseGetTag(value) == argsTag; 22249 } 22250 22251 /** 22252 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 22253 * 22254 * @private 22255 * @param {*} value The value to check. 22256 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 22257 */ 22258 function baseIsArrayBuffer(value) { 22259 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 22260 } 22261 22262 /** 22263 * The base implementation of `_.isDate` without Node.js optimizations. 22264 * 22265 * @private 22266 * @param {*} value The value to check. 22267 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 22268 */ 22269 function baseIsDate(value) { 22270 return isObjectLike(value) && baseGetTag(value) == dateTag; 22271 } 22272 22273 /** 22274 * The base implementation of `_.isEqual` which supports partial comparisons 22275 * and tracks traversed objects. 22276 * 22277 * @private 22278 * @param {*} value The value to compare. 22279 * @param {*} other The other value to compare. 22280 * @param {boolean} bitmask The bitmask flags. 22281 * 1 - Unordered comparison 22282 * 2 - Partial comparison 22283 * @param {Function} [customizer] The function to customize comparisons. 22284 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 22285 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 22286 */ 22287 function baseIsEqual(value, other, bitmask, customizer, stack) { 22288 if (value === other) { 22289 return true; 22290 } 22291 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 22292 return value !== value && other !== other; 22293 } 22294 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 22295 } 22296 22297 /** 22298 * A specialized version of `baseIsEqual` for arrays and objects which performs 22299 * deep comparisons and tracks traversed objects enabling objects with circular 22300 * references to be compared. 22301 * 22302 * @private 22303 * @param {Object} object The object to compare. 22304 * @param {Object} other The other object to compare. 22305 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22306 * @param {Function} customizer The function to customize comparisons. 22307 * @param {Function} equalFunc The function to determine equivalents of values. 22308 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 22309 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 22310 */ 22311 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 22312 var objIsArr = isArray(object), 22313 othIsArr = isArray(other), 22314 objTag = objIsArr ? arrayTag : getTag(object), 22315 othTag = othIsArr ? arrayTag : getTag(other); 22316 22317 objTag = objTag == argsTag ? objectTag : objTag; 22318 othTag = othTag == argsTag ? objectTag : othTag; 22319 22320 var objIsObj = objTag == objectTag, 22321 othIsObj = othTag == objectTag, 22322 isSameTag = objTag == othTag; 22323 22324 if (isSameTag && isBuffer(object)) { 22325 if (!isBuffer(other)) { 22326 return false; 22327 } 22328 objIsArr = true; 22329 objIsObj = false; 22330 } 22331 if (isSameTag && !objIsObj) { 22332 stack || (stack = new Stack); 22333 return (objIsArr || isTypedArray(object)) 22334 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 22335 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 22336 } 22337 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 22338 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 22339 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 22340 22341 if (objIsWrapped || othIsWrapped) { 22342 var objUnwrapped = objIsWrapped ? object.value() : object, 22343 othUnwrapped = othIsWrapped ? other.value() : other; 22344 22345 stack || (stack = new Stack); 22346 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 22347 } 22348 } 22349 if (!isSameTag) { 22350 return false; 22351 } 22352 stack || (stack = new Stack); 22353 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 22354 } 22355 22356 /** 22357 * The base implementation of `_.isMap` without Node.js optimizations. 22358 * 22359 * @private 22360 * @param {*} value The value to check. 22361 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 22362 */ 22363 function baseIsMap(value) { 22364 return isObjectLike(value) && getTag(value) == mapTag; 22365 } 22366 22367 /** 22368 * The base implementation of `_.isMatch` without support for iteratee shorthands. 22369 * 22370 * @private 22371 * @param {Object} object The object to inspect. 22372 * @param {Object} source The object of property values to match. 22373 * @param {Array} matchData The property names, values, and compare flags to match. 22374 * @param {Function} [customizer] The function to customize comparisons. 22375 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 22376 */ 22377 function baseIsMatch(object, source, matchData, customizer) { 22378 var index = matchData.length, 22379 length = index, 22380 noCustomizer = !customizer; 22381 22382 if (object == null) { 22383 return !length; 22384 } 22385 object = Object(object); 22386 while (index--) { 22387 var data = matchData[index]; 22388 if ((noCustomizer && data[2]) 22389 ? data[1] !== object[data[0]] 22390 : !(data[0] in object) 22391 ) { 22392 return false; 22393 } 22394 } 22395 while (++index < length) { 22396 data = matchData[index]; 22397 var key = data[0], 22398 objValue = object[key], 22399 srcValue = data[1]; 22400 22401 if (noCustomizer && data[2]) { 22402 if (objValue === undefined && !(key in object)) { 22403 return false; 22404 } 22405 } else { 22406 var stack = new Stack; 22407 if (customizer) { 22408 var result = customizer(objValue, srcValue, key, object, source, stack); 22409 } 22410 if (!(result === undefined 22411 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 22412 : result 22413 )) { 22414 return false; 22415 } 22416 } 22417 } 22418 return true; 22419 } 22420 22421 /** 22422 * The base implementation of `_.isNative` without bad shim checks. 22423 * 22424 * @private 22425 * @param {*} value The value to check. 22426 * @returns {boolean} Returns `true` if `value` is a native function, 22427 * else `false`. 22428 */ 22429 function baseIsNative(value) { 22430 if (!isObject(value) || isMasked(value)) { 22431 return false; 22432 } 22433 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 22434 return pattern.test(toSource(value)); 22435 } 22436 22437 /** 22438 * The base implementation of `_.isRegExp` without Node.js optimizations. 22439 * 22440 * @private 22441 * @param {*} value The value to check. 22442 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 22443 */ 22444 function baseIsRegExp(value) { 22445 return isObjectLike(value) && baseGetTag(value) == regexpTag; 22446 } 22447 22448 /** 22449 * The base implementation of `_.isSet` without Node.js optimizations. 22450 * 22451 * @private 22452 * @param {*} value The value to check. 22453 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 22454 */ 22455 function baseIsSet(value) { 22456 return isObjectLike(value) && getTag(value) == setTag; 22457 } 22458 22459 /** 22460 * The base implementation of `_.isTypedArray` without Node.js optimizations. 22461 * 22462 * @private 22463 * @param {*} value The value to check. 22464 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 22465 */ 22466 function baseIsTypedArray(value) { 22467 return isObjectLike(value) && 22468 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 22469 } 22470 22471 /** 22472 * The base implementation of `_.iteratee`. 22473 * 22474 * @private 22475 * @param {*} [value=_.identity] The value to convert to an iteratee. 22476 * @returns {Function} Returns the iteratee. 22477 */ 22478 function baseIteratee(value) { 22479 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 22480 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 22481 if (typeof value == 'function') { 22482 return value; 22483 } 22484 if (value == null) { 22485 return identity; 22486 } 22487 if (typeof value == 'object') { 22488 return isArray(value) 22489 ? baseMatchesProperty(value[0], value[1]) 22490 : baseMatches(value); 22491 } 22492 return property(value); 22493 } 22494 22495 /** 22496 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 22497 * 22498 * @private 22499 * @param {Object} object The object to query. 22500 * @returns {Array} Returns the array of property names. 22501 */ 22502 function baseKeys(object) { 22503 if (!isPrototype(object)) { 22504 return nativeKeys(object); 22505 } 22506 var result = []; 22507 for (var key in Object(object)) { 22508 if (hasOwnProperty.call(object, key) && key != 'constructor') { 22509 result.push(key); 22510 } 22511 } 22512 return result; 22513 } 22514 22515 /** 22516 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 22517 * 22518 * @private 22519 * @param {Object} object The object to query. 22520 * @returns {Array} Returns the array of property names. 22521 */ 22522 function baseKeysIn(object) { 22523 if (!isObject(object)) { 22524 return nativeKeysIn(object); 22525 } 22526 var isProto = isPrototype(object), 22527 result = []; 22528 22529 for (var key in object) { 22530 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 22531 result.push(key); 22532 } 22533 } 22534 return result; 22535 } 22536 22537 /** 22538 * The base implementation of `_.lt` which doesn't coerce arguments. 22539 * 22540 * @private 22541 * @param {*} value The value to compare. 22542 * @param {*} other The other value to compare. 22543 * @returns {boolean} Returns `true` if `value` is less than `other`, 22544 * else `false`. 22545 */ 22546 function baseLt(value, other) { 22547 return value < other; 22548 } 22549 22550 /** 22551 * The base implementation of `_.map` without support for iteratee shorthands. 22552 * 22553 * @private 22554 * @param {Array|Object} collection The collection to iterate over. 22555 * @param {Function} iteratee The function invoked per iteration. 22556 * @returns {Array} Returns the new mapped array. 22557 */ 22558 function baseMap(collection, iteratee) { 22559 var index = -1, 22560 result = isArrayLike(collection) ? Array(collection.length) : []; 22561 22562 baseEach(collection, function(value, key, collection) { 22563 result[++index] = iteratee(value, key, collection); 22564 }); 22565 return result; 22566 } 22567 22568 /** 22569 * The base implementation of `_.matches` which doesn't clone `source`. 22570 * 22571 * @private 22572 * @param {Object} source The object of property values to match. 22573 * @returns {Function} Returns the new spec function. 22574 */ 22575 function baseMatches(source) { 22576 var matchData = getMatchData(source); 22577 if (matchData.length == 1 && matchData[0][2]) { 22578 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 22579 } 22580 return function(object) { 22581 return object === source || baseIsMatch(object, source, matchData); 22582 }; 22583 } 22584 22585 /** 22586 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 22587 * 22588 * @private 22589 * @param {string} path The path of the property to get. 22590 * @param {*} srcValue The value to match. 22591 * @returns {Function} Returns the new spec function. 22592 */ 22593 function baseMatchesProperty(path, srcValue) { 22594 if (isKey(path) && isStrictComparable(srcValue)) { 22595 return matchesStrictComparable(toKey(path), srcValue); 22596 } 22597 return function(object) { 22598 var objValue = get(object, path); 22599 return (objValue === undefined && objValue === srcValue) 22600 ? hasIn(object, path) 22601 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 22602 }; 22603 } 22604 22605 /** 22606 * The base implementation of `_.merge` without support for multiple sources. 22607 * 22608 * @private 22609 * @param {Object} object The destination object. 22610 * @param {Object} source The source object. 22611 * @param {number} srcIndex The index of `source`. 22612 * @param {Function} [customizer] The function to customize merged values. 22613 * @param {Object} [stack] Tracks traversed source values and their merged 22614 * counterparts. 22615 */ 22616 function baseMerge(object, source, srcIndex, customizer, stack) { 22617 if (object === source) { 22618 return; 22619 } 22620 baseFor(source, function(srcValue, key) { 22621 stack || (stack = new Stack); 22622 if (isObject(srcValue)) { 22623 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 22624 } 22625 else { 22626 var newValue = customizer 22627 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 22628 : undefined; 22629 22630 if (newValue === undefined) { 22631 newValue = srcValue; 22632 } 22633 assignMergeValue(object, key, newValue); 22634 } 22635 }, keysIn); 22636 } 22637 22638 /** 22639 * A specialized version of `baseMerge` for arrays and objects which performs 22640 * deep merges and tracks traversed objects enabling objects with circular 22641 * references to be merged. 22642 * 22643 * @private 22644 * @param {Object} object The destination object. 22645 * @param {Object} source The source object. 22646 * @param {string} key The key of the value to merge. 22647 * @param {number} srcIndex The index of `source`. 22648 * @param {Function} mergeFunc The function to merge values. 22649 * @param {Function} [customizer] The function to customize assigned values. 22650 * @param {Object} [stack] Tracks traversed source values and their merged 22651 * counterparts. 22652 */ 22653 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 22654 var objValue = safeGet(object, key), 22655 srcValue = safeGet(source, key), 22656 stacked = stack.get(srcValue); 22657 22658 if (stacked) { 22659 assignMergeValue(object, key, stacked); 22660 return; 22661 } 22662 var newValue = customizer 22663 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 22664 : undefined; 22665 22666 var isCommon = newValue === undefined; 22667 22668 if (isCommon) { 22669 var isArr = isArray(srcValue), 22670 isBuff = !isArr && isBuffer(srcValue), 22671 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 22672 22673 newValue = srcValue; 22674 if (isArr || isBuff || isTyped) { 22675 if (isArray(objValue)) { 22676 newValue = objValue; 22677 } 22678 else if (isArrayLikeObject(objValue)) { 22679 newValue = copyArray(objValue); 22680 } 22681 else if (isBuff) { 22682 isCommon = false; 22683 newValue = cloneBuffer(srcValue, true); 22684 } 22685 else if (isTyped) { 22686 isCommon = false; 22687 newValue = cloneTypedArray(srcValue, true); 22688 } 22689 else { 22690 newValue = []; 22691 } 22692 } 22693 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 22694 newValue = objValue; 22695 if (isArguments(objValue)) { 22696 newValue = toPlainObject(objValue); 22697 } 22698 else if (!isObject(objValue) || isFunction(objValue)) { 22699 newValue = initCloneObject(srcValue); 22700 } 22701 } 22702 else { 22703 isCommon = false; 22704 } 22705 } 22706 if (isCommon) { 22707 // Recursively merge objects and arrays (susceptible to call stack limits). 22708 stack.set(srcValue, newValue); 22709 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 22710 stack['delete'](srcValue); 22711 } 22712 assignMergeValue(object, key, newValue); 22713 } 22714 22715 /** 22716 * The base implementation of `_.nth` which doesn't coerce arguments. 22717 * 22718 * @private 22719 * @param {Array} array The array to query. 22720 * @param {number} n The index of the element to return. 22721 * @returns {*} Returns the nth element of `array`. 22722 */ 22723 function baseNth(array, n) { 22724 var length = array.length; 22725 if (!length) { 22726 return; 22727 } 22728 n += n < 0 ? length : 0; 22729 return isIndex(n, length) ? array[n] : undefined; 22730 } 22731 22732 /** 22733 * The base implementation of `_.orderBy` without param guards. 22734 * 22735 * @private 22736 * @param {Array|Object} collection The collection to iterate over. 22737 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 22738 * @param {string[]} orders The sort orders of `iteratees`. 22739 * @returns {Array} Returns the new sorted array. 22740 */ 22741 function baseOrderBy(collection, iteratees, orders) { 22742 var index = -1; 22743 iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); 22744 22745 var result = baseMap(collection, function(value, key, collection) { 22746 var criteria = arrayMap(iteratees, function(iteratee) { 22747 return iteratee(value); 22748 }); 22749 return { 'criteria': criteria, 'index': ++index, 'value': value }; 22750 }); 22751 22752 return baseSortBy(result, function(object, other) { 22753 return compareMultiple(object, other, orders); 22754 }); 22755 } 22756 22757 /** 22758 * The base implementation of `_.pick` without support for individual 22759 * property identifiers. 22760 * 22761 * @private 22762 * @param {Object} object The source object. 22763 * @param {string[]} paths The property paths to pick. 22764 * @returns {Object} Returns the new object. 22765 */ 22766 function basePick(object, paths) { 22767 return basePickBy(object, paths, function(value, path) { 22768 return hasIn(object, path); 22769 }); 22770 } 22771 22772 /** 22773 * The base implementation of `_.pickBy` without support for iteratee shorthands. 22774 * 22775 * @private 22776 * @param {Object} object The source object. 22777 * @param {string[]} paths The property paths to pick. 22778 * @param {Function} predicate The function invoked per property. 22779 * @returns {Object} Returns the new object. 22780 */ 22781 function basePickBy(object, paths, predicate) { 22782 var index = -1, 22783 length = paths.length, 22784 result = {}; 22785 22786 while (++index < length) { 22787 var path = paths[index], 22788 value = baseGet(object, path); 22789 22790 if (predicate(value, path)) { 22791 baseSet(result, castPath(path, object), value); 22792 } 22793 } 22794 return result; 22795 } 22796 22797 /** 22798 * A specialized version of `baseProperty` which supports deep paths. 22799 * 22800 * @private 22801 * @param {Array|string} path The path of the property to get. 22802 * @returns {Function} Returns the new accessor function. 22803 */ 22804 function basePropertyDeep(path) { 22805 return function(object) { 22806 return baseGet(object, path); 22807 }; 22808 } 22809 22810 /** 22811 * The base implementation of `_.pullAllBy` without support for iteratee 22812 * shorthands. 22813 * 22814 * @private 22815 * @param {Array} array The array to modify. 22816 * @param {Array} values The values to remove. 22817 * @param {Function} [iteratee] The iteratee invoked per element. 22818 * @param {Function} [comparator] The comparator invoked per element. 22819 * @returns {Array} Returns `array`. 22820 */ 22821 function basePullAll(array, values, iteratee, comparator) { 22822 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 22823 index = -1, 22824 length = values.length, 22825 seen = array; 22826 22827 if (array === values) { 22828 values = copyArray(values); 22829 } 22830 if (iteratee) { 22831 seen = arrayMap(array, baseUnary(iteratee)); 22832 } 22833 while (++index < length) { 22834 var fromIndex = 0, 22835 value = values[index], 22836 computed = iteratee ? iteratee(value) : value; 22837 22838 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 22839 if (seen !== array) { 22840 splice.call(seen, fromIndex, 1); 22841 } 22842 splice.call(array, fromIndex, 1); 22843 } 22844 } 22845 return array; 22846 } 22847 22848 /** 22849 * The base implementation of `_.pullAt` without support for individual 22850 * indexes or capturing the removed elements. 22851 * 22852 * @private 22853 * @param {Array} array The array to modify. 22854 * @param {number[]} indexes The indexes of elements to remove. 22855 * @returns {Array} Returns `array`. 22856 */ 22857 function basePullAt(array, indexes) { 22858 var length = array ? indexes.length : 0, 22859 lastIndex = length - 1; 22860 22861 while (length--) { 22862 var index = indexes[length]; 22863 if (length == lastIndex || index !== previous) { 22864 var previous = index; 22865 if (isIndex(index)) { 22866 splice.call(array, index, 1); 22867 } else { 22868 baseUnset(array, index); 22869 } 22870 } 22871 } 22872 return array; 22873 } 22874 22875 /** 22876 * The base implementation of `_.random` without support for returning 22877 * floating-point numbers. 22878 * 22879 * @private 22880 * @param {number} lower The lower bound. 22881 * @param {number} upper The upper bound. 22882 * @returns {number} Returns the random number. 22883 */ 22884 function baseRandom(lower, upper) { 22885 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 22886 } 22887 22888 /** 22889 * The base implementation of `_.range` and `_.rangeRight` which doesn't 22890 * coerce arguments. 22891 * 22892 * @private 22893 * @param {number} start The start of the range. 22894 * @param {number} end The end of the range. 22895 * @param {number} step The value to increment or decrement by. 22896 * @param {boolean} [fromRight] Specify iterating from right to left. 22897 * @returns {Array} Returns the range of numbers. 22898 */ 22899 function baseRange(start, end, step, fromRight) { 22900 var index = -1, 22901 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 22902 result = Array(length); 22903 22904 while (length--) { 22905 result[fromRight ? length : ++index] = start; 22906 start += step; 22907 } 22908 return result; 22909 } 22910 22911 /** 22912 * The base implementation of `_.repeat` which doesn't coerce arguments. 22913 * 22914 * @private 22915 * @param {string} string The string to repeat. 22916 * @param {number} n The number of times to repeat the string. 22917 * @returns {string} Returns the repeated string. 22918 */ 22919 function baseRepeat(string, n) { 22920 var result = ''; 22921 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 22922 return result; 22923 } 22924 // Leverage the exponentiation by squaring algorithm for a faster repeat. 22925 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 22926 do { 22927 if (n % 2) { 22928 result += string; 22929 } 22930 n = nativeFloor(n / 2); 22931 if (n) { 22932 string += string; 22933 } 22934 } while (n); 22935 22936 return result; 22937 } 22938 22939 /** 22940 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 22941 * 22942 * @private 22943 * @param {Function} func The function to apply a rest parameter to. 22944 * @param {number} [start=func.length-1] The start position of the rest parameter. 22945 * @returns {Function} Returns the new function. 22946 */ 22947 function baseRest(func, start) { 22948 return setToString(overRest(func, start, identity), func + ''); 22949 } 22950 22951 /** 22952 * The base implementation of `_.sample`. 22953 * 22954 * @private 22955 * @param {Array|Object} collection The collection to sample. 22956 * @returns {*} Returns the random element. 22957 */ 22958 function baseSample(collection) { 22959 return arraySample(values(collection)); 22960 } 22961 22962 /** 22963 * The base implementation of `_.sampleSize` without param guards. 22964 * 22965 * @private 22966 * @param {Array|Object} collection The collection to sample. 22967 * @param {number} n The number of elements to sample. 22968 * @returns {Array} Returns the random elements. 22969 */ 22970 function baseSampleSize(collection, n) { 22971 var array = values(collection); 22972 return shuffleSelf(array, baseClamp(n, 0, array.length)); 22973 } 22974 22975 /** 22976 * The base implementation of `_.set`. 22977 * 22978 * @private 22979 * @param {Object} object The object to modify. 22980 * @param {Array|string} path The path of the property to set. 22981 * @param {*} value The value to set. 22982 * @param {Function} [customizer] The function to customize path creation. 22983 * @returns {Object} Returns `object`. 22984 */ 22985 function baseSet(object, path, value, customizer) { 22986 if (!isObject(object)) { 22987 return object; 22988 } 22989 path = castPath(path, object); 22990 22991 var index = -1, 22992 length = path.length, 22993 lastIndex = length - 1, 22994 nested = object; 22995 22996 while (nested != null && ++index < length) { 22997 var key = toKey(path[index]), 22998 newValue = value; 22999 23000 if (index != lastIndex) { 23001 var objValue = nested[key]; 23002 newValue = customizer ? customizer(objValue, key, nested) : undefined; 23003 if (newValue === undefined) { 23004 newValue = isObject(objValue) 23005 ? objValue 23006 : (isIndex(path[index + 1]) ? [] : {}); 23007 } 23008 } 23009 assignValue(nested, key, newValue); 23010 nested = nested[key]; 23011 } 23012 return object; 23013 } 23014 23015 /** 23016 * The base implementation of `setData` without support for hot loop shorting. 23017 * 23018 * @private 23019 * @param {Function} func The function to associate metadata with. 23020 * @param {*} data The metadata. 23021 * @returns {Function} Returns `func`. 23022 */ 23023 var baseSetData = !metaMap ? identity : function(func, data) { 23024 metaMap.set(func, data); 23025 return func; 23026 }; 23027 23028 /** 23029 * The base implementation of `setToString` without support for hot loop shorting. 23030 * 23031 * @private 23032 * @param {Function} func The function to modify. 23033 * @param {Function} string The `toString` result. 23034 * @returns {Function} Returns `func`. 23035 */ 23036 var baseSetToString = !defineProperty ? identity : function(func, string) { 23037 return defineProperty(func, 'toString', { 23038 'configurable': true, 23039 'enumerable': false, 23040 'value': constant(string), 23041 'writable': true 23042 }); 23043 }; 23044 23045 /** 23046 * The base implementation of `_.shuffle`. 23047 * 23048 * @private 23049 * @param {Array|Object} collection The collection to shuffle. 23050 * @returns {Array} Returns the new shuffled array. 23051 */ 23052 function baseShuffle(collection) { 23053 return shuffleSelf(values(collection)); 23054 } 23055 23056 /** 23057 * The base implementation of `_.slice` without an iteratee call guard. 23058 * 23059 * @private 23060 * @param {Array} array The array to slice. 23061 * @param {number} [start=0] The start position. 23062 * @param {number} [end=array.length] The end position. 23063 * @returns {Array} Returns the slice of `array`. 23064 */ 23065 function baseSlice(array, start, end) { 23066 var index = -1, 23067 length = array.length; 23068 23069 if (start < 0) { 23070 start = -start > length ? 0 : (length + start); 23071 } 23072 end = end > length ? length : end; 23073 if (end < 0) { 23074 end += length; 23075 } 23076 length = start > end ? 0 : ((end - start) >>> 0); 23077 start >>>= 0; 23078 23079 var result = Array(length); 23080 while (++index < length) { 23081 result[index] = array[index + start]; 23082 } 23083 return result; 23084 } 23085 23086 /** 23087 * The base implementation of `_.some` without support for iteratee shorthands. 23088 * 23089 * @private 23090 * @param {Array|Object} collection The collection to iterate over. 23091 * @param {Function} predicate The function invoked per iteration. 23092 * @returns {boolean} Returns `true` if any element passes the predicate check, 23093 * else `false`. 23094 */ 23095 function baseSome(collection, predicate) { 23096 var result; 23097 23098 baseEach(collection, function(value, index, collection) { 23099 result = predicate(value, index, collection); 23100 return !result; 23101 }); 23102 return !!result; 23103 } 23104 23105 /** 23106 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 23107 * performs a binary search of `array` to determine the index at which `value` 23108 * should be inserted into `array` in order to maintain its sort order. 23109 * 23110 * @private 23111 * @param {Array} array The sorted array to inspect. 23112 * @param {*} value The value to evaluate. 23113 * @param {boolean} [retHighest] Specify returning the highest qualified index. 23114 * @returns {number} Returns the index at which `value` should be inserted 23115 * into `array`. 23116 */ 23117 function baseSortedIndex(array, value, retHighest) { 23118 var low = 0, 23119 high = array == null ? low : array.length; 23120 23121 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 23122 while (low < high) { 23123 var mid = (low + high) >>> 1, 23124 computed = array[mid]; 23125 23126 if (computed !== null && !isSymbol(computed) && 23127 (retHighest ? (computed <= value) : (computed < value))) { 23128 low = mid + 1; 23129 } else { 23130 high = mid; 23131 } 23132 } 23133 return high; 23134 } 23135 return baseSortedIndexBy(array, value, identity, retHighest); 23136 } 23137 23138 /** 23139 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 23140 * which invokes `iteratee` for `value` and each element of `array` to compute 23141 * their sort ranking. The iteratee is invoked with one argument; (value). 23142 * 23143 * @private 23144 * @param {Array} array The sorted array to inspect. 23145 * @param {*} value The value to evaluate. 23146 * @param {Function} iteratee The iteratee invoked per element. 23147 * @param {boolean} [retHighest] Specify returning the highest qualified index. 23148 * @returns {number} Returns the index at which `value` should be inserted 23149 * into `array`. 23150 */ 23151 function baseSortedIndexBy(array, value, iteratee, retHighest) { 23152 value = iteratee(value); 23153 23154 var low = 0, 23155 high = array == null ? 0 : array.length, 23156 valIsNaN = value !== value, 23157 valIsNull = value === null, 23158 valIsSymbol = isSymbol(value), 23159 valIsUndefined = value === undefined; 23160 23161 while (low < high) { 23162 var mid = nativeFloor((low + high) / 2), 23163 computed = iteratee(array[mid]), 23164 othIsDefined = computed !== undefined, 23165 othIsNull = computed === null, 23166 othIsReflexive = computed === computed, 23167 othIsSymbol = isSymbol(computed); 23168 23169 if (valIsNaN) { 23170 var setLow = retHighest || othIsReflexive; 23171 } else if (valIsUndefined) { 23172 setLow = othIsReflexive && (retHighest || othIsDefined); 23173 } else if (valIsNull) { 23174 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 23175 } else if (valIsSymbol) { 23176 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 23177 } else if (othIsNull || othIsSymbol) { 23178 setLow = false; 23179 } else { 23180 setLow = retHighest ? (computed <= value) : (computed < value); 23181 } 23182 if (setLow) { 23183 low = mid + 1; 23184 } else { 23185 high = mid; 23186 } 23187 } 23188 return nativeMin(high, MAX_ARRAY_INDEX); 23189 } 23190 23191 /** 23192 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 23193 * support for iteratee shorthands. 23194 * 23195 * @private 23196 * @param {Array} array The array to inspect. 23197 * @param {Function} [iteratee] The iteratee invoked per element. 23198 * @returns {Array} Returns the new duplicate free array. 23199 */ 23200 function baseSortedUniq(array, iteratee) { 23201 var index = -1, 23202 length = array.length, 23203 resIndex = 0, 23204 result = []; 23205 23206 while (++index < length) { 23207 var value = array[index], 23208 computed = iteratee ? iteratee(value) : value; 23209 23210 if (!index || !eq(computed, seen)) { 23211 var seen = computed; 23212 result[resIndex++] = value === 0 ? 0 : value; 23213 } 23214 } 23215 return result; 23216 } 23217 23218 /** 23219 * The base implementation of `_.toNumber` which doesn't ensure correct 23220 * conversions of binary, hexadecimal, or octal string values. 23221 * 23222 * @private 23223 * @param {*} value The value to process. 23224 * @returns {number} Returns the number. 23225 */ 23226 function baseToNumber(value) { 23227 if (typeof value == 'number') { 23228 return value; 23229 } 23230 if (isSymbol(value)) { 23231 return NAN; 23232 } 23233 return +value; 23234 } 23235 23236 /** 23237 * The base implementation of `_.toString` which doesn't convert nullish 23238 * values to empty strings. 23239 * 23240 * @private 23241 * @param {*} value The value to process. 23242 * @returns {string} Returns the string. 23243 */ 23244 function baseToString(value) { 23245 // Exit early for strings to avoid a performance hit in some environments. 23246 if (typeof value == 'string') { 23247 return value; 23248 } 23249 if (isArray(value)) { 23250 // Recursively convert values (susceptible to call stack limits). 23251 return arrayMap(value, baseToString) + ''; 23252 } 23253 if (isSymbol(value)) { 23254 return symbolToString ? symbolToString.call(value) : ''; 23255 } 23256 var result = (value + ''); 23257 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 23258 } 23259 23260 /** 23261 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 23262 * 23263 * @private 23264 * @param {Array} array The array to inspect. 23265 * @param {Function} [iteratee] The iteratee invoked per element. 23266 * @param {Function} [comparator] The comparator invoked per element. 23267 * @returns {Array} Returns the new duplicate free array. 23268 */ 23269 function baseUniq(array, iteratee, comparator) { 23270 var index = -1, 23271 includes = arrayIncludes, 23272 length = array.length, 23273 isCommon = true, 23274 result = [], 23275 seen = result; 23276 23277 if (comparator) { 23278 isCommon = false; 23279 includes = arrayIncludesWith; 23280 } 23281 else if (length >= LARGE_ARRAY_SIZE) { 23282 var set = iteratee ? null : createSet(array); 23283 if (set) { 23284 return setToArray(set); 23285 } 23286 isCommon = false; 23287 includes = cacheHas; 23288 seen = new SetCache; 23289 } 23290 else { 23291 seen = iteratee ? [] : result; 23292 } 23293 outer: 23294 while (++index < length) { 23295 var value = array[index], 23296 computed = iteratee ? iteratee(value) : value; 23297 23298 value = (comparator || value !== 0) ? value : 0; 23299 if (isCommon && computed === computed) { 23300 var seenIndex = seen.length; 23301 while (seenIndex--) { 23302 if (seen[seenIndex] === computed) { 23303 continue outer; 23304 } 23305 } 23306 if (iteratee) { 23307 seen.push(computed); 23308 } 23309 result.push(value); 23310 } 23311 else if (!includes(seen, computed, comparator)) { 23312 if (seen !== result) { 23313 seen.push(computed); 23314 } 23315 result.push(value); 23316 } 23317 } 23318 return result; 23319 } 23320 23321 /** 23322 * The base implementation of `_.unset`. 23323 * 23324 * @private 23325 * @param {Object} object The object to modify. 23326 * @param {Array|string} path The property path to unset. 23327 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 23328 */ 23329 function baseUnset(object, path) { 23330 path = castPath(path, object); 23331 object = parent(object, path); 23332 return object == null || delete object[toKey(last(path))]; 23333 } 23334 23335 /** 23336 * The base implementation of `_.update`. 23337 * 23338 * @private 23339 * @param {Object} object The object to modify. 23340 * @param {Array|string} path The path of the property to update. 23341 * @param {Function} updater The function to produce the updated value. 23342 * @param {Function} [customizer] The function to customize path creation. 23343 * @returns {Object} Returns `object`. 23344 */ 23345 function baseUpdate(object, path, updater, customizer) { 23346 return baseSet(object, path, updater(baseGet(object, path)), customizer); 23347 } 23348 23349 /** 23350 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 23351 * without support for iteratee shorthands. 23352 * 23353 * @private 23354 * @param {Array} array The array to query. 23355 * @param {Function} predicate The function invoked per iteration. 23356 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 23357 * @param {boolean} [fromRight] Specify iterating from right to left. 23358 * @returns {Array} Returns the slice of `array`. 23359 */ 23360 function baseWhile(array, predicate, isDrop, fromRight) { 23361 var length = array.length, 23362 index = fromRight ? length : -1; 23363 23364 while ((fromRight ? index-- : ++index < length) && 23365 predicate(array[index], index, array)) {} 23366 23367 return isDrop 23368 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 23369 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 23370 } 23371 23372 /** 23373 * The base implementation of `wrapperValue` which returns the result of 23374 * performing a sequence of actions on the unwrapped `value`, where each 23375 * successive action is supplied the return value of the previous. 23376 * 23377 * @private 23378 * @param {*} value The unwrapped value. 23379 * @param {Array} actions Actions to perform to resolve the unwrapped value. 23380 * @returns {*} Returns the resolved value. 23381 */ 23382 function baseWrapperValue(value, actions) { 23383 var result = value; 23384 if (result instanceof LazyWrapper) { 23385 result = result.value(); 23386 } 23387 return arrayReduce(actions, function(result, action) { 23388 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 23389 }, result); 23390 } 23391 23392 /** 23393 * The base implementation of methods like `_.xor`, without support for 23394 * iteratee shorthands, that accepts an array of arrays to inspect. 23395 * 23396 * @private 23397 * @param {Array} arrays The arrays to inspect. 23398 * @param {Function} [iteratee] The iteratee invoked per element. 23399 * @param {Function} [comparator] The comparator invoked per element. 23400 * @returns {Array} Returns the new array of values. 23401 */ 23402 function baseXor(arrays, iteratee, comparator) { 23403 var length = arrays.length; 23404 if (length < 2) { 23405 return length ? baseUniq(arrays[0]) : []; 23406 } 23407 var index = -1, 23408 result = Array(length); 23409 23410 while (++index < length) { 23411 var array = arrays[index], 23412 othIndex = -1; 23413 23414 while (++othIndex < length) { 23415 if (othIndex != index) { 23416 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 23417 } 23418 } 23419 } 23420 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 23421 } 23422 23423 /** 23424 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 23425 * 23426 * @private 23427 * @param {Array} props The property identifiers. 23428 * @param {Array} values The property values. 23429 * @param {Function} assignFunc The function to assign values. 23430 * @returns {Object} Returns the new object. 23431 */ 23432 function baseZipObject(props, values, assignFunc) { 23433 var index = -1, 23434 length = props.length, 23435 valsLength = values.length, 23436 result = {}; 23437 23438 while (++index < length) { 23439 var value = index < valsLength ? values[index] : undefined; 23440 assignFunc(result, props[index], value); 23441 } 23442 return result; 23443 } 23444 23445 /** 23446 * Casts `value` to an empty array if it's not an array like object. 23447 * 23448 * @private 23449 * @param {*} value The value to inspect. 23450 * @returns {Array|Object} Returns the cast array-like object. 23451 */ 23452 function castArrayLikeObject(value) { 23453 return isArrayLikeObject(value) ? value : []; 23454 } 23455 23456 /** 23457 * Casts `value` to `identity` if it's not a function. 23458 * 23459 * @private 23460 * @param {*} value The value to inspect. 23461 * @returns {Function} Returns cast function. 23462 */ 23463 function castFunction(value) { 23464 return typeof value == 'function' ? value : identity; 23465 } 23466 23467 /** 23468 * Casts `value` to a path array if it's not one. 23469 * 23470 * @private 23471 * @param {*} value The value to inspect. 23472 * @param {Object} [object] The object to query keys on. 23473 * @returns {Array} Returns the cast property path array. 23474 */ 23475 function castPath(value, object) { 23476 if (isArray(value)) { 23477 return value; 23478 } 23479 return isKey(value, object) ? [value] : stringToPath(toString(value)); 23480 } 23481 23482 /** 23483 * A `baseRest` alias which can be replaced with `identity` by module 23484 * replacement plugins. 23485 * 23486 * @private 23487 * @type {Function} 23488 * @param {Function} func The function to apply a rest parameter to. 23489 * @returns {Function} Returns the new function. 23490 */ 23491 var castRest = baseRest; 23492 23493 /** 23494 * Casts `array` to a slice if it's needed. 23495 * 23496 * @private 23497 * @param {Array} array The array to inspect. 23498 * @param {number} start The start position. 23499 * @param {number} [end=array.length] The end position. 23500 * @returns {Array} Returns the cast slice. 23501 */ 23502 function castSlice(array, start, end) { 23503 var length = array.length; 23504 end = end === undefined ? length : end; 23505 return (!start && end >= length) ? array : baseSlice(array, start, end); 23506 } 23507 23508 /** 23509 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 23510 * 23511 * @private 23512 * @param {number|Object} id The timer id or timeout object of the timer to clear. 23513 */ 23514 var clearTimeout = ctxClearTimeout || function(id) { 23515 return root.clearTimeout(id); 23516 }; 23517 23518 /** 23519 * Creates a clone of `buffer`. 23520 * 23521 * @private 23522 * @param {Buffer} buffer The buffer to clone. 23523 * @param {boolean} [isDeep] Specify a deep clone. 23524 * @returns {Buffer} Returns the cloned buffer. 23525 */ 23526 function cloneBuffer(buffer, isDeep) { 23527 if (isDeep) { 23528 return buffer.slice(); 23529 } 23530 var length = buffer.length, 23531 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 23532 23533 buffer.copy(result); 23534 return result; 23535 } 23536 23537 /** 23538 * Creates a clone of `arrayBuffer`. 23539 * 23540 * @private 23541 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 23542 * @returns {ArrayBuffer} Returns the cloned array buffer. 23543 */ 23544 function cloneArrayBuffer(arrayBuffer) { 23545 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 23546 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 23547 return result; 23548 } 23549 23550 /** 23551 * Creates a clone of `dataView`. 23552 * 23553 * @private 23554 * @param {Object} dataView The data view to clone. 23555 * @param {boolean} [isDeep] Specify a deep clone. 23556 * @returns {Object} Returns the cloned data view. 23557 */ 23558 function cloneDataView(dataView, isDeep) { 23559 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 23560 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 23561 } 23562 23563 /** 23564 * Creates a clone of `regexp`. 23565 * 23566 * @private 23567 * @param {Object} regexp The regexp to clone. 23568 * @returns {Object} Returns the cloned regexp. 23569 */ 23570 function cloneRegExp(regexp) { 23571 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 23572 result.lastIndex = regexp.lastIndex; 23573 return result; 23574 } 23575 23576 /** 23577 * Creates a clone of the `symbol` object. 23578 * 23579 * @private 23580 * @param {Object} symbol The symbol object to clone. 23581 * @returns {Object} Returns the cloned symbol object. 23582 */ 23583 function cloneSymbol(symbol) { 23584 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 23585 } 23586 23587 /** 23588 * Creates a clone of `typedArray`. 23589 * 23590 * @private 23591 * @param {Object} typedArray The typed array to clone. 23592 * @param {boolean} [isDeep] Specify a deep clone. 23593 * @returns {Object} Returns the cloned typed array. 23594 */ 23595 function cloneTypedArray(typedArray, isDeep) { 23596 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 23597 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 23598 } 23599 23600 /** 23601 * Compares values to sort them in ascending order. 23602 * 23603 * @private 23604 * @param {*} value The value to compare. 23605 * @param {*} other The other value to compare. 23606 * @returns {number} Returns the sort order indicator for `value`. 23607 */ 23608 function compareAscending(value, other) { 23609 if (value !== other) { 23610 var valIsDefined = value !== undefined, 23611 valIsNull = value === null, 23612 valIsReflexive = value === value, 23613 valIsSymbol = isSymbol(value); 23614 23615 var othIsDefined = other !== undefined, 23616 othIsNull = other === null, 23617 othIsReflexive = other === other, 23618 othIsSymbol = isSymbol(other); 23619 23620 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 23621 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 23622 (valIsNull && othIsDefined && othIsReflexive) || 23623 (!valIsDefined && othIsReflexive) || 23624 !valIsReflexive) { 23625 return 1; 23626 } 23627 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 23628 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 23629 (othIsNull && valIsDefined && valIsReflexive) || 23630 (!othIsDefined && valIsReflexive) || 23631 !othIsReflexive) { 23632 return -1; 23633 } 23634 } 23635 return 0; 23636 } 23637 23638 /** 23639 * Used by `_.orderBy` to compare multiple properties of a value to another 23640 * and stable sort them. 23641 * 23642 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 23643 * specify an order of "desc" for descending or "asc" for ascending sort order 23644 * of corresponding values. 23645 * 23646 * @private 23647 * @param {Object} object The object to compare. 23648 * @param {Object} other The other object to compare. 23649 * @param {boolean[]|string[]} orders The order to sort by for each property. 23650 * @returns {number} Returns the sort order indicator for `object`. 23651 */ 23652 function compareMultiple(object, other, orders) { 23653 var index = -1, 23654 objCriteria = object.criteria, 23655 othCriteria = other.criteria, 23656 length = objCriteria.length, 23657 ordersLength = orders.length; 23658 23659 while (++index < length) { 23660 var result = compareAscending(objCriteria[index], othCriteria[index]); 23661 if (result) { 23662 if (index >= ordersLength) { 23663 return result; 23664 } 23665 var order = orders[index]; 23666 return result * (order == 'desc' ? -1 : 1); 23667 } 23668 } 23669 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 23670 // that causes it, under certain circumstances, to provide the same value for 23671 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 23672 // for more details. 23673 // 23674 // This also ensures a stable sort in V8 and other engines. 23675 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 23676 return object.index - other.index; 23677 } 23678 23679 /** 23680 * Creates an array that is the composition of partially applied arguments, 23681 * placeholders, and provided arguments into a single array of arguments. 23682 * 23683 * @private 23684 * @param {Array} args The provided arguments. 23685 * @param {Array} partials The arguments to prepend to those provided. 23686 * @param {Array} holders The `partials` placeholder indexes. 23687 * @params {boolean} [isCurried] Specify composing for a curried function. 23688 * @returns {Array} Returns the new array of composed arguments. 23689 */ 23690 function composeArgs(args, partials, holders, isCurried) { 23691 var argsIndex = -1, 23692 argsLength = args.length, 23693 holdersLength = holders.length, 23694 leftIndex = -1, 23695 leftLength = partials.length, 23696 rangeLength = nativeMax(argsLength - holdersLength, 0), 23697 result = Array(leftLength + rangeLength), 23698 isUncurried = !isCurried; 23699 23700 while (++leftIndex < leftLength) { 23701 result[leftIndex] = partials[leftIndex]; 23702 } 23703 while (++argsIndex < holdersLength) { 23704 if (isUncurried || argsIndex < argsLength) { 23705 result[holders[argsIndex]] = args[argsIndex]; 23706 } 23707 } 23708 while (rangeLength--) { 23709 result[leftIndex++] = args[argsIndex++]; 23710 } 23711 return result; 23712 } 23713 23714 /** 23715 * This function is like `composeArgs` except that the arguments composition 23716 * is tailored for `_.partialRight`. 23717 * 23718 * @private 23719 * @param {Array} args The provided arguments. 23720 * @param {Array} partials The arguments to append to those provided. 23721 * @param {Array} holders The `partials` placeholder indexes. 23722 * @params {boolean} [isCurried] Specify composing for a curried function. 23723 * @returns {Array} Returns the new array of composed arguments. 23724 */ 23725 function composeArgsRight(args, partials, holders, isCurried) { 23726 var argsIndex = -1, 23727 argsLength = args.length, 23728 holdersIndex = -1, 23729 holdersLength = holders.length, 23730 rightIndex = -1, 23731 rightLength = partials.length, 23732 rangeLength = nativeMax(argsLength - holdersLength, 0), 23733 result = Array(rangeLength + rightLength), 23734 isUncurried = !isCurried; 23735 23736 while (++argsIndex < rangeLength) { 23737 result[argsIndex] = args[argsIndex]; 23738 } 23739 var offset = argsIndex; 23740 while (++rightIndex < rightLength) { 23741 result[offset + rightIndex] = partials[rightIndex]; 23742 } 23743 while (++holdersIndex < holdersLength) { 23744 if (isUncurried || argsIndex < argsLength) { 23745 result[offset + holders[holdersIndex]] = args[argsIndex++]; 23746 } 23747 } 23748 return result; 23749 } 23750 23751 /** 23752 * Copies the values of `source` to `array`. 23753 * 23754 * @private 23755 * @param {Array} source The array to copy values from. 23756 * @param {Array} [array=[]] The array to copy values to. 23757 * @returns {Array} Returns `array`. 23758 */ 23759 function copyArray(source, array) { 23760 var index = -1, 23761 length = source.length; 23762 23763 array || (array = Array(length)); 23764 while (++index < length) { 23765 array[index] = source[index]; 23766 } 23767 return array; 23768 } 23769 23770 /** 23771 * Copies properties of `source` to `object`. 23772 * 23773 * @private 23774 * @param {Object} source The object to copy properties from. 23775 * @param {Array} props The property identifiers to copy. 23776 * @param {Object} [object={}] The object to copy properties to. 23777 * @param {Function} [customizer] The function to customize copied values. 23778 * @returns {Object} Returns `object`. 23779 */ 23780 function copyObject(source, props, object, customizer) { 23781 var isNew = !object; 23782 object || (object = {}); 23783 23784 var index = -1, 23785 length = props.length; 23786 23787 while (++index < length) { 23788 var key = props[index]; 23789 23790 var newValue = customizer 23791 ? customizer(object[key], source[key], key, object, source) 23792 : undefined; 23793 23794 if (newValue === undefined) { 23795 newValue = source[key]; 23796 } 23797 if (isNew) { 23798 baseAssignValue(object, key, newValue); 23799 } else { 23800 assignValue(object, key, newValue); 23801 } 23802 } 23803 return object; 23804 } 23805 23806 /** 23807 * Copies own symbols of `source` to `object`. 23808 * 23809 * @private 23810 * @param {Object} source The object to copy symbols from. 23811 * @param {Object} [object={}] The object to copy symbols to. 23812 * @returns {Object} Returns `object`. 23813 */ 23814 function copySymbols(source, object) { 23815 return copyObject(source, getSymbols(source), object); 23816 } 23817 23818 /** 23819 * Copies own and inherited symbols of `source` to `object`. 23820 * 23821 * @private 23822 * @param {Object} source The object to copy symbols from. 23823 * @param {Object} [object={}] The object to copy symbols to. 23824 * @returns {Object} Returns `object`. 23825 */ 23826 function copySymbolsIn(source, object) { 23827 return copyObject(source, getSymbolsIn(source), object); 23828 } 23829 23830 /** 23831 * Creates a function like `_.groupBy`. 23832 * 23833 * @private 23834 * @param {Function} setter The function to set accumulator values. 23835 * @param {Function} [initializer] The accumulator object initializer. 23836 * @returns {Function} Returns the new aggregator function. 23837 */ 23838 function createAggregator(setter, initializer) { 23839 return function(collection, iteratee) { 23840 var func = isArray(collection) ? arrayAggregator : baseAggregator, 23841 accumulator = initializer ? initializer() : {}; 23842 23843 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 23844 }; 23845 } 23846 23847 /** 23848 * Creates a function like `_.assign`. 23849 * 23850 * @private 23851 * @param {Function} assigner The function to assign values. 23852 * @returns {Function} Returns the new assigner function. 23853 */ 23854 function createAssigner(assigner) { 23855 return baseRest(function(object, sources) { 23856 var index = -1, 23857 length = sources.length, 23858 customizer = length > 1 ? sources[length - 1] : undefined, 23859 guard = length > 2 ? sources[2] : undefined; 23860 23861 customizer = (assigner.length > 3 && typeof customizer == 'function') 23862 ? (length--, customizer) 23863 : undefined; 23864 23865 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 23866 customizer = length < 3 ? undefined : customizer; 23867 length = 1; 23868 } 23869 object = Object(object); 23870 while (++index < length) { 23871 var source = sources[index]; 23872 if (source) { 23873 assigner(object, source, index, customizer); 23874 } 23875 } 23876 return object; 23877 }); 23878 } 23879 23880 /** 23881 * Creates a `baseEach` or `baseEachRight` function. 23882 * 23883 * @private 23884 * @param {Function} eachFunc The function to iterate over a collection. 23885 * @param {boolean} [fromRight] Specify iterating from right to left. 23886 * @returns {Function} Returns the new base function. 23887 */ 23888 function createBaseEach(eachFunc, fromRight) { 23889 return function(collection, iteratee) { 23890 if (collection == null) { 23891 return collection; 23892 } 23893 if (!isArrayLike(collection)) { 23894 return eachFunc(collection, iteratee); 23895 } 23896 var length = collection.length, 23897 index = fromRight ? length : -1, 23898 iterable = Object(collection); 23899 23900 while ((fromRight ? index-- : ++index < length)) { 23901 if (iteratee(iterable[index], index, iterable) === false) { 23902 break; 23903 } 23904 } 23905 return collection; 23906 }; 23907 } 23908 23909 /** 23910 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 23911 * 23912 * @private 23913 * @param {boolean} [fromRight] Specify iterating from right to left. 23914 * @returns {Function} Returns the new base function. 23915 */ 23916 function createBaseFor(fromRight) { 23917 return function(object, iteratee, keysFunc) { 23918 var index = -1, 23919 iterable = Object(object), 23920 props = keysFunc(object), 23921 length = props.length; 23922 23923 while (length--) { 23924 var key = props[fromRight ? length : ++index]; 23925 if (iteratee(iterable[key], key, iterable) === false) { 23926 break; 23927 } 23928 } 23929 return object; 23930 }; 23931 } 23932 23933 /** 23934 * Creates a function that wraps `func` to invoke it with the optional `this` 23935 * binding of `thisArg`. 23936 * 23937 * @private 23938 * @param {Function} func The function to wrap. 23939 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 23940 * @param {*} [thisArg] The `this` binding of `func`. 23941 * @returns {Function} Returns the new wrapped function. 23942 */ 23943 function createBind(func, bitmask, thisArg) { 23944 var isBind = bitmask & WRAP_BIND_FLAG, 23945 Ctor = createCtor(func); 23946 23947 function wrapper() { 23948 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 23949 return fn.apply(isBind ? thisArg : this, arguments); 23950 } 23951 return wrapper; 23952 } 23953 23954 /** 23955 * Creates a function like `_.lowerFirst`. 23956 * 23957 * @private 23958 * @param {string} methodName The name of the `String` case method to use. 23959 * @returns {Function} Returns the new case function. 23960 */ 23961 function createCaseFirst(methodName) { 23962 return function(string) { 23963 string = toString(string); 23964 23965 var strSymbols = hasUnicode(string) 23966 ? stringToArray(string) 23967 : undefined; 23968 23969 var chr = strSymbols 23970 ? strSymbols[0] 23971 : string.charAt(0); 23972 23973 var trailing = strSymbols 23974 ? castSlice(strSymbols, 1).join('') 23975 : string.slice(1); 23976 23977 return chr[methodName]() + trailing; 23978 }; 23979 } 23980 23981 /** 23982 * Creates a function like `_.camelCase`. 23983 * 23984 * @private 23985 * @param {Function} callback The function to combine each word. 23986 * @returns {Function} Returns the new compounder function. 23987 */ 23988 function createCompounder(callback) { 23989 return function(string) { 23990 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 23991 }; 23992 } 23993 23994 /** 23995 * Creates a function that produces an instance of `Ctor` regardless of 23996 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 23997 * 23998 * @private 23999 * @param {Function} Ctor The constructor to wrap. 24000 * @returns {Function} Returns the new wrapped function. 24001 */ 24002 function createCtor(Ctor) { 24003 return function() { 24004 // Use a `switch` statement to work with class constructors. See 24005 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 24006 // for more details. 24007 var args = arguments; 24008 switch (args.length) { 24009 case 0: return new Ctor; 24010 case 1: return new Ctor(args[0]); 24011 case 2: return new Ctor(args[0], args[1]); 24012 case 3: return new Ctor(args[0], args[1], args[2]); 24013 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 24014 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 24015 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 24016 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 24017 } 24018 var thisBinding = baseCreate(Ctor.prototype), 24019 result = Ctor.apply(thisBinding, args); 24020 24021 // Mimic the constructor's `return` behavior. 24022 // See https://es5.github.io/#x13.2.2 for more details. 24023 return isObject(result) ? result : thisBinding; 24024 }; 24025 } 24026 24027 /** 24028 * Creates a function that wraps `func` to enable currying. 24029 * 24030 * @private 24031 * @param {Function} func The function to wrap. 24032 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24033 * @param {number} arity The arity of `func`. 24034 * @returns {Function} Returns the new wrapped function. 24035 */ 24036 function createCurry(func, bitmask, arity) { 24037 var Ctor = createCtor(func); 24038 24039 function wrapper() { 24040 var length = arguments.length, 24041 args = Array(length), 24042 index = length, 24043 placeholder = getHolder(wrapper); 24044 24045 while (index--) { 24046 args[index] = arguments[index]; 24047 } 24048 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 24049 ? [] 24050 : replaceHolders(args, placeholder); 24051 24052 length -= holders.length; 24053 if (length < arity) { 24054 return createRecurry( 24055 func, bitmask, createHybrid, wrapper.placeholder, undefined, 24056 args, holders, undefined, undefined, arity - length); 24057 } 24058 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 24059 return apply(fn, this, args); 24060 } 24061 return wrapper; 24062 } 24063 24064 /** 24065 * Creates a `_.find` or `_.findLast` function. 24066 * 24067 * @private 24068 * @param {Function} findIndexFunc The function to find the collection index. 24069 * @returns {Function} Returns the new find function. 24070 */ 24071 function createFind(findIndexFunc) { 24072 return function(collection, predicate, fromIndex) { 24073 var iterable = Object(collection); 24074 if (!isArrayLike(collection)) { 24075 var iteratee = getIteratee(predicate, 3); 24076 collection = keys(collection); 24077 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 24078 } 24079 var index = findIndexFunc(collection, predicate, fromIndex); 24080 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 24081 }; 24082 } 24083 24084 /** 24085 * Creates a `_.flow` or `_.flowRight` function. 24086 * 24087 * @private 24088 * @param {boolean} [fromRight] Specify iterating from right to left. 24089 * @returns {Function} Returns the new flow function. 24090 */ 24091 function createFlow(fromRight) { 24092 return flatRest(function(funcs) { 24093 var length = funcs.length, 24094 index = length, 24095 prereq = LodashWrapper.prototype.thru; 24096 24097 if (fromRight) { 24098 funcs.reverse(); 24099 } 24100 while (index--) { 24101 var func = funcs[index]; 24102 if (typeof func != 'function') { 24103 throw new TypeError(FUNC_ERROR_TEXT); 24104 } 24105 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 24106 var wrapper = new LodashWrapper([], true); 24107 } 24108 } 24109 index = wrapper ? index : length; 24110 while (++index < length) { 24111 func = funcs[index]; 24112 24113 var funcName = getFuncName(func), 24114 data = funcName == 'wrapper' ? getData(func) : undefined; 24115 24116 if (data && isLaziable(data[0]) && 24117 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 24118 !data[4].length && data[9] == 1 24119 ) { 24120 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 24121 } else { 24122 wrapper = (func.length == 1 && isLaziable(func)) 24123 ? wrapper[funcName]() 24124 : wrapper.thru(func); 24125 } 24126 } 24127 return function() { 24128 var args = arguments, 24129 value = args[0]; 24130 24131 if (wrapper && args.length == 1 && isArray(value)) { 24132 return wrapper.plant(value).value(); 24133 } 24134 var index = 0, 24135 result = length ? funcs[index].apply(this, args) : value; 24136 24137 while (++index < length) { 24138 result = funcs[index].call(this, result); 24139 } 24140 return result; 24141 }; 24142 }); 24143 } 24144 24145 /** 24146 * Creates a function that wraps `func` to invoke it with optional `this` 24147 * binding of `thisArg`, partial application, and currying. 24148 * 24149 * @private 24150 * @param {Function|string} func The function or method name to wrap. 24151 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24152 * @param {*} [thisArg] The `this` binding of `func`. 24153 * @param {Array} [partials] The arguments to prepend to those provided to 24154 * the new function. 24155 * @param {Array} [holders] The `partials` placeholder indexes. 24156 * @param {Array} [partialsRight] The arguments to append to those provided 24157 * to the new function. 24158 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 24159 * @param {Array} [argPos] The argument positions of the new function. 24160 * @param {number} [ary] The arity cap of `func`. 24161 * @param {number} [arity] The arity of `func`. 24162 * @returns {Function} Returns the new wrapped function. 24163 */ 24164 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 24165 var isAry = bitmask & WRAP_ARY_FLAG, 24166 isBind = bitmask & WRAP_BIND_FLAG, 24167 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 24168 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 24169 isFlip = bitmask & WRAP_FLIP_FLAG, 24170 Ctor = isBindKey ? undefined : createCtor(func); 24171 24172 function wrapper() { 24173 var length = arguments.length, 24174 args = Array(length), 24175 index = length; 24176 24177 while (index--) { 24178 args[index] = arguments[index]; 24179 } 24180 if (isCurried) { 24181 var placeholder = getHolder(wrapper), 24182 holdersCount = countHolders(args, placeholder); 24183 } 24184 if (partials) { 24185 args = composeArgs(args, partials, holders, isCurried); 24186 } 24187 if (partialsRight) { 24188 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 24189 } 24190 length -= holdersCount; 24191 if (isCurried && length < arity) { 24192 var newHolders = replaceHolders(args, placeholder); 24193 return createRecurry( 24194 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 24195 args, newHolders, argPos, ary, arity - length 24196 ); 24197 } 24198 var thisBinding = isBind ? thisArg : this, 24199 fn = isBindKey ? thisBinding[func] : func; 24200 24201 length = args.length; 24202 if (argPos) { 24203 args = reorder(args, argPos); 24204 } else if (isFlip && length > 1) { 24205 args.reverse(); 24206 } 24207 if (isAry && ary < length) { 24208 args.length = ary; 24209 } 24210 if (this && this !== root && this instanceof wrapper) { 24211 fn = Ctor || createCtor(fn); 24212 } 24213 return fn.apply(thisBinding, args); 24214 } 24215 return wrapper; 24216 } 24217 24218 /** 24219 * Creates a function like `_.invertBy`. 24220 * 24221 * @private 24222 * @param {Function} setter The function to set accumulator values. 24223 * @param {Function} toIteratee The function to resolve iteratees. 24224 * @returns {Function} Returns the new inverter function. 24225 */ 24226 function createInverter(setter, toIteratee) { 24227 return function(object, iteratee) { 24228 return baseInverter(object, setter, toIteratee(iteratee), {}); 24229 }; 24230 } 24231 24232 /** 24233 * Creates a function that performs a mathematical operation on two values. 24234 * 24235 * @private 24236 * @param {Function} operator The function to perform the operation. 24237 * @param {number} [defaultValue] The value used for `undefined` arguments. 24238 * @returns {Function} Returns the new mathematical operation function. 24239 */ 24240 function createMathOperation(operator, defaultValue) { 24241 return function(value, other) { 24242 var result; 24243 if (value === undefined && other === undefined) { 24244 return defaultValue; 24245 } 24246 if (value !== undefined) { 24247 result = value; 24248 } 24249 if (other !== undefined) { 24250 if (result === undefined) { 24251 return other; 24252 } 24253 if (typeof value == 'string' || typeof other == 'string') { 24254 value = baseToString(value); 24255 other = baseToString(other); 24256 } else { 24257 value = baseToNumber(value); 24258 other = baseToNumber(other); 24259 } 24260 result = operator(value, other); 24261 } 24262 return result; 24263 }; 24264 } 24265 24266 /** 24267 * Creates a function like `_.over`. 24268 * 24269 * @private 24270 * @param {Function} arrayFunc The function to iterate over iteratees. 24271 * @returns {Function} Returns the new over function. 24272 */ 24273 function createOver(arrayFunc) { 24274 return flatRest(function(iteratees) { 24275 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 24276 return baseRest(function(args) { 24277 var thisArg = this; 24278 return arrayFunc(iteratees, function(iteratee) { 24279 return apply(iteratee, thisArg, args); 24280 }); 24281 }); 24282 }); 24283 } 24284 24285 /** 24286 * Creates the padding for `string` based on `length`. The `chars` string 24287 * is truncated if the number of characters exceeds `length`. 24288 * 24289 * @private 24290 * @param {number} length The padding length. 24291 * @param {string} [chars=' '] The string used as padding. 24292 * @returns {string} Returns the padding for `string`. 24293 */ 24294 function createPadding(length, chars) { 24295 chars = chars === undefined ? ' ' : baseToString(chars); 24296 24297 var charsLength = chars.length; 24298 if (charsLength < 2) { 24299 return charsLength ? baseRepeat(chars, length) : chars; 24300 } 24301 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 24302 return hasUnicode(chars) 24303 ? castSlice(stringToArray(result), 0, length).join('') 24304 : result.slice(0, length); 24305 } 24306 24307 /** 24308 * Creates a function that wraps `func` to invoke it with the `this` binding 24309 * of `thisArg` and `partials` prepended to the arguments it receives. 24310 * 24311 * @private 24312 * @param {Function} func The function to wrap. 24313 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24314 * @param {*} thisArg The `this` binding of `func`. 24315 * @param {Array} partials The arguments to prepend to those provided to 24316 * the new function. 24317 * @returns {Function} Returns the new wrapped function. 24318 */ 24319 function createPartial(func, bitmask, thisArg, partials) { 24320 var isBind = bitmask & WRAP_BIND_FLAG, 24321 Ctor = createCtor(func); 24322 24323 function wrapper() { 24324 var argsIndex = -1, 24325 argsLength = arguments.length, 24326 leftIndex = -1, 24327 leftLength = partials.length, 24328 args = Array(leftLength + argsLength), 24329 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 24330 24331 while (++leftIndex < leftLength) { 24332 args[leftIndex] = partials[leftIndex]; 24333 } 24334 while (argsLength--) { 24335 args[leftIndex++] = arguments[++argsIndex]; 24336 } 24337 return apply(fn, isBind ? thisArg : this, args); 24338 } 24339 return wrapper; 24340 } 24341 24342 /** 24343 * Creates a `_.range` or `_.rangeRight` function. 24344 * 24345 * @private 24346 * @param {boolean} [fromRight] Specify iterating from right to left. 24347 * @returns {Function} Returns the new range function. 24348 */ 24349 function createRange(fromRight) { 24350 return function(start, end, step) { 24351 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 24352 end = step = undefined; 24353 } 24354 // Ensure the sign of `-0` is preserved. 24355 start = toFinite(start); 24356 if (end === undefined) { 24357 end = start; 24358 start = 0; 24359 } else { 24360 end = toFinite(end); 24361 } 24362 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 24363 return baseRange(start, end, step, fromRight); 24364 }; 24365 } 24366 24367 /** 24368 * Creates a function that performs a relational operation on two values. 24369 * 24370 * @private 24371 * @param {Function} operator The function to perform the operation. 24372 * @returns {Function} Returns the new relational operation function. 24373 */ 24374 function createRelationalOperation(operator) { 24375 return function(value, other) { 24376 if (!(typeof value == 'string' && typeof other == 'string')) { 24377 value = toNumber(value); 24378 other = toNumber(other); 24379 } 24380 return operator(value, other); 24381 }; 24382 } 24383 24384 /** 24385 * Creates a function that wraps `func` to continue currying. 24386 * 24387 * @private 24388 * @param {Function} func The function to wrap. 24389 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24390 * @param {Function} wrapFunc The function to create the `func` wrapper. 24391 * @param {*} placeholder The placeholder value. 24392 * @param {*} [thisArg] The `this` binding of `func`. 24393 * @param {Array} [partials] The arguments to prepend to those provided to 24394 * the new function. 24395 * @param {Array} [holders] The `partials` placeholder indexes. 24396 * @param {Array} [argPos] The argument positions of the new function. 24397 * @param {number} [ary] The arity cap of `func`. 24398 * @param {number} [arity] The arity of `func`. 24399 * @returns {Function} Returns the new wrapped function. 24400 */ 24401 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 24402 var isCurry = bitmask & WRAP_CURRY_FLAG, 24403 newHolders = isCurry ? holders : undefined, 24404 newHoldersRight = isCurry ? undefined : holders, 24405 newPartials = isCurry ? partials : undefined, 24406 newPartialsRight = isCurry ? undefined : partials; 24407 24408 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 24409 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 24410 24411 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 24412 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 24413 } 24414 var newData = [ 24415 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 24416 newHoldersRight, argPos, ary, arity 24417 ]; 24418 24419 var result = wrapFunc.apply(undefined, newData); 24420 if (isLaziable(func)) { 24421 setData(result, newData); 24422 } 24423 result.placeholder = placeholder; 24424 return setWrapToString(result, func, bitmask); 24425 } 24426 24427 /** 24428 * Creates a function like `_.round`. 24429 * 24430 * @private 24431 * @param {string} methodName The name of the `Math` method to use when rounding. 24432 * @returns {Function} Returns the new round function. 24433 */ 24434 function createRound(methodName) { 24435 var func = Math[methodName]; 24436 return function(number, precision) { 24437 number = toNumber(number); 24438 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 24439 if (precision && nativeIsFinite(number)) { 24440 // Shift with exponential notation to avoid floating-point issues. 24441 // See [MDN](https://mdn.io/round#Examples) for more details. 24442 var pair = (toString(number) + 'e').split('e'), 24443 value = func(pair[0] + 'e' + (+pair[1] + precision)); 24444 24445 pair = (toString(value) + 'e').split('e'); 24446 return +(pair[0] + 'e' + (+pair[1] - precision)); 24447 } 24448 return func(number); 24449 }; 24450 } 24451 24452 /** 24453 * Creates a set object of `values`. 24454 * 24455 * @private 24456 * @param {Array} values The values to add to the set. 24457 * @returns {Object} Returns the new set. 24458 */ 24459 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 24460 return new Set(values); 24461 }; 24462 24463 /** 24464 * Creates a `_.toPairs` or `_.toPairsIn` function. 24465 * 24466 * @private 24467 * @param {Function} keysFunc The function to get the keys of a given object. 24468 * @returns {Function} Returns the new pairs function. 24469 */ 24470 function createToPairs(keysFunc) { 24471 return function(object) { 24472 var tag = getTag(object); 24473 if (tag == mapTag) { 24474 return mapToArray(object); 24475 } 24476 if (tag == setTag) { 24477 return setToPairs(object); 24478 } 24479 return baseToPairs(object, keysFunc(object)); 24480 }; 24481 } 24482 24483 /** 24484 * Creates a function that either curries or invokes `func` with optional 24485 * `this` binding and partially applied arguments. 24486 * 24487 * @private 24488 * @param {Function|string} func The function or method name to wrap. 24489 * @param {number} bitmask The bitmask flags. 24490 * 1 - `_.bind` 24491 * 2 - `_.bindKey` 24492 * 4 - `_.curry` or `_.curryRight` of a bound function 24493 * 8 - `_.curry` 24494 * 16 - `_.curryRight` 24495 * 32 - `_.partial` 24496 * 64 - `_.partialRight` 24497 * 128 - `_.rearg` 24498 * 256 - `_.ary` 24499 * 512 - `_.flip` 24500 * @param {*} [thisArg] The `this` binding of `func`. 24501 * @param {Array} [partials] The arguments to be partially applied. 24502 * @param {Array} [holders] The `partials` placeholder indexes. 24503 * @param {Array} [argPos] The argument positions of the new function. 24504 * @param {number} [ary] The arity cap of `func`. 24505 * @param {number} [arity] The arity of `func`. 24506 * @returns {Function} Returns the new wrapped function. 24507 */ 24508 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 24509 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 24510 if (!isBindKey && typeof func != 'function') { 24511 throw new TypeError(FUNC_ERROR_TEXT); 24512 } 24513 var length = partials ? partials.length : 0; 24514 if (!length) { 24515 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 24516 partials = holders = undefined; 24517 } 24518 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 24519 arity = arity === undefined ? arity : toInteger(arity); 24520 length -= holders ? holders.length : 0; 24521 24522 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 24523 var partialsRight = partials, 24524 holdersRight = holders; 24525 24526 partials = holders = undefined; 24527 } 24528 var data = isBindKey ? undefined : getData(func); 24529 24530 var newData = [ 24531 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 24532 argPos, ary, arity 24533 ]; 24534 24535 if (data) { 24536 mergeData(newData, data); 24537 } 24538 func = newData[0]; 24539 bitmask = newData[1]; 24540 thisArg = newData[2]; 24541 partials = newData[3]; 24542 holders = newData[4]; 24543 arity = newData[9] = newData[9] === undefined 24544 ? (isBindKey ? 0 : func.length) 24545 : nativeMax(newData[9] - length, 0); 24546 24547 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 24548 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 24549 } 24550 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 24551 var result = createBind(func, bitmask, thisArg); 24552 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 24553 result = createCurry(func, bitmask, arity); 24554 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 24555 result = createPartial(func, bitmask, thisArg, partials); 24556 } else { 24557 result = createHybrid.apply(undefined, newData); 24558 } 24559 var setter = data ? baseSetData : setData; 24560 return setWrapToString(setter(result, newData), func, bitmask); 24561 } 24562 24563 /** 24564 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 24565 * of source objects to the destination object for all destination properties 24566 * that resolve to `undefined`. 24567 * 24568 * @private 24569 * @param {*} objValue The destination value. 24570 * @param {*} srcValue The source value. 24571 * @param {string} key The key of the property to assign. 24572 * @param {Object} object The parent object of `objValue`. 24573 * @returns {*} Returns the value to assign. 24574 */ 24575 function customDefaultsAssignIn(objValue, srcValue, key, object) { 24576 if (objValue === undefined || 24577 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 24578 return srcValue; 24579 } 24580 return objValue; 24581 } 24582 24583 /** 24584 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 24585 * objects into destination objects that are passed thru. 24586 * 24587 * @private 24588 * @param {*} objValue The destination value. 24589 * @param {*} srcValue The source value. 24590 * @param {string} key The key of the property to merge. 24591 * @param {Object} object The parent object of `objValue`. 24592 * @param {Object} source The parent object of `srcValue`. 24593 * @param {Object} [stack] Tracks traversed source values and their merged 24594 * counterparts. 24595 * @returns {*} Returns the value to assign. 24596 */ 24597 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 24598 if (isObject(objValue) && isObject(srcValue)) { 24599 // Recursively merge objects and arrays (susceptible to call stack limits). 24600 stack.set(srcValue, objValue); 24601 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 24602 stack['delete'](srcValue); 24603 } 24604 return objValue; 24605 } 24606 24607 /** 24608 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 24609 * objects. 24610 * 24611 * @private 24612 * @param {*} value The value to inspect. 24613 * @param {string} key The key of the property to inspect. 24614 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 24615 */ 24616 function customOmitClone(value) { 24617 return isPlainObject(value) ? undefined : value; 24618 } 24619 24620 /** 24621 * A specialized version of `baseIsEqualDeep` for arrays with support for 24622 * partial deep comparisons. 24623 * 24624 * @private 24625 * @param {Array} array The array to compare. 24626 * @param {Array} other The other array to compare. 24627 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 24628 * @param {Function} customizer The function to customize comparisons. 24629 * @param {Function} equalFunc The function to determine equivalents of values. 24630 * @param {Object} stack Tracks traversed `array` and `other` objects. 24631 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 24632 */ 24633 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 24634 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 24635 arrLength = array.length, 24636 othLength = other.length; 24637 24638 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 24639 return false; 24640 } 24641 // Assume cyclic values are equal. 24642 var stacked = stack.get(array); 24643 if (stacked && stack.get(other)) { 24644 return stacked == other; 24645 } 24646 var index = -1, 24647 result = true, 24648 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 24649 24650 stack.set(array, other); 24651 stack.set(other, array); 24652 24653 // Ignore non-index properties. 24654 while (++index < arrLength) { 24655 var arrValue = array[index], 24656 othValue = other[index]; 24657 24658 if (customizer) { 24659 var compared = isPartial 24660 ? customizer(othValue, arrValue, index, other, array, stack) 24661 : customizer(arrValue, othValue, index, array, other, stack); 24662 } 24663 if (compared !== undefined) { 24664 if (compared) { 24665 continue; 24666 } 24667 result = false; 24668 break; 24669 } 24670 // Recursively compare arrays (susceptible to call stack limits). 24671 if (seen) { 24672 if (!arraySome(other, function(othValue, othIndex) { 24673 if (!cacheHas(seen, othIndex) && 24674 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 24675 return seen.push(othIndex); 24676 } 24677 })) { 24678 result = false; 24679 break; 24680 } 24681 } else if (!( 24682 arrValue === othValue || 24683 equalFunc(arrValue, othValue, bitmask, customizer, stack) 24684 )) { 24685 result = false; 24686 break; 24687 } 24688 } 24689 stack['delete'](array); 24690 stack['delete'](other); 24691 return result; 24692 } 24693 24694 /** 24695 * A specialized version of `baseIsEqualDeep` for comparing objects of 24696 * the same `toStringTag`. 24697 * 24698 * **Note:** This function only supports comparing values with tags of 24699 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 24700 * 24701 * @private 24702 * @param {Object} object The object to compare. 24703 * @param {Object} other The other object to compare. 24704 * @param {string} tag The `toStringTag` of the objects to compare. 24705 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 24706 * @param {Function} customizer The function to customize comparisons. 24707 * @param {Function} equalFunc The function to determine equivalents of values. 24708 * @param {Object} stack Tracks traversed `object` and `other` objects. 24709 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 24710 */ 24711 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 24712 switch (tag) { 24713 case dataViewTag: 24714 if ((object.byteLength != other.byteLength) || 24715 (object.byteOffset != other.byteOffset)) { 24716 return false; 24717 } 24718 object = object.buffer; 24719 other = other.buffer; 24720 24721 case arrayBufferTag: 24722 if ((object.byteLength != other.byteLength) || 24723 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 24724 return false; 24725 } 24726 return true; 24727 24728 case boolTag: 24729 case dateTag: 24730 case numberTag: 24731 // Coerce booleans to `1` or `0` and dates to milliseconds. 24732 // Invalid dates are coerced to `NaN`. 24733 return eq(+object, +other); 24734 24735 case errorTag: 24736 return object.name == other.name && object.message == other.message; 24737 24738 case regexpTag: 24739 case stringTag: 24740 // Coerce regexes to strings and treat strings, primitives and objects, 24741 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 24742 // for more details. 24743 return object == (other + ''); 24744 24745 case mapTag: 24746 var convert = mapToArray; 24747 24748 case setTag: 24749 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 24750 convert || (convert = setToArray); 24751 24752 if (object.size != other.size && !isPartial) { 24753 return false; 24754 } 24755 // Assume cyclic values are equal. 24756 var stacked = stack.get(object); 24757 if (stacked) { 24758 return stacked == other; 24759 } 24760 bitmask |= COMPARE_UNORDERED_FLAG; 24761 24762 // Recursively compare objects (susceptible to call stack limits). 24763 stack.set(object, other); 24764 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 24765 stack['delete'](object); 24766 return result; 24767 24768 case symbolTag: 24769 if (symbolValueOf) { 24770 return symbolValueOf.call(object) == symbolValueOf.call(other); 24771 } 24772 } 24773 return false; 24774 } 24775 24776 /** 24777 * A specialized version of `baseIsEqualDeep` for objects with support for 24778 * partial deep comparisons. 24779 * 24780 * @private 24781 * @param {Object} object The object to compare. 24782 * @param {Object} other The other object to compare. 24783 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 24784 * @param {Function} customizer The function to customize comparisons. 24785 * @param {Function} equalFunc The function to determine equivalents of values. 24786 * @param {Object} stack Tracks traversed `object` and `other` objects. 24787 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 24788 */ 24789 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 24790 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 24791 objProps = getAllKeys(object), 24792 objLength = objProps.length, 24793 othProps = getAllKeys(other), 24794 othLength = othProps.length; 24795 24796 if (objLength != othLength && !isPartial) { 24797 return false; 24798 } 24799 var index = objLength; 24800 while (index--) { 24801 var key = objProps[index]; 24802 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 24803 return false; 24804 } 24805 } 24806 // Assume cyclic values are equal. 24807 var stacked = stack.get(object); 24808 if (stacked && stack.get(other)) { 24809 return stacked == other; 24810 } 24811 var result = true; 24812 stack.set(object, other); 24813 stack.set(other, object); 24814 24815 var skipCtor = isPartial; 24816 while (++index < objLength) { 24817 key = objProps[index]; 24818 var objValue = object[key], 24819 othValue = other[key]; 24820 24821 if (customizer) { 24822 var compared = isPartial 24823 ? customizer(othValue, objValue, key, other, object, stack) 24824 : customizer(objValue, othValue, key, object, other, stack); 24825 } 24826 // Recursively compare objects (susceptible to call stack limits). 24827 if (!(compared === undefined 24828 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 24829 : compared 24830 )) { 24831 result = false; 24832 break; 24833 } 24834 skipCtor || (skipCtor = key == 'constructor'); 24835 } 24836 if (result && !skipCtor) { 24837 var objCtor = object.constructor, 24838 othCtor = other.constructor; 24839 24840 // Non `Object` object instances with different constructors are not equal. 24841 if (objCtor != othCtor && 24842 ('constructor' in object && 'constructor' in other) && 24843 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 24844 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 24845 result = false; 24846 } 24847 } 24848 stack['delete'](object); 24849 stack['delete'](other); 24850 return result; 24851 } 24852 24853 /** 24854 * A specialized version of `baseRest` which flattens the rest array. 24855 * 24856 * @private 24857 * @param {Function} func The function to apply a rest parameter to. 24858 * @returns {Function} Returns the new function. 24859 */ 24860 function flatRest(func) { 24861 return setToString(overRest(func, undefined, flatten), func + ''); 24862 } 24863 24864 /** 24865 * Creates an array of own enumerable property names and symbols of `object`. 24866 * 24867 * @private 24868 * @param {Object} object The object to query. 24869 * @returns {Array} Returns the array of property names and symbols. 24870 */ 24871 function getAllKeys(object) { 24872 return baseGetAllKeys(object, keys, getSymbols); 24873 } 24874 24875 /** 24876 * Creates an array of own and inherited enumerable property names and 24877 * symbols of `object`. 24878 * 24879 * @private 24880 * @param {Object} object The object to query. 24881 * @returns {Array} Returns the array of property names and symbols. 24882 */ 24883 function getAllKeysIn(object) { 24884 return baseGetAllKeys(object, keysIn, getSymbolsIn); 24885 } 24886 24887 /** 24888 * Gets metadata for `func`. 24889 * 24890 * @private 24891 * @param {Function} func The function to query. 24892 * @returns {*} Returns the metadata for `func`. 24893 */ 24894 var getData = !metaMap ? noop : function(func) { 24895 return metaMap.get(func); 24896 }; 24897 24898 /** 24899 * Gets the name of `func`. 24900 * 24901 * @private 24902 * @param {Function} func The function to query. 24903 * @returns {string} Returns the function name. 24904 */ 24905 function getFuncName(func) { 24906 var result = (func.name + ''), 24907 array = realNames[result], 24908 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 24909 24910 while (length--) { 24911 var data = array[length], 24912 otherFunc = data.func; 24913 if (otherFunc == null || otherFunc == func) { 24914 return data.name; 24915 } 24916 } 24917 return result; 24918 } 24919 24920 /** 24921 * Gets the argument placeholder value for `func`. 24922 * 24923 * @private 24924 * @param {Function} func The function to inspect. 24925 * @returns {*} Returns the placeholder value. 24926 */ 24927 function getHolder(func) { 24928 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 24929 return object.placeholder; 24930 } 24931 24932 /** 24933 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 24934 * this function returns the custom method, otherwise it returns `baseIteratee`. 24935 * If arguments are provided, the chosen function is invoked with them and 24936 * its result is returned. 24937 * 24938 * @private 24939 * @param {*} [value] The value to convert to an iteratee. 24940 * @param {number} [arity] The arity of the created iteratee. 24941 * @returns {Function} Returns the chosen function or its result. 24942 */ 24943 function getIteratee() { 24944 var result = lodash.iteratee || iteratee; 24945 result = result === iteratee ? baseIteratee : result; 24946 return arguments.length ? result(arguments[0], arguments[1]) : result; 24947 } 24948 24949 /** 24950 * Gets the data for `map`. 24951 * 24952 * @private 24953 * @param {Object} map The map to query. 24954 * @param {string} key The reference key. 24955 * @returns {*} Returns the map data. 24956 */ 24957 function getMapData(map, key) { 24958 var data = map.__data__; 24959 return isKeyable(key) 24960 ? data[typeof key == 'string' ? 'string' : 'hash'] 24961 : data.map; 24962 } 24963 24964 /** 24965 * Gets the property names, values, and compare flags of `object`. 24966 * 24967 * @private 24968 * @param {Object} object The object to query. 24969 * @returns {Array} Returns the match data of `object`. 24970 */ 24971 function getMatchData(object) { 24972 var result = keys(object), 24973 length = result.length; 24974 24975 while (length--) { 24976 var key = result[length], 24977 value = object[key]; 24978 24979 result[length] = [key, value, isStrictComparable(value)]; 24980 } 24981 return result; 24982 } 24983 24984 /** 24985 * Gets the native function at `key` of `object`. 24986 * 24987 * @private 24988 * @param {Object} object The object to query. 24989 * @param {string} key The key of the method to get. 24990 * @returns {*} Returns the function if it's native, else `undefined`. 24991 */ 24992 function getNative(object, key) { 24993 var value = getValue(object, key); 24994 return baseIsNative(value) ? value : undefined; 24995 } 24996 24997 /** 24998 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 24999 * 25000 * @private 25001 * @param {*} value The value to query. 25002 * @returns {string} Returns the raw `toStringTag`. 25003 */ 25004 function getRawTag(value) { 25005 var isOwn = hasOwnProperty.call(value, symToStringTag), 25006 tag = value[symToStringTag]; 25007 25008 try { 25009 value[symToStringTag] = undefined; 25010 var unmasked = true; 25011 } catch (e) {} 25012 25013 var result = nativeObjectToString.call(value); 25014 if (unmasked) { 25015 if (isOwn) { 25016 value[symToStringTag] = tag; 25017 } else { 25018 delete value[symToStringTag]; 25019 } 25020 } 25021 return result; 25022 } 25023 25024 /** 25025 * Creates an array of the own enumerable symbols of `object`. 25026 * 25027 * @private 25028 * @param {Object} object The object to query. 25029 * @returns {Array} Returns the array of symbols. 25030 */ 25031 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 25032 if (object == null) { 25033 return []; 25034 } 25035 object = Object(object); 25036 return arrayFilter(nativeGetSymbols(object), function(symbol) { 25037 return propertyIsEnumerable.call(object, symbol); 25038 }); 25039 }; 25040 25041 /** 25042 * Creates an array of the own and inherited enumerable symbols of `object`. 25043 * 25044 * @private 25045 * @param {Object} object The object to query. 25046 * @returns {Array} Returns the array of symbols. 25047 */ 25048 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 25049 var result = []; 25050 while (object) { 25051 arrayPush(result, getSymbols(object)); 25052 object = getPrototype(object); 25053 } 25054 return result; 25055 }; 25056 25057 /** 25058 * Gets the `toStringTag` of `value`. 25059 * 25060 * @private 25061 * @param {*} value The value to query. 25062 * @returns {string} Returns the `toStringTag`. 25063 */ 25064 var getTag = baseGetTag; 25065 25066 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 25067 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 25068 (Map && getTag(new Map) != mapTag) || 25069 (Promise && getTag(Promise.resolve()) != promiseTag) || 25070 (Set && getTag(new Set) != setTag) || 25071 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 25072 getTag = function(value) { 25073 var result = baseGetTag(value), 25074 Ctor = result == objectTag ? value.constructor : undefined, 25075 ctorString = Ctor ? toSource(Ctor) : ''; 25076 25077 if (ctorString) { 25078 switch (ctorString) { 25079 case dataViewCtorString: return dataViewTag; 25080 case mapCtorString: return mapTag; 25081 case promiseCtorString: return promiseTag; 25082 case setCtorString: return setTag; 25083 case weakMapCtorString: return weakMapTag; 25084 } 25085 } 25086 return result; 25087 }; 25088 } 25089 25090 /** 25091 * Gets the view, applying any `transforms` to the `start` and `end` positions. 25092 * 25093 * @private 25094 * @param {number} start The start of the view. 25095 * @param {number} end The end of the view. 25096 * @param {Array} transforms The transformations to apply to the view. 25097 * @returns {Object} Returns an object containing the `start` and `end` 25098 * positions of the view. 25099 */ 25100 function getView(start, end, transforms) { 25101 var index = -1, 25102 length = transforms.length; 25103 25104 while (++index < length) { 25105 var data = transforms[index], 25106 size = data.size; 25107 25108 switch (data.type) { 25109 case 'drop': start += size; break; 25110 case 'dropRight': end -= size; break; 25111 case 'take': end = nativeMin(end, start + size); break; 25112 case 'takeRight': start = nativeMax(start, end - size); break; 25113 } 25114 } 25115 return { 'start': start, 'end': end }; 25116 } 25117 25118 /** 25119 * Extracts wrapper details from the `source` body comment. 25120 * 25121 * @private 25122 * @param {string} source The source to inspect. 25123 * @returns {Array} Returns the wrapper details. 25124 */ 25125 function getWrapDetails(source) { 25126 var match = source.match(reWrapDetails); 25127 return match ? match[1].split(reSplitDetails) : []; 25128 } 25129 25130 /** 25131 * Checks if `path` exists on `object`. 25132 * 25133 * @private 25134 * @param {Object} object The object to query. 25135 * @param {Array|string} path The path to check. 25136 * @param {Function} hasFunc The function to check properties. 25137 * @returns {boolean} Returns `true` if `path` exists, else `false`. 25138 */ 25139 function hasPath(object, path, hasFunc) { 25140 path = castPath(path, object); 25141 25142 var index = -1, 25143 length = path.length, 25144 result = false; 25145 25146 while (++index < length) { 25147 var key = toKey(path[index]); 25148 if (!(result = object != null && hasFunc(object, key))) { 25149 break; 25150 } 25151 object = object[key]; 25152 } 25153 if (result || ++index != length) { 25154 return result; 25155 } 25156 length = object == null ? 0 : object.length; 25157 return !!length && isLength(length) && isIndex(key, length) && 25158 (isArray(object) || isArguments(object)); 25159 } 25160 25161 /** 25162 * Initializes an array clone. 25163 * 25164 * @private 25165 * @param {Array} array The array to clone. 25166 * @returns {Array} Returns the initialized clone. 25167 */ 25168 function initCloneArray(array) { 25169 var length = array.length, 25170 result = new array.constructor(length); 25171 25172 // Add properties assigned by `RegExp#exec`. 25173 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 25174 result.index = array.index; 25175 result.input = array.input; 25176 } 25177 return result; 25178 } 25179 25180 /** 25181 * Initializes an object clone. 25182 * 25183 * @private 25184 * @param {Object} object The object to clone. 25185 * @returns {Object} Returns the initialized clone. 25186 */ 25187 function initCloneObject(object) { 25188 return (typeof object.constructor == 'function' && !isPrototype(object)) 25189 ? baseCreate(getPrototype(object)) 25190 : {}; 25191 } 25192 25193 /** 25194 * Initializes an object clone based on its `toStringTag`. 25195 * 25196 * **Note:** This function only supports cloning values with tags of 25197 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 25198 * 25199 * @private 25200 * @param {Object} object The object to clone. 25201 * @param {string} tag The `toStringTag` of the object to clone. 25202 * @param {boolean} [isDeep] Specify a deep clone. 25203 * @returns {Object} Returns the initialized clone. 25204 */ 25205 function initCloneByTag(object, tag, isDeep) { 25206 var Ctor = object.constructor; 25207 switch (tag) { 25208 case arrayBufferTag: 25209 return cloneArrayBuffer(object); 25210 25211 case boolTag: 25212 case dateTag: 25213 return new Ctor(+object); 25214 25215 case dataViewTag: 25216 return cloneDataView(object, isDeep); 25217 25218 case float32Tag: case float64Tag: 25219 case int8Tag: case int16Tag: case int32Tag: 25220 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 25221 return cloneTypedArray(object, isDeep); 25222 25223 case mapTag: 25224 return new Ctor; 25225 25226 case numberTag: 25227 case stringTag: 25228 return new Ctor(object); 25229 25230 case regexpTag: 25231 return cloneRegExp(object); 25232 25233 case setTag: 25234 return new Ctor; 25235 25236 case symbolTag: 25237 return cloneSymbol(object); 25238 } 25239 } 25240 25241 /** 25242 * Inserts wrapper `details` in a comment at the top of the `source` body. 25243 * 25244 * @private 25245 * @param {string} source The source to modify. 25246 * @returns {Array} details The details to insert. 25247 * @returns {string} Returns the modified source. 25248 */ 25249 function insertWrapDetails(source, details) { 25250 var length = details.length; 25251 if (!length) { 25252 return source; 25253 } 25254 var lastIndex = length - 1; 25255 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 25256 details = details.join(length > 2 ? ', ' : ' '); 25257 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 25258 } 25259 25260 /** 25261 * Checks if `value` is a flattenable `arguments` object or array. 25262 * 25263 * @private 25264 * @param {*} value The value to check. 25265 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 25266 */ 25267 function isFlattenable(value) { 25268 return isArray(value) || isArguments(value) || 25269 !!(spreadableSymbol && value && value[spreadableSymbol]); 25270 } 25271 25272 /** 25273 * Checks if `value` is a valid array-like index. 25274 * 25275 * @private 25276 * @param {*} value The value to check. 25277 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 25278 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 25279 */ 25280 function isIndex(value, length) { 25281 var type = typeof value; 25282 length = length == null ? MAX_SAFE_INTEGER : length; 25283 25284 return !!length && 25285 (type == 'number' || 25286 (type != 'symbol' && reIsUint.test(value))) && 25287 (value > -1 && value % 1 == 0 && value < length); 25288 } 25289 25290 /** 25291 * Checks if the given arguments are from an iteratee call. 25292 * 25293 * @private 25294 * @param {*} value The potential iteratee value argument. 25295 * @param {*} index The potential iteratee index or key argument. 25296 * @param {*} object The potential iteratee object argument. 25297 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 25298 * else `false`. 25299 */ 25300 function isIterateeCall(value, index, object) { 25301 if (!isObject(object)) { 25302 return false; 25303 } 25304 var type = typeof index; 25305 if (type == 'number' 25306 ? (isArrayLike(object) && isIndex(index, object.length)) 25307 : (type == 'string' && index in object) 25308 ) { 25309 return eq(object[index], value); 25310 } 25311 return false; 25312 } 25313 25314 /** 25315 * Checks if `value` is a property name and not a property path. 25316 * 25317 * @private 25318 * @param {*} value The value to check. 25319 * @param {Object} [object] The object to query keys on. 25320 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 25321 */ 25322 function isKey(value, object) { 25323 if (isArray(value)) { 25324 return false; 25325 } 25326 var type = typeof value; 25327 if (type == 'number' || type == 'symbol' || type == 'boolean' || 25328 value == null || isSymbol(value)) { 25329 return true; 25330 } 25331 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 25332 (object != null && value in Object(object)); 25333 } 25334 25335 /** 25336 * Checks if `value` is suitable for use as unique object key. 25337 * 25338 * @private 25339 * @param {*} value The value to check. 25340 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 25341 */ 25342 function isKeyable(value) { 25343 var type = typeof value; 25344 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 25345 ? (value !== '__proto__') 25346 : (value === null); 25347 } 25348 25349 /** 25350 * Checks if `func` has a lazy counterpart. 25351 * 25352 * @private 25353 * @param {Function} func The function to check. 25354 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 25355 * else `false`. 25356 */ 25357 function isLaziable(func) { 25358 var funcName = getFuncName(func), 25359 other = lodash[funcName]; 25360 25361 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 25362 return false; 25363 } 25364 if (func === other) { 25365 return true; 25366 } 25367 var data = getData(other); 25368 return !!data && func === data[0]; 25369 } 25370 25371 /** 25372 * Checks if `func` has its source masked. 25373 * 25374 * @private 25375 * @param {Function} func The function to check. 25376 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 25377 */ 25378 function isMasked(func) { 25379 return !!maskSrcKey && (maskSrcKey in func); 25380 } 25381 25382 /** 25383 * Checks if `func` is capable of being masked. 25384 * 25385 * @private 25386 * @param {*} value The value to check. 25387 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 25388 */ 25389 var isMaskable = coreJsData ? isFunction : stubFalse; 25390 25391 /** 25392 * Checks if `value` is likely a prototype object. 25393 * 25394 * @private 25395 * @param {*} value The value to check. 25396 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 25397 */ 25398 function isPrototype(value) { 25399 var Ctor = value && value.constructor, 25400 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 25401 25402 return value === proto; 25403 } 25404 25405 /** 25406 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 25407 * 25408 * @private 25409 * @param {*} value The value to check. 25410 * @returns {boolean} Returns `true` if `value` if suitable for strict 25411 * equality comparisons, else `false`. 25412 */ 25413 function isStrictComparable(value) { 25414 return value === value && !isObject(value); 25415 } 25416 25417 /** 25418 * A specialized version of `matchesProperty` for source values suitable 25419 * for strict equality comparisons, i.e. `===`. 25420 * 25421 * @private 25422 * @param {string} key The key of the property to get. 25423 * @param {*} srcValue The value to match. 25424 * @returns {Function} Returns the new spec function. 25425 */ 25426 function matchesStrictComparable(key, srcValue) { 25427 return function(object) { 25428 if (object == null) { 25429 return false; 25430 } 25431 return object[key] === srcValue && 25432 (srcValue !== undefined || (key in Object(object))); 25433 }; 25434 } 25435 25436 /** 25437 * A specialized version of `_.memoize` which clears the memoized function's 25438 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 25439 * 25440 * @private 25441 * @param {Function} func The function to have its output memoized. 25442 * @returns {Function} Returns the new memoized function. 25443 */ 25444 function memoizeCapped(func) { 25445 var result = memoize(func, function(key) { 25446 if (cache.size === MAX_MEMOIZE_SIZE) { 25447 cache.clear(); 25448 } 25449 return key; 25450 }); 25451 25452 var cache = result.cache; 25453 return result; 25454 } 25455 25456 /** 25457 * Merges the function metadata of `source` into `data`. 25458 * 25459 * Merging metadata reduces the number of wrappers used to invoke a function. 25460 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 25461 * may be applied regardless of execution order. Methods like `_.ary` and 25462 * `_.rearg` modify function arguments, making the order in which they are 25463 * executed important, preventing the merging of metadata. However, we make 25464 * an exception for a safe combined case where curried functions have `_.ary` 25465 * and or `_.rearg` applied. 25466 * 25467 * @private 25468 * @param {Array} data The destination metadata. 25469 * @param {Array} source The source metadata. 25470 * @returns {Array} Returns `data`. 25471 */ 25472 function mergeData(data, source) { 25473 var bitmask = data[1], 25474 srcBitmask = source[1], 25475 newBitmask = bitmask | srcBitmask, 25476 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 25477 25478 var isCombo = 25479 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 25480 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 25481 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 25482 25483 // Exit early if metadata can't be merged. 25484 if (!(isCommon || isCombo)) { 25485 return data; 25486 } 25487 // Use source `thisArg` if available. 25488 if (srcBitmask & WRAP_BIND_FLAG) { 25489 data[2] = source[2]; 25490 // Set when currying a bound function. 25491 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 25492 } 25493 // Compose partial arguments. 25494 var value = source[3]; 25495 if (value) { 25496 var partials = data[3]; 25497 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 25498 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 25499 } 25500 // Compose partial right arguments. 25501 value = source[5]; 25502 if (value) { 25503 partials = data[5]; 25504 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 25505 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 25506 } 25507 // Use source `argPos` if available. 25508 value = source[7]; 25509 if (value) { 25510 data[7] = value; 25511 } 25512 // Use source `ary` if it's smaller. 25513 if (srcBitmask & WRAP_ARY_FLAG) { 25514 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 25515 } 25516 // Use source `arity` if one is not provided. 25517 if (data[9] == null) { 25518 data[9] = source[9]; 25519 } 25520 // Use source `func` and merge bitmasks. 25521 data[0] = source[0]; 25522 data[1] = newBitmask; 25523 25524 return data; 25525 } 25526 25527 /** 25528 * This function is like 25529 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 25530 * except that it includes inherited enumerable properties. 25531 * 25532 * @private 25533 * @param {Object} object The object to query. 25534 * @returns {Array} Returns the array of property names. 25535 */ 25536 function nativeKeysIn(object) { 25537 var result = []; 25538 if (object != null) { 25539 for (var key in Object(object)) { 25540 result.push(key); 25541 } 25542 } 25543 return result; 25544 } 25545 25546 /** 25547 * Converts `value` to a string using `Object.prototype.toString`. 25548 * 25549 * @private 25550 * @param {*} value The value to convert. 25551 * @returns {string} Returns the converted string. 25552 */ 25553 function objectToString(value) { 25554 return nativeObjectToString.call(value); 25555 } 25556 25557 /** 25558 * A specialized version of `baseRest` which transforms the rest array. 25559 * 25560 * @private 25561 * @param {Function} func The function to apply a rest parameter to. 25562 * @param {number} [start=func.length-1] The start position of the rest parameter. 25563 * @param {Function} transform The rest array transform. 25564 * @returns {Function} Returns the new function. 25565 */ 25566 function overRest(func, start, transform) { 25567 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 25568 return function() { 25569 var args = arguments, 25570 index = -1, 25571 length = nativeMax(args.length - start, 0), 25572 array = Array(length); 25573 25574 while (++index < length) { 25575 array[index] = args[start + index]; 25576 } 25577 index = -1; 25578 var otherArgs = Array(start + 1); 25579 while (++index < start) { 25580 otherArgs[index] = args[index]; 25581 } 25582 otherArgs[start] = transform(array); 25583 return apply(func, this, otherArgs); 25584 }; 25585 } 25586 25587 /** 25588 * Gets the parent value at `path` of `object`. 25589 * 25590 * @private 25591 * @param {Object} object The object to query. 25592 * @param {Array} path The path to get the parent value of. 25593 * @returns {*} Returns the parent value. 25594 */ 25595 function parent(object, path) { 25596 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 25597 } 25598 25599 /** 25600 * Reorder `array` according to the specified indexes where the element at 25601 * the first index is assigned as the first element, the element at 25602 * the second index is assigned as the second element, and so on. 25603 * 25604 * @private 25605 * @param {Array} array The array to reorder. 25606 * @param {Array} indexes The arranged array indexes. 25607 * @returns {Array} Returns `array`. 25608 */ 25609 function reorder(array, indexes) { 25610 var arrLength = array.length, 25611 length = nativeMin(indexes.length, arrLength), 25612 oldArray = copyArray(array); 25613 25614 while (length--) { 25615 var index = indexes[length]; 25616 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 25617 } 25618 return array; 25619 } 25620 25621 /** 25622 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 25623 * 25624 * @private 25625 * @param {Object} object The object to query. 25626 * @param {string} key The key of the property to get. 25627 * @returns {*} Returns the property value. 25628 */ 25629 function safeGet(object, key) { 25630 if (key === 'constructor' && typeof object[key] === 'function') { 25631 return; 25632 } 25633 25634 if (key == '__proto__') { 25635 return; 25636 } 25637 25638 return object[key]; 25639 } 25640 25641 /** 25642 * Sets metadata for `func`. 25643 * 25644 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 25645 * period of time, it will trip its breaker and transition to an identity 25646 * function to avoid garbage collection pauses in V8. See 25647 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 25648 * for more details. 25649 * 25650 * @private 25651 * @param {Function} func The function to associate metadata with. 25652 * @param {*} data The metadata. 25653 * @returns {Function} Returns `func`. 25654 */ 25655 var setData = shortOut(baseSetData); 25656 25657 /** 25658 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 25659 * 25660 * @private 25661 * @param {Function} func The function to delay. 25662 * @param {number} wait The number of milliseconds to delay invocation. 25663 * @returns {number|Object} Returns the timer id or timeout object. 25664 */ 25665 var setTimeout = ctxSetTimeout || function(func, wait) { 25666 return root.setTimeout(func, wait); 25667 }; 25668 25669 /** 25670 * Sets the `toString` method of `func` to return `string`. 25671 * 25672 * @private 25673 * @param {Function} func The function to modify. 25674 * @param {Function} string The `toString` result. 25675 * @returns {Function} Returns `func`. 25676 */ 25677 var setToString = shortOut(baseSetToString); 25678 25679 /** 25680 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 25681 * with wrapper details in a comment at the top of the source body. 25682 * 25683 * @private 25684 * @param {Function} wrapper The function to modify. 25685 * @param {Function} reference The reference function. 25686 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 25687 * @returns {Function} Returns `wrapper`. 25688 */ 25689 function setWrapToString(wrapper, reference, bitmask) { 25690 var source = (reference + ''); 25691 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 25692 } 25693 25694 /** 25695 * Creates a function that'll short out and invoke `identity` instead 25696 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 25697 * milliseconds. 25698 * 25699 * @private 25700 * @param {Function} func The function to restrict. 25701 * @returns {Function} Returns the new shortable function. 25702 */ 25703 function shortOut(func) { 25704 var count = 0, 25705 lastCalled = 0; 25706 25707 return function() { 25708 var stamp = nativeNow(), 25709 remaining = HOT_SPAN - (stamp - lastCalled); 25710 25711 lastCalled = stamp; 25712 if (remaining > 0) { 25713 if (++count >= HOT_COUNT) { 25714 return arguments[0]; 25715 } 25716 } else { 25717 count = 0; 25718 } 25719 return func.apply(undefined, arguments); 25720 }; 25721 } 25722 25723 /** 25724 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 25725 * 25726 * @private 25727 * @param {Array} array The array to shuffle. 25728 * @param {number} [size=array.length] The size of `array`. 25729 * @returns {Array} Returns `array`. 25730 */ 25731 function shuffleSelf(array, size) { 25732 var index = -1, 25733 length = array.length, 25734 lastIndex = length - 1; 25735 25736 size = size === undefined ? length : size; 25737 while (++index < size) { 25738 var rand = baseRandom(index, lastIndex), 25739 value = array[rand]; 25740 25741 array[rand] = array[index]; 25742 array[index] = value; 25743 } 25744 array.length = size; 25745 return array; 25746 } 25747 25748 /** 25749 * Converts `string` to a property path array. 25750 * 25751 * @private 25752 * @param {string} string The string to convert. 25753 * @returns {Array} Returns the property path array. 25754 */ 25755 var stringToPath = memoizeCapped(function(string) { 25756 var result = []; 25757 if (string.charCodeAt(0) === 46 /* . */) { 25758 result.push(''); 25759 } 25760 string.replace(rePropName, function(match, number, quote, subString) { 25761 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 25762 }); 25763 return result; 25764 }); 25765 25766 /** 25767 * Converts `value` to a string key if it's not a string or symbol. 25768 * 25769 * @private 25770 * @param {*} value The value to inspect. 25771 * @returns {string|symbol} Returns the key. 25772 */ 25773 function toKey(value) { 25774 if (typeof value == 'string' || isSymbol(value)) { 25775 return value; 25776 } 25777 var result = (value + ''); 25778 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 25779 } 25780 25781 /** 25782 * Converts `func` to its source code. 25783 * 25784 * @private 25785 * @param {Function} func The function to convert. 25786 * @returns {string} Returns the source code. 25787 */ 25788 function toSource(func) { 25789 if (func != null) { 25790 try { 25791 return funcToString.call(func); 25792 } catch (e) {} 25793 try { 25794 return (func + ''); 25795 } catch (e) {} 25796 } 25797 return ''; 25798 } 25799 25800 /** 25801 * Updates wrapper `details` based on `bitmask` flags. 25802 * 25803 * @private 25804 * @returns {Array} details The details to modify. 25805 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 25806 * @returns {Array} Returns `details`. 25807 */ 25808 function updateWrapDetails(details, bitmask) { 25809 arrayEach(wrapFlags, function(pair) { 25810 var value = '_.' + pair[0]; 25811 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 25812 details.push(value); 25813 } 25814 }); 25815 return details.sort(); 25816 } 25817 25818 /** 25819 * Creates a clone of `wrapper`. 25820 * 25821 * @private 25822 * @param {Object} wrapper The wrapper to clone. 25823 * @returns {Object} Returns the cloned wrapper. 25824 */ 25825 function wrapperClone(wrapper) { 25826 if (wrapper instanceof LazyWrapper) { 25827 return wrapper.clone(); 25828 } 25829 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 25830 result.__actions__ = copyArray(wrapper.__actions__); 25831 result.__index__ = wrapper.__index__; 25832 result.__values__ = wrapper.__values__; 25833 return result; 25834 } 25835 25836 /*------------------------------------------------------------------------*/ 25837 25838 /** 25839 * Creates an array of elements split into groups the length of `size`. 25840 * If `array` can't be split evenly, the final chunk will be the remaining 25841 * elements. 25842 * 25843 * @static 25844 * @memberOf _ 25845 * @since 3.0.0 25846 * @category Array 25847 * @param {Array} array The array to process. 25848 * @param {number} [size=1] The length of each chunk 25849 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 25850 * @returns {Array} Returns the new array of chunks. 25851 * @example 25852 * 25853 * _.chunk(['a', 'b', 'c', 'd'], 2); 25854 * // => [['a', 'b'], ['c', 'd']] 25855 * 25856 * _.chunk(['a', 'b', 'c', 'd'], 3); 25857 * // => [['a', 'b', 'c'], ['d']] 25858 */ 25859 function chunk(array, size, guard) { 25860 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 25861 size = 1; 25862 } else { 25863 size = nativeMax(toInteger(size), 0); 25864 } 25865 var length = array == null ? 0 : array.length; 25866 if (!length || size < 1) { 25867 return []; 25868 } 25869 var index = 0, 25870 resIndex = 0, 25871 result = Array(nativeCeil(length / size)); 25872 25873 while (index < length) { 25874 result[resIndex++] = baseSlice(array, index, (index += size)); 25875 } 25876 return result; 25877 } 25878 25879 /** 25880 * Creates an array with all falsey values removed. The values `false`, `null`, 25881 * `0`, `""`, `undefined`, and `NaN` are falsey. 25882 * 25883 * @static 25884 * @memberOf _ 25885 * @since 0.1.0 25886 * @category Array 25887 * @param {Array} array The array to compact. 25888 * @returns {Array} Returns the new array of filtered values. 25889 * @example 25890 * 25891 * _.compact([0, 1, false, 2, '', 3]); 25892 * // => [1, 2, 3] 25893 */ 25894 function compact(array) { 25895 var index = -1, 25896 length = array == null ? 0 : array.length, 25897 resIndex = 0, 25898 result = []; 25899 25900 while (++index < length) { 25901 var value = array[index]; 25902 if (value) { 25903 result[resIndex++] = value; 25904 } 25905 } 25906 return result; 25907 } 25908 25909 /** 25910 * Creates a new array concatenating `array` with any additional arrays 25911 * and/or values. 25912 * 25913 * @static 25914 * @memberOf _ 25915 * @since 4.0.0 25916 * @category Array 25917 * @param {Array} array The array to concatenate. 25918 * @param {...*} [values] The values to concatenate. 25919 * @returns {Array} Returns the new concatenated array. 25920 * @example 25921 * 25922 * var array = [1]; 25923 * var other = _.concat(array, 2, [3], [[4]]); 25924 * 25925 * console.log(other); 25926 * // => [1, 2, 3, [4]] 25927 * 25928 * console.log(array); 25929 * // => [1] 25930 */ 25931 function concat() { 25932 var length = arguments.length; 25933 if (!length) { 25934 return []; 25935 } 25936 var args = Array(length - 1), 25937 array = arguments[0], 25938 index = length; 25939 25940 while (index--) { 25941 args[index - 1] = arguments[index]; 25942 } 25943 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 25944 } 25945 25946 /** 25947 * Creates an array of `array` values not included in the other given arrays 25948 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25949 * for equality comparisons. The order and references of result values are 25950 * determined by the first array. 25951 * 25952 * **Note:** Unlike `_.pullAll`, this method returns a new array. 25953 * 25954 * @static 25955 * @memberOf _ 25956 * @since 0.1.0 25957 * @category Array 25958 * @param {Array} array The array to inspect. 25959 * @param {...Array} [values] The values to exclude. 25960 * @returns {Array} Returns the new array of filtered values. 25961 * @see _.without, _.xor 25962 * @example 25963 * 25964 * _.difference([2, 1], [2, 3]); 25965 * // => [1] 25966 */ 25967 var difference = baseRest(function(array, values) { 25968 return isArrayLikeObject(array) 25969 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 25970 : []; 25971 }); 25972 25973 /** 25974 * This method is like `_.difference` except that it accepts `iteratee` which 25975 * is invoked for each element of `array` and `values` to generate the criterion 25976 * by which they're compared. The order and references of result values are 25977 * determined by the first array. The iteratee is invoked with one argument: 25978 * (value). 25979 * 25980 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 25981 * 25982 * @static 25983 * @memberOf _ 25984 * @since 4.0.0 25985 * @category Array 25986 * @param {Array} array The array to inspect. 25987 * @param {...Array} [values] The values to exclude. 25988 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25989 * @returns {Array} Returns the new array of filtered values. 25990 * @example 25991 * 25992 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 25993 * // => [1.2] 25994 * 25995 * // The `_.property` iteratee shorthand. 25996 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 25997 * // => [{ 'x': 2 }] 25998 */ 25999 var differenceBy = baseRest(function(array, values) { 26000 var iteratee = last(values); 26001 if (isArrayLikeObject(iteratee)) { 26002 iteratee = undefined; 26003 } 26004 return isArrayLikeObject(array) 26005 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 26006 : []; 26007 }); 26008 26009 /** 26010 * This method is like `_.difference` except that it accepts `comparator` 26011 * which is invoked to compare elements of `array` to `values`. The order and 26012 * references of result values are determined by the first array. The comparator 26013 * is invoked with two arguments: (arrVal, othVal). 26014 * 26015 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 26016 * 26017 * @static 26018 * @memberOf _ 26019 * @since 4.0.0 26020 * @category Array 26021 * @param {Array} array The array to inspect. 26022 * @param {...Array} [values] The values to exclude. 26023 * @param {Function} [comparator] The comparator invoked per element. 26024 * @returns {Array} Returns the new array of filtered values. 26025 * @example 26026 * 26027 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 26028 * 26029 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 26030 * // => [{ 'x': 2, 'y': 1 }] 26031 */ 26032 var differenceWith = baseRest(function(array, values) { 26033 var comparator = last(values); 26034 if (isArrayLikeObject(comparator)) { 26035 comparator = undefined; 26036 } 26037 return isArrayLikeObject(array) 26038 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 26039 : []; 26040 }); 26041 26042 /** 26043 * Creates a slice of `array` with `n` elements dropped from the beginning. 26044 * 26045 * @static 26046 * @memberOf _ 26047 * @since 0.5.0 26048 * @category Array 26049 * @param {Array} array The array to query. 26050 * @param {number} [n=1] The number of elements to drop. 26051 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26052 * @returns {Array} Returns the slice of `array`. 26053 * @example 26054 * 26055 * _.drop([1, 2, 3]); 26056 * // => [2, 3] 26057 * 26058 * _.drop([1, 2, 3], 2); 26059 * // => [3] 26060 * 26061 * _.drop([1, 2, 3], 5); 26062 * // => [] 26063 * 26064 * _.drop([1, 2, 3], 0); 26065 * // => [1, 2, 3] 26066 */ 26067 function drop(array, n, guard) { 26068 var length = array == null ? 0 : array.length; 26069 if (!length) { 26070 return []; 26071 } 26072 n = (guard || n === undefined) ? 1 : toInteger(n); 26073 return baseSlice(array, n < 0 ? 0 : n, length); 26074 } 26075 26076 /** 26077 * Creates a slice of `array` with `n` elements dropped from the end. 26078 * 26079 * @static 26080 * @memberOf _ 26081 * @since 3.0.0 26082 * @category Array 26083 * @param {Array} array The array to query. 26084 * @param {number} [n=1] The number of elements to drop. 26085 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26086 * @returns {Array} Returns the slice of `array`. 26087 * @example 26088 * 26089 * _.dropRight([1, 2, 3]); 26090 * // => [1, 2] 26091 * 26092 * _.dropRight([1, 2, 3], 2); 26093 * // => [1] 26094 * 26095 * _.dropRight([1, 2, 3], 5); 26096 * // => [] 26097 * 26098 * _.dropRight([1, 2, 3], 0); 26099 * // => [1, 2, 3] 26100 */ 26101 function dropRight(array, n, guard) { 26102 var length = array == null ? 0 : array.length; 26103 if (!length) { 26104 return []; 26105 } 26106 n = (guard || n === undefined) ? 1 : toInteger(n); 26107 n = length - n; 26108 return baseSlice(array, 0, n < 0 ? 0 : n); 26109 } 26110 26111 /** 26112 * Creates a slice of `array` excluding elements dropped from the end. 26113 * Elements are dropped until `predicate` returns falsey. The predicate is 26114 * invoked with three arguments: (value, index, array). 26115 * 26116 * @static 26117 * @memberOf _ 26118 * @since 3.0.0 26119 * @category Array 26120 * @param {Array} array The array to query. 26121 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26122 * @returns {Array} Returns the slice of `array`. 26123 * @example 26124 * 26125 * var users = [ 26126 * { 'user': 'barney', 'active': true }, 26127 * { 'user': 'fred', 'active': false }, 26128 * { 'user': 'pebbles', 'active': false } 26129 * ]; 26130 * 26131 * _.dropRightWhile(users, function(o) { return !o.active; }); 26132 * // => objects for ['barney'] 26133 * 26134 * // The `_.matches` iteratee shorthand. 26135 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 26136 * // => objects for ['barney', 'fred'] 26137 * 26138 * // The `_.matchesProperty` iteratee shorthand. 26139 * _.dropRightWhile(users, ['active', false]); 26140 * // => objects for ['barney'] 26141 * 26142 * // The `_.property` iteratee shorthand. 26143 * _.dropRightWhile(users, 'active'); 26144 * // => objects for ['barney', 'fred', 'pebbles'] 26145 */ 26146 function dropRightWhile(array, predicate) { 26147 return (array && array.length) 26148 ? baseWhile(array, getIteratee(predicate, 3), true, true) 26149 : []; 26150 } 26151 26152 /** 26153 * Creates a slice of `array` excluding elements dropped from the beginning. 26154 * Elements are dropped until `predicate` returns falsey. The predicate is 26155 * invoked with three arguments: (value, index, array). 26156 * 26157 * @static 26158 * @memberOf _ 26159 * @since 3.0.0 26160 * @category Array 26161 * @param {Array} array The array to query. 26162 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26163 * @returns {Array} Returns the slice of `array`. 26164 * @example 26165 * 26166 * var users = [ 26167 * { 'user': 'barney', 'active': false }, 26168 * { 'user': 'fred', 'active': false }, 26169 * { 'user': 'pebbles', 'active': true } 26170 * ]; 26171 * 26172 * _.dropWhile(users, function(o) { return !o.active; }); 26173 * // => objects for ['pebbles'] 26174 * 26175 * // The `_.matches` iteratee shorthand. 26176 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 26177 * // => objects for ['fred', 'pebbles'] 26178 * 26179 * // The `_.matchesProperty` iteratee shorthand. 26180 * _.dropWhile(users, ['active', false]); 26181 * // => objects for ['pebbles'] 26182 * 26183 * // The `_.property` iteratee shorthand. 26184 * _.dropWhile(users, 'active'); 26185 * // => objects for ['barney', 'fred', 'pebbles'] 26186 */ 26187 function dropWhile(array, predicate) { 26188 return (array && array.length) 26189 ? baseWhile(array, getIteratee(predicate, 3), true) 26190 : []; 26191 } 26192 26193 /** 26194 * Fills elements of `array` with `value` from `start` up to, but not 26195 * including, `end`. 26196 * 26197 * **Note:** This method mutates `array`. 26198 * 26199 * @static 26200 * @memberOf _ 26201 * @since 3.2.0 26202 * @category Array 26203 * @param {Array} array The array to fill. 26204 * @param {*} value The value to fill `array` with. 26205 * @param {number} [start=0] The start position. 26206 * @param {number} [end=array.length] The end position. 26207 * @returns {Array} Returns `array`. 26208 * @example 26209 * 26210 * var array = [1, 2, 3]; 26211 * 26212 * _.fill(array, 'a'); 26213 * console.log(array); 26214 * // => ['a', 'a', 'a'] 26215 * 26216 * _.fill(Array(3), 2); 26217 * // => [2, 2, 2] 26218 * 26219 * _.fill([4, 6, 8, 10], '*', 1, 3); 26220 * // => [4, '*', '*', 10] 26221 */ 26222 function fill(array, value, start, end) { 26223 var length = array == null ? 0 : array.length; 26224 if (!length) { 26225 return []; 26226 } 26227 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 26228 start = 0; 26229 end = length; 26230 } 26231 return baseFill(array, value, start, end); 26232 } 26233 26234 /** 26235 * This method is like `_.find` except that it returns the index of the first 26236 * element `predicate` returns truthy for instead of the element itself. 26237 * 26238 * @static 26239 * @memberOf _ 26240 * @since 1.1.0 26241 * @category Array 26242 * @param {Array} array The array to inspect. 26243 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26244 * @param {number} [fromIndex=0] The index to search from. 26245 * @returns {number} Returns the index of the found element, else `-1`. 26246 * @example 26247 * 26248 * var users = [ 26249 * { 'user': 'barney', 'active': false }, 26250 * { 'user': 'fred', 'active': false }, 26251 * { 'user': 'pebbles', 'active': true } 26252 * ]; 26253 * 26254 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 26255 * // => 0 26256 * 26257 * // The `_.matches` iteratee shorthand. 26258 * _.findIndex(users, { 'user': 'fred', 'active': false }); 26259 * // => 1 26260 * 26261 * // The `_.matchesProperty` iteratee shorthand. 26262 * _.findIndex(users, ['active', false]); 26263 * // => 0 26264 * 26265 * // The `_.property` iteratee shorthand. 26266 * _.findIndex(users, 'active'); 26267 * // => 2 26268 */ 26269 function findIndex(array, predicate, fromIndex) { 26270 var length = array == null ? 0 : array.length; 26271 if (!length) { 26272 return -1; 26273 } 26274 var index = fromIndex == null ? 0 : toInteger(fromIndex); 26275 if (index < 0) { 26276 index = nativeMax(length + index, 0); 26277 } 26278 return baseFindIndex(array, getIteratee(predicate, 3), index); 26279 } 26280 26281 /** 26282 * This method is like `_.findIndex` except that it iterates over elements 26283 * of `collection` from right to left. 26284 * 26285 * @static 26286 * @memberOf _ 26287 * @since 2.0.0 26288 * @category Array 26289 * @param {Array} array The array to inspect. 26290 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26291 * @param {number} [fromIndex=array.length-1] The index to search from. 26292 * @returns {number} Returns the index of the found element, else `-1`. 26293 * @example 26294 * 26295 * var users = [ 26296 * { 'user': 'barney', 'active': true }, 26297 * { 'user': 'fred', 'active': false }, 26298 * { 'user': 'pebbles', 'active': false } 26299 * ]; 26300 * 26301 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 26302 * // => 2 26303 * 26304 * // The `_.matches` iteratee shorthand. 26305 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 26306 * // => 0 26307 * 26308 * // The `_.matchesProperty` iteratee shorthand. 26309 * _.findLastIndex(users, ['active', false]); 26310 * // => 2 26311 * 26312 * // The `_.property` iteratee shorthand. 26313 * _.findLastIndex(users, 'active'); 26314 * // => 0 26315 */ 26316 function findLastIndex(array, predicate, fromIndex) { 26317 var length = array == null ? 0 : array.length; 26318 if (!length) { 26319 return -1; 26320 } 26321 var index = length - 1; 26322 if (fromIndex !== undefined) { 26323 index = toInteger(fromIndex); 26324 index = fromIndex < 0 26325 ? nativeMax(length + index, 0) 26326 : nativeMin(index, length - 1); 26327 } 26328 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 26329 } 26330 26331 /** 26332 * Flattens `array` a single level deep. 26333 * 26334 * @static 26335 * @memberOf _ 26336 * @since 0.1.0 26337 * @category Array 26338 * @param {Array} array The array to flatten. 26339 * @returns {Array} Returns the new flattened array. 26340 * @example 26341 * 26342 * _.flatten([1, [2, [3, [4]], 5]]); 26343 * // => [1, 2, [3, [4]], 5] 26344 */ 26345 function flatten(array) { 26346 var length = array == null ? 0 : array.length; 26347 return length ? baseFlatten(array, 1) : []; 26348 } 26349 26350 /** 26351 * Recursively flattens `array`. 26352 * 26353 * @static 26354 * @memberOf _ 26355 * @since 3.0.0 26356 * @category Array 26357 * @param {Array} array The array to flatten. 26358 * @returns {Array} Returns the new flattened array. 26359 * @example 26360 * 26361 * _.flattenDeep([1, [2, [3, [4]], 5]]); 26362 * // => [1, 2, 3, 4, 5] 26363 */ 26364 function flattenDeep(array) { 26365 var length = array == null ? 0 : array.length; 26366 return length ? baseFlatten(array, INFINITY) : []; 26367 } 26368 26369 /** 26370 * Recursively flatten `array` up to `depth` times. 26371 * 26372 * @static 26373 * @memberOf _ 26374 * @since 4.4.0 26375 * @category Array 26376 * @param {Array} array The array to flatten. 26377 * @param {number} [depth=1] The maximum recursion depth. 26378 * @returns {Array} Returns the new flattened array. 26379 * @example 26380 * 26381 * var array = [1, [2, [3, [4]], 5]]; 26382 * 26383 * _.flattenDepth(array, 1); 26384 * // => [1, 2, [3, [4]], 5] 26385 * 26386 * _.flattenDepth(array, 2); 26387 * // => [1, 2, 3, [4], 5] 26388 */ 26389 function flattenDepth(array, depth) { 26390 var length = array == null ? 0 : array.length; 26391 if (!length) { 26392 return []; 26393 } 26394 depth = depth === undefined ? 1 : toInteger(depth); 26395 return baseFlatten(array, depth); 26396 } 26397 26398 /** 26399 * The inverse of `_.toPairs`; this method returns an object composed 26400 * from key-value `pairs`. 26401 * 26402 * @static 26403 * @memberOf _ 26404 * @since 4.0.0 26405 * @category Array 26406 * @param {Array} pairs The key-value pairs. 26407 * @returns {Object} Returns the new object. 26408 * @example 26409 * 26410 * _.fromPairs([['a', 1], ['b', 2]]); 26411 * // => { 'a': 1, 'b': 2 } 26412 */ 26413 function fromPairs(pairs) { 26414 var index = -1, 26415 length = pairs == null ? 0 : pairs.length, 26416 result = {}; 26417 26418 while (++index < length) { 26419 var pair = pairs[index]; 26420 result[pair[0]] = pair[1]; 26421 } 26422 return result; 26423 } 26424 26425 /** 26426 * Gets the first element of `array`. 26427 * 26428 * @static 26429 * @memberOf _ 26430 * @since 0.1.0 26431 * @alias first 26432 * @category Array 26433 * @param {Array} array The array to query. 26434 * @returns {*} Returns the first element of `array`. 26435 * @example 26436 * 26437 * _.head([1, 2, 3]); 26438 * // => 1 26439 * 26440 * _.head([]); 26441 * // => undefined 26442 */ 26443 function head(array) { 26444 return (array && array.length) ? array[0] : undefined; 26445 } 26446 26447 /** 26448 * Gets the index at which the first occurrence of `value` is found in `array` 26449 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26450 * for equality comparisons. If `fromIndex` is negative, it's used as the 26451 * offset from the end of `array`. 26452 * 26453 * @static 26454 * @memberOf _ 26455 * @since 0.1.0 26456 * @category Array 26457 * @param {Array} array The array to inspect. 26458 * @param {*} value The value to search for. 26459 * @param {number} [fromIndex=0] The index to search from. 26460 * @returns {number} Returns the index of the matched value, else `-1`. 26461 * @example 26462 * 26463 * _.indexOf([1, 2, 1, 2], 2); 26464 * // => 1 26465 * 26466 * // Search from the `fromIndex`. 26467 * _.indexOf([1, 2, 1, 2], 2, 2); 26468 * // => 3 26469 */ 26470 function indexOf(array, value, fromIndex) { 26471 var length = array == null ? 0 : array.length; 26472 if (!length) { 26473 return -1; 26474 } 26475 var index = fromIndex == null ? 0 : toInteger(fromIndex); 26476 if (index < 0) { 26477 index = nativeMax(length + index, 0); 26478 } 26479 return baseIndexOf(array, value, index); 26480 } 26481 26482 /** 26483 * Gets all but the last element of `array`. 26484 * 26485 * @static 26486 * @memberOf _ 26487 * @since 0.1.0 26488 * @category Array 26489 * @param {Array} array The array to query. 26490 * @returns {Array} Returns the slice of `array`. 26491 * @example 26492 * 26493 * _.initial([1, 2, 3]); 26494 * // => [1, 2] 26495 */ 26496 function initial(array) { 26497 var length = array == null ? 0 : array.length; 26498 return length ? baseSlice(array, 0, -1) : []; 26499 } 26500 26501 /** 26502 * Creates an array of unique values that are included in all given arrays 26503 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26504 * for equality comparisons. The order and references of result values are 26505 * determined by the first array. 26506 * 26507 * @static 26508 * @memberOf _ 26509 * @since 0.1.0 26510 * @category Array 26511 * @param {...Array} [arrays] The arrays to inspect. 26512 * @returns {Array} Returns the new array of intersecting values. 26513 * @example 26514 * 26515 * _.intersection([2, 1], [2, 3]); 26516 * // => [2] 26517 */ 26518 var intersection = baseRest(function(arrays) { 26519 var mapped = arrayMap(arrays, castArrayLikeObject); 26520 return (mapped.length && mapped[0] === arrays[0]) 26521 ? baseIntersection(mapped) 26522 : []; 26523 }); 26524 26525 /** 26526 * This method is like `_.intersection` except that it accepts `iteratee` 26527 * which is invoked for each element of each `arrays` to generate the criterion 26528 * by which they're compared. The order and references of result values are 26529 * determined by the first array. The iteratee is invoked with one argument: 26530 * (value). 26531 * 26532 * @static 26533 * @memberOf _ 26534 * @since 4.0.0 26535 * @category Array 26536 * @param {...Array} [arrays] The arrays to inspect. 26537 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 26538 * @returns {Array} Returns the new array of intersecting values. 26539 * @example 26540 * 26541 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 26542 * // => [2.1] 26543 * 26544 * // The `_.property` iteratee shorthand. 26545 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 26546 * // => [{ 'x': 1 }] 26547 */ 26548 var intersectionBy = baseRest(function(arrays) { 26549 var iteratee = last(arrays), 26550 mapped = arrayMap(arrays, castArrayLikeObject); 26551 26552 if (iteratee === last(mapped)) { 26553 iteratee = undefined; 26554 } else { 26555 mapped.pop(); 26556 } 26557 return (mapped.length && mapped[0] === arrays[0]) 26558 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 26559 : []; 26560 }); 26561 26562 /** 26563 * This method is like `_.intersection` except that it accepts `comparator` 26564 * which is invoked to compare elements of `arrays`. The order and references 26565 * of result values are determined by the first array. The comparator is 26566 * invoked with two arguments: (arrVal, othVal). 26567 * 26568 * @static 26569 * @memberOf _ 26570 * @since 4.0.0 26571 * @category Array 26572 * @param {...Array} [arrays] The arrays to inspect. 26573 * @param {Function} [comparator] The comparator invoked per element. 26574 * @returns {Array} Returns the new array of intersecting values. 26575 * @example 26576 * 26577 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 26578 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 26579 * 26580 * _.intersectionWith(objects, others, _.isEqual); 26581 * // => [{ 'x': 1, 'y': 2 }] 26582 */ 26583 var intersectionWith = baseRest(function(arrays) { 26584 var comparator = last(arrays), 26585 mapped = arrayMap(arrays, castArrayLikeObject); 26586 26587 comparator = typeof comparator == 'function' ? comparator : undefined; 26588 if (comparator) { 26589 mapped.pop(); 26590 } 26591 return (mapped.length && mapped[0] === arrays[0]) 26592 ? baseIntersection(mapped, undefined, comparator) 26593 : []; 26594 }); 26595 26596 /** 26597 * Converts all elements in `array` into a string separated by `separator`. 26598 * 26599 * @static 26600 * @memberOf _ 26601 * @since 4.0.0 26602 * @category Array 26603 * @param {Array} array The array to convert. 26604 * @param {string} [separator=','] The element separator. 26605 * @returns {string} Returns the joined string. 26606 * @example 26607 * 26608 * _.join(['a', 'b', 'c'], '~'); 26609 * // => 'a~b~c' 26610 */ 26611 function join(array, separator) { 26612 return array == null ? '' : nativeJoin.call(array, separator); 26613 } 26614 26615 /** 26616 * Gets the last element of `array`. 26617 * 26618 * @static 26619 * @memberOf _ 26620 * @since 0.1.0 26621 * @category Array 26622 * @param {Array} array The array to query. 26623 * @returns {*} Returns the last element of `array`. 26624 * @example 26625 * 26626 * _.last([1, 2, 3]); 26627 * // => 3 26628 */ 26629 function last(array) { 26630 var length = array == null ? 0 : array.length; 26631 return length ? array[length - 1] : undefined; 26632 } 26633 26634 /** 26635 * This method is like `_.indexOf` except that it iterates over elements of 26636 * `array` from right to left. 26637 * 26638 * @static 26639 * @memberOf _ 26640 * @since 0.1.0 26641 * @category Array 26642 * @param {Array} array The array to inspect. 26643 * @param {*} value The value to search for. 26644 * @param {number} [fromIndex=array.length-1] The index to search from. 26645 * @returns {number} Returns the index of the matched value, else `-1`. 26646 * @example 26647 * 26648 * _.lastIndexOf([1, 2, 1, 2], 2); 26649 * // => 3 26650 * 26651 * // Search from the `fromIndex`. 26652 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 26653 * // => 1 26654 */ 26655 function lastIndexOf(array, value, fromIndex) { 26656 var length = array == null ? 0 : array.length; 26657 if (!length) { 26658 return -1; 26659 } 26660 var index = length; 26661 if (fromIndex !== undefined) { 26662 index = toInteger(fromIndex); 26663 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 26664 } 26665 return value === value 26666 ? strictLastIndexOf(array, value, index) 26667 : baseFindIndex(array, baseIsNaN, index, true); 26668 } 26669 26670 /** 26671 * Gets the element at index `n` of `array`. If `n` is negative, the nth 26672 * element from the end is returned. 26673 * 26674 * @static 26675 * @memberOf _ 26676 * @since 4.11.0 26677 * @category Array 26678 * @param {Array} array The array to query. 26679 * @param {number} [n=0] The index of the element to return. 26680 * @returns {*} Returns the nth element of `array`. 26681 * @example 26682 * 26683 * var array = ['a', 'b', 'c', 'd']; 26684 * 26685 * _.nth(array, 1); 26686 * // => 'b' 26687 * 26688 * _.nth(array, -2); 26689 * // => 'c'; 26690 */ 26691 function nth(array, n) { 26692 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 26693 } 26694 26695 /** 26696 * Removes all given values from `array` using 26697 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26698 * for equality comparisons. 26699 * 26700 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 26701 * to remove elements from an array by predicate. 26702 * 26703 * @static 26704 * @memberOf _ 26705 * @since 2.0.0 26706 * @category Array 26707 * @param {Array} array The array to modify. 26708 * @param {...*} [values] The values to remove. 26709 * @returns {Array} Returns `array`. 26710 * @example 26711 * 26712 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 26713 * 26714 * _.pull(array, 'a', 'c'); 26715 * console.log(array); 26716 * // => ['b', 'b'] 26717 */ 26718 var pull = baseRest(pullAll); 26719 26720 /** 26721 * This method is like `_.pull` except that it accepts an array of values to remove. 26722 * 26723 * **Note:** Unlike `_.difference`, this method mutates `array`. 26724 * 26725 * @static 26726 * @memberOf _ 26727 * @since 4.0.0 26728 * @category Array 26729 * @param {Array} array The array to modify. 26730 * @param {Array} values The values to remove. 26731 * @returns {Array} Returns `array`. 26732 * @example 26733 * 26734 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 26735 * 26736 * _.pullAll(array, ['a', 'c']); 26737 * console.log(array); 26738 * // => ['b', 'b'] 26739 */ 26740 function pullAll(array, values) { 26741 return (array && array.length && values && values.length) 26742 ? basePullAll(array, values) 26743 : array; 26744 } 26745 26746 /** 26747 * This method is like `_.pullAll` except that it accepts `iteratee` which is 26748 * invoked for each element of `array` and `values` to generate the criterion 26749 * by which they're compared. The iteratee is invoked with one argument: (value). 26750 * 26751 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 26752 * 26753 * @static 26754 * @memberOf _ 26755 * @since 4.0.0 26756 * @category Array 26757 * @param {Array} array The array to modify. 26758 * @param {Array} values The values to remove. 26759 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 26760 * @returns {Array} Returns `array`. 26761 * @example 26762 * 26763 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 26764 * 26765 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 26766 * console.log(array); 26767 * // => [{ 'x': 2 }] 26768 */ 26769 function pullAllBy(array, values, iteratee) { 26770 return (array && array.length && values && values.length) 26771 ? basePullAll(array, values, getIteratee(iteratee, 2)) 26772 : array; 26773 } 26774 26775 /** 26776 * This method is like `_.pullAll` except that it accepts `comparator` which 26777 * is invoked to compare elements of `array` to `values`. The comparator is 26778 * invoked with two arguments: (arrVal, othVal). 26779 * 26780 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 26781 * 26782 * @static 26783 * @memberOf _ 26784 * @since 4.6.0 26785 * @category Array 26786 * @param {Array} array The array to modify. 26787 * @param {Array} values The values to remove. 26788 * @param {Function} [comparator] The comparator invoked per element. 26789 * @returns {Array} Returns `array`. 26790 * @example 26791 * 26792 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 26793 * 26794 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 26795 * console.log(array); 26796 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 26797 */ 26798 function pullAllWith(array, values, comparator) { 26799 return (array && array.length && values && values.length) 26800 ? basePullAll(array, values, undefined, comparator) 26801 : array; 26802 } 26803 26804 /** 26805 * Removes elements from `array` corresponding to `indexes` and returns an 26806 * array of removed elements. 26807 * 26808 * **Note:** Unlike `_.at`, this method mutates `array`. 26809 * 26810 * @static 26811 * @memberOf _ 26812 * @since 3.0.0 26813 * @category Array 26814 * @param {Array} array The array to modify. 26815 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 26816 * @returns {Array} Returns the new array of removed elements. 26817 * @example 26818 * 26819 * var array = ['a', 'b', 'c', 'd']; 26820 * var pulled = _.pullAt(array, [1, 3]); 26821 * 26822 * console.log(array); 26823 * // => ['a', 'c'] 26824 * 26825 * console.log(pulled); 26826 * // => ['b', 'd'] 26827 */ 26828 var pullAt = flatRest(function(array, indexes) { 26829 var length = array == null ? 0 : array.length, 26830 result = baseAt(array, indexes); 26831 26832 basePullAt(array, arrayMap(indexes, function(index) { 26833 return isIndex(index, length) ? +index : index; 26834 }).sort(compareAscending)); 26835 26836 return result; 26837 }); 26838 26839 /** 26840 * Removes all elements from `array` that `predicate` returns truthy for 26841 * and returns an array of the removed elements. The predicate is invoked 26842 * with three arguments: (value, index, array). 26843 * 26844 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 26845 * to pull elements from an array by value. 26846 * 26847 * @static 26848 * @memberOf _ 26849 * @since 2.0.0 26850 * @category Array 26851 * @param {Array} array The array to modify. 26852 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26853 * @returns {Array} Returns the new array of removed elements. 26854 * @example 26855 * 26856 * var array = [1, 2, 3, 4]; 26857 * var evens = _.remove(array, function(n) { 26858 * return n % 2 == 0; 26859 * }); 26860 * 26861 * console.log(array); 26862 * // => [1, 3] 26863 * 26864 * console.log(evens); 26865 * // => [2, 4] 26866 */ 26867 function remove(array, predicate) { 26868 var result = []; 26869 if (!(array && array.length)) { 26870 return result; 26871 } 26872 var index = -1, 26873 indexes = [], 26874 length = array.length; 26875 26876 predicate = getIteratee(predicate, 3); 26877 while (++index < length) { 26878 var value = array[index]; 26879 if (predicate(value, index, array)) { 26880 result.push(value); 26881 indexes.push(index); 26882 } 26883 } 26884 basePullAt(array, indexes); 26885 return result; 26886 } 26887 26888 /** 26889 * Reverses `array` so that the first element becomes the last, the second 26890 * element becomes the second to last, and so on. 26891 * 26892 * **Note:** This method mutates `array` and is based on 26893 * [`Array#reverse`](https://mdn.io/Array/reverse). 26894 * 26895 * @static 26896 * @memberOf _ 26897 * @since 4.0.0 26898 * @category Array 26899 * @param {Array} array The array to modify. 26900 * @returns {Array} Returns `array`. 26901 * @example 26902 * 26903 * var array = [1, 2, 3]; 26904 * 26905 * _.reverse(array); 26906 * // => [3, 2, 1] 26907 * 26908 * console.log(array); 26909 * // => [3, 2, 1] 26910 */ 26911 function reverse(array) { 26912 return array == null ? array : nativeReverse.call(array); 26913 } 26914 26915 /** 26916 * Creates a slice of `array` from `start` up to, but not including, `end`. 26917 * 26918 * **Note:** This method is used instead of 26919 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 26920 * returned. 26921 * 26922 * @static 26923 * @memberOf _ 26924 * @since 3.0.0 26925 * @category Array 26926 * @param {Array} array The array to slice. 26927 * @param {number} [start=0] The start position. 26928 * @param {number} [end=array.length] The end position. 26929 * @returns {Array} Returns the slice of `array`. 26930 */ 26931 function slice(array, start, end) { 26932 var length = array == null ? 0 : array.length; 26933 if (!length) { 26934 return []; 26935 } 26936 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 26937 start = 0; 26938 end = length; 26939 } 26940 else { 26941 start = start == null ? 0 : toInteger(start); 26942 end = end === undefined ? length : toInteger(end); 26943 } 26944 return baseSlice(array, start, end); 26945 } 26946 26947 /** 26948 * Uses a binary search to determine the lowest index at which `value` 26949 * should be inserted into `array` in order to maintain its sort order. 26950 * 26951 * @static 26952 * @memberOf _ 26953 * @since 0.1.0 26954 * @category Array 26955 * @param {Array} array The sorted array to inspect. 26956 * @param {*} value The value to evaluate. 26957 * @returns {number} Returns the index at which `value` should be inserted 26958 * into `array`. 26959 * @example 26960 * 26961 * _.sortedIndex([30, 50], 40); 26962 * // => 1 26963 */ 26964 function sortedIndex(array, value) { 26965 return baseSortedIndex(array, value); 26966 } 26967 26968 /** 26969 * This method is like `_.sortedIndex` except that it accepts `iteratee` 26970 * which is invoked for `value` and each element of `array` to compute their 26971 * sort ranking. The iteratee is invoked with one argument: (value). 26972 * 26973 * @static 26974 * @memberOf _ 26975 * @since 4.0.0 26976 * @category Array 26977 * @param {Array} array The sorted array to inspect. 26978 * @param {*} value The value to evaluate. 26979 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 26980 * @returns {number} Returns the index at which `value` should be inserted 26981 * into `array`. 26982 * @example 26983 * 26984 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 26985 * 26986 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 26987 * // => 0 26988 * 26989 * // The `_.property` iteratee shorthand. 26990 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 26991 * // => 0 26992 */ 26993 function sortedIndexBy(array, value, iteratee) { 26994 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 26995 } 26996 26997 /** 26998 * This method is like `_.indexOf` except that it performs a binary 26999 * search on a sorted `array`. 27000 * 27001 * @static 27002 * @memberOf _ 27003 * @since 4.0.0 27004 * @category Array 27005 * @param {Array} array The array to inspect. 27006 * @param {*} value The value to search for. 27007 * @returns {number} Returns the index of the matched value, else `-1`. 27008 * @example 27009 * 27010 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 27011 * // => 1 27012 */ 27013 function sortedIndexOf(array, value) { 27014 var length = array == null ? 0 : array.length; 27015 if (length) { 27016 var index = baseSortedIndex(array, value); 27017 if (index < length && eq(array[index], value)) { 27018 return index; 27019 } 27020 } 27021 return -1; 27022 } 27023 27024 /** 27025 * This method is like `_.sortedIndex` except that it returns the highest 27026 * index at which `value` should be inserted into `array` in order to 27027 * maintain its sort order. 27028 * 27029 * @static 27030 * @memberOf _ 27031 * @since 3.0.0 27032 * @category Array 27033 * @param {Array} array The sorted array to inspect. 27034 * @param {*} value The value to evaluate. 27035 * @returns {number} Returns the index at which `value` should be inserted 27036 * into `array`. 27037 * @example 27038 * 27039 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 27040 * // => 4 27041 */ 27042 function sortedLastIndex(array, value) { 27043 return baseSortedIndex(array, value, true); 27044 } 27045 27046 /** 27047 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 27048 * which is invoked for `value` and each element of `array` to compute their 27049 * sort ranking. The iteratee is invoked with one argument: (value). 27050 * 27051 * @static 27052 * @memberOf _ 27053 * @since 4.0.0 27054 * @category Array 27055 * @param {Array} array The sorted array to inspect. 27056 * @param {*} value The value to evaluate. 27057 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27058 * @returns {number} Returns the index at which `value` should be inserted 27059 * into `array`. 27060 * @example 27061 * 27062 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 27063 * 27064 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 27065 * // => 1 27066 * 27067 * // The `_.property` iteratee shorthand. 27068 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 27069 * // => 1 27070 */ 27071 function sortedLastIndexBy(array, value, iteratee) { 27072 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 27073 } 27074 27075 /** 27076 * This method is like `_.lastIndexOf` except that it performs a binary 27077 * search on a sorted `array`. 27078 * 27079 * @static 27080 * @memberOf _ 27081 * @since 4.0.0 27082 * @category Array 27083 * @param {Array} array The array to inspect. 27084 * @param {*} value The value to search for. 27085 * @returns {number} Returns the index of the matched value, else `-1`. 27086 * @example 27087 * 27088 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 27089 * // => 3 27090 */ 27091 function sortedLastIndexOf(array, value) { 27092 var length = array == null ? 0 : array.length; 27093 if (length) { 27094 var index = baseSortedIndex(array, value, true) - 1; 27095 if (eq(array[index], value)) { 27096 return index; 27097 } 27098 } 27099 return -1; 27100 } 27101 27102 /** 27103 * This method is like `_.uniq` except that it's designed and optimized 27104 * for sorted arrays. 27105 * 27106 * @static 27107 * @memberOf _ 27108 * @since 4.0.0 27109 * @category Array 27110 * @param {Array} array The array to inspect. 27111 * @returns {Array} Returns the new duplicate free array. 27112 * @example 27113 * 27114 * _.sortedUniq([1, 1, 2]); 27115 * // => [1, 2] 27116 */ 27117 function sortedUniq(array) { 27118 return (array && array.length) 27119 ? baseSortedUniq(array) 27120 : []; 27121 } 27122 27123 /** 27124 * This method is like `_.uniqBy` except that it's designed and optimized 27125 * for sorted arrays. 27126 * 27127 * @static 27128 * @memberOf _ 27129 * @since 4.0.0 27130 * @category Array 27131 * @param {Array} array The array to inspect. 27132 * @param {Function} [iteratee] The iteratee invoked per element. 27133 * @returns {Array} Returns the new duplicate free array. 27134 * @example 27135 * 27136 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 27137 * // => [1.1, 2.3] 27138 */ 27139 function sortedUniqBy(array, iteratee) { 27140 return (array && array.length) 27141 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 27142 : []; 27143 } 27144 27145 /** 27146 * Gets all but the first element of `array`. 27147 * 27148 * @static 27149 * @memberOf _ 27150 * @since 4.0.0 27151 * @category Array 27152 * @param {Array} array The array to query. 27153 * @returns {Array} Returns the slice of `array`. 27154 * @example 27155 * 27156 * _.tail([1, 2, 3]); 27157 * // => [2, 3] 27158 */ 27159 function tail(array) { 27160 var length = array == null ? 0 : array.length; 27161 return length ? baseSlice(array, 1, length) : []; 27162 } 27163 27164 /** 27165 * Creates a slice of `array` with `n` elements taken from the beginning. 27166 * 27167 * @static 27168 * @memberOf _ 27169 * @since 0.1.0 27170 * @category Array 27171 * @param {Array} array The array to query. 27172 * @param {number} [n=1] The number of elements to take. 27173 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27174 * @returns {Array} Returns the slice of `array`. 27175 * @example 27176 * 27177 * _.take([1, 2, 3]); 27178 * // => [1] 27179 * 27180 * _.take([1, 2, 3], 2); 27181 * // => [1, 2] 27182 * 27183 * _.take([1, 2, 3], 5); 27184 * // => [1, 2, 3] 27185 * 27186 * _.take([1, 2, 3], 0); 27187 * // => [] 27188 */ 27189 function take(array, n, guard) { 27190 if (!(array && array.length)) { 27191 return []; 27192 } 27193 n = (guard || n === undefined) ? 1 : toInteger(n); 27194 return baseSlice(array, 0, n < 0 ? 0 : n); 27195 } 27196 27197 /** 27198 * Creates a slice of `array` with `n` elements taken from the end. 27199 * 27200 * @static 27201 * @memberOf _ 27202 * @since 3.0.0 27203 * @category Array 27204 * @param {Array} array The array to query. 27205 * @param {number} [n=1] The number of elements to take. 27206 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27207 * @returns {Array} Returns the slice of `array`. 27208 * @example 27209 * 27210 * _.takeRight([1, 2, 3]); 27211 * // => [3] 27212 * 27213 * _.takeRight([1, 2, 3], 2); 27214 * // => [2, 3] 27215 * 27216 * _.takeRight([1, 2, 3], 5); 27217 * // => [1, 2, 3] 27218 * 27219 * _.takeRight([1, 2, 3], 0); 27220 * // => [] 27221 */ 27222 function takeRight(array, n, guard) { 27223 var length = array == null ? 0 : array.length; 27224 if (!length) { 27225 return []; 27226 } 27227 n = (guard || n === undefined) ? 1 : toInteger(n); 27228 n = length - n; 27229 return baseSlice(array, n < 0 ? 0 : n, length); 27230 } 27231 27232 /** 27233 * Creates a slice of `array` with elements taken from the end. Elements are 27234 * taken until `predicate` returns falsey. The predicate is invoked with 27235 * three arguments: (value, index, array). 27236 * 27237 * @static 27238 * @memberOf _ 27239 * @since 3.0.0 27240 * @category Array 27241 * @param {Array} array The array to query. 27242 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27243 * @returns {Array} Returns the slice of `array`. 27244 * @example 27245 * 27246 * var users = [ 27247 * { 'user': 'barney', 'active': true }, 27248 * { 'user': 'fred', 'active': false }, 27249 * { 'user': 'pebbles', 'active': false } 27250 * ]; 27251 * 27252 * _.takeRightWhile(users, function(o) { return !o.active; }); 27253 * // => objects for ['fred', 'pebbles'] 27254 * 27255 * // The `_.matches` iteratee shorthand. 27256 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 27257 * // => objects for ['pebbles'] 27258 * 27259 * // The `_.matchesProperty` iteratee shorthand. 27260 * _.takeRightWhile(users, ['active', false]); 27261 * // => objects for ['fred', 'pebbles'] 27262 * 27263 * // The `_.property` iteratee shorthand. 27264 * _.takeRightWhile(users, 'active'); 27265 * // => [] 27266 */ 27267 function takeRightWhile(array, predicate) { 27268 return (array && array.length) 27269 ? baseWhile(array, getIteratee(predicate, 3), false, true) 27270 : []; 27271 } 27272 27273 /** 27274 * Creates a slice of `array` with elements taken from the beginning. Elements 27275 * are taken until `predicate` returns falsey. The predicate is invoked with 27276 * three arguments: (value, index, array). 27277 * 27278 * @static 27279 * @memberOf _ 27280 * @since 3.0.0 27281 * @category Array 27282 * @param {Array} array The array to query. 27283 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27284 * @returns {Array} Returns the slice of `array`. 27285 * @example 27286 * 27287 * var users = [ 27288 * { 'user': 'barney', 'active': false }, 27289 * { 'user': 'fred', 'active': false }, 27290 * { 'user': 'pebbles', 'active': true } 27291 * ]; 27292 * 27293 * _.takeWhile(users, function(o) { return !o.active; }); 27294 * // => objects for ['barney', 'fred'] 27295 * 27296 * // The `_.matches` iteratee shorthand. 27297 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 27298 * // => objects for ['barney'] 27299 * 27300 * // The `_.matchesProperty` iteratee shorthand. 27301 * _.takeWhile(users, ['active', false]); 27302 * // => objects for ['barney', 'fred'] 27303 * 27304 * // The `_.property` iteratee shorthand. 27305 * _.takeWhile(users, 'active'); 27306 * // => [] 27307 */ 27308 function takeWhile(array, predicate) { 27309 return (array && array.length) 27310 ? baseWhile(array, getIteratee(predicate, 3)) 27311 : []; 27312 } 27313 27314 /** 27315 * Creates an array of unique values, in order, from all given arrays using 27316 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27317 * for equality comparisons. 27318 * 27319 * @static 27320 * @memberOf _ 27321 * @since 0.1.0 27322 * @category Array 27323 * @param {...Array} [arrays] The arrays to inspect. 27324 * @returns {Array} Returns the new array of combined values. 27325 * @example 27326 * 27327 * _.union([2], [1, 2]); 27328 * // => [2, 1] 27329 */ 27330 var union = baseRest(function(arrays) { 27331 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 27332 }); 27333 27334 /** 27335 * This method is like `_.union` except that it accepts `iteratee` which is 27336 * invoked for each element of each `arrays` to generate the criterion by 27337 * which uniqueness is computed. Result values are chosen from the first 27338 * array in which the value occurs. The iteratee is invoked with one argument: 27339 * (value). 27340 * 27341 * @static 27342 * @memberOf _ 27343 * @since 4.0.0 27344 * @category Array 27345 * @param {...Array} [arrays] The arrays to inspect. 27346 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27347 * @returns {Array} Returns the new array of combined values. 27348 * @example 27349 * 27350 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 27351 * // => [2.1, 1.2] 27352 * 27353 * // The `_.property` iteratee shorthand. 27354 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 27355 * // => [{ 'x': 1 }, { 'x': 2 }] 27356 */ 27357 var unionBy = baseRest(function(arrays) { 27358 var iteratee = last(arrays); 27359 if (isArrayLikeObject(iteratee)) { 27360 iteratee = undefined; 27361 } 27362 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 27363 }); 27364 27365 /** 27366 * This method is like `_.union` except that it accepts `comparator` which 27367 * is invoked to compare elements of `arrays`. Result values are chosen from 27368 * the first array in which the value occurs. The comparator is invoked 27369 * with two arguments: (arrVal, othVal). 27370 * 27371 * @static 27372 * @memberOf _ 27373 * @since 4.0.0 27374 * @category Array 27375 * @param {...Array} [arrays] The arrays to inspect. 27376 * @param {Function} [comparator] The comparator invoked per element. 27377 * @returns {Array} Returns the new array of combined values. 27378 * @example 27379 * 27380 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 27381 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 27382 * 27383 * _.unionWith(objects, others, _.isEqual); 27384 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 27385 */ 27386 var unionWith = baseRest(function(arrays) { 27387 var comparator = last(arrays); 27388 comparator = typeof comparator == 'function' ? comparator : undefined; 27389 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 27390 }); 27391 27392 /** 27393 * Creates a duplicate-free version of an array, using 27394 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27395 * for equality comparisons, in which only the first occurrence of each element 27396 * is kept. The order of result values is determined by the order they occur 27397 * in the array. 27398 * 27399 * @static 27400 * @memberOf _ 27401 * @since 0.1.0 27402 * @category Array 27403 * @param {Array} array The array to inspect. 27404 * @returns {Array} Returns the new duplicate free array. 27405 * @example 27406 * 27407 * _.uniq([2, 1, 2]); 27408 * // => [2, 1] 27409 */ 27410 function uniq(array) { 27411 return (array && array.length) ? baseUniq(array) : []; 27412 } 27413 27414 /** 27415 * This method is like `_.uniq` except that it accepts `iteratee` which is 27416 * invoked for each element in `array` to generate the criterion by which 27417 * uniqueness is computed. The order of result values is determined by the 27418 * order they occur in the array. The iteratee is invoked with one argument: 27419 * (value). 27420 * 27421 * @static 27422 * @memberOf _ 27423 * @since 4.0.0 27424 * @category Array 27425 * @param {Array} array The array to inspect. 27426 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27427 * @returns {Array} Returns the new duplicate free array. 27428 * @example 27429 * 27430 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 27431 * // => [2.1, 1.2] 27432 * 27433 * // The `_.property` iteratee shorthand. 27434 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 27435 * // => [{ 'x': 1 }, { 'x': 2 }] 27436 */ 27437 function uniqBy(array, iteratee) { 27438 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 27439 } 27440 27441 /** 27442 * This method is like `_.uniq` except that it accepts `comparator` which 27443 * is invoked to compare elements of `array`. The order of result values is 27444 * determined by the order they occur in the array.The comparator is invoked 27445 * with two arguments: (arrVal, othVal). 27446 * 27447 * @static 27448 * @memberOf _ 27449 * @since 4.0.0 27450 * @category Array 27451 * @param {Array} array The array to inspect. 27452 * @param {Function} [comparator] The comparator invoked per element. 27453 * @returns {Array} Returns the new duplicate free array. 27454 * @example 27455 * 27456 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 27457 * 27458 * _.uniqWith(objects, _.isEqual); 27459 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 27460 */ 27461 function uniqWith(array, comparator) { 27462 comparator = typeof comparator == 'function' ? comparator : undefined; 27463 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 27464 } 27465 27466 /** 27467 * This method is like `_.zip` except that it accepts an array of grouped 27468 * elements and creates an array regrouping the elements to their pre-zip 27469 * configuration. 27470 * 27471 * @static 27472 * @memberOf _ 27473 * @since 1.2.0 27474 * @category Array 27475 * @param {Array} array The array of grouped elements to process. 27476 * @returns {Array} Returns the new array of regrouped elements. 27477 * @example 27478 * 27479 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 27480 * // => [['a', 1, true], ['b', 2, false]] 27481 * 27482 * _.unzip(zipped); 27483 * // => [['a', 'b'], [1, 2], [true, false]] 27484 */ 27485 function unzip(array) { 27486 if (!(array && array.length)) { 27487 return []; 27488 } 27489 var length = 0; 27490 array = arrayFilter(array, function(group) { 27491 if (isArrayLikeObject(group)) { 27492 length = nativeMax(group.length, length); 27493 return true; 27494 } 27495 }); 27496 return baseTimes(length, function(index) { 27497 return arrayMap(array, baseProperty(index)); 27498 }); 27499 } 27500 27501 /** 27502 * This method is like `_.unzip` except that it accepts `iteratee` to specify 27503 * how regrouped values should be combined. The iteratee is invoked with the 27504 * elements of each group: (...group). 27505 * 27506 * @static 27507 * @memberOf _ 27508 * @since 3.8.0 27509 * @category Array 27510 * @param {Array} array The array of grouped elements to process. 27511 * @param {Function} [iteratee=_.identity] The function to combine 27512 * regrouped values. 27513 * @returns {Array} Returns the new array of regrouped elements. 27514 * @example 27515 * 27516 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 27517 * // => [[1, 10, 100], [2, 20, 200]] 27518 * 27519 * _.unzipWith(zipped, _.add); 27520 * // => [3, 30, 300] 27521 */ 27522 function unzipWith(array, iteratee) { 27523 if (!(array && array.length)) { 27524 return []; 27525 } 27526 var result = unzip(array); 27527 if (iteratee == null) { 27528 return result; 27529 } 27530 return arrayMap(result, function(group) { 27531 return apply(iteratee, undefined, group); 27532 }); 27533 } 27534 27535 /** 27536 * Creates an array excluding all given values using 27537 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27538 * for equality comparisons. 27539 * 27540 * **Note:** Unlike `_.pull`, this method returns a new array. 27541 * 27542 * @static 27543 * @memberOf _ 27544 * @since 0.1.0 27545 * @category Array 27546 * @param {Array} array The array to inspect. 27547 * @param {...*} [values] The values to exclude. 27548 * @returns {Array} Returns the new array of filtered values. 27549 * @see _.difference, _.xor 27550 * @example 27551 * 27552 * _.without([2, 1, 2, 3], 1, 2); 27553 * // => [3] 27554 */ 27555 var without = baseRest(function(array, values) { 27556 return isArrayLikeObject(array) 27557 ? baseDifference(array, values) 27558 : []; 27559 }); 27560 27561 /** 27562 * Creates an array of unique values that is the 27563 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 27564 * of the given arrays. The order of result values is determined by the order 27565 * they occur in the arrays. 27566 * 27567 * @static 27568 * @memberOf _ 27569 * @since 2.4.0 27570 * @category Array 27571 * @param {...Array} [arrays] The arrays to inspect. 27572 * @returns {Array} Returns the new array of filtered values. 27573 * @see _.difference, _.without 27574 * @example 27575 * 27576 * _.xor([2, 1], [2, 3]); 27577 * // => [1, 3] 27578 */ 27579 var xor = baseRest(function(arrays) { 27580 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 27581 }); 27582 27583 /** 27584 * This method is like `_.xor` except that it accepts `iteratee` which is 27585 * invoked for each element of each `arrays` to generate the criterion by 27586 * which by which they're compared. The order of result values is determined 27587 * by the order they occur in the arrays. The iteratee is invoked with one 27588 * argument: (value). 27589 * 27590 * @static 27591 * @memberOf _ 27592 * @since 4.0.0 27593 * @category Array 27594 * @param {...Array} [arrays] The arrays to inspect. 27595 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27596 * @returns {Array} Returns the new array of filtered values. 27597 * @example 27598 * 27599 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 27600 * // => [1.2, 3.4] 27601 * 27602 * // The `_.property` iteratee shorthand. 27603 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 27604 * // => [{ 'x': 2 }] 27605 */ 27606 var xorBy = baseRest(function(arrays) { 27607 var iteratee = last(arrays); 27608 if (isArrayLikeObject(iteratee)) { 27609 iteratee = undefined; 27610 } 27611 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 27612 }); 27613 27614 /** 27615 * This method is like `_.xor` except that it accepts `comparator` which is 27616 * invoked to compare elements of `arrays`. The order of result values is 27617 * determined by the order they occur in the arrays. The comparator is invoked 27618 * with two arguments: (arrVal, othVal). 27619 * 27620 * @static 27621 * @memberOf _ 27622 * @since 4.0.0 27623 * @category Array 27624 * @param {...Array} [arrays] The arrays to inspect. 27625 * @param {Function} [comparator] The comparator invoked per element. 27626 * @returns {Array} Returns the new array of filtered values. 27627 * @example 27628 * 27629 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 27630 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 27631 * 27632 * _.xorWith(objects, others, _.isEqual); 27633 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 27634 */ 27635 var xorWith = baseRest(function(arrays) { 27636 var comparator = last(arrays); 27637 comparator = typeof comparator == 'function' ? comparator : undefined; 27638 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 27639 }); 27640 27641 /** 27642 * Creates an array of grouped elements, the first of which contains the 27643 * first elements of the given arrays, the second of which contains the 27644 * second elements of the given arrays, and so on. 27645 * 27646 * @static 27647 * @memberOf _ 27648 * @since 0.1.0 27649 * @category Array 27650 * @param {...Array} [arrays] The arrays to process. 27651 * @returns {Array} Returns the new array of grouped elements. 27652 * @example 27653 * 27654 * _.zip(['a', 'b'], [1, 2], [true, false]); 27655 * // => [['a', 1, true], ['b', 2, false]] 27656 */ 27657 var zip = baseRest(unzip); 27658 27659 /** 27660 * This method is like `_.fromPairs` except that it accepts two arrays, 27661 * one of property identifiers and one of corresponding values. 27662 * 27663 * @static 27664 * @memberOf _ 27665 * @since 0.4.0 27666 * @category Array 27667 * @param {Array} [props=[]] The property identifiers. 27668 * @param {Array} [values=[]] The property values. 27669 * @returns {Object} Returns the new object. 27670 * @example 27671 * 27672 * _.zipObject(['a', 'b'], [1, 2]); 27673 * // => { 'a': 1, 'b': 2 } 27674 */ 27675 function zipObject(props, values) { 27676 return baseZipObject(props || [], values || [], assignValue); 27677 } 27678 27679 /** 27680 * This method is like `_.zipObject` except that it supports property paths. 27681 * 27682 * @static 27683 * @memberOf _ 27684 * @since 4.1.0 27685 * @category Array 27686 * @param {Array} [props=[]] The property identifiers. 27687 * @param {Array} [values=[]] The property values. 27688 * @returns {Object} Returns the new object. 27689 * @example 27690 * 27691 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 27692 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 27693 */ 27694 function zipObjectDeep(props, values) { 27695 return baseZipObject(props || [], values || [], baseSet); 27696 } 27697 27698 /** 27699 * This method is like `_.zip` except that it accepts `iteratee` to specify 27700 * how grouped values should be combined. The iteratee is invoked with the 27701 * elements of each group: (...group). 27702 * 27703 * @static 27704 * @memberOf _ 27705 * @since 3.8.0 27706 * @category Array 27707 * @param {...Array} [arrays] The arrays to process. 27708 * @param {Function} [iteratee=_.identity] The function to combine 27709 * grouped values. 27710 * @returns {Array} Returns the new array of grouped elements. 27711 * @example 27712 * 27713 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 27714 * return a + b + c; 27715 * }); 27716 * // => [111, 222] 27717 */ 27718 var zipWith = baseRest(function(arrays) { 27719 var length = arrays.length, 27720 iteratee = length > 1 ? arrays[length - 1] : undefined; 27721 27722 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 27723 return unzipWith(arrays, iteratee); 27724 }); 27725 27726 /*------------------------------------------------------------------------*/ 27727 27728 /** 27729 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 27730 * chain sequences enabled. The result of such sequences must be unwrapped 27731 * with `_#value`. 27732 * 27733 * @static 27734 * @memberOf _ 27735 * @since 1.3.0 27736 * @category Seq 27737 * @param {*} value The value to wrap. 27738 * @returns {Object} Returns the new `lodash` wrapper instance. 27739 * @example 27740 * 27741 * var users = [ 27742 * { 'user': 'barney', 'age': 36 }, 27743 * { 'user': 'fred', 'age': 40 }, 27744 * { 'user': 'pebbles', 'age': 1 } 27745 * ]; 27746 * 27747 * var youngest = _ 27748 * .chain(users) 27749 * .sortBy('age') 27750 * .map(function(o) { 27751 * return o.user + ' is ' + o.age; 27752 * }) 27753 * .head() 27754 * .value(); 27755 * // => 'pebbles is 1' 27756 */ 27757 function chain(value) { 27758 var result = lodash(value); 27759 result.__chain__ = true; 27760 return result; 27761 } 27762 27763 /** 27764 * This method invokes `interceptor` and returns `value`. The interceptor 27765 * is invoked with one argument; (value). The purpose of this method is to 27766 * "tap into" a method chain sequence in order to modify intermediate results. 27767 * 27768 * @static 27769 * @memberOf _ 27770 * @since 0.1.0 27771 * @category Seq 27772 * @param {*} value The value to provide to `interceptor`. 27773 * @param {Function} interceptor The function to invoke. 27774 * @returns {*} Returns `value`. 27775 * @example 27776 * 27777 * _([1, 2, 3]) 27778 * .tap(function(array) { 27779 * // Mutate input array. 27780 * array.pop(); 27781 * }) 27782 * .reverse() 27783 * .value(); 27784 * // => [2, 1] 27785 */ 27786 function tap(value, interceptor) { 27787 interceptor(value); 27788 return value; 27789 } 27790 27791 /** 27792 * This method is like `_.tap` except that it returns the result of `interceptor`. 27793 * The purpose of this method is to "pass thru" values replacing intermediate 27794 * results in a method chain sequence. 27795 * 27796 * @static 27797 * @memberOf _ 27798 * @since 3.0.0 27799 * @category Seq 27800 * @param {*} value The value to provide to `interceptor`. 27801 * @param {Function} interceptor The function to invoke. 27802 * @returns {*} Returns the result of `interceptor`. 27803 * @example 27804 * 27805 * _(' abc ') 27806 * .chain() 27807 * .trim() 27808 * .thru(function(value) { 27809 * return [value]; 27810 * }) 27811 * .value(); 27812 * // => ['abc'] 27813 */ 27814 function thru(value, interceptor) { 27815 return interceptor(value); 27816 } 27817 27818 /** 27819 * This method is the wrapper version of `_.at`. 27820 * 27821 * @name at 27822 * @memberOf _ 27823 * @since 1.0.0 27824 * @category Seq 27825 * @param {...(string|string[])} [paths] The property paths to pick. 27826 * @returns {Object} Returns the new `lodash` wrapper instance. 27827 * @example 27828 * 27829 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 27830 * 27831 * _(object).at(['a[0].b.c', 'a[1]']).value(); 27832 * // => [3, 4] 27833 */ 27834 var wrapperAt = flatRest(function(paths) { 27835 var length = paths.length, 27836 start = length ? paths[0] : 0, 27837 value = this.__wrapped__, 27838 interceptor = function(object) { return baseAt(object, paths); }; 27839 27840 if (length > 1 || this.__actions__.length || 27841 !(value instanceof LazyWrapper) || !isIndex(start)) { 27842 return this.thru(interceptor); 27843 } 27844 value = value.slice(start, +start + (length ? 1 : 0)); 27845 value.__actions__.push({ 27846 'func': thru, 27847 'args': [interceptor], 27848 'thisArg': undefined 27849 }); 27850 return new LodashWrapper(value, this.__chain__).thru(function(array) { 27851 if (length && !array.length) { 27852 array.push(undefined); 27853 } 27854 return array; 27855 }); 27856 }); 27857 27858 /** 27859 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 27860 * 27861 * @name chain 27862 * @memberOf _ 27863 * @since 0.1.0 27864 * @category Seq 27865 * @returns {Object} Returns the new `lodash` wrapper instance. 27866 * @example 27867 * 27868 * var users = [ 27869 * { 'user': 'barney', 'age': 36 }, 27870 * { 'user': 'fred', 'age': 40 } 27871 * ]; 27872 * 27873 * // A sequence without explicit chaining. 27874 * _(users).head(); 27875 * // => { 'user': 'barney', 'age': 36 } 27876 * 27877 * // A sequence with explicit chaining. 27878 * _(users) 27879 * .chain() 27880 * .head() 27881 * .pick('user') 27882 * .value(); 27883 * // => { 'user': 'barney' } 27884 */ 27885 function wrapperChain() { 27886 return chain(this); 27887 } 27888 27889 /** 27890 * Executes the chain sequence and returns the wrapped result. 27891 * 27892 * @name commit 27893 * @memberOf _ 27894 * @since 3.2.0 27895 * @category Seq 27896 * @returns {Object} Returns the new `lodash` wrapper instance. 27897 * @example 27898 * 27899 * var array = [1, 2]; 27900 * var wrapped = _(array).push(3); 27901 * 27902 * console.log(array); 27903 * // => [1, 2] 27904 * 27905 * wrapped = wrapped.commit(); 27906 * console.log(array); 27907 * // => [1, 2, 3] 27908 * 27909 * wrapped.last(); 27910 * // => 3 27911 * 27912 * console.log(array); 27913 * // => [1, 2, 3] 27914 */ 27915 function wrapperCommit() { 27916 return new LodashWrapper(this.value(), this.__chain__); 27917 } 27918 27919 /** 27920 * Gets the next value on a wrapped object following the 27921 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 27922 * 27923 * @name next 27924 * @memberOf _ 27925 * @since 4.0.0 27926 * @category Seq 27927 * @returns {Object} Returns the next iterator value. 27928 * @example 27929 * 27930 * var wrapped = _([1, 2]); 27931 * 27932 * wrapped.next(); 27933 * // => { 'done': false, 'value': 1 } 27934 * 27935 * wrapped.next(); 27936 * // => { 'done': false, 'value': 2 } 27937 * 27938 * wrapped.next(); 27939 * // => { 'done': true, 'value': undefined } 27940 */ 27941 function wrapperNext() { 27942 if (this.__values__ === undefined) { 27943 this.__values__ = toArray(this.value()); 27944 } 27945 var done = this.__index__ >= this.__values__.length, 27946 value = done ? undefined : this.__values__[this.__index__++]; 27947 27948 return { 'done': done, 'value': value }; 27949 } 27950 27951 /** 27952 * Enables the wrapper to be iterable. 27953 * 27954 * @name Symbol.iterator 27955 * @memberOf _ 27956 * @since 4.0.0 27957 * @category Seq 27958 * @returns {Object} Returns the wrapper object. 27959 * @example 27960 * 27961 * var wrapped = _([1, 2]); 27962 * 27963 * wrapped[Symbol.iterator]() === wrapped; 27964 * // => true 27965 * 27966 * Array.from(wrapped); 27967 * // => [1, 2] 27968 */ 27969 function wrapperToIterator() { 27970 return this; 27971 } 27972 27973 /** 27974 * Creates a clone of the chain sequence planting `value` as the wrapped value. 27975 * 27976 * @name plant 27977 * @memberOf _ 27978 * @since 3.2.0 27979 * @category Seq 27980 * @param {*} value The value to plant. 27981 * @returns {Object} Returns the new `lodash` wrapper instance. 27982 * @example 27983 * 27984 * function square(n) { 27985 * return n * n; 27986 * } 27987 * 27988 * var wrapped = _([1, 2]).map(square); 27989 * var other = wrapped.plant([3, 4]); 27990 * 27991 * other.value(); 27992 * // => [9, 16] 27993 * 27994 * wrapped.value(); 27995 * // => [1, 4] 27996 */ 27997 function wrapperPlant(value) { 27998 var result, 27999 parent = this; 28000 28001 while (parent instanceof baseLodash) { 28002 var clone = wrapperClone(parent); 28003 clone.__index__ = 0; 28004 clone.__values__ = undefined; 28005 if (result) { 28006 previous.__wrapped__ = clone; 28007 } else { 28008 result = clone; 28009 } 28010 var previous = clone; 28011 parent = parent.__wrapped__; 28012 } 28013 previous.__wrapped__ = value; 28014 return result; 28015 } 28016 28017 /** 28018 * This method is the wrapper version of `_.reverse`. 28019 * 28020 * **Note:** This method mutates the wrapped array. 28021 * 28022 * @name reverse 28023 * @memberOf _ 28024 * @since 0.1.0 28025 * @category Seq 28026 * @returns {Object} Returns the new `lodash` wrapper instance. 28027 * @example 28028 * 28029 * var array = [1, 2, 3]; 28030 * 28031 * _(array).reverse().value() 28032 * // => [3, 2, 1] 28033 * 28034 * console.log(array); 28035 * // => [3, 2, 1] 28036 */ 28037 function wrapperReverse() { 28038 var value = this.__wrapped__; 28039 if (value instanceof LazyWrapper) { 28040 var wrapped = value; 28041 if (this.__actions__.length) { 28042 wrapped = new LazyWrapper(this); 28043 } 28044 wrapped = wrapped.reverse(); 28045 wrapped.__actions__.push({ 28046 'func': thru, 28047 'args': [reverse], 28048 'thisArg': undefined 28049 }); 28050 return new LodashWrapper(wrapped, this.__chain__); 28051 } 28052 return this.thru(reverse); 28053 } 28054 28055 /** 28056 * Executes the chain sequence to resolve the unwrapped value. 28057 * 28058 * @name value 28059 * @memberOf _ 28060 * @since 0.1.0 28061 * @alias toJSON, valueOf 28062 * @category Seq 28063 * @returns {*} Returns the resolved unwrapped value. 28064 * @example 28065 * 28066 * _([1, 2, 3]).value(); 28067 * // => [1, 2, 3] 28068 */ 28069 function wrapperValue() { 28070 return baseWrapperValue(this.__wrapped__, this.__actions__); 28071 } 28072 28073 /*------------------------------------------------------------------------*/ 28074 28075 /** 28076 * Creates an object composed of keys generated from the results of running 28077 * each element of `collection` thru `iteratee`. The corresponding value of 28078 * each key is the number of times the key was returned by `iteratee`. The 28079 * iteratee is invoked with one argument: (value). 28080 * 28081 * @static 28082 * @memberOf _ 28083 * @since 0.5.0 28084 * @category Collection 28085 * @param {Array|Object} collection The collection to iterate over. 28086 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 28087 * @returns {Object} Returns the composed aggregate object. 28088 * @example 28089 * 28090 * _.countBy([6.1, 4.2, 6.3], Math.floor); 28091 * // => { '4': 1, '6': 2 } 28092 * 28093 * // The `_.property` iteratee shorthand. 28094 * _.countBy(['one', 'two', 'three'], 'length'); 28095 * // => { '3': 2, '5': 1 } 28096 */ 28097 var countBy = createAggregator(function(result, value, key) { 28098 if (hasOwnProperty.call(result, key)) { 28099 ++result[key]; 28100 } else { 28101 baseAssignValue(result, key, 1); 28102 } 28103 }); 28104 28105 /** 28106 * Checks if `predicate` returns truthy for **all** elements of `collection`. 28107 * Iteration is stopped once `predicate` returns falsey. The predicate is 28108 * invoked with three arguments: (value, index|key, collection). 28109 * 28110 * **Note:** This method returns `true` for 28111 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 28112 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 28113 * elements of empty collections. 28114 * 28115 * @static 28116 * @memberOf _ 28117 * @since 0.1.0 28118 * @category Collection 28119 * @param {Array|Object} collection The collection to iterate over. 28120 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28121 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28122 * @returns {boolean} Returns `true` if all elements pass the predicate check, 28123 * else `false`. 28124 * @example 28125 * 28126 * _.every([true, 1, null, 'yes'], Boolean); 28127 * // => false 28128 * 28129 * var users = [ 28130 * { 'user': 'barney', 'age': 36, 'active': false }, 28131 * { 'user': 'fred', 'age': 40, 'active': false } 28132 * ]; 28133 * 28134 * // The `_.matches` iteratee shorthand. 28135 * _.every(users, { 'user': 'barney', 'active': false }); 28136 * // => false 28137 * 28138 * // The `_.matchesProperty` iteratee shorthand. 28139 * _.every(users, ['active', false]); 28140 * // => true 28141 * 28142 * // The `_.property` iteratee shorthand. 28143 * _.every(users, 'active'); 28144 * // => false 28145 */ 28146 function every(collection, predicate, guard) { 28147 var func = isArray(collection) ? arrayEvery : baseEvery; 28148 if (guard && isIterateeCall(collection, predicate, guard)) { 28149 predicate = undefined; 28150 } 28151 return func(collection, getIteratee(predicate, 3)); 28152 } 28153 28154 /** 28155 * Iterates over elements of `collection`, returning an array of all elements 28156 * `predicate` returns truthy for. The predicate is invoked with three 28157 * arguments: (value, index|key, collection). 28158 * 28159 * **Note:** Unlike `_.remove`, this method returns a new array. 28160 * 28161 * @static 28162 * @memberOf _ 28163 * @since 0.1.0 28164 * @category Collection 28165 * @param {Array|Object} collection The collection to iterate over. 28166 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28167 * @returns {Array} Returns the new filtered array. 28168 * @see _.reject 28169 * @example 28170 * 28171 * var users = [ 28172 * { 'user': 'barney', 'age': 36, 'active': true }, 28173 * { 'user': 'fred', 'age': 40, 'active': false } 28174 * ]; 28175 * 28176 * _.filter(users, function(o) { return !o.active; }); 28177 * // => objects for ['fred'] 28178 * 28179 * // The `_.matches` iteratee shorthand. 28180 * _.filter(users, { 'age': 36, 'active': true }); 28181 * // => objects for ['barney'] 28182 * 28183 * // The `_.matchesProperty` iteratee shorthand. 28184 * _.filter(users, ['active', false]); 28185 * // => objects for ['fred'] 28186 * 28187 * // The `_.property` iteratee shorthand. 28188 * _.filter(users, 'active'); 28189 * // => objects for ['barney'] 28190 */ 28191 function filter(collection, predicate) { 28192 var func = isArray(collection) ? arrayFilter : baseFilter; 28193 return func(collection, getIteratee(predicate, 3)); 28194 } 28195 28196 /** 28197 * Iterates over elements of `collection`, returning the first element 28198 * `predicate` returns truthy for. The predicate is invoked with three 28199 * arguments: (value, index|key, collection). 28200 * 28201 * @static 28202 * @memberOf _ 28203 * @since 0.1.0 28204 * @category Collection 28205 * @param {Array|Object} collection The collection to inspect. 28206 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28207 * @param {number} [fromIndex=0] The index to search from. 28208 * @returns {*} Returns the matched element, else `undefined`. 28209 * @example 28210 * 28211 * var users = [ 28212 * { 'user': 'barney', 'age': 36, 'active': true }, 28213 * { 'user': 'fred', 'age': 40, 'active': false }, 28214 * { 'user': 'pebbles', 'age': 1, 'active': true } 28215 * ]; 28216 * 28217 * _.find(users, function(o) { return o.age < 40; }); 28218 * // => object for 'barney' 28219 * 28220 * // The `_.matches` iteratee shorthand. 28221 * _.find(users, { 'age': 1, 'active': true }); 28222 * // => object for 'pebbles' 28223 * 28224 * // The `_.matchesProperty` iteratee shorthand. 28225 * _.find(users, ['active', false]); 28226 * // => object for 'fred' 28227 * 28228 * // The `_.property` iteratee shorthand. 28229 * _.find(users, 'active'); 28230 * // => object for 'barney' 28231 */ 28232 var find = createFind(findIndex); 28233 28234 /** 28235 * This method is like `_.find` except that it iterates over elements of 28236 * `collection` from right to left. 28237 * 28238 * @static 28239 * @memberOf _ 28240 * @since 2.0.0 28241 * @category Collection 28242 * @param {Array|Object} collection The collection to inspect. 28243 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28244 * @param {number} [fromIndex=collection.length-1] The index to search from. 28245 * @returns {*} Returns the matched element, else `undefined`. 28246 * @example 28247 * 28248 * _.findLast([1, 2, 3, 4], function(n) { 28249 * return n % 2 == 1; 28250 * }); 28251 * // => 3 28252 */ 28253 var findLast = createFind(findLastIndex); 28254 28255 /** 28256 * Creates a flattened array of values by running each element in `collection` 28257 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 28258 * with three arguments: (value, index|key, collection). 28259 * 28260 * @static 28261 * @memberOf _ 28262 * @since 4.0.0 28263 * @category Collection 28264 * @param {Array|Object} collection The collection to iterate over. 28265 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28266 * @returns {Array} Returns the new flattened array. 28267 * @example 28268 * 28269 * function duplicate(n) { 28270 * return [n, n]; 28271 * } 28272 * 28273 * _.flatMap([1, 2], duplicate); 28274 * // => [1, 1, 2, 2] 28275 */ 28276 function flatMap(collection, iteratee) { 28277 return baseFlatten(map(collection, iteratee), 1); 28278 } 28279 28280 /** 28281 * This method is like `_.flatMap` except that it recursively flattens the 28282 * mapped results. 28283 * 28284 * @static 28285 * @memberOf _ 28286 * @since 4.7.0 28287 * @category Collection 28288 * @param {Array|Object} collection The collection to iterate over. 28289 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28290 * @returns {Array} Returns the new flattened array. 28291 * @example 28292 * 28293 * function duplicate(n) { 28294 * return [[[n, n]]]; 28295 * } 28296 * 28297 * _.flatMapDeep([1, 2], duplicate); 28298 * // => [1, 1, 2, 2] 28299 */ 28300 function flatMapDeep(collection, iteratee) { 28301 return baseFlatten(map(collection, iteratee), INFINITY); 28302 } 28303 28304 /** 28305 * This method is like `_.flatMap` except that it recursively flattens the 28306 * mapped results up to `depth` times. 28307 * 28308 * @static 28309 * @memberOf _ 28310 * @since 4.7.0 28311 * @category Collection 28312 * @param {Array|Object} collection The collection to iterate over. 28313 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28314 * @param {number} [depth=1] The maximum recursion depth. 28315 * @returns {Array} Returns the new flattened array. 28316 * @example 28317 * 28318 * function duplicate(n) { 28319 * return [[[n, n]]]; 28320 * } 28321 * 28322 * _.flatMapDepth([1, 2], duplicate, 2); 28323 * // => [[1, 1], [2, 2]] 28324 */ 28325 function flatMapDepth(collection, iteratee, depth) { 28326 depth = depth === undefined ? 1 : toInteger(depth); 28327 return baseFlatten(map(collection, iteratee), depth); 28328 } 28329 28330 /** 28331 * Iterates over elements of `collection` and invokes `iteratee` for each element. 28332 * The iteratee is invoked with three arguments: (value, index|key, collection). 28333 * Iteratee functions may exit iteration early by explicitly returning `false`. 28334 * 28335 * **Note:** As with other "Collections" methods, objects with a "length" 28336 * property are iterated like arrays. To avoid this behavior use `_.forIn` 28337 * or `_.forOwn` for object iteration. 28338 * 28339 * @static 28340 * @memberOf _ 28341 * @since 0.1.0 28342 * @alias each 28343 * @category Collection 28344 * @param {Array|Object} collection The collection to iterate over. 28345 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28346 * @returns {Array|Object} Returns `collection`. 28347 * @see _.forEachRight 28348 * @example 28349 * 28350 * _.forEach([1, 2], function(value) { 28351 * console.log(value); 28352 * }); 28353 * // => Logs `1` then `2`. 28354 * 28355 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 28356 * console.log(key); 28357 * }); 28358 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 28359 */ 28360 function forEach(collection, iteratee) { 28361 var func = isArray(collection) ? arrayEach : baseEach; 28362 return func(collection, getIteratee(iteratee, 3)); 28363 } 28364 28365 /** 28366 * This method is like `_.forEach` except that it iterates over elements of 28367 * `collection` from right to left. 28368 * 28369 * @static 28370 * @memberOf _ 28371 * @since 2.0.0 28372 * @alias eachRight 28373 * @category Collection 28374 * @param {Array|Object} collection The collection to iterate over. 28375 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28376 * @returns {Array|Object} Returns `collection`. 28377 * @see _.forEach 28378 * @example 28379 * 28380 * _.forEachRight([1, 2], function(value) { 28381 * console.log(value); 28382 * }); 28383 * // => Logs `2` then `1`. 28384 */ 28385 function forEachRight(collection, iteratee) { 28386 var func = isArray(collection) ? arrayEachRight : baseEachRight; 28387 return func(collection, getIteratee(iteratee, 3)); 28388 } 28389 28390 /** 28391 * Creates an object composed of keys generated from the results of running 28392 * each element of `collection` thru `iteratee`. The order of grouped values 28393 * is determined by the order they occur in `collection`. The corresponding 28394 * value of each key is an array of elements responsible for generating the 28395 * key. The iteratee is invoked with one argument: (value). 28396 * 28397 * @static 28398 * @memberOf _ 28399 * @since 0.1.0 28400 * @category Collection 28401 * @param {Array|Object} collection The collection to iterate over. 28402 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 28403 * @returns {Object} Returns the composed aggregate object. 28404 * @example 28405 * 28406 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 28407 * // => { '4': [4.2], '6': [6.1, 6.3] } 28408 * 28409 * // The `_.property` iteratee shorthand. 28410 * _.groupBy(['one', 'two', 'three'], 'length'); 28411 * // => { '3': ['one', 'two'], '5': ['three'] } 28412 */ 28413 var groupBy = createAggregator(function(result, value, key) { 28414 if (hasOwnProperty.call(result, key)) { 28415 result[key].push(value); 28416 } else { 28417 baseAssignValue(result, key, [value]); 28418 } 28419 }); 28420 28421 /** 28422 * Checks if `value` is in `collection`. If `collection` is a string, it's 28423 * checked for a substring of `value`, otherwise 28424 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28425 * is used for equality comparisons. If `fromIndex` is negative, it's used as 28426 * the offset from the end of `collection`. 28427 * 28428 * @static 28429 * @memberOf _ 28430 * @since 0.1.0 28431 * @category Collection 28432 * @param {Array|Object|string} collection The collection to inspect. 28433 * @param {*} value The value to search for. 28434 * @param {number} [fromIndex=0] The index to search from. 28435 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 28436 * @returns {boolean} Returns `true` if `value` is found, else `false`. 28437 * @example 28438 * 28439 * _.includes([1, 2, 3], 1); 28440 * // => true 28441 * 28442 * _.includes([1, 2, 3], 1, 2); 28443 * // => false 28444 * 28445 * _.includes({ 'a': 1, 'b': 2 }, 1); 28446 * // => true 28447 * 28448 * _.includes('abcd', 'bc'); 28449 * // => true 28450 */ 28451 function includes(collection, value, fromIndex, guard) { 28452 collection = isArrayLike(collection) ? collection : values(collection); 28453 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 28454 28455 var length = collection.length; 28456 if (fromIndex < 0) { 28457 fromIndex = nativeMax(length + fromIndex, 0); 28458 } 28459 return isString(collection) 28460 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 28461 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 28462 } 28463 28464 /** 28465 * Invokes the method at `path` of each element in `collection`, returning 28466 * an array of the results of each invoked method. Any additional arguments 28467 * are provided to each invoked method. If `path` is a function, it's invoked 28468 * for, and `this` bound to, each element in `collection`. 28469 * 28470 * @static 28471 * @memberOf _ 28472 * @since 4.0.0 28473 * @category Collection 28474 * @param {Array|Object} collection The collection to iterate over. 28475 * @param {Array|Function|string} path The path of the method to invoke or 28476 * the function invoked per iteration. 28477 * @param {...*} [args] The arguments to invoke each method with. 28478 * @returns {Array} Returns the array of results. 28479 * @example 28480 * 28481 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 28482 * // => [[1, 5, 7], [1, 2, 3]] 28483 * 28484 * _.invokeMap([123, 456], String.prototype.split, ''); 28485 * // => [['1', '2', '3'], ['4', '5', '6']] 28486 */ 28487 var invokeMap = baseRest(function(collection, path, args) { 28488 var index = -1, 28489 isFunc = typeof path == 'function', 28490 result = isArrayLike(collection) ? Array(collection.length) : []; 28491 28492 baseEach(collection, function(value) { 28493 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 28494 }); 28495 return result; 28496 }); 28497 28498 /** 28499 * Creates an object composed of keys generated from the results of running 28500 * each element of `collection` thru `iteratee`. The corresponding value of 28501 * each key is the last element responsible for generating the key. The 28502 * iteratee is invoked with one argument: (value). 28503 * 28504 * @static 28505 * @memberOf _ 28506 * @since 4.0.0 28507 * @category Collection 28508 * @param {Array|Object} collection The collection to iterate over. 28509 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 28510 * @returns {Object} Returns the composed aggregate object. 28511 * @example 28512 * 28513 * var array = [ 28514 * { 'dir': 'left', 'code': 97 }, 28515 * { 'dir': 'right', 'code': 100 } 28516 * ]; 28517 * 28518 * _.keyBy(array, function(o) { 28519 * return String.fromCharCode(o.code); 28520 * }); 28521 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 28522 * 28523 * _.keyBy(array, 'dir'); 28524 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 28525 */ 28526 var keyBy = createAggregator(function(result, value, key) { 28527 baseAssignValue(result, key, value); 28528 }); 28529 28530 /** 28531 * Creates an array of values by running each element in `collection` thru 28532 * `iteratee`. The iteratee is invoked with three arguments: 28533 * (value, index|key, collection). 28534 * 28535 * Many lodash methods are guarded to work as iteratees for methods like 28536 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 28537 * 28538 * The guarded methods are: 28539 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 28540 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 28541 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 28542 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 28543 * 28544 * @static 28545 * @memberOf _ 28546 * @since 0.1.0 28547 * @category Collection 28548 * @param {Array|Object} collection The collection to iterate over. 28549 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28550 * @returns {Array} Returns the new mapped array. 28551 * @example 28552 * 28553 * function square(n) { 28554 * return n * n; 28555 * } 28556 * 28557 * _.map([4, 8], square); 28558 * // => [16, 64] 28559 * 28560 * _.map({ 'a': 4, 'b': 8 }, square); 28561 * // => [16, 64] (iteration order is not guaranteed) 28562 * 28563 * var users = [ 28564 * { 'user': 'barney' }, 28565 * { 'user': 'fred' } 28566 * ]; 28567 * 28568 * // The `_.property` iteratee shorthand. 28569 * _.map(users, 'user'); 28570 * // => ['barney', 'fred'] 28571 */ 28572 function map(collection, iteratee) { 28573 var func = isArray(collection) ? arrayMap : baseMap; 28574 return func(collection, getIteratee(iteratee, 3)); 28575 } 28576 28577 /** 28578 * This method is like `_.sortBy` except that it allows specifying the sort 28579 * orders of the iteratees to sort by. If `orders` is unspecified, all values 28580 * are sorted in ascending order. Otherwise, specify an order of "desc" for 28581 * descending or "asc" for ascending sort order of corresponding values. 28582 * 28583 * @static 28584 * @memberOf _ 28585 * @since 4.0.0 28586 * @category Collection 28587 * @param {Array|Object} collection The collection to iterate over. 28588 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 28589 * The iteratees to sort by. 28590 * @param {string[]} [orders] The sort orders of `iteratees`. 28591 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 28592 * @returns {Array} Returns the new sorted array. 28593 * @example 28594 * 28595 * var users = [ 28596 * { 'user': 'fred', 'age': 48 }, 28597 * { 'user': 'barney', 'age': 34 }, 28598 * { 'user': 'fred', 'age': 40 }, 28599 * { 'user': 'barney', 'age': 36 } 28600 * ]; 28601 * 28602 * // Sort by `user` in ascending order and by `age` in descending order. 28603 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 28604 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 28605 */ 28606 function orderBy(collection, iteratees, orders, guard) { 28607 if (collection == null) { 28608 return []; 28609 } 28610 if (!isArray(iteratees)) { 28611 iteratees = iteratees == null ? [] : [iteratees]; 28612 } 28613 orders = guard ? undefined : orders; 28614 if (!isArray(orders)) { 28615 orders = orders == null ? [] : [orders]; 28616 } 28617 return baseOrderBy(collection, iteratees, orders); 28618 } 28619 28620 /** 28621 * Creates an array of elements split into two groups, the first of which 28622 * contains elements `predicate` returns truthy for, the second of which 28623 * contains elements `predicate` returns falsey for. The predicate is 28624 * invoked with one argument: (value). 28625 * 28626 * @static 28627 * @memberOf _ 28628 * @since 3.0.0 28629 * @category Collection 28630 * @param {Array|Object} collection The collection to iterate over. 28631 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28632 * @returns {Array} Returns the array of grouped elements. 28633 * @example 28634 * 28635 * var users = [ 28636 * { 'user': 'barney', 'age': 36, 'active': false }, 28637 * { 'user': 'fred', 'age': 40, 'active': true }, 28638 * { 'user': 'pebbles', 'age': 1, 'active': false } 28639 * ]; 28640 * 28641 * _.partition(users, function(o) { return o.active; }); 28642 * // => objects for [['fred'], ['barney', 'pebbles']] 28643 * 28644 * // The `_.matches` iteratee shorthand. 28645 * _.partition(users, { 'age': 1, 'active': false }); 28646 * // => objects for [['pebbles'], ['barney', 'fred']] 28647 * 28648 * // The `_.matchesProperty` iteratee shorthand. 28649 * _.partition(users, ['active', false]); 28650 * // => objects for [['barney', 'pebbles'], ['fred']] 28651 * 28652 * // The `_.property` iteratee shorthand. 28653 * _.partition(users, 'active'); 28654 * // => objects for [['fred'], ['barney', 'pebbles']] 28655 */ 28656 var partition = createAggregator(function(result, value, key) { 28657 result[key ? 0 : 1].push(value); 28658 }, function() { return [[], []]; }); 28659 28660 /** 28661 * Reduces `collection` to a value which is the accumulated result of running 28662 * each element in `collection` thru `iteratee`, where each successive 28663 * invocation is supplied the return value of the previous. If `accumulator` 28664 * is not given, the first element of `collection` is used as the initial 28665 * value. The iteratee is invoked with four arguments: 28666 * (accumulator, value, index|key, collection). 28667 * 28668 * Many lodash methods are guarded to work as iteratees for methods like 28669 * `_.reduce`, `_.reduceRight`, and `_.transform`. 28670 * 28671 * The guarded methods are: 28672 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 28673 * and `sortBy` 28674 * 28675 * @static 28676 * @memberOf _ 28677 * @since 0.1.0 28678 * @category Collection 28679 * @param {Array|Object} collection The collection to iterate over. 28680 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28681 * @param {*} [accumulator] The initial value. 28682 * @returns {*} Returns the accumulated value. 28683 * @see _.reduceRight 28684 * @example 28685 * 28686 * _.reduce([1, 2], function(sum, n) { 28687 * return sum + n; 28688 * }, 0); 28689 * // => 3 28690 * 28691 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 28692 * (result[value] || (result[value] = [])).push(key); 28693 * return result; 28694 * }, {}); 28695 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 28696 */ 28697 function reduce(collection, iteratee, accumulator) { 28698 var func = isArray(collection) ? arrayReduce : baseReduce, 28699 initAccum = arguments.length < 3; 28700 28701 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 28702 } 28703 28704 /** 28705 * This method is like `_.reduce` except that it iterates over elements of 28706 * `collection` from right to left. 28707 * 28708 * @static 28709 * @memberOf _ 28710 * @since 0.1.0 28711 * @category Collection 28712 * @param {Array|Object} collection The collection to iterate over. 28713 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28714 * @param {*} [accumulator] The initial value. 28715 * @returns {*} Returns the accumulated value. 28716 * @see _.reduce 28717 * @example 28718 * 28719 * var array = [[0, 1], [2, 3], [4, 5]]; 28720 * 28721 * _.reduceRight(array, function(flattened, other) { 28722 * return flattened.concat(other); 28723 * }, []); 28724 * // => [4, 5, 2, 3, 0, 1] 28725 */ 28726 function reduceRight(collection, iteratee, accumulator) { 28727 var func = isArray(collection) ? arrayReduceRight : baseReduce, 28728 initAccum = arguments.length < 3; 28729 28730 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 28731 } 28732 28733 /** 28734 * The opposite of `_.filter`; this method returns the elements of `collection` 28735 * that `predicate` does **not** return truthy for. 28736 * 28737 * @static 28738 * @memberOf _ 28739 * @since 0.1.0 28740 * @category Collection 28741 * @param {Array|Object} collection The collection to iterate over. 28742 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28743 * @returns {Array} Returns the new filtered array. 28744 * @see _.filter 28745 * @example 28746 * 28747 * var users = [ 28748 * { 'user': 'barney', 'age': 36, 'active': false }, 28749 * { 'user': 'fred', 'age': 40, 'active': true } 28750 * ]; 28751 * 28752 * _.reject(users, function(o) { return !o.active; }); 28753 * // => objects for ['fred'] 28754 * 28755 * // The `_.matches` iteratee shorthand. 28756 * _.reject(users, { 'age': 40, 'active': true }); 28757 * // => objects for ['barney'] 28758 * 28759 * // The `_.matchesProperty` iteratee shorthand. 28760 * _.reject(users, ['active', false]); 28761 * // => objects for ['fred'] 28762 * 28763 * // The `_.property` iteratee shorthand. 28764 * _.reject(users, 'active'); 28765 * // => objects for ['barney'] 28766 */ 28767 function reject(collection, predicate) { 28768 var func = isArray(collection) ? arrayFilter : baseFilter; 28769 return func(collection, negate(getIteratee(predicate, 3))); 28770 } 28771 28772 /** 28773 * Gets a random element from `collection`. 28774 * 28775 * @static 28776 * @memberOf _ 28777 * @since 2.0.0 28778 * @category Collection 28779 * @param {Array|Object} collection The collection to sample. 28780 * @returns {*} Returns the random element. 28781 * @example 28782 * 28783 * _.sample([1, 2, 3, 4]); 28784 * // => 2 28785 */ 28786 function sample(collection) { 28787 var func = isArray(collection) ? arraySample : baseSample; 28788 return func(collection); 28789 } 28790 28791 /** 28792 * Gets `n` random elements at unique keys from `collection` up to the 28793 * size of `collection`. 28794 * 28795 * @static 28796 * @memberOf _ 28797 * @since 4.0.0 28798 * @category Collection 28799 * @param {Array|Object} collection The collection to sample. 28800 * @param {number} [n=1] The number of elements to sample. 28801 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28802 * @returns {Array} Returns the random elements. 28803 * @example 28804 * 28805 * _.sampleSize([1, 2, 3], 2); 28806 * // => [3, 1] 28807 * 28808 * _.sampleSize([1, 2, 3], 4); 28809 * // => [2, 3, 1] 28810 */ 28811 function sampleSize(collection, n, guard) { 28812 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 28813 n = 1; 28814 } else { 28815 n = toInteger(n); 28816 } 28817 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 28818 return func(collection, n); 28819 } 28820 28821 /** 28822 * Creates an array of shuffled values, using a version of the 28823 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 28824 * 28825 * @static 28826 * @memberOf _ 28827 * @since 0.1.0 28828 * @category Collection 28829 * @param {Array|Object} collection The collection to shuffle. 28830 * @returns {Array} Returns the new shuffled array. 28831 * @example 28832 * 28833 * _.shuffle([1, 2, 3, 4]); 28834 * // => [4, 1, 3, 2] 28835 */ 28836 function shuffle(collection) { 28837 var func = isArray(collection) ? arrayShuffle : baseShuffle; 28838 return func(collection); 28839 } 28840 28841 /** 28842 * Gets the size of `collection` by returning its length for array-like 28843 * values or the number of own enumerable string keyed properties for objects. 28844 * 28845 * @static 28846 * @memberOf _ 28847 * @since 0.1.0 28848 * @category Collection 28849 * @param {Array|Object|string} collection The collection to inspect. 28850 * @returns {number} Returns the collection size. 28851 * @example 28852 * 28853 * _.size([1, 2, 3]); 28854 * // => 3 28855 * 28856 * _.size({ 'a': 1, 'b': 2 }); 28857 * // => 2 28858 * 28859 * _.size('pebbles'); 28860 * // => 7 28861 */ 28862 function size(collection) { 28863 if (collection == null) { 28864 return 0; 28865 } 28866 if (isArrayLike(collection)) { 28867 return isString(collection) ? stringSize(collection) : collection.length; 28868 } 28869 var tag = getTag(collection); 28870 if (tag == mapTag || tag == setTag) { 28871 return collection.size; 28872 } 28873 return baseKeys(collection).length; 28874 } 28875 28876 /** 28877 * Checks if `predicate` returns truthy for **any** element of `collection`. 28878 * Iteration is stopped once `predicate` returns truthy. The predicate is 28879 * invoked with three arguments: (value, index|key, collection). 28880 * 28881 * @static 28882 * @memberOf _ 28883 * @since 0.1.0 28884 * @category Collection 28885 * @param {Array|Object} collection The collection to iterate over. 28886 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28887 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28888 * @returns {boolean} Returns `true` if any element passes the predicate check, 28889 * else `false`. 28890 * @example 28891 * 28892 * _.some([null, 0, 'yes', false], Boolean); 28893 * // => true 28894 * 28895 * var users = [ 28896 * { 'user': 'barney', 'active': true }, 28897 * { 'user': 'fred', 'active': false } 28898 * ]; 28899 * 28900 * // The `_.matches` iteratee shorthand. 28901 * _.some(users, { 'user': 'barney', 'active': false }); 28902 * // => false 28903 * 28904 * // The `_.matchesProperty` iteratee shorthand. 28905 * _.some(users, ['active', false]); 28906 * // => true 28907 * 28908 * // The `_.property` iteratee shorthand. 28909 * _.some(users, 'active'); 28910 * // => true 28911 */ 28912 function some(collection, predicate, guard) { 28913 var func = isArray(collection) ? arraySome : baseSome; 28914 if (guard && isIterateeCall(collection, predicate, guard)) { 28915 predicate = undefined; 28916 } 28917 return func(collection, getIteratee(predicate, 3)); 28918 } 28919 28920 /** 28921 * Creates an array of elements, sorted in ascending order by the results of 28922 * running each element in a collection thru each iteratee. This method 28923 * performs a stable sort, that is, it preserves the original sort order of 28924 * equal elements. The iteratees are invoked with one argument: (value). 28925 * 28926 * @static 28927 * @memberOf _ 28928 * @since 0.1.0 28929 * @category Collection 28930 * @param {Array|Object} collection The collection to iterate over. 28931 * @param {...(Function|Function[])} [iteratees=[_.identity]] 28932 * The iteratees to sort by. 28933 * @returns {Array} Returns the new sorted array. 28934 * @example 28935 * 28936 * var users = [ 28937 * { 'user': 'fred', 'age': 48 }, 28938 * { 'user': 'barney', 'age': 36 }, 28939 * { 'user': 'fred', 'age': 40 }, 28940 * { 'user': 'barney', 'age': 34 } 28941 * ]; 28942 * 28943 * _.sortBy(users, [function(o) { return o.user; }]); 28944 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 28945 * 28946 * _.sortBy(users, ['user', 'age']); 28947 * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] 28948 */ 28949 var sortBy = baseRest(function(collection, iteratees) { 28950 if (collection == null) { 28951 return []; 28952 } 28953 var length = iteratees.length; 28954 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 28955 iteratees = []; 28956 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 28957 iteratees = [iteratees[0]]; 28958 } 28959 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 28960 }); 28961 28962 /*------------------------------------------------------------------------*/ 28963 28964 /** 28965 * Gets the timestamp of the number of milliseconds that have elapsed since 28966 * the Unix epoch (1 January 1970 00:00:00 UTC). 28967 * 28968 * @static 28969 * @memberOf _ 28970 * @since 2.4.0 28971 * @category Date 28972 * @returns {number} Returns the timestamp. 28973 * @example 28974 * 28975 * _.defer(function(stamp) { 28976 * console.log(_.now() - stamp); 28977 * }, _.now()); 28978 * // => Logs the number of milliseconds it took for the deferred invocation. 28979 */ 28980 var now = ctxNow || function() { 28981 return root.Date.now(); 28982 }; 28983 28984 /*------------------------------------------------------------------------*/ 28985 28986 /** 28987 * The opposite of `_.before`; this method creates a function that invokes 28988 * `func` once it's called `n` or more times. 28989 * 28990 * @static 28991 * @memberOf _ 28992 * @since 0.1.0 28993 * @category Function 28994 * @param {number} n The number of calls before `func` is invoked. 28995 * @param {Function} func The function to restrict. 28996 * @returns {Function} Returns the new restricted function. 28997 * @example 28998 * 28999 * var saves = ['profile', 'settings']; 29000 * 29001 * var done = _.after(saves.length, function() { 29002 * console.log('done saving!'); 29003 * }); 29004 * 29005 * _.forEach(saves, function(type) { 29006 * asyncSave({ 'type': type, 'complete': done }); 29007 * }); 29008 * // => Logs 'done saving!' after the two async saves have completed. 29009 */ 29010 function after(n, func) { 29011 if (typeof func != 'function') { 29012 throw new TypeError(FUNC_ERROR_TEXT); 29013 } 29014 n = toInteger(n); 29015 return function() { 29016 if (--n < 1) { 29017 return func.apply(this, arguments); 29018 } 29019 }; 29020 } 29021 29022 /** 29023 * Creates a function that invokes `func`, with up to `n` arguments, 29024 * ignoring any additional arguments. 29025 * 29026 * @static 29027 * @memberOf _ 29028 * @since 3.0.0 29029 * @category Function 29030 * @param {Function} func The function to cap arguments for. 29031 * @param {number} [n=func.length] The arity cap. 29032 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29033 * @returns {Function} Returns the new capped function. 29034 * @example 29035 * 29036 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 29037 * // => [6, 8, 10] 29038 */ 29039 function ary(func, n, guard) { 29040 n = guard ? undefined : n; 29041 n = (func && n == null) ? func.length : n; 29042 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 29043 } 29044 29045 /** 29046 * Creates a function that invokes `func`, with the `this` binding and arguments 29047 * of the created function, while it's called less than `n` times. Subsequent 29048 * calls to the created function return the result of the last `func` invocation. 29049 * 29050 * @static 29051 * @memberOf _ 29052 * @since 3.0.0 29053 * @category Function 29054 * @param {number} n The number of calls at which `func` is no longer invoked. 29055 * @param {Function} func The function to restrict. 29056 * @returns {Function} Returns the new restricted function. 29057 * @example 29058 * 29059 * jQuery(element).on('click', _.before(5, addContactToList)); 29060 * // => Allows adding up to 4 contacts to the list. 29061 */ 29062 function before(n, func) { 29063 var result; 29064 if (typeof func != 'function') { 29065 throw new TypeError(FUNC_ERROR_TEXT); 29066 } 29067 n = toInteger(n); 29068 return function() { 29069 if (--n > 0) { 29070 result = func.apply(this, arguments); 29071 } 29072 if (n <= 1) { 29073 func = undefined; 29074 } 29075 return result; 29076 }; 29077 } 29078 29079 /** 29080 * Creates a function that invokes `func` with the `this` binding of `thisArg` 29081 * and `partials` prepended to the arguments it receives. 29082 * 29083 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 29084 * may be used as a placeholder for partially applied arguments. 29085 * 29086 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 29087 * property of bound functions. 29088 * 29089 * @static 29090 * @memberOf _ 29091 * @since 0.1.0 29092 * @category Function 29093 * @param {Function} func The function to bind. 29094 * @param {*} thisArg The `this` binding of `func`. 29095 * @param {...*} [partials] The arguments to be partially applied. 29096 * @returns {Function} Returns the new bound function. 29097 * @example 29098 * 29099 * function greet(greeting, punctuation) { 29100 * return greeting + ' ' + this.user + punctuation; 29101 * } 29102 * 29103 * var object = { 'user': 'fred' }; 29104 * 29105 * var bound = _.bind(greet, object, 'hi'); 29106 * bound('!'); 29107 * // => 'hi fred!' 29108 * 29109 * // Bound with placeholders. 29110 * var bound = _.bind(greet, object, _, '!'); 29111 * bound('hi'); 29112 * // => 'hi fred!' 29113 */ 29114 var bind = baseRest(function(func, thisArg, partials) { 29115 var bitmask = WRAP_BIND_FLAG; 29116 if (partials.length) { 29117 var holders = replaceHolders(partials, getHolder(bind)); 29118 bitmask |= WRAP_PARTIAL_FLAG; 29119 } 29120 return createWrap(func, bitmask, thisArg, partials, holders); 29121 }); 29122 29123 /** 29124 * Creates a function that invokes the method at `object[key]` with `partials` 29125 * prepended to the arguments it receives. 29126 * 29127 * This method differs from `_.bind` by allowing bound functions to reference 29128 * methods that may be redefined or don't yet exist. See 29129 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 29130 * for more details. 29131 * 29132 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 29133 * builds, may be used as a placeholder for partially applied arguments. 29134 * 29135 * @static 29136 * @memberOf _ 29137 * @since 0.10.0 29138 * @category Function 29139 * @param {Object} object The object to invoke the method on. 29140 * @param {string} key The key of the method. 29141 * @param {...*} [partials] The arguments to be partially applied. 29142 * @returns {Function} Returns the new bound function. 29143 * @example 29144 * 29145 * var object = { 29146 * 'user': 'fred', 29147 * 'greet': function(greeting, punctuation) { 29148 * return greeting + ' ' + this.user + punctuation; 29149 * } 29150 * }; 29151 * 29152 * var bound = _.bindKey(object, 'greet', 'hi'); 29153 * bound('!'); 29154 * // => 'hi fred!' 29155 * 29156 * object.greet = function(greeting, punctuation) { 29157 * return greeting + 'ya ' + this.user + punctuation; 29158 * }; 29159 * 29160 * bound('!'); 29161 * // => 'hiya fred!' 29162 * 29163 * // Bound with placeholders. 29164 * var bound = _.bindKey(object, 'greet', _, '!'); 29165 * bound('hi'); 29166 * // => 'hiya fred!' 29167 */ 29168 var bindKey = baseRest(function(object, key, partials) { 29169 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 29170 if (partials.length) { 29171 var holders = replaceHolders(partials, getHolder(bindKey)); 29172 bitmask |= WRAP_PARTIAL_FLAG; 29173 } 29174 return createWrap(key, bitmask, object, partials, holders); 29175 }); 29176 29177 /** 29178 * Creates a function that accepts arguments of `func` and either invokes 29179 * `func` returning its result, if at least `arity` number of arguments have 29180 * been provided, or returns a function that accepts the remaining `func` 29181 * arguments, and so on. The arity of `func` may be specified if `func.length` 29182 * is not sufficient. 29183 * 29184 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 29185 * may be used as a placeholder for provided arguments. 29186 * 29187 * **Note:** This method doesn't set the "length" property of curried functions. 29188 * 29189 * @static 29190 * @memberOf _ 29191 * @since 2.0.0 29192 * @category Function 29193 * @param {Function} func The function to curry. 29194 * @param {number} [arity=func.length] The arity of `func`. 29195 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29196 * @returns {Function} Returns the new curried function. 29197 * @example 29198 * 29199 * var abc = function(a, b, c) { 29200 * return [a, b, c]; 29201 * }; 29202 * 29203 * var curried = _.curry(abc); 29204 * 29205 * curried(1)(2)(3); 29206 * // => [1, 2, 3] 29207 * 29208 * curried(1, 2)(3); 29209 * // => [1, 2, 3] 29210 * 29211 * curried(1, 2, 3); 29212 * // => [1, 2, 3] 29213 * 29214 * // Curried with placeholders. 29215 * curried(1)(_, 3)(2); 29216 * // => [1, 2, 3] 29217 */ 29218 function curry(func, arity, guard) { 29219 arity = guard ? undefined : arity; 29220 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 29221 result.placeholder = curry.placeholder; 29222 return result; 29223 } 29224 29225 /** 29226 * This method is like `_.curry` except that arguments are applied to `func` 29227 * in the manner of `_.partialRight` instead of `_.partial`. 29228 * 29229 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 29230 * builds, may be used as a placeholder for provided arguments. 29231 * 29232 * **Note:** This method doesn't set the "length" property of curried functions. 29233 * 29234 * @static 29235 * @memberOf _ 29236 * @since 3.0.0 29237 * @category Function 29238 * @param {Function} func The function to curry. 29239 * @param {number} [arity=func.length] The arity of `func`. 29240 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29241 * @returns {Function} Returns the new curried function. 29242 * @example 29243 * 29244 * var abc = function(a, b, c) { 29245 * return [a, b, c]; 29246 * }; 29247 * 29248 * var curried = _.curryRight(abc); 29249 * 29250 * curried(3)(2)(1); 29251 * // => [1, 2, 3] 29252 * 29253 * curried(2, 3)(1); 29254 * // => [1, 2, 3] 29255 * 29256 * curried(1, 2, 3); 29257 * // => [1, 2, 3] 29258 * 29259 * // Curried with placeholders. 29260 * curried(3)(1, _)(2); 29261 * // => [1, 2, 3] 29262 */ 29263 function curryRight(func, arity, guard) { 29264 arity = guard ? undefined : arity; 29265 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 29266 result.placeholder = curryRight.placeholder; 29267 return result; 29268 } 29269 29270 /** 29271 * Creates a debounced function that delays invoking `func` until after `wait` 29272 * milliseconds have elapsed since the last time the debounced function was 29273 * invoked. The debounced function comes with a `cancel` method to cancel 29274 * delayed `func` invocations and a `flush` method to immediately invoke them. 29275 * Provide `options` to indicate whether `func` should be invoked on the 29276 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 29277 * with the last arguments provided to the debounced function. Subsequent 29278 * calls to the debounced function return the result of the last `func` 29279 * invocation. 29280 * 29281 * **Note:** If `leading` and `trailing` options are `true`, `func` is 29282 * invoked on the trailing edge of the timeout only if the debounced function 29283 * is invoked more than once during the `wait` timeout. 29284 * 29285 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 29286 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 29287 * 29288 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 29289 * for details over the differences between `_.debounce` and `_.throttle`. 29290 * 29291 * @static 29292 * @memberOf _ 29293 * @since 0.1.0 29294 * @category Function 29295 * @param {Function} func The function to debounce. 29296 * @param {number} [wait=0] The number of milliseconds to delay. 29297 * @param {Object} [options={}] The options object. 29298 * @param {boolean} [options.leading=false] 29299 * Specify invoking on the leading edge of the timeout. 29300 * @param {number} [options.maxWait] 29301 * The maximum time `func` is allowed to be delayed before it's invoked. 29302 * @param {boolean} [options.trailing=true] 29303 * Specify invoking on the trailing edge of the timeout. 29304 * @returns {Function} Returns the new debounced function. 29305 * @example 29306 * 29307 * // Avoid costly calculations while the window size is in flux. 29308 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 29309 * 29310 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 29311 * jQuery(element).on('click', _.debounce(sendMail, 300, { 29312 * 'leading': true, 29313 * 'trailing': false 29314 * })); 29315 * 29316 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 29317 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 29318 * var source = new EventSource('/stream'); 29319 * jQuery(source).on('message', debounced); 29320 * 29321 * // Cancel the trailing debounced invocation. 29322 * jQuery(window).on('popstate', debounced.cancel); 29323 */ 29324 function debounce(func, wait, options) { 29325 var lastArgs, 29326 lastThis, 29327 maxWait, 29328 result, 29329 timerId, 29330 lastCallTime, 29331 lastInvokeTime = 0, 29332 leading = false, 29333 maxing = false, 29334 trailing = true; 29335 29336 if (typeof func != 'function') { 29337 throw new TypeError(FUNC_ERROR_TEXT); 29338 } 29339 wait = toNumber(wait) || 0; 29340 if (isObject(options)) { 29341 leading = !!options.leading; 29342 maxing = 'maxWait' in options; 29343 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 29344 trailing = 'trailing' in options ? !!options.trailing : trailing; 29345 } 29346 29347 function invokeFunc(time) { 29348 var args = lastArgs, 29349 thisArg = lastThis; 29350 29351 lastArgs = lastThis = undefined; 29352 lastInvokeTime = time; 29353 result = func.apply(thisArg, args); 29354 return result; 29355 } 29356 29357 function leadingEdge(time) { 29358 // Reset any `maxWait` timer. 29359 lastInvokeTime = time; 29360 // Start the timer for the trailing edge. 29361 timerId = setTimeout(timerExpired, wait); 29362 // Invoke the leading edge. 29363 return leading ? invokeFunc(time) : result; 29364 } 29365 29366 function remainingWait(time) { 29367 var timeSinceLastCall = time - lastCallTime, 29368 timeSinceLastInvoke = time - lastInvokeTime, 29369 timeWaiting = wait - timeSinceLastCall; 29370 29371 return maxing 29372 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 29373 : timeWaiting; 29374 } 29375 29376 function shouldInvoke(time) { 29377 var timeSinceLastCall = time - lastCallTime, 29378 timeSinceLastInvoke = time - lastInvokeTime; 29379 29380 // Either this is the first call, activity has stopped and we're at the 29381 // trailing edge, the system time has gone backwards and we're treating 29382 // it as the trailing edge, or we've hit the `maxWait` limit. 29383 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 29384 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 29385 } 29386 29387 function timerExpired() { 29388 var time = now(); 29389 if (shouldInvoke(time)) { 29390 return trailingEdge(time); 29391 } 29392 // Restart the timer. 29393 timerId = setTimeout(timerExpired, remainingWait(time)); 29394 } 29395 29396 function trailingEdge(time) { 29397 timerId = undefined; 29398 29399 // Only invoke if we have `lastArgs` which means `func` has been 29400 // debounced at least once. 29401 if (trailing && lastArgs) { 29402 return invokeFunc(time); 29403 } 29404 lastArgs = lastThis = undefined; 29405 return result; 29406 } 29407 29408 function cancel() { 29409 if (timerId !== undefined) { 29410 clearTimeout(timerId); 29411 } 29412 lastInvokeTime = 0; 29413 lastArgs = lastCallTime = lastThis = timerId = undefined; 29414 } 29415 29416 function flush() { 29417 return timerId === undefined ? result : trailingEdge(now()); 29418 } 29419 29420 function debounced() { 29421 var time = now(), 29422 isInvoking = shouldInvoke(time); 29423 29424 lastArgs = arguments; 29425 lastThis = this; 29426 lastCallTime = time; 29427 29428 if (isInvoking) { 29429 if (timerId === undefined) { 29430 return leadingEdge(lastCallTime); 29431 } 29432 if (maxing) { 29433 // Handle invocations in a tight loop. 29434 clearTimeout(timerId); 29435 timerId = setTimeout(timerExpired, wait); 29436 return invokeFunc(lastCallTime); 29437 } 29438 } 29439 if (timerId === undefined) { 29440 timerId = setTimeout(timerExpired, wait); 29441 } 29442 return result; 29443 } 29444 debounced.cancel = cancel; 29445 debounced.flush = flush; 29446 return debounced; 29447 } 29448 29449 /** 29450 * Defers invoking the `func` until the current call stack has cleared. Any 29451 * additional arguments are provided to `func` when it's invoked. 29452 * 29453 * @static 29454 * @memberOf _ 29455 * @since 0.1.0 29456 * @category Function 29457 * @param {Function} func The function to defer. 29458 * @param {...*} [args] The arguments to invoke `func` with. 29459 * @returns {number} Returns the timer id. 29460 * @example 29461 * 29462 * _.defer(function(text) { 29463 * console.log(text); 29464 * }, 'deferred'); 29465 * // => Logs 'deferred' after one millisecond. 29466 */ 29467 var defer = baseRest(function(func, args) { 29468 return baseDelay(func, 1, args); 29469 }); 29470 29471 /** 29472 * Invokes `func` after `wait` milliseconds. Any additional arguments are 29473 * provided to `func` when it's invoked. 29474 * 29475 * @static 29476 * @memberOf _ 29477 * @since 0.1.0 29478 * @category Function 29479 * @param {Function} func The function to delay. 29480 * @param {number} wait The number of milliseconds to delay invocation. 29481 * @param {...*} [args] The arguments to invoke `func` with. 29482 * @returns {number} Returns the timer id. 29483 * @example 29484 * 29485 * _.delay(function(text) { 29486 * console.log(text); 29487 * }, 1000, 'later'); 29488 * // => Logs 'later' after one second. 29489 */ 29490 var delay = baseRest(function(func, wait, args) { 29491 return baseDelay(func, toNumber(wait) || 0, args); 29492 }); 29493 29494 /** 29495 * Creates a function that invokes `func` with arguments reversed. 29496 * 29497 * @static 29498 * @memberOf _ 29499 * @since 4.0.0 29500 * @category Function 29501 * @param {Function} func The function to flip arguments for. 29502 * @returns {Function} Returns the new flipped function. 29503 * @example 29504 * 29505 * var flipped = _.flip(function() { 29506 * return _.toArray(arguments); 29507 * }); 29508 * 29509 * flipped('a', 'b', 'c', 'd'); 29510 * // => ['d', 'c', 'b', 'a'] 29511 */ 29512 function flip(func) { 29513 return createWrap(func, WRAP_FLIP_FLAG); 29514 } 29515 29516 /** 29517 * Creates a function that memoizes the result of `func`. If `resolver` is 29518 * provided, it determines the cache key for storing the result based on the 29519 * arguments provided to the memoized function. By default, the first argument 29520 * provided to the memoized function is used as the map cache key. The `func` 29521 * is invoked with the `this` binding of the memoized function. 29522 * 29523 * **Note:** The cache is exposed as the `cache` property on the memoized 29524 * function. Its creation may be customized by replacing the `_.memoize.Cache` 29525 * constructor with one whose instances implement the 29526 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 29527 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 29528 * 29529 * @static 29530 * @memberOf _ 29531 * @since 0.1.0 29532 * @category Function 29533 * @param {Function} func The function to have its output memoized. 29534 * @param {Function} [resolver] The function to resolve the cache key. 29535 * @returns {Function} Returns the new memoized function. 29536 * @example 29537 * 29538 * var object = { 'a': 1, 'b': 2 }; 29539 * var other = { 'c': 3, 'd': 4 }; 29540 * 29541 * var values = _.memoize(_.values); 29542 * values(object); 29543 * // => [1, 2] 29544 * 29545 * values(other); 29546 * // => [3, 4] 29547 * 29548 * object.a = 2; 29549 * values(object); 29550 * // => [1, 2] 29551 * 29552 * // Modify the result cache. 29553 * values.cache.set(object, ['a', 'b']); 29554 * values(object); 29555 * // => ['a', 'b'] 29556 * 29557 * // Replace `_.memoize.Cache`. 29558 * _.memoize.Cache = WeakMap; 29559 */ 29560 function memoize(func, resolver) { 29561 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 29562 throw new TypeError(FUNC_ERROR_TEXT); 29563 } 29564 var memoized = function() { 29565 var args = arguments, 29566 key = resolver ? resolver.apply(this, args) : args[0], 29567 cache = memoized.cache; 29568 29569 if (cache.has(key)) { 29570 return cache.get(key); 29571 } 29572 var result = func.apply(this, args); 29573 memoized.cache = cache.set(key, result) || cache; 29574 return result; 29575 }; 29576 memoized.cache = new (memoize.Cache || MapCache); 29577 return memoized; 29578 } 29579 29580 // Expose `MapCache`. 29581 memoize.Cache = MapCache; 29582 29583 /** 29584 * Creates a function that negates the result of the predicate `func`. The 29585 * `func` predicate is invoked with the `this` binding and arguments of the 29586 * created function. 29587 * 29588 * @static 29589 * @memberOf _ 29590 * @since 3.0.0 29591 * @category Function 29592 * @param {Function} predicate The predicate to negate. 29593 * @returns {Function} Returns the new negated function. 29594 * @example 29595 * 29596 * function isEven(n) { 29597 * return n % 2 == 0; 29598 * } 29599 * 29600 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 29601 * // => [1, 3, 5] 29602 */ 29603 function negate(predicate) { 29604 if (typeof predicate != 'function') { 29605 throw new TypeError(FUNC_ERROR_TEXT); 29606 } 29607 return function() { 29608 var args = arguments; 29609 switch (args.length) { 29610 case 0: return !predicate.call(this); 29611 case 1: return !predicate.call(this, args[0]); 29612 case 2: return !predicate.call(this, args[0], args[1]); 29613 case 3: return !predicate.call(this, args[0], args[1], args[2]); 29614 } 29615 return !predicate.apply(this, args); 29616 }; 29617 } 29618 29619 /** 29620 * Creates a function that is restricted to invoking `func` once. Repeat calls 29621 * to the function return the value of the first invocation. The `func` is 29622 * invoked with the `this` binding and arguments of the created function. 29623 * 29624 * @static 29625 * @memberOf _ 29626 * @since 0.1.0 29627 * @category Function 29628 * @param {Function} func The function to restrict. 29629 * @returns {Function} Returns the new restricted function. 29630 * @example 29631 * 29632 * var initialize = _.once(createApplication); 29633 * initialize(); 29634 * initialize(); 29635 * // => `createApplication` is invoked once 29636 */ 29637 function once(func) { 29638 return before(2, func); 29639 } 29640 29641 /** 29642 * Creates a function that invokes `func` with its arguments transformed. 29643 * 29644 * @static 29645 * @since 4.0.0 29646 * @memberOf _ 29647 * @category Function 29648 * @param {Function} func The function to wrap. 29649 * @param {...(Function|Function[])} [transforms=[_.identity]] 29650 * The argument transforms. 29651 * @returns {Function} Returns the new function. 29652 * @example 29653 * 29654 * function doubled(n) { 29655 * return n * 2; 29656 * } 29657 * 29658 * function square(n) { 29659 * return n * n; 29660 * } 29661 * 29662 * var func = _.overArgs(function(x, y) { 29663 * return [x, y]; 29664 * }, [square, doubled]); 29665 * 29666 * func(9, 3); 29667 * // => [81, 6] 29668 * 29669 * func(10, 5); 29670 * // => [100, 10] 29671 */ 29672 var overArgs = castRest(function(func, transforms) { 29673 transforms = (transforms.length == 1 && isArray(transforms[0])) 29674 ? arrayMap(transforms[0], baseUnary(getIteratee())) 29675 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 29676 29677 var funcsLength = transforms.length; 29678 return baseRest(function(args) { 29679 var index = -1, 29680 length = nativeMin(args.length, funcsLength); 29681 29682 while (++index < length) { 29683 args[index] = transforms[index].call(this, args[index]); 29684 } 29685 return apply(func, this, args); 29686 }); 29687 }); 29688 29689 /** 29690 * Creates a function that invokes `func` with `partials` prepended to the 29691 * arguments it receives. This method is like `_.bind` except it does **not** 29692 * alter the `this` binding. 29693 * 29694 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 29695 * builds, may be used as a placeholder for partially applied arguments. 29696 * 29697 * **Note:** This method doesn't set the "length" property of partially 29698 * applied functions. 29699 * 29700 * @static 29701 * @memberOf _ 29702 * @since 0.2.0 29703 * @category Function 29704 * @param {Function} func The function to partially apply arguments to. 29705 * @param {...*} [partials] The arguments to be partially applied. 29706 * @returns {Function} Returns the new partially applied function. 29707 * @example 29708 * 29709 * function greet(greeting, name) { 29710 * return greeting + ' ' + name; 29711 * } 29712 * 29713 * var sayHelloTo = _.partial(greet, 'hello'); 29714 * sayHelloTo('fred'); 29715 * // => 'hello fred' 29716 * 29717 * // Partially applied with placeholders. 29718 * var greetFred = _.partial(greet, _, 'fred'); 29719 * greetFred('hi'); 29720 * // => 'hi fred' 29721 */ 29722 var partial = baseRest(function(func, partials) { 29723 var holders = replaceHolders(partials, getHolder(partial)); 29724 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 29725 }); 29726 29727 /** 29728 * This method is like `_.partial` except that partially applied arguments 29729 * are appended to the arguments it receives. 29730 * 29731 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 29732 * builds, may be used as a placeholder for partially applied arguments. 29733 * 29734 * **Note:** This method doesn't set the "length" property of partially 29735 * applied functions. 29736 * 29737 * @static 29738 * @memberOf _ 29739 * @since 1.0.0 29740 * @category Function 29741 * @param {Function} func The function to partially apply arguments to. 29742 * @param {...*} [partials] The arguments to be partially applied. 29743 * @returns {Function} Returns the new partially applied function. 29744 * @example 29745 * 29746 * function greet(greeting, name) { 29747 * return greeting + ' ' + name; 29748 * } 29749 * 29750 * var greetFred = _.partialRight(greet, 'fred'); 29751 * greetFred('hi'); 29752 * // => 'hi fred' 29753 * 29754 * // Partially applied with placeholders. 29755 * var sayHelloTo = _.partialRight(greet, 'hello', _); 29756 * sayHelloTo('fred'); 29757 * // => 'hello fred' 29758 */ 29759 var partialRight = baseRest(function(func, partials) { 29760 var holders = replaceHolders(partials, getHolder(partialRight)); 29761 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 29762 }); 29763 29764 /** 29765 * Creates a function that invokes `func` with arguments arranged according 29766 * to the specified `indexes` where the argument value at the first index is 29767 * provided as the first argument, the argument value at the second index is 29768 * provided as the second argument, and so on. 29769 * 29770 * @static 29771 * @memberOf _ 29772 * @since 3.0.0 29773 * @category Function 29774 * @param {Function} func The function to rearrange arguments for. 29775 * @param {...(number|number[])} indexes The arranged argument indexes. 29776 * @returns {Function} Returns the new function. 29777 * @example 29778 * 29779 * var rearged = _.rearg(function(a, b, c) { 29780 * return [a, b, c]; 29781 * }, [2, 0, 1]); 29782 * 29783 * rearged('b', 'c', 'a') 29784 * // => ['a', 'b', 'c'] 29785 */ 29786 var rearg = flatRest(function(func, indexes) { 29787 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 29788 }); 29789 29790 /** 29791 * Creates a function that invokes `func` with the `this` binding of the 29792 * created function and arguments from `start` and beyond provided as 29793 * an array. 29794 * 29795 * **Note:** This method is based on the 29796 * [rest parameter](https://mdn.io/rest_parameters). 29797 * 29798 * @static 29799 * @memberOf _ 29800 * @since 4.0.0 29801 * @category Function 29802 * @param {Function} func The function to apply a rest parameter to. 29803 * @param {number} [start=func.length-1] The start position of the rest parameter. 29804 * @returns {Function} Returns the new function. 29805 * @example 29806 * 29807 * var say = _.rest(function(what, names) { 29808 * return what + ' ' + _.initial(names).join(', ') + 29809 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 29810 * }); 29811 * 29812 * say('hello', 'fred', 'barney', 'pebbles'); 29813 * // => 'hello fred, barney, & pebbles' 29814 */ 29815 function rest(func, start) { 29816 if (typeof func != 'function') { 29817 throw new TypeError(FUNC_ERROR_TEXT); 29818 } 29819 start = start === undefined ? start : toInteger(start); 29820 return baseRest(func, start); 29821 } 29822 29823 /** 29824 * Creates a function that invokes `func` with the `this` binding of the 29825 * create function and an array of arguments much like 29826 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 29827 * 29828 * **Note:** This method is based on the 29829 * [spread operator](https://mdn.io/spread_operator). 29830 * 29831 * @static 29832 * @memberOf _ 29833 * @since 3.2.0 29834 * @category Function 29835 * @param {Function} func The function to spread arguments over. 29836 * @param {number} [start=0] The start position of the spread. 29837 * @returns {Function} Returns the new function. 29838 * @example 29839 * 29840 * var say = _.spread(function(who, what) { 29841 * return who + ' says ' + what; 29842 * }); 29843 * 29844 * say(['fred', 'hello']); 29845 * // => 'fred says hello' 29846 * 29847 * var numbers = Promise.all([ 29848 * Promise.resolve(40), 29849 * Promise.resolve(36) 29850 * ]); 29851 * 29852 * numbers.then(_.spread(function(x, y) { 29853 * return x + y; 29854 * })); 29855 * // => a Promise of 76 29856 */ 29857 function spread(func, start) { 29858 if (typeof func != 'function') { 29859 throw new TypeError(FUNC_ERROR_TEXT); 29860 } 29861 start = start == null ? 0 : nativeMax(toInteger(start), 0); 29862 return baseRest(function(args) { 29863 var array = args[start], 29864 otherArgs = castSlice(args, 0, start); 29865 29866 if (array) { 29867 arrayPush(otherArgs, array); 29868 } 29869 return apply(func, this, otherArgs); 29870 }); 29871 } 29872 29873 /** 29874 * Creates a throttled function that only invokes `func` at most once per 29875 * every `wait` milliseconds. The throttled function comes with a `cancel` 29876 * method to cancel delayed `func` invocations and a `flush` method to 29877 * immediately invoke them. Provide `options` to indicate whether `func` 29878 * should be invoked on the leading and/or trailing edge of the `wait` 29879 * timeout. The `func` is invoked with the last arguments provided to the 29880 * throttled function. Subsequent calls to the throttled function return the 29881 * result of the last `func` invocation. 29882 * 29883 * **Note:** If `leading` and `trailing` options are `true`, `func` is 29884 * invoked on the trailing edge of the timeout only if the throttled function 29885 * is invoked more than once during the `wait` timeout. 29886 * 29887 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 29888 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 29889 * 29890 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 29891 * for details over the differences between `_.throttle` and `_.debounce`. 29892 * 29893 * @static 29894 * @memberOf _ 29895 * @since 0.1.0 29896 * @category Function 29897 * @param {Function} func The function to throttle. 29898 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 29899 * @param {Object} [options={}] The options object. 29900 * @param {boolean} [options.leading=true] 29901 * Specify invoking on the leading edge of the timeout. 29902 * @param {boolean} [options.trailing=true] 29903 * Specify invoking on the trailing edge of the timeout. 29904 * @returns {Function} Returns the new throttled function. 29905 * @example 29906 * 29907 * // Avoid excessively updating the position while scrolling. 29908 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 29909 * 29910 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 29911 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 29912 * jQuery(element).on('click', throttled); 29913 * 29914 * // Cancel the trailing throttled invocation. 29915 * jQuery(window).on('popstate', throttled.cancel); 29916 */ 29917 function throttle(func, wait, options) { 29918 var leading = true, 29919 trailing = true; 29920 29921 if (typeof func != 'function') { 29922 throw new TypeError(FUNC_ERROR_TEXT); 29923 } 29924 if (isObject(options)) { 29925 leading = 'leading' in options ? !!options.leading : leading; 29926 trailing = 'trailing' in options ? !!options.trailing : trailing; 29927 } 29928 return debounce(func, wait, { 29929 'leading': leading, 29930 'maxWait': wait, 29931 'trailing': trailing 29932 }); 29933 } 29934 29935 /** 29936 * Creates a function that accepts up to one argument, ignoring any 29937 * additional arguments. 29938 * 29939 * @static 29940 * @memberOf _ 29941 * @since 4.0.0 29942 * @category Function 29943 * @param {Function} func The function to cap arguments for. 29944 * @returns {Function} Returns the new capped function. 29945 * @example 29946 * 29947 * _.map(['6', '8', '10'], _.unary(parseInt)); 29948 * // => [6, 8, 10] 29949 */ 29950 function unary(func) { 29951 return ary(func, 1); 29952 } 29953 29954 /** 29955 * Creates a function that provides `value` to `wrapper` as its first 29956 * argument. Any additional arguments provided to the function are appended 29957 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 29958 * binding of the created function. 29959 * 29960 * @static 29961 * @memberOf _ 29962 * @since 0.1.0 29963 * @category Function 29964 * @param {*} value The value to wrap. 29965 * @param {Function} [wrapper=identity] The wrapper function. 29966 * @returns {Function} Returns the new function. 29967 * @example 29968 * 29969 * var p = _.wrap(_.escape, function(func, text) { 29970 * return '<p>' + func(text) + '</p>'; 29971 * }); 29972 * 29973 * p('fred, barney, & pebbles'); 29974 * // => '<p>fred, barney, & pebbles</p>' 29975 */ 29976 function wrap(value, wrapper) { 29977 return partial(castFunction(wrapper), value); 29978 } 29979 29980 /*------------------------------------------------------------------------*/ 29981 29982 /** 29983 * Casts `value` as an array if it's not one. 29984 * 29985 * @static 29986 * @memberOf _ 29987 * @since 4.4.0 29988 * @category Lang 29989 * @param {*} value The value to inspect. 29990 * @returns {Array} Returns the cast array. 29991 * @example 29992 * 29993 * _.castArray(1); 29994 * // => [1] 29995 * 29996 * _.castArray({ 'a': 1 }); 29997 * // => [{ 'a': 1 }] 29998 * 29999 * _.castArray('abc'); 30000 * // => ['abc'] 30001 * 30002 * _.castArray(null); 30003 * // => [null] 30004 * 30005 * _.castArray(undefined); 30006 * // => [undefined] 30007 * 30008 * _.castArray(); 30009 * // => [] 30010 * 30011 * var array = [1, 2, 3]; 30012 * console.log(_.castArray(array) === array); 30013 * // => true 30014 */ 30015 function castArray() { 30016 if (!arguments.length) { 30017 return []; 30018 } 30019 var value = arguments[0]; 30020 return isArray(value) ? value : [value]; 30021 } 30022 30023 /** 30024 * Creates a shallow clone of `value`. 30025 * 30026 * **Note:** This method is loosely based on the 30027 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 30028 * and supports cloning arrays, array buffers, booleans, date objects, maps, 30029 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 30030 * arrays. The own enumerable properties of `arguments` objects are cloned 30031 * as plain objects. An empty object is returned for uncloneable values such 30032 * as error objects, functions, DOM nodes, and WeakMaps. 30033 * 30034 * @static 30035 * @memberOf _ 30036 * @since 0.1.0 30037 * @category Lang 30038 * @param {*} value The value to clone. 30039 * @returns {*} Returns the cloned value. 30040 * @see _.cloneDeep 30041 * @example 30042 * 30043 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 30044 * 30045 * var shallow = _.clone(objects); 30046 * console.log(shallow[0] === objects[0]); 30047 * // => true 30048 */ 30049 function clone(value) { 30050 return baseClone(value, CLONE_SYMBOLS_FLAG); 30051 } 30052 30053 /** 30054 * This method is like `_.clone` except that it accepts `customizer` which 30055 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 30056 * cloning is handled by the method instead. The `customizer` is invoked with 30057 * up to four arguments; (value [, index|key, object, stack]). 30058 * 30059 * @static 30060 * @memberOf _ 30061 * @since 4.0.0 30062 * @category Lang 30063 * @param {*} value The value to clone. 30064 * @param {Function} [customizer] The function to customize cloning. 30065 * @returns {*} Returns the cloned value. 30066 * @see _.cloneDeepWith 30067 * @example 30068 * 30069 * function customizer(value) { 30070 * if (_.isElement(value)) { 30071 * return value.cloneNode(false); 30072 * } 30073 * } 30074 * 30075 * var el = _.cloneWith(document.body, customizer); 30076 * 30077 * console.log(el === document.body); 30078 * // => false 30079 * console.log(el.nodeName); 30080 * // => 'BODY' 30081 * console.log(el.childNodes.length); 30082 * // => 0 30083 */ 30084 function cloneWith(value, customizer) { 30085 customizer = typeof customizer == 'function' ? customizer : undefined; 30086 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 30087 } 30088 30089 /** 30090 * This method is like `_.clone` except that it recursively clones `value`. 30091 * 30092 * @static 30093 * @memberOf _ 30094 * @since 1.0.0 30095 * @category Lang 30096 * @param {*} value The value to recursively clone. 30097 * @returns {*} Returns the deep cloned value. 30098 * @see _.clone 30099 * @example 30100 * 30101 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 30102 * 30103 * var deep = _.cloneDeep(objects); 30104 * console.log(deep[0] === objects[0]); 30105 * // => false 30106 */ 30107 function cloneDeep(value) { 30108 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 30109 } 30110 30111 /** 30112 * This method is like `_.cloneWith` except that it recursively clones `value`. 30113 * 30114 * @static 30115 * @memberOf _ 30116 * @since 4.0.0 30117 * @category Lang 30118 * @param {*} value The value to recursively clone. 30119 * @param {Function} [customizer] The function to customize cloning. 30120 * @returns {*} Returns the deep cloned value. 30121 * @see _.cloneWith 30122 * @example 30123 * 30124 * function customizer(value) { 30125 * if (_.isElement(value)) { 30126 * return value.cloneNode(true); 30127 * } 30128 * } 30129 * 30130 * var el = _.cloneDeepWith(document.body, customizer); 30131 * 30132 * console.log(el === document.body); 30133 * // => false 30134 * console.log(el.nodeName); 30135 * // => 'BODY' 30136 * console.log(el.childNodes.length); 30137 * // => 20 30138 */ 30139 function cloneDeepWith(value, customizer) { 30140 customizer = typeof customizer == 'function' ? customizer : undefined; 30141 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 30142 } 30143 30144 /** 30145 * Checks if `object` conforms to `source` by invoking the predicate 30146 * properties of `source` with the corresponding property values of `object`. 30147 * 30148 * **Note:** This method is equivalent to `_.conforms` when `source` is 30149 * partially applied. 30150 * 30151 * @static 30152 * @memberOf _ 30153 * @since 4.14.0 30154 * @category Lang 30155 * @param {Object} object The object to inspect. 30156 * @param {Object} source The object of property predicates to conform to. 30157 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 30158 * @example 30159 * 30160 * var object = { 'a': 1, 'b': 2 }; 30161 * 30162 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 30163 * // => true 30164 * 30165 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 30166 * // => false 30167 */ 30168 function conformsTo(object, source) { 30169 return source == null || baseConformsTo(object, source, keys(source)); 30170 } 30171 30172 /** 30173 * Performs a 30174 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 30175 * comparison between two values to determine if they are equivalent. 30176 * 30177 * @static 30178 * @memberOf _ 30179 * @since 4.0.0 30180 * @category Lang 30181 * @param {*} value The value to compare. 30182 * @param {*} other The other value to compare. 30183 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 30184 * @example 30185 * 30186 * var object = { 'a': 1 }; 30187 * var other = { 'a': 1 }; 30188 * 30189 * _.eq(object, object); 30190 * // => true 30191 * 30192 * _.eq(object, other); 30193 * // => false 30194 * 30195 * _.eq('a', 'a'); 30196 * // => true 30197 * 30198 * _.eq('a', Object('a')); 30199 * // => false 30200 * 30201 * _.eq(NaN, NaN); 30202 * // => true 30203 */ 30204 function eq(value, other) { 30205 return value === other || (value !== value && other !== other); 30206 } 30207 30208 /** 30209 * Checks if `value` is greater than `other`. 30210 * 30211 * @static 30212 * @memberOf _ 30213 * @since 3.9.0 30214 * @category Lang 30215 * @param {*} value The value to compare. 30216 * @param {*} other The other value to compare. 30217 * @returns {boolean} Returns `true` if `value` is greater than `other`, 30218 * else `false`. 30219 * @see _.lt 30220 * @example 30221 * 30222 * _.gt(3, 1); 30223 * // => true 30224 * 30225 * _.gt(3, 3); 30226 * // => false 30227 * 30228 * _.gt(1, 3); 30229 * // => false 30230 */ 30231 var gt = createRelationalOperation(baseGt); 30232 30233 /** 30234 * Checks if `value` is greater than or equal to `other`. 30235 * 30236 * @static 30237 * @memberOf _ 30238 * @since 3.9.0 30239 * @category Lang 30240 * @param {*} value The value to compare. 30241 * @param {*} other The other value to compare. 30242 * @returns {boolean} Returns `true` if `value` is greater than or equal to 30243 * `other`, else `false`. 30244 * @see _.lte 30245 * @example 30246 * 30247 * _.gte(3, 1); 30248 * // => true 30249 * 30250 * _.gte(3, 3); 30251 * // => true 30252 * 30253 * _.gte(1, 3); 30254 * // => false 30255 */ 30256 var gte = createRelationalOperation(function(value, other) { 30257 return value >= other; 30258 }); 30259 30260 /** 30261 * Checks if `value` is likely an `arguments` object. 30262 * 30263 * @static 30264 * @memberOf _ 30265 * @since 0.1.0 30266 * @category Lang 30267 * @param {*} value The value to check. 30268 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 30269 * else `false`. 30270 * @example 30271 * 30272 * _.isArguments(function() { return arguments; }()); 30273 * // => true 30274 * 30275 * _.isArguments([1, 2, 3]); 30276 * // => false 30277 */ 30278 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 30279 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 30280 !propertyIsEnumerable.call(value, 'callee'); 30281 }; 30282 30283 /** 30284 * Checks if `value` is classified as an `Array` object. 30285 * 30286 * @static 30287 * @memberOf _ 30288 * @since 0.1.0 30289 * @category Lang 30290 * @param {*} value The value to check. 30291 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 30292 * @example 30293 * 30294 * _.isArray([1, 2, 3]); 30295 * // => true 30296 * 30297 * _.isArray(document.body.children); 30298 * // => false 30299 * 30300 * _.isArray('abc'); 30301 * // => false 30302 * 30303 * _.isArray(_.noop); 30304 * // => false 30305 */ 30306 var isArray = Array.isArray; 30307 30308 /** 30309 * Checks if `value` is classified as an `ArrayBuffer` object. 30310 * 30311 * @static 30312 * @memberOf _ 30313 * @since 4.3.0 30314 * @category Lang 30315 * @param {*} value The value to check. 30316 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 30317 * @example 30318 * 30319 * _.isArrayBuffer(new ArrayBuffer(2)); 30320 * // => true 30321 * 30322 * _.isArrayBuffer(new Array(2)); 30323 * // => false 30324 */ 30325 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 30326 30327 /** 30328 * Checks if `value` is array-like. A value is considered array-like if it's 30329 * not a function and has a `value.length` that's an integer greater than or 30330 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 30331 * 30332 * @static 30333 * @memberOf _ 30334 * @since 4.0.0 30335 * @category Lang 30336 * @param {*} value The value to check. 30337 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 30338 * @example 30339 * 30340 * _.isArrayLike([1, 2, 3]); 30341 * // => true 30342 * 30343 * _.isArrayLike(document.body.children); 30344 * // => true 30345 * 30346 * _.isArrayLike('abc'); 30347 * // => true 30348 * 30349 * _.isArrayLike(_.noop); 30350 * // => false 30351 */ 30352 function isArrayLike(value) { 30353 return value != null && isLength(value.length) && !isFunction(value); 30354 } 30355 30356 /** 30357 * This method is like `_.isArrayLike` except that it also checks if `value` 30358 * is an object. 30359 * 30360 * @static 30361 * @memberOf _ 30362 * @since 4.0.0 30363 * @category Lang 30364 * @param {*} value The value to check. 30365 * @returns {boolean} Returns `true` if `value` is an array-like object, 30366 * else `false`. 30367 * @example 30368 * 30369 * _.isArrayLikeObject([1, 2, 3]); 30370 * // => true 30371 * 30372 * _.isArrayLikeObject(document.body.children); 30373 * // => true 30374 * 30375 * _.isArrayLikeObject('abc'); 30376 * // => false 30377 * 30378 * _.isArrayLikeObject(_.noop); 30379 * // => false 30380 */ 30381 function isArrayLikeObject(value) { 30382 return isObjectLike(value) && isArrayLike(value); 30383 } 30384 30385 /** 30386 * Checks if `value` is classified as a boolean primitive or object. 30387 * 30388 * @static 30389 * @memberOf _ 30390 * @since 0.1.0 30391 * @category Lang 30392 * @param {*} value The value to check. 30393 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 30394 * @example 30395 * 30396 * _.isBoolean(false); 30397 * // => true 30398 * 30399 * _.isBoolean(null); 30400 * // => false 30401 */ 30402 function isBoolean(value) { 30403 return value === true || value === false || 30404 (isObjectLike(value) && baseGetTag(value) == boolTag); 30405 } 30406 30407 /** 30408 * Checks if `value` is a buffer. 30409 * 30410 * @static 30411 * @memberOf _ 30412 * @since 4.3.0 30413 * @category Lang 30414 * @param {*} value The value to check. 30415 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 30416 * @example 30417 * 30418 * _.isBuffer(new Buffer(2)); 30419 * // => true 30420 * 30421 * _.isBuffer(new Uint8Array(2)); 30422 * // => false 30423 */ 30424 var isBuffer = nativeIsBuffer || stubFalse; 30425 30426 /** 30427 * Checks if `value` is classified as a `Date` object. 30428 * 30429 * @static 30430 * @memberOf _ 30431 * @since 0.1.0 30432 * @category Lang 30433 * @param {*} value The value to check. 30434 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 30435 * @example 30436 * 30437 * _.isDate(new Date); 30438 * // => true 30439 * 30440 * _.isDate('Mon April 23 2012'); 30441 * // => false 30442 */ 30443 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 30444 30445 /** 30446 * Checks if `value` is likely a DOM element. 30447 * 30448 * @static 30449 * @memberOf _ 30450 * @since 0.1.0 30451 * @category Lang 30452 * @param {*} value The value to check. 30453 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 30454 * @example 30455 * 30456 * _.isElement(document.body); 30457 * // => true 30458 * 30459 * _.isElement('<body>'); 30460 * // => false 30461 */ 30462 function isElement(value) { 30463 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 30464 } 30465 30466 /** 30467 * Checks if `value` is an empty object, collection, map, or set. 30468 * 30469 * Objects are considered empty if they have no own enumerable string keyed 30470 * properties. 30471 * 30472 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 30473 * jQuery-like collections are considered empty if they have a `length` of `0`. 30474 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 30475 * 30476 * @static 30477 * @memberOf _ 30478 * @since 0.1.0 30479 * @category Lang 30480 * @param {*} value The value to check. 30481 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 30482 * @example 30483 * 30484 * _.isEmpty(null); 30485 * // => true 30486 * 30487 * _.isEmpty(true); 30488 * // => true 30489 * 30490 * _.isEmpty(1); 30491 * // => true 30492 * 30493 * _.isEmpty([1, 2, 3]); 30494 * // => false 30495 * 30496 * _.isEmpty({ 'a': 1 }); 30497 * // => false 30498 */ 30499 function isEmpty(value) { 30500 if (value == null) { 30501 return true; 30502 } 30503 if (isArrayLike(value) && 30504 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 30505 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 30506 return !value.length; 30507 } 30508 var tag = getTag(value); 30509 if (tag == mapTag || tag == setTag) { 30510 return !value.size; 30511 } 30512 if (isPrototype(value)) { 30513 return !baseKeys(value).length; 30514 } 30515 for (var key in value) { 30516 if (hasOwnProperty.call(value, key)) { 30517 return false; 30518 } 30519 } 30520 return true; 30521 } 30522 30523 /** 30524 * Performs a deep comparison between two values to determine if they are 30525 * equivalent. 30526 * 30527 * **Note:** This method supports comparing arrays, array buffers, booleans, 30528 * date objects, error objects, maps, numbers, `Object` objects, regexes, 30529 * sets, strings, symbols, and typed arrays. `Object` objects are compared 30530 * by their own, not inherited, enumerable properties. Functions and DOM 30531 * nodes are compared by strict equality, i.e. `===`. 30532 * 30533 * @static 30534 * @memberOf _ 30535 * @since 0.1.0 30536 * @category Lang 30537 * @param {*} value The value to compare. 30538 * @param {*} other The other value to compare. 30539 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 30540 * @example 30541 * 30542 * var object = { 'a': 1 }; 30543 * var other = { 'a': 1 }; 30544 * 30545 * _.isEqual(object, other); 30546 * // => true 30547 * 30548 * object === other; 30549 * // => false 30550 */ 30551 function isEqual(value, other) { 30552 return baseIsEqual(value, other); 30553 } 30554 30555 /** 30556 * This method is like `_.isEqual` except that it accepts `customizer` which 30557 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 30558 * are handled by the method instead. The `customizer` is invoked with up to 30559 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 30560 * 30561 * @static 30562 * @memberOf _ 30563 * @since 4.0.0 30564 * @category Lang 30565 * @param {*} value The value to compare. 30566 * @param {*} other The other value to compare. 30567 * @param {Function} [customizer] The function to customize comparisons. 30568 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 30569 * @example 30570 * 30571 * function isGreeting(value) { 30572 * return /^h(?:i|ello)$/.test(value); 30573 * } 30574 * 30575 * function customizer(objValue, othValue) { 30576 * if (isGreeting(objValue) && isGreeting(othValue)) { 30577 * return true; 30578 * } 30579 * } 30580 * 30581 * var array = ['hello', 'goodbye']; 30582 * var other = ['hi', 'goodbye']; 30583 * 30584 * _.isEqualWith(array, other, customizer); 30585 * // => true 30586 */ 30587 function isEqualWith(value, other, customizer) { 30588 customizer = typeof customizer == 'function' ? customizer : undefined; 30589 var result = customizer ? customizer(value, other) : undefined; 30590 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 30591 } 30592 30593 /** 30594 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 30595 * `SyntaxError`, `TypeError`, or `URIError` object. 30596 * 30597 * @static 30598 * @memberOf _ 30599 * @since 3.0.0 30600 * @category Lang 30601 * @param {*} value The value to check. 30602 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 30603 * @example 30604 * 30605 * _.isError(new Error); 30606 * // => true 30607 * 30608 * _.isError(Error); 30609 * // => false 30610 */ 30611 function isError(value) { 30612 if (!isObjectLike(value)) { 30613 return false; 30614 } 30615 var tag = baseGetTag(value); 30616 return tag == errorTag || tag == domExcTag || 30617 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 30618 } 30619 30620 /** 30621 * Checks if `value` is a finite primitive number. 30622 * 30623 * **Note:** This method is based on 30624 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 30625 * 30626 * @static 30627 * @memberOf _ 30628 * @since 0.1.0 30629 * @category Lang 30630 * @param {*} value The value to check. 30631 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 30632 * @example 30633 * 30634 * _.isFinite(3); 30635 * // => true 30636 * 30637 * _.isFinite(Number.MIN_VALUE); 30638 * // => true 30639 * 30640 * _.isFinite(Infinity); 30641 * // => false 30642 * 30643 * _.isFinite('3'); 30644 * // => false 30645 */ 30646 function isFinite(value) { 30647 return typeof value == 'number' && nativeIsFinite(value); 30648 } 30649 30650 /** 30651 * Checks if `value` is classified as a `Function` object. 30652 * 30653 * @static 30654 * @memberOf _ 30655 * @since 0.1.0 30656 * @category Lang 30657 * @param {*} value The value to check. 30658 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 30659 * @example 30660 * 30661 * _.isFunction(_); 30662 * // => true 30663 * 30664 * _.isFunction(/abc/); 30665 * // => false 30666 */ 30667 function isFunction(value) { 30668 if (!isObject(value)) { 30669 return false; 30670 } 30671 // The use of `Object#toString` avoids issues with the `typeof` operator 30672 // in Safari 9 which returns 'object' for typed arrays and other constructors. 30673 var tag = baseGetTag(value); 30674 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 30675 } 30676 30677 /** 30678 * Checks if `value` is an integer. 30679 * 30680 * **Note:** This method is based on 30681 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 30682 * 30683 * @static 30684 * @memberOf _ 30685 * @since 4.0.0 30686 * @category Lang 30687 * @param {*} value The value to check. 30688 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 30689 * @example 30690 * 30691 * _.isInteger(3); 30692 * // => true 30693 * 30694 * _.isInteger(Number.MIN_VALUE); 30695 * // => false 30696 * 30697 * _.isInteger(Infinity); 30698 * // => false 30699 * 30700 * _.isInteger('3'); 30701 * // => false 30702 */ 30703 function isInteger(value) { 30704 return typeof value == 'number' && value == toInteger(value); 30705 } 30706 30707 /** 30708 * Checks if `value` is a valid array-like length. 30709 * 30710 * **Note:** This method is loosely based on 30711 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 30712 * 30713 * @static 30714 * @memberOf _ 30715 * @since 4.0.0 30716 * @category Lang 30717 * @param {*} value The value to check. 30718 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 30719 * @example 30720 * 30721 * _.isLength(3); 30722 * // => true 30723 * 30724 * _.isLength(Number.MIN_VALUE); 30725 * // => false 30726 * 30727 * _.isLength(Infinity); 30728 * // => false 30729 * 30730 * _.isLength('3'); 30731 * // => false 30732 */ 30733 function isLength(value) { 30734 return typeof value == 'number' && 30735 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 30736 } 30737 30738 /** 30739 * Checks if `value` is the 30740 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 30741 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 30742 * 30743 * @static 30744 * @memberOf _ 30745 * @since 0.1.0 30746 * @category Lang 30747 * @param {*} value The value to check. 30748 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 30749 * @example 30750 * 30751 * _.isObject({}); 30752 * // => true 30753 * 30754 * _.isObject([1, 2, 3]); 30755 * // => true 30756 * 30757 * _.isObject(_.noop); 30758 * // => true 30759 * 30760 * _.isObject(null); 30761 * // => false 30762 */ 30763 function isObject(value) { 30764 var type = typeof value; 30765 return value != null && (type == 'object' || type == 'function'); 30766 } 30767 30768 /** 30769 * Checks if `value` is object-like. A value is object-like if it's not `null` 30770 * and has a `typeof` result of "object". 30771 * 30772 * @static 30773 * @memberOf _ 30774 * @since 4.0.0 30775 * @category Lang 30776 * @param {*} value The value to check. 30777 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 30778 * @example 30779 * 30780 * _.isObjectLike({}); 30781 * // => true 30782 * 30783 * _.isObjectLike([1, 2, 3]); 30784 * // => true 30785 * 30786 * _.isObjectLike(_.noop); 30787 * // => false 30788 * 30789 * _.isObjectLike(null); 30790 * // => false 30791 */ 30792 function isObjectLike(value) { 30793 return value != null && typeof value == 'object'; 30794 } 30795 30796 /** 30797 * Checks if `value` is classified as a `Map` object. 30798 * 30799 * @static 30800 * @memberOf _ 30801 * @since 4.3.0 30802 * @category Lang 30803 * @param {*} value The value to check. 30804 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 30805 * @example 30806 * 30807 * _.isMap(new Map); 30808 * // => true 30809 * 30810 * _.isMap(new WeakMap); 30811 * // => false 30812 */ 30813 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 30814 30815 /** 30816 * Performs a partial deep comparison between `object` and `source` to 30817 * determine if `object` contains equivalent property values. 30818 * 30819 * **Note:** This method is equivalent to `_.matches` when `source` is 30820 * partially applied. 30821 * 30822 * Partial comparisons will match empty array and empty object `source` 30823 * values against any array or object value, respectively. See `_.isEqual` 30824 * for a list of supported value comparisons. 30825 * 30826 * @static 30827 * @memberOf _ 30828 * @since 3.0.0 30829 * @category Lang 30830 * @param {Object} object The object to inspect. 30831 * @param {Object} source The object of property values to match. 30832 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 30833 * @example 30834 * 30835 * var object = { 'a': 1, 'b': 2 }; 30836 * 30837 * _.isMatch(object, { 'b': 2 }); 30838 * // => true 30839 * 30840 * _.isMatch(object, { 'b': 1 }); 30841 * // => false 30842 */ 30843 function isMatch(object, source) { 30844 return object === source || baseIsMatch(object, source, getMatchData(source)); 30845 } 30846 30847 /** 30848 * This method is like `_.isMatch` except that it accepts `customizer` which 30849 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 30850 * are handled by the method instead. The `customizer` is invoked with five 30851 * arguments: (objValue, srcValue, index|key, object, source). 30852 * 30853 * @static 30854 * @memberOf _ 30855 * @since 4.0.0 30856 * @category Lang 30857 * @param {Object} object The object to inspect. 30858 * @param {Object} source The object of property values to match. 30859 * @param {Function} [customizer] The function to customize comparisons. 30860 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 30861 * @example 30862 * 30863 * function isGreeting(value) { 30864 * return /^h(?:i|ello)$/.test(value); 30865 * } 30866 * 30867 * function customizer(objValue, srcValue) { 30868 * if (isGreeting(objValue) && isGreeting(srcValue)) { 30869 * return true; 30870 * } 30871 * } 30872 * 30873 * var object = { 'greeting': 'hello' }; 30874 * var source = { 'greeting': 'hi' }; 30875 * 30876 * _.isMatchWith(object, source, customizer); 30877 * // => true 30878 */ 30879 function isMatchWith(object, source, customizer) { 30880 customizer = typeof customizer == 'function' ? customizer : undefined; 30881 return baseIsMatch(object, source, getMatchData(source), customizer); 30882 } 30883 30884 /** 30885 * Checks if `value` is `NaN`. 30886 * 30887 * **Note:** This method is based on 30888 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 30889 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 30890 * `undefined` and other non-number values. 30891 * 30892 * @static 30893 * @memberOf _ 30894 * @since 0.1.0 30895 * @category Lang 30896 * @param {*} value The value to check. 30897 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 30898 * @example 30899 * 30900 * _.isNaN(NaN); 30901 * // => true 30902 * 30903 * _.isNaN(new Number(NaN)); 30904 * // => true 30905 * 30906 * isNaN(undefined); 30907 * // => true 30908 * 30909 * _.isNaN(undefined); 30910 * // => false 30911 */ 30912 function isNaN(value) { 30913 // An `NaN` primitive is the only value that is not equal to itself. 30914 // Perform the `toStringTag` check first to avoid errors with some 30915 // ActiveX objects in IE. 30916 return isNumber(value) && value != +value; 30917 } 30918 30919 /** 30920 * Checks if `value` is a pristine native function. 30921 * 30922 * **Note:** This method can't reliably detect native functions in the presence 30923 * of the core-js package because core-js circumvents this kind of detection. 30924 * Despite multiple requests, the core-js maintainer has made it clear: any 30925 * attempt to fix the detection will be obstructed. As a result, we're left 30926 * with little choice but to throw an error. Unfortunately, this also affects 30927 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 30928 * which rely on core-js. 30929 * 30930 * @static 30931 * @memberOf _ 30932 * @since 3.0.0 30933 * @category Lang 30934 * @param {*} value The value to check. 30935 * @returns {boolean} Returns `true` if `value` is a native function, 30936 * else `false`. 30937 * @example 30938 * 30939 * _.isNative(Array.prototype.push); 30940 * // => true 30941 * 30942 * _.isNative(_); 30943 * // => false 30944 */ 30945 function isNative(value) { 30946 if (isMaskable(value)) { 30947 throw new Error(CORE_ERROR_TEXT); 30948 } 30949 return baseIsNative(value); 30950 } 30951 30952 /** 30953 * Checks if `value` is `null`. 30954 * 30955 * @static 30956 * @memberOf _ 30957 * @since 0.1.0 30958 * @category Lang 30959 * @param {*} value The value to check. 30960 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 30961 * @example 30962 * 30963 * _.isNull(null); 30964 * // => true 30965 * 30966 * _.isNull(void 0); 30967 * // => false 30968 */ 30969 function isNull(value) { 30970 return value === null; 30971 } 30972 30973 /** 30974 * Checks if `value` is `null` or `undefined`. 30975 * 30976 * @static 30977 * @memberOf _ 30978 * @since 4.0.0 30979 * @category Lang 30980 * @param {*} value The value to check. 30981 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 30982 * @example 30983 * 30984 * _.isNil(null); 30985 * // => true 30986 * 30987 * _.isNil(void 0); 30988 * // => true 30989 * 30990 * _.isNil(NaN); 30991 * // => false 30992 */ 30993 function isNil(value) { 30994 return value == null; 30995 } 30996 30997 /** 30998 * Checks if `value` is classified as a `Number` primitive or object. 30999 * 31000 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 31001 * classified as numbers, use the `_.isFinite` method. 31002 * 31003 * @static 31004 * @memberOf _ 31005 * @since 0.1.0 31006 * @category Lang 31007 * @param {*} value The value to check. 31008 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 31009 * @example 31010 * 31011 * _.isNumber(3); 31012 * // => true 31013 * 31014 * _.isNumber(Number.MIN_VALUE); 31015 * // => true 31016 * 31017 * _.isNumber(Infinity); 31018 * // => true 31019 * 31020 * _.isNumber('3'); 31021 * // => false 31022 */ 31023 function isNumber(value) { 31024 return typeof value == 'number' || 31025 (isObjectLike(value) && baseGetTag(value) == numberTag); 31026 } 31027 31028 /** 31029 * Checks if `value` is a plain object, that is, an object created by the 31030 * `Object` constructor or one with a `[[Prototype]]` of `null`. 31031 * 31032 * @static 31033 * @memberOf _ 31034 * @since 0.8.0 31035 * @category Lang 31036 * @param {*} value The value to check. 31037 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 31038 * @example 31039 * 31040 * function Foo() { 31041 * this.a = 1; 31042 * } 31043 * 31044 * _.isPlainObject(new Foo); 31045 * // => false 31046 * 31047 * _.isPlainObject([1, 2, 3]); 31048 * // => false 31049 * 31050 * _.isPlainObject({ 'x': 0, 'y': 0 }); 31051 * // => true 31052 * 31053 * _.isPlainObject(Object.create(null)); 31054 * // => true 31055 */ 31056 function isPlainObject(value) { 31057 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 31058 return false; 31059 } 31060 var proto = getPrototype(value); 31061 if (proto === null) { 31062 return true; 31063 } 31064 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 31065 return typeof Ctor == 'function' && Ctor instanceof Ctor && 31066 funcToString.call(Ctor) == objectCtorString; 31067 } 31068 31069 /** 31070 * Checks if `value` is classified as a `RegExp` object. 31071 * 31072 * @static 31073 * @memberOf _ 31074 * @since 0.1.0 31075 * @category Lang 31076 * @param {*} value The value to check. 31077 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 31078 * @example 31079 * 31080 * _.isRegExp(/abc/); 31081 * // => true 31082 * 31083 * _.isRegExp('/abc/'); 31084 * // => false 31085 */ 31086 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 31087 31088 /** 31089 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 31090 * double precision number which isn't the result of a rounded unsafe integer. 31091 * 31092 * **Note:** This method is based on 31093 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 31094 * 31095 * @static 31096 * @memberOf _ 31097 * @since 4.0.0 31098 * @category Lang 31099 * @param {*} value The value to check. 31100 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 31101 * @example 31102 * 31103 * _.isSafeInteger(3); 31104 * // => true 31105 * 31106 * _.isSafeInteger(Number.MIN_VALUE); 31107 * // => false 31108 * 31109 * _.isSafeInteger(Infinity); 31110 * // => false 31111 * 31112 * _.isSafeInteger('3'); 31113 * // => false 31114 */ 31115 function isSafeInteger(value) { 31116 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 31117 } 31118 31119 /** 31120 * Checks if `value` is classified as a `Set` object. 31121 * 31122 * @static 31123 * @memberOf _ 31124 * @since 4.3.0 31125 * @category Lang 31126 * @param {*} value The value to check. 31127 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 31128 * @example 31129 * 31130 * _.isSet(new Set); 31131 * // => true 31132 * 31133 * _.isSet(new WeakSet); 31134 * // => false 31135 */ 31136 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 31137 31138 /** 31139 * Checks if `value` is classified as a `String` primitive or object. 31140 * 31141 * @static 31142 * @since 0.1.0 31143 * @memberOf _ 31144 * @category Lang 31145 * @param {*} value The value to check. 31146 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 31147 * @example 31148 * 31149 * _.isString('abc'); 31150 * // => true 31151 * 31152 * _.isString(1); 31153 * // => false 31154 */ 31155 function isString(value) { 31156 return typeof value == 'string' || 31157 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 31158 } 31159 31160 /** 31161 * Checks if `value` is classified as a `Symbol` primitive or object. 31162 * 31163 * @static 31164 * @memberOf _ 31165 * @since 4.0.0 31166 * @category Lang 31167 * @param {*} value The value to check. 31168 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 31169 * @example 31170 * 31171 * _.isSymbol(Symbol.iterator); 31172 * // => true 31173 * 31174 * _.isSymbol('abc'); 31175 * // => false 31176 */ 31177 function isSymbol(value) { 31178 return typeof value == 'symbol' || 31179 (isObjectLike(value) && baseGetTag(value) == symbolTag); 31180 } 31181 31182 /** 31183 * Checks if `value` is classified as a typed array. 31184 * 31185 * @static 31186 * @memberOf _ 31187 * @since 3.0.0 31188 * @category Lang 31189 * @param {*} value The value to check. 31190 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 31191 * @example 31192 * 31193 * _.isTypedArray(new Uint8Array); 31194 * // => true 31195 * 31196 * _.isTypedArray([]); 31197 * // => false 31198 */ 31199 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 31200 31201 /** 31202 * Checks if `value` is `undefined`. 31203 * 31204 * @static 31205 * @since 0.1.0 31206 * @memberOf _ 31207 * @category Lang 31208 * @param {*} value The value to check. 31209 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 31210 * @example 31211 * 31212 * _.isUndefined(void 0); 31213 * // => true 31214 * 31215 * _.isUndefined(null); 31216 * // => false 31217 */ 31218 function isUndefined(value) { 31219 return value === undefined; 31220 } 31221 31222 /** 31223 * Checks if `value` is classified as a `WeakMap` object. 31224 * 31225 * @static 31226 * @memberOf _ 31227 * @since 4.3.0 31228 * @category Lang 31229 * @param {*} value The value to check. 31230 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 31231 * @example 31232 * 31233 * _.isWeakMap(new WeakMap); 31234 * // => true 31235 * 31236 * _.isWeakMap(new Map); 31237 * // => false 31238 */ 31239 function isWeakMap(value) { 31240 return isObjectLike(value) && getTag(value) == weakMapTag; 31241 } 31242 31243 /** 31244 * Checks if `value` is classified as a `WeakSet` object. 31245 * 31246 * @static 31247 * @memberOf _ 31248 * @since 4.3.0 31249 * @category Lang 31250 * @param {*} value The value to check. 31251 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 31252 * @example 31253 * 31254 * _.isWeakSet(new WeakSet); 31255 * // => true 31256 * 31257 * _.isWeakSet(new Set); 31258 * // => false 31259 */ 31260 function isWeakSet(value) { 31261 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 31262 } 31263 31264 /** 31265 * Checks if `value` is less than `other`. 31266 * 31267 * @static 31268 * @memberOf _ 31269 * @since 3.9.0 31270 * @category Lang 31271 * @param {*} value The value to compare. 31272 * @param {*} other The other value to compare. 31273 * @returns {boolean} Returns `true` if `value` is less than `other`, 31274 * else `false`. 31275 * @see _.gt 31276 * @example 31277 * 31278 * _.lt(1, 3); 31279 * // => true 31280 * 31281 * _.lt(3, 3); 31282 * // => false 31283 * 31284 * _.lt(3, 1); 31285 * // => false 31286 */ 31287 var lt = createRelationalOperation(baseLt); 31288 31289 /** 31290 * Checks if `value` is less than or equal to `other`. 31291 * 31292 * @static 31293 * @memberOf _ 31294 * @since 3.9.0 31295 * @category Lang 31296 * @param {*} value The value to compare. 31297 * @param {*} other The other value to compare. 31298 * @returns {boolean} Returns `true` if `value` is less than or equal to 31299 * `other`, else `false`. 31300 * @see _.gte 31301 * @example 31302 * 31303 * _.lte(1, 3); 31304 * // => true 31305 * 31306 * _.lte(3, 3); 31307 * // => true 31308 * 31309 * _.lte(3, 1); 31310 * // => false 31311 */ 31312 var lte = createRelationalOperation(function(value, other) { 31313 return value <= other; 31314 }); 31315 31316 /** 31317 * Converts `value` to an array. 31318 * 31319 * @static 31320 * @since 0.1.0 31321 * @memberOf _ 31322 * @category Lang 31323 * @param {*} value The value to convert. 31324 * @returns {Array} Returns the converted array. 31325 * @example 31326 * 31327 * _.toArray({ 'a': 1, 'b': 2 }); 31328 * // => [1, 2] 31329 * 31330 * _.toArray('abc'); 31331 * // => ['a', 'b', 'c'] 31332 * 31333 * _.toArray(1); 31334 * // => [] 31335 * 31336 * _.toArray(null); 31337 * // => [] 31338 */ 31339 function toArray(value) { 31340 if (!value) { 31341 return []; 31342 } 31343 if (isArrayLike(value)) { 31344 return isString(value) ? stringToArray(value) : copyArray(value); 31345 } 31346 if (symIterator && value[symIterator]) { 31347 return iteratorToArray(value[symIterator]()); 31348 } 31349 var tag = getTag(value), 31350 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 31351 31352 return func(value); 31353 } 31354 31355 /** 31356 * Converts `value` to a finite number. 31357 * 31358 * @static 31359 * @memberOf _ 31360 * @since 4.12.0 31361 * @category Lang 31362 * @param {*} value The value to convert. 31363 * @returns {number} Returns the converted number. 31364 * @example 31365 * 31366 * _.toFinite(3.2); 31367 * // => 3.2 31368 * 31369 * _.toFinite(Number.MIN_VALUE); 31370 * // => 5e-324 31371 * 31372 * _.toFinite(Infinity); 31373 * // => 1.7976931348623157e+308 31374 * 31375 * _.toFinite('3.2'); 31376 * // => 3.2 31377 */ 31378 function toFinite(value) { 31379 if (!value) { 31380 return value === 0 ? value : 0; 31381 } 31382 value = toNumber(value); 31383 if (value === INFINITY || value === -INFINITY) { 31384 var sign = (value < 0 ? -1 : 1); 31385 return sign * MAX_INTEGER; 31386 } 31387 return value === value ? value : 0; 31388 } 31389 31390 /** 31391 * Converts `value` to an integer. 31392 * 31393 * **Note:** This method is loosely based on 31394 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 31395 * 31396 * @static 31397 * @memberOf _ 31398 * @since 4.0.0 31399 * @category Lang 31400 * @param {*} value The value to convert. 31401 * @returns {number} Returns the converted integer. 31402 * @example 31403 * 31404 * _.toInteger(3.2); 31405 * // => 3 31406 * 31407 * _.toInteger(Number.MIN_VALUE); 31408 * // => 0 31409 * 31410 * _.toInteger(Infinity); 31411 * // => 1.7976931348623157e+308 31412 * 31413 * _.toInteger('3.2'); 31414 * // => 3 31415 */ 31416 function toInteger(value) { 31417 var result = toFinite(value), 31418 remainder = result % 1; 31419 31420 return result === result ? (remainder ? result - remainder : result) : 0; 31421 } 31422 31423 /** 31424 * Converts `value` to an integer suitable for use as the length of an 31425 * array-like object. 31426 * 31427 * **Note:** This method is based on 31428 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 31429 * 31430 * @static 31431 * @memberOf _ 31432 * @since 4.0.0 31433 * @category Lang 31434 * @param {*} value The value to convert. 31435 * @returns {number} Returns the converted integer. 31436 * @example 31437 * 31438 * _.toLength(3.2); 31439 * // => 3 31440 * 31441 * _.toLength(Number.MIN_VALUE); 31442 * // => 0 31443 * 31444 * _.toLength(Infinity); 31445 * // => 4294967295 31446 * 31447 * _.toLength('3.2'); 31448 * // => 3 31449 */ 31450 function toLength(value) { 31451 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 31452 } 31453 31454 /** 31455 * Converts `value` to a number. 31456 * 31457 * @static 31458 * @memberOf _ 31459 * @since 4.0.0 31460 * @category Lang 31461 * @param {*} value The value to process. 31462 * @returns {number} Returns the number. 31463 * @example 31464 * 31465 * _.toNumber(3.2); 31466 * // => 3.2 31467 * 31468 * _.toNumber(Number.MIN_VALUE); 31469 * // => 5e-324 31470 * 31471 * _.toNumber(Infinity); 31472 * // => Infinity 31473 * 31474 * _.toNumber('3.2'); 31475 * // => 3.2 31476 */ 31477 function toNumber(value) { 31478 if (typeof value == 'number') { 31479 return value; 31480 } 31481 if (isSymbol(value)) { 31482 return NAN; 31483 } 31484 if (isObject(value)) { 31485 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 31486 value = isObject(other) ? (other + '') : other; 31487 } 31488 if (typeof value != 'string') { 31489 return value === 0 ? value : +value; 31490 } 31491 value = value.replace(reTrim, ''); 31492 var isBinary = reIsBinary.test(value); 31493 return (isBinary || reIsOctal.test(value)) 31494 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 31495 : (reIsBadHex.test(value) ? NAN : +value); 31496 } 31497 31498 /** 31499 * Converts `value` to a plain object flattening inherited enumerable string 31500 * keyed properties of `value` to own properties of the plain object. 31501 * 31502 * @static 31503 * @memberOf _ 31504 * @since 3.0.0 31505 * @category Lang 31506 * @param {*} value The value to convert. 31507 * @returns {Object} Returns the converted plain object. 31508 * @example 31509 * 31510 * function Foo() { 31511 * this.b = 2; 31512 * } 31513 * 31514 * Foo.prototype.c = 3; 31515 * 31516 * _.assign({ 'a': 1 }, new Foo); 31517 * // => { 'a': 1, 'b': 2 } 31518 * 31519 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 31520 * // => { 'a': 1, 'b': 2, 'c': 3 } 31521 */ 31522 function toPlainObject(value) { 31523 return copyObject(value, keysIn(value)); 31524 } 31525 31526 /** 31527 * Converts `value` to a safe integer. A safe integer can be compared and 31528 * represented correctly. 31529 * 31530 * @static 31531 * @memberOf _ 31532 * @since 4.0.0 31533 * @category Lang 31534 * @param {*} value The value to convert. 31535 * @returns {number} Returns the converted integer. 31536 * @example 31537 * 31538 * _.toSafeInteger(3.2); 31539 * // => 3 31540 * 31541 * _.toSafeInteger(Number.MIN_VALUE); 31542 * // => 0 31543 * 31544 * _.toSafeInteger(Infinity); 31545 * // => 9007199254740991 31546 * 31547 * _.toSafeInteger('3.2'); 31548 * // => 3 31549 */ 31550 function toSafeInteger(value) { 31551 return value 31552 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 31553 : (value === 0 ? value : 0); 31554 } 31555 31556 /** 31557 * Converts `value` to a string. An empty string is returned for `null` 31558 * and `undefined` values. The sign of `-0` is preserved. 31559 * 31560 * @static 31561 * @memberOf _ 31562 * @since 4.0.0 31563 * @category Lang 31564 * @param {*} value The value to convert. 31565 * @returns {string} Returns the converted string. 31566 * @example 31567 * 31568 * _.toString(null); 31569 * // => '' 31570 * 31571 * _.toString(-0); 31572 * // => '-0' 31573 * 31574 * _.toString([1, 2, 3]); 31575 * // => '1,2,3' 31576 */ 31577 function toString(value) { 31578 return value == null ? '' : baseToString(value); 31579 } 31580 31581 /*------------------------------------------------------------------------*/ 31582 31583 /** 31584 * Assigns own enumerable string keyed properties of source objects to the 31585 * destination object. Source objects are applied from left to right. 31586 * Subsequent sources overwrite property assignments of previous sources. 31587 * 31588 * **Note:** This method mutates `object` and is loosely based on 31589 * [`Object.assign`](https://mdn.io/Object/assign). 31590 * 31591 * @static 31592 * @memberOf _ 31593 * @since 0.10.0 31594 * @category Object 31595 * @param {Object} object The destination object. 31596 * @param {...Object} [sources] The source objects. 31597 * @returns {Object} Returns `object`. 31598 * @see _.assignIn 31599 * @example 31600 * 31601 * function Foo() { 31602 * this.a = 1; 31603 * } 31604 * 31605 * function Bar() { 31606 * this.c = 3; 31607 * } 31608 * 31609 * Foo.prototype.b = 2; 31610 * Bar.prototype.d = 4; 31611 * 31612 * _.assign({ 'a': 0 }, new Foo, new Bar); 31613 * // => { 'a': 1, 'c': 3 } 31614 */ 31615 var assign = createAssigner(function(object, source) { 31616 if (isPrototype(source) || isArrayLike(source)) { 31617 copyObject(source, keys(source), object); 31618 return; 31619 } 31620 for (var key in source) { 31621 if (hasOwnProperty.call(source, key)) { 31622 assignValue(object, key, source[key]); 31623 } 31624 } 31625 }); 31626 31627 /** 31628 * This method is like `_.assign` except that it iterates over own and 31629 * inherited source properties. 31630 * 31631 * **Note:** This method mutates `object`. 31632 * 31633 * @static 31634 * @memberOf _ 31635 * @since 4.0.0 31636 * @alias extend 31637 * @category Object 31638 * @param {Object} object The destination object. 31639 * @param {...Object} [sources] The source objects. 31640 * @returns {Object} Returns `object`. 31641 * @see _.assign 31642 * @example 31643 * 31644 * function Foo() { 31645 * this.a = 1; 31646 * } 31647 * 31648 * function Bar() { 31649 * this.c = 3; 31650 * } 31651 * 31652 * Foo.prototype.b = 2; 31653 * Bar.prototype.d = 4; 31654 * 31655 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 31656 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 31657 */ 31658 var assignIn = createAssigner(function(object, source) { 31659 copyObject(source, keysIn(source), object); 31660 }); 31661 31662 /** 31663 * This method is like `_.assignIn` except that it accepts `customizer` 31664 * which is invoked to produce the assigned values. If `customizer` returns 31665 * `undefined`, assignment is handled by the method instead. The `customizer` 31666 * is invoked with five arguments: (objValue, srcValue, key, object, source). 31667 * 31668 * **Note:** This method mutates `object`. 31669 * 31670 * @static 31671 * @memberOf _ 31672 * @since 4.0.0 31673 * @alias extendWith 31674 * @category Object 31675 * @param {Object} object The destination object. 31676 * @param {...Object} sources The source objects. 31677 * @param {Function} [customizer] The function to customize assigned values. 31678 * @returns {Object} Returns `object`. 31679 * @see _.assignWith 31680 * @example 31681 * 31682 * function customizer(objValue, srcValue) { 31683 * return _.isUndefined(objValue) ? srcValue : objValue; 31684 * } 31685 * 31686 * var defaults = _.partialRight(_.assignInWith, customizer); 31687 * 31688 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 31689 * // => { 'a': 1, 'b': 2 } 31690 */ 31691 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 31692 copyObject(source, keysIn(source), object, customizer); 31693 }); 31694 31695 /** 31696 * This method is like `_.assign` except that it accepts `customizer` 31697 * which is invoked to produce the assigned values. If `customizer` returns 31698 * `undefined`, assignment is handled by the method instead. The `customizer` 31699 * is invoked with five arguments: (objValue, srcValue, key, object, source). 31700 * 31701 * **Note:** This method mutates `object`. 31702 * 31703 * @static 31704 * @memberOf _ 31705 * @since 4.0.0 31706 * @category Object 31707 * @param {Object} object The destination object. 31708 * @param {...Object} sources The source objects. 31709 * @param {Function} [customizer] The function to customize assigned values. 31710 * @returns {Object} Returns `object`. 31711 * @see _.assignInWith 31712 * @example 31713 * 31714 * function customizer(objValue, srcValue) { 31715 * return _.isUndefined(objValue) ? srcValue : objValue; 31716 * } 31717 * 31718 * var defaults = _.partialRight(_.assignWith, customizer); 31719 * 31720 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 31721 * // => { 'a': 1, 'b': 2 } 31722 */ 31723 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 31724 copyObject(source, keys(source), object, customizer); 31725 }); 31726 31727 /** 31728 * Creates an array of values corresponding to `paths` of `object`. 31729 * 31730 * @static 31731 * @memberOf _ 31732 * @since 1.0.0 31733 * @category Object 31734 * @param {Object} object The object to iterate over. 31735 * @param {...(string|string[])} [paths] The property paths to pick. 31736 * @returns {Array} Returns the picked values. 31737 * @example 31738 * 31739 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 31740 * 31741 * _.at(object, ['a[0].b.c', 'a[1]']); 31742 * // => [3, 4] 31743 */ 31744 var at = flatRest(baseAt); 31745 31746 /** 31747 * Creates an object that inherits from the `prototype` object. If a 31748 * `properties` object is given, its own enumerable string keyed properties 31749 * are assigned to the created object. 31750 * 31751 * @static 31752 * @memberOf _ 31753 * @since 2.3.0 31754 * @category Object 31755 * @param {Object} prototype The object to inherit from. 31756 * @param {Object} [properties] The properties to assign to the object. 31757 * @returns {Object} Returns the new object. 31758 * @example 31759 * 31760 * function Shape() { 31761 * this.x = 0; 31762 * this.y = 0; 31763 * } 31764 * 31765 * function Circle() { 31766 * Shape.call(this); 31767 * } 31768 * 31769 * Circle.prototype = _.create(Shape.prototype, { 31770 * 'constructor': Circle 31771 * }); 31772 * 31773 * var circle = new Circle; 31774 * circle instanceof Circle; 31775 * // => true 31776 * 31777 * circle instanceof Shape; 31778 * // => true 31779 */ 31780 function create(prototype, properties) { 31781 var result = baseCreate(prototype); 31782 return properties == null ? result : baseAssign(result, properties); 31783 } 31784 31785 /** 31786 * Assigns own and inherited enumerable string keyed properties of source 31787 * objects to the destination object for all destination properties that 31788 * resolve to `undefined`. Source objects are applied from left to right. 31789 * Once a property is set, additional values of the same property are ignored. 31790 * 31791 * **Note:** This method mutates `object`. 31792 * 31793 * @static 31794 * @since 0.1.0 31795 * @memberOf _ 31796 * @category Object 31797 * @param {Object} object The destination object. 31798 * @param {...Object} [sources] The source objects. 31799 * @returns {Object} Returns `object`. 31800 * @see _.defaultsDeep 31801 * @example 31802 * 31803 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 31804 * // => { 'a': 1, 'b': 2 } 31805 */ 31806 var defaults = baseRest(function(object, sources) { 31807 object = Object(object); 31808 31809 var index = -1; 31810 var length = sources.length; 31811 var guard = length > 2 ? sources[2] : undefined; 31812 31813 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 31814 length = 1; 31815 } 31816 31817 while (++index < length) { 31818 var source = sources[index]; 31819 var props = keysIn(source); 31820 var propsIndex = -1; 31821 var propsLength = props.length; 31822 31823 while (++propsIndex < propsLength) { 31824 var key = props[propsIndex]; 31825 var value = object[key]; 31826 31827 if (value === undefined || 31828 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 31829 object[key] = source[key]; 31830 } 31831 } 31832 } 31833 31834 return object; 31835 }); 31836 31837 /** 31838 * This method is like `_.defaults` except that it recursively assigns 31839 * default properties. 31840 * 31841 * **Note:** This method mutates `object`. 31842 * 31843 * @static 31844 * @memberOf _ 31845 * @since 3.10.0 31846 * @category Object 31847 * @param {Object} object The destination object. 31848 * @param {...Object} [sources] The source objects. 31849 * @returns {Object} Returns `object`. 31850 * @see _.defaults 31851 * @example 31852 * 31853 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 31854 * // => { 'a': { 'b': 2, 'c': 3 } } 31855 */ 31856 var defaultsDeep = baseRest(function(args) { 31857 args.push(undefined, customDefaultsMerge); 31858 return apply(mergeWith, undefined, args); 31859 }); 31860 31861 /** 31862 * This method is like `_.find` except that it returns the key of the first 31863 * element `predicate` returns truthy for instead of the element itself. 31864 * 31865 * @static 31866 * @memberOf _ 31867 * @since 1.1.0 31868 * @category Object 31869 * @param {Object} object The object to inspect. 31870 * @param {Function} [predicate=_.identity] The function invoked per iteration. 31871 * @returns {string|undefined} Returns the key of the matched element, 31872 * else `undefined`. 31873 * @example 31874 * 31875 * var users = { 31876 * 'barney': { 'age': 36, 'active': true }, 31877 * 'fred': { 'age': 40, 'active': false }, 31878 * 'pebbles': { 'age': 1, 'active': true } 31879 * }; 31880 * 31881 * _.findKey(users, function(o) { return o.age < 40; }); 31882 * // => 'barney' (iteration order is not guaranteed) 31883 * 31884 * // The `_.matches` iteratee shorthand. 31885 * _.findKey(users, { 'age': 1, 'active': true }); 31886 * // => 'pebbles' 31887 * 31888 * // The `_.matchesProperty` iteratee shorthand. 31889 * _.findKey(users, ['active', false]); 31890 * // => 'fred' 31891 * 31892 * // The `_.property` iteratee shorthand. 31893 * _.findKey(users, 'active'); 31894 * // => 'barney' 31895 */ 31896 function findKey(object, predicate) { 31897 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 31898 } 31899 31900 /** 31901 * This method is like `_.findKey` except that it iterates over elements of 31902 * a collection in the opposite order. 31903 * 31904 * @static 31905 * @memberOf _ 31906 * @since 2.0.0 31907 * @category Object 31908 * @param {Object} object The object to inspect. 31909 * @param {Function} [predicate=_.identity] The function invoked per iteration. 31910 * @returns {string|undefined} Returns the key of the matched element, 31911 * else `undefined`. 31912 * @example 31913 * 31914 * var users = { 31915 * 'barney': { 'age': 36, 'active': true }, 31916 * 'fred': { 'age': 40, 'active': false }, 31917 * 'pebbles': { 'age': 1, 'active': true } 31918 * }; 31919 * 31920 * _.findLastKey(users, function(o) { return o.age < 40; }); 31921 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 31922 * 31923 * // The `_.matches` iteratee shorthand. 31924 * _.findLastKey(users, { 'age': 36, 'active': true }); 31925 * // => 'barney' 31926 * 31927 * // The `_.matchesProperty` iteratee shorthand. 31928 * _.findLastKey(users, ['active', false]); 31929 * // => 'fred' 31930 * 31931 * // The `_.property` iteratee shorthand. 31932 * _.findLastKey(users, 'active'); 31933 * // => 'pebbles' 31934 */ 31935 function findLastKey(object, predicate) { 31936 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 31937 } 31938 31939 /** 31940 * Iterates over own and inherited enumerable string keyed properties of an 31941 * object and invokes `iteratee` for each property. The iteratee is invoked 31942 * with three arguments: (value, key, object). Iteratee functions may exit 31943 * iteration early by explicitly returning `false`. 31944 * 31945 * @static 31946 * @memberOf _ 31947 * @since 0.3.0 31948 * @category Object 31949 * @param {Object} object The object to iterate over. 31950 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 31951 * @returns {Object} Returns `object`. 31952 * @see _.forInRight 31953 * @example 31954 * 31955 * function Foo() { 31956 * this.a = 1; 31957 * this.b = 2; 31958 * } 31959 * 31960 * Foo.prototype.c = 3; 31961 * 31962 * _.forIn(new Foo, function(value, key) { 31963 * console.log(key); 31964 * }); 31965 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 31966 */ 31967 function forIn(object, iteratee) { 31968 return object == null 31969 ? object 31970 : baseFor(object, getIteratee(iteratee, 3), keysIn); 31971 } 31972 31973 /** 31974 * This method is like `_.forIn` except that it iterates over properties of 31975 * `object` in the opposite order. 31976 * 31977 * @static 31978 * @memberOf _ 31979 * @since 2.0.0 31980 * @category Object 31981 * @param {Object} object The object to iterate over. 31982 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 31983 * @returns {Object} Returns `object`. 31984 * @see _.forIn 31985 * @example 31986 * 31987 * function Foo() { 31988 * this.a = 1; 31989 * this.b = 2; 31990 * } 31991 * 31992 * Foo.prototype.c = 3; 31993 * 31994 * _.forInRight(new Foo, function(value, key) { 31995 * console.log(key); 31996 * }); 31997 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 31998 */ 31999 function forInRight(object, iteratee) { 32000 return object == null 32001 ? object 32002 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 32003 } 32004 32005 /** 32006 * Iterates over own enumerable string keyed properties of an object and 32007 * invokes `iteratee` for each property. The iteratee is invoked with three 32008 * arguments: (value, key, object). Iteratee functions may exit iteration 32009 * early by explicitly returning `false`. 32010 * 32011 * @static 32012 * @memberOf _ 32013 * @since 0.3.0 32014 * @category Object 32015 * @param {Object} object The object to iterate over. 32016 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32017 * @returns {Object} Returns `object`. 32018 * @see _.forOwnRight 32019 * @example 32020 * 32021 * function Foo() { 32022 * this.a = 1; 32023 * this.b = 2; 32024 * } 32025 * 32026 * Foo.prototype.c = 3; 32027 * 32028 * _.forOwn(new Foo, function(value, key) { 32029 * console.log(key); 32030 * }); 32031 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 32032 */ 32033 function forOwn(object, iteratee) { 32034 return object && baseForOwn(object, getIteratee(iteratee, 3)); 32035 } 32036 32037 /** 32038 * This method is like `_.forOwn` except that it iterates over properties of 32039 * `object` in the opposite order. 32040 * 32041 * @static 32042 * @memberOf _ 32043 * @since 2.0.0 32044 * @category Object 32045 * @param {Object} object The object to iterate over. 32046 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32047 * @returns {Object} Returns `object`. 32048 * @see _.forOwn 32049 * @example 32050 * 32051 * function Foo() { 32052 * this.a = 1; 32053 * this.b = 2; 32054 * } 32055 * 32056 * Foo.prototype.c = 3; 32057 * 32058 * _.forOwnRight(new Foo, function(value, key) { 32059 * console.log(key); 32060 * }); 32061 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 32062 */ 32063 function forOwnRight(object, iteratee) { 32064 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 32065 } 32066 32067 /** 32068 * Creates an array of function property names from own enumerable properties 32069 * of `object`. 32070 * 32071 * @static 32072 * @since 0.1.0 32073 * @memberOf _ 32074 * @category Object 32075 * @param {Object} object The object to inspect. 32076 * @returns {Array} Returns the function names. 32077 * @see _.functionsIn 32078 * @example 32079 * 32080 * function Foo() { 32081 * this.a = _.constant('a'); 32082 * this.b = _.constant('b'); 32083 * } 32084 * 32085 * Foo.prototype.c = _.constant('c'); 32086 * 32087 * _.functions(new Foo); 32088 * // => ['a', 'b'] 32089 */ 32090 function functions(object) { 32091 return object == null ? [] : baseFunctions(object, keys(object)); 32092 } 32093 32094 /** 32095 * Creates an array of function property names from own and inherited 32096 * enumerable properties of `object`. 32097 * 32098 * @static 32099 * @memberOf _ 32100 * @since 4.0.0 32101 * @category Object 32102 * @param {Object} object The object to inspect. 32103 * @returns {Array} Returns the function names. 32104 * @see _.functions 32105 * @example 32106 * 32107 * function Foo() { 32108 * this.a = _.constant('a'); 32109 * this.b = _.constant('b'); 32110 * } 32111 * 32112 * Foo.prototype.c = _.constant('c'); 32113 * 32114 * _.functionsIn(new Foo); 32115 * // => ['a', 'b', 'c'] 32116 */ 32117 function functionsIn(object) { 32118 return object == null ? [] : baseFunctions(object, keysIn(object)); 32119 } 32120 32121 /** 32122 * Gets the value at `path` of `object`. If the resolved value is 32123 * `undefined`, the `defaultValue` is returned in its place. 32124 * 32125 * @static 32126 * @memberOf _ 32127 * @since 3.7.0 32128 * @category Object 32129 * @param {Object} object The object to query. 32130 * @param {Array|string} path The path of the property to get. 32131 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 32132 * @returns {*} Returns the resolved value. 32133 * @example 32134 * 32135 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 32136 * 32137 * _.get(object, 'a[0].b.c'); 32138 * // => 3 32139 * 32140 * _.get(object, ['a', '0', 'b', 'c']); 32141 * // => 3 32142 * 32143 * _.get(object, 'a.b.c', 'default'); 32144 * // => 'default' 32145 */ 32146 function get(object, path, defaultValue) { 32147 var result = object == null ? undefined : baseGet(object, path); 32148 return result === undefined ? defaultValue : result; 32149 } 32150 32151 /** 32152 * Checks if `path` is a direct property of `object`. 32153 * 32154 * @static 32155 * @since 0.1.0 32156 * @memberOf _ 32157 * @category Object 32158 * @param {Object} object The object to query. 32159 * @param {Array|string} path The path to check. 32160 * @returns {boolean} Returns `true` if `path` exists, else `false`. 32161 * @example 32162 * 32163 * var object = { 'a': { 'b': 2 } }; 32164 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 32165 * 32166 * _.has(object, 'a'); 32167 * // => true 32168 * 32169 * _.has(object, 'a.b'); 32170 * // => true 32171 * 32172 * _.has(object, ['a', 'b']); 32173 * // => true 32174 * 32175 * _.has(other, 'a'); 32176 * // => false 32177 */ 32178 function has(object, path) { 32179 return object != null && hasPath(object, path, baseHas); 32180 } 32181 32182 /** 32183 * Checks if `path` is a direct or inherited property of `object`. 32184 * 32185 * @static 32186 * @memberOf _ 32187 * @since 4.0.0 32188 * @category Object 32189 * @param {Object} object The object to query. 32190 * @param {Array|string} path The path to check. 32191 * @returns {boolean} Returns `true` if `path` exists, else `false`. 32192 * @example 32193 * 32194 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 32195 * 32196 * _.hasIn(object, 'a'); 32197 * // => true 32198 * 32199 * _.hasIn(object, 'a.b'); 32200 * // => true 32201 * 32202 * _.hasIn(object, ['a', 'b']); 32203 * // => true 32204 * 32205 * _.hasIn(object, 'b'); 32206 * // => false 32207 */ 32208 function hasIn(object, path) { 32209 return object != null && hasPath(object, path, baseHasIn); 32210 } 32211 32212 /** 32213 * Creates an object composed of the inverted keys and values of `object`. 32214 * If `object` contains duplicate values, subsequent values overwrite 32215 * property assignments of previous values. 32216 * 32217 * @static 32218 * @memberOf _ 32219 * @since 0.7.0 32220 * @category Object 32221 * @param {Object} object The object to invert. 32222 * @returns {Object} Returns the new inverted object. 32223 * @example 32224 * 32225 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 32226 * 32227 * _.invert(object); 32228 * // => { '1': 'c', '2': 'b' } 32229 */ 32230 var invert = createInverter(function(result, value, key) { 32231 if (value != null && 32232 typeof value.toString != 'function') { 32233 value = nativeObjectToString.call(value); 32234 } 32235 32236 result[value] = key; 32237 }, constant(identity)); 32238 32239 /** 32240 * This method is like `_.invert` except that the inverted object is generated 32241 * from the results of running each element of `object` thru `iteratee`. The 32242 * corresponding inverted value of each inverted key is an array of keys 32243 * responsible for generating the inverted value. The iteratee is invoked 32244 * with one argument: (value). 32245 * 32246 * @static 32247 * @memberOf _ 32248 * @since 4.1.0 32249 * @category Object 32250 * @param {Object} object The object to invert. 32251 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 32252 * @returns {Object} Returns the new inverted object. 32253 * @example 32254 * 32255 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 32256 * 32257 * _.invertBy(object); 32258 * // => { '1': ['a', 'c'], '2': ['b'] } 32259 * 32260 * _.invertBy(object, function(value) { 32261 * return 'group' + value; 32262 * }); 32263 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 32264 */ 32265 var invertBy = createInverter(function(result, value, key) { 32266 if (value != null && 32267 typeof value.toString != 'function') { 32268 value = nativeObjectToString.call(value); 32269 } 32270 32271 if (hasOwnProperty.call(result, value)) { 32272 result[value].push(key); 32273 } else { 32274 result[value] = [key]; 32275 } 32276 }, getIteratee); 32277 32278 /** 32279 * Invokes the method at `path` of `object`. 32280 * 32281 * @static 32282 * @memberOf _ 32283 * @since 4.0.0 32284 * @category Object 32285 * @param {Object} object The object to query. 32286 * @param {Array|string} path The path of the method to invoke. 32287 * @param {...*} [args] The arguments to invoke the method with. 32288 * @returns {*} Returns the result of the invoked method. 32289 * @example 32290 * 32291 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 32292 * 32293 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 32294 * // => [2, 3] 32295 */ 32296 var invoke = baseRest(baseInvoke); 32297 32298 /** 32299 * Creates an array of the own enumerable property names of `object`. 32300 * 32301 * **Note:** Non-object values are coerced to objects. See the 32302 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 32303 * for more details. 32304 * 32305 * @static 32306 * @since 0.1.0 32307 * @memberOf _ 32308 * @category Object 32309 * @param {Object} object The object to query. 32310 * @returns {Array} Returns the array of property names. 32311 * @example 32312 * 32313 * function Foo() { 32314 * this.a = 1; 32315 * this.b = 2; 32316 * } 32317 * 32318 * Foo.prototype.c = 3; 32319 * 32320 * _.keys(new Foo); 32321 * // => ['a', 'b'] (iteration order is not guaranteed) 32322 * 32323 * _.keys('hi'); 32324 * // => ['0', '1'] 32325 */ 32326 function keys(object) { 32327 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 32328 } 32329 32330 /** 32331 * Creates an array of the own and inherited enumerable property names of `object`. 32332 * 32333 * **Note:** Non-object values are coerced to objects. 32334 * 32335 * @static 32336 * @memberOf _ 32337 * @since 3.0.0 32338 * @category Object 32339 * @param {Object} object The object to query. 32340 * @returns {Array} Returns the array of property names. 32341 * @example 32342 * 32343 * function Foo() { 32344 * this.a = 1; 32345 * this.b = 2; 32346 * } 32347 * 32348 * Foo.prototype.c = 3; 32349 * 32350 * _.keysIn(new Foo); 32351 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 32352 */ 32353 function keysIn(object) { 32354 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 32355 } 32356 32357 /** 32358 * The opposite of `_.mapValues`; this method creates an object with the 32359 * same values as `object` and keys generated by running each own enumerable 32360 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 32361 * with three arguments: (value, key, object). 32362 * 32363 * @static 32364 * @memberOf _ 32365 * @since 3.8.0 32366 * @category Object 32367 * @param {Object} object The object to iterate over. 32368 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32369 * @returns {Object} Returns the new mapped object. 32370 * @see _.mapValues 32371 * @example 32372 * 32373 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 32374 * return key + value; 32375 * }); 32376 * // => { 'a1': 1, 'b2': 2 } 32377 */ 32378 function mapKeys(object, iteratee) { 32379 var result = {}; 32380 iteratee = getIteratee(iteratee, 3); 32381 32382 baseForOwn(object, function(value, key, object) { 32383 baseAssignValue(result, iteratee(value, key, object), value); 32384 }); 32385 return result; 32386 } 32387 32388 /** 32389 * Creates an object with the same keys as `object` and values generated 32390 * by running each own enumerable string keyed property of `object` thru 32391 * `iteratee`. The iteratee is invoked with three arguments: 32392 * (value, key, object). 32393 * 32394 * @static 32395 * @memberOf _ 32396 * @since 2.4.0 32397 * @category Object 32398 * @param {Object} object The object to iterate over. 32399 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32400 * @returns {Object} Returns the new mapped object. 32401 * @see _.mapKeys 32402 * @example 32403 * 32404 * var users = { 32405 * 'fred': { 'user': 'fred', 'age': 40 }, 32406 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 32407 * }; 32408 * 32409 * _.mapValues(users, function(o) { return o.age; }); 32410 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 32411 * 32412 * // The `_.property` iteratee shorthand. 32413 * _.mapValues(users, 'age'); 32414 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 32415 */ 32416 function mapValues(object, iteratee) { 32417 var result = {}; 32418 iteratee = getIteratee(iteratee, 3); 32419 32420 baseForOwn(object, function(value, key, object) { 32421 baseAssignValue(result, key, iteratee(value, key, object)); 32422 }); 32423 return result; 32424 } 32425 32426 /** 32427 * This method is like `_.assign` except that it recursively merges own and 32428 * inherited enumerable string keyed properties of source objects into the 32429 * destination object. Source properties that resolve to `undefined` are 32430 * skipped if a destination value exists. Array and plain object properties 32431 * are merged recursively. Other objects and value types are overridden by 32432 * assignment. Source objects are applied from left to right. Subsequent 32433 * sources overwrite property assignments of previous sources. 32434 * 32435 * **Note:** This method mutates `object`. 32436 * 32437 * @static 32438 * @memberOf _ 32439 * @since 0.5.0 32440 * @category Object 32441 * @param {Object} object The destination object. 32442 * @param {...Object} [sources] The source objects. 32443 * @returns {Object} Returns `object`. 32444 * @example 32445 * 32446 * var object = { 32447 * 'a': [{ 'b': 2 }, { 'd': 4 }] 32448 * }; 32449 * 32450 * var other = { 32451 * 'a': [{ 'c': 3 }, { 'e': 5 }] 32452 * }; 32453 * 32454 * _.merge(object, other); 32455 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 32456 */ 32457 var merge = createAssigner(function(object, source, srcIndex) { 32458 baseMerge(object, source, srcIndex); 32459 }); 32460 32461 /** 32462 * This method is like `_.merge` except that it accepts `customizer` which 32463 * is invoked to produce the merged values of the destination and source 32464 * properties. If `customizer` returns `undefined`, merging is handled by the 32465 * method instead. The `customizer` is invoked with six arguments: 32466 * (objValue, srcValue, key, object, source, stack). 32467 * 32468 * **Note:** This method mutates `object`. 32469 * 32470 * @static 32471 * @memberOf _ 32472 * @since 4.0.0 32473 * @category Object 32474 * @param {Object} object The destination object. 32475 * @param {...Object} sources The source objects. 32476 * @param {Function} customizer The function to customize assigned values. 32477 * @returns {Object} Returns `object`. 32478 * @example 32479 * 32480 * function customizer(objValue, srcValue) { 32481 * if (_.isArray(objValue)) { 32482 * return objValue.concat(srcValue); 32483 * } 32484 * } 32485 * 32486 * var object = { 'a': [1], 'b': [2] }; 32487 * var other = { 'a': [3], 'b': [4] }; 32488 * 32489 * _.mergeWith(object, other, customizer); 32490 * // => { 'a': [1, 3], 'b': [2, 4] } 32491 */ 32492 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 32493 baseMerge(object, source, srcIndex, customizer); 32494 }); 32495 32496 /** 32497 * The opposite of `_.pick`; this method creates an object composed of the 32498 * own and inherited enumerable property paths of `object` that are not omitted. 32499 * 32500 * **Note:** This method is considerably slower than `_.pick`. 32501 * 32502 * @static 32503 * @since 0.1.0 32504 * @memberOf _ 32505 * @category Object 32506 * @param {Object} object The source object. 32507 * @param {...(string|string[])} [paths] The property paths to omit. 32508 * @returns {Object} Returns the new object. 32509 * @example 32510 * 32511 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 32512 * 32513 * _.omit(object, ['a', 'c']); 32514 * // => { 'b': '2' } 32515 */ 32516 var omit = flatRest(function(object, paths) { 32517 var result = {}; 32518 if (object == null) { 32519 return result; 32520 } 32521 var isDeep = false; 32522 paths = arrayMap(paths, function(path) { 32523 path = castPath(path, object); 32524 isDeep || (isDeep = path.length > 1); 32525 return path; 32526 }); 32527 copyObject(object, getAllKeysIn(object), result); 32528 if (isDeep) { 32529 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 32530 } 32531 var length = paths.length; 32532 while (length--) { 32533 baseUnset(result, paths[length]); 32534 } 32535 return result; 32536 }); 32537 32538 /** 32539 * The opposite of `_.pickBy`; this method creates an object composed of 32540 * the own and inherited enumerable string keyed properties of `object` that 32541 * `predicate` doesn't return truthy for. The predicate is invoked with two 32542 * arguments: (value, key). 32543 * 32544 * @static 32545 * @memberOf _ 32546 * @since 4.0.0 32547 * @category Object 32548 * @param {Object} object The source object. 32549 * @param {Function} [predicate=_.identity] The function invoked per property. 32550 * @returns {Object} Returns the new object. 32551 * @example 32552 * 32553 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 32554 * 32555 * _.omitBy(object, _.isNumber); 32556 * // => { 'b': '2' } 32557 */ 32558 function omitBy(object, predicate) { 32559 return pickBy(object, negate(getIteratee(predicate))); 32560 } 32561 32562 /** 32563 * Creates an object composed of the picked `object` properties. 32564 * 32565 * @static 32566 * @since 0.1.0 32567 * @memberOf _ 32568 * @category Object 32569 * @param {Object} object The source object. 32570 * @param {...(string|string[])} [paths] The property paths to pick. 32571 * @returns {Object} Returns the new object. 32572 * @example 32573 * 32574 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 32575 * 32576 * _.pick(object, ['a', 'c']); 32577 * // => { 'a': 1, 'c': 3 } 32578 */ 32579 var pick = flatRest(function(object, paths) { 32580 return object == null ? {} : basePick(object, paths); 32581 }); 32582 32583 /** 32584 * Creates an object composed of the `object` properties `predicate` returns 32585 * truthy for. The predicate is invoked with two arguments: (value, key). 32586 * 32587 * @static 32588 * @memberOf _ 32589 * @since 4.0.0 32590 * @category Object 32591 * @param {Object} object The source object. 32592 * @param {Function} [predicate=_.identity] The function invoked per property. 32593 * @returns {Object} Returns the new object. 32594 * @example 32595 * 32596 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 32597 * 32598 * _.pickBy(object, _.isNumber); 32599 * // => { 'a': 1, 'c': 3 } 32600 */ 32601 function pickBy(object, predicate) { 32602 if (object == null) { 32603 return {}; 32604 } 32605 var props = arrayMap(getAllKeysIn(object), function(prop) { 32606 return [prop]; 32607 }); 32608 predicate = getIteratee(predicate); 32609 return basePickBy(object, props, function(value, path) { 32610 return predicate(value, path[0]); 32611 }); 32612 } 32613 32614 /** 32615 * This method is like `_.get` except that if the resolved value is a 32616 * function it's invoked with the `this` binding of its parent object and 32617 * its result is returned. 32618 * 32619 * @static 32620 * @since 0.1.0 32621 * @memberOf _ 32622 * @category Object 32623 * @param {Object} object The object to query. 32624 * @param {Array|string} path The path of the property to resolve. 32625 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 32626 * @returns {*} Returns the resolved value. 32627 * @example 32628 * 32629 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 32630 * 32631 * _.result(object, 'a[0].b.c1'); 32632 * // => 3 32633 * 32634 * _.result(object, 'a[0].b.c2'); 32635 * // => 4 32636 * 32637 * _.result(object, 'a[0].b.c3', 'default'); 32638 * // => 'default' 32639 * 32640 * _.result(object, 'a[0].b.c3', _.constant('default')); 32641 * // => 'default' 32642 */ 32643 function result(object, path, defaultValue) { 32644 path = castPath(path, object); 32645 32646 var index = -1, 32647 length = path.length; 32648 32649 // Ensure the loop is entered when path is empty. 32650 if (!length) { 32651 length = 1; 32652 object = undefined; 32653 } 32654 while (++index < length) { 32655 var value = object == null ? undefined : object[toKey(path[index])]; 32656 if (value === undefined) { 32657 index = length; 32658 value = defaultValue; 32659 } 32660 object = isFunction(value) ? value.call(object) : value; 32661 } 32662 return object; 32663 } 32664 32665 /** 32666 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 32667 * it's created. Arrays are created for missing index properties while objects 32668 * are created for all other missing properties. Use `_.setWith` to customize 32669 * `path` creation. 32670 * 32671 * **Note:** This method mutates `object`. 32672 * 32673 * @static 32674 * @memberOf _ 32675 * @since 3.7.0 32676 * @category Object 32677 * @param {Object} object The object to modify. 32678 * @param {Array|string} path The path of the property to set. 32679 * @param {*} value The value to set. 32680 * @returns {Object} Returns `object`. 32681 * @example 32682 * 32683 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 32684 * 32685 * _.set(object, 'a[0].b.c', 4); 32686 * console.log(object.a[0].b.c); 32687 * // => 4 32688 * 32689 * _.set(object, ['x', '0', 'y', 'z'], 5); 32690 * console.log(object.x[0].y.z); 32691 * // => 5 32692 */ 32693 function set(object, path, value) { 32694 return object == null ? object : baseSet(object, path, value); 32695 } 32696 32697 /** 32698 * This method is like `_.set` except that it accepts `customizer` which is 32699 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 32700 * path creation is handled by the method instead. The `customizer` is invoked 32701 * with three arguments: (nsValue, key, nsObject). 32702 * 32703 * **Note:** This method mutates `object`. 32704 * 32705 * @static 32706 * @memberOf _ 32707 * @since 4.0.0 32708 * @category Object 32709 * @param {Object} object The object to modify. 32710 * @param {Array|string} path The path of the property to set. 32711 * @param {*} value The value to set. 32712 * @param {Function} [customizer] The function to customize assigned values. 32713 * @returns {Object} Returns `object`. 32714 * @example 32715 * 32716 * var object = {}; 32717 * 32718 * _.setWith(object, '[0][1]', 'a', Object); 32719 * // => { '0': { '1': 'a' } } 32720 */ 32721 function setWith(object, path, value, customizer) { 32722 customizer = typeof customizer == 'function' ? customizer : undefined; 32723 return object == null ? object : baseSet(object, path, value, customizer); 32724 } 32725 32726 /** 32727 * Creates an array of own enumerable string keyed-value pairs for `object` 32728 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 32729 * entries are returned. 32730 * 32731 * @static 32732 * @memberOf _ 32733 * @since 4.0.0 32734 * @alias entries 32735 * @category Object 32736 * @param {Object} object The object to query. 32737 * @returns {Array} Returns the key-value pairs. 32738 * @example 32739 * 32740 * function Foo() { 32741 * this.a = 1; 32742 * this.b = 2; 32743 * } 32744 * 32745 * Foo.prototype.c = 3; 32746 * 32747 * _.toPairs(new Foo); 32748 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 32749 */ 32750 var toPairs = createToPairs(keys); 32751 32752 /** 32753 * Creates an array of own and inherited enumerable string keyed-value pairs 32754 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 32755 * or set, its entries are returned. 32756 * 32757 * @static 32758 * @memberOf _ 32759 * @since 4.0.0 32760 * @alias entriesIn 32761 * @category Object 32762 * @param {Object} object The object to query. 32763 * @returns {Array} Returns the key-value pairs. 32764 * @example 32765 * 32766 * function Foo() { 32767 * this.a = 1; 32768 * this.b = 2; 32769 * } 32770 * 32771 * Foo.prototype.c = 3; 32772 * 32773 * _.toPairsIn(new Foo); 32774 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 32775 */ 32776 var toPairsIn = createToPairs(keysIn); 32777 32778 /** 32779 * An alternative to `_.reduce`; this method transforms `object` to a new 32780 * `accumulator` object which is the result of running each of its own 32781 * enumerable string keyed properties thru `iteratee`, with each invocation 32782 * potentially mutating the `accumulator` object. If `accumulator` is not 32783 * provided, a new object with the same `[[Prototype]]` will be used. The 32784 * iteratee is invoked with four arguments: (accumulator, value, key, object). 32785 * Iteratee functions may exit iteration early by explicitly returning `false`. 32786 * 32787 * @static 32788 * @memberOf _ 32789 * @since 1.3.0 32790 * @category Object 32791 * @param {Object} object The object to iterate over. 32792 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32793 * @param {*} [accumulator] The custom accumulator value. 32794 * @returns {*} Returns the accumulated value. 32795 * @example 32796 * 32797 * _.transform([2, 3, 4], function(result, n) { 32798 * result.push(n *= n); 32799 * return n % 2 == 0; 32800 * }, []); 32801 * // => [4, 9] 32802 * 32803 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 32804 * (result[value] || (result[value] = [])).push(key); 32805 * }, {}); 32806 * // => { '1': ['a', 'c'], '2': ['b'] } 32807 */ 32808 function transform(object, iteratee, accumulator) { 32809 var isArr = isArray(object), 32810 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 32811 32812 iteratee = getIteratee(iteratee, 4); 32813 if (accumulator == null) { 32814 var Ctor = object && object.constructor; 32815 if (isArrLike) { 32816 accumulator = isArr ? new Ctor : []; 32817 } 32818 else if (isObject(object)) { 32819 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 32820 } 32821 else { 32822 accumulator = {}; 32823 } 32824 } 32825 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 32826 return iteratee(accumulator, value, index, object); 32827 }); 32828 return accumulator; 32829 } 32830 32831 /** 32832 * Removes the property at `path` of `object`. 32833 * 32834 * **Note:** This method mutates `object`. 32835 * 32836 * @static 32837 * @memberOf _ 32838 * @since 4.0.0 32839 * @category Object 32840 * @param {Object} object The object to modify. 32841 * @param {Array|string} path The path of the property to unset. 32842 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 32843 * @example 32844 * 32845 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 32846 * _.unset(object, 'a[0].b.c'); 32847 * // => true 32848 * 32849 * console.log(object); 32850 * // => { 'a': [{ 'b': {} }] }; 32851 * 32852 * _.unset(object, ['a', '0', 'b', 'c']); 32853 * // => true 32854 * 32855 * console.log(object); 32856 * // => { 'a': [{ 'b': {} }] }; 32857 */ 32858 function unset(object, path) { 32859 return object == null ? true : baseUnset(object, path); 32860 } 32861 32862 /** 32863 * This method is like `_.set` except that accepts `updater` to produce the 32864 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 32865 * is invoked with one argument: (value). 32866 * 32867 * **Note:** This method mutates `object`. 32868 * 32869 * @static 32870 * @memberOf _ 32871 * @since 4.6.0 32872 * @category Object 32873 * @param {Object} object The object to modify. 32874 * @param {Array|string} path The path of the property to set. 32875 * @param {Function} updater The function to produce the updated value. 32876 * @returns {Object} Returns `object`. 32877 * @example 32878 * 32879 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 32880 * 32881 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 32882 * console.log(object.a[0].b.c); 32883 * // => 9 32884 * 32885 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 32886 * console.log(object.x[0].y.z); 32887 * // => 0 32888 */ 32889 function update(object, path, updater) { 32890 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 32891 } 32892 32893 /** 32894 * This method is like `_.update` except that it accepts `customizer` which is 32895 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 32896 * path creation is handled by the method instead. The `customizer` is invoked 32897 * with three arguments: (nsValue, key, nsObject). 32898 * 32899 * **Note:** This method mutates `object`. 32900 * 32901 * @static 32902 * @memberOf _ 32903 * @since 4.6.0 32904 * @category Object 32905 * @param {Object} object The object to modify. 32906 * @param {Array|string} path The path of the property to set. 32907 * @param {Function} updater The function to produce the updated value. 32908 * @param {Function} [customizer] The function to customize assigned values. 32909 * @returns {Object} Returns `object`. 32910 * @example 32911 * 32912 * var object = {}; 32913 * 32914 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 32915 * // => { '0': { '1': 'a' } } 32916 */ 32917 function updateWith(object, path, updater, customizer) { 32918 customizer = typeof customizer == 'function' ? customizer : undefined; 32919 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 32920 } 32921 32922 /** 32923 * Creates an array of the own enumerable string keyed property values of `object`. 32924 * 32925 * **Note:** Non-object values are coerced to objects. 32926 * 32927 * @static 32928 * @since 0.1.0 32929 * @memberOf _ 32930 * @category Object 32931 * @param {Object} object The object to query. 32932 * @returns {Array} Returns the array of property values. 32933 * @example 32934 * 32935 * function Foo() { 32936 * this.a = 1; 32937 * this.b = 2; 32938 * } 32939 * 32940 * Foo.prototype.c = 3; 32941 * 32942 * _.values(new Foo); 32943 * // => [1, 2] (iteration order is not guaranteed) 32944 * 32945 * _.values('hi'); 32946 * // => ['h', 'i'] 32947 */ 32948 function values(object) { 32949 return object == null ? [] : baseValues(object, keys(object)); 32950 } 32951 32952 /** 32953 * Creates an array of the own and inherited enumerable string keyed property 32954 * values of `object`. 32955 * 32956 * **Note:** Non-object values are coerced to objects. 32957 * 32958 * @static 32959 * @memberOf _ 32960 * @since 3.0.0 32961 * @category Object 32962 * @param {Object} object The object to query. 32963 * @returns {Array} Returns the array of property values. 32964 * @example 32965 * 32966 * function Foo() { 32967 * this.a = 1; 32968 * this.b = 2; 32969 * } 32970 * 32971 * Foo.prototype.c = 3; 32972 * 32973 * _.valuesIn(new Foo); 32974 * // => [1, 2, 3] (iteration order is not guaranteed) 32975 */ 32976 function valuesIn(object) { 32977 return object == null ? [] : baseValues(object, keysIn(object)); 32978 } 32979 32980 /*------------------------------------------------------------------------*/ 32981 32982 /** 32983 * Clamps `number` within the inclusive `lower` and `upper` bounds. 32984 * 32985 * @static 32986 * @memberOf _ 32987 * @since 4.0.0 32988 * @category Number 32989 * @param {number} number The number to clamp. 32990 * @param {number} [lower] The lower bound. 32991 * @param {number} upper The upper bound. 32992 * @returns {number} Returns the clamped number. 32993 * @example 32994 * 32995 * _.clamp(-10, -5, 5); 32996 * // => -5 32997 * 32998 * _.clamp(10, -5, 5); 32999 * // => 5 33000 */ 33001 function clamp(number, lower, upper) { 33002 if (upper === undefined) { 33003 upper = lower; 33004 lower = undefined; 33005 } 33006 if (upper !== undefined) { 33007 upper = toNumber(upper); 33008 upper = upper === upper ? upper : 0; 33009 } 33010 if (lower !== undefined) { 33011 lower = toNumber(lower); 33012 lower = lower === lower ? lower : 0; 33013 } 33014 return baseClamp(toNumber(number), lower, upper); 33015 } 33016 33017 /** 33018 * Checks if `n` is between `start` and up to, but not including, `end`. If 33019 * `end` is not specified, it's set to `start` with `start` then set to `0`. 33020 * If `start` is greater than `end` the params are swapped to support 33021 * negative ranges. 33022 * 33023 * @static 33024 * @memberOf _ 33025 * @since 3.3.0 33026 * @category Number 33027 * @param {number} number The number to check. 33028 * @param {number} [start=0] The start of the range. 33029 * @param {number} end The end of the range. 33030 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 33031 * @see _.range, _.rangeRight 33032 * @example 33033 * 33034 * _.inRange(3, 2, 4); 33035 * // => true 33036 * 33037 * _.inRange(4, 8); 33038 * // => true 33039 * 33040 * _.inRange(4, 2); 33041 * // => false 33042 * 33043 * _.inRange(2, 2); 33044 * // => false 33045 * 33046 * _.inRange(1.2, 2); 33047 * // => true 33048 * 33049 * _.inRange(5.2, 4); 33050 * // => false 33051 * 33052 * _.inRange(-3, -2, -6); 33053 * // => true 33054 */ 33055 function inRange(number, start, end) { 33056 start = toFinite(start); 33057 if (end === undefined) { 33058 end = start; 33059 start = 0; 33060 } else { 33061 end = toFinite(end); 33062 } 33063 number = toNumber(number); 33064 return baseInRange(number, start, end); 33065 } 33066 33067 /** 33068 * Produces a random number between the inclusive `lower` and `upper` bounds. 33069 * If only one argument is provided a number between `0` and the given number 33070 * is returned. If `floating` is `true`, or either `lower` or `upper` are 33071 * floats, a floating-point number is returned instead of an integer. 33072 * 33073 * **Note:** JavaScript follows the IEEE-754 standard for resolving 33074 * floating-point values which can produce unexpected results. 33075 * 33076 * @static 33077 * @memberOf _ 33078 * @since 0.7.0 33079 * @category Number 33080 * @param {number} [lower=0] The lower bound. 33081 * @param {number} [upper=1] The upper bound. 33082 * @param {boolean} [floating] Specify returning a floating-point number. 33083 * @returns {number} Returns the random number. 33084 * @example 33085 * 33086 * _.random(0, 5); 33087 * // => an integer between 0 and 5 33088 * 33089 * _.random(5); 33090 * // => also an integer between 0 and 5 33091 * 33092 * _.random(5, true); 33093 * // => a floating-point number between 0 and 5 33094 * 33095 * _.random(1.2, 5.2); 33096 * // => a floating-point number between 1.2 and 5.2 33097 */ 33098 function random(lower, upper, floating) { 33099 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 33100 upper = floating = undefined; 33101 } 33102 if (floating === undefined) { 33103 if (typeof upper == 'boolean') { 33104 floating = upper; 33105 upper = undefined; 33106 } 33107 else if (typeof lower == 'boolean') { 33108 floating = lower; 33109 lower = undefined; 33110 } 33111 } 33112 if (lower === undefined && upper === undefined) { 33113 lower = 0; 33114 upper = 1; 33115 } 33116 else { 33117 lower = toFinite(lower); 33118 if (upper === undefined) { 33119 upper = lower; 33120 lower = 0; 33121 } else { 33122 upper = toFinite(upper); 33123 } 33124 } 33125 if (lower > upper) { 33126 var temp = lower; 33127 lower = upper; 33128 upper = temp; 33129 } 33130 if (floating || lower % 1 || upper % 1) { 33131 var rand = nativeRandom(); 33132 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 33133 } 33134 return baseRandom(lower, upper); 33135 } 33136 33137 /*------------------------------------------------------------------------*/ 33138 33139 /** 33140 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 33141 * 33142 * @static 33143 * @memberOf _ 33144 * @since 3.0.0 33145 * @category String 33146 * @param {string} [string=''] The string to convert. 33147 * @returns {string} Returns the camel cased string. 33148 * @example 33149 * 33150 * _.camelCase('Foo Bar'); 33151 * // => 'fooBar' 33152 * 33153 * _.camelCase('--foo-bar--'); 33154 * // => 'fooBar' 33155 * 33156 * _.camelCase('__FOO_BAR__'); 33157 * // => 'fooBar' 33158 */ 33159 var camelCase = createCompounder(function(result, word, index) { 33160 word = word.toLowerCase(); 33161 return result + (index ? capitalize(word) : word); 33162 }); 33163 33164 /** 33165 * Converts the first character of `string` to upper case and the remaining 33166 * to lower case. 33167 * 33168 * @static 33169 * @memberOf _ 33170 * @since 3.0.0 33171 * @category String 33172 * @param {string} [string=''] The string to capitalize. 33173 * @returns {string} Returns the capitalized string. 33174 * @example 33175 * 33176 * _.capitalize('FRED'); 33177 * // => 'Fred' 33178 */ 33179 function capitalize(string) { 33180 return upperFirst(toString(string).toLowerCase()); 33181 } 33182 33183 /** 33184 * Deburrs `string` by converting 33185 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 33186 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 33187 * letters to basic Latin letters and removing 33188 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 33189 * 33190 * @static 33191 * @memberOf _ 33192 * @since 3.0.0 33193 * @category String 33194 * @param {string} [string=''] The string to deburr. 33195 * @returns {string} Returns the deburred string. 33196 * @example 33197 * 33198 * _.deburr('déjàvu'); 33199 * // => 'deja vu' 33200 */ 33201 function deburr(string) { 33202 string = toString(string); 33203 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 33204 } 33205 33206 /** 33207 * Checks if `string` ends with the given target string. 33208 * 33209 * @static 33210 * @memberOf _ 33211 * @since 3.0.0 33212 * @category String 33213 * @param {string} [string=''] The string to inspect. 33214 * @param {string} [target] The string to search for. 33215 * @param {number} [position=string.length] The position to search up to. 33216 * @returns {boolean} Returns `true` if `string` ends with `target`, 33217 * else `false`. 33218 * @example 33219 * 33220 * _.endsWith('abc', 'c'); 33221 * // => true 33222 * 33223 * _.endsWith('abc', 'b'); 33224 * // => false 33225 * 33226 * _.endsWith('abc', 'b', 2); 33227 * // => true 33228 */ 33229 function endsWith(string, target, position) { 33230 string = toString(string); 33231 target = baseToString(target); 33232 33233 var length = string.length; 33234 position = position === undefined 33235 ? length 33236 : baseClamp(toInteger(position), 0, length); 33237 33238 var end = position; 33239 position -= target.length; 33240 return position >= 0 && string.slice(position, end) == target; 33241 } 33242 33243 /** 33244 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 33245 * corresponding HTML entities. 33246 * 33247 * **Note:** No other characters are escaped. To escape additional 33248 * characters use a third-party library like [_he_](https://mths.be/he). 33249 * 33250 * Though the ">" character is escaped for symmetry, characters like 33251 * ">" and "/" don't need escaping in HTML and have no special meaning 33252 * unless they're part of a tag or unquoted attribute value. See 33253 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 33254 * (under "semi-related fun fact") for more details. 33255 * 33256 * When working with HTML you should always 33257 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 33258 * XSS vectors. 33259 * 33260 * @static 33261 * @since 0.1.0 33262 * @memberOf _ 33263 * @category String 33264 * @param {string} [string=''] The string to escape. 33265 * @returns {string} Returns the escaped string. 33266 * @example 33267 * 33268 * _.escape('fred, barney, & pebbles'); 33269 * // => 'fred, barney, & pebbles' 33270 */ 33271 function escape(string) { 33272 string = toString(string); 33273 return (string && reHasUnescapedHtml.test(string)) 33274 ? string.replace(reUnescapedHtml, escapeHtmlChar) 33275 : string; 33276 } 33277 33278 /** 33279 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 33280 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 33281 * 33282 * @static 33283 * @memberOf _ 33284 * @since 3.0.0 33285 * @category String 33286 * @param {string} [string=''] The string to escape. 33287 * @returns {string} Returns the escaped string. 33288 * @example 33289 * 33290 * _.escapeRegExp('[lodash](https://lodash.com/)'); 33291 * // => '\[lodash\]\(https://lodash\.com/\)' 33292 */ 33293 function escapeRegExp(string) { 33294 string = toString(string); 33295 return (string && reHasRegExpChar.test(string)) 33296 ? string.replace(reRegExpChar, '\\$&') 33297 : string; 33298 } 33299 33300 /** 33301 * Converts `string` to 33302 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 33303 * 33304 * @static 33305 * @memberOf _ 33306 * @since 3.0.0 33307 * @category String 33308 * @param {string} [string=''] The string to convert. 33309 * @returns {string} Returns the kebab cased string. 33310 * @example 33311 * 33312 * _.kebabCase('Foo Bar'); 33313 * // => 'foo-bar' 33314 * 33315 * _.kebabCase('fooBar'); 33316 * // => 'foo-bar' 33317 * 33318 * _.kebabCase('__FOO_BAR__'); 33319 * // => 'foo-bar' 33320 */ 33321 var kebabCase = createCompounder(function(result, word, index) { 33322 return result + (index ? '-' : '') + word.toLowerCase(); 33323 }); 33324 33325 /** 33326 * Converts `string`, as space separated words, to lower case. 33327 * 33328 * @static 33329 * @memberOf _ 33330 * @since 4.0.0 33331 * @category String 33332 * @param {string} [string=''] The string to convert. 33333 * @returns {string} Returns the lower cased string. 33334 * @example 33335 * 33336 * _.lowerCase('--Foo-Bar--'); 33337 * // => 'foo bar' 33338 * 33339 * _.lowerCase('fooBar'); 33340 * // => 'foo bar' 33341 * 33342 * _.lowerCase('__FOO_BAR__'); 33343 * // => 'foo bar' 33344 */ 33345 var lowerCase = createCompounder(function(result, word, index) { 33346 return result + (index ? ' ' : '') + word.toLowerCase(); 33347 }); 33348 33349 /** 33350 * Converts the first character of `string` to lower case. 33351 * 33352 * @static 33353 * @memberOf _ 33354 * @since 4.0.0 33355 * @category String 33356 * @param {string} [string=''] The string to convert. 33357 * @returns {string} Returns the converted string. 33358 * @example 33359 * 33360 * _.lowerFirst('Fred'); 33361 * // => 'fred' 33362 * 33363 * _.lowerFirst('FRED'); 33364 * // => 'fRED' 33365 */ 33366 var lowerFirst = createCaseFirst('toLowerCase'); 33367 33368 /** 33369 * Pads `string` on the left and right sides if it's shorter than `length`. 33370 * Padding characters are truncated if they can't be evenly divided by `length`. 33371 * 33372 * @static 33373 * @memberOf _ 33374 * @since 3.0.0 33375 * @category String 33376 * @param {string} [string=''] The string to pad. 33377 * @param {number} [length=0] The padding length. 33378 * @param {string} [chars=' '] The string used as padding. 33379 * @returns {string} Returns the padded string. 33380 * @example 33381 * 33382 * _.pad('abc', 8); 33383 * // => ' abc ' 33384 * 33385 * _.pad('abc', 8, '_-'); 33386 * // => '_-abc_-_' 33387 * 33388 * _.pad('abc', 3); 33389 * // => 'abc' 33390 */ 33391 function pad(string, length, chars) { 33392 string = toString(string); 33393 length = toInteger(length); 33394 33395 var strLength = length ? stringSize(string) : 0; 33396 if (!length || strLength >= length) { 33397 return string; 33398 } 33399 var mid = (length - strLength) / 2; 33400 return ( 33401 createPadding(nativeFloor(mid), chars) + 33402 string + 33403 createPadding(nativeCeil(mid), chars) 33404 ); 33405 } 33406 33407 /** 33408 * Pads `string` on the right side if it's shorter than `length`. Padding 33409 * characters are truncated if they exceed `length`. 33410 * 33411 * @static 33412 * @memberOf _ 33413 * @since 4.0.0 33414 * @category String 33415 * @param {string} [string=''] The string to pad. 33416 * @param {number} [length=0] The padding length. 33417 * @param {string} [chars=' '] The string used as padding. 33418 * @returns {string} Returns the padded string. 33419 * @example 33420 * 33421 * _.padEnd('abc', 6); 33422 * // => 'abc ' 33423 * 33424 * _.padEnd('abc', 6, '_-'); 33425 * // => 'abc_-_' 33426 * 33427 * _.padEnd('abc', 3); 33428 * // => 'abc' 33429 */ 33430 function padEnd(string, length, chars) { 33431 string = toString(string); 33432 length = toInteger(length); 33433 33434 var strLength = length ? stringSize(string) : 0; 33435 return (length && strLength < length) 33436 ? (string + createPadding(length - strLength, chars)) 33437 : string; 33438 } 33439 33440 /** 33441 * Pads `string` on the left side if it's shorter than `length`. Padding 33442 * characters are truncated if they exceed `length`. 33443 * 33444 * @static 33445 * @memberOf _ 33446 * @since 4.0.0 33447 * @category String 33448 * @param {string} [string=''] The string to pad. 33449 * @param {number} [length=0] The padding length. 33450 * @param {string} [chars=' '] The string used as padding. 33451 * @returns {string} Returns the padded string. 33452 * @example 33453 * 33454 * _.padStart('abc', 6); 33455 * // => ' abc' 33456 * 33457 * _.padStart('abc', 6, '_-'); 33458 * // => '_-_abc' 33459 * 33460 * _.padStart('abc', 3); 33461 * // => 'abc' 33462 */ 33463 function padStart(string, length, chars) { 33464 string = toString(string); 33465 length = toInteger(length); 33466 33467 var strLength = length ? stringSize(string) : 0; 33468 return (length && strLength < length) 33469 ? (createPadding(length - strLength, chars) + string) 33470 : string; 33471 } 33472 33473 /** 33474 * Converts `string` to an integer of the specified radix. If `radix` is 33475 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 33476 * hexadecimal, in which case a `radix` of `16` is used. 33477 * 33478 * **Note:** This method aligns with the 33479 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 33480 * 33481 * @static 33482 * @memberOf _ 33483 * @since 1.1.0 33484 * @category String 33485 * @param {string} string The string to convert. 33486 * @param {number} [radix=10] The radix to interpret `value` by. 33487 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 33488 * @returns {number} Returns the converted integer. 33489 * @example 33490 * 33491 * _.parseInt('08'); 33492 * // => 8 33493 * 33494 * _.map(['6', '08', '10'], _.parseInt); 33495 * // => [6, 8, 10] 33496 */ 33497 function parseInt(string, radix, guard) { 33498 if (guard || radix == null) { 33499 radix = 0; 33500 } else if (radix) { 33501 radix = +radix; 33502 } 33503 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 33504 } 33505 33506 /** 33507 * Repeats the given string `n` times. 33508 * 33509 * @static 33510 * @memberOf _ 33511 * @since 3.0.0 33512 * @category String 33513 * @param {string} [string=''] The string to repeat. 33514 * @param {number} [n=1] The number of times to repeat the string. 33515 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 33516 * @returns {string} Returns the repeated string. 33517 * @example 33518 * 33519 * _.repeat('*', 3); 33520 * // => '***' 33521 * 33522 * _.repeat('abc', 2); 33523 * // => 'abcabc' 33524 * 33525 * _.repeat('abc', 0); 33526 * // => '' 33527 */ 33528 function repeat(string, n, guard) { 33529 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 33530 n = 1; 33531 } else { 33532 n = toInteger(n); 33533 } 33534 return baseRepeat(toString(string), n); 33535 } 33536 33537 /** 33538 * Replaces matches for `pattern` in `string` with `replacement`. 33539 * 33540 * **Note:** This method is based on 33541 * [`String#replace`](https://mdn.io/String/replace). 33542 * 33543 * @static 33544 * @memberOf _ 33545 * @since 4.0.0 33546 * @category String 33547 * @param {string} [string=''] The string to modify. 33548 * @param {RegExp|string} pattern The pattern to replace. 33549 * @param {Function|string} replacement The match replacement. 33550 * @returns {string} Returns the modified string. 33551 * @example 33552 * 33553 * _.replace('Hi Fred', 'Fred', 'Barney'); 33554 * // => 'Hi Barney' 33555 */ 33556 function replace() { 33557 var args = arguments, 33558 string = toString(args[0]); 33559 33560 return args.length < 3 ? string : string.replace(args[1], args[2]); 33561 } 33562 33563 /** 33564 * Converts `string` to 33565 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 33566 * 33567 * @static 33568 * @memberOf _ 33569 * @since 3.0.0 33570 * @category String 33571 * @param {string} [string=''] The string to convert. 33572 * @returns {string} Returns the snake cased string. 33573 * @example 33574 * 33575 * _.snakeCase('Foo Bar'); 33576 * // => 'foo_bar' 33577 * 33578 * _.snakeCase('fooBar'); 33579 * // => 'foo_bar' 33580 * 33581 * _.snakeCase('--FOO-BAR--'); 33582 * // => 'foo_bar' 33583 */ 33584 var snakeCase = createCompounder(function(result, word, index) { 33585 return result + (index ? '_' : '') + word.toLowerCase(); 33586 }); 33587 33588 /** 33589 * Splits `string` by `separator`. 33590 * 33591 * **Note:** This method is based on 33592 * [`String#split`](https://mdn.io/String/split). 33593 * 33594 * @static 33595 * @memberOf _ 33596 * @since 4.0.0 33597 * @category String 33598 * @param {string} [string=''] The string to split. 33599 * @param {RegExp|string} separator The separator pattern to split by. 33600 * @param {number} [limit] The length to truncate results to. 33601 * @returns {Array} Returns the string segments. 33602 * @example 33603 * 33604 * _.split('a-b-c', '-', 2); 33605 * // => ['a', 'b'] 33606 */ 33607 function split(string, separator, limit) { 33608 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 33609 separator = limit = undefined; 33610 } 33611 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 33612 if (!limit) { 33613 return []; 33614 } 33615 string = toString(string); 33616 if (string && ( 33617 typeof separator == 'string' || 33618 (separator != null && !isRegExp(separator)) 33619 )) { 33620 separator = baseToString(separator); 33621 if (!separator && hasUnicode(string)) { 33622 return castSlice(stringToArray(string), 0, limit); 33623 } 33624 } 33625 return string.split(separator, limit); 33626 } 33627 33628 /** 33629 * Converts `string` to 33630 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 33631 * 33632 * @static 33633 * @memberOf _ 33634 * @since 3.1.0 33635 * @category String 33636 * @param {string} [string=''] The string to convert. 33637 * @returns {string} Returns the start cased string. 33638 * @example 33639 * 33640 * _.startCase('--foo-bar--'); 33641 * // => 'Foo Bar' 33642 * 33643 * _.startCase('fooBar'); 33644 * // => 'Foo Bar' 33645 * 33646 * _.startCase('__FOO_BAR__'); 33647 * // => 'FOO BAR' 33648 */ 33649 var startCase = createCompounder(function(result, word, index) { 33650 return result + (index ? ' ' : '') + upperFirst(word); 33651 }); 33652 33653 /** 33654 * Checks if `string` starts with the given target string. 33655 * 33656 * @static 33657 * @memberOf _ 33658 * @since 3.0.0 33659 * @category String 33660 * @param {string} [string=''] The string to inspect. 33661 * @param {string} [target] The string to search for. 33662 * @param {number} [position=0] The position to search from. 33663 * @returns {boolean} Returns `true` if `string` starts with `target`, 33664 * else `false`. 33665 * @example 33666 * 33667 * _.startsWith('abc', 'a'); 33668 * // => true 33669 * 33670 * _.startsWith('abc', 'b'); 33671 * // => false 33672 * 33673 * _.startsWith('abc', 'b', 1); 33674 * // => true 33675 */ 33676 function startsWith(string, target, position) { 33677 string = toString(string); 33678 position = position == null 33679 ? 0 33680 : baseClamp(toInteger(position), 0, string.length); 33681 33682 target = baseToString(target); 33683 return string.slice(position, position + target.length) == target; 33684 } 33685 33686 /** 33687 * Creates a compiled template function that can interpolate data properties 33688 * in "interpolate" delimiters, HTML-escape interpolated data properties in 33689 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 33690 * properties may be accessed as free variables in the template. If a setting 33691 * object is given, it takes precedence over `_.templateSettings` values. 33692 * 33693 * **Note:** In the development build `_.template` utilizes 33694 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 33695 * for easier debugging. 33696 * 33697 * For more information on precompiling templates see 33698 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 33699 * 33700 * For more information on Chrome extension sandboxes see 33701 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 33702 * 33703 * @static 33704 * @since 0.1.0 33705 * @memberOf _ 33706 * @category String 33707 * @param {string} [string=''] The template string. 33708 * @param {Object} [options={}] The options object. 33709 * @param {RegExp} [options.escape=_.templateSettings.escape] 33710 * The HTML "escape" delimiter. 33711 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 33712 * The "evaluate" delimiter. 33713 * @param {Object} [options.imports=_.templateSettings.imports] 33714 * An object to import into the template as free variables. 33715 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 33716 * The "interpolate" delimiter. 33717 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 33718 * The sourceURL of the compiled template. 33719 * @param {string} [options.variable='obj'] 33720 * The data object variable name. 33721 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 33722 * @returns {Function} Returns the compiled template function. 33723 * @example 33724 * 33725 * // Use the "interpolate" delimiter to create a compiled template. 33726 * var compiled = _.template('hello <%= user %>!'); 33727 * compiled({ 'user': 'fred' }); 33728 * // => 'hello fred!' 33729 * 33730 * // Use the HTML "escape" delimiter to escape data property values. 33731 * var compiled = _.template('<b><%- value %></b>'); 33732 * compiled({ 'value': '<script>' }); 33733 * // => '<b><script></b>' 33734 * 33735 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 33736 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 33737 * compiled({ 'users': ['fred', 'barney'] }); 33738 * // => '<li>fred</li><li>barney</li>' 33739 * 33740 * // Use the internal `print` function in "evaluate" delimiters. 33741 * var compiled = _.template('<% print("hello " + user); %>!'); 33742 * compiled({ 'user': 'barney' }); 33743 * // => 'hello barney!' 33744 * 33745 * // Use the ES template literal delimiter as an "interpolate" delimiter. 33746 * // Disable support by replacing the "interpolate" delimiter. 33747 * var compiled = _.template('hello ${ user }!'); 33748 * compiled({ 'user': 'pebbles' }); 33749 * // => 'hello pebbles!' 33750 * 33751 * // Use backslashes to treat delimiters as plain text. 33752 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 33753 * compiled({ 'value': 'ignored' }); 33754 * // => '<%- value %>' 33755 * 33756 * // Use the `imports` option to import `jQuery` as `jq`. 33757 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 33758 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 33759 * compiled({ 'users': ['fred', 'barney'] }); 33760 * // => '<li>fred</li><li>barney</li>' 33761 * 33762 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 33763 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 33764 * compiled(data); 33765 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 33766 * 33767 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 33768 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 33769 * compiled.source; 33770 * // => function(data) { 33771 * // var __t, __p = ''; 33772 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 33773 * // return __p; 33774 * // } 33775 * 33776 * // Use custom template delimiters. 33777 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 33778 * var compiled = _.template('hello {{ user }}!'); 33779 * compiled({ 'user': 'mustache' }); 33780 * // => 'hello mustache!' 33781 * 33782 * // Use the `source` property to inline compiled templates for meaningful 33783 * // line numbers in error messages and stack traces. 33784 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 33785 * var JST = {\ 33786 * "main": ' + _.template(mainText).source + '\ 33787 * };\ 33788 * '); 33789 */ 33790 function template(string, options, guard) { 33791 // Based on John Resig's `tmpl` implementation 33792 // (http://ejohn.org/blog/javascript-micro-templating/) 33793 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 33794 var settings = lodash.templateSettings; 33795 33796 if (guard && isIterateeCall(string, options, guard)) { 33797 options = undefined; 33798 } 33799 string = toString(string); 33800 options = assignInWith({}, options, settings, customDefaultsAssignIn); 33801 33802 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 33803 importsKeys = keys(imports), 33804 importsValues = baseValues(imports, importsKeys); 33805 33806 var isEscaping, 33807 isEvaluating, 33808 index = 0, 33809 interpolate = options.interpolate || reNoMatch, 33810 source = "__p += '"; 33811 33812 // Compile the regexp to match each delimiter. 33813 var reDelimiters = RegExp( 33814 (options.escape || reNoMatch).source + '|' + 33815 interpolate.source + '|' + 33816 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 33817 (options.evaluate || reNoMatch).source + '|$' 33818 , 'g'); 33819 33820 // Use a sourceURL for easier debugging. 33821 // The sourceURL gets injected into the source that's eval-ed, so be careful 33822 // with lookup (in case of e.g. prototype pollution), and strip newlines if any. 33823 // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. 33824 var sourceURL = '//# sourceURL=' + 33825 (hasOwnProperty.call(options, 'sourceURL') 33826 ? (options.sourceURL + '').replace(/[\r\n]/g, ' ') 33827 : ('lodash.templateSources[' + (++templateCounter) + ']') 33828 ) + '\n'; 33829 33830 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 33831 interpolateValue || (interpolateValue = esTemplateValue); 33832 33833 // Escape characters that can't be included in string literals. 33834 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 33835 33836 // Replace delimiters with snippets. 33837 if (escapeValue) { 33838 isEscaping = true; 33839 source += "' +\n__e(" + escapeValue + ") +\n'"; 33840 } 33841 if (evaluateValue) { 33842 isEvaluating = true; 33843 source += "';\n" + evaluateValue + ";\n__p += '"; 33844 } 33845 if (interpolateValue) { 33846 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 33847 } 33848 index = offset + match.length; 33849 33850 // The JS engine embedded in Adobe products needs `match` returned in 33851 // order to produce the correct `offset` value. 33852 return match; 33853 }); 33854 33855 source += "';\n"; 33856 33857 // If `variable` is not specified wrap a with-statement around the generated 33858 // code to add the data object to the top of the scope chain. 33859 // Like with sourceURL, we take care to not check the option's prototype, 33860 // as this configuration is a code injection vector. 33861 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 33862 if (!variable) { 33863 source = 'with (obj) {\n' + source + '\n}\n'; 33864 } 33865 // Cleanup code by stripping empty strings. 33866 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 33867 .replace(reEmptyStringMiddle, '$1') 33868 .replace(reEmptyStringTrailing, '$1;'); 33869 33870 // Frame code as the function body. 33871 source = 'function(' + (variable || 'obj') + ') {\n' + 33872 (variable 33873 ? '' 33874 : 'obj || (obj = {});\n' 33875 ) + 33876 "var __t, __p = ''" + 33877 (isEscaping 33878 ? ', __e = _.escape' 33879 : '' 33880 ) + 33881 (isEvaluating 33882 ? ', __j = Array.prototype.join;\n' + 33883 "function print() { __p += __j.call(arguments, '') }\n" 33884 : ';\n' 33885 ) + 33886 source + 33887 'return __p\n}'; 33888 33889 var result = attempt(function() { 33890 return Function(importsKeys, sourceURL + 'return ' + source) 33891 .apply(undefined, importsValues); 33892 }); 33893 33894 // Provide the compiled function's source by its `toString` method or 33895 // the `source` property as a convenience for inlining compiled templates. 33896 result.source = source; 33897 if (isError(result)) { 33898 throw result; 33899 } 33900 return result; 33901 } 33902 33903 /** 33904 * Converts `string`, as a whole, to lower case just like 33905 * [String#toLowerCase](https://mdn.io/toLowerCase). 33906 * 33907 * @static 33908 * @memberOf _ 33909 * @since 4.0.0 33910 * @category String 33911 * @param {string} [string=''] The string to convert. 33912 * @returns {string} Returns the lower cased string. 33913 * @example 33914 * 33915 * _.toLower('--Foo-Bar--'); 33916 * // => '--foo-bar--' 33917 * 33918 * _.toLower('fooBar'); 33919 * // => 'foobar' 33920 * 33921 * _.toLower('__FOO_BAR__'); 33922 * // => '__foo_bar__' 33923 */ 33924 function toLower(value) { 33925 return toString(value).toLowerCase(); 33926 } 33927 33928 /** 33929 * Converts `string`, as a whole, to upper case just like 33930 * [String#toUpperCase](https://mdn.io/toUpperCase). 33931 * 33932 * @static 33933 * @memberOf _ 33934 * @since 4.0.0 33935 * @category String 33936 * @param {string} [string=''] The string to convert. 33937 * @returns {string} Returns the upper cased string. 33938 * @example 33939 * 33940 * _.toUpper('--foo-bar--'); 33941 * // => '--FOO-BAR--' 33942 * 33943 * _.toUpper('fooBar'); 33944 * // => 'FOOBAR' 33945 * 33946 * _.toUpper('__foo_bar__'); 33947 * // => '__FOO_BAR__' 33948 */ 33949 function toUpper(value) { 33950 return toString(value).toUpperCase(); 33951 } 33952 33953 /** 33954 * Removes leading and trailing whitespace or specified characters from `string`. 33955 * 33956 * @static 33957 * @memberOf _ 33958 * @since 3.0.0 33959 * @category String 33960 * @param {string} [string=''] The string to trim. 33961 * @param {string} [chars=whitespace] The characters to trim. 33962 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 33963 * @returns {string} Returns the trimmed string. 33964 * @example 33965 * 33966 * _.trim(' abc '); 33967 * // => 'abc' 33968 * 33969 * _.trim('-_-abc-_-', '_-'); 33970 * // => 'abc' 33971 * 33972 * _.map([' foo ', ' bar '], _.trim); 33973 * // => ['foo', 'bar'] 33974 */ 33975 function trim(string, chars, guard) { 33976 string = toString(string); 33977 if (string && (guard || chars === undefined)) { 33978 return string.replace(reTrim, ''); 33979 } 33980 if (!string || !(chars = baseToString(chars))) { 33981 return string; 33982 } 33983 var strSymbols = stringToArray(string), 33984 chrSymbols = stringToArray(chars), 33985 start = charsStartIndex(strSymbols, chrSymbols), 33986 end = charsEndIndex(strSymbols, chrSymbols) + 1; 33987 33988 return castSlice(strSymbols, start, end).join(''); 33989 } 33990 33991 /** 33992 * Removes trailing whitespace or specified characters from `string`. 33993 * 33994 * @static 33995 * @memberOf _ 33996 * @since 4.0.0 33997 * @category String 33998 * @param {string} [string=''] The string to trim. 33999 * @param {string} [chars=whitespace] The characters to trim. 34000 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34001 * @returns {string} Returns the trimmed string. 34002 * @example 34003 * 34004 * _.trimEnd(' abc '); 34005 * // => ' abc' 34006 * 34007 * _.trimEnd('-_-abc-_-', '_-'); 34008 * // => '-_-abc' 34009 */ 34010 function trimEnd(string, chars, guard) { 34011 string = toString(string); 34012 if (string && (guard || chars === undefined)) { 34013 return string.replace(reTrimEnd, ''); 34014 } 34015 if (!string || !(chars = baseToString(chars))) { 34016 return string; 34017 } 34018 var strSymbols = stringToArray(string), 34019 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 34020 34021 return castSlice(strSymbols, 0, end).join(''); 34022 } 34023 34024 /** 34025 * Removes leading whitespace or specified characters from `string`. 34026 * 34027 * @static 34028 * @memberOf _ 34029 * @since 4.0.0 34030 * @category String 34031 * @param {string} [string=''] The string to trim. 34032 * @param {string} [chars=whitespace] The characters to trim. 34033 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34034 * @returns {string} Returns the trimmed string. 34035 * @example 34036 * 34037 * _.trimStart(' abc '); 34038 * // => 'abc ' 34039 * 34040 * _.trimStart('-_-abc-_-', '_-'); 34041 * // => 'abc-_-' 34042 */ 34043 function trimStart(string, chars, guard) { 34044 string = toString(string); 34045 if (string && (guard || chars === undefined)) { 34046 return string.replace(reTrimStart, ''); 34047 } 34048 if (!string || !(chars = baseToString(chars))) { 34049 return string; 34050 } 34051 var strSymbols = stringToArray(string), 34052 start = charsStartIndex(strSymbols, stringToArray(chars)); 34053 34054 return castSlice(strSymbols, start).join(''); 34055 } 34056 34057 /** 34058 * Truncates `string` if it's longer than the given maximum string length. 34059 * The last characters of the truncated string are replaced with the omission 34060 * string which defaults to "...". 34061 * 34062 * @static 34063 * @memberOf _ 34064 * @since 4.0.0 34065 * @category String 34066 * @param {string} [string=''] The string to truncate. 34067 * @param {Object} [options={}] The options object. 34068 * @param {number} [options.length=30] The maximum string length. 34069 * @param {string} [options.omission='...'] The string to indicate text is omitted. 34070 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 34071 * @returns {string} Returns the truncated string. 34072 * @example 34073 * 34074 * _.truncate('hi-diddly-ho there, neighborino'); 34075 * // => 'hi-diddly-ho there, neighbo...' 34076 * 34077 * _.truncate('hi-diddly-ho there, neighborino', { 34078 * 'length': 24, 34079 * 'separator': ' ' 34080 * }); 34081 * // => 'hi-diddly-ho there,...' 34082 * 34083 * _.truncate('hi-diddly-ho there, neighborino', { 34084 * 'length': 24, 34085 * 'separator': /,? +/ 34086 * }); 34087 * // => 'hi-diddly-ho there...' 34088 * 34089 * _.truncate('hi-diddly-ho there, neighborino', { 34090 * 'omission': ' [...]' 34091 * }); 34092 * // => 'hi-diddly-ho there, neig [...]' 34093 */ 34094 function truncate(string, options) { 34095 var length = DEFAULT_TRUNC_LENGTH, 34096 omission = DEFAULT_TRUNC_OMISSION; 34097 34098 if (isObject(options)) { 34099 var separator = 'separator' in options ? options.separator : separator; 34100 length = 'length' in options ? toInteger(options.length) : length; 34101 omission = 'omission' in options ? baseToString(options.omission) : omission; 34102 } 34103 string = toString(string); 34104 34105 var strLength = string.length; 34106 if (hasUnicode(string)) { 34107 var strSymbols = stringToArray(string); 34108 strLength = strSymbols.length; 34109 } 34110 if (length >= strLength) { 34111 return string; 34112 } 34113 var end = length - stringSize(omission); 34114 if (end < 1) { 34115 return omission; 34116 } 34117 var result = strSymbols 34118 ? castSlice(strSymbols, 0, end).join('') 34119 : string.slice(0, end); 34120 34121 if (separator === undefined) { 34122 return result + omission; 34123 } 34124 if (strSymbols) { 34125 end += (result.length - end); 34126 } 34127 if (isRegExp(separator)) { 34128 if (string.slice(end).search(separator)) { 34129 var match, 34130 substring = result; 34131 34132 if (!separator.global) { 34133 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 34134 } 34135 separator.lastIndex = 0; 34136 while ((match = separator.exec(substring))) { 34137 var newEnd = match.index; 34138 } 34139 result = result.slice(0, newEnd === undefined ? end : newEnd); 34140 } 34141 } else if (string.indexOf(baseToString(separator), end) != end) { 34142 var index = result.lastIndexOf(separator); 34143 if (index > -1) { 34144 result = result.slice(0, index); 34145 } 34146 } 34147 return result + omission; 34148 } 34149 34150 /** 34151 * The inverse of `_.escape`; this method converts the HTML entities 34152 * `&`, `<`, `>`, `"`, and `'` in `string` to 34153 * their corresponding characters. 34154 * 34155 * **Note:** No other HTML entities are unescaped. To unescape additional 34156 * HTML entities use a third-party library like [_he_](https://mths.be/he). 34157 * 34158 * @static 34159 * @memberOf _ 34160 * @since 0.6.0 34161 * @category String 34162 * @param {string} [string=''] The string to unescape. 34163 * @returns {string} Returns the unescaped string. 34164 * @example 34165 * 34166 * _.unescape('fred, barney, & pebbles'); 34167 * // => 'fred, barney, & pebbles' 34168 */ 34169 function unescape(string) { 34170 string = toString(string); 34171 return (string && reHasEscapedHtml.test(string)) 34172 ? string.replace(reEscapedHtml, unescapeHtmlChar) 34173 : string; 34174 } 34175 34176 /** 34177 * Converts `string`, as space separated words, to upper case. 34178 * 34179 * @static 34180 * @memberOf _ 34181 * @since 4.0.0 34182 * @category String 34183 * @param {string} [string=''] The string to convert. 34184 * @returns {string} Returns the upper cased string. 34185 * @example 34186 * 34187 * _.upperCase('--foo-bar'); 34188 * // => 'FOO BAR' 34189 * 34190 * _.upperCase('fooBar'); 34191 * // => 'FOO BAR' 34192 * 34193 * _.upperCase('__foo_bar__'); 34194 * // => 'FOO BAR' 34195 */ 34196 var upperCase = createCompounder(function(result, word, index) { 34197 return result + (index ? ' ' : '') + word.toUpperCase(); 34198 }); 34199 34200 /** 34201 * Converts the first character of `string` to upper case. 34202 * 34203 * @static 34204 * @memberOf _ 34205 * @since 4.0.0 34206 * @category String 34207 * @param {string} [string=''] The string to convert. 34208 * @returns {string} Returns the converted string. 34209 * @example 34210 * 34211 * _.upperFirst('fred'); 34212 * // => 'Fred' 34213 * 34214 * _.upperFirst('FRED'); 34215 * // => 'FRED' 34216 */ 34217 var upperFirst = createCaseFirst('toUpperCase'); 34218 34219 /** 34220 * Splits `string` into an array of its words. 34221 * 34222 * @static 34223 * @memberOf _ 34224 * @since 3.0.0 34225 * @category String 34226 * @param {string} [string=''] The string to inspect. 34227 * @param {RegExp|string} [pattern] The pattern to match words. 34228 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34229 * @returns {Array} Returns the words of `string`. 34230 * @example 34231 * 34232 * _.words('fred, barney, & pebbles'); 34233 * // => ['fred', 'barney', 'pebbles'] 34234 * 34235 * _.words('fred, barney, & pebbles', /[^, ]+/g); 34236 * // => ['fred', 'barney', '&', 'pebbles'] 34237 */ 34238 function words(string, pattern, guard) { 34239 string = toString(string); 34240 pattern = guard ? undefined : pattern; 34241 34242 if (pattern === undefined) { 34243 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 34244 } 34245 return string.match(pattern) || []; 34246 } 34247 34248 /*------------------------------------------------------------------------*/ 34249 34250 /** 34251 * Attempts to invoke `func`, returning either the result or the caught error 34252 * object. Any additional arguments are provided to `func` when it's invoked. 34253 * 34254 * @static 34255 * @memberOf _ 34256 * @since 3.0.0 34257 * @category Util 34258 * @param {Function} func The function to attempt. 34259 * @param {...*} [args] The arguments to invoke `func` with. 34260 * @returns {*} Returns the `func` result or error object. 34261 * @example 34262 * 34263 * // Avoid throwing errors for invalid selectors. 34264 * var elements = _.attempt(function(selector) { 34265 * return document.querySelectorAll(selector); 34266 * }, '>_>'); 34267 * 34268 * if (_.isError(elements)) { 34269 * elements = []; 34270 * } 34271 */ 34272 var attempt = baseRest(function(func, args) { 34273 try { 34274 return apply(func, undefined, args); 34275 } catch (e) { 34276 return isError(e) ? e : new Error(e); 34277 } 34278 }); 34279 34280 /** 34281 * Binds methods of an object to the object itself, overwriting the existing 34282 * method. 34283 * 34284 * **Note:** This method doesn't set the "length" property of bound functions. 34285 * 34286 * @static 34287 * @since 0.1.0 34288 * @memberOf _ 34289 * @category Util 34290 * @param {Object} object The object to bind and assign the bound methods to. 34291 * @param {...(string|string[])} methodNames The object method names to bind. 34292 * @returns {Object} Returns `object`. 34293 * @example 34294 * 34295 * var view = { 34296 * 'label': 'docs', 34297 * 'click': function() { 34298 * console.log('clicked ' + this.label); 34299 * } 34300 * }; 34301 * 34302 * _.bindAll(view, ['click']); 34303 * jQuery(element).on('click', view.click); 34304 * // => Logs 'clicked docs' when clicked. 34305 */ 34306 var bindAll = flatRest(function(object, methodNames) { 34307 arrayEach(methodNames, function(key) { 34308 key = toKey(key); 34309 baseAssignValue(object, key, bind(object[key], object)); 34310 }); 34311 return object; 34312 }); 34313 34314 /** 34315 * Creates a function that iterates over `pairs` and invokes the corresponding 34316 * function of the first predicate to return truthy. The predicate-function 34317 * pairs are invoked with the `this` binding and arguments of the created 34318 * function. 34319 * 34320 * @static 34321 * @memberOf _ 34322 * @since 4.0.0 34323 * @category Util 34324 * @param {Array} pairs The predicate-function pairs. 34325 * @returns {Function} Returns the new composite function. 34326 * @example 34327 * 34328 * var func = _.cond([ 34329 * [_.matches({ 'a': 1 }), _.constant('matches A')], 34330 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 34331 * [_.stubTrue, _.constant('no match')] 34332 * ]); 34333 * 34334 * func({ 'a': 1, 'b': 2 }); 34335 * // => 'matches A' 34336 * 34337 * func({ 'a': 0, 'b': 1 }); 34338 * // => 'matches B' 34339 * 34340 * func({ 'a': '1', 'b': '2' }); 34341 * // => 'no match' 34342 */ 34343 function cond(pairs) { 34344 var length = pairs == null ? 0 : pairs.length, 34345 toIteratee = getIteratee(); 34346 34347 pairs = !length ? [] : arrayMap(pairs, function(pair) { 34348 if (typeof pair[1] != 'function') { 34349 throw new TypeError(FUNC_ERROR_TEXT); 34350 } 34351 return [toIteratee(pair[0]), pair[1]]; 34352 }); 34353 34354 return baseRest(function(args) { 34355 var index = -1; 34356 while (++index < length) { 34357 var pair = pairs[index]; 34358 if (apply(pair[0], this, args)) { 34359 return apply(pair[1], this, args); 34360 } 34361 } 34362 }); 34363 } 34364 34365 /** 34366 * Creates a function that invokes the predicate properties of `source` with 34367 * the corresponding property values of a given object, returning `true` if 34368 * all predicates return truthy, else `false`. 34369 * 34370 * **Note:** The created function is equivalent to `_.conformsTo` with 34371 * `source` partially applied. 34372 * 34373 * @static 34374 * @memberOf _ 34375 * @since 4.0.0 34376 * @category Util 34377 * @param {Object} source The object of property predicates to conform to. 34378 * @returns {Function} Returns the new spec function. 34379 * @example 34380 * 34381 * var objects = [ 34382 * { 'a': 2, 'b': 1 }, 34383 * { 'a': 1, 'b': 2 } 34384 * ]; 34385 * 34386 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 34387 * // => [{ 'a': 1, 'b': 2 }] 34388 */ 34389 function conforms(source) { 34390 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 34391 } 34392 34393 /** 34394 * Creates a function that returns `value`. 34395 * 34396 * @static 34397 * @memberOf _ 34398 * @since 2.4.0 34399 * @category Util 34400 * @param {*} value The value to return from the new function. 34401 * @returns {Function} Returns the new constant function. 34402 * @example 34403 * 34404 * var objects = _.times(2, _.constant({ 'a': 1 })); 34405 * 34406 * console.log(objects); 34407 * // => [{ 'a': 1 }, { 'a': 1 }] 34408 * 34409 * console.log(objects[0] === objects[1]); 34410 * // => true 34411 */ 34412 function constant(value) { 34413 return function() { 34414 return value; 34415 }; 34416 } 34417 34418 /** 34419 * Checks `value` to determine whether a default value should be returned in 34420 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 34421 * or `undefined`. 34422 * 34423 * @static 34424 * @memberOf _ 34425 * @since 4.14.0 34426 * @category Util 34427 * @param {*} value The value to check. 34428 * @param {*} defaultValue The default value. 34429 * @returns {*} Returns the resolved value. 34430 * @example 34431 * 34432 * _.defaultTo(1, 10); 34433 * // => 1 34434 * 34435 * _.defaultTo(undefined, 10); 34436 * // => 10 34437 */ 34438 function defaultTo(value, defaultValue) { 34439 return (value == null || value !== value) ? defaultValue : value; 34440 } 34441 34442 /** 34443 * Creates a function that returns the result of invoking the given functions 34444 * with the `this` binding of the created function, where each successive 34445 * invocation is supplied the return value of the previous. 34446 * 34447 * @static 34448 * @memberOf _ 34449 * @since 3.0.0 34450 * @category Util 34451 * @param {...(Function|Function[])} [funcs] The functions to invoke. 34452 * @returns {Function} Returns the new composite function. 34453 * @see _.flowRight 34454 * @example 34455 * 34456 * function square(n) { 34457 * return n * n; 34458 * } 34459 * 34460 * var addSquare = _.flow([_.add, square]); 34461 * addSquare(1, 2); 34462 * // => 9 34463 */ 34464 var flow = createFlow(); 34465 34466 /** 34467 * This method is like `_.flow` except that it creates a function that 34468 * invokes the given functions from right to left. 34469 * 34470 * @static 34471 * @since 3.0.0 34472 * @memberOf _ 34473 * @category Util 34474 * @param {...(Function|Function[])} [funcs] The functions to invoke. 34475 * @returns {Function} Returns the new composite function. 34476 * @see _.flow 34477 * @example 34478 * 34479 * function square(n) { 34480 * return n * n; 34481 * } 34482 * 34483 * var addSquare = _.flowRight([square, _.add]); 34484 * addSquare(1, 2); 34485 * // => 9 34486 */ 34487 var flowRight = createFlow(true); 34488 34489 /** 34490 * This method returns the first argument it receives. 34491 * 34492 * @static 34493 * @since 0.1.0 34494 * @memberOf _ 34495 * @category Util 34496 * @param {*} value Any value. 34497 * @returns {*} Returns `value`. 34498 * @example 34499 * 34500 * var object = { 'a': 1 }; 34501 * 34502 * console.log(_.identity(object) === object); 34503 * // => true 34504 */ 34505 function identity(value) { 34506 return value; 34507 } 34508 34509 /** 34510 * Creates a function that invokes `func` with the arguments of the created 34511 * function. If `func` is a property name, the created function returns the 34512 * property value for a given element. If `func` is an array or object, the 34513 * created function returns `true` for elements that contain the equivalent 34514 * source properties, otherwise it returns `false`. 34515 * 34516 * @static 34517 * @since 4.0.0 34518 * @memberOf _ 34519 * @category Util 34520 * @param {*} [func=_.identity] The value to convert to a callback. 34521 * @returns {Function} Returns the callback. 34522 * @example 34523 * 34524 * var users = [ 34525 * { 'user': 'barney', 'age': 36, 'active': true }, 34526 * { 'user': 'fred', 'age': 40, 'active': false } 34527 * ]; 34528 * 34529 * // The `_.matches` iteratee shorthand. 34530 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 34531 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 34532 * 34533 * // The `_.matchesProperty` iteratee shorthand. 34534 * _.filter(users, _.iteratee(['user', 'fred'])); 34535 * // => [{ 'user': 'fred', 'age': 40 }] 34536 * 34537 * // The `_.property` iteratee shorthand. 34538 * _.map(users, _.iteratee('user')); 34539 * // => ['barney', 'fred'] 34540 * 34541 * // Create custom iteratee shorthands. 34542 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 34543 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 34544 * return func.test(string); 34545 * }; 34546 * }); 34547 * 34548 * _.filter(['abc', 'def'], /ef/); 34549 * // => ['def'] 34550 */ 34551 function iteratee(func) { 34552 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 34553 } 34554 34555 /** 34556 * Creates a function that performs a partial deep comparison between a given 34557 * object and `source`, returning `true` if the given object has equivalent 34558 * property values, else `false`. 34559 * 34560 * **Note:** The created function is equivalent to `_.isMatch` with `source` 34561 * partially applied. 34562 * 34563 * Partial comparisons will match empty array and empty object `source` 34564 * values against any array or object value, respectively. See `_.isEqual` 34565 * for a list of supported value comparisons. 34566 * 34567 * @static 34568 * @memberOf _ 34569 * @since 3.0.0 34570 * @category Util 34571 * @param {Object} source The object of property values to match. 34572 * @returns {Function} Returns the new spec function. 34573 * @example 34574 * 34575 * var objects = [ 34576 * { 'a': 1, 'b': 2, 'c': 3 }, 34577 * { 'a': 4, 'b': 5, 'c': 6 } 34578 * ]; 34579 * 34580 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 34581 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 34582 */ 34583 function matches(source) { 34584 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 34585 } 34586 34587 /** 34588 * Creates a function that performs a partial deep comparison between the 34589 * value at `path` of a given object to `srcValue`, returning `true` if the 34590 * object value is equivalent, else `false`. 34591 * 34592 * **Note:** Partial comparisons will match empty array and empty object 34593 * `srcValue` values against any array or object value, respectively. See 34594 * `_.isEqual` for a list of supported value comparisons. 34595 * 34596 * @static 34597 * @memberOf _ 34598 * @since 3.2.0 34599 * @category Util 34600 * @param {Array|string} path The path of the property to get. 34601 * @param {*} srcValue The value to match. 34602 * @returns {Function} Returns the new spec function. 34603 * @example 34604 * 34605 * var objects = [ 34606 * { 'a': 1, 'b': 2, 'c': 3 }, 34607 * { 'a': 4, 'b': 5, 'c': 6 } 34608 * ]; 34609 * 34610 * _.find(objects, _.matchesProperty('a', 4)); 34611 * // => { 'a': 4, 'b': 5, 'c': 6 } 34612 */ 34613 function matchesProperty(path, srcValue) { 34614 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 34615 } 34616 34617 /** 34618 * Creates a function that invokes the method at `path` of a given object. 34619 * Any additional arguments are provided to the invoked method. 34620 * 34621 * @static 34622 * @memberOf _ 34623 * @since 3.7.0 34624 * @category Util 34625 * @param {Array|string} path The path of the method to invoke. 34626 * @param {...*} [args] The arguments to invoke the method with. 34627 * @returns {Function} Returns the new invoker function. 34628 * @example 34629 * 34630 * var objects = [ 34631 * { 'a': { 'b': _.constant(2) } }, 34632 * { 'a': { 'b': _.constant(1) } } 34633 * ]; 34634 * 34635 * _.map(objects, _.method('a.b')); 34636 * // => [2, 1] 34637 * 34638 * _.map(objects, _.method(['a', 'b'])); 34639 * // => [2, 1] 34640 */ 34641 var method = baseRest(function(path, args) { 34642 return function(object) { 34643 return baseInvoke(object, path, args); 34644 }; 34645 }); 34646 34647 /** 34648 * The opposite of `_.method`; this method creates a function that invokes 34649 * the method at a given path of `object`. Any additional arguments are 34650 * provided to the invoked method. 34651 * 34652 * @static 34653 * @memberOf _ 34654 * @since 3.7.0 34655 * @category Util 34656 * @param {Object} object The object to query. 34657 * @param {...*} [args] The arguments to invoke the method with. 34658 * @returns {Function} Returns the new invoker function. 34659 * @example 34660 * 34661 * var array = _.times(3, _.constant), 34662 * object = { 'a': array, 'b': array, 'c': array }; 34663 * 34664 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 34665 * // => [2, 0] 34666 * 34667 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 34668 * // => [2, 0] 34669 */ 34670 var methodOf = baseRest(function(object, args) { 34671 return function(path) { 34672 return baseInvoke(object, path, args); 34673 }; 34674 }); 34675 34676 /** 34677 * Adds all own enumerable string keyed function properties of a source 34678 * object to the destination object. If `object` is a function, then methods 34679 * are added to its prototype as well. 34680 * 34681 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 34682 * avoid conflicts caused by modifying the original. 34683 * 34684 * @static 34685 * @since 0.1.0 34686 * @memberOf _ 34687 * @category Util 34688 * @param {Function|Object} [object=lodash] The destination object. 34689 * @param {Object} source The object of functions to add. 34690 * @param {Object} [options={}] The options object. 34691 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 34692 * @returns {Function|Object} Returns `object`. 34693 * @example 34694 * 34695 * function vowels(string) { 34696 * return _.filter(string, function(v) { 34697 * return /[aeiou]/i.test(v); 34698 * }); 34699 * } 34700 * 34701 * _.mixin({ 'vowels': vowels }); 34702 * _.vowels('fred'); 34703 * // => ['e'] 34704 * 34705 * _('fred').vowels().value(); 34706 * // => ['e'] 34707 * 34708 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 34709 * _('fred').vowels(); 34710 * // => ['e'] 34711 */ 34712 function mixin(object, source, options) { 34713 var props = keys(source), 34714 methodNames = baseFunctions(source, props); 34715 34716 if (options == null && 34717 !(isObject(source) && (methodNames.length || !props.length))) { 34718 options = source; 34719 source = object; 34720 object = this; 34721 methodNames = baseFunctions(source, keys(source)); 34722 } 34723 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 34724 isFunc = isFunction(object); 34725 34726 arrayEach(methodNames, function(methodName) { 34727 var func = source[methodName]; 34728 object[methodName] = func; 34729 if (isFunc) { 34730 object.prototype[methodName] = function() { 34731 var chainAll = this.__chain__; 34732 if (chain || chainAll) { 34733 var result = object(this.__wrapped__), 34734 actions = result.__actions__ = copyArray(this.__actions__); 34735 34736 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 34737 result.__chain__ = chainAll; 34738 return result; 34739 } 34740 return func.apply(object, arrayPush([this.value()], arguments)); 34741 }; 34742 } 34743 }); 34744 34745 return object; 34746 } 34747 34748 /** 34749 * Reverts the `_` variable to its previous value and returns a reference to 34750 * the `lodash` function. 34751 * 34752 * @static 34753 * @since 0.1.0 34754 * @memberOf _ 34755 * @category Util 34756 * @returns {Function} Returns the `lodash` function. 34757 * @example 34758 * 34759 * var lodash = _.noConflict(); 34760 */ 34761 function noConflict() { 34762 if (root._ === this) { 34763 root._ = oldDash; 34764 } 34765 return this; 34766 } 34767 34768 /** 34769 * This method returns `undefined`. 34770 * 34771 * @static 34772 * @memberOf _ 34773 * @since 2.3.0 34774 * @category Util 34775 * @example 34776 * 34777 * _.times(2, _.noop); 34778 * // => [undefined, undefined] 34779 */ 34780 function noop() { 34781 // No operation performed. 34782 } 34783 34784 /** 34785 * Creates a function that gets the argument at index `n`. If `n` is negative, 34786 * the nth argument from the end is returned. 34787 * 34788 * @static 34789 * @memberOf _ 34790 * @since 4.0.0 34791 * @category Util 34792 * @param {number} [n=0] The index of the argument to return. 34793 * @returns {Function} Returns the new pass-thru function. 34794 * @example 34795 * 34796 * var func = _.nthArg(1); 34797 * func('a', 'b', 'c', 'd'); 34798 * // => 'b' 34799 * 34800 * var func = _.nthArg(-2); 34801 * func('a', 'b', 'c', 'd'); 34802 * // => 'c' 34803 */ 34804 function nthArg(n) { 34805 n = toInteger(n); 34806 return baseRest(function(args) { 34807 return baseNth(args, n); 34808 }); 34809 } 34810 34811 /** 34812 * Creates a function that invokes `iteratees` with the arguments it receives 34813 * and returns their results. 34814 * 34815 * @static 34816 * @memberOf _ 34817 * @since 4.0.0 34818 * @category Util 34819 * @param {...(Function|Function[])} [iteratees=[_.identity]] 34820 * The iteratees to invoke. 34821 * @returns {Function} Returns the new function. 34822 * @example 34823 * 34824 * var func = _.over([Math.max, Math.min]); 34825 * 34826 * func(1, 2, 3, 4); 34827 * // => [4, 1] 34828 */ 34829 var over = createOver(arrayMap); 34830 34831 /** 34832 * Creates a function that checks if **all** of the `predicates` return 34833 * truthy when invoked with the arguments it receives. 34834 * 34835 * @static 34836 * @memberOf _ 34837 * @since 4.0.0 34838 * @category Util 34839 * @param {...(Function|Function[])} [predicates=[_.identity]] 34840 * The predicates to check. 34841 * @returns {Function} Returns the new function. 34842 * @example 34843 * 34844 * var func = _.overEvery([Boolean, isFinite]); 34845 * 34846 * func('1'); 34847 * // => true 34848 * 34849 * func(null); 34850 * // => false 34851 * 34852 * func(NaN); 34853 * // => false 34854 */ 34855 var overEvery = createOver(arrayEvery); 34856 34857 /** 34858 * Creates a function that checks if **any** of the `predicates` return 34859 * truthy when invoked with the arguments it receives. 34860 * 34861 * @static 34862 * @memberOf _ 34863 * @since 4.0.0 34864 * @category Util 34865 * @param {...(Function|Function[])} [predicates=[_.identity]] 34866 * The predicates to check. 34867 * @returns {Function} Returns the new function. 34868 * @example 34869 * 34870 * var func = _.overSome([Boolean, isFinite]); 34871 * 34872 * func('1'); 34873 * // => true 34874 * 34875 * func(null); 34876 * // => true 34877 * 34878 * func(NaN); 34879 * // => false 34880 */ 34881 var overSome = createOver(arraySome); 34882 34883 /** 34884 * Creates a function that returns the value at `path` of a given object. 34885 * 34886 * @static 34887 * @memberOf _ 34888 * @since 2.4.0 34889 * @category Util 34890 * @param {Array|string} path The path of the property to get. 34891 * @returns {Function} Returns the new accessor function. 34892 * @example 34893 * 34894 * var objects = [ 34895 * { 'a': { 'b': 2 } }, 34896 * { 'a': { 'b': 1 } } 34897 * ]; 34898 * 34899 * _.map(objects, _.property('a.b')); 34900 * // => [2, 1] 34901 * 34902 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 34903 * // => [1, 2] 34904 */ 34905 function property(path) { 34906 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 34907 } 34908 34909 /** 34910 * The opposite of `_.property`; this method creates a function that returns 34911 * the value at a given path of `object`. 34912 * 34913 * @static 34914 * @memberOf _ 34915 * @since 3.0.0 34916 * @category Util 34917 * @param {Object} object The object to query. 34918 * @returns {Function} Returns the new accessor function. 34919 * @example 34920 * 34921 * var array = [0, 1, 2], 34922 * object = { 'a': array, 'b': array, 'c': array }; 34923 * 34924 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 34925 * // => [2, 0] 34926 * 34927 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 34928 * // => [2, 0] 34929 */ 34930 function propertyOf(object) { 34931 return function(path) { 34932 return object == null ? undefined : baseGet(object, path); 34933 }; 34934 } 34935 34936 /** 34937 * Creates an array of numbers (positive and/or negative) progressing from 34938 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 34939 * `start` is specified without an `end` or `step`. If `end` is not specified, 34940 * it's set to `start` with `start` then set to `0`. 34941 * 34942 * **Note:** JavaScript follows the IEEE-754 standard for resolving 34943 * floating-point values which can produce unexpected results. 34944 * 34945 * @static 34946 * @since 0.1.0 34947 * @memberOf _ 34948 * @category Util 34949 * @param {number} [start=0] The start of the range. 34950 * @param {number} end The end of the range. 34951 * @param {number} [step=1] The value to increment or decrement by. 34952 * @returns {Array} Returns the range of numbers. 34953 * @see _.inRange, _.rangeRight 34954 * @example 34955 * 34956 * _.range(4); 34957 * // => [0, 1, 2, 3] 34958 * 34959 * _.range(-4); 34960 * // => [0, -1, -2, -3] 34961 * 34962 * _.range(1, 5); 34963 * // => [1, 2, 3, 4] 34964 * 34965 * _.range(0, 20, 5); 34966 * // => [0, 5, 10, 15] 34967 * 34968 * _.range(0, -4, -1); 34969 * // => [0, -1, -2, -3] 34970 * 34971 * _.range(1, 4, 0); 34972 * // => [1, 1, 1] 34973 * 34974 * _.range(0); 34975 * // => [] 34976 */ 34977 var range = createRange(); 34978 34979 /** 34980 * This method is like `_.range` except that it populates values in 34981 * descending order. 34982 * 34983 * @static 34984 * @memberOf _ 34985 * @since 4.0.0 34986 * @category Util 34987 * @param {number} [start=0] The start of the range. 34988 * @param {number} end The end of the range. 34989 * @param {number} [step=1] The value to increment or decrement by. 34990 * @returns {Array} Returns the range of numbers. 34991 * @see _.inRange, _.range 34992 * @example 34993 * 34994 * _.rangeRight(4); 34995 * // => [3, 2, 1, 0] 34996 * 34997 * _.rangeRight(-4); 34998 * // => [-3, -2, -1, 0] 34999 * 35000 * _.rangeRight(1, 5); 35001 * // => [4, 3, 2, 1] 35002 * 35003 * _.rangeRight(0, 20, 5); 35004 * // => [15, 10, 5, 0] 35005 * 35006 * _.rangeRight(0, -4, -1); 35007 * // => [-3, -2, -1, 0] 35008 * 35009 * _.rangeRight(1, 4, 0); 35010 * // => [1, 1, 1] 35011 * 35012 * _.rangeRight(0); 35013 * // => [] 35014 */ 35015 var rangeRight = createRange(true); 35016 35017 /** 35018 * This method returns a new empty array. 35019 * 35020 * @static 35021 * @memberOf _ 35022 * @since 4.13.0 35023 * @category Util 35024 * @returns {Array} Returns the new empty array. 35025 * @example 35026 * 35027 * var arrays = _.times(2, _.stubArray); 35028 * 35029 * console.log(arrays); 35030 * // => [[], []] 35031 * 35032 * console.log(arrays[0] === arrays[1]); 35033 * // => false 35034 */ 35035 function stubArray() { 35036 return []; 35037 } 35038 35039 /** 35040 * This method returns `false`. 35041 * 35042 * @static 35043 * @memberOf _ 35044 * @since 4.13.0 35045 * @category Util 35046 * @returns {boolean} Returns `false`. 35047 * @example 35048 * 35049 * _.times(2, _.stubFalse); 35050 * // => [false, false] 35051 */ 35052 function stubFalse() { 35053 return false; 35054 } 35055 35056 /** 35057 * This method returns a new empty object. 35058 * 35059 * @static 35060 * @memberOf _ 35061 * @since 4.13.0 35062 * @category Util 35063 * @returns {Object} Returns the new empty object. 35064 * @example 35065 * 35066 * var objects = _.times(2, _.stubObject); 35067 * 35068 * console.log(objects); 35069 * // => [{}, {}] 35070 * 35071 * console.log(objects[0] === objects[1]); 35072 * // => false 35073 */ 35074 function stubObject() { 35075 return {}; 35076 } 35077 35078 /** 35079 * This method returns an empty string. 35080 * 35081 * @static 35082 * @memberOf _ 35083 * @since 4.13.0 35084 * @category Util 35085 * @returns {string} Returns the empty string. 35086 * @example 35087 * 35088 * _.times(2, _.stubString); 35089 * // => ['', ''] 35090 */ 35091 function stubString() { 35092 return ''; 35093 } 35094 35095 /** 35096 * This method returns `true`. 35097 * 35098 * @static 35099 * @memberOf _ 35100 * @since 4.13.0 35101 * @category Util 35102 * @returns {boolean} Returns `true`. 35103 * @example 35104 * 35105 * _.times(2, _.stubTrue); 35106 * // => [true, true] 35107 */ 35108 function stubTrue() { 35109 return true; 35110 } 35111 35112 /** 35113 * Invokes the iteratee `n` times, returning an array of the results of 35114 * each invocation. The iteratee is invoked with one argument; (index). 35115 * 35116 * @static 35117 * @since 0.1.0 35118 * @memberOf _ 35119 * @category Util 35120 * @param {number} n The number of times to invoke `iteratee`. 35121 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 35122 * @returns {Array} Returns the array of results. 35123 * @example 35124 * 35125 * _.times(3, String); 35126 * // => ['0', '1', '2'] 35127 * 35128 * _.times(4, _.constant(0)); 35129 * // => [0, 0, 0, 0] 35130 */ 35131 function times(n, iteratee) { 35132 n = toInteger(n); 35133 if (n < 1 || n > MAX_SAFE_INTEGER) { 35134 return []; 35135 } 35136 var index = MAX_ARRAY_LENGTH, 35137 length = nativeMin(n, MAX_ARRAY_LENGTH); 35138 35139 iteratee = getIteratee(iteratee); 35140 n -= MAX_ARRAY_LENGTH; 35141 35142 var result = baseTimes(length, iteratee); 35143 while (++index < n) { 35144 iteratee(index); 35145 } 35146 return result; 35147 } 35148 35149 /** 35150 * Converts `value` to a property path array. 35151 * 35152 * @static 35153 * @memberOf _ 35154 * @since 4.0.0 35155 * @category Util 35156 * @param {*} value The value to convert. 35157 * @returns {Array} Returns the new property path array. 35158 * @example 35159 * 35160 * _.toPath('a.b.c'); 35161 * // => ['a', 'b', 'c'] 35162 * 35163 * _.toPath('a[0].b.c'); 35164 * // => ['a', '0', 'b', 'c'] 35165 */ 35166 function toPath(value) { 35167 if (isArray(value)) { 35168 return arrayMap(value, toKey); 35169 } 35170 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 35171 } 35172 35173 /** 35174 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 35175 * 35176 * @static 35177 * @since 0.1.0 35178 * @memberOf _ 35179 * @category Util 35180 * @param {string} [prefix=''] The value to prefix the ID with. 35181 * @returns {string} Returns the unique ID. 35182 * @example 35183 * 35184 * _.uniqueId('contact_'); 35185 * // => 'contact_104' 35186 * 35187 * _.uniqueId(); 35188 * // => '105' 35189 */ 35190 function uniqueId(prefix) { 35191 var id = ++idCounter; 35192 return toString(prefix) + id; 35193 } 35194 35195 /*------------------------------------------------------------------------*/ 35196 35197 /** 35198 * Adds two numbers. 35199 * 35200 * @static 35201 * @memberOf _ 35202 * @since 3.4.0 35203 * @category Math 35204 * @param {number} augend The first number in an addition. 35205 * @param {number} addend The second number in an addition. 35206 * @returns {number} Returns the total. 35207 * @example 35208 * 35209 * _.add(6, 4); 35210 * // => 10 35211 */ 35212 var add = createMathOperation(function(augend, addend) { 35213 return augend + addend; 35214 }, 0); 35215 35216 /** 35217 * Computes `number` rounded up to `precision`. 35218 * 35219 * @static 35220 * @memberOf _ 35221 * @since 3.10.0 35222 * @category Math 35223 * @param {number} number The number to round up. 35224 * @param {number} [precision=0] The precision to round up to. 35225 * @returns {number} Returns the rounded up number. 35226 * @example 35227 * 35228 * _.ceil(4.006); 35229 * // => 5 35230 * 35231 * _.ceil(6.004, 2); 35232 * // => 6.01 35233 * 35234 * _.ceil(6040, -2); 35235 * // => 6100 35236 */ 35237 var ceil = createRound('ceil'); 35238 35239 /** 35240 * Divide two numbers. 35241 * 35242 * @static 35243 * @memberOf _ 35244 * @since 4.7.0 35245 * @category Math 35246 * @param {number} dividend The first number in a division. 35247 * @param {number} divisor The second number in a division. 35248 * @returns {number} Returns the quotient. 35249 * @example 35250 * 35251 * _.divide(6, 4); 35252 * // => 1.5 35253 */ 35254 var divide = createMathOperation(function(dividend, divisor) { 35255 return dividend / divisor; 35256 }, 1); 35257 35258 /** 35259 * Computes `number` rounded down to `precision`. 35260 * 35261 * @static 35262 * @memberOf _ 35263 * @since 3.10.0 35264 * @category Math 35265 * @param {number} number The number to round down. 35266 * @param {number} [precision=0] The precision to round down to. 35267 * @returns {number} Returns the rounded down number. 35268 * @example 35269 * 35270 * _.floor(4.006); 35271 * // => 4 35272 * 35273 * _.floor(0.046, 2); 35274 * // => 0.04 35275 * 35276 * _.floor(4060, -2); 35277 * // => 4000 35278 */ 35279 var floor = createRound('floor'); 35280 35281 /** 35282 * Computes the maximum value of `array`. If `array` is empty or falsey, 35283 * `undefined` is returned. 35284 * 35285 * @static 35286 * @since 0.1.0 35287 * @memberOf _ 35288 * @category Math 35289 * @param {Array} array The array to iterate over. 35290 * @returns {*} Returns the maximum value. 35291 * @example 35292 * 35293 * _.max([4, 2, 8, 6]); 35294 * // => 8 35295 * 35296 * _.max([]); 35297 * // => undefined 35298 */ 35299 function max(array) { 35300 return (array && array.length) 35301 ? baseExtremum(array, identity, baseGt) 35302 : undefined; 35303 } 35304 35305 /** 35306 * This method is like `_.max` except that it accepts `iteratee` which is 35307 * invoked for each element in `array` to generate the criterion by which 35308 * the value is ranked. The iteratee is invoked with one argument: (value). 35309 * 35310 * @static 35311 * @memberOf _ 35312 * @since 4.0.0 35313 * @category Math 35314 * @param {Array} array The array to iterate over. 35315 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35316 * @returns {*} Returns the maximum value. 35317 * @example 35318 * 35319 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 35320 * 35321 * _.maxBy(objects, function(o) { return o.n; }); 35322 * // => { 'n': 2 } 35323 * 35324 * // The `_.property` iteratee shorthand. 35325 * _.maxBy(objects, 'n'); 35326 * // => { 'n': 2 } 35327 */ 35328 function maxBy(array, iteratee) { 35329 return (array && array.length) 35330 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 35331 : undefined; 35332 } 35333 35334 /** 35335 * Computes the mean of the values in `array`. 35336 * 35337 * @static 35338 * @memberOf _ 35339 * @since 4.0.0 35340 * @category Math 35341 * @param {Array} array The array to iterate over. 35342 * @returns {number} Returns the mean. 35343 * @example 35344 * 35345 * _.mean([4, 2, 8, 6]); 35346 * // => 5 35347 */ 35348 function mean(array) { 35349 return baseMean(array, identity); 35350 } 35351 35352 /** 35353 * This method is like `_.mean` except that it accepts `iteratee` which is 35354 * invoked for each element in `array` to generate the value to be averaged. 35355 * The iteratee is invoked with one argument: (value). 35356 * 35357 * @static 35358 * @memberOf _ 35359 * @since 4.7.0 35360 * @category Math 35361 * @param {Array} array The array to iterate over. 35362 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35363 * @returns {number} Returns the mean. 35364 * @example 35365 * 35366 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 35367 * 35368 * _.meanBy(objects, function(o) { return o.n; }); 35369 * // => 5 35370 * 35371 * // The `_.property` iteratee shorthand. 35372 * _.meanBy(objects, 'n'); 35373 * // => 5 35374 */ 35375 function meanBy(array, iteratee) { 35376 return baseMean(array, getIteratee(iteratee, 2)); 35377 } 35378 35379 /** 35380 * Computes the minimum value of `array`. If `array` is empty or falsey, 35381 * `undefined` is returned. 35382 * 35383 * @static 35384 * @since 0.1.0 35385 * @memberOf _ 35386 * @category Math 35387 * @param {Array} array The array to iterate over. 35388 * @returns {*} Returns the minimum value. 35389 * @example 35390 * 35391 * _.min([4, 2, 8, 6]); 35392 * // => 2 35393 * 35394 * _.min([]); 35395 * // => undefined 35396 */ 35397 function min(array) { 35398 return (array && array.length) 35399 ? baseExtremum(array, identity, baseLt) 35400 : undefined; 35401 } 35402 35403 /** 35404 * This method is like `_.min` except that it accepts `iteratee` which is 35405 * invoked for each element in `array` to generate the criterion by which 35406 * the value is ranked. The iteratee is invoked with one argument: (value). 35407 * 35408 * @static 35409 * @memberOf _ 35410 * @since 4.0.0 35411 * @category Math 35412 * @param {Array} array The array to iterate over. 35413 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35414 * @returns {*} Returns the minimum value. 35415 * @example 35416 * 35417 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 35418 * 35419 * _.minBy(objects, function(o) { return o.n; }); 35420 * // => { 'n': 1 } 35421 * 35422 * // The `_.property` iteratee shorthand. 35423 * _.minBy(objects, 'n'); 35424 * // => { 'n': 1 } 35425 */ 35426 function minBy(array, iteratee) { 35427 return (array && array.length) 35428 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 35429 : undefined; 35430 } 35431 35432 /** 35433 * Multiply two numbers. 35434 * 35435 * @static 35436 * @memberOf _ 35437 * @since 4.7.0 35438 * @category Math 35439 * @param {number} multiplier The first number in a multiplication. 35440 * @param {number} multiplicand The second number in a multiplication. 35441 * @returns {number} Returns the product. 35442 * @example 35443 * 35444 * _.multiply(6, 4); 35445 * // => 24 35446 */ 35447 var multiply = createMathOperation(function(multiplier, multiplicand) { 35448 return multiplier * multiplicand; 35449 }, 1); 35450 35451 /** 35452 * Computes `number` rounded to `precision`. 35453 * 35454 * @static 35455 * @memberOf _ 35456 * @since 3.10.0 35457 * @category Math 35458 * @param {number} number The number to round. 35459 * @param {number} [precision=0] The precision to round to. 35460 * @returns {number} Returns the rounded number. 35461 * @example 35462 * 35463 * _.round(4.006); 35464 * // => 4 35465 * 35466 * _.round(4.006, 2); 35467 * // => 4.01 35468 * 35469 * _.round(4060, -2); 35470 * // => 4100 35471 */ 35472 var round = createRound('round'); 35473 35474 /** 35475 * Subtract two numbers. 35476 * 35477 * @static 35478 * @memberOf _ 35479 * @since 4.0.0 35480 * @category Math 35481 * @param {number} minuend The first number in a subtraction. 35482 * @param {number} subtrahend The second number in a subtraction. 35483 * @returns {number} Returns the difference. 35484 * @example 35485 * 35486 * _.subtract(6, 4); 35487 * // => 2 35488 */ 35489 var subtract = createMathOperation(function(minuend, subtrahend) { 35490 return minuend - subtrahend; 35491 }, 0); 35492 35493 /** 35494 * Computes the sum of the values in `array`. 35495 * 35496 * @static 35497 * @memberOf _ 35498 * @since 3.4.0 35499 * @category Math 35500 * @param {Array} array The array to iterate over. 35501 * @returns {number} Returns the sum. 35502 * @example 35503 * 35504 * _.sum([4, 2, 8, 6]); 35505 * // => 20 35506 */ 35507 function sum(array) { 35508 return (array && array.length) 35509 ? baseSum(array, identity) 35510 : 0; 35511 } 35512 35513 /** 35514 * This method is like `_.sum` except that it accepts `iteratee` which is 35515 * invoked for each element in `array` to generate the value to be summed. 35516 * The iteratee is invoked with one argument: (value). 35517 * 35518 * @static 35519 * @memberOf _ 35520 * @since 4.0.0 35521 * @category Math 35522 * @param {Array} array The array to iterate over. 35523 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 35524 * @returns {number} Returns the sum. 35525 * @example 35526 * 35527 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 35528 * 35529 * _.sumBy(objects, function(o) { return o.n; }); 35530 * // => 20 35531 * 35532 * // The `_.property` iteratee shorthand. 35533 * _.sumBy(objects, 'n'); 35534 * // => 20 35535 */ 35536 function sumBy(array, iteratee) { 35537 return (array && array.length) 35538 ? baseSum(array, getIteratee(iteratee, 2)) 35539 : 0; 35540 } 35541 35542 /*------------------------------------------------------------------------*/ 35543 35544 // Add methods that return wrapped values in chain sequences. 35545 lodash.after = after; 35546 lodash.ary = ary; 35547 lodash.assign = assign; 35548 lodash.assignIn = assignIn; 35549 lodash.assignInWith = assignInWith; 35550 lodash.assignWith = assignWith; 35551 lodash.at = at; 35552 lodash.before = before; 35553 lodash.bind = bind; 35554 lodash.bindAll = bindAll; 35555 lodash.bindKey = bindKey; 35556 lodash.castArray = castArray; 35557 lodash.chain = chain; 35558 lodash.chunk = chunk; 35559 lodash.compact = compact; 35560 lodash.concat = concat; 35561 lodash.cond = cond; 35562 lodash.conforms = conforms; 35563 lodash.constant = constant; 35564 lodash.countBy = countBy; 35565 lodash.create = create; 35566 lodash.curry = curry; 35567 lodash.curryRight = curryRight; 35568 lodash.debounce = debounce; 35569 lodash.defaults = defaults; 35570 lodash.defaultsDeep = defaultsDeep; 35571 lodash.defer = defer; 35572 lodash.delay = delay; 35573 lodash.difference = difference; 35574 lodash.differenceBy = differenceBy; 35575 lodash.differenceWith = differenceWith; 35576 lodash.drop = drop; 35577 lodash.dropRight = dropRight; 35578 lodash.dropRightWhile = dropRightWhile; 35579 lodash.dropWhile = dropWhile; 35580 lodash.fill = fill; 35581 lodash.filter = filter; 35582 lodash.flatMap = flatMap; 35583 lodash.flatMapDeep = flatMapDeep; 35584 lodash.flatMapDepth = flatMapDepth; 35585 lodash.flatten = flatten; 35586 lodash.flattenDeep = flattenDeep; 35587 lodash.flattenDepth = flattenDepth; 35588 lodash.flip = flip; 35589 lodash.flow = flow; 35590 lodash.flowRight = flowRight; 35591 lodash.fromPairs = fromPairs; 35592 lodash.functions = functions; 35593 lodash.functionsIn = functionsIn; 35594 lodash.groupBy = groupBy; 35595 lodash.initial = initial; 35596 lodash.intersection = intersection; 35597 lodash.intersectionBy = intersectionBy; 35598 lodash.intersectionWith = intersectionWith; 35599 lodash.invert = invert; 35600 lodash.invertBy = invertBy; 35601 lodash.invokeMap = invokeMap; 35602 lodash.iteratee = iteratee; 35603 lodash.keyBy = keyBy; 35604 lodash.keys = keys; 35605 lodash.keysIn = keysIn; 35606 lodash.map = map; 35607 lodash.mapKeys = mapKeys; 35608 lodash.mapValues = mapValues; 35609 lodash.matches = matches; 35610 lodash.matchesProperty = matchesProperty; 35611 lodash.memoize = memoize; 35612 lodash.merge = merge; 35613 lodash.mergeWith = mergeWith; 35614 lodash.method = method; 35615 lodash.methodOf = methodOf; 35616 lodash.mixin = mixin; 35617 lodash.negate = negate; 35618 lodash.nthArg = nthArg; 35619 lodash.omit = omit; 35620 lodash.omitBy = omitBy; 35621 lodash.once = once; 35622 lodash.orderBy = orderBy; 35623 lodash.over = over; 35624 lodash.overArgs = overArgs; 35625 lodash.overEvery = overEvery; 35626 lodash.overSome = overSome; 35627 lodash.partial = partial; 35628 lodash.partialRight = partialRight; 35629 lodash.partition = partition; 35630 lodash.pick = pick; 35631 lodash.pickBy = pickBy; 35632 lodash.property = property; 35633 lodash.propertyOf = propertyOf; 35634 lodash.pull = pull; 35635 lodash.pullAll = pullAll; 35636 lodash.pullAllBy = pullAllBy; 35637 lodash.pullAllWith = pullAllWith; 35638 lodash.pullAt = pullAt; 35639 lodash.range = range; 35640 lodash.rangeRight = rangeRight; 35641 lodash.rearg = rearg; 35642 lodash.reject = reject; 35643 lodash.remove = remove; 35644 lodash.rest = rest; 35645 lodash.reverse = reverse; 35646 lodash.sampleSize = sampleSize; 35647 lodash.set = set; 35648 lodash.setWith = setWith; 35649 lodash.shuffle = shuffle; 35650 lodash.slice = slice; 35651 lodash.sortBy = sortBy; 35652 lodash.sortedUniq = sortedUniq; 35653 lodash.sortedUniqBy = sortedUniqBy; 35654 lodash.split = split; 35655 lodash.spread = spread; 35656 lodash.tail = tail; 35657 lodash.take = take; 35658 lodash.takeRight = takeRight; 35659 lodash.takeRightWhile = takeRightWhile; 35660 lodash.takeWhile = takeWhile; 35661 lodash.tap = tap; 35662 lodash.throttle = throttle; 35663 lodash.thru = thru; 35664 lodash.toArray = toArray; 35665 lodash.toPairs = toPairs; 35666 lodash.toPairsIn = toPairsIn; 35667 lodash.toPath = toPath; 35668 lodash.toPlainObject = toPlainObject; 35669 lodash.transform = transform; 35670 lodash.unary = unary; 35671 lodash.union = union; 35672 lodash.unionBy = unionBy; 35673 lodash.unionWith = unionWith; 35674 lodash.uniq = uniq; 35675 lodash.uniqBy = uniqBy; 35676 lodash.uniqWith = uniqWith; 35677 lodash.unset = unset; 35678 lodash.unzip = unzip; 35679 lodash.unzipWith = unzipWith; 35680 lodash.update = update; 35681 lodash.updateWith = updateWith; 35682 lodash.values = values; 35683 lodash.valuesIn = valuesIn; 35684 lodash.without = without; 35685 lodash.words = words; 35686 lodash.wrap = wrap; 35687 lodash.xor = xor; 35688 lodash.xorBy = xorBy; 35689 lodash.xorWith = xorWith; 35690 lodash.zip = zip; 35691 lodash.zipObject = zipObject; 35692 lodash.zipObjectDeep = zipObjectDeep; 35693 lodash.zipWith = zipWith; 35694 35695 // Add aliases. 35696 lodash.entries = toPairs; 35697 lodash.entriesIn = toPairsIn; 35698 lodash.extend = assignIn; 35699 lodash.extendWith = assignInWith; 35700 35701 // Add methods to `lodash.prototype`. 35702 mixin(lodash, lodash); 35703 35704 /*------------------------------------------------------------------------*/ 35705 35706 // Add methods that return unwrapped values in chain sequences. 35707 lodash.add = add; 35708 lodash.attempt = attempt; 35709 lodash.camelCase = camelCase; 35710 lodash.capitalize = capitalize; 35711 lodash.ceil = ceil; 35712 lodash.clamp = clamp; 35713 lodash.clone = clone; 35714 lodash.cloneDeep = cloneDeep; 35715 lodash.cloneDeepWith = cloneDeepWith; 35716 lodash.cloneWith = cloneWith; 35717 lodash.conformsTo = conformsTo; 35718 lodash.deburr = deburr; 35719 lodash.defaultTo = defaultTo; 35720 lodash.divide = divide; 35721 lodash.endsWith = endsWith; 35722 lodash.eq = eq; 35723 lodash.escape = escape; 35724 lodash.escapeRegExp = escapeRegExp; 35725 lodash.every = every; 35726 lodash.find = find; 35727 lodash.findIndex = findIndex; 35728 lodash.findKey = findKey; 35729 lodash.findLast = findLast; 35730 lodash.findLastIndex = findLastIndex; 35731 lodash.findLastKey = findLastKey; 35732 lodash.floor = floor; 35733 lodash.forEach = forEach; 35734 lodash.forEachRight = forEachRight; 35735 lodash.forIn = forIn; 35736 lodash.forInRight = forInRight; 35737 lodash.forOwn = forOwn; 35738 lodash.forOwnRight = forOwnRight; 35739 lodash.get = get; 35740 lodash.gt = gt; 35741 lodash.gte = gte; 35742 lodash.has = has; 35743 lodash.hasIn = hasIn; 35744 lodash.head = head; 35745 lodash.identity = identity; 35746 lodash.includes = includes; 35747 lodash.indexOf = indexOf; 35748 lodash.inRange = inRange; 35749 lodash.invoke = invoke; 35750 lodash.isArguments = isArguments; 35751 lodash.isArray = isArray; 35752 lodash.isArrayBuffer = isArrayBuffer; 35753 lodash.isArrayLike = isArrayLike; 35754 lodash.isArrayLikeObject = isArrayLikeObject; 35755 lodash.isBoolean = isBoolean; 35756 lodash.isBuffer = isBuffer; 35757 lodash.isDate = isDate; 35758 lodash.isElement = isElement; 35759 lodash.isEmpty = isEmpty; 35760 lodash.isEqual = isEqual; 35761 lodash.isEqualWith = isEqualWith; 35762 lodash.isError = isError; 35763 lodash.isFinite = isFinite; 35764 lodash.isFunction = isFunction; 35765 lodash.isInteger = isInteger; 35766 lodash.isLength = isLength; 35767 lodash.isMap = isMap; 35768 lodash.isMatch = isMatch; 35769 lodash.isMatchWith = isMatchWith; 35770 lodash.isNaN = isNaN; 35771 lodash.isNative = isNative; 35772 lodash.isNil = isNil; 35773 lodash.isNull = isNull; 35774 lodash.isNumber = isNumber; 35775 lodash.isObject = isObject; 35776 lodash.isObjectLike = isObjectLike; 35777 lodash.isPlainObject = isPlainObject; 35778 lodash.isRegExp = isRegExp; 35779 lodash.isSafeInteger = isSafeInteger; 35780 lodash.isSet = isSet; 35781 lodash.isString = isString; 35782 lodash.isSymbol = isSymbol; 35783 lodash.isTypedArray = isTypedArray; 35784 lodash.isUndefined = isUndefined; 35785 lodash.isWeakMap = isWeakMap; 35786 lodash.isWeakSet = isWeakSet; 35787 lodash.join = join; 35788 lodash.kebabCase = kebabCase; 35789 lodash.last = last; 35790 lodash.lastIndexOf = lastIndexOf; 35791 lodash.lowerCase = lowerCase; 35792 lodash.lowerFirst = lowerFirst; 35793 lodash.lt = lt; 35794 lodash.lte = lte; 35795 lodash.max = max; 35796 lodash.maxBy = maxBy; 35797 lodash.mean = mean; 35798 lodash.meanBy = meanBy; 35799 lodash.min = min; 35800 lodash.minBy = minBy; 35801 lodash.stubArray = stubArray; 35802 lodash.stubFalse = stubFalse; 35803 lodash.stubObject = stubObject; 35804 lodash.stubString = stubString; 35805 lodash.stubTrue = stubTrue; 35806 lodash.multiply = multiply; 35807 lodash.nth = nth; 35808 lodash.noConflict = noConflict; 35809 lodash.noop = noop; 35810 lodash.now = now; 35811 lodash.pad = pad; 35812 lodash.padEnd = padEnd; 35813 lodash.padStart = padStart; 35814 lodash.parseInt = parseInt; 35815 lodash.random = random; 35816 lodash.reduce = reduce; 35817 lodash.reduceRight = reduceRight; 35818 lodash.repeat = repeat; 35819 lodash.replace = replace; 35820 lodash.result = result; 35821 lodash.round = round; 35822 lodash.runInContext = runInContext; 35823 lodash.sample = sample; 35824 lodash.size = size; 35825 lodash.snakeCase = snakeCase; 35826 lodash.some = some; 35827 lodash.sortedIndex = sortedIndex; 35828 lodash.sortedIndexBy = sortedIndexBy; 35829 lodash.sortedIndexOf = sortedIndexOf; 35830 lodash.sortedLastIndex = sortedLastIndex; 35831 lodash.sortedLastIndexBy = sortedLastIndexBy; 35832 lodash.sortedLastIndexOf = sortedLastIndexOf; 35833 lodash.startCase = startCase; 35834 lodash.startsWith = startsWith; 35835 lodash.subtract = subtract; 35836 lodash.sum = sum; 35837 lodash.sumBy = sumBy; 35838 lodash.template = template; 35839 lodash.times = times; 35840 lodash.toFinite = toFinite; 35841 lodash.toInteger = toInteger; 35842 lodash.toLength = toLength; 35843 lodash.toLower = toLower; 35844 lodash.toNumber = toNumber; 35845 lodash.toSafeInteger = toSafeInteger; 35846 lodash.toString = toString; 35847 lodash.toUpper = toUpper; 35848 lodash.trim = trim; 35849 lodash.trimEnd = trimEnd; 35850 lodash.trimStart = trimStart; 35851 lodash.truncate = truncate; 35852 lodash.unescape = unescape; 35853 lodash.uniqueId = uniqueId; 35854 lodash.upperCase = upperCase; 35855 lodash.upperFirst = upperFirst; 35856 35857 // Add aliases. 35858 lodash.each = forEach; 35859 lodash.eachRight = forEachRight; 35860 lodash.first = head; 35861 35862 mixin(lodash, (function() { 35863 var source = {}; 35864 baseForOwn(lodash, function(func, methodName) { 35865 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 35866 source[methodName] = func; 35867 } 35868 }); 35869 return source; 35870 }()), { 'chain': false }); 35871 35872 /*------------------------------------------------------------------------*/ 35873 35874 /** 35875 * The semantic version number. 35876 * 35877 * @static 35878 * @memberOf _ 35879 * @type {string} 35880 */ 35881 lodash.VERSION = VERSION; 35882 35883 // Assign default placeholders. 35884 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 35885 lodash[methodName].placeholder = lodash; 35886 }); 35887 35888 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 35889 arrayEach(['drop', 'take'], function(methodName, index) { 35890 LazyWrapper.prototype[methodName] = function(n) { 35891 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 35892 35893 var result = (this.__filtered__ && !index) 35894 ? new LazyWrapper(this) 35895 : this.clone(); 35896 35897 if (result.__filtered__) { 35898 result.__takeCount__ = nativeMin(n, result.__takeCount__); 35899 } else { 35900 result.__views__.push({ 35901 'size': nativeMin(n, MAX_ARRAY_LENGTH), 35902 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 35903 }); 35904 } 35905 return result; 35906 }; 35907 35908 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 35909 return this.reverse()[methodName](n).reverse(); 35910 }; 35911 }); 35912 35913 // Add `LazyWrapper` methods that accept an `iteratee` value. 35914 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 35915 var type = index + 1, 35916 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 35917 35918 LazyWrapper.prototype[methodName] = function(iteratee) { 35919 var result = this.clone(); 35920 result.__iteratees__.push({ 35921 'iteratee': getIteratee(iteratee, 3), 35922 'type': type 35923 }); 35924 result.__filtered__ = result.__filtered__ || isFilter; 35925 return result; 35926 }; 35927 }); 35928 35929 // Add `LazyWrapper` methods for `_.head` and `_.last`. 35930 arrayEach(['head', 'last'], function(methodName, index) { 35931 var takeName = 'take' + (index ? 'Right' : ''); 35932 35933 LazyWrapper.prototype[methodName] = function() { 35934 return this[takeName](1).value()[0]; 35935 }; 35936 }); 35937 35938 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 35939 arrayEach(['initial', 'tail'], function(methodName, index) { 35940 var dropName = 'drop' + (index ? '' : 'Right'); 35941 35942 LazyWrapper.prototype[methodName] = function() { 35943 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 35944 }; 35945 }); 35946 35947 LazyWrapper.prototype.compact = function() { 35948 return this.filter(identity); 35949 }; 35950 35951 LazyWrapper.prototype.find = function(predicate) { 35952 return this.filter(predicate).head(); 35953 }; 35954 35955 LazyWrapper.prototype.findLast = function(predicate) { 35956 return this.reverse().find(predicate); 35957 }; 35958 35959 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 35960 if (typeof path == 'function') { 35961 return new LazyWrapper(this); 35962 } 35963 return this.map(function(value) { 35964 return baseInvoke(value, path, args); 35965 }); 35966 }); 35967 35968 LazyWrapper.prototype.reject = function(predicate) { 35969 return this.filter(negate(getIteratee(predicate))); 35970 }; 35971 35972 LazyWrapper.prototype.slice = function(start, end) { 35973 start = toInteger(start); 35974 35975 var result = this; 35976 if (result.__filtered__ && (start > 0 || end < 0)) { 35977 return new LazyWrapper(result); 35978 } 35979 if (start < 0) { 35980 result = result.takeRight(-start); 35981 } else if (start) { 35982 result = result.drop(start); 35983 } 35984 if (end !== undefined) { 35985 end = toInteger(end); 35986 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 35987 } 35988 return result; 35989 }; 35990 35991 LazyWrapper.prototype.takeRightWhile = function(predicate) { 35992 return this.reverse().takeWhile(predicate).reverse(); 35993 }; 35994 35995 LazyWrapper.prototype.toArray = function() { 35996 return this.take(MAX_ARRAY_LENGTH); 35997 }; 35998 35999 // Add `LazyWrapper` methods to `lodash.prototype`. 36000 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 36001 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 36002 isTaker = /^(?:head|last)$/.test(methodName), 36003 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 36004 retUnwrapped = isTaker || /^find/.test(methodName); 36005 36006 if (!lodashFunc) { 36007 return; 36008 } 36009 lodash.prototype[methodName] = function() { 36010 var value = this.__wrapped__, 36011 args = isTaker ? [1] : arguments, 36012 isLazy = value instanceof LazyWrapper, 36013 iteratee = args[0], 36014 useLazy = isLazy || isArray(value); 36015 36016 var interceptor = function(value) { 36017 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 36018 return (isTaker && chainAll) ? result[0] : result; 36019 }; 36020 36021 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 36022 // Avoid lazy use if the iteratee has a "length" value other than `1`. 36023 isLazy = useLazy = false; 36024 } 36025 var chainAll = this.__chain__, 36026 isHybrid = !!this.__actions__.length, 36027 isUnwrapped = retUnwrapped && !chainAll, 36028 onlyLazy = isLazy && !isHybrid; 36029 36030 if (!retUnwrapped && useLazy) { 36031 value = onlyLazy ? value : new LazyWrapper(this); 36032 var result = func.apply(value, args); 36033 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 36034 return new LodashWrapper(result, chainAll); 36035 } 36036 if (isUnwrapped && onlyLazy) { 36037 return func.apply(this, args); 36038 } 36039 result = this.thru(interceptor); 36040 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 36041 }; 36042 }); 36043 36044 // Add `Array` methods to `lodash.prototype`. 36045 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 36046 var func = arrayProto[methodName], 36047 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 36048 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 36049 36050 lodash.prototype[methodName] = function() { 36051 var args = arguments; 36052 if (retUnwrapped && !this.__chain__) { 36053 var value = this.value(); 36054 return func.apply(isArray(value) ? value : [], args); 36055 } 36056 return this[chainName](function(value) { 36057 return func.apply(isArray(value) ? value : [], args); 36058 }); 36059 }; 36060 }); 36061 36062 // Map minified method names to their real names. 36063 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 36064 var lodashFunc = lodash[methodName]; 36065 if (lodashFunc) { 36066 var key = lodashFunc.name + ''; 36067 if (!hasOwnProperty.call(realNames, key)) { 36068 realNames[key] = []; 36069 } 36070 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 36071 } 36072 }); 36073 36074 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 36075 'name': 'wrapper', 36076 'func': undefined 36077 }]; 36078 36079 // Add methods to `LazyWrapper`. 36080 LazyWrapper.prototype.clone = lazyClone; 36081 LazyWrapper.prototype.reverse = lazyReverse; 36082 LazyWrapper.prototype.value = lazyValue; 36083 36084 // Add chain sequence methods to the `lodash` wrapper. 36085 lodash.prototype.at = wrapperAt; 36086 lodash.prototype.chain = wrapperChain; 36087 lodash.prototype.commit = wrapperCommit; 36088 lodash.prototype.next = wrapperNext; 36089 lodash.prototype.plant = wrapperPlant; 36090 lodash.prototype.reverse = wrapperReverse; 36091 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 36092 36093 // Add lazy aliases. 36094 lodash.prototype.first = lodash.prototype.head; 36095 36096 if (symIterator) { 36097 lodash.prototype[symIterator] = wrapperToIterator; 36098 } 36099 return lodash; 36100 }); 36101 36102 /*--------------------------------------------------------------------------*/ 36103 36104 // Export lodash. 36105 var _ = runInContext(); 36106 36107 // Some AMD build optimizers, like r.js, check for condition patterns like: 36108 if (true) { 36109 // Expose Lodash on the global object to prevent errors when Lodash is 36110 // loaded by a script tag in the presence of an AMD loader. 36111 // See http://requirejs.org/docs/errors.html#mismatch for more details. 36112 // Use `_.noConflict` to remove Lodash from the global object. 36113 root._ = _; 36114 36115 // Define as an anonymous module so, through path mapping, it can be 36116 // referenced as the "underscore" module. 36117 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 36118 return _; 36119 }).call(exports, __webpack_require__, exports, module), 36120 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 36121 } 36122 // Check for `exports` after `define` in case a build optimizer adds it. 36123 else {} 36124}.call(this)); 36125 36126/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) 36127 36128/***/ }), 36129
vendor: 404 bytes, lines 36130-36144
36130/***/ "./node_modules/react-dom/index.js": 36131/*!*****************************************!*\ 36132 !*** ./node_modules/react-dom/index.js ***! 36133 \*****************************************/ 36134/*! no static exports found */ 36135/***/ (function(module, exports, __webpack_require__) { 36136 36137"use strict"; 36138 36139 36140module.exports = __webpack_require__(/*! react/lib/ReactDOM */ "./node_modules/react/lib/ReactDOM.js"); 36141 36142 36143/***/ }), 36144
vendor: 1,310 bytes, lines 36145-36191
36145/***/ "./node_modules/react/lib/AutoFocusUtils.js": 36146/*!**************************************************!*\ 36147 !*** ./node_modules/react/lib/AutoFocusUtils.js ***! 36148 \**************************************************/ 36149/*! no static exports found */ 36150/***/ (function(module, exports, __webpack_require__) { 36151 36152"use strict"; 36153/** 36154 * Copyright 2013-2015, Facebook, Inc. 36155 * All rights reserved. 36156 * 36157 * This source code is licensed under the BSD-style license found in the 36158 * LICENSE file in the root directory of this source tree. An additional grant 36159 * of patent rights can be found in the PATENTS file in the same directory. 36160 * 36161 * @providesModule AutoFocusUtils 36162 * @typechecks static-only 36163 */ 36164 36165 36166 36167var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 36168 36169var findDOMNode = __webpack_require__(/*! ./findDOMNode */ "./node_modules/react/lib/findDOMNode.js"); 36170var focusNode = __webpack_require__(/*! fbjs/lib/focusNode */ "./node_modules/fbjs/lib/focusNode.js"); 36171 36172var Mixin = { 36173 componentDidMount: function () { 36174 if (this.props.autoFocus) { 36175 focusNode(findDOMNode(this)); 36176 } 36177 } 36178}; 36179 36180var AutoFocusUtils = { 36181 Mixin: Mixin, 36182 36183 focusDOMComponent: function () { 36184 focusNode(ReactMount.getNode(this._rootNodeID)); 36185 } 36186}; 36187 36188module.exports = AutoFocusUtils; 36189 36190/***/ }), 36191
vendor: 15,676 bytes, lines 36192-36607
36192/***/ "./node_modules/react/lib/BeforeInputEventPlugin.js": 36193/*!**********************************************************!*\ 36194 !*** ./node_modules/react/lib/BeforeInputEventPlugin.js ***! 36195 \**********************************************************/ 36196/*! no static exports found */ 36197/***/ (function(module, exports, __webpack_require__) { 36198 36199"use strict"; 36200/** 36201 * Copyright 2013-2015 Facebook, Inc. 36202 * All rights reserved. 36203 * 36204 * This source code is licensed under the BSD-style license found in the 36205 * LICENSE file in the root directory of this source tree. An additional grant 36206 * of patent rights can be found in the PATENTS file in the same directory. 36207 * 36208 * @providesModule BeforeInputEventPlugin 36209 * @typechecks static-only 36210 */ 36211 36212 36213 36214var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 36215var EventPropagators = __webpack_require__(/*! ./EventPropagators */ "./node_modules/react/lib/EventPropagators.js"); 36216var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 36217var FallbackCompositionState = __webpack_require__(/*! ./FallbackCompositionState */ "./node_modules/react/lib/FallbackCompositionState.js"); 36218var SyntheticCompositionEvent = __webpack_require__(/*! ./SyntheticCompositionEvent */ "./node_modules/react/lib/SyntheticCompositionEvent.js"); 36219var SyntheticInputEvent = __webpack_require__(/*! ./SyntheticInputEvent */ "./node_modules/react/lib/SyntheticInputEvent.js"); 36220 36221var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 36222 36223var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space 36224var START_KEYCODE = 229; 36225 36226var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; 36227 36228var documentMode = null; 36229if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { 36230 documentMode = document.documentMode; 36231} 36232 36233// Webkit offers a very useful `textInput` event that can be used to 36234// directly represent `beforeInput`. The IE `textinput` event is not as 36235// useful, so we don't use it. 36236var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); 36237 36238// In IE9+, we have access to composition events, but the data supplied 36239// by the native compositionend event may be incorrect. Japanese ideographic 36240// spaces, for instance (\u3000) are not recorded correctly. 36241var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); 36242 36243/** 36244 * Opera <= 12 includes TextEvent in window, but does not fire 36245 * text input events. Rely on keypress instead. 36246 */ 36247function isPresto() { 36248 var opera = window.opera; 36249 return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; 36250} 36251 36252var SPACEBAR_CODE = 32; 36253var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); 36254 36255var topLevelTypes = EventConstants.topLevelTypes; 36256 36257// Events and their corresponding property names. 36258var eventTypes = { 36259 beforeInput: { 36260 phasedRegistrationNames: { 36261 bubbled: keyOf({ onBeforeInput: null }), 36262 captured: keyOf({ onBeforeInputCapture: null }) 36263 }, 36264 dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste] 36265 }, 36266 compositionEnd: { 36267 phasedRegistrationNames: { 36268 bubbled: keyOf({ onCompositionEnd: null }), 36269 captured: keyOf({ onCompositionEndCapture: null }) 36270 }, 36271 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] 36272 }, 36273 compositionStart: { 36274 phasedRegistrationNames: { 36275 bubbled: keyOf({ onCompositionStart: null }), 36276 captured: keyOf({ onCompositionStartCapture: null }) 36277 }, 36278 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] 36279 }, 36280 compositionUpdate: { 36281 phasedRegistrationNames: { 36282 bubbled: keyOf({ onCompositionUpdate: null }), 36283 captured: keyOf({ onCompositionUpdateCapture: null }) 36284 }, 36285 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] 36286 } 36287}; 36288 36289// Track whether we've ever handled a keypress on the space key. 36290var hasSpaceKeypress = false; 36291 36292/** 36293 * Return whether a native keypress event is assumed to be a command. 36294 * This is required because Firefox fires `keypress` events for key commands 36295 * (cut, copy, select-all, etc.) even though no character is inserted. 36296 */ 36297function isKeypressCommand(nativeEvent) { 36298 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && 36299 // ctrlKey && altKey is equivalent to AltGr, and is not a command. 36300 !(nativeEvent.ctrlKey && nativeEvent.altKey); 36301} 36302 36303/** 36304 * Translate native top level events into event types. 36305 * 36306 * @param {string} topLevelType 36307 * @return {object} 36308 */ 36309function getCompositionEventType(topLevelType) { 36310 switch (topLevelType) { 36311 case topLevelTypes.topCompositionStart: 36312 return eventTypes.compositionStart; 36313 case topLevelTypes.topCompositionEnd: 36314 return eventTypes.compositionEnd; 36315 case topLevelTypes.topCompositionUpdate: 36316 return eventTypes.compositionUpdate; 36317 } 36318} 36319 36320/** 36321 * Does our fallback best-guess model think this event signifies that 36322 * composition has begun? 36323 * 36324 * @param {string} topLevelType 36325 * @param {object} nativeEvent 36326 * @return {boolean} 36327 */ 36328function isFallbackCompositionStart(topLevelType, nativeEvent) { 36329 return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE; 36330} 36331 36332/** 36333 * Does our fallback mode think that this event is the end of composition? 36334 * 36335 * @param {string} topLevelType 36336 * @param {object} nativeEvent 36337 * @return {boolean} 36338 */ 36339function isFallbackCompositionEnd(topLevelType, nativeEvent) { 36340 switch (topLevelType) { 36341 case topLevelTypes.topKeyUp: 36342 // Command keys insert or clear IME input. 36343 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; 36344 case topLevelTypes.topKeyDown: 36345 // Expect IME keyCode on each keydown. If we get any other 36346 // code we must have exited earlier. 36347 return nativeEvent.keyCode !== START_KEYCODE; 36348 case topLevelTypes.topKeyPress: 36349 case topLevelTypes.topMouseDown: 36350 case topLevelTypes.topBlur: 36351 // Events are not possible without cancelling IME. 36352 return true; 36353 default: 36354 return false; 36355 } 36356} 36357 36358/** 36359 * Google Input Tools provides composition data via a CustomEvent, 36360 * with the `data` property populated in the `detail` object. If this 36361 * is available on the event object, use it. If not, this is a plain 36362 * composition event and we have nothing special to extract. 36363 * 36364 * @param {object} nativeEvent 36365 * @return {?string} 36366 */ 36367function getDataFromCustomEvent(nativeEvent) { 36368 var detail = nativeEvent.detail; 36369 if (typeof detail === 'object' && 'data' in detail) { 36370 return detail.data; 36371 } 36372 return null; 36373} 36374 36375// Track the current IME composition fallback object, if any. 36376var currentComposition = null; 36377 36378/** 36379 * @param {string} topLevelType Record from `EventConstants`. 36380 * @param {DOMEventTarget} topLevelTarget The listening component root node. 36381 * @param {string} topLevelTargetID ID of `topLevelTarget`. 36382 * @param {object} nativeEvent Native browser event. 36383 * @return {?object} A SyntheticCompositionEvent. 36384 */ 36385function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 36386 var eventType; 36387 var fallbackData; 36388 36389 if (canUseCompositionEvent) { 36390 eventType = getCompositionEventType(topLevelType); 36391 } else if (!currentComposition) { 36392 if (isFallbackCompositionStart(topLevelType, nativeEvent)) { 36393 eventType = eventTypes.compositionStart; 36394 } 36395 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { 36396 eventType = eventTypes.compositionEnd; 36397 } 36398 36399 if (!eventType) { 36400 return null; 36401 } 36402 36403 if (useFallbackCompositionData) { 36404 // The current composition is stored statically and must not be 36405 // overwritten while composition continues. 36406 if (!currentComposition && eventType === eventTypes.compositionStart) { 36407 currentComposition = FallbackCompositionState.getPooled(topLevelTarget); 36408 } else if (eventType === eventTypes.compositionEnd) { 36409 if (currentComposition) { 36410 fallbackData = currentComposition.getData(); 36411 } 36412 } 36413 } 36414 36415 var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget); 36416 36417 if (fallbackData) { 36418 // Inject data generated from fallback path into the synthetic event. 36419 // This matches the property of native CompositionEventInterface. 36420 event.data = fallbackData; 36421 } else { 36422 var customData = getDataFromCustomEvent(nativeEvent); 36423 if (customData !== null) { 36424 event.data = customData; 36425 } 36426 } 36427 36428 EventPropagators.accumulateTwoPhaseDispatches(event); 36429 return event; 36430} 36431 36432/** 36433 * @param {string} topLevelType Record from `EventConstants`. 36434 * @param {object} nativeEvent Native browser event. 36435 * @return {?string} The string corresponding to this `beforeInput` event. 36436 */ 36437function getNativeBeforeInputChars(topLevelType, nativeEvent) { 36438 switch (topLevelType) { 36439 case topLevelTypes.topCompositionEnd: 36440 return getDataFromCustomEvent(nativeEvent); 36441 case topLevelTypes.topKeyPress: 36442 /** 36443 * If native `textInput` events are available, our goal is to make 36444 * use of them. However, there is a special case: the spacebar key. 36445 * In Webkit, preventing default on a spacebar `textInput` event 36446 * cancels character insertion, but it *also* causes the browser 36447 * to fall back to its default spacebar behavior of scrolling the 36448 * page. 36449 * 36450 * Tracking at: 36451 * https://code.google.com/p/chromium/issues/detail?id=355103 36452 * 36453 * To avoid this issue, use the keypress event as if no `textInput` 36454 * event is available. 36455 */ 36456 var which = nativeEvent.which; 36457 if (which !== SPACEBAR_CODE) { 36458 return null; 36459 } 36460 36461 hasSpaceKeypress = true; 36462 return SPACEBAR_CHAR; 36463 36464 case topLevelTypes.topTextInput: 36465 // Record the characters to be added to the DOM. 36466 var chars = nativeEvent.data; 36467 36468 // If it's a spacebar character, assume that we have already handled 36469 // it at the keypress level and bail immediately. Android Chrome 36470 // doesn't give us keycodes, so we need to blacklist it. 36471 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { 36472 return null; 36473 } 36474 36475 return chars; 36476 36477 default: 36478 // For other native event types, do nothing. 36479 return null; 36480 } 36481} 36482 36483/** 36484 * For browsers that do not provide the `textInput` event, extract the 36485 * appropriate string to use for SyntheticInputEvent. 36486 * 36487 * @param {string} topLevelType Record from `EventConstants`. 36488 * @param {object} nativeEvent Native browser event. 36489 * @return {?string} The fallback string for this `beforeInput` event. 36490 */ 36491function getFallbackBeforeInputChars(topLevelType, nativeEvent) { 36492 // If we are currently composing (IME) and using a fallback to do so, 36493 // try to extract the composed characters from the fallback object. 36494 if (currentComposition) { 36495 if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) { 36496 var chars = currentComposition.getData(); 36497 FallbackCompositionState.release(currentComposition); 36498 currentComposition = null; 36499 return chars; 36500 } 36501 return null; 36502 } 36503 36504 switch (topLevelType) { 36505 case topLevelTypes.topPaste: 36506 // If a paste event occurs after a keypress, throw out the input 36507 // chars. Paste events should not lead to BeforeInput events. 36508 return null; 36509 case topLevelTypes.topKeyPress: 36510 /** 36511 * As of v27, Firefox may fire keypress events even when no character 36512 * will be inserted. A few possibilities: 36513 * 36514 * - `which` is `0`. Arrow keys, Esc key, etc. 36515 * 36516 * - `which` is the pressed key code, but no char is available. 36517 * Ex: 'AltGr + d` in Polish. There is no modified character for 36518 * this key combination and no character is inserted into the 36519 * document, but FF fires the keypress for char code `100` anyway. 36520 * No `input` event will occur. 36521 * 36522 * - `which` is the pressed key code, but a command combination is 36523 * being used. Ex: `Cmd+C`. No character is inserted, and no 36524 * `input` event will occur. 36525 */ 36526 if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { 36527 return String.fromCharCode(nativeEvent.which); 36528 } 36529 return null; 36530 case topLevelTypes.topCompositionEnd: 36531 return useFallbackCompositionData ? null : nativeEvent.data; 36532 default: 36533 return null; 36534 } 36535} 36536 36537/** 36538 * Extract a SyntheticInputEvent for `beforeInput`, based on either native 36539 * `textInput` or fallback behavior. 36540 * 36541 * @param {string} topLevelType Record from `EventConstants`. 36542 * @param {DOMEventTarget} topLevelTarget The listening component root node. 36543 * @param {string} topLevelTargetID ID of `topLevelTarget`. 36544 * @param {object} nativeEvent Native browser event. 36545 * @return {?object} A SyntheticInputEvent. 36546 */ 36547function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 36548 var chars; 36549 36550 if (canUseTextInputEvent) { 36551 chars = getNativeBeforeInputChars(topLevelType, nativeEvent); 36552 } else { 36553 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); 36554 } 36555 36556 // If no characters are being inserted, no BeforeInput event should 36557 // be fired. 36558 if (!chars) { 36559 return null; 36560 } 36561 36562 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget); 36563 36564 event.data = chars; 36565 EventPropagators.accumulateTwoPhaseDispatches(event); 36566 return event; 36567} 36568 36569/** 36570 * Create an `onBeforeInput` event to match 36571 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. 36572 * 36573 * This event plugin is based on the native `textInput` event 36574 * available in Chrome, Safari, Opera, and IE. This event fires after 36575 * `onKeyPress` and `onCompositionEnd`, but before `onInput`. 36576 * 36577 * `beforeInput` is spec'd but not implemented in any browsers, and 36578 * the `input` event does not provide any useful information about what has 36579 * actually been added, contrary to the spec. Thus, `textInput` is the best 36580 * available event to identify the characters that have actually been inserted 36581 * into the target node. 36582 * 36583 * This plugin is also responsible for emitting `composition` events, thus 36584 * allowing us to share composition fallback code for both `beforeInput` and 36585 * `composition` event types. 36586 */ 36587var BeforeInputEventPlugin = { 36588 36589 eventTypes: eventTypes, 36590 36591 /** 36592 * @param {string} topLevelType Record from `EventConstants`. 36593 * @param {DOMEventTarget} topLevelTarget The listening component root node. 36594 * @param {string} topLevelTargetID ID of `topLevelTarget`. 36595 * @param {object} nativeEvent Native browser event. 36596 * @return {*} An accumulation of synthetic events. 36597 * @see {EventPluginHub.extractEvents} 36598 */ 36599 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 36600 return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)]; 36601 } 36602}; 36603 36604module.exports = BeforeInputEventPlugin; 36605 36606/***/ }), 36607
vendor: 3,810 bytes, lines 36608-36757
36608/***/ "./node_modules/react/lib/CSSProperty.js": 36609/*!***********************************************!*\ 36610 !*** ./node_modules/react/lib/CSSProperty.js ***! 36611 \***********************************************/ 36612/*! no static exports found */ 36613/***/ (function(module, exports, __webpack_require__) { 36614 36615"use strict"; 36616/** 36617 * Copyright 2013-2015, Facebook, Inc. 36618 * All rights reserved. 36619 * 36620 * This source code is licensed under the BSD-style license found in the 36621 * LICENSE file in the root directory of this source tree. An additional grant 36622 * of patent rights can be found in the PATENTS file in the same directory. 36623 * 36624 * @providesModule CSSProperty 36625 */ 36626 36627 36628 36629/** 36630 * CSS properties which accept numbers but are not in units of "px". 36631 */ 36632var isUnitlessNumber = { 36633 animationIterationCount: true, 36634 boxFlex: true, 36635 boxFlexGroup: true, 36636 boxOrdinalGroup: true, 36637 columnCount: true, 36638 flex: true, 36639 flexGrow: true, 36640 flexPositive: true, 36641 flexShrink: true, 36642 flexNegative: true, 36643 flexOrder: true, 36644 fontWeight: true, 36645 lineClamp: true, 36646 lineHeight: true, 36647 opacity: true, 36648 order: true, 36649 orphans: true, 36650 tabSize: true, 36651 widows: true, 36652 zIndex: true, 36653 zoom: true, 36654 36655 // SVG-related properties 36656 fillOpacity: true, 36657 stopOpacity: true, 36658 strokeDashoffset: true, 36659 strokeOpacity: true, 36660 strokeWidth: true 36661}; 36662 36663/** 36664 * @param {string} prefix vendor-specific prefix, eg: Webkit 36665 * @param {string} key style name, eg: transitionDuration 36666 * @return {string} style name prefixed with `prefix`, properly camelCased, eg: 36667 * WebkitTransitionDuration 36668 */ 36669function prefixKey(prefix, key) { 36670 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 36671} 36672 36673/** 36674 * Support style names that may come passed in prefixed by adding permutations 36675 * of vendor prefixes. 36676 */ 36677var prefixes = ['Webkit', 'ms', 'Moz', 'O']; 36678 36679// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an 36680// infinite loop, because it iterates over the newly added props too. 36681Object.keys(isUnitlessNumber).forEach(function (prop) { 36682 prefixes.forEach(function (prefix) { 36683 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; 36684 }); 36685}); 36686 36687/** 36688 * Most style properties can be unset by doing .style[prop] = '' but IE8 36689 * doesn't like doing that with shorthand properties so for the properties that 36690 * IE8 breaks on, which are listed here, we instead unset each of the 36691 * individual properties. See http://bugs.jquery.com/ticket/12385. 36692 * The 4-value 'clock' properties like margin, padding, border-width seem to 36693 * behave without any problems. Curiously, list-style works too without any 36694 * special prodding. 36695 */ 36696var shorthandPropertyExpansions = { 36697 background: { 36698 backgroundAttachment: true, 36699 backgroundColor: true, 36700 backgroundImage: true, 36701 backgroundPositionX: true, 36702 backgroundPositionY: true, 36703 backgroundRepeat: true 36704 }, 36705 backgroundPosition: { 36706 backgroundPositionX: true, 36707 backgroundPositionY: true 36708 }, 36709 border: { 36710 borderWidth: true, 36711 borderStyle: true, 36712 borderColor: true 36713 }, 36714 borderBottom: { 36715 borderBottomWidth: true, 36716 borderBottomStyle: true, 36717 borderBottomColor: true 36718 }, 36719 borderLeft: { 36720 borderLeftWidth: true, 36721 borderLeftStyle: true, 36722 borderLeftColor: true 36723 }, 36724 borderRight: { 36725 borderRightWidth: true, 36726 borderRightStyle: true, 36727 borderRightColor: true 36728 }, 36729 borderTop: { 36730 borderTopWidth: true, 36731 borderTopStyle: true, 36732 borderTopColor: true 36733 }, 36734 font: { 36735 fontStyle: true, 36736 fontVariant: true, 36737 fontWeight: true, 36738 fontSize: true, 36739 lineHeight: true, 36740 fontFamily: true 36741 }, 36742 outline: { 36743 outlineWidth: true, 36744 outlineStyle: true, 36745 outlineColor: true 36746 } 36747}; 36748 36749var CSSProperty = { 36750 isUnitlessNumber: isUnitlessNumber, 36751 shorthandPropertyExpansions: shorthandPropertyExpansions 36752}; 36753 36754module.exports = CSSProperty; 36755 36756/***/ }), 36757
vendor: 6,361 bytes, lines 36758-36943
36758/***/ "./node_modules/react/lib/CSSPropertyOperations.js": 36759/*!*********************************************************!*\ 36760 !*** ./node_modules/react/lib/CSSPropertyOperations.js ***! 36761 \*********************************************************/ 36762/*! no static exports found */ 36763/***/ (function(module, exports, __webpack_require__) { 36764 36765"use strict"; 36766/** 36767 * Copyright 2013-2015, Facebook, Inc. 36768 * All rights reserved. 36769 * 36770 * This source code is licensed under the BSD-style license found in the 36771 * LICENSE file in the root directory of this source tree. An additional grant 36772 * of patent rights can be found in the PATENTS file in the same directory. 36773 * 36774 * @providesModule CSSPropertyOperations 36775 * @typechecks static-only 36776 */ 36777 36778 36779 36780var CSSProperty = __webpack_require__(/*! ./CSSProperty */ "./node_modules/react/lib/CSSProperty.js"); 36781var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 36782var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 36783 36784var camelizeStyleName = __webpack_require__(/*! fbjs/lib/camelizeStyleName */ "./node_modules/fbjs/lib/camelizeStyleName.js"); 36785var dangerousStyleValue = __webpack_require__(/*! ./dangerousStyleValue */ "./node_modules/react/lib/dangerousStyleValue.js"); 36786var hyphenateStyleName = __webpack_require__(/*! fbjs/lib/hyphenateStyleName */ "./node_modules/fbjs/lib/hyphenateStyleName.js"); 36787var memoizeStringOnly = __webpack_require__(/*! fbjs/lib/memoizeStringOnly */ "./node_modules/fbjs/lib/memoizeStringOnly.js"); 36788var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 36789 36790var processStyleName = memoizeStringOnly(function (styleName) { 36791 return hyphenateStyleName(styleName); 36792}); 36793 36794var hasShorthandPropertyBug = false; 36795var styleFloatAccessor = 'cssFloat'; 36796if (ExecutionEnvironment.canUseDOM) { 36797 var tempStyle = document.createElement('div').style; 36798 try { 36799 // IE8 throws "Invalid argument." if resetting shorthand style properties. 36800 tempStyle.font = ''; 36801 } catch (e) { 36802 hasShorthandPropertyBug = true; 36803 } 36804 // IE8 only supports accessing cssFloat (standard) as styleFloat 36805 if (document.documentElement.style.cssFloat === undefined) { 36806 styleFloatAccessor = 'styleFloat'; 36807 } 36808} 36809 36810if (true) { 36811 // 'msTransform' is correct, but the other prefixes should be capitalized 36812 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; 36813 36814 // style values shouldn't contain a semicolon 36815 var badStyleValueWithSemicolonPattern = /;\s*$/; 36816 36817 var warnedStyleNames = {}; 36818 var warnedStyleValues = {}; 36819 36820 var warnHyphenatedStyleName = function (name) { 36821 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 36822 return; 36823 } 36824 36825 warnedStyleNames[name] = true; 36826 true ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined; 36827 }; 36828 36829 var warnBadVendoredStyleName = function (name) { 36830 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 36831 return; 36832 } 36833 36834 warnedStyleNames[name] = true; 36835 true ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined; 36836 }; 36837 36838 var warnStyleValueWithSemicolon = function (name, value) { 36839 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { 36840 return; 36841 } 36842 36843 warnedStyleValues[value] = true; 36844 true ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined; 36845 }; 36846 36847 /** 36848 * @param {string} name 36849 * @param {*} value 36850 */ 36851 var warnValidStyle = function (name, value) { 36852 if (name.indexOf('-') > -1) { 36853 warnHyphenatedStyleName(name); 36854 } else if (badVendoredStyleNamePattern.test(name)) { 36855 warnBadVendoredStyleName(name); 36856 } else if (badStyleValueWithSemicolonPattern.test(value)) { 36857 warnStyleValueWithSemicolon(name, value); 36858 } 36859 }; 36860} 36861 36862/** 36863 * Operations for dealing with CSS properties. 36864 */ 36865var CSSPropertyOperations = { 36866 36867 /** 36868 * Serializes a mapping of style properties for use as inline styles: 36869 * 36870 * > createMarkupForStyles({width: '200px', height: 0}) 36871 * "width:200px;height:0;" 36872 * 36873 * Undefined values are ignored so that declarative programming is easier. 36874 * The result should be HTML-escaped before insertion into the DOM. 36875 * 36876 * @param {object} styles 36877 * @return {?string} 36878 */ 36879 createMarkupForStyles: function (styles) { 36880 var serialized = ''; 36881 for (var styleName in styles) { 36882 if (!styles.hasOwnProperty(styleName)) { 36883 continue; 36884 } 36885 var styleValue = styles[styleName]; 36886 if (true) { 36887 warnValidStyle(styleName, styleValue); 36888 } 36889 if (styleValue != null) { 36890 serialized += processStyleName(styleName) + ':'; 36891 serialized += dangerousStyleValue(styleName, styleValue) + ';'; 36892 } 36893 } 36894 return serialized || null; 36895 }, 36896 36897 /** 36898 * Sets the value for multiple styles on a node. If a value is specified as 36899 * '' (empty string), the corresponding style property will be unset. 36900 * 36901 * @param {DOMElement} node 36902 * @param {object} styles 36903 */ 36904 setValueForStyles: function (node, styles) { 36905 var style = node.style; 36906 for (var styleName in styles) { 36907 if (!styles.hasOwnProperty(styleName)) { 36908 continue; 36909 } 36910 if (true) { 36911 warnValidStyle(styleName, styles[styleName]); 36912 } 36913 var styleValue = dangerousStyleValue(styleName, styles[styleName]); 36914 if (styleName === 'float') { 36915 styleName = styleFloatAccessor; 36916 } 36917 if (styleValue) { 36918 style[styleName] = styleValue; 36919 } else { 36920 var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; 36921 if (expansion) { 36922 // Shorthand property that IE8 won't like unsetting, so unset each 36923 // component to placate it 36924 for (var individualStyleName in expansion) { 36925 style[individualStyleName] = ''; 36926 } 36927 } else { 36928 style[styleName] = ''; 36929 } 36930 } 36931 } 36932 } 36933 36934}; 36935 36936ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', { 36937 setValueForStyles: 'setValueForStyles' 36938}); 36939 36940module.exports = CSSPropertyOperations; 36941 36942/***/ }), 36943
vendor: 2,890 bytes, lines 36944-37047
36944/***/ "./node_modules/react/lib/CallbackQueue.js": 36945/*!*************************************************!*\ 36946 !*** ./node_modules/react/lib/CallbackQueue.js ***! 36947 \*************************************************/ 36948/*! no static exports found */ 36949/***/ (function(module, exports, __webpack_require__) { 36950 36951"use strict"; 36952/** 36953 * Copyright 2013-2015, Facebook, Inc. 36954 * All rights reserved. 36955 * 36956 * This source code is licensed under the BSD-style license found in the 36957 * LICENSE file in the root directory of this source tree. An additional grant 36958 * of patent rights can be found in the PATENTS file in the same directory. 36959 * 36960 * @providesModule CallbackQueue 36961 */ 36962 36963 36964 36965var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 36966 36967var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 36968var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 36969 36970/** 36971 * A specialized pseudo-event module to help keep track of components waiting to 36972 * be notified when their DOM representations are available for use. 36973 * 36974 * This implements `PooledClass`, so you should never need to instantiate this. 36975 * Instead, use `CallbackQueue.getPooled()`. 36976 * 36977 * @class ReactMountReady 36978 * @implements PooledClass 36979 * @internal 36980 */ 36981function CallbackQueue() { 36982 this._callbacks = null; 36983 this._contexts = null; 36984} 36985 36986assign(CallbackQueue.prototype, { 36987 36988 /** 36989 * Enqueues a callback to be invoked when `notifyAll` is invoked. 36990 * 36991 * @param {function} callback Invoked when `notifyAll` is invoked. 36992 * @param {?object} context Context to call `callback` with. 36993 * @internal 36994 */ 36995 enqueue: function (callback, context) { 36996 this._callbacks = this._callbacks || []; 36997 this._contexts = this._contexts || []; 36998 this._callbacks.push(callback); 36999 this._contexts.push(context); 37000 }, 37001 37002 /** 37003 * Invokes all enqueued callbacks and clears the queue. This is invoked after 37004 * the DOM representation of a component has been created or updated. 37005 * 37006 * @internal 37007 */ 37008 notifyAll: function () { 37009 var callbacks = this._callbacks; 37010 var contexts = this._contexts; 37011 if (callbacks) { 37012 !(callbacks.length === contexts.length) ? true ? invariant(false, 'Mismatched list of contexts in callback queue') : undefined : undefined; 37013 this._callbacks = null; 37014 this._contexts = null; 37015 for (var i = 0; i < callbacks.length; i++) { 37016 callbacks[i].call(contexts[i]); 37017 } 37018 callbacks.length = 0; 37019 contexts.length = 0; 37020 } 37021 }, 37022 37023 /** 37024 * Resets the internal queue. 37025 * 37026 * @internal 37027 */ 37028 reset: function () { 37029 this._callbacks = null; 37030 this._contexts = null; 37031 }, 37032 37033 /** 37034 * `PooledClass` looks for this. 37035 */ 37036 destructor: function () { 37037 this.reset(); 37038 } 37039 37040}); 37041 37042PooledClass.addPoolingTo(CallbackQueue); 37043 37044module.exports = CallbackQueue; 37045 37046/***/ }), 37047
vendor: 12,455 bytes, lines 37048-37379
37048/***/ "./node_modules/react/lib/ChangeEventPlugin.js": 37049/*!*****************************************************!*\ 37050 !*** ./node_modules/react/lib/ChangeEventPlugin.js ***! 37051 \*****************************************************/ 37052/*! no static exports found */ 37053/***/ (function(module, exports, __webpack_require__) { 37054 37055"use strict"; 37056/** 37057 * Copyright 2013-2015, Facebook, Inc. 37058 * All rights reserved. 37059 * 37060 * This source code is licensed under the BSD-style license found in the 37061 * LICENSE file in the root directory of this source tree. An additional grant 37062 * of patent rights can be found in the PATENTS file in the same directory. 37063 * 37064 * @providesModule ChangeEventPlugin 37065 */ 37066 37067 37068 37069var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 37070var EventPluginHub = __webpack_require__(/*! ./EventPluginHub */ "./node_modules/react/lib/EventPluginHub.js"); 37071var EventPropagators = __webpack_require__(/*! ./EventPropagators */ "./node_modules/react/lib/EventPropagators.js"); 37072var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 37073var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 37074var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 37075 37076var getEventTarget = __webpack_require__(/*! ./getEventTarget */ "./node_modules/react/lib/getEventTarget.js"); 37077var isEventSupported = __webpack_require__(/*! ./isEventSupported */ "./node_modules/react/lib/isEventSupported.js"); 37078var isTextInputElement = __webpack_require__(/*! ./isTextInputElement */ "./node_modules/react/lib/isTextInputElement.js"); 37079var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 37080 37081var topLevelTypes = EventConstants.topLevelTypes; 37082 37083var eventTypes = { 37084 change: { 37085 phasedRegistrationNames: { 37086 bubbled: keyOf({ onChange: null }), 37087 captured: keyOf({ onChangeCapture: null }) 37088 }, 37089 dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange] 37090 } 37091}; 37092 37093/** 37094 * For IE shims 37095 */ 37096var activeElement = null; 37097var activeElementID = null; 37098var activeElementValue = null; 37099var activeElementValueProp = null; 37100 37101/** 37102 * SECTION: handle `change` event 37103 */ 37104function shouldUseChangeEvent(elem) { 37105 var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); 37106 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; 37107} 37108 37109var doesChangeEventBubble = false; 37110if (ExecutionEnvironment.canUseDOM) { 37111 // See `handleChange` comment below 37112 doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8); 37113} 37114 37115function manualDispatchChangeEvent(nativeEvent) { 37116 var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent)); 37117 EventPropagators.accumulateTwoPhaseDispatches(event); 37118 37119 // If change and propertychange bubbled, we'd just bind to it like all the 37120 // other events and have it go through ReactBrowserEventEmitter. Since it 37121 // doesn't, we manually listen for the events and so we have to enqueue and 37122 // process the abstract event manually. 37123 // 37124 // Batching is necessary here in order to ensure that all event handlers run 37125 // before the next rerender (including event handlers attached to ancestor 37126 // elements instead of directly on the input). Without this, controlled 37127 // components don't work properly in conjunction with event bubbling because 37128 // the component is rerendered and the value reverted before all the event 37129 // handlers can run. See https://github.com/facebook/react/issues/708. 37130 ReactUpdates.batchedUpdates(runEventInBatch, event); 37131} 37132 37133function runEventInBatch(event) { 37134 EventPluginHub.enqueueEvents(event); 37135 EventPluginHub.processEventQueue(false); 37136} 37137 37138function startWatchingForChangeEventIE8(target, targetID) { 37139 activeElement = target; 37140 activeElementID = targetID; 37141 activeElement.attachEvent('onchange', manualDispatchChangeEvent); 37142} 37143 37144function stopWatchingForChangeEventIE8() { 37145 if (!activeElement) { 37146 return; 37147 } 37148 activeElement.detachEvent('onchange', manualDispatchChangeEvent); 37149 activeElement = null; 37150 activeElementID = null; 37151} 37152 37153function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) { 37154 if (topLevelType === topLevelTypes.topChange) { 37155 return topLevelTargetID; 37156 } 37157} 37158function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) { 37159 if (topLevelType === topLevelTypes.topFocus) { 37160 // stopWatching() should be a noop here but we call it just in case we 37161 // missed a blur event somehow. 37162 stopWatchingForChangeEventIE8(); 37163 startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); 37164 } else if (topLevelType === topLevelTypes.topBlur) { 37165 stopWatchingForChangeEventIE8(); 37166 } 37167} 37168 37169/** 37170 * SECTION: handle `input` event 37171 */ 37172var isInputEventSupported = false; 37173if (ExecutionEnvironment.canUseDOM) { 37174 // IE9 claims to support the input event but fails to trigger it when 37175 // deleting text, so we ignore its input events 37176 isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9); 37177} 37178 37179/** 37180 * (For old IE.) Replacement getter/setter for the `value` property that gets 37181 * set on the active element. 37182 */ 37183var newValueProp = { 37184 get: function () { 37185 return activeElementValueProp.get.call(this); 37186 }, 37187 set: function (val) { 37188 // Cast to a string so we can do equality checks. 37189 activeElementValue = '' + val; 37190 activeElementValueProp.set.call(this, val); 37191 } 37192}; 37193 37194/** 37195 * (For old IE.) Starts tracking propertychange events on the passed-in element 37196 * and override the value property so that we can distinguish user events from 37197 * value changes in JS. 37198 */ 37199function startWatchingForValueChange(target, targetID) { 37200 activeElement = target; 37201 activeElementID = targetID; 37202 activeElementValue = target.value; 37203 activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); 37204 37205 // Not guarded in a canDefineProperty check: IE8 supports defineProperty only 37206 // on DOM elements 37207 Object.defineProperty(activeElement, 'value', newValueProp); 37208 activeElement.attachEvent('onpropertychange', handlePropertyChange); 37209} 37210 37211/** 37212 * (For old IE.) Removes the event listeners from the currently-tracked element, 37213 * if any exists. 37214 */ 37215function stopWatchingForValueChange() { 37216 if (!activeElement) { 37217 return; 37218 } 37219 37220 // delete restores the original property definition 37221 delete activeElement.value; 37222 activeElement.detachEvent('onpropertychange', handlePropertyChange); 37223 37224 activeElement = null; 37225 activeElementID = null; 37226 activeElementValue = null; 37227 activeElementValueProp = null; 37228} 37229 37230/** 37231 * (For old IE.) Handles a propertychange event, sending a `change` event if 37232 * the value of the active element has changed. 37233 */ 37234function handlePropertyChange(nativeEvent) { 37235 if (nativeEvent.propertyName !== 'value') { 37236 return; 37237 } 37238 var value = nativeEvent.srcElement.value; 37239 if (value === activeElementValue) { 37240 return; 37241 } 37242 activeElementValue = value; 37243 37244 manualDispatchChangeEvent(nativeEvent); 37245} 37246 37247/** 37248 * If a `change` event should be fired, returns the target's ID. 37249 */ 37250function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) { 37251 if (topLevelType === topLevelTypes.topInput) { 37252 // In modern browsers (i.e., not IE8 or IE9), the input event is exactly 37253 // what we want so fall through here and trigger an abstract event 37254 return topLevelTargetID; 37255 } 37256} 37257 37258// For IE8 and IE9. 37259function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { 37260 if (topLevelType === topLevelTypes.topFocus) { 37261 // In IE8, we can capture almost all .value changes by adding a 37262 // propertychange handler and looking for events with propertyName 37263 // equal to 'value' 37264 // In IE9, propertychange fires for most input events but is buggy and 37265 // doesn't fire when text is deleted, but conveniently, selectionchange 37266 // appears to fire in all of the remaining cases so we catch those and 37267 // forward the event if the value has changed 37268 // In either case, we don't want to call the event handler if the value 37269 // is changed from JS so we redefine a setter for `.value` that updates 37270 // our activeElementValue variable, allowing us to ignore those changes 37271 // 37272 // stopWatching() should be a noop here but we call it just in case we 37273 // missed a blur event somehow. 37274 stopWatchingForValueChange(); 37275 startWatchingForValueChange(topLevelTarget, topLevelTargetID); 37276 } else if (topLevelType === topLevelTypes.topBlur) { 37277 stopWatchingForValueChange(); 37278 } 37279} 37280 37281// For IE8 and IE9. 37282function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { 37283 if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { 37284 // On the selectionchange event, the target is just document which isn't 37285 // helpful for us so just check activeElement instead. 37286 // 37287 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire 37288 // propertychange on the first input event after setting `value` from a 37289 // script and fires only keydown, keypress, keyup. Catching keyup usually 37290 // gets it and catching keydown lets us fire an event for the first 37291 // keystroke if user does a key repeat (it'll be a little delayed: right 37292 // before the second keystroke). Other input methods (e.g., paste) seem to 37293 // fire selectionchange normally. 37294 if (activeElement && activeElement.value !== activeElementValue) { 37295 activeElementValue = activeElement.value; 37296 return activeElementID; 37297 } 37298 } 37299} 37300 37301/** 37302 * SECTION: handle `click` event 37303 */ 37304function shouldUseClickEvent(elem) { 37305 // Use the `click` event to detect changes to checkbox and radio inputs. 37306 // This approach works across all browsers, whereas `change` does not fire 37307 // until `blur` in IE8. 37308 return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); 37309} 37310 37311function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) { 37312 if (topLevelType === topLevelTypes.topClick) { 37313 return topLevelTargetID; 37314 } 37315} 37316 37317/** 37318 * This plugin creates an `onChange` event that normalizes change events 37319 * across form elements. This event fires at a time when it's possible to 37320 * change the element's value without seeing a flicker. 37321 * 37322 * Supported elements are: 37323 * - input (see `isTextInputElement`) 37324 * - textarea 37325 * - select 37326 */ 37327var ChangeEventPlugin = { 37328 37329 eventTypes: eventTypes, 37330 37331 /** 37332 * @param {string} topLevelType Record from `EventConstants`. 37333 * @param {DOMEventTarget} topLevelTarget The listening component root node. 37334 * @param {string} topLevelTargetID ID of `topLevelTarget`. 37335 * @param {object} nativeEvent Native browser event. 37336 * @return {*} An accumulation of synthetic events. 37337 * @see {EventPluginHub.extractEvents} 37338 */ 37339 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 37340 37341 var getTargetIDFunc, handleEventFunc; 37342 if (shouldUseChangeEvent(topLevelTarget)) { 37343 if (doesChangeEventBubble) { 37344 getTargetIDFunc = getTargetIDForChangeEvent; 37345 } else { 37346 handleEventFunc = handleEventsForChangeEventIE8; 37347 } 37348 } else if (isTextInputElement(topLevelTarget)) { 37349 if (isInputEventSupported) { 37350 getTargetIDFunc = getTargetIDForInputEvent; 37351 } else { 37352 getTargetIDFunc = getTargetIDForInputEventIE; 37353 handleEventFunc = handleEventsForInputEventIE; 37354 } 37355 } else if (shouldUseClickEvent(topLevelTarget)) { 37356 getTargetIDFunc = getTargetIDForClickEvent; 37357 } 37358 37359 if (getTargetIDFunc) { 37360 var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID); 37361 if (targetID) { 37362 var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget); 37363 event.type = 'change'; 37364 EventPropagators.accumulateTwoPhaseDispatches(event); 37365 return event; 37366 } 37367 } 37368 37369 if (handleEventFunc) { 37370 handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID); 37371 } 37372 } 37373 37374}; 37375 37376module.exports = ChangeEventPlugin; 37377 37378/***/ }), 37379
vendor: 896 bytes, lines 37380-37413
37380/***/ "./node_modules/react/lib/ClientReactRootIndex.js": 37381/*!********************************************************!*\ 37382 !*** ./node_modules/react/lib/ClientReactRootIndex.js ***! 37383 \********************************************************/ 37384/*! no static exports found */ 37385/***/ (function(module, exports, __webpack_require__) { 37386 37387"use strict"; 37388/** 37389 * Copyright 2013-2015, Facebook, Inc. 37390 * All rights reserved. 37391 * 37392 * This source code is licensed under the BSD-style license found in the 37393 * LICENSE file in the root directory of this source tree. An additional grant 37394 * of patent rights can be found in the PATENTS file in the same directory. 37395 * 37396 * @providesModule ClientReactRootIndex 37397 * @typechecks 37398 */ 37399 37400 37401 37402var nextReactRootIndex = 0; 37403 37404var ClientReactRootIndex = { 37405 createReactRootIndex: function () { 37406 return nextReactRootIndex++; 37407 } 37408}; 37409 37410module.exports = ClientReactRootIndex; 37411 37412/***/ }), 37413
vendor: 5,669 bytes, lines 37414-37553
37414/***/ "./node_modules/react/lib/DOMChildrenOperations.js": 37415/*!*********************************************************!*\ 37416 !*** ./node_modules/react/lib/DOMChildrenOperations.js ***! 37417 \*********************************************************/ 37418/*! no static exports found */ 37419/***/ (function(module, exports, __webpack_require__) { 37420 37421"use strict"; 37422/** 37423 * Copyright 2013-2015, Facebook, Inc. 37424 * All rights reserved. 37425 * 37426 * This source code is licensed under the BSD-style license found in the 37427 * LICENSE file in the root directory of this source tree. An additional grant 37428 * of patent rights can be found in the PATENTS file in the same directory. 37429 * 37430 * @providesModule DOMChildrenOperations 37431 * @typechecks static-only 37432 */ 37433 37434 37435 37436var Danger = __webpack_require__(/*! ./Danger */ "./node_modules/react/lib/Danger.js"); 37437var ReactMultiChildUpdateTypes = __webpack_require__(/*! ./ReactMultiChildUpdateTypes */ "./node_modules/react/lib/ReactMultiChildUpdateTypes.js"); 37438var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 37439 37440var setInnerHTML = __webpack_require__(/*! ./setInnerHTML */ "./node_modules/react/lib/setInnerHTML.js"); 37441var setTextContent = __webpack_require__(/*! ./setTextContent */ "./node_modules/react/lib/setTextContent.js"); 37442var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 37443 37444/** 37445 * Inserts `childNode` as a child of `parentNode` at the `index`. 37446 * 37447 * @param {DOMElement} parentNode Parent node in which to insert. 37448 * @param {DOMElement} childNode Child node to insert. 37449 * @param {number} index Index at which to insert the child. 37450 * @internal 37451 */ 37452function insertChildAt(parentNode, childNode, index) { 37453 // By exploiting arrays returning `undefined` for an undefined index, we can 37454 // rely exclusively on `insertBefore(node, null)` instead of also using 37455 // `appendChild(node)`. However, using `undefined` is not allowed by all 37456 // browsers so we must replace it with `null`. 37457 37458 // fix render order error in safari 37459 // IE8 will throw error when index out of list size. 37460 var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index); 37461 37462 parentNode.insertBefore(childNode, beforeChild); 37463} 37464 37465/** 37466 * Operations for updating with DOM children. 37467 */ 37468var DOMChildrenOperations = { 37469 37470 dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, 37471 37472 updateTextContent: setTextContent, 37473 37474 /** 37475 * Updates a component's children by processing a series of updates. The 37476 * update configurations are each expected to have a `parentNode` property. 37477 * 37478 * @param {array<object>} updates List of update configurations. 37479 * @param {array<string>} markupList List of markup strings. 37480 * @internal 37481 */ 37482 processUpdates: function (updates, markupList) { 37483 var update; 37484 // Mapping from parent IDs to initial child orderings. 37485 var initialChildren = null; 37486 // List of children that will be moved or removed. 37487 var updatedChildren = null; 37488 37489 for (var i = 0; i < updates.length; i++) { 37490 update = updates[i]; 37491 if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { 37492 var updatedIndex = update.fromIndex; 37493 var updatedChild = update.parentNode.childNodes[updatedIndex]; 37494 var parentID = update.parentID; 37495 37496 !updatedChild ? true ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : undefined : undefined; 37497 37498 initialChildren = initialChildren || {}; 37499 initialChildren[parentID] = initialChildren[parentID] || []; 37500 initialChildren[parentID][updatedIndex] = updatedChild; 37501 37502 updatedChildren = updatedChildren || []; 37503 updatedChildren.push(updatedChild); 37504 } 37505 } 37506 37507 var renderedMarkup; 37508 // markupList is either a list of markup or just a list of elements 37509 if (markupList.length && typeof markupList[0] === 'string') { 37510 renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); 37511 } else { 37512 renderedMarkup = markupList; 37513 } 37514 37515 // Remove updated children first so that `toIndex` is consistent. 37516 if (updatedChildren) { 37517 for (var j = 0; j < updatedChildren.length; j++) { 37518 updatedChildren[j].parentNode.removeChild(updatedChildren[j]); 37519 } 37520 } 37521 37522 for (var k = 0; k < updates.length; k++) { 37523 update = updates[k]; 37524 switch (update.type) { 37525 case ReactMultiChildUpdateTypes.INSERT_MARKUP: 37526 insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); 37527 break; 37528 case ReactMultiChildUpdateTypes.MOVE_EXISTING: 37529 insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); 37530 break; 37531 case ReactMultiChildUpdateTypes.SET_MARKUP: 37532 setInnerHTML(update.parentNode, update.content); 37533 break; 37534 case ReactMultiChildUpdateTypes.TEXT_CONTENT: 37535 setTextContent(update.parentNode, update.content); 37536 break; 37537 case ReactMultiChildUpdateTypes.REMOVE_NODE: 37538 // Already removed by the for-loop above. 37539 break; 37540 } 37541 } 37542 } 37543 37544}; 37545 37546ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { 37547 updateTextContent: 'updateTextContent' 37548}); 37549 37550module.exports = DOMChildrenOperations; 37551 37552/***/ }), 37553
vendor: 9,687 bytes, lines 37554-37798
37554/***/ "./node_modules/react/lib/DOMProperty.js": 37555/*!***********************************************!*\ 37556 !*** ./node_modules/react/lib/DOMProperty.js ***! 37557 \***********************************************/ 37558/*! no static exports found */ 37559/***/ (function(module, exports, __webpack_require__) { 37560 37561"use strict"; 37562/** 37563 * Copyright 2013-2015, Facebook, Inc. 37564 * All rights reserved. 37565 * 37566 * This source code is licensed under the BSD-style license found in the 37567 * LICENSE file in the root directory of this source tree. An additional grant 37568 * of patent rights can be found in the PATENTS file in the same directory. 37569 * 37570 * @providesModule DOMProperty 37571 * @typechecks static-only 37572 */ 37573 37574 37575 37576var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 37577 37578function checkMask(value, bitmask) { 37579 return (value & bitmask) === bitmask; 37580} 37581 37582var DOMPropertyInjection = { 37583 /** 37584 * Mapping from normalized, camelcased property names to a configuration that 37585 * specifies how the associated DOM property should be accessed or rendered. 37586 */ 37587 MUST_USE_ATTRIBUTE: 0x1, 37588 MUST_USE_PROPERTY: 0x2, 37589 HAS_SIDE_EFFECTS: 0x4, 37590 HAS_BOOLEAN_VALUE: 0x8, 37591 HAS_NUMERIC_VALUE: 0x10, 37592 HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10, 37593 HAS_OVERLOADED_BOOLEAN_VALUE: 0x40, 37594 37595 /** 37596 * Inject some specialized knowledge about the DOM. This takes a config object 37597 * with the following properties: 37598 * 37599 * isCustomAttribute: function that given an attribute name will return true 37600 * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* 37601 * attributes where it's impossible to enumerate all of the possible 37602 * attribute names, 37603 * 37604 * Properties: object mapping DOM property name to one of the 37605 * DOMPropertyInjection constants or null. If your attribute isn't in here, 37606 * it won't get written to the DOM. 37607 * 37608 * DOMAttributeNames: object mapping React attribute name to the DOM 37609 * attribute name. Attribute names not specified use the **lowercase** 37610 * normalized name. 37611 * 37612 * DOMAttributeNamespaces: object mapping React attribute name to the DOM 37613 * attribute namespace URL. (Attribute names not specified use no namespace.) 37614 * 37615 * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. 37616 * Property names not specified use the normalized name. 37617 * 37618 * DOMMutationMethods: Properties that require special mutation methods. If 37619 * `value` is undefined, the mutation method should unset the property. 37620 * 37621 * @param {object} domPropertyConfig the config as described above. 37622 */ 37623 injectDOMPropertyConfig: function (domPropertyConfig) { 37624 var Injection = DOMPropertyInjection; 37625 var Properties = domPropertyConfig.Properties || {}; 37626 var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; 37627 var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; 37628 var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; 37629 var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; 37630 37631 if (domPropertyConfig.isCustomAttribute) { 37632 DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); 37633 } 37634 37635 for (var propName in Properties) { 37636 !!DOMProperty.properties.hasOwnProperty(propName) ? true ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : undefined : undefined; 37637 37638 var lowerCased = propName.toLowerCase(); 37639 var propConfig = Properties[propName]; 37640 37641 var propertyInfo = { 37642 attributeName: lowerCased, 37643 attributeNamespace: null, 37644 propertyName: propName, 37645 mutationMethod: null, 37646 37647 mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE), 37648 mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), 37649 hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS), 37650 hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), 37651 hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), 37652 hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), 37653 hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) 37654 }; 37655 37656 !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? true ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : undefined : undefined; 37657 !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? true ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : undefined : undefined; 37658 !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? true ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : undefined : undefined; 37659 37660 if (true) { 37661 DOMProperty.getPossibleStandardName[lowerCased] = propName; 37662 } 37663 37664 if (DOMAttributeNames.hasOwnProperty(propName)) { 37665 var attributeName = DOMAttributeNames[propName]; 37666 propertyInfo.attributeName = attributeName; 37667 if (true) { 37668 DOMProperty.getPossibleStandardName[attributeName] = propName; 37669 } 37670 } 37671 37672 if (DOMAttributeNamespaces.hasOwnProperty(propName)) { 37673 propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; 37674 } 37675 37676 if (DOMPropertyNames.hasOwnProperty(propName)) { 37677 propertyInfo.propertyName = DOMPropertyNames[propName]; 37678 } 37679 37680 if (DOMMutationMethods.hasOwnProperty(propName)) { 37681 propertyInfo.mutationMethod = DOMMutationMethods[propName]; 37682 } 37683 37684 DOMProperty.properties[propName] = propertyInfo; 37685 } 37686 } 37687}; 37688var defaultValueCache = {}; 37689 37690/** 37691 * DOMProperty exports lookup objects that can be used like functions: 37692 * 37693 * > DOMProperty.isValid['id'] 37694 * true 37695 * > DOMProperty.isValid['foobar'] 37696 * undefined 37697 * 37698 * Although this may be confusing, it performs better in general. 37699 * 37700 * @see http://jsperf.com/key-exists 37701 * @see http://jsperf.com/key-missing 37702 */ 37703var DOMProperty = { 37704 37705 ID_ATTRIBUTE_NAME: 'data-reactid', 37706 37707 /** 37708 * Map from property "standard name" to an object with info about how to set 37709 * the property in the DOM. Each object contains: 37710 * 37711 * attributeName: 37712 * Used when rendering markup or with `*Attribute()`. 37713 * attributeNamespace 37714 * propertyName: 37715 * Used on DOM node instances. (This includes properties that mutate due to 37716 * external factors.) 37717 * mutationMethod: 37718 * If non-null, used instead of the property or `setAttribute()` after 37719 * initial render. 37720 * mustUseAttribute: 37721 * Whether the property must be accessed and mutated using `*Attribute()`. 37722 * (This includes anything that fails `<propName> in <element>`.) 37723 * mustUseProperty: 37724 * Whether the property must be accessed and mutated as an object property. 37725 * hasSideEffects: 37726 * Whether or not setting a value causes side effects such as triggering 37727 * resources to be loaded or text selection changes. If true, we read from 37728 * the DOM before updating to ensure that the value is only set if it has 37729 * changed. 37730 * hasBooleanValue: 37731 * Whether the property should be removed when set to a falsey value. 37732 * hasNumericValue: 37733 * Whether the property must be numeric or parse as a numeric and should be 37734 * removed when set to a falsey value. 37735 * hasPositiveNumericValue: 37736 * Whether the property must be positive numeric or parse as a positive 37737 * numeric and should be removed when set to a falsey value. 37738 * hasOverloadedBooleanValue: 37739 * Whether the property can be used as a flag as well as with a value. 37740 * Removed when strictly equal to false; present without a value when 37741 * strictly equal to true; present with a value otherwise. 37742 */ 37743 properties: {}, 37744 37745 /** 37746 * Mapping from lowercase property names to the properly cased version, used 37747 * to warn in the case of missing properties. Available only in __DEV__. 37748 * @type {Object} 37749 */ 37750 getPossibleStandardName: true ? {} : undefined, 37751 37752 /** 37753 * All of the isCustomAttribute() functions that have been injected. 37754 */ 37755 _isCustomAttributeFunctions: [], 37756 37757 /** 37758 * Checks whether a property name is a custom attribute. 37759 * @method 37760 */ 37761 isCustomAttribute: function (attributeName) { 37762 for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { 37763 var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; 37764 if (isCustomAttributeFn(attributeName)) { 37765 return true; 37766 } 37767 } 37768 return false; 37769 }, 37770 37771 /** 37772 * Returns the default property value for a DOM property (i.e., not an 37773 * attribute). Most default values are '' or false, but not all. Worse yet, 37774 * some (in particular, `type`) vary depending on the type of element. 37775 * 37776 * TODO: Is it better to grab all the possible properties when creating an 37777 * element to avoid having to create the same element twice? 37778 */ 37779 getDefaultValueForProperty: function (nodeName, prop) { 37780 var nodeDefaults = defaultValueCache[nodeName]; 37781 var testElement; 37782 if (!nodeDefaults) { 37783 defaultValueCache[nodeName] = nodeDefaults = {}; 37784 } 37785 if (!(prop in nodeDefaults)) { 37786 testElement = document.createElement(nodeName); 37787 nodeDefaults[prop] = testElement[prop]; 37788 } 37789 return nodeDefaults[prop]; 37790 }, 37791 37792 injection: DOMPropertyInjection 37793}; 37794 37795module.exports = DOMProperty; 37796 37797/***/ }), 37798
vendor: 8,280 bytes, lines 37799-38034
37799/***/ "./node_modules/react/lib/DOMPropertyOperations.js": 37800/*!*********************************************************!*\ 37801 !*** ./node_modules/react/lib/DOMPropertyOperations.js ***! 37802 \*********************************************************/ 37803/*! no static exports found */ 37804/***/ (function(module, exports, __webpack_require__) { 37805 37806"use strict"; 37807/** 37808 * Copyright 2013-2015, Facebook, Inc. 37809 * All rights reserved. 37810 * 37811 * This source code is licensed under the BSD-style license found in the 37812 * LICENSE file in the root directory of this source tree. An additional grant 37813 * of patent rights can be found in the PATENTS file in the same directory. 37814 * 37815 * @providesModule DOMPropertyOperations 37816 * @typechecks static-only 37817 */ 37818 37819 37820 37821var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 37822var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 37823 37824var quoteAttributeValueForBrowser = __webpack_require__(/*! ./quoteAttributeValueForBrowser */ "./node_modules/react/lib/quoteAttributeValueForBrowser.js"); 37825var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 37826 37827// Simplified subset 37828var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/; 37829var illegalAttributeNameCache = {}; 37830var validatedAttributeNameCache = {}; 37831 37832function isAttributeNameSafe(attributeName) { 37833 if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { 37834 return true; 37835 } 37836 if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { 37837 return false; 37838 } 37839 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { 37840 validatedAttributeNameCache[attributeName] = true; 37841 return true; 37842 } 37843 illegalAttributeNameCache[attributeName] = true; 37844 true ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined; 37845 return false; 37846} 37847 37848function shouldIgnoreValue(propertyInfo, value) { 37849 return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; 37850} 37851 37852if (true) { 37853 var reactProps = { 37854 children: true, 37855 dangerouslySetInnerHTML: true, 37856 key: true, 37857 ref: true 37858 }; 37859 var warnedProperties = {}; 37860 37861 var warnUnknownProperty = function (name) { 37862 if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { 37863 return; 37864 } 37865 37866 warnedProperties[name] = true; 37867 var lowerCasedName = name.toLowerCase(); 37868 37869 // data-* attributes should be lowercase; suggest the lowercase version 37870 var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; 37871 37872 // For now, only warn when we have a suggested correction. This prevents 37873 // logging too much when using transferPropsTo. 37874 true ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined; 37875 }; 37876} 37877 37878/** 37879 * Operations for dealing with DOM properties. 37880 */ 37881var DOMPropertyOperations = { 37882 37883 /** 37884 * Creates markup for the ID property. 37885 * 37886 * @param {string} id Unescaped ID. 37887 * @return {string} Markup string. 37888 */ 37889 createMarkupForID: function (id) { 37890 return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); 37891 }, 37892 37893 setAttributeForID: function (node, id) { 37894 node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); 37895 }, 37896 37897 /** 37898 * Creates markup for a property. 37899 * 37900 * @param {string} name 37901 * @param {*} value 37902 * @return {?string} Markup string, or null if the property was invalid. 37903 */ 37904 createMarkupForProperty: function (name, value) { 37905 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 37906 if (propertyInfo) { 37907 if (shouldIgnoreValue(propertyInfo, value)) { 37908 return ''; 37909 } 37910 var attributeName = propertyInfo.attributeName; 37911 if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { 37912 return attributeName + '=""'; 37913 } 37914 return attributeName + '=' + quoteAttributeValueForBrowser(value); 37915 } else if (DOMProperty.isCustomAttribute(name)) { 37916 if (value == null) { 37917 return ''; 37918 } 37919 return name + '=' + quoteAttributeValueForBrowser(value); 37920 } else if (true) { 37921 warnUnknownProperty(name); 37922 } 37923 return null; 37924 }, 37925 37926 /** 37927 * Creates markup for a custom property. 37928 * 37929 * @param {string} name 37930 * @param {*} value 37931 * @return {string} Markup string, or empty string if the property was invalid. 37932 */ 37933 createMarkupForCustomAttribute: function (name, value) { 37934 if (!isAttributeNameSafe(name) || value == null) { 37935 return ''; 37936 } 37937 return name + '=' + quoteAttributeValueForBrowser(value); 37938 }, 37939 37940 /** 37941 * Sets the value for a property on a node. 37942 * 37943 * @param {DOMElement} node 37944 * @param {string} name 37945 * @param {*} value 37946 */ 37947 setValueForProperty: function (node, name, value) { 37948 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 37949 if (propertyInfo) { 37950 var mutationMethod = propertyInfo.mutationMethod; 37951 if (mutationMethod) { 37952 mutationMethod(node, value); 37953 } else if (shouldIgnoreValue(propertyInfo, value)) { 37954 this.deleteValueForProperty(node, name); 37955 } else if (propertyInfo.mustUseAttribute) { 37956 var attributeName = propertyInfo.attributeName; 37957 var namespace = propertyInfo.attributeNamespace; 37958 // `setAttribute` with objects becomes only `[object]` in IE8/9, 37959 // ('' + value) makes it output the correct toString()-value. 37960 if (namespace) { 37961 node.setAttributeNS(namespace, attributeName, '' + value); 37962 } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { 37963 node.setAttribute(attributeName, ''); 37964 } else { 37965 node.setAttribute(attributeName, '' + value); 37966 } 37967 } else { 37968 var propName = propertyInfo.propertyName; 37969 // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the 37970 // property type before comparing; only `value` does and is string. 37971 if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) { 37972 // Contrary to `setAttribute`, object properties are properly 37973 // `toString`ed by IE8/9. 37974 node[propName] = value; 37975 } 37976 } 37977 } else if (DOMProperty.isCustomAttribute(name)) { 37978 DOMPropertyOperations.setValueForAttribute(node, name, value); 37979 } else if (true) { 37980 warnUnknownProperty(name); 37981 } 37982 }, 37983 37984 setValueForAttribute: function (node, name, value) { 37985 if (!isAttributeNameSafe(name)) { 37986 return; 37987 } 37988 if (value == null) { 37989 node.removeAttribute(name); 37990 } else { 37991 node.setAttribute(name, '' + value); 37992 } 37993 }, 37994 37995 /** 37996 * Deletes the value for a property on a node. 37997 * 37998 * @param {DOMElement} node 37999 * @param {string} name 38000 */ 38001 deleteValueForProperty: function (node, name) { 38002 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 38003 if (propertyInfo) { 38004 var mutationMethod = propertyInfo.mutationMethod; 38005 if (mutationMethod) { 38006 mutationMethod(node, undefined); 38007 } else if (propertyInfo.mustUseAttribute) { 38008 node.removeAttribute(propertyInfo.attributeName); 38009 } else { 38010 var propName = propertyInfo.propertyName; 38011 var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName); 38012 if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) { 38013 node[propName] = defaultValue; 38014 } 38015 } 38016 } else if (DOMProperty.isCustomAttribute(name)) { 38017 node.removeAttribute(name); 38018 } else if (true) { 38019 warnUnknownProperty(name); 38020 } 38021 } 38022 38023}; 38024 38025ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', { 38026 setValueForProperty: 'setValueForProperty', 38027 setValueForAttribute: 'setValueForAttribute', 38028 deleteValueForProperty: 'deleteValueForProperty' 38029}); 38030 38031module.exports = DOMPropertyOperations; 38032 38033/***/ }), 38034
vendor: 7,217 bytes, lines 38035-38190
38035/***/ "./node_modules/react/lib/Danger.js": 38036/*!******************************************!*\ 38037 !*** ./node_modules/react/lib/Danger.js ***! 38038 \******************************************/ 38039/*! no static exports found */ 38040/***/ (function(module, exports, __webpack_require__) { 38041 38042"use strict"; 38043/** 38044 * Copyright 2013-2015, Facebook, Inc. 38045 * All rights reserved. 38046 * 38047 * This source code is licensed under the BSD-style license found in the 38048 * LICENSE file in the root directory of this source tree. An additional grant 38049 * of patent rights can be found in the PATENTS file in the same directory. 38050 * 38051 * @providesModule Danger 38052 * @typechecks static-only 38053 */ 38054 38055 38056 38057var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 38058 38059var createNodesFromMarkup = __webpack_require__(/*! fbjs/lib/createNodesFromMarkup */ "./node_modules/fbjs/lib/createNodesFromMarkup.js"); 38060var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 38061var getMarkupWrap = __webpack_require__(/*! fbjs/lib/getMarkupWrap */ "./node_modules/fbjs/lib/getMarkupWrap.js"); 38062var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 38063 38064var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; 38065var RESULT_INDEX_ATTR = 'data-danger-index'; 38066 38067/** 38068 * Extracts the `nodeName` from a string of markup. 38069 * 38070 * NOTE: Extracting the `nodeName` does not require a regular expression match 38071 * because we make assumptions about React-generated markup (i.e. there are no 38072 * spaces surrounding the opening tag and there is at least one attribute). 38073 * 38074 * @param {string} markup String of markup. 38075 * @return {string} Node name of the supplied markup. 38076 * @see http://jsperf.com/extract-nodename 38077 */ 38078function getNodeName(markup) { 38079 return markup.substring(1, markup.indexOf(' ')); 38080} 38081 38082var Danger = { 38083 38084 /** 38085 * Renders markup into an array of nodes. The markup is expected to render 38086 * into a list of root nodes. Also, the length of `resultList` and 38087 * `markupList` should be the same. 38088 * 38089 * @param {array<string>} markupList List of markup strings to render. 38090 * @return {array<DOMElement>} List of rendered nodes. 38091 * @internal 38092 */ 38093 dangerouslyRenderMarkup: function (markupList) { 38094 !ExecutionEnvironment.canUseDOM ? true ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : undefined : undefined; 38095 var nodeName; 38096 var markupByNodeName = {}; 38097 // Group markup by `nodeName` if a wrap is necessary, else by '*'. 38098 for (var i = 0; i < markupList.length; i++) { 38099 !markupList[i] ? true ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : undefined : undefined; 38100 nodeName = getNodeName(markupList[i]); 38101 nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; 38102 markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; 38103 markupByNodeName[nodeName][i] = markupList[i]; 38104 } 38105 var resultList = []; 38106 var resultListAssignmentCount = 0; 38107 for (nodeName in markupByNodeName) { 38108 if (!markupByNodeName.hasOwnProperty(nodeName)) { 38109 continue; 38110 } 38111 var markupListByNodeName = markupByNodeName[nodeName]; 38112 38113 // This for-in loop skips the holes of the sparse array. The order of 38114 // iteration should follow the order of assignment, which happens to match 38115 // numerical index order, but we don't rely on that. 38116 var resultIndex; 38117 for (resultIndex in markupListByNodeName) { 38118 if (markupListByNodeName.hasOwnProperty(resultIndex)) { 38119 var markup = markupListByNodeName[resultIndex]; 38120 38121 // Push the requested markup with an additional RESULT_INDEX_ATTR 38122 // attribute. If the markup does not start with a < character, it 38123 // will be discarded below (with an appropriate console.error). 38124 markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP, 38125 // This index will be parsed back out below. 38126 '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '); 38127 } 38128 } 38129 38130 // Render each group of markup with similar wrapping `nodeName`. 38131 var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags. 38132 ); 38133 38134 for (var j = 0; j < renderNodes.length; ++j) { 38135 var renderNode = renderNodes[j]; 38136 if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) { 38137 38138 resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR); 38139 renderNode.removeAttribute(RESULT_INDEX_ATTR); 38140 38141 !!resultList.hasOwnProperty(resultIndex) ? true ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : undefined : undefined; 38142 38143 resultList[resultIndex] = renderNode; 38144 38145 // This should match resultList.length and markupList.length when 38146 // we're done. 38147 resultListAssignmentCount += 1; 38148 } else if (true) { 38149 console.error('Danger: Discarding unexpected node:', renderNode); 38150 } 38151 } 38152 } 38153 38154 // Although resultList was populated out of order, it should now be a dense 38155 // array. 38156 !(resultListAssignmentCount === resultList.length) ? true ? invariant(false, 'Danger: Did not assign to every index of resultList.') : undefined : undefined; 38157 38158 !(resultList.length === markupList.length) ? true ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : undefined : undefined; 38159 38160 return resultList; 38161 }, 38162 38163 /** 38164 * Replaces a node with a string of markup at its current position within its 38165 * parent. The markup must render into a single root node. 38166 * 38167 * @param {DOMElement} oldChild Child node to replace. 38168 * @param {string} markup Markup to render in place of the child node. 38169 * @internal 38170 */ 38171 dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { 38172 !ExecutionEnvironment.canUseDOM ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : undefined : undefined; 38173 !markup ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : undefined : undefined; 38174 !(oldChild.tagName.toLowerCase() !== 'html') ? true ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : undefined : undefined; 38175 38176 var newChild; 38177 if (typeof markup === 'string') { 38178 newChild = createNodesFromMarkup(markup, emptyFunction)[0]; 38179 } else { 38180 newChild = markup; 38181 } 38182 oldChild.parentNode.replaceChild(newChild, oldChild); 38183 } 38184 38185}; 38186 38187module.exports = Danger; 38188 38189/***/ }), 38190
vendor: 1,670 bytes, lines 38191-38228
38191/***/ "./node_modules/react/lib/DefaultEventPluginOrder.js": 38192/*!***********************************************************!*\ 38193 !*** ./node_modules/react/lib/DefaultEventPluginOrder.js ***! 38194 \***********************************************************/ 38195/*! no static exports found */ 38196/***/ (function(module, exports, __webpack_require__) { 38197 38198"use strict"; 38199/** 38200 * Copyright 2013-2015, Facebook, Inc. 38201 * All rights reserved. 38202 * 38203 * This source code is licensed under the BSD-style license found in the 38204 * LICENSE file in the root directory of this source tree. An additional grant 38205 * of patent rights can be found in the PATENTS file in the same directory. 38206 * 38207 * @providesModule DefaultEventPluginOrder 38208 */ 38209 38210 38211 38212var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 38213 38214/** 38215 * Module that is injectable into `EventPluginHub`, that specifies a 38216 * deterministic ordering of `EventPlugin`s. A convenient way to reason about 38217 * plugins, without having to package every one of them. This is better than 38218 * having plugins be ordered in the same order that they are injected because 38219 * that ordering would be influenced by the packaging order. 38220 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that 38221 * preventing default on events is convenient in `SimpleEventPlugin` handlers. 38222 */ 38223var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; 38224 38225module.exports = DefaultEventPluginOrder; 38226 38227/***/ }), 38228
vendor: 4,557 bytes, lines 38229-38363
38229/***/ "./node_modules/react/lib/EnterLeaveEventPlugin.js": 38230/*!*********************************************************!*\ 38231 !*** ./node_modules/react/lib/EnterLeaveEventPlugin.js ***! 38232 \*********************************************************/ 38233/*! no static exports found */ 38234/***/ (function(module, exports, __webpack_require__) { 38235 38236"use strict"; 38237/** 38238 * Copyright 2013-2015, Facebook, Inc. 38239 * All rights reserved. 38240 * 38241 * This source code is licensed under the BSD-style license found in the 38242 * LICENSE file in the root directory of this source tree. An additional grant 38243 * of patent rights can be found in the PATENTS file in the same directory. 38244 * 38245 * @providesModule EnterLeaveEventPlugin 38246 * @typechecks static-only 38247 */ 38248 38249 38250 38251var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 38252var EventPropagators = __webpack_require__(/*! ./EventPropagators */ "./node_modules/react/lib/EventPropagators.js"); 38253var SyntheticMouseEvent = __webpack_require__(/*! ./SyntheticMouseEvent */ "./node_modules/react/lib/SyntheticMouseEvent.js"); 38254 38255var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 38256var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 38257 38258var topLevelTypes = EventConstants.topLevelTypes; 38259var getFirstReactDOM = ReactMount.getFirstReactDOM; 38260 38261var eventTypes = { 38262 mouseEnter: { 38263 registrationName: keyOf({ onMouseEnter: null }), 38264 dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] 38265 }, 38266 mouseLeave: { 38267 registrationName: keyOf({ onMouseLeave: null }), 38268 dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] 38269 } 38270}; 38271 38272var extractedEvents = [null, null]; 38273 38274var EnterLeaveEventPlugin = { 38275 38276 eventTypes: eventTypes, 38277 38278 /** 38279 * For almost every interaction we care about, there will be both a top-level 38280 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that 38281 * we do not extract duplicate events. However, moving the mouse into the 38282 * browser from outside will not fire a `mouseout` event. In this case, we use 38283 * the `mouseover` top-level event. 38284 * 38285 * @param {string} topLevelType Record from `EventConstants`. 38286 * @param {DOMEventTarget} topLevelTarget The listening component root node. 38287 * @param {string} topLevelTargetID ID of `topLevelTarget`. 38288 * @param {object} nativeEvent Native browser event. 38289 * @return {*} An accumulation of synthetic events. 38290 * @see {EventPluginHub.extractEvents} 38291 */ 38292 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 38293 if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { 38294 return null; 38295 } 38296 if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { 38297 // Must not be a mouse in or mouse out - ignoring. 38298 return null; 38299 } 38300 38301 var win; 38302 if (topLevelTarget.window === topLevelTarget) { 38303 // `topLevelTarget` is probably a window object. 38304 win = topLevelTarget; 38305 } else { 38306 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 38307 var doc = topLevelTarget.ownerDocument; 38308 if (doc) { 38309 win = doc.defaultView || doc.parentWindow; 38310 } else { 38311 win = window; 38312 } 38313 } 38314 38315 var from; 38316 var to; 38317 var fromID = ''; 38318 var toID = ''; 38319 if (topLevelType === topLevelTypes.topMouseOut) { 38320 from = topLevelTarget; 38321 fromID = topLevelTargetID; 38322 to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement); 38323 if (to) { 38324 toID = ReactMount.getID(to); 38325 } else { 38326 to = win; 38327 } 38328 to = to || win; 38329 } else { 38330 from = win; 38331 to = topLevelTarget; 38332 toID = topLevelTargetID; 38333 } 38334 38335 if (from === to) { 38336 // Nothing pertains to our managed components. 38337 return null; 38338 } 38339 38340 var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget); 38341 leave.type = 'mouseleave'; 38342 leave.target = from; 38343 leave.relatedTarget = to; 38344 38345 var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget); 38346 enter.type = 'mouseenter'; 38347 enter.target = to; 38348 enter.relatedTarget = from; 38349 38350 EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID); 38351 38352 extractedEvents[0] = leave; 38353 extractedEvents[1] = enter; 38354 38355 return extractedEvents; 38356 } 38357 38358}; 38359 38360module.exports = EnterLeaveEventPlugin; 38361 38362/***/ }), 38363
vendor: 2,413 bytes, lines 38364-38466
38364/***/ "./node_modules/react/lib/EventConstants.js": 38365/*!**************************************************!*\ 38366 !*** ./node_modules/react/lib/EventConstants.js ***! 38367 \**************************************************/ 38368/*! no static exports found */ 38369/***/ (function(module, exports, __webpack_require__) { 38370 38371"use strict"; 38372/** 38373 * Copyright 2013-2015, Facebook, Inc. 38374 * All rights reserved. 38375 * 38376 * This source code is licensed under the BSD-style license found in the 38377 * LICENSE file in the root directory of this source tree. An additional grant 38378 * of patent rights can be found in the PATENTS file in the same directory. 38379 * 38380 * @providesModule EventConstants 38381 */ 38382 38383 38384 38385var keyMirror = __webpack_require__(/*! fbjs/lib/keyMirror */ "./node_modules/fbjs/lib/keyMirror.js"); 38386 38387var PropagationPhases = keyMirror({ bubbled: null, captured: null }); 38388 38389/** 38390 * Types of raw signals from the browser caught at the top level. 38391 */ 38392var topLevelTypes = keyMirror({ 38393 topAbort: null, 38394 topBlur: null, 38395 topCanPlay: null, 38396 topCanPlayThrough: null, 38397 topChange: null, 38398 topClick: null, 38399 topCompositionEnd: null, 38400 topCompositionStart: null, 38401 topCompositionUpdate: null, 38402 topContextMenu: null, 38403 topCopy: null, 38404 topCut: null, 38405 topDoubleClick: null, 38406 topDrag: null, 38407 topDragEnd: null, 38408 topDragEnter: null, 38409 topDragExit: null, 38410 topDragLeave: null, 38411 topDragOver: null, 38412 topDragStart: null, 38413 topDrop: null, 38414 topDurationChange: null, 38415 topEmptied: null, 38416 topEncrypted: null, 38417 topEnded: null, 38418 topError: null, 38419 topFocus: null, 38420 topInput: null, 38421 topKeyDown: null, 38422 topKeyPress: null, 38423 topKeyUp: null, 38424 topLoad: null, 38425 topLoadedData: null, 38426 topLoadedMetadata: null, 38427 topLoadStart: null, 38428 topMouseDown: null, 38429 topMouseMove: null, 38430 topMouseOut: null, 38431 topMouseOver: null, 38432 topMouseUp: null, 38433 topPaste: null, 38434 topPause: null, 38435 topPlay: null, 38436 topPlaying: null, 38437 topProgress: null, 38438 topRateChange: null, 38439 topReset: null, 38440 topScroll: null, 38441 topSeeked: null, 38442 topSeeking: null, 38443 topSelectionChange: null, 38444 topStalled: null, 38445 topSubmit: null, 38446 topSuspend: null, 38447 topTextInput: null, 38448 topTimeUpdate: null, 38449 topTouchCancel: null, 38450 topTouchEnd: null, 38451 topTouchMove: null, 38452 topTouchStart: null, 38453 topVolumeChange: null, 38454 topWaiting: null, 38455 topWheel: null 38456}); 38457 38458var EventConstants = { 38459 topLevelTypes: topLevelTypes, 38460 PropagationPhases: PropagationPhases 38461}; 38462 38463module.exports = EventConstants; 38464 38465/***/ }), 38466
vendor: 9,795 bytes, lines 38467-38756
38467/***/ "./node_modules/react/lib/EventPluginHub.js": 38468/*!**************************************************!*\ 38469 !*** ./node_modules/react/lib/EventPluginHub.js ***! 38470 \**************************************************/ 38471/*! no static exports found */ 38472/***/ (function(module, exports, __webpack_require__) { 38473 38474"use strict"; 38475/** 38476 * Copyright 2013-2015, Facebook, Inc. 38477 * All rights reserved. 38478 * 38479 * This source code is licensed under the BSD-style license found in the 38480 * LICENSE file in the root directory of this source tree. An additional grant 38481 * of patent rights can be found in the PATENTS file in the same directory. 38482 * 38483 * @providesModule EventPluginHub 38484 */ 38485 38486 38487 38488var EventPluginRegistry = __webpack_require__(/*! ./EventPluginRegistry */ "./node_modules/react/lib/EventPluginRegistry.js"); 38489var EventPluginUtils = __webpack_require__(/*! ./EventPluginUtils */ "./node_modules/react/lib/EventPluginUtils.js"); 38490var ReactErrorUtils = __webpack_require__(/*! ./ReactErrorUtils */ "./node_modules/react/lib/ReactErrorUtils.js"); 38491 38492var accumulateInto = __webpack_require__(/*! ./accumulateInto */ "./node_modules/react/lib/accumulateInto.js"); 38493var forEachAccumulated = __webpack_require__(/*! ./forEachAccumulated */ "./node_modules/react/lib/forEachAccumulated.js"); 38494var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 38495var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 38496 38497/** 38498 * Internal store for event listeners 38499 */ 38500var listenerBank = {}; 38501 38502/** 38503 * Internal queue of events that have accumulated their dispatches and are 38504 * waiting to have their dispatches executed. 38505 */ 38506var eventQueue = null; 38507 38508/** 38509 * Dispatches an event and releases it back into the pool, unless persistent. 38510 * 38511 * @param {?object} event Synthetic event to be dispatched. 38512 * @param {boolean} simulated If the event is simulated (changes exn behavior) 38513 * @private 38514 */ 38515var executeDispatchesAndRelease = function (event, simulated) { 38516 if (event) { 38517 EventPluginUtils.executeDispatchesInOrder(event, simulated); 38518 38519 if (!event.isPersistent()) { 38520 event.constructor.release(event); 38521 } 38522 } 38523}; 38524var executeDispatchesAndReleaseSimulated = function (e) { 38525 return executeDispatchesAndRelease(e, true); 38526}; 38527var executeDispatchesAndReleaseTopLevel = function (e) { 38528 return executeDispatchesAndRelease(e, false); 38529}; 38530 38531/** 38532 * - `InstanceHandle`: [required] Module that performs logical traversals of DOM 38533 * hierarchy given ids of the logical DOM elements involved. 38534 */ 38535var InstanceHandle = null; 38536 38537function validateInstanceHandle() { 38538 var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave; 38539 true ? warning(valid, 'InstanceHandle not injected before use!') : undefined; 38540} 38541 38542/** 38543 * This is a unified interface for event plugins to be installed and configured. 38544 * 38545 * Event plugins can implement the following properties: 38546 * 38547 * `extractEvents` {function(string, DOMEventTarget, string, object): *} 38548 * Required. When a top-level event is fired, this method is expected to 38549 * extract synthetic events that will in turn be queued and dispatched. 38550 * 38551 * `eventTypes` {object} 38552 * Optional, plugins that fire events must publish a mapping of registration 38553 * names that are used to register listeners. Values of this mapping must 38554 * be objects that contain `registrationName` or `phasedRegistrationNames`. 38555 * 38556 * `executeDispatch` {function(object, function, string)} 38557 * Optional, allows plugins to override how an event gets dispatched. By 38558 * default, the listener is simply invoked. 38559 * 38560 * Each plugin that is injected into `EventsPluginHub` is immediately operable. 38561 * 38562 * @public 38563 */ 38564var EventPluginHub = { 38565 38566 /** 38567 * Methods for injecting dependencies. 38568 */ 38569 injection: { 38570 38571 /** 38572 * @param {object} InjectedMount 38573 * @public 38574 */ 38575 injectMount: EventPluginUtils.injection.injectMount, 38576 38577 /** 38578 * @param {object} InjectedInstanceHandle 38579 * @public 38580 */ 38581 injectInstanceHandle: function (InjectedInstanceHandle) { 38582 InstanceHandle = InjectedInstanceHandle; 38583 if (true) { 38584 validateInstanceHandle(); 38585 } 38586 }, 38587 38588 getInstanceHandle: function () { 38589 if (true) { 38590 validateInstanceHandle(); 38591 } 38592 return InstanceHandle; 38593 }, 38594 38595 /** 38596 * @param {array} InjectedEventPluginOrder 38597 * @public 38598 */ 38599 injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, 38600 38601 /** 38602 * @param {object} injectedNamesToPlugins Map from names to plugin modules. 38603 */ 38604 injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName 38605 38606 }, 38607 38608 eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs, 38609 38610 registrationNameModules: EventPluginRegistry.registrationNameModules, 38611 38612 /** 38613 * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. 38614 * 38615 * @param {string} id ID of the DOM element. 38616 * @param {string} registrationName Name of listener (e.g. `onClick`). 38617 * @param {?function} listener The callback to store. 38618 */ 38619 putListener: function (id, registrationName, listener) { 38620 !(typeof listener === 'function') ? true ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : undefined : undefined; 38621 38622 var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); 38623 bankForRegistrationName[id] = listener; 38624 38625 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 38626 if (PluginModule && PluginModule.didPutListener) { 38627 PluginModule.didPutListener(id, registrationName, listener); 38628 } 38629 }, 38630 38631 /** 38632 * @param {string} id ID of the DOM element. 38633 * @param {string} registrationName Name of listener (e.g. `onClick`). 38634 * @return {?function} The stored callback. 38635 */ 38636 getListener: function (id, registrationName) { 38637 var bankForRegistrationName = listenerBank[registrationName]; 38638 return bankForRegistrationName && bankForRegistrationName[id]; 38639 }, 38640 38641 /** 38642 * Deletes a listener from the registration bank. 38643 * 38644 * @param {string} id ID of the DOM element. 38645 * @param {string} registrationName Name of listener (e.g. `onClick`). 38646 */ 38647 deleteListener: function (id, registrationName) { 38648 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 38649 if (PluginModule && PluginModule.willDeleteListener) { 38650 PluginModule.willDeleteListener(id, registrationName); 38651 } 38652 38653 var bankForRegistrationName = listenerBank[registrationName]; 38654 // TODO: This should never be null -- when is it? 38655 if (bankForRegistrationName) { 38656 delete bankForRegistrationName[id]; 38657 } 38658 }, 38659 38660 /** 38661 * Deletes all listeners for the DOM element with the supplied ID. 38662 * 38663 * @param {string} id ID of the DOM element. 38664 */ 38665 deleteAllListeners: function (id) { 38666 for (var registrationName in listenerBank) { 38667 if (!listenerBank[registrationName][id]) { 38668 continue; 38669 } 38670 38671 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 38672 if (PluginModule && PluginModule.willDeleteListener) { 38673 PluginModule.willDeleteListener(id, registrationName); 38674 } 38675 38676 delete listenerBank[registrationName][id]; 38677 } 38678 }, 38679 38680 /** 38681 * Allows registered plugins an opportunity to extract events from top-level 38682 * native browser events. 38683 * 38684 * @param {string} topLevelType Record from `EventConstants`. 38685 * @param {DOMEventTarget} topLevelTarget The listening component root node. 38686 * @param {string} topLevelTargetID ID of `topLevelTarget`. 38687 * @param {object} nativeEvent Native browser event. 38688 * @return {*} An accumulation of synthetic events. 38689 * @internal 38690 */ 38691 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 38692 var events; 38693 var plugins = EventPluginRegistry.plugins; 38694 for (var i = 0; i < plugins.length; i++) { 38695 // Not every plugin in the ordering may be loaded at runtime. 38696 var possiblePlugin = plugins[i]; 38697 if (possiblePlugin) { 38698 var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); 38699 if (extractedEvents) { 38700 events = accumulateInto(events, extractedEvents); 38701 } 38702 } 38703 } 38704 return events; 38705 }, 38706 38707 /** 38708 * Enqueues a synthetic event that should be dispatched when 38709 * `processEventQueue` is invoked. 38710 * 38711 * @param {*} events An accumulation of synthetic events. 38712 * @internal 38713 */ 38714 enqueueEvents: function (events) { 38715 if (events) { 38716 eventQueue = accumulateInto(eventQueue, events); 38717 } 38718 }, 38719 38720 /** 38721 * Dispatches all synthetic events on the event queue. 38722 * 38723 * @internal 38724 */ 38725 processEventQueue: function (simulated) { 38726 // Set `eventQueue` to null before processing it so that we can tell if more 38727 // events get enqueued while processing. 38728 var processingEventQueue = eventQueue; 38729 eventQueue = null; 38730 if (simulated) { 38731 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); 38732 } else { 38733 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); 38734 } 38735 !!eventQueue ? true ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : undefined : undefined; 38736 // This would be a good time to rethrow if any of the event handlers threw. 38737 ReactErrorUtils.rethrowCaughtError(); 38738 }, 38739 38740 /** 38741 * These are needed for tests only. Do not use! 38742 */ 38743 __purge: function () { 38744 listenerBank = {}; 38745 }, 38746 38747 __getListenerBank: function () { 38748 return listenerBank; 38749 } 38750 38751}; 38752 38753module.exports = EventPluginHub; 38754 38755/***/ }), 38756
vendor: 8,535 bytes, lines 38757-38987
38757/***/ "./node_modules/react/lib/EventPluginRegistry.js": 38758/*!*******************************************************!*\ 38759 !*** ./node_modules/react/lib/EventPluginRegistry.js ***! 38760 \*******************************************************/ 38761/*! no static exports found */ 38762/***/ (function(module, exports, __webpack_require__) { 38763 38764"use strict"; 38765/** 38766 * Copyright 2013-2015, Facebook, Inc. 38767 * All rights reserved. 38768 * 38769 * This source code is licensed under the BSD-style license found in the 38770 * LICENSE file in the root directory of this source tree. An additional grant 38771 * of patent rights can be found in the PATENTS file in the same directory. 38772 * 38773 * @providesModule EventPluginRegistry 38774 * @typechecks static-only 38775 */ 38776 38777 38778 38779var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 38780 38781/** 38782 * Injectable ordering of event plugins. 38783 */ 38784var EventPluginOrder = null; 38785 38786/** 38787 * Injectable mapping from names to event plugin modules. 38788 */ 38789var namesToPlugins = {}; 38790 38791/** 38792 * Recomputes the plugin list using the injected plugins and plugin ordering. 38793 * 38794 * @private 38795 */ 38796function recomputePluginOrdering() { 38797 if (!EventPluginOrder) { 38798 // Wait until an `EventPluginOrder` is injected. 38799 return; 38800 } 38801 for (var pluginName in namesToPlugins) { 38802 var PluginModule = namesToPlugins[pluginName]; 38803 var pluginIndex = EventPluginOrder.indexOf(pluginName); 38804 !(pluginIndex > -1) ? true ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : undefined : undefined; 38805 if (EventPluginRegistry.plugins[pluginIndex]) { 38806 continue; 38807 } 38808 !PluginModule.extractEvents ? true ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : undefined : undefined; 38809 EventPluginRegistry.plugins[pluginIndex] = PluginModule; 38810 var publishedEvents = PluginModule.eventTypes; 38811 for (var eventName in publishedEvents) { 38812 !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? true ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : undefined : undefined; 38813 } 38814 } 38815} 38816 38817/** 38818 * Publishes an event so that it can be dispatched by the supplied plugin. 38819 * 38820 * @param {object} dispatchConfig Dispatch configuration for the event. 38821 * @param {object} PluginModule Plugin publishing the event. 38822 * @return {boolean} True if the event was successfully published. 38823 * @private 38824 */ 38825function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { 38826 !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? true ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : undefined : undefined; 38827 EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; 38828 38829 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; 38830 if (phasedRegistrationNames) { 38831 for (var phaseName in phasedRegistrationNames) { 38832 if (phasedRegistrationNames.hasOwnProperty(phaseName)) { 38833 var phasedRegistrationName = phasedRegistrationNames[phaseName]; 38834 publishRegistrationName(phasedRegistrationName, PluginModule, eventName); 38835 } 38836 } 38837 return true; 38838 } else if (dispatchConfig.registrationName) { 38839 publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName); 38840 return true; 38841 } 38842 return false; 38843} 38844 38845/** 38846 * Publishes a registration name that is used to identify dispatched events and 38847 * can be used with `EventPluginHub.putListener` to register listeners. 38848 * 38849 * @param {string} registrationName Registration name to add. 38850 * @param {object} PluginModule Plugin publishing the event. 38851 * @private 38852 */ 38853function publishRegistrationName(registrationName, PluginModule, eventName) { 38854 !!EventPluginRegistry.registrationNameModules[registrationName] ? true ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : undefined : undefined; 38855 EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; 38856 EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; 38857} 38858 38859/** 38860 * Registers plugins so that they can extract and dispatch events. 38861 * 38862 * @see {EventPluginHub} 38863 */ 38864var EventPluginRegistry = { 38865 38866 /** 38867 * Ordered list of injected plugins. 38868 */ 38869 plugins: [], 38870 38871 /** 38872 * Mapping from event name to dispatch config 38873 */ 38874 eventNameDispatchConfigs: {}, 38875 38876 /** 38877 * Mapping from registration name to plugin module 38878 */ 38879 registrationNameModules: {}, 38880 38881 /** 38882 * Mapping from registration name to event name 38883 */ 38884 registrationNameDependencies: {}, 38885 38886 /** 38887 * Injects an ordering of plugins (by plugin name). This allows the ordering 38888 * to be decoupled from injection of the actual plugins so that ordering is 38889 * always deterministic regardless of packaging, on-the-fly injection, etc. 38890 * 38891 * @param {array} InjectedEventPluginOrder 38892 * @internal 38893 * @see {EventPluginHub.injection.injectEventPluginOrder} 38894 */ 38895 injectEventPluginOrder: function (InjectedEventPluginOrder) { 38896 !!EventPluginOrder ? true ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : undefined : undefined; 38897 // Clone the ordering so it cannot be dynamically mutated. 38898 EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); 38899 recomputePluginOrdering(); 38900 }, 38901 38902 /** 38903 * Injects plugins to be used by `EventPluginHub`. The plugin names must be 38904 * in the ordering injected by `injectEventPluginOrder`. 38905 * 38906 * Plugins can be injected as part of page initialization or on-the-fly. 38907 * 38908 * @param {object} injectedNamesToPlugins Map from names to plugin modules. 38909 * @internal 38910 * @see {EventPluginHub.injection.injectEventPluginsByName} 38911 */ 38912 injectEventPluginsByName: function (injectedNamesToPlugins) { 38913 var isOrderingDirty = false; 38914 for (var pluginName in injectedNamesToPlugins) { 38915 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { 38916 continue; 38917 } 38918 var PluginModule = injectedNamesToPlugins[pluginName]; 38919 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) { 38920 !!namesToPlugins[pluginName] ? true ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : undefined : undefined; 38921 namesToPlugins[pluginName] = PluginModule; 38922 isOrderingDirty = true; 38923 } 38924 } 38925 if (isOrderingDirty) { 38926 recomputePluginOrdering(); 38927 } 38928 }, 38929 38930 /** 38931 * Looks up the plugin for the supplied event. 38932 * 38933 * @param {object} event A synthetic event. 38934 * @return {?object} The plugin that created the supplied event. 38935 * @internal 38936 */ 38937 getPluginModuleForEvent: function (event) { 38938 var dispatchConfig = event.dispatchConfig; 38939 if (dispatchConfig.registrationName) { 38940 return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; 38941 } 38942 for (var phase in dispatchConfig.phasedRegistrationNames) { 38943 if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) { 38944 continue; 38945 } 38946 var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]]; 38947 if (PluginModule) { 38948 return PluginModule; 38949 } 38950 } 38951 return null; 38952 }, 38953 38954 /** 38955 * Exposed for unit testing. 38956 * @private 38957 */ 38958 _resetEventPlugins: function () { 38959 EventPluginOrder = null; 38960 for (var pluginName in namesToPlugins) { 38961 if (namesToPlugins.hasOwnProperty(pluginName)) { 38962 delete namesToPlugins[pluginName]; 38963 } 38964 } 38965 EventPluginRegistry.plugins.length = 0; 38966 38967 var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; 38968 for (var eventName in eventNameDispatchConfigs) { 38969 if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { 38970 delete eventNameDispatchConfigs[eventName]; 38971 } 38972 } 38973 38974 var registrationNameModules = EventPluginRegistry.registrationNameModules; 38975 for (var registrationName in registrationNameModules) { 38976 if (registrationNameModules.hasOwnProperty(registrationName)) { 38977 delete registrationNameModules[registrationName]; 38978 } 38979 } 38980 } 38981 38982}; 38983 38984module.exports = EventPluginRegistry; 38985 38986/***/ }), 38987
vendor: 7,081 bytes, lines 38988-39200
38988/***/ "./node_modules/react/lib/EventPluginUtils.js": 38989/*!****************************************************!*\ 38990 !*** ./node_modules/react/lib/EventPluginUtils.js ***! 38991 \****************************************************/ 38992/*! no static exports found */ 38993/***/ (function(module, exports, __webpack_require__) { 38994 38995"use strict"; 38996/** 38997 * Copyright 2013-2015, Facebook, Inc. 38998 * All rights reserved. 38999 * 39000 * This source code is licensed under the BSD-style license found in the 39001 * LICENSE file in the root directory of this source tree. An additional grant 39002 * of patent rights can be found in the PATENTS file in the same directory. 39003 * 39004 * @providesModule EventPluginUtils 39005 */ 39006 39007 39008 39009var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 39010var ReactErrorUtils = __webpack_require__(/*! ./ReactErrorUtils */ "./node_modules/react/lib/ReactErrorUtils.js"); 39011 39012var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 39013var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 39014 39015/** 39016 * Injected dependencies: 39017 */ 39018 39019/** 39020 * - `Mount`: [required] Module that can convert between React dom IDs and 39021 * actual node references. 39022 */ 39023var injection = { 39024 Mount: null, 39025 injectMount: function (InjectedMount) { 39026 injection.Mount = InjectedMount; 39027 if (true) { 39028 true ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined; 39029 } 39030 } 39031}; 39032 39033var topLevelTypes = EventConstants.topLevelTypes; 39034 39035function isEndish(topLevelType) { 39036 return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; 39037} 39038 39039function isMoveish(topLevelType) { 39040 return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; 39041} 39042function isStartish(topLevelType) { 39043 return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; 39044} 39045 39046var validateEventDispatches; 39047if (true) { 39048 validateEventDispatches = function (event) { 39049 var dispatchListeners = event._dispatchListeners; 39050 var dispatchIDs = event._dispatchIDs; 39051 39052 var listenersIsArr = Array.isArray(dispatchListeners); 39053 var idsIsArr = Array.isArray(dispatchIDs); 39054 var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0; 39055 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; 39056 39057 true ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined; 39058 }; 39059} 39060 39061/** 39062 * Dispatch the event to the listener. 39063 * @param {SyntheticEvent} event SyntheticEvent to handle 39064 * @param {boolean} simulated If the event is simulated (changes exn behavior) 39065 * @param {function} listener Application-level callback 39066 * @param {string} domID DOM id to pass to the callback. 39067 */ 39068function executeDispatch(event, simulated, listener, domID) { 39069 var type = event.type || 'unknown-event'; 39070 event.currentTarget = injection.Mount.getNode(domID); 39071 if (simulated) { 39072 ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID); 39073 } else { 39074 ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID); 39075 } 39076 event.currentTarget = null; 39077} 39078 39079/** 39080 * Standard/simple iteration through an event's collected dispatches. 39081 */ 39082function executeDispatchesInOrder(event, simulated) { 39083 var dispatchListeners = event._dispatchListeners; 39084 var dispatchIDs = event._dispatchIDs; 39085 if (true) { 39086 validateEventDispatches(event); 39087 } 39088 if (Array.isArray(dispatchListeners)) { 39089 for (var i = 0; i < dispatchListeners.length; i++) { 39090 if (event.isPropagationStopped()) { 39091 break; 39092 } 39093 // Listeners and IDs are two parallel arrays that are always in sync. 39094 executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]); 39095 } 39096 } else if (dispatchListeners) { 39097 executeDispatch(event, simulated, dispatchListeners, dispatchIDs); 39098 } 39099 event._dispatchListeners = null; 39100 event._dispatchIDs = null; 39101} 39102 39103/** 39104 * Standard/simple iteration through an event's collected dispatches, but stops 39105 * at the first dispatch execution returning true, and returns that id. 39106 * 39107 * @return {?string} id of the first dispatch execution who's listener returns 39108 * true, or null if no listener returned true. 39109 */ 39110function executeDispatchesInOrderStopAtTrueImpl(event) { 39111 var dispatchListeners = event._dispatchListeners; 39112 var dispatchIDs = event._dispatchIDs; 39113 if (true) { 39114 validateEventDispatches(event); 39115 } 39116 if (Array.isArray(dispatchListeners)) { 39117 for (var i = 0; i < dispatchListeners.length; i++) { 39118 if (event.isPropagationStopped()) { 39119 break; 39120 } 39121 // Listeners and IDs are two parallel arrays that are always in sync. 39122 if (dispatchListeners[i](event, dispatchIDs[i])) { 39123 return dispatchIDs[i]; 39124 } 39125 } 39126 } else if (dispatchListeners) { 39127 if (dispatchListeners(event, dispatchIDs)) { 39128 return dispatchIDs; 39129 } 39130 } 39131 return null; 39132} 39133 39134/** 39135 * @see executeDispatchesInOrderStopAtTrueImpl 39136 */ 39137function executeDispatchesInOrderStopAtTrue(event) { 39138 var ret = executeDispatchesInOrderStopAtTrueImpl(event); 39139 event._dispatchIDs = null; 39140 event._dispatchListeners = null; 39141 return ret; 39142} 39143 39144/** 39145 * Execution of a "direct" dispatch - there must be at most one dispatch 39146 * accumulated on the event or it is considered an error. It doesn't really make 39147 * sense for an event with multiple dispatches (bubbled) to keep track of the 39148 * return values at each dispatch execution, but it does tend to make sense when 39149 * dealing with "direct" dispatches. 39150 * 39151 * @return {*} The return value of executing the single dispatch. 39152 */ 39153function executeDirectDispatch(event) { 39154 if (true) { 39155 validateEventDispatches(event); 39156 } 39157 var dispatchListener = event._dispatchListeners; 39158 var dispatchID = event._dispatchIDs; 39159 !!Array.isArray(dispatchListener) ? true ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : undefined : undefined; 39160 var res = dispatchListener ? dispatchListener(event, dispatchID) : null; 39161 event._dispatchListeners = null; 39162 event._dispatchIDs = null; 39163 return res; 39164} 39165 39166/** 39167 * @param {SyntheticEvent} event 39168 * @return {boolean} True iff number of dispatches accumulated is greater than 0. 39169 */ 39170function hasDispatches(event) { 39171 return !!event._dispatchListeners; 39172} 39173 39174/** 39175 * General utilities that are useful in creating custom Event Plugins. 39176 */ 39177var EventPluginUtils = { 39178 isEndish: isEndish, 39179 isMoveish: isMoveish, 39180 isStartish: isStartish, 39181 39182 executeDirectDispatch: executeDirectDispatch, 39183 executeDispatchesInOrder: executeDispatchesInOrder, 39184 executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, 39185 hasDispatches: hasDispatches, 39186 39187 getNode: function (id) { 39188 return injection.Mount.getNode(id); 39189 }, 39190 getID: function (node) { 39191 return injection.Mount.getID(node); 39192 }, 39193 39194 injection: injection 39195}; 39196 39197module.exports = EventPluginUtils; 39198 39199/***/ }), 39200
vendor: 5,794 bytes, lines 39201-39346
39201/***/ "./node_modules/react/lib/EventPropagators.js": 39202/*!****************************************************!*\ 39203 !*** ./node_modules/react/lib/EventPropagators.js ***! 39204 \****************************************************/ 39205/*! no static exports found */ 39206/***/ (function(module, exports, __webpack_require__) { 39207 39208"use strict"; 39209/** 39210 * Copyright 2013-2015, Facebook, Inc. 39211 * All rights reserved. 39212 * 39213 * This source code is licensed under the BSD-style license found in the 39214 * LICENSE file in the root directory of this source tree. An additional grant 39215 * of patent rights can be found in the PATENTS file in the same directory. 39216 * 39217 * @providesModule EventPropagators 39218 */ 39219 39220 39221 39222var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 39223var EventPluginHub = __webpack_require__(/*! ./EventPluginHub */ "./node_modules/react/lib/EventPluginHub.js"); 39224 39225var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 39226 39227var accumulateInto = __webpack_require__(/*! ./accumulateInto */ "./node_modules/react/lib/accumulateInto.js"); 39228var forEachAccumulated = __webpack_require__(/*! ./forEachAccumulated */ "./node_modules/react/lib/forEachAccumulated.js"); 39229 39230var PropagationPhases = EventConstants.PropagationPhases; 39231var getListener = EventPluginHub.getListener; 39232 39233/** 39234 * Some event types have a notion of different registration names for different 39235 * "phases" of propagation. This finds listeners by a given phase. 39236 */ 39237function listenerAtPhase(id, event, propagationPhase) { 39238 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; 39239 return getListener(id, registrationName); 39240} 39241 39242/** 39243 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function 39244 * here, allows us to not have to bind or create functions for each event. 39245 * Mutating the event's members allows us to not have to create a wrapping 39246 * "dispatch" object that pairs the event with the listener. 39247 */ 39248function accumulateDirectionalDispatches(domID, upwards, event) { 39249 if (true) { 39250 true ? warning(domID, 'Dispatching id must not be null') : undefined; 39251 } 39252 var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; 39253 var listener = listenerAtPhase(domID, event, phase); 39254 if (listener) { 39255 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 39256 event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); 39257 } 39258} 39259 39260/** 39261 * Collect dispatches (must be entirely collected before dispatching - see unit 39262 * tests). Lazily allocate the array to conserve memory. We must loop through 39263 * each event and perform the traversal for each one. We cannot perform a 39264 * single traversal for the entire collection of events because each event may 39265 * have a different target. 39266 */ 39267function accumulateTwoPhaseDispatchesSingle(event) { 39268 if (event && event.dispatchConfig.phasedRegistrationNames) { 39269 EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event); 39270 } 39271} 39272 39273/** 39274 * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. 39275 */ 39276function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { 39277 if (event && event.dispatchConfig.phasedRegistrationNames) { 39278 EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event); 39279 } 39280} 39281 39282/** 39283 * Accumulates without regard to direction, does not look for phased 39284 * registration names. Same as `accumulateDirectDispatchesSingle` but without 39285 * requiring that the `dispatchMarker` be the same as the dispatched ID. 39286 */ 39287function accumulateDispatches(id, ignoredDirection, event) { 39288 if (event && event.dispatchConfig.registrationName) { 39289 var registrationName = event.dispatchConfig.registrationName; 39290 var listener = getListener(id, registrationName); 39291 if (listener) { 39292 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 39293 event._dispatchIDs = accumulateInto(event._dispatchIDs, id); 39294 } 39295 } 39296} 39297 39298/** 39299 * Accumulates dispatches on an `SyntheticEvent`, but only for the 39300 * `dispatchMarker`. 39301 * @param {SyntheticEvent} event 39302 */ 39303function accumulateDirectDispatchesSingle(event) { 39304 if (event && event.dispatchConfig.registrationName) { 39305 accumulateDispatches(event.dispatchMarker, null, event); 39306 } 39307} 39308 39309function accumulateTwoPhaseDispatches(events) { 39310 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); 39311} 39312 39313function accumulateTwoPhaseDispatchesSkipTarget(events) { 39314 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); 39315} 39316 39317function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { 39318 EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter); 39319} 39320 39321function accumulateDirectDispatches(events) { 39322 forEachAccumulated(events, accumulateDirectDispatchesSingle); 39323} 39324 39325/** 39326 * A small set of propagation patterns, each of which will accept a small amount 39327 * of information, and generate a set of "dispatch ready event objects" - which 39328 * are sets of events that have already been annotated with a set of dispatched 39329 * listener functions/ids. The API is designed this way to discourage these 39330 * propagation strategies from actually executing the dispatches, since we 39331 * always want to collect the entire set of dispatches before executing event a 39332 * single one. 39333 * 39334 * @constructor EventPropagators 39335 */ 39336var EventPropagators = { 39337 accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, 39338 accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, 39339 accumulateDirectDispatches: accumulateDirectDispatches, 39340 accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches 39341}; 39342 39343module.exports = EventPropagators; 39344 39345/***/ }), 39346
vendor: 3,044 bytes, lines 39347-39452
39347/***/ "./node_modules/react/lib/FallbackCompositionState.js": 39348/*!************************************************************!*\ 39349 !*** ./node_modules/react/lib/FallbackCompositionState.js ***! 39350 \************************************************************/ 39351/*! no static exports found */ 39352/***/ (function(module, exports, __webpack_require__) { 39353 39354"use strict"; 39355/** 39356 * Copyright 2013-2015, Facebook, Inc. 39357 * All rights reserved. 39358 * 39359 * This source code is licensed under the BSD-style license found in the 39360 * LICENSE file in the root directory of this source tree. An additional grant 39361 * of patent rights can be found in the PATENTS file in the same directory. 39362 * 39363 * @providesModule FallbackCompositionState 39364 * @typechecks static-only 39365 */ 39366 39367 39368 39369var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 39370 39371var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 39372var getTextContentAccessor = __webpack_require__(/*! ./getTextContentAccessor */ "./node_modules/react/lib/getTextContentAccessor.js"); 39373 39374/** 39375 * This helper class stores information about text content of a target node, 39376 * allowing comparison of content before and after a given event. 39377 * 39378 * Identify the node where selection currently begins, then observe 39379 * both its text content and its current position in the DOM. Since the 39380 * browser may natively replace the target node during composition, we can 39381 * use its position to find its replacement. 39382 * 39383 * @param {DOMEventTarget} root 39384 */ 39385function FallbackCompositionState(root) { 39386 this._root = root; 39387 this._startText = this.getText(); 39388 this._fallbackText = null; 39389} 39390 39391assign(FallbackCompositionState.prototype, { 39392 destructor: function () { 39393 this._root = null; 39394 this._startText = null; 39395 this._fallbackText = null; 39396 }, 39397 39398 /** 39399 * Get current text of input. 39400 * 39401 * @return {string} 39402 */ 39403 getText: function () { 39404 if ('value' in this._root) { 39405 return this._root.value; 39406 } 39407 return this._root[getTextContentAccessor()]; 39408 }, 39409 39410 /** 39411 * Determine the differing substring between the initially stored 39412 * text content and the current content. 39413 * 39414 * @return {string} 39415 */ 39416 getData: function () { 39417 if (this._fallbackText) { 39418 return this._fallbackText; 39419 } 39420 39421 var start; 39422 var startValue = this._startText; 39423 var startLength = startValue.length; 39424 var end; 39425 var endValue = this.getText(); 39426 var endLength = endValue.length; 39427 39428 for (start = 0; start < startLength; start++) { 39429 if (startValue[start] !== endValue[start]) { 39430 break; 39431 } 39432 } 39433 39434 var minEnd = startLength - start; 39435 for (end = 1; end <= minEnd; end++) { 39436 if (startValue[startLength - end] !== endValue[endLength - end]) { 39437 break; 39438 } 39439 } 39440 39441 var sliceTail = end > 1 ? 1 - end : undefined; 39442 this._fallbackText = endValue.slice(start, sliceTail); 39443 return this._fallbackText; 39444 } 39445}); 39446 39447PooledClass.addPoolingTo(FallbackCompositionState); 39448 39449module.exports = FallbackCompositionState; 39450 39451/***/ }), 39452
vendor: 8,103 bytes, lines 39453-39693
39453/***/ "./node_modules/react/lib/HTMLDOMPropertyConfig.js": 39454/*!*********************************************************!*\ 39455 !*** ./node_modules/react/lib/HTMLDOMPropertyConfig.js ***! 39456 \*********************************************************/ 39457/*! no static exports found */ 39458/***/ (function(module, exports, __webpack_require__) { 39459 39460"use strict"; 39461/** 39462 * Copyright 2013-2015, Facebook, Inc. 39463 * All rights reserved. 39464 * 39465 * This source code is licensed under the BSD-style license found in the 39466 * LICENSE file in the root directory of this source tree. An additional grant 39467 * of patent rights can be found in the PATENTS file in the same directory. 39468 * 39469 * @providesModule HTMLDOMPropertyConfig 39470 */ 39471 39472 39473 39474var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 39475var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 39476 39477var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; 39478var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; 39479var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; 39480var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; 39481var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; 39482var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; 39483var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; 39484 39485var hasSVG; 39486if (ExecutionEnvironment.canUseDOM) { 39487 var implementation = document.implementation; 39488 hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1'); 39489} 39490 39491var HTMLDOMPropertyConfig = { 39492 isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/), 39493 Properties: { 39494 /** 39495 * Standard Properties 39496 */ 39497 accept: null, 39498 acceptCharset: null, 39499 accessKey: null, 39500 action: null, 39501 allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39502 allowTransparency: MUST_USE_ATTRIBUTE, 39503 alt: null, 39504 async: HAS_BOOLEAN_VALUE, 39505 autoComplete: null, 39506 // autoFocus is polyfilled/normalized by AutoFocusUtils 39507 // autoFocus: HAS_BOOLEAN_VALUE, 39508 autoPlay: HAS_BOOLEAN_VALUE, 39509 capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39510 cellPadding: null, 39511 cellSpacing: null, 39512 charSet: MUST_USE_ATTRIBUTE, 39513 challenge: MUST_USE_ATTRIBUTE, 39514 checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39515 classID: MUST_USE_ATTRIBUTE, 39516 // To set className on SVG elements, it's necessary to use .setAttribute; 39517 // this works on HTML elements too in all browsers except IE8. Conveniently, 39518 // IE8 doesn't support SVG and so we can simply use the attribute in 39519 // browsers that support SVG and the property in browsers that don't, 39520 // regardless of whether the element is HTML or SVG. 39521 className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY, 39522 cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, 39523 colSpan: null, 39524 content: null, 39525 contentEditable: null, 39526 contextMenu: MUST_USE_ATTRIBUTE, 39527 controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39528 coords: null, 39529 crossOrigin: null, 39530 data: null, // For `<object />` acts as `src`. 39531 dateTime: MUST_USE_ATTRIBUTE, 39532 'default': HAS_BOOLEAN_VALUE, 39533 defer: HAS_BOOLEAN_VALUE, 39534 dir: null, 39535 disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39536 download: HAS_OVERLOADED_BOOLEAN_VALUE, 39537 draggable: null, 39538 encType: null, 39539 form: MUST_USE_ATTRIBUTE, 39540 formAction: MUST_USE_ATTRIBUTE, 39541 formEncType: MUST_USE_ATTRIBUTE, 39542 formMethod: MUST_USE_ATTRIBUTE, 39543 formNoValidate: HAS_BOOLEAN_VALUE, 39544 formTarget: MUST_USE_ATTRIBUTE, 39545 frameBorder: MUST_USE_ATTRIBUTE, 39546 headers: null, 39547 height: MUST_USE_ATTRIBUTE, 39548 hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39549 high: null, 39550 href: null, 39551 hrefLang: null, 39552 htmlFor: null, 39553 httpEquiv: null, 39554 icon: null, 39555 id: MUST_USE_PROPERTY, 39556 inputMode: MUST_USE_ATTRIBUTE, 39557 integrity: null, 39558 is: MUST_USE_ATTRIBUTE, 39559 keyParams: MUST_USE_ATTRIBUTE, 39560 keyType: MUST_USE_ATTRIBUTE, 39561 kind: null, 39562 label: null, 39563 lang: null, 39564 list: MUST_USE_ATTRIBUTE, 39565 loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39566 low: null, 39567 manifest: MUST_USE_ATTRIBUTE, 39568 marginHeight: null, 39569 marginWidth: null, 39570 max: null, 39571 maxLength: MUST_USE_ATTRIBUTE, 39572 media: MUST_USE_ATTRIBUTE, 39573 mediaGroup: null, 39574 method: null, 39575 min: null, 39576 minLength: MUST_USE_ATTRIBUTE, 39577 multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39578 muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39579 name: null, 39580 nonce: MUST_USE_ATTRIBUTE, 39581 noValidate: HAS_BOOLEAN_VALUE, 39582 open: HAS_BOOLEAN_VALUE, 39583 optimum: null, 39584 pattern: null, 39585 placeholder: null, 39586 poster: null, 39587 preload: null, 39588 radioGroup: null, 39589 readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39590 rel: null, 39591 required: HAS_BOOLEAN_VALUE, 39592 reversed: HAS_BOOLEAN_VALUE, 39593 role: MUST_USE_ATTRIBUTE, 39594 rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, 39595 rowSpan: null, 39596 sandbox: null, 39597 scope: null, 39598 scoped: HAS_BOOLEAN_VALUE, 39599 scrolling: null, 39600 seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39601 selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 39602 shape: null, 39603 size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, 39604 sizes: MUST_USE_ATTRIBUTE, 39605 span: HAS_POSITIVE_NUMERIC_VALUE, 39606 spellCheck: null, 39607 src: null, 39608 srcDoc: MUST_USE_PROPERTY, 39609 srcLang: null, 39610 srcSet: MUST_USE_ATTRIBUTE, 39611 start: HAS_NUMERIC_VALUE, 39612 step: null, 39613 style: null, 39614 summary: null, 39615 tabIndex: null, 39616 target: null, 39617 title: null, 39618 type: null, 39619 useMap: null, 39620 value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, 39621 width: MUST_USE_ATTRIBUTE, 39622 wmode: MUST_USE_ATTRIBUTE, 39623 wrap: null, 39624 39625 /** 39626 * RDFa Properties 39627 */ 39628 about: MUST_USE_ATTRIBUTE, 39629 datatype: MUST_USE_ATTRIBUTE, 39630 inlist: MUST_USE_ATTRIBUTE, 39631 prefix: MUST_USE_ATTRIBUTE, 39632 // property is also supported for OpenGraph in meta tags. 39633 property: MUST_USE_ATTRIBUTE, 39634 resource: MUST_USE_ATTRIBUTE, 39635 'typeof': MUST_USE_ATTRIBUTE, 39636 vocab: MUST_USE_ATTRIBUTE, 39637 39638 /** 39639 * Non-standard Properties 39640 */ 39641 // autoCapitalize and autoCorrect are supported in Mobile Safari for 39642 // keyboard hints. 39643 autoCapitalize: MUST_USE_ATTRIBUTE, 39644 autoCorrect: MUST_USE_ATTRIBUTE, 39645 // autoSave allows WebKit/Blink to persist values of input fields on page reloads 39646 autoSave: null, 39647 // color is for Safari mask-icon link 39648 color: null, 39649 // itemProp, itemScope, itemType are for 39650 // Microdata support. See http://schema.org/docs/gs.html 39651 itemProp: MUST_USE_ATTRIBUTE, 39652 itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, 39653 itemType: MUST_USE_ATTRIBUTE, 39654 // itemID and itemRef are for Microdata support as well but 39655 // only specified in the the WHATWG spec document. See 39656 // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api 39657 itemID: MUST_USE_ATTRIBUTE, 39658 itemRef: MUST_USE_ATTRIBUTE, 39659 // results show looking glass icon and recent searches on input 39660 // search fields in WebKit/Blink 39661 results: null, 39662 // IE-only attribute that specifies security restrictions on an iframe 39663 // as an alternative to the sandbox attribute on IE<10 39664 security: MUST_USE_ATTRIBUTE, 39665 // IE-only attribute that controls focus behavior 39666 unselectable: MUST_USE_ATTRIBUTE 39667 }, 39668 DOMAttributeNames: { 39669 acceptCharset: 'accept-charset', 39670 className: 'class', 39671 htmlFor: 'for', 39672 httpEquiv: 'http-equiv' 39673 }, 39674 DOMPropertyNames: { 39675 autoComplete: 'autocomplete', 39676 autoFocus: 'autofocus', 39677 autoPlay: 'autoplay', 39678 autoSave: 'autosave', 39679 // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter. 39680 // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding 39681 encType: 'encoding', 39682 hrefLang: 'hreflang', 39683 radioGroup: 'radiogroup', 39684 spellCheck: 'spellcheck', 39685 srcDoc: 'srcdoc', 39686 srcSet: 'srcset' 39687 } 39688}; 39689 39690module.exports = HTMLDOMPropertyConfig; 39691 39692/***/ }), 39693
vendor: 5,655 bytes, lines 39694-39838
39694/***/ "./node_modules/react/lib/LinkedValueUtils.js": 39695/*!****************************************************!*\ 39696 !*** ./node_modules/react/lib/LinkedValueUtils.js ***! 39697 \****************************************************/ 39698/*! no static exports found */ 39699/***/ (function(module, exports, __webpack_require__) { 39700 39701"use strict"; 39702/** 39703 * Copyright 2013-2015, Facebook, Inc. 39704 * All rights reserved. 39705 * 39706 * This source code is licensed under the BSD-style license found in the 39707 * LICENSE file in the root directory of this source tree. An additional grant 39708 * of patent rights can be found in the PATENTS file in the same directory. 39709 * 39710 * @providesModule LinkedValueUtils 39711 * @typechecks static-only 39712 */ 39713 39714 39715 39716var ReactPropTypes = __webpack_require__(/*! ./ReactPropTypes */ "./node_modules/react/lib/ReactPropTypes.js"); 39717var ReactPropTypeLocations = __webpack_require__(/*! ./ReactPropTypeLocations */ "./node_modules/react/lib/ReactPropTypeLocations.js"); 39718 39719var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 39720var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 39721 39722var hasReadOnlyValue = { 39723 'button': true, 39724 'checkbox': true, 39725 'image': true, 39726 'hidden': true, 39727 'radio': true, 39728 'reset': true, 39729 'submit': true 39730}; 39731 39732function _assertSingleLink(inputProps) { 39733 !(inputProps.checkedLink == null || inputProps.valueLink == null) ? true ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : undefined : undefined; 39734} 39735function _assertValueLink(inputProps) { 39736 _assertSingleLink(inputProps); 39737 !(inputProps.value == null && inputProps.onChange == null) ? true ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : undefined : undefined; 39738} 39739 39740function _assertCheckedLink(inputProps) { 39741 _assertSingleLink(inputProps); 39742 !(inputProps.checked == null && inputProps.onChange == null) ? true ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : undefined : undefined; 39743} 39744 39745var propTypes = { 39746 value: function (props, propName, componentName) { 39747 if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { 39748 return null; 39749 } 39750 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 39751 }, 39752 checked: function (props, propName, componentName) { 39753 if (!props[propName] || props.onChange || props.readOnly || props.disabled) { 39754 return null; 39755 } 39756 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 39757 }, 39758 onChange: ReactPropTypes.func 39759}; 39760 39761var loggedTypeFailures = {}; 39762function getDeclarationErrorAddendum(owner) { 39763 if (owner) { 39764 var name = owner.getName(); 39765 if (name) { 39766 return ' Check the render method of `' + name + '`.'; 39767 } 39768 } 39769 return ''; 39770} 39771 39772/** 39773 * Provide a linked `value` attribute for controlled forms. You should not use 39774 * this outside of the ReactDOM controlled form components. 39775 */ 39776var LinkedValueUtils = { 39777 checkPropTypes: function (tagName, props, owner) { 39778 for (var propName in propTypes) { 39779 if (propTypes.hasOwnProperty(propName)) { 39780 var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 39781 } 39782 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 39783 // Only monitor this failure once because there tends to be a lot of the 39784 // same error. 39785 loggedTypeFailures[error.message] = true; 39786 39787 var addendum = getDeclarationErrorAddendum(owner); 39788 true ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined; 39789 } 39790 } 39791 }, 39792 39793 /** 39794 * @param {object} inputProps Props for form component 39795 * @return {*} current value of the input either from value prop or link. 39796 */ 39797 getValue: function (inputProps) { 39798 if (inputProps.valueLink) { 39799 _assertValueLink(inputProps); 39800 return inputProps.valueLink.value; 39801 } 39802 return inputProps.value; 39803 }, 39804 39805 /** 39806 * @param {object} inputProps Props for form component 39807 * @return {*} current checked status of the input either from checked prop 39808 * or link. 39809 */ 39810 getChecked: function (inputProps) { 39811 if (inputProps.checkedLink) { 39812 _assertCheckedLink(inputProps); 39813 return inputProps.checkedLink.value; 39814 } 39815 return inputProps.checked; 39816 }, 39817 39818 /** 39819 * @param {object} inputProps Props for form component 39820 * @param {SyntheticEvent} event change event to handle 39821 */ 39822 executeOnChange: function (inputProps, event) { 39823 if (inputProps.valueLink) { 39824 _assertValueLink(inputProps); 39825 return inputProps.valueLink.requestChange(event.target.value); 39826 } else if (inputProps.checkedLink) { 39827 _assertCheckedLink(inputProps); 39828 return inputProps.checkedLink.requestChange(event.target.checked); 39829 } else if (inputProps.onChange) { 39830 return inputProps.onChange.call(undefined, event); 39831 } 39832 } 39833}; 39834 39835module.exports = LinkedValueUtils; 39836 39837/***/ }), 39838
vendor: 1,578 bytes, lines 39839-39896
39839/***/ "./node_modules/react/lib/Object.assign.js": 39840/*!*************************************************!*\ 39841 !*** ./node_modules/react/lib/Object.assign.js ***! 39842 \*************************************************/ 39843/*! no static exports found */ 39844/***/ (function(module, exports, __webpack_require__) { 39845 39846"use strict"; 39847/** 39848 * Copyright 2014-2015, Facebook, Inc. 39849 * All rights reserved. 39850 * 39851 * This source code is licensed under the BSD-style license found in the 39852 * LICENSE file in the root directory of this source tree. An additional grant 39853 * of patent rights can be found in the PATENTS file in the same directory. 39854 * 39855 * @providesModule Object.assign 39856 */ 39857 39858// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign 39859 39860 39861 39862function assign(target, sources) { 39863 if (target == null) { 39864 throw new TypeError('Object.assign target cannot be null or undefined'); 39865 } 39866 39867 var to = Object(target); 39868 var hasOwnProperty = Object.prototype.hasOwnProperty; 39869 39870 for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { 39871 var nextSource = arguments[nextIndex]; 39872 if (nextSource == null) { 39873 continue; 39874 } 39875 39876 var from = Object(nextSource); 39877 39878 // We don't currently support accessors nor proxies. Therefore this 39879 // copy cannot throw. If we ever supported this then we must handle 39880 // exceptions and side-effects. We don't support symbols so they won't 39881 // be transferred. 39882 39883 for (var key in from) { 39884 if (hasOwnProperty.call(from, key)) { 39885 to[key] = from[key]; 39886 } 39887 } 39888 } 39889 39890 return to; 39891} 39892 39893module.exports = assign; 39894 39895/***/ }), 39896
vendor: 3,872 bytes, lines 39897-40026
39897/***/ "./node_modules/react/lib/PooledClass.js": 39898/*!***********************************************!*\ 39899 !*** ./node_modules/react/lib/PooledClass.js ***! 39900 \***********************************************/ 39901/*! no static exports found */ 39902/***/ (function(module, exports, __webpack_require__) { 39903 39904"use strict"; 39905/** 39906 * Copyright 2013-2015, Facebook, Inc. 39907 * All rights reserved. 39908 * 39909 * This source code is licensed under the BSD-style license found in the 39910 * LICENSE file in the root directory of this source tree. An additional grant 39911 * of patent rights can be found in the PATENTS file in the same directory. 39912 * 39913 * @providesModule PooledClass 39914 */ 39915 39916 39917 39918var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 39919 39920/** 39921 * Static poolers. Several custom versions for each potential number of 39922 * arguments. A completely generic pooler is easy to implement, but would 39923 * require accessing the `arguments` object. In each of these, `this` refers to 39924 * the Class itself, not an instance. If any others are needed, simply add them 39925 * here, or in their own files. 39926 */ 39927var oneArgumentPooler = function (copyFieldsFrom) { 39928 var Klass = this; 39929 if (Klass.instancePool.length) { 39930 var instance = Klass.instancePool.pop(); 39931 Klass.call(instance, copyFieldsFrom); 39932 return instance; 39933 } else { 39934 return new Klass(copyFieldsFrom); 39935 } 39936}; 39937 39938var twoArgumentPooler = function (a1, a2) { 39939 var Klass = this; 39940 if (Klass.instancePool.length) { 39941 var instance = Klass.instancePool.pop(); 39942 Klass.call(instance, a1, a2); 39943 return instance; 39944 } else { 39945 return new Klass(a1, a2); 39946 } 39947}; 39948 39949var threeArgumentPooler = function (a1, a2, a3) { 39950 var Klass = this; 39951 if (Klass.instancePool.length) { 39952 var instance = Klass.instancePool.pop(); 39953 Klass.call(instance, a1, a2, a3); 39954 return instance; 39955 } else { 39956 return new Klass(a1, a2, a3); 39957 } 39958}; 39959 39960var fourArgumentPooler = function (a1, a2, a3, a4) { 39961 var Klass = this; 39962 if (Klass.instancePool.length) { 39963 var instance = Klass.instancePool.pop(); 39964 Klass.call(instance, a1, a2, a3, a4); 39965 return instance; 39966 } else { 39967 return new Klass(a1, a2, a3, a4); 39968 } 39969}; 39970 39971var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { 39972 var Klass = this; 39973 if (Klass.instancePool.length) { 39974 var instance = Klass.instancePool.pop(); 39975 Klass.call(instance, a1, a2, a3, a4, a5); 39976 return instance; 39977 } else { 39978 return new Klass(a1, a2, a3, a4, a5); 39979 } 39980}; 39981 39982var standardReleaser = function (instance) { 39983 var Klass = this; 39984 !(instance instanceof Klass) ? true ? invariant(false, 'Trying to release an instance into a pool of a different type.') : undefined : undefined; 39985 instance.destructor(); 39986 if (Klass.instancePool.length < Klass.poolSize) { 39987 Klass.instancePool.push(instance); 39988 } 39989}; 39990 39991var DEFAULT_POOL_SIZE = 10; 39992var DEFAULT_POOLER = oneArgumentPooler; 39993 39994/** 39995 * Augments `CopyConstructor` to be a poolable class, augmenting only the class 39996 * itself (statically) not adding any prototypical fields. Any CopyConstructor 39997 * you give this may have a `poolSize` property, and will look for a 39998 * prototypical `destructor` on instances (optional). 39999 * 40000 * @param {Function} CopyConstructor Constructor that can be used to reset. 40001 * @param {Function} pooler Customizable pooler. 40002 */ 40003var addPoolingTo = function (CopyConstructor, pooler) { 40004 var NewKlass = CopyConstructor; 40005 NewKlass.instancePool = []; 40006 NewKlass.getPooled = pooler || DEFAULT_POOLER; 40007 if (!NewKlass.poolSize) { 40008 NewKlass.poolSize = DEFAULT_POOL_SIZE; 40009 } 40010 NewKlass.release = standardReleaser; 40011 return NewKlass; 40012}; 40013 40014var PooledClass = { 40015 addPoolingTo: addPoolingTo, 40016 oneArgumentPooler: oneArgumentPooler, 40017 twoArgumentPooler: twoArgumentPooler, 40018 threeArgumentPooler: threeArgumentPooler, 40019 fourArgumentPooler: fourArgumentPooler, 40020 fiveArgumentPooler: fiveArgumentPooler 40021}; 40022 40023module.exports = PooledClass; 40024 40025/***/ }), 40026
vendor: 2,075 bytes, lines 40027-40077
40027/***/ "./node_modules/react/lib/React.js": 40028/*!*****************************************!*\ 40029 !*** ./node_modules/react/lib/React.js ***! 40030 \*****************************************/ 40031/*! no static exports found */ 40032/***/ (function(module, exports, __webpack_require__) { 40033 40034"use strict"; 40035/** 40036 * Copyright 2013-2015, Facebook, Inc. 40037 * All rights reserved. 40038 * 40039 * This source code is licensed under the BSD-style license found in the 40040 * LICENSE file in the root directory of this source tree. An additional grant 40041 * of patent rights can be found in the PATENTS file in the same directory. 40042 * 40043 * @providesModule React 40044 */ 40045 40046 40047 40048var ReactDOM = __webpack_require__(/*! ./ReactDOM */ "./node_modules/react/lib/ReactDOM.js"); 40049var ReactDOMServer = __webpack_require__(/*! ./ReactDOMServer */ "./node_modules/react/lib/ReactDOMServer.js"); 40050var ReactIsomorphic = __webpack_require__(/*! ./ReactIsomorphic */ "./node_modules/react/lib/ReactIsomorphic.js"); 40051 40052var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 40053var deprecated = __webpack_require__(/*! ./deprecated */ "./node_modules/react/lib/deprecated.js"); 40054 40055// `version` will be added here by ReactIsomorphic. 40056var React = {}; 40057 40058assign(React, ReactIsomorphic); 40059 40060assign(React, { 40061 // ReactDOM 40062 findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode), 40063 render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render), 40064 unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode), 40065 40066 // ReactDOMServer 40067 renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString), 40068 renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup) 40069}); 40070 40071React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; 40072React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer; 40073 40074module.exports = React; 40075 40076/***/ }), 40077
vendor: 1,663 bytes, lines 40078-40124
40078/***/ "./node_modules/react/lib/ReactBrowserComponentMixin.js": 40079/*!**************************************************************!*\ 40080 !*** ./node_modules/react/lib/ReactBrowserComponentMixin.js ***! 40081 \**************************************************************/ 40082/*! no static exports found */ 40083/***/ (function(module, exports, __webpack_require__) { 40084 40085"use strict"; 40086/** 40087 * Copyright 2013-2015, Facebook, Inc. 40088 * All rights reserved. 40089 * 40090 * This source code is licensed under the BSD-style license found in the 40091 * LICENSE file in the root directory of this source tree. An additional grant 40092 * of patent rights can be found in the PATENTS file in the same directory. 40093 * 40094 * @providesModule ReactBrowserComponentMixin 40095 */ 40096 40097 40098 40099var ReactInstanceMap = __webpack_require__(/*! ./ReactInstanceMap */ "./node_modules/react/lib/ReactInstanceMap.js"); 40100 40101var findDOMNode = __webpack_require__(/*! ./findDOMNode */ "./node_modules/react/lib/findDOMNode.js"); 40102var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 40103 40104var didWarnKey = '_getDOMNodeDidWarn'; 40105 40106var ReactBrowserComponentMixin = { 40107 /** 40108 * Returns the DOM node rendered by this component. 40109 * 40110 * @return {DOMElement} The root node of this component. 40111 * @final 40112 * @protected 40113 */ 40114 getDOMNode: function () { 40115 true ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined; 40116 this.constructor[didWarnKey] = true; 40117 return findDOMNode(this); 40118 } 40119}; 40120 40121module.exports = ReactBrowserComponentMixin; 40122 40123/***/ }), 40124
vendor: 13,284 bytes, lines 40125-40459
40125/***/ "./node_modules/react/lib/ReactBrowserEventEmitter.js": 40126/*!************************************************************!*\ 40127 !*** ./node_modules/react/lib/ReactBrowserEventEmitter.js ***! 40128 \************************************************************/ 40129/*! no static exports found */ 40130/***/ (function(module, exports, __webpack_require__) { 40131 40132"use strict"; 40133/** 40134 * Copyright 2013-2015, Facebook, Inc. 40135 * All rights reserved. 40136 * 40137 * This source code is licensed under the BSD-style license found in the 40138 * LICENSE file in the root directory of this source tree. An additional grant 40139 * of patent rights can be found in the PATENTS file in the same directory. 40140 * 40141 * @providesModule ReactBrowserEventEmitter 40142 * @typechecks static-only 40143 */ 40144 40145 40146 40147var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 40148var EventPluginHub = __webpack_require__(/*! ./EventPluginHub */ "./node_modules/react/lib/EventPluginHub.js"); 40149var EventPluginRegistry = __webpack_require__(/*! ./EventPluginRegistry */ "./node_modules/react/lib/EventPluginRegistry.js"); 40150var ReactEventEmitterMixin = __webpack_require__(/*! ./ReactEventEmitterMixin */ "./node_modules/react/lib/ReactEventEmitterMixin.js"); 40151var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 40152var ViewportMetrics = __webpack_require__(/*! ./ViewportMetrics */ "./node_modules/react/lib/ViewportMetrics.js"); 40153 40154var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 40155var isEventSupported = __webpack_require__(/*! ./isEventSupported */ "./node_modules/react/lib/isEventSupported.js"); 40156 40157/** 40158 * Summary of `ReactBrowserEventEmitter` event handling: 40159 * 40160 * - Top-level delegation is used to trap most native browser events. This 40161 * may only occur in the main thread and is the responsibility of 40162 * ReactEventListener, which is injected and can therefore support pluggable 40163 * event sources. This is the only work that occurs in the main thread. 40164 * 40165 * - We normalize and de-duplicate events to account for browser quirks. This 40166 * may be done in the worker thread. 40167 * 40168 * - Forward these native events (with the associated top-level type used to 40169 * trap it) to `EventPluginHub`, which in turn will ask plugins if they want 40170 * to extract any synthetic events. 40171 * 40172 * - The `EventPluginHub` will then process each event by annotating them with 40173 * "dispatches", a sequence of listeners and IDs that care about that event. 40174 * 40175 * - The `EventPluginHub` then dispatches the events. 40176 * 40177 * Overview of React and the event system: 40178 * 40179 * +------------+ . 40180 * | DOM | . 40181 * +------------+ . 40182 * | . 40183 * v . 40184 * +------------+ . 40185 * | ReactEvent | . 40186 * | Listener | . 40187 * +------------+ . +-----------+ 40188 * | . +--------+|SimpleEvent| 40189 * | . | |Plugin | 40190 * +-----|------+ . v +-----------+ 40191 * | | | . +--------------+ +------------+ 40192 * | +-----------.--->|EventPluginHub| | Event | 40193 * | | . | | +-----------+ | Propagators| 40194 * | ReactEvent | . | | |TapEvent | |------------| 40195 * | Emitter | . | |<---+|Plugin | |other plugin| 40196 * | | . | | +-----------+ | utilities | 40197 * | +-----------.--->| | +------------+ 40198 * | | | . +--------------+ 40199 * +-----|------+ . ^ +-----------+ 40200 * | . | |Enter/Leave| 40201 * + . +-------+|Plugin | 40202 * +-------------+ . +-----------+ 40203 * | application | . 40204 * |-------------| . 40205 * | | . 40206 * | | . 40207 * +-------------+ . 40208 * . 40209 * React Core . General Purpose Event Plugin System 40210 */ 40211 40212var alreadyListeningTo = {}; 40213var isMonitoringScrollValue = false; 40214var reactTopListenersCounter = 0; 40215 40216// For events like 'submit' which don't consistently bubble (which we trap at a 40217// lower node than `document`), binding at `document` would cause duplicate 40218// events so we don't include them here 40219var topEventMapping = { 40220 topAbort: 'abort', 40221 topBlur: 'blur', 40222 topCanPlay: 'canplay', 40223 topCanPlayThrough: 'canplaythrough', 40224 topChange: 'change', 40225 topClick: 'click', 40226 topCompositionEnd: 'compositionend', 40227 topCompositionStart: 'compositionstart', 40228 topCompositionUpdate: 'compositionupdate', 40229 topContextMenu: 'contextmenu', 40230 topCopy: 'copy', 40231 topCut: 'cut', 40232 topDoubleClick: 'dblclick', 40233 topDrag: 'drag', 40234 topDragEnd: 'dragend', 40235 topDragEnter: 'dragenter', 40236 topDragExit: 'dragexit', 40237 topDragLeave: 'dragleave', 40238 topDragOver: 'dragover', 40239 topDragStart: 'dragstart', 40240 topDrop: 'drop', 40241 topDurationChange: 'durationchange', 40242 topEmptied: 'emptied', 40243 topEncrypted: 'encrypted', 40244 topEnded: 'ended', 40245 topError: 'error', 40246 topFocus: 'focus', 40247 topInput: 'input', 40248 topKeyDown: 'keydown', 40249 topKeyPress: 'keypress', 40250 topKeyUp: 'keyup', 40251 topLoadedData: 'loadeddata', 40252 topLoadedMetadata: 'loadedmetadata', 40253 topLoadStart: 'loadstart', 40254 topMouseDown: 'mousedown', 40255 topMouseMove: 'mousemove', 40256 topMouseOut: 'mouseout', 40257 topMouseOver: 'mouseover', 40258 topMouseUp: 'mouseup', 40259 topPaste: 'paste', 40260 topPause: 'pause', 40261 topPlay: 'play', 40262 topPlaying: 'playing', 40263 topProgress: 'progress', 40264 topRateChange: 'ratechange', 40265 topScroll: 'scroll', 40266 topSeeked: 'seeked', 40267 topSeeking: 'seeking', 40268 topSelectionChange: 'selectionchange', 40269 topStalled: 'stalled', 40270 topSuspend: 'suspend', 40271 topTextInput: 'textInput', 40272 topTimeUpdate: 'timeupdate', 40273 topTouchCancel: 'touchcancel', 40274 topTouchEnd: 'touchend', 40275 topTouchMove: 'touchmove', 40276 topTouchStart: 'touchstart', 40277 topVolumeChange: 'volumechange', 40278 topWaiting: 'waiting', 40279 topWheel: 'wheel' 40280}; 40281 40282/** 40283 * To ensure no conflicts with other potential React instances on the page 40284 */ 40285var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); 40286 40287function getListeningForDocument(mountAt) { 40288 // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` 40289 // directly. 40290 if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { 40291 mountAt[topListenersIDKey] = reactTopListenersCounter++; 40292 alreadyListeningTo[mountAt[topListenersIDKey]] = {}; 40293 } 40294 return alreadyListeningTo[mountAt[topListenersIDKey]]; 40295} 40296 40297/** 40298 * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For 40299 * example: 40300 * 40301 * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction); 40302 * 40303 * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. 40304 * 40305 * @internal 40306 */ 40307var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { 40308 40309 /** 40310 * Injectable event backend 40311 */ 40312 ReactEventListener: null, 40313 40314 injection: { 40315 /** 40316 * @param {object} ReactEventListener 40317 */ 40318 injectReactEventListener: function (ReactEventListener) { 40319 ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); 40320 ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; 40321 } 40322 }, 40323 40324 /** 40325 * Sets whether or not any created callbacks should be enabled. 40326 * 40327 * @param {boolean} enabled True if callbacks should be enabled. 40328 */ 40329 setEnabled: function (enabled) { 40330 if (ReactBrowserEventEmitter.ReactEventListener) { 40331 ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); 40332 } 40333 }, 40334 40335 /** 40336 * @return {boolean} True if callbacks are enabled. 40337 */ 40338 isEnabled: function () { 40339 return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); 40340 }, 40341 40342 /** 40343 * We listen for bubbled touch events on the document object. 40344 * 40345 * Firefox v8.01 (and possibly others) exhibited strange behavior when 40346 * mounting `onmousemove` events at some node that was not the document 40347 * element. The symptoms were that if your mouse is not moving over something 40348 * contained within that mount point (for example on the background) the 40349 * top-level listeners for `onmousemove` won't be called. However, if you 40350 * register the `mousemove` on the document object, then it will of course 40351 * catch all `mousemove`s. This along with iOS quirks, justifies restricting 40352 * top-level listeners to the document object only, at least for these 40353 * movement types of events and possibly all events. 40354 * 40355 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 40356 * 40357 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but 40358 * they bubble to document. 40359 * 40360 * @param {string} registrationName Name of listener (e.g. `onClick`). 40361 * @param {object} contentDocumentHandle Document which owns the container 40362 */ 40363 listenTo: function (registrationName, contentDocumentHandle) { 40364 var mountAt = contentDocumentHandle; 40365 var isListening = getListeningForDocument(mountAt); 40366 var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; 40367 40368 var topLevelTypes = EventConstants.topLevelTypes; 40369 for (var i = 0; i < dependencies.length; i++) { 40370 var dependency = dependencies[i]; 40371 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { 40372 if (dependency === topLevelTypes.topWheel) { 40373 if (isEventSupported('wheel')) { 40374 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt); 40375 } else if (isEventSupported('mousewheel')) { 40376 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt); 40377 } else { 40378 // Firefox needs to capture a different mouse scroll event. 40379 // @see http://www.quirksmode.org/dom/events/tests/scroll.html 40380 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt); 40381 } 40382 } else if (dependency === topLevelTypes.topScroll) { 40383 40384 if (isEventSupported('scroll', true)) { 40385 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt); 40386 } else { 40387 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); 40388 } 40389 } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) { 40390 40391 if (isEventSupported('focus', true)) { 40392 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt); 40393 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt); 40394 } else if (isEventSupported('focusin')) { 40395 // IE has `focusin` and `focusout` events which bubble. 40396 // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html 40397 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt); 40398 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt); 40399 } 40400 40401 // to make sure blur and focus event listeners are only attached once 40402 isListening[topLevelTypes.topBlur] = true; 40403 isListening[topLevelTypes.topFocus] = true; 40404 } else if (topEventMapping.hasOwnProperty(dependency)) { 40405 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); 40406 } 40407 40408 isListening[dependency] = true; 40409 } 40410 } 40411 }, 40412 40413 trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { 40414 return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); 40415 }, 40416 40417 trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { 40418 return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); 40419 }, 40420 40421 /** 40422 * Listens to window scroll and resize events. We cache scroll values so that 40423 * application code can access them without triggering reflows. 40424 * 40425 * NOTE: Scroll events do not bubble. 40426 * 40427 * @see http://www.quirksmode.org/dom/events/scroll.html 40428 */ 40429 ensureScrollValueMonitoring: function () { 40430 if (!isMonitoringScrollValue) { 40431 var refresh = ViewportMetrics.refreshScrollValues; 40432 ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); 40433 isMonitoringScrollValue = true; 40434 } 40435 }, 40436 40437 eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs, 40438 40439 registrationNameModules: EventPluginHub.registrationNameModules, 40440 40441 putListener: EventPluginHub.putListener, 40442 40443 getListener: EventPluginHub.getListener, 40444 40445 deleteListener: EventPluginHub.deleteListener, 40446 40447 deleteAllListeners: EventPluginHub.deleteAllListeners 40448 40449}); 40450 40451ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', { 40452 putListener: 'putListener', 40453 deleteListener: 'deleteListener' 40454}); 40455 40456module.exports = ReactBrowserEventEmitter; 40457 40458/***/ }), 40459
vendor: 3,562 bytes, lines 40460-40553
40460/***/ "./node_modules/react/lib/ReactCSSTransitionGroup.js": 40461/*!***********************************************************!*\ 40462 !*** ./node_modules/react/lib/ReactCSSTransitionGroup.js ***! 40463 \***********************************************************/ 40464/*! no static exports found */ 40465/***/ (function(module, exports, __webpack_require__) { 40466 40467"use strict"; 40468/** 40469 * Copyright 2013-2015, Facebook, Inc. 40470 * All rights reserved. 40471 * 40472 * This source code is licensed under the BSD-style license found in the 40473 * LICENSE file in the root directory of this source tree. An additional grant 40474 * of patent rights can be found in the PATENTS file in the same directory. 40475 * 40476 * @typechecks 40477 * @providesModule ReactCSSTransitionGroup 40478 */ 40479 40480 40481 40482var React = __webpack_require__(/*! ./React */ "./node_modules/react/lib/React.js"); 40483 40484var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 40485 40486var ReactTransitionGroup = __webpack_require__(/*! ./ReactTransitionGroup */ "./node_modules/react/lib/ReactTransitionGroup.js"); 40487var ReactCSSTransitionGroupChild = __webpack_require__(/*! ./ReactCSSTransitionGroupChild */ "./node_modules/react/lib/ReactCSSTransitionGroupChild.js"); 40488 40489function createTransitionTimeoutPropValidator(transitionType) { 40490 var timeoutPropName = 'transition' + transitionType + 'Timeout'; 40491 var enabledPropName = 'transition' + transitionType; 40492 40493 return function (props) { 40494 // If the transition is enabled 40495 if (props[enabledPropName]) { 40496 // If no timeout duration is provided 40497 if (props[timeoutPropName] == null) { 40498 return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); 40499 40500 // If the duration isn't a number 40501 } else if (typeof props[timeoutPropName] !== 'number') { 40502 return new Error(timeoutPropName + ' must be a number (in milliseconds)'); 40503 } 40504 } 40505 }; 40506} 40507 40508var ReactCSSTransitionGroup = React.createClass({ 40509 displayName: 'ReactCSSTransitionGroup', 40510 40511 propTypes: { 40512 transitionName: ReactCSSTransitionGroupChild.propTypes.name, 40513 40514 transitionAppear: React.PropTypes.bool, 40515 transitionEnter: React.PropTypes.bool, 40516 transitionLeave: React.PropTypes.bool, 40517 transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'), 40518 transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'), 40519 transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave') 40520 }, 40521 40522 getDefaultProps: function () { 40523 return { 40524 transitionAppear: false, 40525 transitionEnter: true, 40526 transitionLeave: true 40527 }; 40528 }, 40529 40530 _wrapChild: function (child) { 40531 // We need to provide this childFactory so that 40532 // ReactCSSTransitionGroupChild can receive updates to name, enter, and 40533 // leave while it is leaving. 40534 return React.createElement(ReactCSSTransitionGroupChild, { 40535 name: this.props.transitionName, 40536 appear: this.props.transitionAppear, 40537 enter: this.props.transitionEnter, 40538 leave: this.props.transitionLeave, 40539 appearTimeout: this.props.transitionAppearTimeout, 40540 enterTimeout: this.props.transitionEnterTimeout, 40541 leaveTimeout: this.props.transitionLeaveTimeout 40542 }, child); 40543 }, 40544 40545 render: function () { 40546 return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild })); 40547 } 40548}); 40549 40550module.exports = ReactCSSTransitionGroup; 40551 40552/***/ }), 40553
vendor: 5,471 bytes, lines 40554-40729
40554/***/ "./node_modules/react/lib/ReactCSSTransitionGroupChild.js": 40555/*!****************************************************************!*\ 40556 !*** ./node_modules/react/lib/ReactCSSTransitionGroupChild.js ***! 40557 \****************************************************************/ 40558/*! no static exports found */ 40559/***/ (function(module, exports, __webpack_require__) { 40560 40561"use strict"; 40562/** 40563 * Copyright 2013-2015, Facebook, Inc. 40564 * All rights reserved. 40565 * 40566 * This source code is licensed under the BSD-style license found in the 40567 * LICENSE file in the root directory of this source tree. An additional grant 40568 * of patent rights can be found in the PATENTS file in the same directory. 40569 * 40570 * @typechecks 40571 * @providesModule ReactCSSTransitionGroupChild 40572 */ 40573 40574 40575 40576var React = __webpack_require__(/*! ./React */ "./node_modules/react/lib/React.js"); 40577var ReactDOM = __webpack_require__(/*! ./ReactDOM */ "./node_modules/react/lib/ReactDOM.js"); 40578 40579var CSSCore = __webpack_require__(/*! fbjs/lib/CSSCore */ "./node_modules/fbjs/lib/CSSCore.js"); 40580var ReactTransitionEvents = __webpack_require__(/*! ./ReactTransitionEvents */ "./node_modules/react/lib/ReactTransitionEvents.js"); 40581 40582var onlyChild = __webpack_require__(/*! ./onlyChild */ "./node_modules/react/lib/onlyChild.js"); 40583 40584// We don't remove the element from the DOM until we receive an animationend or 40585// transitionend event. If the user screws up and forgets to add an animation 40586// their node will be stuck in the DOM forever, so we detect if an animation 40587// does not start and if it doesn't, we just call the end listener immediately. 40588var TICK = 17; 40589 40590var ReactCSSTransitionGroupChild = React.createClass({ 40591 displayName: 'ReactCSSTransitionGroupChild', 40592 40593 propTypes: { 40594 name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({ 40595 enter: React.PropTypes.string, 40596 leave: React.PropTypes.string, 40597 active: React.PropTypes.string 40598 }), React.PropTypes.shape({ 40599 enter: React.PropTypes.string, 40600 enterActive: React.PropTypes.string, 40601 leave: React.PropTypes.string, 40602 leaveActive: React.PropTypes.string, 40603 appear: React.PropTypes.string, 40604 appearActive: React.PropTypes.string 40605 })]).isRequired, 40606 40607 // Once we require timeouts to be specified, we can remove the 40608 // boolean flags (appear etc.) and just accept a number 40609 // or a bool for the timeout flags (appearTimeout etc.) 40610 appear: React.PropTypes.bool, 40611 enter: React.PropTypes.bool, 40612 leave: React.PropTypes.bool, 40613 appearTimeout: React.PropTypes.number, 40614 enterTimeout: React.PropTypes.number, 40615 leaveTimeout: React.PropTypes.number 40616 }, 40617 40618 transition: function (animationType, finishCallback, userSpecifiedDelay) { 40619 var node = ReactDOM.findDOMNode(this); 40620 40621 if (!node) { 40622 if (finishCallback) { 40623 finishCallback(); 40624 } 40625 return; 40626 } 40627 40628 var className = this.props.name[animationType] || this.props.name + '-' + animationType; 40629 var activeClassName = this.props.name[animationType + 'Active'] || className + '-active'; 40630 var timeout = null; 40631 40632 var endListener = function (e) { 40633 if (e && e.target !== node) { 40634 return; 40635 } 40636 40637 clearTimeout(timeout); 40638 40639 CSSCore.removeClass(node, className); 40640 CSSCore.removeClass(node, activeClassName); 40641 40642 ReactTransitionEvents.removeEndEventListener(node, endListener); 40643 40644 // Usually this optional callback is used for informing an owner of 40645 // a leave animation and telling it to remove the child. 40646 if (finishCallback) { 40647 finishCallback(); 40648 } 40649 }; 40650 40651 CSSCore.addClass(node, className); 40652 40653 // Need to do this to actually trigger a transition. 40654 this.queueClass(activeClassName); 40655 40656 // If the user specified a timeout delay. 40657 if (userSpecifiedDelay) { 40658 // Clean-up the animation after the specified delay 40659 timeout = setTimeout(endListener, userSpecifiedDelay); 40660 this.transitionTimeouts.push(timeout); 40661 } else { 40662 // DEPRECATED: this listener will be removed in a future version of react 40663 ReactTransitionEvents.addEndEventListener(node, endListener); 40664 } 40665 }, 40666 40667 queueClass: function (className) { 40668 this.classNameQueue.push(className); 40669 40670 if (!this.timeout) { 40671 this.timeout = setTimeout(this.flushClassNameQueue, TICK); 40672 } 40673 }, 40674 40675 flushClassNameQueue: function () { 40676 if (this.isMounted()) { 40677 this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this))); 40678 } 40679 this.classNameQueue.length = 0; 40680 this.timeout = null; 40681 }, 40682 40683 componentWillMount: function () { 40684 this.classNameQueue = []; 40685 this.transitionTimeouts = []; 40686 }, 40687 40688 componentWillUnmount: function () { 40689 if (this.timeout) { 40690 clearTimeout(this.timeout); 40691 } 40692 this.transitionTimeouts.forEach(function (timeout) { 40693 clearTimeout(timeout); 40694 }); 40695 }, 40696 40697 componentWillAppear: function (done) { 40698 if (this.props.appear) { 40699 this.transition('appear', done, this.props.appearTimeout); 40700 } else { 40701 done(); 40702 } 40703 }, 40704 40705 componentWillEnter: function (done) { 40706 if (this.props.enter) { 40707 this.transition('enter', done, this.props.enterTimeout); 40708 } else { 40709 done(); 40710 } 40711 }, 40712 40713 componentWillLeave: function (done) { 40714 if (this.props.leave) { 40715 this.transition('leave', done, this.props.leaveTimeout); 40716 } else { 40717 done(); 40718 } 40719 }, 40720 40721 render: function () { 40722 return onlyChild(this.props.children); 40723 } 40724}); 40725 40726module.exports = ReactCSSTransitionGroupChild; 40727 40728/***/ }), 40729
vendor: 5,132 bytes, lines 40730-40862
40730/***/ "./node_modules/react/lib/ReactChildReconciler.js": 40731/*!********************************************************!*\ 40732 !*** ./node_modules/react/lib/ReactChildReconciler.js ***! 40733 \********************************************************/ 40734/*! no static exports found */ 40735/***/ (function(module, exports, __webpack_require__) { 40736 40737"use strict"; 40738/** 40739 * Copyright 2014-2015, Facebook, Inc. 40740 * All rights reserved. 40741 * 40742 * This source code is licensed under the BSD-style license found in the 40743 * LICENSE file in the root directory of this source tree. An additional grant 40744 * of patent rights can be found in the PATENTS file in the same directory. 40745 * 40746 * @providesModule ReactChildReconciler 40747 * @typechecks static-only 40748 */ 40749 40750 40751 40752var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 40753 40754var instantiateReactComponent = __webpack_require__(/*! ./instantiateReactComponent */ "./node_modules/react/lib/instantiateReactComponent.js"); 40755var shouldUpdateReactComponent = __webpack_require__(/*! ./shouldUpdateReactComponent */ "./node_modules/react/lib/shouldUpdateReactComponent.js"); 40756var traverseAllChildren = __webpack_require__(/*! ./traverseAllChildren */ "./node_modules/react/lib/traverseAllChildren.js"); 40757var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 40758 40759function instantiateChild(childInstances, child, name) { 40760 // We found a component instance. 40761 var keyUnique = childInstances[name] === undefined; 40762 if (true) { 40763 true ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined; 40764 } 40765 if (child != null && keyUnique) { 40766 childInstances[name] = instantiateReactComponent(child, null); 40767 } 40768} 40769 40770/** 40771 * ReactChildReconciler provides helpers for initializing or updating a set of 40772 * children. Its output is suitable for passing it onto ReactMultiChild which 40773 * does diffed reordering and insertion. 40774 */ 40775var ReactChildReconciler = { 40776 /** 40777 * Generates a "mount image" for each of the supplied children. In the case 40778 * of `ReactDOMComponent`, a mount image is a string of markup. 40779 * 40780 * @param {?object} nestedChildNodes Nested child maps. 40781 * @return {?object} A set of child instances. 40782 * @internal 40783 */ 40784 instantiateChildren: function (nestedChildNodes, transaction, context) { 40785 if (nestedChildNodes == null) { 40786 return null; 40787 } 40788 var childInstances = {}; 40789 traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); 40790 return childInstances; 40791 }, 40792 40793 /** 40794 * Updates the rendered children and returns a new set of children. 40795 * 40796 * @param {?object} prevChildren Previously initialized set of children. 40797 * @param {?object} nextChildren Flat child element maps. 40798 * @param {ReactReconcileTransaction} transaction 40799 * @param {object} context 40800 * @return {?object} A new set of child instances. 40801 * @internal 40802 */ 40803 updateChildren: function (prevChildren, nextChildren, transaction, context) { 40804 // We currently don't have a way to track moves here but if we use iterators 40805 // instead of for..in we can zip the iterators and check if an item has 40806 // moved. 40807 // TODO: If nothing has changed, return the prevChildren object so that we 40808 // can quickly bailout if nothing has changed. 40809 if (!nextChildren && !prevChildren) { 40810 return null; 40811 } 40812 var name; 40813 for (name in nextChildren) { 40814 if (!nextChildren.hasOwnProperty(name)) { 40815 continue; 40816 } 40817 var prevChild = prevChildren && prevChildren[name]; 40818 var prevElement = prevChild && prevChild._currentElement; 40819 var nextElement = nextChildren[name]; 40820 if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { 40821 ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); 40822 nextChildren[name] = prevChild; 40823 } else { 40824 if (prevChild) { 40825 ReactReconciler.unmountComponent(prevChild, name); 40826 } 40827 // The child must be instantiated before it's mounted. 40828 var nextChildInstance = instantiateReactComponent(nextElement, null); 40829 nextChildren[name] = nextChildInstance; 40830 } 40831 } 40832 // Unmount children that are no longer present. 40833 for (name in prevChildren) { 40834 if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { 40835 ReactReconciler.unmountComponent(prevChildren[name]); 40836 } 40837 } 40838 return nextChildren; 40839 }, 40840 40841 /** 40842 * Unmounts all rendered children. This should be used to clean up children 40843 * when this component is unmounted. 40844 * 40845 * @param {?object} renderedChildren Previously initialized set of children. 40846 * @internal 40847 */ 40848 unmountChildren: function (renderedChildren) { 40849 for (var name in renderedChildren) { 40850 if (renderedChildren.hasOwnProperty(name)) { 40851 var renderedChild = renderedChildren[name]; 40852 ReactReconciler.unmountComponent(renderedChild); 40853 } 40854 } 40855 } 40856 40857}; 40858 40859module.exports = ReactChildReconciler; 40860 40861/***/ }), 40862
vendor: 6,398 bytes, lines 40863-41055
40863/***/ "./node_modules/react/lib/ReactChildren.js": 40864/*!*************************************************!*\ 40865 !*** ./node_modules/react/lib/ReactChildren.js ***! 40866 \*************************************************/ 40867/*! no static exports found */ 40868/***/ (function(module, exports, __webpack_require__) { 40869 40870"use strict"; 40871/** 40872 * Copyright 2013-2015, Facebook, Inc. 40873 * All rights reserved. 40874 * 40875 * This source code is licensed under the BSD-style license found in the 40876 * LICENSE file in the root directory of this source tree. An additional grant 40877 * of patent rights can be found in the PATENTS file in the same directory. 40878 * 40879 * @providesModule ReactChildren 40880 */ 40881 40882 40883 40884var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 40885var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 40886 40887var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 40888var traverseAllChildren = __webpack_require__(/*! ./traverseAllChildren */ "./node_modules/react/lib/traverseAllChildren.js"); 40889 40890var twoArgumentPooler = PooledClass.twoArgumentPooler; 40891var fourArgumentPooler = PooledClass.fourArgumentPooler; 40892 40893var userProvidedKeyEscapeRegex = /\/(?!\/)/g; 40894function escapeUserProvidedKey(text) { 40895 return ('' + text).replace(userProvidedKeyEscapeRegex, '//'); 40896} 40897 40898/** 40899 * PooledClass representing the bookkeeping associated with performing a child 40900 * traversal. Allows avoiding binding callbacks. 40901 * 40902 * @constructor ForEachBookKeeping 40903 * @param {!function} forEachFunction Function to perform traversal with. 40904 * @param {?*} forEachContext Context to perform context with. 40905 */ 40906function ForEachBookKeeping(forEachFunction, forEachContext) { 40907 this.func = forEachFunction; 40908 this.context = forEachContext; 40909 this.count = 0; 40910} 40911ForEachBookKeeping.prototype.destructor = function () { 40912 this.func = null; 40913 this.context = null; 40914 this.count = 0; 40915}; 40916PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); 40917 40918function forEachSingleChild(bookKeeping, child, name) { 40919 var func = bookKeeping.func; 40920 var context = bookKeeping.context; 40921 40922 func.call(context, child, bookKeeping.count++); 40923} 40924 40925/** 40926 * Iterates through children that are typically specified as `props.children`. 40927 * 40928 * The provided forEachFunc(child, index) will be called for each 40929 * leaf child. 40930 * 40931 * @param {?*} children Children tree container. 40932 * @param {function(*, int)} forEachFunc 40933 * @param {*} forEachContext Context for forEachContext. 40934 */ 40935function forEachChildren(children, forEachFunc, forEachContext) { 40936 if (children == null) { 40937 return children; 40938 } 40939 var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); 40940 traverseAllChildren(children, forEachSingleChild, traverseContext); 40941 ForEachBookKeeping.release(traverseContext); 40942} 40943 40944/** 40945 * PooledClass representing the bookkeeping associated with performing a child 40946 * mapping. Allows avoiding binding callbacks. 40947 * 40948 * @constructor MapBookKeeping 40949 * @param {!*} mapResult Object containing the ordered map of results. 40950 * @param {!function} mapFunction Function to perform mapping with. 40951 * @param {?*} mapContext Context to perform mapping with. 40952 */ 40953function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { 40954 this.result = mapResult; 40955 this.keyPrefix = keyPrefix; 40956 this.func = mapFunction; 40957 this.context = mapContext; 40958 this.count = 0; 40959} 40960MapBookKeeping.prototype.destructor = function () { 40961 this.result = null; 40962 this.keyPrefix = null; 40963 this.func = null; 40964 this.context = null; 40965 this.count = 0; 40966}; 40967PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); 40968 40969function mapSingleChildIntoContext(bookKeeping, child, childKey) { 40970 var result = bookKeeping.result; 40971 var keyPrefix = bookKeeping.keyPrefix; 40972 var func = bookKeeping.func; 40973 var context = bookKeeping.context; 40974 40975 var mappedChild = func.call(context, child, bookKeeping.count++); 40976 if (Array.isArray(mappedChild)) { 40977 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); 40978 } else if (mappedChild != null) { 40979 if (ReactElement.isValidElement(mappedChild)) { 40980 mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, 40981 // Keep both the (mapped) and old keys if they differ, just as 40982 // traverseAllChildren used to do for objects as children 40983 keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey); 40984 } 40985 result.push(mappedChild); 40986 } 40987} 40988 40989function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { 40990 var escapedPrefix = ''; 40991 if (prefix != null) { 40992 escapedPrefix = escapeUserProvidedKey(prefix) + '/'; 40993 } 40994 var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); 40995 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); 40996 MapBookKeeping.release(traverseContext); 40997} 40998 40999/** 41000 * Maps children that are typically specified as `props.children`. 41001 * 41002 * The provided mapFunction(child, key, index) will be called for each 41003 * leaf child. 41004 * 41005 * @param {?*} children Children tree container. 41006 * @param {function(*, int)} func The map function. 41007 * @param {*} context Context for mapFunction. 41008 * @return {object} Object containing the ordered map of results. 41009 */ 41010function mapChildren(children, func, context) { 41011 if (children == null) { 41012 return children; 41013 } 41014 var result = []; 41015 mapIntoWithKeyPrefixInternal(children, result, null, func, context); 41016 return result; 41017} 41018 41019function forEachSingleChildDummy(traverseContext, child, name) { 41020 return null; 41021} 41022 41023/** 41024 * Count the number of children that are typically specified as 41025 * `props.children`. 41026 * 41027 * @param {?*} children Children tree container. 41028 * @return {number} The number of children. 41029 */ 41030function countChildren(children, context) { 41031 return traverseAllChildren(children, forEachSingleChildDummy, null); 41032} 41033 41034/** 41035 * Flatten a children object (typically specified as `props.children`) and 41036 * return an array with appropriately re-keyed children. 41037 */ 41038function toArray(children) { 41039 var result = []; 41040 mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); 41041 return result; 41042} 41043 41044var ReactChildren = { 41045 forEach: forEachChildren, 41046 map: mapChildren, 41047 mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, 41048 count: countChildren, 41049 toArray: toArray 41050}; 41051 41052module.exports = ReactChildren; 41053 41054/***/ }), 41055
vendor: 27,783 bytes, lines 41056-41837
41056/***/ "./node_modules/react/lib/ReactClass.js": 41057/*!**********************************************!*\ 41058 !*** ./node_modules/react/lib/ReactClass.js ***! 41059 \**********************************************/ 41060/*! no static exports found */ 41061/***/ (function(module, exports, __webpack_require__) { 41062 41063"use strict"; 41064/** 41065 * Copyright 2013-2015, Facebook, Inc. 41066 * All rights reserved. 41067 * 41068 * This source code is licensed under the BSD-style license found in the 41069 * LICENSE file in the root directory of this source tree. An additional grant 41070 * of patent rights can be found in the PATENTS file in the same directory. 41071 * 41072 * @providesModule ReactClass 41073 */ 41074 41075 41076 41077var ReactComponent = __webpack_require__(/*! ./ReactComponent */ "./node_modules/react/lib/ReactComponent.js"); 41078var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 41079var ReactPropTypeLocations = __webpack_require__(/*! ./ReactPropTypeLocations */ "./node_modules/react/lib/ReactPropTypeLocations.js"); 41080var ReactPropTypeLocationNames = __webpack_require__(/*! ./ReactPropTypeLocationNames */ "./node_modules/react/lib/ReactPropTypeLocationNames.js"); 41081var ReactNoopUpdateQueue = __webpack_require__(/*! ./ReactNoopUpdateQueue */ "./node_modules/react/lib/ReactNoopUpdateQueue.js"); 41082 41083var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 41084var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); 41085var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 41086var keyMirror = __webpack_require__(/*! fbjs/lib/keyMirror */ "./node_modules/fbjs/lib/keyMirror.js"); 41087var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 41088var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 41089 41090var MIXINS_KEY = keyOf({ mixins: null }); 41091 41092/** 41093 * Policies that describe methods in `ReactClassInterface`. 41094 */ 41095var SpecPolicy = keyMirror({ 41096 /** 41097 * These methods may be defined only once by the class specification or mixin. 41098 */ 41099 DEFINE_ONCE: null, 41100 /** 41101 * These methods may be defined by both the class specification and mixins. 41102 * Subsequent definitions will be chained. These methods must return void. 41103 */ 41104 DEFINE_MANY: null, 41105 /** 41106 * These methods are overriding the base class. 41107 */ 41108 OVERRIDE_BASE: null, 41109 /** 41110 * These methods are similar to DEFINE_MANY, except we assume they return 41111 * objects. We try to merge the keys of the return values of all the mixed in 41112 * functions. If there is a key conflict we throw. 41113 */ 41114 DEFINE_MANY_MERGED: null 41115}); 41116 41117var injectedMixins = []; 41118 41119var warnedSetProps = false; 41120function warnSetProps() { 41121 if (!warnedSetProps) { 41122 warnedSetProps = true; 41123 true ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined; 41124 } 41125} 41126 41127/** 41128 * Composite components are higher-level components that compose other composite 41129 * or native components. 41130 * 41131 * To create a new type of `ReactClass`, pass a specification of 41132 * your new class to `React.createClass`. The only requirement of your class 41133 * specification is that you implement a `render` method. 41134 * 41135 * var MyComponent = React.createClass({ 41136 * render: function() { 41137 * return <div>Hello World</div>; 41138 * } 41139 * }); 41140 * 41141 * The class specification supports a specific protocol of methods that have 41142 * special meaning (e.g. `render`). See `ReactClassInterface` for 41143 * more the comprehensive protocol. Any other properties and methods in the 41144 * class specification will be available on the prototype. 41145 * 41146 * @interface ReactClassInterface 41147 * @internal 41148 */ 41149var ReactClassInterface = { 41150 41151 /** 41152 * An array of Mixin objects to include when defining your component. 41153 * 41154 * @type {array} 41155 * @optional 41156 */ 41157 mixins: SpecPolicy.DEFINE_MANY, 41158 41159 /** 41160 * An object containing properties and methods that should be defined on 41161 * the component's constructor instead of its prototype (static methods). 41162 * 41163 * @type {object} 41164 * @optional 41165 */ 41166 statics: SpecPolicy.DEFINE_MANY, 41167 41168 /** 41169 * Definition of prop types for this component. 41170 * 41171 * @type {object} 41172 * @optional 41173 */ 41174 propTypes: SpecPolicy.DEFINE_MANY, 41175 41176 /** 41177 * Definition of context types for this component. 41178 * 41179 * @type {object} 41180 * @optional 41181 */ 41182 contextTypes: SpecPolicy.DEFINE_MANY, 41183 41184 /** 41185 * Definition of context types this component sets for its children. 41186 * 41187 * @type {object} 41188 * @optional 41189 */ 41190 childContextTypes: SpecPolicy.DEFINE_MANY, 41191 41192 // ==== Definition methods ==== 41193 41194 /** 41195 * Invoked when the component is mounted. Values in the mapping will be set on 41196 * `this.props` if that prop is not specified (i.e. using an `in` check). 41197 * 41198 * This method is invoked before `getInitialState` and therefore cannot rely 41199 * on `this.state` or use `this.setState`. 41200 * 41201 * @return {object} 41202 * @optional 41203 */ 41204 getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, 41205 41206 /** 41207 * Invoked once before the component is mounted. The return value will be used 41208 * as the initial value of `this.state`. 41209 * 41210 * getInitialState: function() { 41211 * return { 41212 * isOn: false, 41213 * fooBaz: new BazFoo() 41214 * } 41215 * } 41216 * 41217 * @return {object} 41218 * @optional 41219 */ 41220 getInitialState: SpecPolicy.DEFINE_MANY_MERGED, 41221 41222 /** 41223 * @return {object} 41224 * @optional 41225 */ 41226 getChildContext: SpecPolicy.DEFINE_MANY_MERGED, 41227 41228 /** 41229 * Uses props from `this.props` and state from `this.state` to render the 41230 * structure of the component. 41231 * 41232 * No guarantees are made about when or how often this method is invoked, so 41233 * it must not have side effects. 41234 * 41235 * render: function() { 41236 * var name = this.props.name; 41237 * return <div>Hello, {name}!</div>; 41238 * } 41239 * 41240 * @return {ReactComponent} 41241 * @nosideeffects 41242 * @required 41243 */ 41244 render: SpecPolicy.DEFINE_ONCE, 41245 41246 // ==== Delegate methods ==== 41247 41248 /** 41249 * Invoked when the component is initially created and about to be mounted. 41250 * This may have side effects, but any external subscriptions or data created 41251 * by this method must be cleaned up in `componentWillUnmount`. 41252 * 41253 * @optional 41254 */ 41255 componentWillMount: SpecPolicy.DEFINE_MANY, 41256 41257 /** 41258 * Invoked when the component has been mounted and has a DOM representation. 41259 * However, there is no guarantee that the DOM node is in the document. 41260 * 41261 * Use this as an opportunity to operate on the DOM when the component has 41262 * been mounted (initialized and rendered) for the first time. 41263 * 41264 * @param {DOMElement} rootNode DOM element representing the component. 41265 * @optional 41266 */ 41267 componentDidMount: SpecPolicy.DEFINE_MANY, 41268 41269 /** 41270 * Invoked before the component receives new props. 41271 * 41272 * Use this as an opportunity to react to a prop transition by updating the 41273 * state using `this.setState`. Current props are accessed via `this.props`. 41274 * 41275 * componentWillReceiveProps: function(nextProps, nextContext) { 41276 * this.setState({ 41277 * likesIncreasing: nextProps.likeCount > this.props.likeCount 41278 * }); 41279 * } 41280 * 41281 * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop 41282 * transition may cause a state change, but the opposite is not true. If you 41283 * need it, you are probably looking for `componentWillUpdate`. 41284 * 41285 * @param {object} nextProps 41286 * @optional 41287 */ 41288 componentWillReceiveProps: SpecPolicy.DEFINE_MANY, 41289 41290 /** 41291 * Invoked while deciding if the component should be updated as a result of 41292 * receiving new props, state and/or context. 41293 * 41294 * Use this as an opportunity to `return false` when you're certain that the 41295 * transition to the new props/state/context will not require a component 41296 * update. 41297 * 41298 * shouldComponentUpdate: function(nextProps, nextState, nextContext) { 41299 * return !equal(nextProps, this.props) || 41300 * !equal(nextState, this.state) || 41301 * !equal(nextContext, this.context); 41302 * } 41303 * 41304 * @param {object} nextProps 41305 * @param {?object} nextState 41306 * @param {?object} nextContext 41307 * @return {boolean} True if the component should update. 41308 * @optional 41309 */ 41310 shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, 41311 41312 /** 41313 * Invoked when the component is about to update due to a transition from 41314 * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` 41315 * and `nextContext`. 41316 * 41317 * Use this as an opportunity to perform preparation before an update occurs. 41318 * 41319 * NOTE: You **cannot** use `this.setState()` in this method. 41320 * 41321 * @param {object} nextProps 41322 * @param {?object} nextState 41323 * @param {?object} nextContext 41324 * @param {ReactReconcileTransaction} transaction 41325 * @optional 41326 */ 41327 componentWillUpdate: SpecPolicy.DEFINE_MANY, 41328 41329 /** 41330 * Invoked when the component's DOM representation has been updated. 41331 * 41332 * Use this as an opportunity to operate on the DOM when the component has 41333 * been updated. 41334 * 41335 * @param {object} prevProps 41336 * @param {?object} prevState 41337 * @param {?object} prevContext 41338 * @param {DOMElement} rootNode DOM element representing the component. 41339 * @optional 41340 */ 41341 componentDidUpdate: SpecPolicy.DEFINE_MANY, 41342 41343 /** 41344 * Invoked when the component is about to be removed from its parent and have 41345 * its DOM representation destroyed. 41346 * 41347 * Use this as an opportunity to deallocate any external resources. 41348 * 41349 * NOTE: There is no `componentDidUnmount` since your component will have been 41350 * destroyed by that point. 41351 * 41352 * @optional 41353 */ 41354 componentWillUnmount: SpecPolicy.DEFINE_MANY, 41355 41356 // ==== Advanced methods ==== 41357 41358 /** 41359 * Updates the component's currently mounted DOM representation. 41360 * 41361 * By default, this implements React's rendering and reconciliation algorithm. 41362 * Sophisticated clients may wish to override this. 41363 * 41364 * @param {ReactReconcileTransaction} transaction 41365 * @internal 41366 * @overridable 41367 */ 41368 updateComponent: SpecPolicy.OVERRIDE_BASE 41369 41370}; 41371 41372/** 41373 * Mapping from class specification keys to special processing functions. 41374 * 41375 * Although these are declared like instance properties in the specification 41376 * when defining classes using `React.createClass`, they are actually static 41377 * and are accessible on the constructor instead of the prototype. Despite 41378 * being static, they must be defined outside of the "statics" key under 41379 * which all other static methods are defined. 41380 */ 41381var RESERVED_SPEC_KEYS = { 41382 displayName: function (Constructor, displayName) { 41383 Constructor.displayName = displayName; 41384 }, 41385 mixins: function (Constructor, mixins) { 41386 if (mixins) { 41387 for (var i = 0; i < mixins.length; i++) { 41388 mixSpecIntoComponent(Constructor, mixins[i]); 41389 } 41390 } 41391 }, 41392 childContextTypes: function (Constructor, childContextTypes) { 41393 if (true) { 41394 validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext); 41395 } 41396 Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes); 41397 }, 41398 contextTypes: function (Constructor, contextTypes) { 41399 if (true) { 41400 validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context); 41401 } 41402 Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes); 41403 }, 41404 /** 41405 * Special case getDefaultProps which should move into statics but requires 41406 * automatic merging. 41407 */ 41408 getDefaultProps: function (Constructor, getDefaultProps) { 41409 if (Constructor.getDefaultProps) { 41410 Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); 41411 } else { 41412 Constructor.getDefaultProps = getDefaultProps; 41413 } 41414 }, 41415 propTypes: function (Constructor, propTypes) { 41416 if (true) { 41417 validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop); 41418 } 41419 Constructor.propTypes = assign({}, Constructor.propTypes, propTypes); 41420 }, 41421 statics: function (Constructor, statics) { 41422 mixStaticSpecIntoComponent(Constructor, statics); 41423 }, 41424 autobind: function () {} }; 41425 41426// noop 41427function validateTypeDef(Constructor, typeDef, location) { 41428 for (var propName in typeDef) { 41429 if (typeDef.hasOwnProperty(propName)) { 41430 // use a warning instead of an invariant so components 41431 // don't show up in prod but not in __DEV__ 41432 true ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined; 41433 } 41434 } 41435} 41436 41437function validateMethodOverride(proto, name) { 41438 var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; 41439 41440 // Disallow overriding of base class methods unless explicitly allowed. 41441 if (ReactClassMixin.hasOwnProperty(name)) { 41442 !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? true ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : undefined : undefined; 41443 } 41444 41445 // Disallow defining methods more than once unless explicitly allowed. 41446 if (proto.hasOwnProperty(name)) { 41447 !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? true ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : undefined : undefined; 41448 } 41449} 41450 41451/** 41452 * Mixin helper which handles policy validation and reserved 41453 * specification keys when building React classses. 41454 */ 41455function mixSpecIntoComponent(Constructor, spec) { 41456 if (!spec) { 41457 return; 41458 } 41459 41460 !(typeof spec !== 'function') ? true ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : undefined : undefined; 41461 !!ReactElement.isValidElement(spec) ? true ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : undefined : undefined; 41462 41463 var proto = Constructor.prototype; 41464 41465 // By handling mixins before any other properties, we ensure the same 41466 // chaining order is applied to methods with DEFINE_MANY policy, whether 41467 // mixins are listed before or after these methods in the spec. 41468 if (spec.hasOwnProperty(MIXINS_KEY)) { 41469 RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); 41470 } 41471 41472 for (var name in spec) { 41473 if (!spec.hasOwnProperty(name)) { 41474 continue; 41475 } 41476 41477 if (name === MIXINS_KEY) { 41478 // We have already handled mixins in a special case above. 41479 continue; 41480 } 41481 41482 var property = spec[name]; 41483 validateMethodOverride(proto, name); 41484 41485 if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { 41486 RESERVED_SPEC_KEYS[name](Constructor, property); 41487 } else { 41488 // Setup methods on prototype: 41489 // The following member methods should not be automatically bound: 41490 // 1. Expected ReactClass methods (in the "interface"). 41491 // 2. Overridden methods (that were mixed in). 41492 var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); 41493 var isAlreadyDefined = proto.hasOwnProperty(name); 41494 var isFunction = typeof property === 'function'; 41495 var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; 41496 41497 if (shouldAutoBind) { 41498 if (!proto.__reactAutoBindMap) { 41499 proto.__reactAutoBindMap = {}; 41500 } 41501 proto.__reactAutoBindMap[name] = property; 41502 proto[name] = property; 41503 } else { 41504 if (isAlreadyDefined) { 41505 var specPolicy = ReactClassInterface[name]; 41506 41507 // These cases should already be caught by validateMethodOverride. 41508 !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? true ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : undefined : undefined; 41509 41510 // For methods which are defined more than once, call the existing 41511 // methods before calling the new property, merging if appropriate. 41512 if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { 41513 proto[name] = createMergedResultFunction(proto[name], property); 41514 } else if (specPolicy === SpecPolicy.DEFINE_MANY) { 41515 proto[name] = createChainedFunction(proto[name], property); 41516 } 41517 } else { 41518 proto[name] = property; 41519 if (true) { 41520 // Add verbose displayName to the function, which helps when looking 41521 // at profiling tools. 41522 if (typeof property === 'function' && spec.displayName) { 41523 proto[name].displayName = spec.displayName + '_' + name; 41524 } 41525 } 41526 } 41527 } 41528 } 41529 } 41530} 41531 41532function mixStaticSpecIntoComponent(Constructor, statics) { 41533 if (!statics) { 41534 return; 41535 } 41536 for (var name in statics) { 41537 var property = statics[name]; 41538 if (!statics.hasOwnProperty(name)) { 41539 continue; 41540 } 41541 41542 var isReserved = (name in RESERVED_SPEC_KEYS); 41543 !!isReserved ? true ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : undefined : undefined; 41544 41545 var isInherited = (name in Constructor); 41546 !!isInherited ? true ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : undefined : undefined; 41547 Constructor[name] = property; 41548 } 41549} 41550 41551/** 41552 * Merge two objects, but throw if both contain the same key. 41553 * 41554 * @param {object} one The first object, which is mutated. 41555 * @param {object} two The second object 41556 * @return {object} one after it has been mutated to contain everything in two. 41557 */ 41558function mergeIntoWithNoDuplicateKeys(one, two) { 41559 !(one && two && typeof one === 'object' && typeof two === 'object') ? true ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : undefined : undefined; 41560 41561 for (var key in two) { 41562 if (two.hasOwnProperty(key)) { 41563 !(one[key] === undefined) ? true ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : undefined : undefined; 41564 one[key] = two[key]; 41565 } 41566 } 41567 return one; 41568} 41569 41570/** 41571 * Creates a function that invokes two functions and merges their return values. 41572 * 41573 * @param {function} one Function to invoke first. 41574 * @param {function} two Function to invoke second. 41575 * @return {function} Function that invokes the two argument functions. 41576 * @private 41577 */ 41578function createMergedResultFunction(one, two) { 41579 return function mergedResult() { 41580 var a = one.apply(this, arguments); 41581 var b = two.apply(this, arguments); 41582 if (a == null) { 41583 return b; 41584 } else if (b == null) { 41585 return a; 41586 } 41587 var c = {}; 41588 mergeIntoWithNoDuplicateKeys(c, a); 41589 mergeIntoWithNoDuplicateKeys(c, b); 41590 return c; 41591 }; 41592} 41593 41594/** 41595 * Creates a function that invokes two functions and ignores their return vales. 41596 * 41597 * @param {function} one Function to invoke first. 41598 * @param {function} two Function to invoke second. 41599 * @return {function} Function that invokes the two argument functions. 41600 * @private 41601 */ 41602function createChainedFunction(one, two) { 41603 return function chainedFunction() { 41604 one.apply(this, arguments); 41605 two.apply(this, arguments); 41606 }; 41607} 41608 41609/** 41610 * Binds a method to the component. 41611 * 41612 * @param {object} component Component whose method is going to be bound. 41613 * @param {function} method Method to be bound. 41614 * @return {function} The bound method. 41615 */ 41616function bindAutoBindMethod(component, method) { 41617 var boundMethod = method.bind(component); 41618 if (true) { 41619 boundMethod.__reactBoundContext = component; 41620 boundMethod.__reactBoundMethod = method; 41621 boundMethod.__reactBoundArguments = null; 41622 var componentName = component.constructor.displayName; 41623 var _bind = boundMethod.bind; 41624 /* eslint-disable block-scoped-var, no-undef */ 41625 boundMethod.bind = function (newThis) { 41626 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 41627 args[_key - 1] = arguments[_key]; 41628 } 41629 41630 // User is trying to bind() an autobound method; we effectively will 41631 // ignore the value of "this" that the user is trying to use, so 41632 // let's warn. 41633 if (newThis !== component && newThis !== null) { 41634 true ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined; 41635 } else if (!args.length) { 41636 true ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined; 41637 return boundMethod; 41638 } 41639 var reboundMethod = _bind.apply(boundMethod, arguments); 41640 reboundMethod.__reactBoundContext = component; 41641 reboundMethod.__reactBoundMethod = method; 41642 reboundMethod.__reactBoundArguments = args; 41643 return reboundMethod; 41644 /* eslint-enable */ 41645 }; 41646 } 41647 return boundMethod; 41648} 41649 41650/** 41651 * Binds all auto-bound methods in a component. 41652 * 41653 * @param {object} component Component whose method is going to be bound. 41654 */ 41655function bindAutoBindMethods(component) { 41656 for (var autoBindKey in component.__reactAutoBindMap) { 41657 if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { 41658 var method = component.__reactAutoBindMap[autoBindKey]; 41659 component[autoBindKey] = bindAutoBindMethod(component, method); 41660 } 41661 } 41662} 41663 41664/** 41665 * Add more to the ReactClass base class. These are all legacy features and 41666 * therefore not already part of the modern ReactComponent. 41667 */ 41668var ReactClassMixin = { 41669 41670 /** 41671 * TODO: This will be deprecated because state should always keep a consistent 41672 * type signature and the only use case for this, is to avoid that. 41673 */ 41674 replaceState: function (newState, callback) { 41675 this.updater.enqueueReplaceState(this, newState); 41676 if (callback) { 41677 this.updater.enqueueCallback(this, callback); 41678 } 41679 }, 41680 41681 /** 41682 * Checks whether or not this composite component is mounted. 41683 * @return {boolean} True if mounted, false otherwise. 41684 * @protected 41685 * @final 41686 */ 41687 isMounted: function () { 41688 return this.updater.isMounted(this); 41689 }, 41690 41691 /** 41692 * Sets a subset of the props. 41693 * 41694 * @param {object} partialProps Subset of the next props. 41695 * @param {?function} callback Called after props are updated. 41696 * @final 41697 * @public 41698 * @deprecated 41699 */ 41700 setProps: function (partialProps, callback) { 41701 if (true) { 41702 warnSetProps(); 41703 } 41704 this.updater.enqueueSetProps(this, partialProps); 41705 if (callback) { 41706 this.updater.enqueueCallback(this, callback); 41707 } 41708 }, 41709 41710 /** 41711 * Replace all the props. 41712 * 41713 * @param {object} newProps Subset of the next props. 41714 * @param {?function} callback Called after props are updated. 41715 * @final 41716 * @public 41717 * @deprecated 41718 */ 41719 replaceProps: function (newProps, callback) { 41720 if (true) { 41721 warnSetProps(); 41722 } 41723 this.updater.enqueueReplaceProps(this, newProps); 41724 if (callback) { 41725 this.updater.enqueueCallback(this, callback); 41726 } 41727 } 41728}; 41729 41730var ReactClassComponent = function () {}; 41731assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); 41732 41733/** 41734 * Module for creating composite components. 41735 * 41736 * @class ReactClass 41737 */ 41738var ReactClass = { 41739 41740 /** 41741 * Creates a composite component class given a class specification. 41742 * 41743 * @param {object} spec Class specification (which must define `render`). 41744 * @return {function} Component constructor function. 41745 * @public 41746 */ 41747 createClass: function (spec) { 41748 var Constructor = function (props, context, updater) { 41749 // This constructor is overridden by mocks. The argument is used 41750 // by mocks to assert on what gets mounted. 41751 41752 if (true) { 41753 true ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined; 41754 } 41755 41756 // Wire up auto-binding 41757 if (this.__reactAutoBindMap) { 41758 bindAutoBindMethods(this); 41759 } 41760 41761 this.props = props; 41762 this.context = context; 41763 this.refs = emptyObject; 41764 this.updater = updater || ReactNoopUpdateQueue; 41765 41766 this.state = null; 41767 41768 // ReactClasses doesn't have constructors. Instead, they use the 41769 // getInitialState and componentWillMount methods for initialization. 41770 41771 var initialState = this.getInitialState ? this.getInitialState() : null; 41772 if (true) { 41773 // We allow auto-mocks to proceed as if they're returning null. 41774 if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) { 41775 // This is probably bad practice. Consider warning here and 41776 // deprecating this convenience. 41777 initialState = null; 41778 } 41779 } 41780 !(typeof initialState === 'object' && !Array.isArray(initialState)) ? true ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : undefined : undefined; 41781 41782 this.state = initialState; 41783 }; 41784 Constructor.prototype = new ReactClassComponent(); 41785 Constructor.prototype.constructor = Constructor; 41786 41787 injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); 41788 41789 mixSpecIntoComponent(Constructor, spec); 41790 41791 // Initialize the defaultProps property after all mixins have been merged. 41792 if (Constructor.getDefaultProps) { 41793 Constructor.defaultProps = Constructor.getDefaultProps(); 41794 } 41795 41796 if (true) { 41797 // This is a tag to indicate that the use of these method names is ok, 41798 // since it's used with createClass. If it's not, then it's likely a 41799 // mistake so we'll warn you to use the static property, property 41800 // initializer or constructor respectively. 41801 if (Constructor.getDefaultProps) { 41802 Constructor.getDefaultProps.isReactClassApproved = {}; 41803 } 41804 if (Constructor.prototype.getInitialState) { 41805 Constructor.prototype.getInitialState.isReactClassApproved = {}; 41806 } 41807 } 41808 41809 !Constructor.prototype.render ? true ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : undefined : undefined; 41810 41811 if (true) { 41812 true ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined; 41813 true ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined; 41814 } 41815 41816 // Reduce time spent doing lookups by setting these on the prototype. 41817 for (var methodName in ReactClassInterface) { 41818 if (!Constructor.prototype[methodName]) { 41819 Constructor.prototype[methodName] = null; 41820 } 41821 } 41822 41823 return Constructor; 41824 }, 41825 41826 injection: { 41827 injectMixin: function (mixin) { 41828 injectedMixins.push(mixin); 41829 } 41830 } 41831 41832}; 41833 41834module.exports = ReactClass; 41835 41836/***/ }), 41837
vendor: 5,494 bytes, lines 41838-41970
41838/***/ "./node_modules/react/lib/ReactComponent.js": 41839/*!**************************************************!*\ 41840 !*** ./node_modules/react/lib/ReactComponent.js ***! 41841 \**************************************************/ 41842/*! no static exports found */ 41843/***/ (function(module, exports, __webpack_require__) { 41844 41845"use strict"; 41846/** 41847 * Copyright 2013-2015, Facebook, Inc. 41848 * All rights reserved. 41849 * 41850 * This source code is licensed under the BSD-style license found in the 41851 * LICENSE file in the root directory of this source tree. An additional grant 41852 * of patent rights can be found in the PATENTS file in the same directory. 41853 * 41854 * @providesModule ReactComponent 41855 */ 41856 41857 41858 41859var ReactNoopUpdateQueue = __webpack_require__(/*! ./ReactNoopUpdateQueue */ "./node_modules/react/lib/ReactNoopUpdateQueue.js"); 41860 41861var canDefineProperty = __webpack_require__(/*! ./canDefineProperty */ "./node_modules/react/lib/canDefineProperty.js"); 41862var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); 41863var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 41864var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 41865 41866/** 41867 * Base class helpers for the updating state of a component. 41868 */ 41869function ReactComponent(props, context, updater) { 41870 this.props = props; 41871 this.context = context; 41872 this.refs = emptyObject; 41873 // We initialize the default updater but the real one gets injected by the 41874 // renderer. 41875 this.updater = updater || ReactNoopUpdateQueue; 41876} 41877 41878ReactComponent.prototype.isReactComponent = {}; 41879 41880/** 41881 * Sets a subset of the state. Always use this to mutate 41882 * state. You should treat `this.state` as immutable. 41883 * 41884 * There is no guarantee that `this.state` will be immediately updated, so 41885 * accessing `this.state` after calling this method may return the old value. 41886 * 41887 * There is no guarantee that calls to `setState` will run synchronously, 41888 * as they may eventually be batched together. You can provide an optional 41889 * callback that will be executed when the call to setState is actually 41890 * completed. 41891 * 41892 * When a function is provided to setState, it will be called at some point in 41893 * the future (not synchronously). It will be called with the up to date 41894 * component arguments (state, props, context). These values can be different 41895 * from this.* because your function may be called after receiveProps but before 41896 * shouldComponentUpdate, and this new state, props, and context will not yet be 41897 * assigned to this. 41898 * 41899 * @param {object|function} partialState Next partial state or function to 41900 * produce next partial state to be merged with current state. 41901 * @param {?function} callback Called after state is updated. 41902 * @final 41903 * @protected 41904 */ 41905ReactComponent.prototype.setState = function (partialState, callback) { 41906 !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? true ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : undefined : undefined; 41907 if (true) { 41908 true ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined; 41909 } 41910 this.updater.enqueueSetState(this, partialState); 41911 if (callback) { 41912 this.updater.enqueueCallback(this, callback); 41913 } 41914}; 41915 41916/** 41917 * Forces an update. This should only be invoked when it is known with 41918 * certainty that we are **not** in a DOM transaction. 41919 * 41920 * You may want to call this when you know that some deeper aspect of the 41921 * component's state has changed but `setState` was not called. 41922 * 41923 * This will not invoke `shouldComponentUpdate`, but it will invoke 41924 * `componentWillUpdate` and `componentDidUpdate`. 41925 * 41926 * @param {?function} callback Called after update is complete. 41927 * @final 41928 * @protected 41929 */ 41930ReactComponent.prototype.forceUpdate = function (callback) { 41931 this.updater.enqueueForceUpdate(this); 41932 if (callback) { 41933 this.updater.enqueueCallback(this, callback); 41934 } 41935}; 41936 41937/** 41938 * Deprecated APIs. These APIs used to exist on classic React classes but since 41939 * we would like to deprecate them, we're not going to move them over to this 41940 * modern base class. Instead, we define a getter that warns if it's accessed. 41941 */ 41942if (true) { 41943 var deprecatedAPIs = { 41944 getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'], 41945 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], 41946 replaceProps: ['replaceProps', 'Instead, call render again at the top level.'], 41947 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'], 41948 setProps: ['setProps', 'Instead, call render again at the top level.'] 41949 }; 41950 var defineDeprecationWarning = function (methodName, info) { 41951 if (canDefineProperty) { 41952 Object.defineProperty(ReactComponent.prototype, methodName, { 41953 get: function () { 41954 true ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined; 41955 return undefined; 41956 } 41957 }); 41958 } 41959 }; 41960 for (var fnName in deprecatedAPIs) { 41961 if (deprecatedAPIs.hasOwnProperty(fnName)) { 41962 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); 41963 } 41964 } 41965} 41966 41967module.exports = ReactComponent; 41968 41969/***/ }), 41970
vendor: 1,777 bytes, lines 41971-42022
41971/***/ "./node_modules/react/lib/ReactComponentBrowserEnvironment.js": 41972/*!********************************************************************!*\ 41973 !*** ./node_modules/react/lib/ReactComponentBrowserEnvironment.js ***! 41974 \********************************************************************/ 41975/*! no static exports found */ 41976/***/ (function(module, exports, __webpack_require__) { 41977 41978"use strict"; 41979/** 41980 * Copyright 2013-2015, Facebook, Inc. 41981 * All rights reserved. 41982 * 41983 * This source code is licensed under the BSD-style license found in the 41984 * LICENSE file in the root directory of this source tree. An additional grant 41985 * of patent rights can be found in the PATENTS file in the same directory. 41986 * 41987 * @providesModule ReactComponentBrowserEnvironment 41988 */ 41989 41990 41991 41992var ReactDOMIDOperations = __webpack_require__(/*! ./ReactDOMIDOperations */ "./node_modules/react/lib/ReactDOMIDOperations.js"); 41993var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 41994 41995/** 41996 * Abstracts away all functionality of the reconciler that requires knowledge of 41997 * the browser context. TODO: These callers should be refactored to avoid the 41998 * need for this injection. 41999 */ 42000var ReactComponentBrowserEnvironment = { 42001 42002 processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, 42003 42004 replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, 42005 42006 /** 42007 * If a particular environment requires that some resources be cleaned up, 42008 * specify this in the injected Mixin. In the DOM, we would likely want to 42009 * purge any cached node ID lookups. 42010 * 42011 * @private 42012 */ 42013 unmountIDFromEnvironment: function (rootNodeID) { 42014 ReactMount.purgeID(rootNodeID); 42015 } 42016 42017}; 42018 42019module.exports = ReactComponentBrowserEnvironment; 42020 42021/***/ }), 42022
vendor: 2,053 bytes, lines 42023-42084
42023/***/ "./node_modules/react/lib/ReactComponentEnvironment.js": 42024/*!*************************************************************!*\ 42025 !*** ./node_modules/react/lib/ReactComponentEnvironment.js ***! 42026 \*************************************************************/ 42027/*! no static exports found */ 42028/***/ (function(module, exports, __webpack_require__) { 42029 42030"use strict"; 42031/** 42032 * Copyright 2014-2015, Facebook, Inc. 42033 * All rights reserved. 42034 * 42035 * This source code is licensed under the BSD-style license found in the 42036 * LICENSE file in the root directory of this source tree. An additional grant 42037 * of patent rights can be found in the PATENTS file in the same directory. 42038 * 42039 * @providesModule ReactComponentEnvironment 42040 */ 42041 42042 42043 42044var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 42045 42046var injected = false; 42047 42048var ReactComponentEnvironment = { 42049 42050 /** 42051 * Optionally injectable environment dependent cleanup hook. (server vs. 42052 * browser etc). Example: A browser system caches DOM nodes based on component 42053 * ID and must remove that cache entry when this instance is unmounted. 42054 */ 42055 unmountIDFromEnvironment: null, 42056 42057 /** 42058 * Optionally injectable hook for swapping out mount images in the middle of 42059 * the tree. 42060 */ 42061 replaceNodeWithMarkupByID: null, 42062 42063 /** 42064 * Optionally injectable hook for processing a queue of child updates. Will 42065 * later move into MultiChildComponents. 42066 */ 42067 processChildrenUpdates: null, 42068 42069 injection: { 42070 injectEnvironment: function (environment) { 42071 !!injected ? true ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : undefined : undefined; 42072 ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment; 42073 ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID; 42074 ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; 42075 injected = true; 42076 } 42077 } 42078 42079}; 42080 42081module.exports = ReactComponentEnvironment; 42082 42083/***/ }), 42084
vendor: 27,747 bytes, lines 42085-42787
42085/***/ "./node_modules/react/lib/ReactCompositeComponent.js": 42086/*!***********************************************************!*\ 42087 !*** ./node_modules/react/lib/ReactCompositeComponent.js ***! 42088 \***********************************************************/ 42089/*! no static exports found */ 42090/***/ (function(module, exports, __webpack_require__) { 42091 42092"use strict"; 42093/** 42094 * Copyright 2013-2015, Facebook, Inc. 42095 * All rights reserved. 42096 * 42097 * This source code is licensed under the BSD-style license found in the 42098 * LICENSE file in the root directory of this source tree. An additional grant 42099 * of patent rights can be found in the PATENTS file in the same directory. 42100 * 42101 * @providesModule ReactCompositeComponent 42102 */ 42103 42104 42105 42106var ReactComponentEnvironment = __webpack_require__(/*! ./ReactComponentEnvironment */ "./node_modules/react/lib/ReactComponentEnvironment.js"); 42107var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 42108var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 42109var ReactInstanceMap = __webpack_require__(/*! ./ReactInstanceMap */ "./node_modules/react/lib/ReactInstanceMap.js"); 42110var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 42111var ReactPropTypeLocations = __webpack_require__(/*! ./ReactPropTypeLocations */ "./node_modules/react/lib/ReactPropTypeLocations.js"); 42112var ReactPropTypeLocationNames = __webpack_require__(/*! ./ReactPropTypeLocationNames */ "./node_modules/react/lib/ReactPropTypeLocationNames.js"); 42113var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 42114var ReactUpdateQueue = __webpack_require__(/*! ./ReactUpdateQueue */ "./node_modules/react/lib/ReactUpdateQueue.js"); 42115 42116var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 42117var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); 42118var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 42119var shouldUpdateReactComponent = __webpack_require__(/*! ./shouldUpdateReactComponent */ "./node_modules/react/lib/shouldUpdateReactComponent.js"); 42120var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 42121 42122function getDeclarationErrorAddendum(component) { 42123 var owner = component._currentElement._owner || null; 42124 if (owner) { 42125 var name = owner.getName(); 42126 if (name) { 42127 return ' Check the render method of `' + name + '`.'; 42128 } 42129 } 42130 return ''; 42131} 42132 42133function StatelessComponent(Component) {} 42134StatelessComponent.prototype.render = function () { 42135 var Component = ReactInstanceMap.get(this)._currentElement.type; 42136 return Component(this.props, this.context, this.updater); 42137}; 42138 42139/** 42140 * ------------------ The Life-Cycle of a Composite Component ------------------ 42141 * 42142 * - constructor: Initialization of state. The instance is now retained. 42143 * - componentWillMount 42144 * - render 42145 * - [children's constructors] 42146 * - [children's componentWillMount and render] 42147 * - [children's componentDidMount] 42148 * - componentDidMount 42149 * 42150 * Update Phases: 42151 * - componentWillReceiveProps (only called if parent updated) 42152 * - shouldComponentUpdate 42153 * - componentWillUpdate 42154 * - render 42155 * - [children's constructors or receive props phases] 42156 * - componentDidUpdate 42157 * 42158 * - componentWillUnmount 42159 * - [children's componentWillUnmount] 42160 * - [children destroyed] 42161 * - (destroyed): The instance is now blank, released by React and ready for GC. 42162 * 42163 * ----------------------------------------------------------------------------- 42164 */ 42165 42166/** 42167 * An incrementing ID assigned to each component when it is mounted. This is 42168 * used to enforce the order in which `ReactUpdates` updates dirty components. 42169 * 42170 * @private 42171 */ 42172var nextMountID = 1; 42173 42174/** 42175 * @lends {ReactCompositeComponent.prototype} 42176 */ 42177var ReactCompositeComponentMixin = { 42178 42179 /** 42180 * Base constructor for all composite component. 42181 * 42182 * @param {ReactElement} element 42183 * @final 42184 * @internal 42185 */ 42186 construct: function (element) { 42187 this._currentElement = element; 42188 this._rootNodeID = null; 42189 this._instance = null; 42190 42191 // See ReactUpdateQueue 42192 this._pendingElement = null; 42193 this._pendingStateQueue = null; 42194 this._pendingReplaceState = false; 42195 this._pendingForceUpdate = false; 42196 42197 this._renderedComponent = null; 42198 42199 this._context = null; 42200 this._mountOrder = 0; 42201 this._topLevelWrapper = null; 42202 42203 // See ReactUpdates and ReactUpdateQueue. 42204 this._pendingCallbacks = null; 42205 }, 42206 42207 /** 42208 * Initializes the component, renders markup, and registers event listeners. 42209 * 42210 * @param {string} rootID DOM ID of the root node. 42211 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 42212 * @return {?string} Rendered markup to be inserted into the DOM. 42213 * @final 42214 * @internal 42215 */ 42216 mountComponent: function (rootID, transaction, context) { 42217 this._context = context; 42218 this._mountOrder = nextMountID++; 42219 this._rootNodeID = rootID; 42220 42221 var publicProps = this._processProps(this._currentElement.props); 42222 var publicContext = this._processContext(context); 42223 42224 var Component = this._currentElement.type; 42225 42226 // Initialize the public class 42227 var inst; 42228 var renderedElement; 42229 42230 // This is a way to detect if Component is a stateless arrow function 42231 // component, which is not newable. It might not be 100% reliable but is 42232 // something we can do until we start detecting that Component extends 42233 // React.Component. We already assume that typeof Component === 'function'. 42234 var canInstantiate = ('prototype' in Component); 42235 42236 if (canInstantiate) { 42237 if (true) { 42238 ReactCurrentOwner.current = this; 42239 try { 42240 inst = new Component(publicProps, publicContext, ReactUpdateQueue); 42241 } finally { 42242 ReactCurrentOwner.current = null; 42243 } 42244 } else {} 42245 } 42246 42247 if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) { 42248 renderedElement = inst; 42249 inst = new StatelessComponent(Component); 42250 } 42251 42252 if (true) { 42253 // This will throw later in _renderValidatedComponent, but add an early 42254 // warning now to help debugging 42255 if (inst.render == null) { 42256 true ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined; 42257 } else { 42258 // We support ES6 inheriting from React.Component, the module pattern, 42259 // and stateless components, but not ES6 classes that don't extend 42260 true ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined; 42261 } 42262 } 42263 42264 // These should be set up in the constructor, but as a convenience for 42265 // simpler class abstractions, we set them up after the fact. 42266 inst.props = publicProps; 42267 inst.context = publicContext; 42268 inst.refs = emptyObject; 42269 inst.updater = ReactUpdateQueue; 42270 42271 this._instance = inst; 42272 42273 // Store a reference from the instance back to the internal representation 42274 ReactInstanceMap.set(inst, this); 42275 42276 if (true) { 42277 // Since plain JS classes are defined without any special initialization 42278 // logic, we can not catch common errors early. Therefore, we have to 42279 // catch them here, at initialization time, instead. 42280 true ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined; 42281 true ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined; 42282 true ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined; 42283 true ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined; 42284 true ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined; 42285 true ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined; 42286 true ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined; 42287 } 42288 42289 var initialState = inst.state; 42290 if (initialState === undefined) { 42291 inst.state = initialState = null; 42292 } 42293 !(typeof initialState === 'object' && !Array.isArray(initialState)) ? true ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : undefined : undefined; 42294 42295 this._pendingStateQueue = null; 42296 this._pendingReplaceState = false; 42297 this._pendingForceUpdate = false; 42298 42299 if (inst.componentWillMount) { 42300 inst.componentWillMount(); 42301 // When mounting, calls to `setState` by `componentWillMount` will set 42302 // `this._pendingStateQueue` without triggering a re-render. 42303 if (this._pendingStateQueue) { 42304 inst.state = this._processPendingState(inst.props, inst.context); 42305 } 42306 } 42307 42308 // If not a stateless component, we now render 42309 if (renderedElement === undefined) { 42310 renderedElement = this._renderValidatedComponent(); 42311 } 42312 42313 this._renderedComponent = this._instantiateReactComponent(renderedElement); 42314 42315 var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context)); 42316 if (inst.componentDidMount) { 42317 transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); 42318 } 42319 42320 return markup; 42321 }, 42322 42323 /** 42324 * Releases any resources allocated by `mountComponent`. 42325 * 42326 * @final 42327 * @internal 42328 */ 42329 unmountComponent: function () { 42330 var inst = this._instance; 42331 42332 if (inst.componentWillUnmount) { 42333 inst.componentWillUnmount(); 42334 } 42335 42336 ReactReconciler.unmountComponent(this._renderedComponent); 42337 this._renderedComponent = null; 42338 this._instance = null; 42339 42340 // Reset pending fields 42341 // Even if this component is scheduled for another update in ReactUpdates, 42342 // it would still be ignored because these fields are reset. 42343 this._pendingStateQueue = null; 42344 this._pendingReplaceState = false; 42345 this._pendingForceUpdate = false; 42346 this._pendingCallbacks = null; 42347 this._pendingElement = null; 42348 42349 // These fields do not really need to be reset since this object is no 42350 // longer accessible. 42351 this._context = null; 42352 this._rootNodeID = null; 42353 this._topLevelWrapper = null; 42354 42355 // Delete the reference from the instance to this internal representation 42356 // which allow the internals to be properly cleaned up even if the user 42357 // leaks a reference to the public instance. 42358 ReactInstanceMap.remove(inst); 42359 42360 // Some existing components rely on inst.props even after they've been 42361 // destroyed (in event handlers). 42362 // TODO: inst.props = null; 42363 // TODO: inst.state = null; 42364 // TODO: inst.context = null; 42365 }, 42366 42367 /** 42368 * Filters the context object to only contain keys specified in 42369 * `contextTypes` 42370 * 42371 * @param {object} context 42372 * @return {?object} 42373 * @private 42374 */ 42375 _maskContext: function (context) { 42376 var maskedContext = null; 42377 var Component = this._currentElement.type; 42378 var contextTypes = Component.contextTypes; 42379 if (!contextTypes) { 42380 return emptyObject; 42381 } 42382 maskedContext = {}; 42383 for (var contextName in contextTypes) { 42384 maskedContext[contextName] = context[contextName]; 42385 } 42386 return maskedContext; 42387 }, 42388 42389 /** 42390 * Filters the context object to only contain keys specified in 42391 * `contextTypes`, and asserts that they are valid. 42392 * 42393 * @param {object} context 42394 * @return {?object} 42395 * @private 42396 */ 42397 _processContext: function (context) { 42398 var maskedContext = this._maskContext(context); 42399 if (true) { 42400 var Component = this._currentElement.type; 42401 if (Component.contextTypes) { 42402 this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context); 42403 } 42404 } 42405 return maskedContext; 42406 }, 42407 42408 /** 42409 * @param {object} currentContext 42410 * @return {object} 42411 * @private 42412 */ 42413 _processChildContext: function (currentContext) { 42414 var Component = this._currentElement.type; 42415 var inst = this._instance; 42416 var childContext = inst.getChildContext && inst.getChildContext(); 42417 if (childContext) { 42418 !(typeof Component.childContextTypes === 'object') ? true ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : undefined : undefined; 42419 if (true) { 42420 this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext); 42421 } 42422 for (var name in childContext) { 42423 !(name in Component.childContextTypes) ? true ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : undefined : undefined; 42424 } 42425 return assign({}, currentContext, childContext); 42426 } 42427 return currentContext; 42428 }, 42429 42430 /** 42431 * Processes props by setting default values for unspecified props and 42432 * asserting that the props are valid. Does not mutate its argument; returns 42433 * a new props object with defaults merged in. 42434 * 42435 * @param {object} newProps 42436 * @return {object} 42437 * @private 42438 */ 42439 _processProps: function (newProps) { 42440 if (true) { 42441 var Component = this._currentElement.type; 42442 if (Component.propTypes) { 42443 this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop); 42444 } 42445 } 42446 return newProps; 42447 }, 42448 42449 /** 42450 * Assert that the props are valid 42451 * 42452 * @param {object} propTypes Map of prop name to a ReactPropType 42453 * @param {object} props 42454 * @param {string} location e.g. "prop", "context", "child context" 42455 * @private 42456 */ 42457 _checkPropTypes: function (propTypes, props, location) { 42458 // TODO: Stop validating prop types here and only use the element 42459 // validation. 42460 var componentName = this.getName(); 42461 for (var propName in propTypes) { 42462 if (propTypes.hasOwnProperty(propName)) { 42463 var error; 42464 try { 42465 // This is intentionally an invariant that gets caught. It's the same 42466 // behavior as without this statement except with a better message. 42467 !(typeof propTypes[propName] === 'function') ? true ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : undefined : undefined; 42468 error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 42469 } catch (ex) { 42470 error = ex; 42471 } 42472 if (error instanceof Error) { 42473 // We may want to extend this logic for similar errors in 42474 // top-level render calls, so I'm abstracting it away into 42475 // a function to minimize refactoring in the future 42476 var addendum = getDeclarationErrorAddendum(this); 42477 42478 if (location === ReactPropTypeLocations.prop) { 42479 // Preface gives us something to blacklist in warning module 42480 true ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined; 42481 } else { 42482 true ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined; 42483 } 42484 } 42485 } 42486 } 42487 }, 42488 42489 receiveComponent: function (nextElement, transaction, nextContext) { 42490 var prevElement = this._currentElement; 42491 var prevContext = this._context; 42492 42493 this._pendingElement = null; 42494 42495 this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); 42496 }, 42497 42498 /** 42499 * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` 42500 * is set, update the component. 42501 * 42502 * @param {ReactReconcileTransaction} transaction 42503 * @internal 42504 */ 42505 performUpdateIfNecessary: function (transaction) { 42506 if (this._pendingElement != null) { 42507 ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context); 42508 } 42509 42510 if (this._pendingStateQueue !== null || this._pendingForceUpdate) { 42511 this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); 42512 } 42513 }, 42514 42515 /** 42516 * Perform an update to a mounted component. The componentWillReceiveProps and 42517 * shouldComponentUpdate methods are called, then (assuming the update isn't 42518 * skipped) the remaining update lifecycle methods are called and the DOM 42519 * representation is updated. 42520 * 42521 * By default, this implements React's rendering and reconciliation algorithm. 42522 * Sophisticated clients may wish to override this. 42523 * 42524 * @param {ReactReconcileTransaction} transaction 42525 * @param {ReactElement} prevParentElement 42526 * @param {ReactElement} nextParentElement 42527 * @internal 42528 * @overridable 42529 */ 42530 updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { 42531 var inst = this._instance; 42532 42533 var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext); 42534 var nextProps; 42535 42536 // Distinguish between a props update versus a simple state update 42537 if (prevParentElement === nextParentElement) { 42538 // Skip checking prop types again -- we don't read inst.props to avoid 42539 // warning for DOM component props in this upgrade 42540 nextProps = nextParentElement.props; 42541 } else { 42542 nextProps = this._processProps(nextParentElement.props); 42543 // An update here will schedule an update but immediately set 42544 // _pendingStateQueue which will ensure that any state updates gets 42545 // immediately reconciled instead of waiting for the next batch. 42546 42547 if (inst.componentWillReceiveProps) { 42548 inst.componentWillReceiveProps(nextProps, nextContext); 42549 } 42550 } 42551 42552 var nextState = this._processPendingState(nextProps, nextContext); 42553 42554 var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext); 42555 42556 if (true) { 42557 true ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined; 42558 } 42559 42560 if (shouldUpdate) { 42561 this._pendingForceUpdate = false; 42562 // Will set `this.props`, `this.state` and `this.context`. 42563 this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); 42564 } else { 42565 // If it's determined that a component should not update, we still want 42566 // to set props and state but we shortcut the rest of the update. 42567 this._currentElement = nextParentElement; 42568 this._context = nextUnmaskedContext; 42569 inst.props = nextProps; 42570 inst.state = nextState; 42571 inst.context = nextContext; 42572 } 42573 }, 42574 42575 _processPendingState: function (props, context) { 42576 var inst = this._instance; 42577 var queue = this._pendingStateQueue; 42578 var replace = this._pendingReplaceState; 42579 this._pendingReplaceState = false; 42580 this._pendingStateQueue = null; 42581 42582 if (!queue) { 42583 return inst.state; 42584 } 42585 42586 if (replace && queue.length === 1) { 42587 return queue[0]; 42588 } 42589 42590 var nextState = assign({}, replace ? queue[0] : inst.state); 42591 for (var i = replace ? 1 : 0; i < queue.length; i++) { 42592 var partial = queue[i]; 42593 assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); 42594 } 42595 42596 return nextState; 42597 }, 42598 42599 /** 42600 * Merges new props and state, notifies delegate methods of update and 42601 * performs update. 42602 * 42603 * @param {ReactElement} nextElement Next element 42604 * @param {object} nextProps Next public object to set as properties. 42605 * @param {?object} nextState Next object to set as state. 42606 * @param {?object} nextContext Next public object to set as context. 42607 * @param {ReactReconcileTransaction} transaction 42608 * @param {?object} unmaskedContext 42609 * @private 42610 */ 42611 _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { 42612 var inst = this._instance; 42613 42614 var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); 42615 var prevProps; 42616 var prevState; 42617 var prevContext; 42618 if (hasComponentDidUpdate) { 42619 prevProps = inst.props; 42620 prevState = inst.state; 42621 prevContext = inst.context; 42622 } 42623 42624 if (inst.componentWillUpdate) { 42625 inst.componentWillUpdate(nextProps, nextState, nextContext); 42626 } 42627 42628 this._currentElement = nextElement; 42629 this._context = unmaskedContext; 42630 inst.props = nextProps; 42631 inst.state = nextState; 42632 inst.context = nextContext; 42633 42634 this._updateRenderedComponent(transaction, unmaskedContext); 42635 42636 if (hasComponentDidUpdate) { 42637 transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); 42638 } 42639 }, 42640 42641 /** 42642 * Call the component's `render` method and update the DOM accordingly. 42643 * 42644 * @param {ReactReconcileTransaction} transaction 42645 * @internal 42646 */ 42647 _updateRenderedComponent: function (transaction, context) { 42648 var prevComponentInstance = this._renderedComponent; 42649 var prevRenderedElement = prevComponentInstance._currentElement; 42650 var nextRenderedElement = this._renderValidatedComponent(); 42651 if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { 42652 ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); 42653 } else { 42654 // These two IDs are actually the same! But nothing should rely on that. 42655 var thisID = this._rootNodeID; 42656 var prevComponentID = prevComponentInstance._rootNodeID; 42657 ReactReconciler.unmountComponent(prevComponentInstance); 42658 42659 this._renderedComponent = this._instantiateReactComponent(nextRenderedElement); 42660 var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context)); 42661 this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); 42662 } 42663 }, 42664 42665 /** 42666 * @protected 42667 */ 42668 _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) { 42669 ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup); 42670 }, 42671 42672 /** 42673 * @protected 42674 */ 42675 _renderValidatedComponentWithoutOwnerOrContext: function () { 42676 var inst = this._instance; 42677 var renderedComponent = inst.render(); 42678 if (true) { 42679 // We allow auto-mocks to proceed as if they're returning null. 42680 if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { 42681 // This is probably bad practice. Consider warning here and 42682 // deprecating this convenience. 42683 renderedComponent = null; 42684 } 42685 } 42686 42687 return renderedComponent; 42688 }, 42689 42690 /** 42691 * @private 42692 */ 42693 _renderValidatedComponent: function () { 42694 var renderedComponent; 42695 ReactCurrentOwner.current = this; 42696 try { 42697 renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); 42698 } finally { 42699 ReactCurrentOwner.current = null; 42700 } 42701 !( 42702 // TODO: An `isValidNode` function would probably be more appropriate 42703 renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? true ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : undefined : undefined; 42704 return renderedComponent; 42705 }, 42706 42707 /** 42708 * Lazily allocates the refs object and stores `component` as `ref`. 42709 * 42710 * @param {string} ref Reference name. 42711 * @param {component} component Component to store as `ref`. 42712 * @final 42713 * @private 42714 */ 42715 attachRef: function (ref, component) { 42716 var inst = this.getPublicInstance(); 42717 !(inst != null) ? true ? invariant(false, 'Stateless function components cannot have refs.') : undefined : undefined; 42718 var publicComponentInstance = component.getPublicInstance(); 42719 if (true) { 42720 var componentName = component && component.getName ? component.getName() : 'a component'; 42721 true ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined; 42722 } 42723 var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; 42724 refs[ref] = publicComponentInstance; 42725 }, 42726 42727 /** 42728 * Detaches a reference name. 42729 * 42730 * @param {string} ref Name to dereference. 42731 * @final 42732 * @private 42733 */ 42734 detachRef: function (ref) { 42735 var refs = this.getPublicInstance().refs; 42736 delete refs[ref]; 42737 }, 42738 42739 /** 42740 * Get a text description of the component that can be used to identify it 42741 * in error messages. 42742 * @return {string} The name or null. 42743 * @internal 42744 */ 42745 getName: function () { 42746 var type = this._currentElement.type; 42747 var constructor = this._instance && this._instance.constructor; 42748 return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; 42749 }, 42750 42751 /** 42752 * Get the publicly accessible representation of this component - i.e. what 42753 * is exposed by refs and returned by render. Can be null for stateless 42754 * components. 42755 * 42756 * @return {ReactComponent} the public component instance. 42757 * @internal 42758 */ 42759 getPublicInstance: function () { 42760 var inst = this._instance; 42761 if (inst instanceof StatelessComponent) { 42762 return null; 42763 } 42764 return inst; 42765 }, 42766 42767 // Stub 42768 _instantiateReactComponent: null 42769 42770}; 42771 42772ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', { 42773 mountComponent: 'mountComponent', 42774 updateComponent: 'updateComponent', 42775 _renderValidatedComponent: '_renderValidatedComponent' 42776}); 42777 42778var ReactCompositeComponent = { 42779 42780 Mixin: ReactCompositeComponentMixin 42781 42782}; 42783 42784module.exports = ReactCompositeComponent; 42785 42786/***/ }), 42787
vendor: 986 bytes, lines 42788-42828
42788/***/ "./node_modules/react/lib/ReactCurrentOwner.js": 42789/*!*****************************************************!*\ 42790 !*** ./node_modules/react/lib/ReactCurrentOwner.js ***! 42791 \*****************************************************/ 42792/*! no static exports found */ 42793/***/ (function(module, exports, __webpack_require__) { 42794 42795"use strict"; 42796/** 42797 * Copyright 2013-2015, Facebook, Inc. 42798 * All rights reserved. 42799 * 42800 * This source code is licensed under the BSD-style license found in the 42801 * LICENSE file in the root directory of this source tree. An additional grant 42802 * of patent rights can be found in the PATENTS file in the same directory. 42803 * 42804 * @providesModule ReactCurrentOwner 42805 */ 42806 42807 42808 42809/** 42810 * Keeps track of the current owner. 42811 * 42812 * The current owner is the component who should own any components that are 42813 * currently being constructed. 42814 */ 42815var ReactCurrentOwner = { 42816 42817 /** 42818 * @internal 42819 * @type {ReactComponent} 42820 */ 42821 current: null 42822 42823}; 42824 42825module.exports = ReactCurrentOwner; 42826 42827/***/ }), 42828
vendor: 4,764 bytes, lines 42829-42931
42829/***/ "./node_modules/react/lib/ReactDOM.js": 42830/*!********************************************!*\ 42831 !*** ./node_modules/react/lib/ReactDOM.js ***! 42832 \********************************************/ 42833/*! no static exports found */ 42834/***/ (function(module, exports, __webpack_require__) { 42835 42836"use strict"; 42837/** 42838 * Copyright 2013-2015, Facebook, Inc. 42839 * All rights reserved. 42840 * 42841 * This source code is licensed under the BSD-style license found in the 42842 * LICENSE file in the root directory of this source tree. An additional grant 42843 * of patent rights can be found in the PATENTS file in the same directory. 42844 * 42845 * @providesModule ReactDOM 42846 */ 42847 42848/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ 42849 42850 42851 42852var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 42853var ReactDOMTextComponent = __webpack_require__(/*! ./ReactDOMTextComponent */ "./node_modules/react/lib/ReactDOMTextComponent.js"); 42854var ReactDefaultInjection = __webpack_require__(/*! ./ReactDefaultInjection */ "./node_modules/react/lib/ReactDefaultInjection.js"); 42855var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 42856var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 42857var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 42858var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 42859var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 42860var ReactVersion = __webpack_require__(/*! ./ReactVersion */ "./node_modules/react/lib/ReactVersion.js"); 42861 42862var findDOMNode = __webpack_require__(/*! ./findDOMNode */ "./node_modules/react/lib/findDOMNode.js"); 42863var renderSubtreeIntoContainer = __webpack_require__(/*! ./renderSubtreeIntoContainer */ "./node_modules/react/lib/renderSubtreeIntoContainer.js"); 42864var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 42865 42866ReactDefaultInjection.inject(); 42867 42868var render = ReactPerf.measure('React', 'render', ReactMount.render); 42869 42870var React = { 42871 findDOMNode: findDOMNode, 42872 render: render, 42873 unmountComponentAtNode: ReactMount.unmountComponentAtNode, 42874 version: ReactVersion, 42875 42876 /* eslint-disable camelcase */ 42877 unstable_batchedUpdates: ReactUpdates.batchedUpdates, 42878 unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer 42879}; 42880 42881// Inject the runtime into a devtools global hook regardless of browser. 42882// Allows for debugging when the hook is injected on the page. 42883/* eslint-enable camelcase */ 42884if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { 42885 __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ 42886 CurrentOwner: ReactCurrentOwner, 42887 InstanceHandles: ReactInstanceHandles, 42888 Mount: ReactMount, 42889 Reconciler: ReactReconciler, 42890 TextComponent: ReactDOMTextComponent 42891 }); 42892} 42893 42894if (true) { 42895 var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 42896 if (ExecutionEnvironment.canUseDOM && window.top === window.self) { 42897 42898 // First check if devtools is not installed 42899 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { 42900 // If we're in Chrome or Firefox, provide a download link if not installed. 42901 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { 42902 console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools'); 42903 } 42904 } 42905 42906 // If we're in IE8, check to see if we are in compatibility mode and provide 42907 // information on preventing compatibility mode 42908 var ieCompatibilityMode = document.documentMode && document.documentMode < 8; 42909 42910 true ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined; 42911 42912 var expectedFeatures = [ 42913 // shims 42914 Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim, 42915 42916 // shams 42917 Object.create, Object.freeze]; 42918 42919 for (var i = 0; i < expectedFeatures.length; i++) { 42920 if (!expectedFeatures[i]) { 42921 console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills'); 42922 break; 42923 } 42924 } 42925 } 42926} 42927 42928module.exports = React; 42929 42930/***/ }), 42931
vendor: 1,475 bytes, lines 42932-42992
42932/***/ "./node_modules/react/lib/ReactDOMButton.js": 42933/*!**************************************************!*\ 42934 !*** ./node_modules/react/lib/ReactDOMButton.js ***! 42935 \**************************************************/ 42936/*! no static exports found */ 42937/***/ (function(module, exports, __webpack_require__) { 42938 42939"use strict"; 42940/** 42941 * Copyright 2013-2015, Facebook, Inc. 42942 * All rights reserved. 42943 * 42944 * This source code is licensed under the BSD-style license found in the 42945 * LICENSE file in the root directory of this source tree. An additional grant 42946 * of patent rights can be found in the PATENTS file in the same directory. 42947 * 42948 * @providesModule ReactDOMButton 42949 */ 42950 42951 42952 42953var mouseListenerNames = { 42954 onClick: true, 42955 onDoubleClick: true, 42956 onMouseDown: true, 42957 onMouseMove: true, 42958 onMouseUp: true, 42959 42960 onClickCapture: true, 42961 onDoubleClickCapture: true, 42962 onMouseDownCapture: true, 42963 onMouseMoveCapture: true, 42964 onMouseUpCapture: true 42965}; 42966 42967/** 42968 * Implements a <button> native component that does not receive mouse events 42969 * when `disabled` is set. 42970 */ 42971var ReactDOMButton = { 42972 getNativeProps: function (inst, props, context) { 42973 if (!props.disabled) { 42974 return props; 42975 } 42976 42977 // Copy the props, except the mouse listeners 42978 var nativeProps = {}; 42979 for (var key in props) { 42980 if (props.hasOwnProperty(key) && !mouseListenerNames[key]) { 42981 nativeProps[key] = props[key]; 42982 } 42983 } 42984 42985 return nativeProps; 42986 } 42987}; 42988 42989module.exports = ReactDOMButton; 42990 42991/***/ }), 42992
vendor: 37,695 bytes, lines 42993-43962
42993/***/ "./node_modules/react/lib/ReactDOMComponent.js": 42994/*!*****************************************************!*\ 42995 !*** ./node_modules/react/lib/ReactDOMComponent.js ***! 42996 \*****************************************************/ 42997/*! no static exports found */ 42998/***/ (function(module, exports, __webpack_require__) { 42999 43000"use strict"; 43001/** 43002 * Copyright 2013-2015, Facebook, Inc. 43003 * All rights reserved. 43004 * 43005 * This source code is licensed under the BSD-style license found in the 43006 * LICENSE file in the root directory of this source tree. An additional grant 43007 * of patent rights can be found in the PATENTS file in the same directory. 43008 * 43009 * @providesModule ReactDOMComponent 43010 * @typechecks static-only 43011 */ 43012 43013/* global hasOwnProperty:true */ 43014 43015 43016 43017var AutoFocusUtils = __webpack_require__(/*! ./AutoFocusUtils */ "./node_modules/react/lib/AutoFocusUtils.js"); 43018var CSSPropertyOperations = __webpack_require__(/*! ./CSSPropertyOperations */ "./node_modules/react/lib/CSSPropertyOperations.js"); 43019var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 43020var DOMPropertyOperations = __webpack_require__(/*! ./DOMPropertyOperations */ "./node_modules/react/lib/DOMPropertyOperations.js"); 43021var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 43022var ReactBrowserEventEmitter = __webpack_require__(/*! ./ReactBrowserEventEmitter */ "./node_modules/react/lib/ReactBrowserEventEmitter.js"); 43023var ReactComponentBrowserEnvironment = __webpack_require__(/*! ./ReactComponentBrowserEnvironment */ "./node_modules/react/lib/ReactComponentBrowserEnvironment.js"); 43024var ReactDOMButton = __webpack_require__(/*! ./ReactDOMButton */ "./node_modules/react/lib/ReactDOMButton.js"); 43025var ReactDOMInput = __webpack_require__(/*! ./ReactDOMInput */ "./node_modules/react/lib/ReactDOMInput.js"); 43026var ReactDOMOption = __webpack_require__(/*! ./ReactDOMOption */ "./node_modules/react/lib/ReactDOMOption.js"); 43027var ReactDOMSelect = __webpack_require__(/*! ./ReactDOMSelect */ "./node_modules/react/lib/ReactDOMSelect.js"); 43028var ReactDOMTextarea = __webpack_require__(/*! ./ReactDOMTextarea */ "./node_modules/react/lib/ReactDOMTextarea.js"); 43029var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 43030var ReactMultiChild = __webpack_require__(/*! ./ReactMultiChild */ "./node_modules/react/lib/ReactMultiChild.js"); 43031var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 43032var ReactUpdateQueue = __webpack_require__(/*! ./ReactUpdateQueue */ "./node_modules/react/lib/ReactUpdateQueue.js"); 43033 43034var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 43035var canDefineProperty = __webpack_require__(/*! ./canDefineProperty */ "./node_modules/react/lib/canDefineProperty.js"); 43036var escapeTextContentForBrowser = __webpack_require__(/*! ./escapeTextContentForBrowser */ "./node_modules/react/lib/escapeTextContentForBrowser.js"); 43037var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 43038var isEventSupported = __webpack_require__(/*! ./isEventSupported */ "./node_modules/react/lib/isEventSupported.js"); 43039var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 43040var setInnerHTML = __webpack_require__(/*! ./setInnerHTML */ "./node_modules/react/lib/setInnerHTML.js"); 43041var setTextContent = __webpack_require__(/*! ./setTextContent */ "./node_modules/react/lib/setTextContent.js"); 43042var shallowEqual = __webpack_require__(/*! fbjs/lib/shallowEqual */ "./node_modules/fbjs/lib/shallowEqual.js"); 43043var validateDOMNesting = __webpack_require__(/*! ./validateDOMNesting */ "./node_modules/react/lib/validateDOMNesting.js"); 43044var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 43045 43046var deleteListener = ReactBrowserEventEmitter.deleteListener; 43047var listenTo = ReactBrowserEventEmitter.listenTo; 43048var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules; 43049 43050// For quickly matching children type, to test if can be treated as content. 43051var CONTENT_TYPES = { 'string': true, 'number': true }; 43052 43053var CHILDREN = keyOf({ children: null }); 43054var STYLE = keyOf({ style: null }); 43055var HTML = keyOf({ __html: null }); 43056 43057var ELEMENT_NODE_TYPE = 1; 43058 43059function getDeclarationErrorAddendum(internalInstance) { 43060 if (internalInstance) { 43061 var owner = internalInstance._currentElement._owner || null; 43062 if (owner) { 43063 var name = owner.getName(); 43064 if (name) { 43065 return ' This DOM node was rendered by `' + name + '`.'; 43066 } 43067 } 43068 } 43069 return ''; 43070} 43071 43072var legacyPropsDescriptor; 43073if (true) { 43074 legacyPropsDescriptor = { 43075 props: { 43076 enumerable: false, 43077 get: function () { 43078 var component = this._reactInternalComponent; 43079 true ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined; 43080 return component._currentElement.props; 43081 } 43082 } 43083 }; 43084} 43085 43086function legacyGetDOMNode() { 43087 if (true) { 43088 var component = this._reactInternalComponent; 43089 true ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined; 43090 } 43091 return this; 43092} 43093 43094function legacyIsMounted() { 43095 var component = this._reactInternalComponent; 43096 if (true) { 43097 true ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined; 43098 } 43099 return !!component; 43100} 43101 43102function legacySetStateEtc() { 43103 if (true) { 43104 var component = this._reactInternalComponent; 43105 true ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined; 43106 } 43107} 43108 43109function legacySetProps(partialProps, callback) { 43110 var component = this._reactInternalComponent; 43111 if (true) { 43112 true ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined; 43113 } 43114 if (!component) { 43115 return; 43116 } 43117 ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps); 43118 if (callback) { 43119 ReactUpdateQueue.enqueueCallbackInternal(component, callback); 43120 } 43121} 43122 43123function legacyReplaceProps(partialProps, callback) { 43124 var component = this._reactInternalComponent; 43125 if (true) { 43126 true ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined; 43127 } 43128 if (!component) { 43129 return; 43130 } 43131 ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps); 43132 if (callback) { 43133 ReactUpdateQueue.enqueueCallbackInternal(component, callback); 43134 } 43135} 43136 43137function friendlyStringify(obj) { 43138 if (typeof obj === 'object') { 43139 if (Array.isArray(obj)) { 43140 return '[' + obj.map(friendlyStringify).join(', ') + ']'; 43141 } else { 43142 var pairs = []; 43143 for (var key in obj) { 43144 if (Object.prototype.hasOwnProperty.call(obj, key)) { 43145 var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); 43146 pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); 43147 } 43148 } 43149 return '{' + pairs.join(', ') + '}'; 43150 } 43151 } else if (typeof obj === 'string') { 43152 return JSON.stringify(obj); 43153 } else if (typeof obj === 'function') { 43154 return '[function object]'; 43155 } 43156 // Differs from JSON.stringify in that undefined becauses undefined and that 43157 // inf and nan don't become null 43158 return String(obj); 43159} 43160 43161var styleMutationWarning = {}; 43162 43163function checkAndWarnForMutatedStyle(style1, style2, component) { 43164 if (style1 == null || style2 == null) { 43165 return; 43166 } 43167 if (shallowEqual(style1, style2)) { 43168 return; 43169 } 43170 43171 var componentName = component._tag; 43172 var owner = component._currentElement._owner; 43173 var ownerName; 43174 if (owner) { 43175 ownerName = owner.getName(); 43176 } 43177 43178 var hash = ownerName + '|' + componentName; 43179 43180 if (styleMutationWarning.hasOwnProperty(hash)) { 43181 return; 43182 } 43183 43184 styleMutationWarning[hash] = true; 43185 43186 true ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined; 43187} 43188 43189/** 43190 * @param {object} component 43191 * @param {?object} props 43192 */ 43193function assertValidProps(component, props) { 43194 if (!props) { 43195 return; 43196 } 43197 // Note the use of `==` which checks for null or undefined. 43198 if (true) { 43199 if (voidElementTags[component._tag]) { 43200 true ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined; 43201 } 43202 } 43203 if (props.dangerouslySetInnerHTML != null) { 43204 !(props.children == null) ? true ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : undefined : undefined; 43205 !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? true ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : undefined : undefined; 43206 } 43207 if (true) { 43208 true ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined; 43209 true ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined; 43210 } 43211 !(props.style == null || typeof props.style === 'object') ? true ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : undefined : undefined; 43212} 43213 43214function enqueuePutListener(id, registrationName, listener, transaction) { 43215 if (true) { 43216 // IE8 has no API for event capturing and the `onScroll` event doesn't 43217 // bubble. 43218 true ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined; 43219 } 43220 var container = ReactMount.findReactContainerForID(id); 43221 if (container) { 43222 var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container; 43223 listenTo(registrationName, doc); 43224 } 43225 transaction.getReactMountReady().enqueue(putListener, { 43226 id: id, 43227 registrationName: registrationName, 43228 listener: listener 43229 }); 43230} 43231 43232function putListener() { 43233 var listenerToPut = this; 43234 ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener); 43235} 43236 43237// There are so many media events, it makes sense to just 43238// maintain a list rather than create a `trapBubbledEvent` for each 43239var mediaEvents = { 43240 topAbort: 'abort', 43241 topCanPlay: 'canplay', 43242 topCanPlayThrough: 'canplaythrough', 43243 topDurationChange: 'durationchange', 43244 topEmptied: 'emptied', 43245 topEncrypted: 'encrypted', 43246 topEnded: 'ended', 43247 topError: 'error', 43248 topLoadedData: 'loadeddata', 43249 topLoadedMetadata: 'loadedmetadata', 43250 topLoadStart: 'loadstart', 43251 topPause: 'pause', 43252 topPlay: 'play', 43253 topPlaying: 'playing', 43254 topProgress: 'progress', 43255 topRateChange: 'ratechange', 43256 topSeeked: 'seeked', 43257 topSeeking: 'seeking', 43258 topStalled: 'stalled', 43259 topSuspend: 'suspend', 43260 topTimeUpdate: 'timeupdate', 43261 topVolumeChange: 'volumechange', 43262 topWaiting: 'waiting' 43263}; 43264 43265function trapBubbledEventsLocal() { 43266 var inst = this; 43267 // If a component renders to null or if another component fatals and causes 43268 // the state of the tree to be corrupted, `node` here can be null. 43269 !inst._rootNodeID ? true ? invariant(false, 'Must be mounted to trap events') : undefined : undefined; 43270 var node = ReactMount.getNode(inst._rootNodeID); 43271 !node ? true ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : undefined : undefined; 43272 43273 switch (inst._tag) { 43274 case 'iframe': 43275 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; 43276 break; 43277 case 'video': 43278 case 'audio': 43279 43280 inst._wrapperState.listeners = []; 43281 // create listener for each media event 43282 for (var event in mediaEvents) { 43283 if (mediaEvents.hasOwnProperty(event)) { 43284 inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node)); 43285 } 43286 } 43287 43288 break; 43289 case 'img': 43290 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; 43291 break; 43292 case 'form': 43293 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)]; 43294 break; 43295 } 43296} 43297 43298function mountReadyInputWrapper() { 43299 ReactDOMInput.mountReadyWrapper(this); 43300} 43301 43302function postUpdateSelectWrapper() { 43303 ReactDOMSelect.postUpdateWrapper(this); 43304} 43305 43306// For HTML, certain tags should omit their close tag. We keep a whitelist for 43307// those special cased tags. 43308 43309var omittedCloseTags = { 43310 'area': true, 43311 'base': true, 43312 'br': true, 43313 'col': true, 43314 'embed': true, 43315 'hr': true, 43316 'img': true, 43317 'input': true, 43318 'keygen': true, 43319 'link': true, 43320 'meta': true, 43321 'param': true, 43322 'source': true, 43323 'track': true, 43324 'wbr': true 43325}; 43326 43327// NOTE: menuitem's close tag should be omitted, but that causes problems. 43328var newlineEatingTags = { 43329 'listing': true, 43330 'pre': true, 43331 'textarea': true 43332}; 43333 43334// For HTML, certain tags cannot have children. This has the same purpose as 43335// `omittedCloseTags` except that `menuitem` should still have its closing tag. 43336 43337var voidElementTags = assign({ 43338 'menuitem': true 43339}, omittedCloseTags); 43340 43341// We accept any tag to be rendered but since this gets injected into arbitrary 43342// HTML, we want to make sure that it's a safe tag. 43343// http://www.w3.org/TR/REC-xml/#NT-Name 43344 43345var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset 43346var validatedTagCache = {}; 43347var hasOwnProperty = ({}).hasOwnProperty; 43348 43349function validateDangerousTag(tag) { 43350 if (!hasOwnProperty.call(validatedTagCache, tag)) { 43351 !VALID_TAG_REGEX.test(tag) ? true ? invariant(false, 'Invalid tag: %s', tag) : undefined : undefined; 43352 validatedTagCache[tag] = true; 43353 } 43354} 43355 43356function processChildContextDev(context, inst) { 43357 // Pass down our tag name to child components for validation purposes 43358 context = assign({}, context); 43359 var info = context[validateDOMNesting.ancestorInfoContextKey]; 43360 context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst); 43361 return context; 43362} 43363 43364function isCustomComponent(tagName, props) { 43365 return tagName.indexOf('-') >= 0 || props.is != null; 43366} 43367 43368/** 43369 * Creates a new React class that is idempotent and capable of containing other 43370 * React components. It accepts event listeners and DOM properties that are 43371 * valid according to `DOMProperty`. 43372 * 43373 * - Event listeners: `onClick`, `onMouseDown`, etc. 43374 * - DOM properties: `className`, `name`, `title`, etc. 43375 * 43376 * The `style` property functions differently from the DOM API. It accepts an 43377 * object mapping of style properties to values. 43378 * 43379 * @constructor ReactDOMComponent 43380 * @extends ReactMultiChild 43381 */ 43382function ReactDOMComponent(tag) { 43383 validateDangerousTag(tag); 43384 this._tag = tag.toLowerCase(); 43385 this._renderedChildren = null; 43386 this._previousStyle = null; 43387 this._previousStyleCopy = null; 43388 this._rootNodeID = null; 43389 this._wrapperState = null; 43390 this._topLevelWrapper = null; 43391 this._nodeWithLegacyProperties = null; 43392 if (true) { 43393 this._unprocessedContextDev = null; 43394 this._processedContextDev = null; 43395 } 43396} 43397 43398ReactDOMComponent.displayName = 'ReactDOMComponent'; 43399 43400ReactDOMComponent.Mixin = { 43401 43402 construct: function (element) { 43403 this._currentElement = element; 43404 }, 43405 43406 /** 43407 * Generates root tag markup then recurses. This method has side effects and 43408 * is not idempotent. 43409 * 43410 * @internal 43411 * @param {string} rootID The root DOM ID for this node. 43412 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 43413 * @param {object} context 43414 * @return {string} The computed markup. 43415 */ 43416 mountComponent: function (rootID, transaction, context) { 43417 this._rootNodeID = rootID; 43418 43419 var props = this._currentElement.props; 43420 43421 switch (this._tag) { 43422 case 'iframe': 43423 case 'img': 43424 case 'form': 43425 case 'video': 43426 case 'audio': 43427 this._wrapperState = { 43428 listeners: null 43429 }; 43430 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); 43431 break; 43432 case 'button': 43433 props = ReactDOMButton.getNativeProps(this, props, context); 43434 break; 43435 case 'input': 43436 ReactDOMInput.mountWrapper(this, props, context); 43437 props = ReactDOMInput.getNativeProps(this, props, context); 43438 break; 43439 case 'option': 43440 ReactDOMOption.mountWrapper(this, props, context); 43441 props = ReactDOMOption.getNativeProps(this, props, context); 43442 break; 43443 case 'select': 43444 ReactDOMSelect.mountWrapper(this, props, context); 43445 props = ReactDOMSelect.getNativeProps(this, props, context); 43446 context = ReactDOMSelect.processChildContext(this, props, context); 43447 break; 43448 case 'textarea': 43449 ReactDOMTextarea.mountWrapper(this, props, context); 43450 props = ReactDOMTextarea.getNativeProps(this, props, context); 43451 break; 43452 } 43453 43454 assertValidProps(this, props); 43455 if (true) { 43456 if (context[validateDOMNesting.ancestorInfoContextKey]) { 43457 validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]); 43458 } 43459 } 43460 43461 if (true) { 43462 this._unprocessedContextDev = context; 43463 this._processedContextDev = processChildContextDev(context, this); 43464 context = this._processedContextDev; 43465 } 43466 43467 var mountImage; 43468 if (transaction.useCreateElement) { 43469 var ownerDocument = context[ReactMount.ownerDocumentContextKey]; 43470 var el = ownerDocument.createElement(this._currentElement.type); 43471 DOMPropertyOperations.setAttributeForID(el, this._rootNodeID); 43472 // Populate node cache 43473 ReactMount.getID(el); 43474 this._updateDOMProperties({}, props, transaction, el); 43475 this._createInitialChildren(transaction, props, context, el); 43476 mountImage = el; 43477 } else { 43478 var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); 43479 var tagContent = this._createContentMarkup(transaction, props, context); 43480 if (!tagContent && omittedCloseTags[this._tag]) { 43481 mountImage = tagOpen + '/>'; 43482 } else { 43483 mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; 43484 } 43485 } 43486 43487 switch (this._tag) { 43488 case 'input': 43489 transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this); 43490 // falls through 43491 case 'button': 43492 case 'select': 43493 case 'textarea': 43494 if (props.autoFocus) { 43495 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); 43496 } 43497 break; 43498 } 43499 43500 return mountImage; 43501 }, 43502 43503 /** 43504 * Creates markup for the open tag and all attributes. 43505 * 43506 * This method has side effects because events get registered. 43507 * 43508 * Iterating over object properties is faster than iterating over arrays. 43509 * @see http://jsperf.com/obj-vs-arr-iteration 43510 * 43511 * @private 43512 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 43513 * @param {object} props 43514 * @return {string} Markup of opening tag. 43515 */ 43516 _createOpenTagMarkupAndPutListeners: function (transaction, props) { 43517 var ret = '<' + this._currentElement.type; 43518 43519 for (var propKey in props) { 43520 if (!props.hasOwnProperty(propKey)) { 43521 continue; 43522 } 43523 var propValue = props[propKey]; 43524 if (propValue == null) { 43525 continue; 43526 } 43527 if (registrationNameModules.hasOwnProperty(propKey)) { 43528 if (propValue) { 43529 enqueuePutListener(this._rootNodeID, propKey, propValue, transaction); 43530 } 43531 } else { 43532 if (propKey === STYLE) { 43533 if (propValue) { 43534 if (true) { 43535 // See `_updateDOMProperties`. style block 43536 this._previousStyle = propValue; 43537 } 43538 propValue = this._previousStyleCopy = assign({}, props.style); 43539 } 43540 propValue = CSSPropertyOperations.createMarkupForStyles(propValue); 43541 } 43542 var markup = null; 43543 if (this._tag != null && isCustomComponent(this._tag, props)) { 43544 if (propKey !== CHILDREN) { 43545 markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); 43546 } 43547 } else { 43548 markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); 43549 } 43550 if (markup) { 43551 ret += ' ' + markup; 43552 } 43553 } 43554 } 43555 43556 // For static pages, no need to put React ID and checksum. Saves lots of 43557 // bytes. 43558 if (transaction.renderToStaticMarkup) { 43559 return ret; 43560 } 43561 43562 var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID); 43563 return ret + ' ' + markupForID; 43564 }, 43565 43566 /** 43567 * Creates markup for the content between the tags. 43568 * 43569 * @private 43570 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 43571 * @param {object} props 43572 * @param {object} context 43573 * @return {string} Content markup. 43574 */ 43575 _createContentMarkup: function (transaction, props, context) { 43576 var ret = ''; 43577 43578 // Intentional use of != to avoid catching zero/false. 43579 var innerHTML = props.dangerouslySetInnerHTML; 43580 if (innerHTML != null) { 43581 if (innerHTML.__html != null) { 43582 ret = innerHTML.__html; 43583 } 43584 } else { 43585 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; 43586 var childrenToUse = contentToUse != null ? null : props.children; 43587 if (contentToUse != null) { 43588 // TODO: Validate that text is allowed as a child of this node 43589 ret = escapeTextContentForBrowser(contentToUse); 43590 } else if (childrenToUse != null) { 43591 var mountImages = this.mountChildren(childrenToUse, transaction, context); 43592 ret = mountImages.join(''); 43593 } 43594 } 43595 if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { 43596 // text/html ignores the first character in these tags if it's a newline 43597 // Prefer to break application/xml over text/html (for now) by adding 43598 // a newline specifically to get eaten by the parser. (Alternately for 43599 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first 43600 // \r is normalized out by HTMLTextAreaElement#value.) 43601 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> 43602 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> 43603 // See: <http://www.w3.org/TR/html5/syntax.html#newlines> 43604 // See: Parsing of "textarea" "listing" and "pre" elements 43605 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> 43606 return '\n' + ret; 43607 } else { 43608 return ret; 43609 } 43610 }, 43611 43612 _createInitialChildren: function (transaction, props, context, el) { 43613 // Intentional use of != to avoid catching zero/false. 43614 var innerHTML = props.dangerouslySetInnerHTML; 43615 if (innerHTML != null) { 43616 if (innerHTML.__html != null) { 43617 setInnerHTML(el, innerHTML.__html); 43618 } 43619 } else { 43620 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; 43621 var childrenToUse = contentToUse != null ? null : props.children; 43622 if (contentToUse != null) { 43623 // TODO: Validate that text is allowed as a child of this node 43624 setTextContent(el, contentToUse); 43625 } else if (childrenToUse != null) { 43626 var mountImages = this.mountChildren(childrenToUse, transaction, context); 43627 for (var i = 0; i < mountImages.length; i++) { 43628 el.appendChild(mountImages[i]); 43629 } 43630 } 43631 } 43632 }, 43633 43634 /** 43635 * Receives a next element and updates the component. 43636 * 43637 * @internal 43638 * @param {ReactElement} nextElement 43639 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 43640 * @param {object} context 43641 */ 43642 receiveComponent: function (nextElement, transaction, context) { 43643 var prevElement = this._currentElement; 43644 this._currentElement = nextElement; 43645 this.updateComponent(transaction, prevElement, nextElement, context); 43646 }, 43647 43648 /** 43649 * Updates a native DOM component after it has already been allocated and 43650 * attached to the DOM. Reconciles the root DOM node, then recurses. 43651 * 43652 * @param {ReactReconcileTransaction} transaction 43653 * @param {ReactElement} prevElement 43654 * @param {ReactElement} nextElement 43655 * @internal 43656 * @overridable 43657 */ 43658 updateComponent: function (transaction, prevElement, nextElement, context) { 43659 var lastProps = prevElement.props; 43660 var nextProps = this._currentElement.props; 43661 43662 switch (this._tag) { 43663 case 'button': 43664 lastProps = ReactDOMButton.getNativeProps(this, lastProps); 43665 nextProps = ReactDOMButton.getNativeProps(this, nextProps); 43666 break; 43667 case 'input': 43668 ReactDOMInput.updateWrapper(this); 43669 lastProps = ReactDOMInput.getNativeProps(this, lastProps); 43670 nextProps = ReactDOMInput.getNativeProps(this, nextProps); 43671 break; 43672 case 'option': 43673 lastProps = ReactDOMOption.getNativeProps(this, lastProps); 43674 nextProps = ReactDOMOption.getNativeProps(this, nextProps); 43675 break; 43676 case 'select': 43677 lastProps = ReactDOMSelect.getNativeProps(this, lastProps); 43678 nextProps = ReactDOMSelect.getNativeProps(this, nextProps); 43679 break; 43680 case 'textarea': 43681 ReactDOMTextarea.updateWrapper(this); 43682 lastProps = ReactDOMTextarea.getNativeProps(this, lastProps); 43683 nextProps = ReactDOMTextarea.getNativeProps(this, nextProps); 43684 break; 43685 } 43686 43687 if (true) { 43688 // If the context is reference-equal to the old one, pass down the same 43689 // processed object so the update bailout in ReactReconciler behaves 43690 // correctly (and identically in dev and prod). See #5005. 43691 if (this._unprocessedContextDev !== context) { 43692 this._unprocessedContextDev = context; 43693 this._processedContextDev = processChildContextDev(context, this); 43694 } 43695 context = this._processedContextDev; 43696 } 43697 43698 assertValidProps(this, nextProps); 43699 this._updateDOMProperties(lastProps, nextProps, transaction, null); 43700 this._updateDOMChildren(lastProps, nextProps, transaction, context); 43701 43702 if (!canDefineProperty && this._nodeWithLegacyProperties) { 43703 this._nodeWithLegacyProperties.props = nextProps; 43704 } 43705 43706 if (this._tag === 'select') { 43707 // <select> value update needs to occur after <option> children 43708 // reconciliation 43709 transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); 43710 } 43711 }, 43712 43713 /** 43714 * Reconciles the properties by detecting differences in property values and 43715 * updating the DOM as necessary. This function is probably the single most 43716 * critical path for performance optimization. 43717 * 43718 * TODO: Benchmark whether checking for changed values in memory actually 43719 * improves performance (especially statically positioned elements). 43720 * TODO: Benchmark the effects of putting this at the top since 99% of props 43721 * do not change for a given reconciliation. 43722 * TODO: Benchmark areas that can be improved with caching. 43723 * 43724 * @private 43725 * @param {object} lastProps 43726 * @param {object} nextProps 43727 * @param {ReactReconcileTransaction} transaction 43728 * @param {?DOMElement} node 43729 */ 43730 _updateDOMProperties: function (lastProps, nextProps, transaction, node) { 43731 var propKey; 43732 var styleName; 43733 var styleUpdates; 43734 for (propKey in lastProps) { 43735 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) { 43736 continue; 43737 } 43738 if (propKey === STYLE) { 43739 var lastStyle = this._previousStyleCopy; 43740 for (styleName in lastStyle) { 43741 if (lastStyle.hasOwnProperty(styleName)) { 43742 styleUpdates = styleUpdates || {}; 43743 styleUpdates[styleName] = ''; 43744 } 43745 } 43746 this._previousStyleCopy = null; 43747 } else if (registrationNameModules.hasOwnProperty(propKey)) { 43748 if (lastProps[propKey]) { 43749 // Only call deleteListener if there was a listener previously or 43750 // else willDeleteListener gets called when there wasn't actually a 43751 // listener (e.g., onClick={null}) 43752 deleteListener(this._rootNodeID, propKey); 43753 } 43754 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { 43755 if (!node) { 43756 node = ReactMount.getNode(this._rootNodeID); 43757 } 43758 DOMPropertyOperations.deleteValueForProperty(node, propKey); 43759 } 43760 } 43761 for (propKey in nextProps) { 43762 var nextProp = nextProps[propKey]; 43763 var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey]; 43764 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) { 43765 continue; 43766 } 43767 if (propKey === STYLE) { 43768 if (nextProp) { 43769 if (true) { 43770 checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); 43771 this._previousStyle = nextProp; 43772 } 43773 nextProp = this._previousStyleCopy = assign({}, nextProp); 43774 } else { 43775 this._previousStyleCopy = null; 43776 } 43777 if (lastProp) { 43778 // Unset styles on `lastProp` but not on `nextProp`. 43779 for (styleName in lastProp) { 43780 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { 43781 styleUpdates = styleUpdates || {}; 43782 styleUpdates[styleName] = ''; 43783 } 43784 } 43785 // Update styles that changed since `lastProp`. 43786 for (styleName in nextProp) { 43787 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { 43788 styleUpdates = styleUpdates || {}; 43789 styleUpdates[styleName] = nextProp[styleName]; 43790 } 43791 } 43792 } else { 43793 // Relies on `updateStylesByID` not mutating `styleUpdates`. 43794 styleUpdates = nextProp; 43795 } 43796 } else if (registrationNameModules.hasOwnProperty(propKey)) { 43797 if (nextProp) { 43798 enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction); 43799 } else if (lastProp) { 43800 deleteListener(this._rootNodeID, propKey); 43801 } 43802 } else if (isCustomComponent(this._tag, nextProps)) { 43803 if (!node) { 43804 node = ReactMount.getNode(this._rootNodeID); 43805 } 43806 if (propKey === CHILDREN) { 43807 nextProp = null; 43808 } 43809 DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp); 43810 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { 43811 if (!node) { 43812 node = ReactMount.getNode(this._rootNodeID); 43813 } 43814 // If we're updating to null or undefined, we should remove the property 43815 // from the DOM node instead of inadvertantly setting to a string. This 43816 // brings us in line with the same behavior we have on initial render. 43817 if (nextProp != null) { 43818 DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); 43819 } else { 43820 DOMPropertyOperations.deleteValueForProperty(node, propKey); 43821 } 43822 } 43823 } 43824 if (styleUpdates) { 43825 if (!node) { 43826 node = ReactMount.getNode(this._rootNodeID); 43827 } 43828 CSSPropertyOperations.setValueForStyles(node, styleUpdates); 43829 } 43830 }, 43831 43832 /** 43833 * Reconciles the children with the various properties that affect the 43834 * children content. 43835 * 43836 * @param {object} lastProps 43837 * @param {object} nextProps 43838 * @param {ReactReconcileTransaction} transaction 43839 * @param {object} context 43840 */ 43841 _updateDOMChildren: function (lastProps, nextProps, transaction, context) { 43842 var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; 43843 var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; 43844 43845 var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; 43846 var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; 43847 43848 // Note the use of `!=` which checks for null or undefined. 43849 var lastChildren = lastContent != null ? null : lastProps.children; 43850 var nextChildren = nextContent != null ? null : nextProps.children; 43851 43852 // If we're switching from children to content/html or vice versa, remove 43853 // the old content 43854 var lastHasContentOrHtml = lastContent != null || lastHtml != null; 43855 var nextHasContentOrHtml = nextContent != null || nextHtml != null; 43856 if (lastChildren != null && nextChildren == null) { 43857 this.updateChildren(null, transaction, context); 43858 } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { 43859 this.updateTextContent(''); 43860 } 43861 43862 if (nextContent != null) { 43863 if (lastContent !== nextContent) { 43864 this.updateTextContent('' + nextContent); 43865 } 43866 } else if (nextHtml != null) { 43867 if (lastHtml !== nextHtml) { 43868 this.updateMarkup('' + nextHtml); 43869 } 43870 } else if (nextChildren != null) { 43871 this.updateChildren(nextChildren, transaction, context); 43872 } 43873 }, 43874 43875 /** 43876 * Destroys all event registrations for this instance. Does not remove from 43877 * the DOM. That must be done by the parent. 43878 * 43879 * @internal 43880 */ 43881 unmountComponent: function () { 43882 switch (this._tag) { 43883 case 'iframe': 43884 case 'img': 43885 case 'form': 43886 case 'video': 43887 case 'audio': 43888 var listeners = this._wrapperState.listeners; 43889 if (listeners) { 43890 for (var i = 0; i < listeners.length; i++) { 43891 listeners[i].remove(); 43892 } 43893 } 43894 break; 43895 case 'input': 43896 ReactDOMInput.unmountWrapper(this); 43897 break; 43898 case 'html': 43899 case 'head': 43900 case 'body': 43901 /** 43902 * Components like <html> <head> and <body> can't be removed or added 43903 * easily in a cross-browser way, however it's valuable to be able to 43904 * take advantage of React's reconciliation for styling and <title> 43905 * management. So we just document it and throw in dangerous cases. 43906 */ 43907 true ? true ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : undefined : undefined; 43908 break; 43909 } 43910 43911 this.unmountChildren(); 43912 ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID); 43913 ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); 43914 this._rootNodeID = null; 43915 this._wrapperState = null; 43916 if (this._nodeWithLegacyProperties) { 43917 var node = this._nodeWithLegacyProperties; 43918 node._reactInternalComponent = null; 43919 this._nodeWithLegacyProperties = null; 43920 } 43921 }, 43922 43923 getPublicInstance: function () { 43924 if (!this._nodeWithLegacyProperties) { 43925 var node = ReactMount.getNode(this._rootNodeID); 43926 43927 node._reactInternalComponent = this; 43928 node.getDOMNode = legacyGetDOMNode; 43929 node.isMounted = legacyIsMounted; 43930 node.setState = legacySetStateEtc; 43931 node.replaceState = legacySetStateEtc; 43932 node.forceUpdate = legacySetStateEtc; 43933 node.setProps = legacySetProps; 43934 node.replaceProps = legacyReplaceProps; 43935 43936 if (true) { 43937 if (canDefineProperty) { 43938 Object.defineProperties(node, legacyPropsDescriptor); 43939 } else { 43940 // updateComponent will update this property on subsequent renders 43941 node.props = this._currentElement.props; 43942 } 43943 } else {} 43944 43945 this._nodeWithLegacyProperties = node; 43946 } 43947 return this._nodeWithLegacyProperties; 43948 } 43949 43950}; 43951 43952ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', { 43953 mountComponent: 'mountComponent', 43954 updateComponent: 'updateComponent' 43955}); 43956 43957assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); 43958 43959module.exports = ReactDOMComponent; 43960 43961/***/ }), 43962
vendor: 3,842 bytes, lines 43963-44150
43963/***/ "./node_modules/react/lib/ReactDOMFactories.js": 43964/*!*****************************************************!*\ 43965 !*** ./node_modules/react/lib/ReactDOMFactories.js ***! 43966 \*****************************************************/ 43967/*! no static exports found */ 43968/***/ (function(module, exports, __webpack_require__) { 43969 43970"use strict"; 43971/** 43972 * Copyright 2013-2015, Facebook, Inc. 43973 * All rights reserved. 43974 * 43975 * This source code is licensed under the BSD-style license found in the 43976 * LICENSE file in the root directory of this source tree. An additional grant 43977 * of patent rights can be found in the PATENTS file in the same directory. 43978 * 43979 * @providesModule ReactDOMFactories 43980 * @typechecks static-only 43981 */ 43982 43983 43984 43985var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 43986var ReactElementValidator = __webpack_require__(/*! ./ReactElementValidator */ "./node_modules/react/lib/ReactElementValidator.js"); 43987 43988var mapObject = __webpack_require__(/*! fbjs/lib/mapObject */ "./node_modules/fbjs/lib/mapObject.js"); 43989 43990/** 43991 * Create a factory that creates HTML tag elements. 43992 * 43993 * @param {string} tag Tag name (e.g. `div`). 43994 * @private 43995 */ 43996function createDOMFactory(tag) { 43997 if (true) { 43998 return ReactElementValidator.createFactory(tag); 43999 } 44000 return ReactElement.createFactory(tag); 44001} 44002 44003/** 44004 * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. 44005 * This is also accessible via `React.DOM`. 44006 * 44007 * @public 44008 */ 44009var ReactDOMFactories = mapObject({ 44010 a: 'a', 44011 abbr: 'abbr', 44012 address: 'address', 44013 area: 'area', 44014 article: 'article', 44015 aside: 'aside', 44016 audio: 'audio', 44017 b: 'b', 44018 base: 'base', 44019 bdi: 'bdi', 44020 bdo: 'bdo', 44021 big: 'big', 44022 blockquote: 'blockquote', 44023 body: 'body', 44024 br: 'br', 44025 button: 'button', 44026 canvas: 'canvas', 44027 caption: 'caption', 44028 cite: 'cite', 44029 code: 'code', 44030 col: 'col', 44031 colgroup: 'colgroup', 44032 data: 'data', 44033 datalist: 'datalist', 44034 dd: 'dd', 44035 del: 'del', 44036 details: 'details', 44037 dfn: 'dfn', 44038 dialog: 'dialog', 44039 div: 'div', 44040 dl: 'dl', 44041 dt: 'dt', 44042 em: 'em', 44043 embed: 'embed', 44044 fieldset: 'fieldset', 44045 figcaption: 'figcaption', 44046 figure: 'figure', 44047 footer: 'footer', 44048 form: 'form', 44049 h1: 'h1', 44050 h2: 'h2', 44051 h3: 'h3', 44052 h4: 'h4', 44053 h5: 'h5', 44054 h6: 'h6', 44055 head: 'head', 44056 header: 'header', 44057 hgroup: 'hgroup', 44058 hr: 'hr', 44059 html: 'html', 44060 i: 'i', 44061 iframe: 'iframe', 44062 img: 'img', 44063 input: 'input', 44064 ins: 'ins', 44065 kbd: 'kbd', 44066 keygen: 'keygen', 44067 label: 'label', 44068 legend: 'legend', 44069 li: 'li', 44070 link: 'link', 44071 main: 'main', 44072 map: 'map', 44073 mark: 'mark', 44074 menu: 'menu', 44075 menuitem: 'menuitem', 44076 meta: 'meta', 44077 meter: 'meter', 44078 nav: 'nav', 44079 noscript: 'noscript', 44080 object: 'object', 44081 ol: 'ol', 44082 optgroup: 'optgroup', 44083 option: 'option', 44084 output: 'output', 44085 p: 'p', 44086 param: 'param', 44087 picture: 'picture', 44088 pre: 'pre', 44089 progress: 'progress', 44090 q: 'q', 44091 rp: 'rp', 44092 rt: 'rt', 44093 ruby: 'ruby', 44094 s: 's', 44095 samp: 'samp', 44096 script: 'script', 44097 section: 'section', 44098 select: 'select', 44099 small: 'small', 44100 source: 'source', 44101 span: 'span', 44102 strong: 'strong', 44103 style: 'style', 44104 sub: 'sub', 44105 summary: 'summary', 44106 sup: 'sup', 44107 table: 'table', 44108 tbody: 'tbody', 44109 td: 'td', 44110 textarea: 'textarea', 44111 tfoot: 'tfoot', 44112 th: 'th', 44113 thead: 'thead', 44114 time: 'time', 44115 title: 'title', 44116 tr: 'tr', 44117 track: 'track', 44118 u: 'u', 44119 ul: 'ul', 44120 'var': 'var', 44121 video: 'video', 44122 wbr: 'wbr', 44123 44124 // SVG 44125 circle: 'circle', 44126 clipPath: 'clipPath', 44127 defs: 'defs', 44128 ellipse: 'ellipse', 44129 g: 'g', 44130 image: 'image', 44131 line: 'line', 44132 linearGradient: 'linearGradient', 44133 mask: 'mask', 44134 path: 'path', 44135 pattern: 'pattern', 44136 polygon: 'polygon', 44137 polyline: 'polyline', 44138 radialGradient: 'radialGradient', 44139 rect: 'rect', 44140 stop: 'stop', 44141 svg: 'svg', 44142 text: 'text', 44143 tspan: 'tspan' 44144 44145}, createDOMFactory); 44146 44147module.exports = ReactDOMFactories; 44148 44149/***/ }), 44150
vendor: 803 bytes, lines 44151-44179
44151/***/ "./node_modules/react/lib/ReactDOMFeatureFlags.js": 44152/*!********************************************************!*\ 44153 !*** ./node_modules/react/lib/ReactDOMFeatureFlags.js ***! 44154 \********************************************************/ 44155/*! no static exports found */ 44156/***/ (function(module, exports, __webpack_require__) { 44157 44158"use strict"; 44159/** 44160 * Copyright 2013-2015, Facebook, Inc. 44161 * All rights reserved. 44162 * 44163 * This source code is licensed under the BSD-style license found in the 44164 * LICENSE file in the root directory of this source tree. An additional grant 44165 * of patent rights can be found in the PATENTS file in the same directory. 44166 * 44167 * @providesModule ReactDOMFeatureFlags 44168 */ 44169 44170 44171 44172var ReactDOMFeatureFlags = { 44173 useCreateElement: false 44174}; 44175 44176module.exports = ReactDOMFeatureFlags; 44177 44178/***/ }), 44179
vendor: 3,909 bytes, lines 44180-44284
44180/***/ "./node_modules/react/lib/ReactDOMIDOperations.js": 44181/*!********************************************************!*\ 44182 !*** ./node_modules/react/lib/ReactDOMIDOperations.js ***! 44183 \********************************************************/ 44184/*! no static exports found */ 44185/***/ (function(module, exports, __webpack_require__) { 44186 44187"use strict"; 44188/** 44189 * Copyright 2013-2015, Facebook, Inc. 44190 * All rights reserved. 44191 * 44192 * This source code is licensed under the BSD-style license found in the 44193 * LICENSE file in the root directory of this source tree. An additional grant 44194 * of patent rights can be found in the PATENTS file in the same directory. 44195 * 44196 * @providesModule ReactDOMIDOperations 44197 * @typechecks static-only 44198 */ 44199 44200 44201 44202var DOMChildrenOperations = __webpack_require__(/*! ./DOMChildrenOperations */ "./node_modules/react/lib/DOMChildrenOperations.js"); 44203var DOMPropertyOperations = __webpack_require__(/*! ./DOMPropertyOperations */ "./node_modules/react/lib/DOMPropertyOperations.js"); 44204var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 44205var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 44206 44207var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 44208 44209/** 44210 * Errors for properties that should not be updated with `updatePropertyByID()`. 44211 * 44212 * @type {object} 44213 * @private 44214 */ 44215var INVALID_PROPERTY_ERRORS = { 44216 dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.', 44217 style: '`style` must be set using `updateStylesByID()`.' 44218}; 44219 44220/** 44221 * Operations used to process updates to DOM nodes. 44222 */ 44223var ReactDOMIDOperations = { 44224 44225 /** 44226 * Updates a DOM node with new property values. This should only be used to 44227 * update DOM properties in `DOMProperty`. 44228 * 44229 * @param {string} id ID of the node to update. 44230 * @param {string} name A valid property name, see `DOMProperty`. 44231 * @param {*} value New value of the property. 44232 * @internal 44233 */ 44234 updatePropertyByID: function (id, name, value) { 44235 var node = ReactMount.getNode(id); 44236 !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? true ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : undefined : undefined; 44237 44238 // If we're updating to null or undefined, we should remove the property 44239 // from the DOM node instead of inadvertantly setting to a string. This 44240 // brings us in line with the same behavior we have on initial render. 44241 if (value != null) { 44242 DOMPropertyOperations.setValueForProperty(node, name, value); 44243 } else { 44244 DOMPropertyOperations.deleteValueForProperty(node, name); 44245 } 44246 }, 44247 44248 /** 44249 * Replaces a DOM node that exists in the document with markup. 44250 * 44251 * @param {string} id ID of child to be replaced. 44252 * @param {string} markup Dangerous markup to inject in place of child. 44253 * @internal 44254 * @see {Danger.dangerouslyReplaceNodeWithMarkup} 44255 */ 44256 dangerouslyReplaceNodeWithMarkupByID: function (id, markup) { 44257 var node = ReactMount.getNode(id); 44258 DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup); 44259 }, 44260 44261 /** 44262 * Updates a component's children by processing a series of updates. 44263 * 44264 * @param {array<object>} updates List of update configurations. 44265 * @param {array<string>} markup List of markup strings. 44266 * @internal 44267 */ 44268 dangerouslyProcessChildrenUpdates: function (updates, markup) { 44269 for (var i = 0; i < updates.length; i++) { 44270 updates[i].parentNode = ReactMount.getNode(updates[i].parentID); 44271 } 44272 DOMChildrenOperations.processUpdates(updates, markup); 44273 } 44274}; 44275 44276ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { 44277 dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID', 44278 dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates' 44279}); 44280 44281module.exports = ReactDOMIDOperations; 44282 44283/***/ }), 44284
vendor: 6,316 bytes, lines 44285-44448
44285/***/ "./node_modules/react/lib/ReactDOMInput.js": 44286/*!*************************************************!*\ 44287 !*** ./node_modules/react/lib/ReactDOMInput.js ***! 44288 \*************************************************/ 44289/*! no static exports found */ 44290/***/ (function(module, exports, __webpack_require__) { 44291 44292"use strict"; 44293/** 44294 * Copyright 2013-2015, Facebook, Inc. 44295 * All rights reserved. 44296 * 44297 * This source code is licensed under the BSD-style license found in the 44298 * LICENSE file in the root directory of this source tree. An additional grant 44299 * of patent rights can be found in the PATENTS file in the same directory. 44300 * 44301 * @providesModule ReactDOMInput 44302 */ 44303 44304 44305 44306var ReactDOMIDOperations = __webpack_require__(/*! ./ReactDOMIDOperations */ "./node_modules/react/lib/ReactDOMIDOperations.js"); 44307var LinkedValueUtils = __webpack_require__(/*! ./LinkedValueUtils */ "./node_modules/react/lib/LinkedValueUtils.js"); 44308var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 44309var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 44310 44311var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 44312var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 44313 44314var instancesByReactID = {}; 44315 44316function forceUpdateIfMounted() { 44317 if (this._rootNodeID) { 44318 // DOM component is still mounted; update 44319 ReactDOMInput.updateWrapper(this); 44320 } 44321} 44322 44323/** 44324 * Implements an <input> native component that allows setting these optional 44325 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. 44326 * 44327 * If `checked` or `value` are not supplied (or null/undefined), user actions 44328 * that affect the checked state or value will trigger updates to the element. 44329 * 44330 * If they are supplied (and not null/undefined), the rendered element will not 44331 * trigger updates to the element. Instead, the props must change in order for 44332 * the rendered element to be updated. 44333 * 44334 * The rendered element will be initialized as unchecked (or `defaultChecked`) 44335 * with an empty value (or `defaultValue`). 44336 * 44337 * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html 44338 */ 44339var ReactDOMInput = { 44340 getNativeProps: function (inst, props, context) { 44341 var value = LinkedValueUtils.getValue(props); 44342 var checked = LinkedValueUtils.getChecked(props); 44343 44344 var nativeProps = assign({}, props, { 44345 defaultChecked: undefined, 44346 defaultValue: undefined, 44347 value: value != null ? value : inst._wrapperState.initialValue, 44348 checked: checked != null ? checked : inst._wrapperState.initialChecked, 44349 onChange: inst._wrapperState.onChange 44350 }); 44351 44352 return nativeProps; 44353 }, 44354 44355 mountWrapper: function (inst, props) { 44356 if (true) { 44357 LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); 44358 } 44359 44360 var defaultValue = props.defaultValue; 44361 inst._wrapperState = { 44362 initialChecked: props.defaultChecked || false, 44363 initialValue: defaultValue != null ? defaultValue : null, 44364 onChange: _handleChange.bind(inst) 44365 }; 44366 }, 44367 44368 mountReadyWrapper: function (inst) { 44369 // Can't be in mountWrapper or else server rendering leaks. 44370 instancesByReactID[inst._rootNodeID] = inst; 44371 }, 44372 44373 unmountWrapper: function (inst) { 44374 delete instancesByReactID[inst._rootNodeID]; 44375 }, 44376 44377 updateWrapper: function (inst) { 44378 var props = inst._currentElement.props; 44379 44380 // TODO: Shouldn't this be getChecked(props)? 44381 var checked = props.checked; 44382 if (checked != null) { 44383 ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false); 44384 } 44385 44386 var value = LinkedValueUtils.getValue(props); 44387 if (value != null) { 44388 // Cast `value` to a string to ensure the value is set correctly. While 44389 // browsers typically do this as necessary, jsdom doesn't. 44390 ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); 44391 } 44392 } 44393}; 44394 44395function _handleChange(event) { 44396 var props = this._currentElement.props; 44397 44398 var returnValue = LinkedValueUtils.executeOnChange(props, event); 44399 44400 // Here we use asap to wait until all updates have propagated, which 44401 // is important when using controlled components within layers: 44402 // https://github.com/facebook/react/issues/1698 44403 ReactUpdates.asap(forceUpdateIfMounted, this); 44404 44405 var name = props.name; 44406 if (props.type === 'radio' && name != null) { 44407 var rootNode = ReactMount.getNode(this._rootNodeID); 44408 var queryRoot = rootNode; 44409 44410 while (queryRoot.parentNode) { 44411 queryRoot = queryRoot.parentNode; 44412 } 44413 44414 // If `rootNode.form` was non-null, then we could try `form.elements`, 44415 // but that sometimes behaves strangely in IE8. We could also try using 44416 // `form.getElementsByName`, but that will only return direct children 44417 // and won't include inputs that use the HTML5 `form=` attribute. Since 44418 // the input might not even be in a form, let's just use the global 44419 // `querySelectorAll` to ensure we don't miss anything. 44420 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); 44421 44422 for (var i = 0; i < group.length; i++) { 44423 var otherNode = group[i]; 44424 if (otherNode === rootNode || otherNode.form !== rootNode.form) { 44425 continue; 44426 } 44427 // This will throw if radio buttons rendered by different copies of React 44428 // and the same name are rendered into the same form (same as #1939). 44429 // That's probably okay; we don't support it just as we don't support 44430 // mixing React with non-React. 44431 var otherID = ReactMount.getID(otherNode); 44432 !otherID ? true ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : undefined : undefined; 44433 var otherInstance = instancesByReactID[otherID]; 44434 !otherInstance ? true ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : undefined : undefined; 44435 // If this is a controlled radio button group, forcing the input that 44436 // was previously checked to update will cause it to be come re-checked 44437 // as appropriate. 44438 ReactUpdates.asap(forceUpdateIfMounted, otherInstance); 44439 } 44440 } 44441 44442 return returnValue; 44443} 44444 44445module.exports = ReactDOMInput; 44446 44447/***/ }), 44448
vendor: 3,284 bytes, lines 44449-44548
44449/***/ "./node_modules/react/lib/ReactDOMOption.js": 44450/*!**************************************************!*\ 44451 !*** ./node_modules/react/lib/ReactDOMOption.js ***! 44452 \**************************************************/ 44453/*! no static exports found */ 44454/***/ (function(module, exports, __webpack_require__) { 44455 44456"use strict"; 44457/** 44458 * Copyright 2013-2015, Facebook, Inc. 44459 * All rights reserved. 44460 * 44461 * This source code is licensed under the BSD-style license found in the 44462 * LICENSE file in the root directory of this source tree. An additional grant 44463 * of patent rights can be found in the PATENTS file in the same directory. 44464 * 44465 * @providesModule ReactDOMOption 44466 */ 44467 44468 44469 44470var ReactChildren = __webpack_require__(/*! ./ReactChildren */ "./node_modules/react/lib/ReactChildren.js"); 44471var ReactDOMSelect = __webpack_require__(/*! ./ReactDOMSelect */ "./node_modules/react/lib/ReactDOMSelect.js"); 44472 44473var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 44474var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 44475 44476var valueContextKey = ReactDOMSelect.valueContextKey; 44477 44478/** 44479 * Implements an <option> native component that warns when `selected` is set. 44480 */ 44481var ReactDOMOption = { 44482 mountWrapper: function (inst, props, context) { 44483 // TODO (yungsters): Remove support for `selected` in <option>. 44484 if (true) { 44485 true ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined; 44486 } 44487 44488 // Look up whether this option is 'selected' via context 44489 var selectValue = context[valueContextKey]; 44490 44491 // If context key is null (e.g., no specified value or after initial mount) 44492 // or missing (e.g., for <datalist>), we don't change props.selected 44493 var selected = null; 44494 if (selectValue != null) { 44495 selected = false; 44496 if (Array.isArray(selectValue)) { 44497 // multiple 44498 for (var i = 0; i < selectValue.length; i++) { 44499 if ('' + selectValue[i] === '' + props.value) { 44500 selected = true; 44501 break; 44502 } 44503 } 44504 } else { 44505 selected = '' + selectValue === '' + props.value; 44506 } 44507 } 44508 44509 inst._wrapperState = { selected: selected }; 44510 }, 44511 44512 getNativeProps: function (inst, props, context) { 44513 var nativeProps = assign({ selected: undefined, children: undefined }, props); 44514 44515 // Read state only from initial mount because <select> updates value 44516 // manually; we need the initial state only for server rendering 44517 if (inst._wrapperState.selected != null) { 44518 nativeProps.selected = inst._wrapperState.selected; 44519 } 44520 44521 var content = ''; 44522 44523 // Flatten children and warn if they aren't strings or numbers; 44524 // invalid types are ignored. 44525 ReactChildren.forEach(props.children, function (child) { 44526 if (child == null) { 44527 return; 44528 } 44529 if (typeof child === 'string' || typeof child === 'number') { 44530 content += child; 44531 } else { 44532 true ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined; 44533 } 44534 }); 44535 44536 if (content) { 44537 nativeProps.children = content; 44538 } 44539 44540 return nativeProps; 44541 } 44542 44543}; 44544 44545module.exports = ReactDOMOption; 44546 44547/***/ }), 44548
vendor: 6,627 bytes, lines 44549-44747
44549/***/ "./node_modules/react/lib/ReactDOMSelect.js": 44550/*!**************************************************!*\ 44551 !*** ./node_modules/react/lib/ReactDOMSelect.js ***! 44552 \**************************************************/ 44553/*! no static exports found */ 44554/***/ (function(module, exports, __webpack_require__) { 44555 44556"use strict"; 44557/** 44558 * Copyright 2013-2015, Facebook, Inc. 44559 * All rights reserved. 44560 * 44561 * This source code is licensed under the BSD-style license found in the 44562 * LICENSE file in the root directory of this source tree. An additional grant 44563 * of patent rights can be found in the PATENTS file in the same directory. 44564 * 44565 * @providesModule ReactDOMSelect 44566 */ 44567 44568 44569 44570var LinkedValueUtils = __webpack_require__(/*! ./LinkedValueUtils */ "./node_modules/react/lib/LinkedValueUtils.js"); 44571var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 44572var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 44573 44574var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 44575var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 44576 44577var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2); 44578 44579function updateOptionsIfPendingUpdateAndMounted() { 44580 if (this._rootNodeID && this._wrapperState.pendingUpdate) { 44581 this._wrapperState.pendingUpdate = false; 44582 44583 var props = this._currentElement.props; 44584 var value = LinkedValueUtils.getValue(props); 44585 44586 if (value != null) { 44587 updateOptions(this, Boolean(props.multiple), value); 44588 } 44589 } 44590} 44591 44592function getDeclarationErrorAddendum(owner) { 44593 if (owner) { 44594 var name = owner.getName(); 44595 if (name) { 44596 return ' Check the render method of `' + name + '`.'; 44597 } 44598 } 44599 return ''; 44600} 44601 44602var valuePropNames = ['value', 'defaultValue']; 44603 44604/** 44605 * Validation function for `value` and `defaultValue`. 44606 * @private 44607 */ 44608function checkSelectPropTypes(inst, props) { 44609 var owner = inst._currentElement._owner; 44610 LinkedValueUtils.checkPropTypes('select', props, owner); 44611 44612 for (var i = 0; i < valuePropNames.length; i++) { 44613 var propName = valuePropNames[i]; 44614 if (props[propName] == null) { 44615 continue; 44616 } 44617 if (props.multiple) { 44618 true ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined; 44619 } else { 44620 true ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined; 44621 } 44622 } 44623} 44624 44625/** 44626 * @param {ReactDOMComponent} inst 44627 * @param {boolean} multiple 44628 * @param {*} propValue A stringable (with `multiple`, a list of stringables). 44629 * @private 44630 */ 44631function updateOptions(inst, multiple, propValue) { 44632 var selectedValue, i; 44633 var options = ReactMount.getNode(inst._rootNodeID).options; 44634 44635 if (multiple) { 44636 selectedValue = {}; 44637 for (i = 0; i < propValue.length; i++) { 44638 selectedValue['' + propValue[i]] = true; 44639 } 44640 for (i = 0; i < options.length; i++) { 44641 var selected = selectedValue.hasOwnProperty(options[i].value); 44642 if (options[i].selected !== selected) { 44643 options[i].selected = selected; 44644 } 44645 } 44646 } else { 44647 // Do not set `select.value` as exact behavior isn't consistent across all 44648 // browsers for all cases. 44649 selectedValue = '' + propValue; 44650 for (i = 0; i < options.length; i++) { 44651 if (options[i].value === selectedValue) { 44652 options[i].selected = true; 44653 return; 44654 } 44655 } 44656 if (options.length) { 44657 options[0].selected = true; 44658 } 44659 } 44660} 44661 44662/** 44663 * Implements a <select> native component that allows optionally setting the 44664 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a 44665 * stringable. If `multiple` is true, the prop must be an array of stringables. 44666 * 44667 * If `value` is not supplied (or null/undefined), user actions that change the 44668 * selected option will trigger updates to the rendered options. 44669 * 44670 * If it is supplied (and not null/undefined), the rendered options will not 44671 * update in response to user actions. Instead, the `value` prop must change in 44672 * order for the rendered options to update. 44673 * 44674 * If `defaultValue` is provided, any options with the supplied values will be 44675 * selected. 44676 */ 44677var ReactDOMSelect = { 44678 valueContextKey: valueContextKey, 44679 44680 getNativeProps: function (inst, props, context) { 44681 return assign({}, props, { 44682 onChange: inst._wrapperState.onChange, 44683 value: undefined 44684 }); 44685 }, 44686 44687 mountWrapper: function (inst, props) { 44688 if (true) { 44689 checkSelectPropTypes(inst, props); 44690 } 44691 44692 var value = LinkedValueUtils.getValue(props); 44693 inst._wrapperState = { 44694 pendingUpdate: false, 44695 initialValue: value != null ? value : props.defaultValue, 44696 onChange: _handleChange.bind(inst), 44697 wasMultiple: Boolean(props.multiple) 44698 }; 44699 }, 44700 44701 processChildContext: function (inst, props, context) { 44702 // Pass down initial value so initial generated markup has correct 44703 // `selected` attributes 44704 var childContext = assign({}, context); 44705 childContext[valueContextKey] = inst._wrapperState.initialValue; 44706 return childContext; 44707 }, 44708 44709 postUpdateWrapper: function (inst) { 44710 var props = inst._currentElement.props; 44711 44712 // After the initial mount, we control selected-ness manually so don't pass 44713 // the context value down 44714 inst._wrapperState.initialValue = undefined; 44715 44716 var wasMultiple = inst._wrapperState.wasMultiple; 44717 inst._wrapperState.wasMultiple = Boolean(props.multiple); 44718 44719 var value = LinkedValueUtils.getValue(props); 44720 if (value != null) { 44721 inst._wrapperState.pendingUpdate = false; 44722 updateOptions(inst, Boolean(props.multiple), value); 44723 } else if (wasMultiple !== Boolean(props.multiple)) { 44724 // For simplicity, reapply `defaultValue` if `multiple` is toggled. 44725 if (props.defaultValue != null) { 44726 updateOptions(inst, Boolean(props.multiple), props.defaultValue); 44727 } else { 44728 // Revert the select back to its default unselected state. 44729 updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); 44730 } 44731 } 44732 } 44733}; 44734 44735function _handleChange(event) { 44736 var props = this._currentElement.props; 44737 var returnValue = LinkedValueUtils.executeOnChange(props, event); 44738 44739 this._wrapperState.pendingUpdate = true; 44740 ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); 44741 return returnValue; 44742} 44743 44744module.exports = ReactDOMSelect; 44745 44746/***/ }), 44747
vendor: 7,370 bytes, lines 44748-44970
44748/***/ "./node_modules/react/lib/ReactDOMSelection.js": 44749/*!*****************************************************!*\ 44750 !*** ./node_modules/react/lib/ReactDOMSelection.js ***! 44751 \*****************************************************/ 44752/*! no static exports found */ 44753/***/ (function(module, exports, __webpack_require__) { 44754 44755"use strict"; 44756/** 44757 * Copyright 2013-2015, Facebook, Inc. 44758 * All rights reserved. 44759 * 44760 * This source code is licensed under the BSD-style license found in the 44761 * LICENSE file in the root directory of this source tree. An additional grant 44762 * of patent rights can be found in the PATENTS file in the same directory. 44763 * 44764 * @providesModule ReactDOMSelection 44765 */ 44766 44767 44768 44769var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 44770 44771var getNodeForCharacterOffset = __webpack_require__(/*! ./getNodeForCharacterOffset */ "./node_modules/react/lib/getNodeForCharacterOffset.js"); 44772var getTextContentAccessor = __webpack_require__(/*! ./getTextContentAccessor */ "./node_modules/react/lib/getTextContentAccessor.js"); 44773 44774/** 44775 * While `isCollapsed` is available on the Selection object and `collapsed` 44776 * is available on the Range object, IE11 sometimes gets them wrong. 44777 * If the anchor/focus nodes and offsets are the same, the range is collapsed. 44778 */ 44779function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { 44780 return anchorNode === focusNode && anchorOffset === focusOffset; 44781} 44782 44783/** 44784 * Get the appropriate anchor and focus node/offset pairs for IE. 44785 * 44786 * The catch here is that IE's selection API doesn't provide information 44787 * about whether the selection is forward or backward, so we have to 44788 * behave as though it's always forward. 44789 * 44790 * IE text differs from modern selection in that it behaves as though 44791 * block elements end with a new line. This means character offsets will 44792 * differ between the two APIs. 44793 * 44794 * @param {DOMElement} node 44795 * @return {object} 44796 */ 44797function getIEOffsets(node) { 44798 var selection = document.selection; 44799 var selectedRange = selection.createRange(); 44800 var selectedLength = selectedRange.text.length; 44801 44802 // Duplicate selection so we can move range without breaking user selection. 44803 var fromStart = selectedRange.duplicate(); 44804 fromStart.moveToElementText(node); 44805 fromStart.setEndPoint('EndToStart', selectedRange); 44806 44807 var startOffset = fromStart.text.length; 44808 var endOffset = startOffset + selectedLength; 44809 44810 return { 44811 start: startOffset, 44812 end: endOffset 44813 }; 44814} 44815 44816/** 44817 * @param {DOMElement} node 44818 * @return {?object} 44819 */ 44820function getModernOffsets(node) { 44821 var selection = window.getSelection && window.getSelection(); 44822 44823 if (!selection || selection.rangeCount === 0) { 44824 return null; 44825 } 44826 44827 var anchorNode = selection.anchorNode; 44828 var anchorOffset = selection.anchorOffset; 44829 var focusNode = selection.focusNode; 44830 var focusOffset = selection.focusOffset; 44831 44832 var currentRange = selection.getRangeAt(0); 44833 44834 // In Firefox, range.startContainer and range.endContainer can be "anonymous 44835 // divs", e.g. the up/down buttons on an <input type="number">. Anonymous 44836 // divs do not seem to expose properties, triggering a "Permission denied 44837 // error" if any of its properties are accessed. The only seemingly possible 44838 // way to avoid erroring is to access a property that typically works for 44839 // non-anonymous divs and catch any error that may otherwise arise. See 44840 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 44841 try { 44842 /* eslint-disable no-unused-expressions */ 44843 currentRange.startContainer.nodeType; 44844 currentRange.endContainer.nodeType; 44845 /* eslint-enable no-unused-expressions */ 44846 } catch (e) { 44847 return null; 44848 } 44849 44850 // If the node and offset values are the same, the selection is collapsed. 44851 // `Selection.isCollapsed` is available natively, but IE sometimes gets 44852 // this value wrong. 44853 var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); 44854 44855 var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; 44856 44857 var tempRange = currentRange.cloneRange(); 44858 tempRange.selectNodeContents(node); 44859 tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); 44860 44861 var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); 44862 44863 var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; 44864 var end = start + rangeLength; 44865 44866 // Detect whether the selection is backward. 44867 var detectionRange = document.createRange(); 44868 detectionRange.setStart(anchorNode, anchorOffset); 44869 detectionRange.setEnd(focusNode, focusOffset); 44870 var isBackward = detectionRange.collapsed; 44871 44872 return { 44873 start: isBackward ? end : start, 44874 end: isBackward ? start : end 44875 }; 44876} 44877 44878/** 44879 * @param {DOMElement|DOMTextNode} node 44880 * @param {object} offsets 44881 */ 44882function setIEOffsets(node, offsets) { 44883 var range = document.selection.createRange().duplicate(); 44884 var start, end; 44885 44886 if (typeof offsets.end === 'undefined') { 44887 start = offsets.start; 44888 end = start; 44889 } else if (offsets.start > offsets.end) { 44890 start = offsets.end; 44891 end = offsets.start; 44892 } else { 44893 start = offsets.start; 44894 end = offsets.end; 44895 } 44896 44897 range.moveToElementText(node); 44898 range.moveStart('character', start); 44899 range.setEndPoint('EndToStart', range); 44900 range.moveEnd('character', end - start); 44901 range.select(); 44902} 44903 44904/** 44905 * In modern non-IE browsers, we can support both forward and backward 44906 * selections. 44907 * 44908 * Note: IE10+ supports the Selection object, but it does not support 44909 * the `extend` method, which means that even in modern IE, it's not possible 44910 * to programatically create a backward selection. Thus, for all IE 44911 * versions, we use the old IE API to create our selections. 44912 * 44913 * @param {DOMElement|DOMTextNode} node 44914 * @param {object} offsets 44915 */ 44916function setModernOffsets(node, offsets) { 44917 if (!window.getSelection) { 44918 return; 44919 } 44920 44921 var selection = window.getSelection(); 44922 var length = node[getTextContentAccessor()].length; 44923 var start = Math.min(offsets.start, length); 44924 var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); 44925 44926 // IE 11 uses modern selection, but doesn't support the extend method. 44927 // Flip backward selections, so we can set with a single range. 44928 if (!selection.extend && start > end) { 44929 var temp = end; 44930 end = start; 44931 start = temp; 44932 } 44933 44934 var startMarker = getNodeForCharacterOffset(node, start); 44935 var endMarker = getNodeForCharacterOffset(node, end); 44936 44937 if (startMarker && endMarker) { 44938 var range = document.createRange(); 44939 range.setStart(startMarker.node, startMarker.offset); 44940 selection.removeAllRanges(); 44941 44942 if (start > end) { 44943 selection.addRange(range); 44944 selection.extend(endMarker.node, endMarker.offset); 44945 } else { 44946 range.setEnd(endMarker.node, endMarker.offset); 44947 selection.addRange(range); 44948 } 44949 } 44950} 44951 44952var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); 44953 44954var ReactDOMSelection = { 44955 /** 44956 * @param {DOMElement} node 44957 */ 44958 getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, 44959 44960 /** 44961 * @param {DOMElement|DOMTextNode} node 44962 * @param {object} offsets 44963 */ 44964 setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets 44965}; 44966 44967module.exports = ReactDOMSelection; 44968 44969/***/ }), 44970
vendor: 1,284 bytes, lines 44971-45007
44971/***/ "./node_modules/react/lib/ReactDOMServer.js": 44972/*!**************************************************!*\ 44973 !*** ./node_modules/react/lib/ReactDOMServer.js ***! 44974 \**************************************************/ 44975/*! no static exports found */ 44976/***/ (function(module, exports, __webpack_require__) { 44977 44978"use strict"; 44979/** 44980 * Copyright 2013-2015, Facebook, Inc. 44981 * All rights reserved. 44982 * 44983 * This source code is licensed under the BSD-style license found in the 44984 * LICENSE file in the root directory of this source tree. An additional grant 44985 * of patent rights can be found in the PATENTS file in the same directory. 44986 * 44987 * @providesModule ReactDOMServer 44988 */ 44989 44990 44991 44992var ReactDefaultInjection = __webpack_require__(/*! ./ReactDefaultInjection */ "./node_modules/react/lib/ReactDefaultInjection.js"); 44993var ReactServerRendering = __webpack_require__(/*! ./ReactServerRendering */ "./node_modules/react/lib/ReactServerRendering.js"); 44994var ReactVersion = __webpack_require__(/*! ./ReactVersion */ "./node_modules/react/lib/ReactVersion.js"); 44995 44996ReactDefaultInjection.inject(); 44997 44998var ReactDOMServer = { 44999 renderToString: ReactServerRendering.renderToString, 45000 renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, 45001 version: ReactVersion 45002}; 45003 45004module.exports = ReactDOMServer; 45005 45006/***/ }), 45007
vendor: 5,173 bytes, lines 45008-45145
45008/***/ "./node_modules/react/lib/ReactDOMTextComponent.js": 45009/*!*********************************************************!*\ 45010 !*** ./node_modules/react/lib/ReactDOMTextComponent.js ***! 45011 \*********************************************************/ 45012/*! no static exports found */ 45013/***/ (function(module, exports, __webpack_require__) { 45014 45015"use strict"; 45016/** 45017 * Copyright 2013-2015, Facebook, Inc. 45018 * All rights reserved. 45019 * 45020 * This source code is licensed under the BSD-style license found in the 45021 * LICENSE file in the root directory of this source tree. An additional grant 45022 * of patent rights can be found in the PATENTS file in the same directory. 45023 * 45024 * @providesModule ReactDOMTextComponent 45025 * @typechecks static-only 45026 */ 45027 45028 45029 45030var DOMChildrenOperations = __webpack_require__(/*! ./DOMChildrenOperations */ "./node_modules/react/lib/DOMChildrenOperations.js"); 45031var DOMPropertyOperations = __webpack_require__(/*! ./DOMPropertyOperations */ "./node_modules/react/lib/DOMPropertyOperations.js"); 45032var ReactComponentBrowserEnvironment = __webpack_require__(/*! ./ReactComponentBrowserEnvironment */ "./node_modules/react/lib/ReactComponentBrowserEnvironment.js"); 45033var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 45034 45035var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 45036var escapeTextContentForBrowser = __webpack_require__(/*! ./escapeTextContentForBrowser */ "./node_modules/react/lib/escapeTextContentForBrowser.js"); 45037var setTextContent = __webpack_require__(/*! ./setTextContent */ "./node_modules/react/lib/setTextContent.js"); 45038var validateDOMNesting = __webpack_require__(/*! ./validateDOMNesting */ "./node_modules/react/lib/validateDOMNesting.js"); 45039 45040/** 45041 * Text nodes violate a couple assumptions that React makes about components: 45042 * 45043 * - When mounting text into the DOM, adjacent text nodes are merged. 45044 * - Text nodes cannot be assigned a React root ID. 45045 * 45046 * This component is used to wrap strings in elements so that they can undergo 45047 * the same reconciliation that is applied to elements. 45048 * 45049 * TODO: Investigate representing React components in the DOM with text nodes. 45050 * 45051 * @class ReactDOMTextComponent 45052 * @extends ReactComponent 45053 * @internal 45054 */ 45055var ReactDOMTextComponent = function (props) { 45056 // This constructor and its argument is currently used by mocks. 45057}; 45058 45059assign(ReactDOMTextComponent.prototype, { 45060 45061 /** 45062 * @param {ReactText} text 45063 * @internal 45064 */ 45065 construct: function (text) { 45066 // TODO: This is really a ReactText (ReactNode), not a ReactElement 45067 this._currentElement = text; 45068 this._stringText = '' + text; 45069 45070 // Properties 45071 this._rootNodeID = null; 45072 this._mountIndex = 0; 45073 }, 45074 45075 /** 45076 * Creates the markup for this text node. This node is not intended to have 45077 * any features besides containing text content. 45078 * 45079 * @param {string} rootID DOM ID of the root node. 45080 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 45081 * @return {string} Markup for this text node. 45082 * @internal 45083 */ 45084 mountComponent: function (rootID, transaction, context) { 45085 if (true) { 45086 if (context[validateDOMNesting.ancestorInfoContextKey]) { 45087 validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]); 45088 } 45089 } 45090 45091 this._rootNodeID = rootID; 45092 if (transaction.useCreateElement) { 45093 var ownerDocument = context[ReactMount.ownerDocumentContextKey]; 45094 var el = ownerDocument.createElement('span'); 45095 DOMPropertyOperations.setAttributeForID(el, rootID); 45096 // Populate node cache 45097 ReactMount.getID(el); 45098 setTextContent(el, this._stringText); 45099 return el; 45100 } else { 45101 var escapedText = escapeTextContentForBrowser(this._stringText); 45102 45103 if (transaction.renderToStaticMarkup) { 45104 // Normally we'd wrap this in a `span` for the reasons stated above, but 45105 // since this is a situation where React won't take over (static pages), 45106 // we can simply return the text as it is. 45107 return escapedText; 45108 } 45109 45110 return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>'; 45111 } 45112 }, 45113 45114 /** 45115 * Updates this component by updating the text content. 45116 * 45117 * @param {ReactText} nextText The next text content 45118 * @param {ReactReconcileTransaction} transaction 45119 * @internal 45120 */ 45121 receiveComponent: function (nextText, transaction) { 45122 if (nextText !== this._currentElement) { 45123 this._currentElement = nextText; 45124 var nextStringText = '' + nextText; 45125 if (nextStringText !== this._stringText) { 45126 // TODO: Save this as pending props and use performUpdateIfNecessary 45127 // and/or updateComponent to do the actual update for consistency with 45128 // other component types? 45129 this._stringText = nextStringText; 45130 var node = ReactMount.getNode(this._rootNodeID); 45131 DOMChildrenOperations.updateTextContent(node, nextStringText); 45132 } 45133 } 45134 }, 45135 45136 unmountComponent: function () { 45137 ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); 45138 } 45139 45140}); 45141 45142module.exports = ReactDOMTextComponent; 45143 45144/***/ }), 45145
vendor: 4,824 bytes, lines 45146-45269
45146/***/ "./node_modules/react/lib/ReactDOMTextarea.js": 45147/*!****************************************************!*\ 45148 !*** ./node_modules/react/lib/ReactDOMTextarea.js ***! 45149 \****************************************************/ 45150/*! no static exports found */ 45151/***/ (function(module, exports, __webpack_require__) { 45152 45153"use strict"; 45154/** 45155 * Copyright 2013-2015, Facebook, Inc. 45156 * All rights reserved. 45157 * 45158 * This source code is licensed under the BSD-style license found in the 45159 * LICENSE file in the root directory of this source tree. An additional grant 45160 * of patent rights can be found in the PATENTS file in the same directory. 45161 * 45162 * @providesModule ReactDOMTextarea 45163 */ 45164 45165 45166 45167var LinkedValueUtils = __webpack_require__(/*! ./LinkedValueUtils */ "./node_modules/react/lib/LinkedValueUtils.js"); 45168var ReactDOMIDOperations = __webpack_require__(/*! ./ReactDOMIDOperations */ "./node_modules/react/lib/ReactDOMIDOperations.js"); 45169var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 45170 45171var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 45172var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 45173var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 45174 45175function forceUpdateIfMounted() { 45176 if (this._rootNodeID) { 45177 // DOM component is still mounted; update 45178 ReactDOMTextarea.updateWrapper(this); 45179 } 45180} 45181 45182/** 45183 * Implements a <textarea> native component that allows setting `value`, and 45184 * `defaultValue`. This differs from the traditional DOM API because value is 45185 * usually set as PCDATA children. 45186 * 45187 * If `value` is not supplied (or null/undefined), user actions that affect the 45188 * value will trigger updates to the element. 45189 * 45190 * If `value` is supplied (and not null/undefined), the rendered element will 45191 * not trigger updates to the element. Instead, the `value` prop must change in 45192 * order for the rendered element to be updated. 45193 * 45194 * The rendered element will be initialized with an empty value, the prop 45195 * `defaultValue` if specified, or the children content (deprecated). 45196 */ 45197var ReactDOMTextarea = { 45198 getNativeProps: function (inst, props, context) { 45199 !(props.dangerouslySetInnerHTML == null) ? true ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : undefined : undefined; 45200 45201 // Always set children to the same thing. In IE9, the selection range will 45202 // get reset if `textContent` is mutated. 45203 var nativeProps = assign({}, props, { 45204 defaultValue: undefined, 45205 value: undefined, 45206 children: inst._wrapperState.initialValue, 45207 onChange: inst._wrapperState.onChange 45208 }); 45209 45210 return nativeProps; 45211 }, 45212 45213 mountWrapper: function (inst, props) { 45214 if (true) { 45215 LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); 45216 } 45217 45218 var defaultValue = props.defaultValue; 45219 // TODO (yungsters): Remove support for children content in <textarea>. 45220 var children = props.children; 45221 if (children != null) { 45222 if (true) { 45223 true ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined; 45224 } 45225 !(defaultValue == null) ? true ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : undefined : undefined; 45226 if (Array.isArray(children)) { 45227 !(children.length <= 1) ? true ? invariant(false, '<textarea> can only have at most one child.') : undefined : undefined; 45228 children = children[0]; 45229 } 45230 45231 defaultValue = '' + children; 45232 } 45233 if (defaultValue == null) { 45234 defaultValue = ''; 45235 } 45236 var value = LinkedValueUtils.getValue(props); 45237 45238 inst._wrapperState = { 45239 // We save the initial value so that `ReactDOMComponent` doesn't update 45240 // `textContent` (unnecessary since we update value). 45241 // The initial value can be a boolean or object so that's why it's 45242 // forced to be a string. 45243 initialValue: '' + (value != null ? value : defaultValue), 45244 onChange: _handleChange.bind(inst) 45245 }; 45246 }, 45247 45248 updateWrapper: function (inst) { 45249 var props = inst._currentElement.props; 45250 var value = LinkedValueUtils.getValue(props); 45251 if (value != null) { 45252 // Cast `value` to a string to ensure the value is set correctly. While 45253 // browsers typically do this as necessary, jsdom doesn't. 45254 ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); 45255 } 45256 } 45257}; 45258 45259function _handleChange(event) { 45260 var props = this._currentElement.props; 45261 var returnValue = LinkedValueUtils.executeOnChange(props, event); 45262 ReactUpdates.asap(forceUpdateIfMounted, this); 45263 return returnValue; 45264} 45265 45266module.exports = ReactDOMTextarea; 45267 45268/***/ }), 45269
vendor: 2,533 bytes, lines 45270-45347
45270/***/ "./node_modules/react/lib/ReactDefaultBatchingStrategy.js": 45271/*!****************************************************************!*\ 45272 !*** ./node_modules/react/lib/ReactDefaultBatchingStrategy.js ***! 45273 \****************************************************************/ 45274/*! no static exports found */ 45275/***/ (function(module, exports, __webpack_require__) { 45276 45277"use strict"; 45278/** 45279 * Copyright 2013-2015, Facebook, Inc. 45280 * All rights reserved. 45281 * 45282 * This source code is licensed under the BSD-style license found in the 45283 * LICENSE file in the root directory of this source tree. An additional grant 45284 * of patent rights can be found in the PATENTS file in the same directory. 45285 * 45286 * @providesModule ReactDefaultBatchingStrategy 45287 */ 45288 45289 45290 45291var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 45292var Transaction = __webpack_require__(/*! ./Transaction */ "./node_modules/react/lib/Transaction.js"); 45293 45294var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 45295var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 45296 45297var RESET_BATCHED_UPDATES = { 45298 initialize: emptyFunction, 45299 close: function () { 45300 ReactDefaultBatchingStrategy.isBatchingUpdates = false; 45301 } 45302}; 45303 45304var FLUSH_BATCHED_UPDATES = { 45305 initialize: emptyFunction, 45306 close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) 45307}; 45308 45309var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; 45310 45311function ReactDefaultBatchingStrategyTransaction() { 45312 this.reinitializeTransaction(); 45313} 45314 45315assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, { 45316 getTransactionWrappers: function () { 45317 return TRANSACTION_WRAPPERS; 45318 } 45319}); 45320 45321var transaction = new ReactDefaultBatchingStrategyTransaction(); 45322 45323var ReactDefaultBatchingStrategy = { 45324 isBatchingUpdates: false, 45325 45326 /** 45327 * Call the provided function in a context within which calls to `setState` 45328 * and friends are batched such that components aren't updated unnecessarily. 45329 */ 45330 batchedUpdates: function (callback, a, b, c, d, e) { 45331 var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; 45332 45333 ReactDefaultBatchingStrategy.isBatchingUpdates = true; 45334 45335 // The code is written this way to avoid extra allocations 45336 if (alreadyBatchingUpdates) { 45337 callback(a, b, c, d, e); 45338 } else { 45339 transaction.perform(callback, null, a, b, c, d, e); 45340 } 45341 } 45342}; 45343 45344module.exports = ReactDefaultBatchingStrategy; 45345 45346/***/ }), 45347
vendor: 5,802 bytes, lines 45348-45455
45348/***/ "./node_modules/react/lib/ReactDefaultInjection.js": 45349/*!*********************************************************!*\ 45350 !*** ./node_modules/react/lib/ReactDefaultInjection.js ***! 45351 \*********************************************************/ 45352/*! no static exports found */ 45353/***/ (function(module, exports, __webpack_require__) { 45354 45355"use strict"; 45356/** 45357 * Copyright 2013-2015, Facebook, Inc. 45358 * All rights reserved. 45359 * 45360 * This source code is licensed under the BSD-style license found in the 45361 * LICENSE file in the root directory of this source tree. An additional grant 45362 * of patent rights can be found in the PATENTS file in the same directory. 45363 * 45364 * @providesModule ReactDefaultInjection 45365 */ 45366 45367 45368 45369var BeforeInputEventPlugin = __webpack_require__(/*! ./BeforeInputEventPlugin */ "./node_modules/react/lib/BeforeInputEventPlugin.js"); 45370var ChangeEventPlugin = __webpack_require__(/*! ./ChangeEventPlugin */ "./node_modules/react/lib/ChangeEventPlugin.js"); 45371var ClientReactRootIndex = __webpack_require__(/*! ./ClientReactRootIndex */ "./node_modules/react/lib/ClientReactRootIndex.js"); 45372var DefaultEventPluginOrder = __webpack_require__(/*! ./DefaultEventPluginOrder */ "./node_modules/react/lib/DefaultEventPluginOrder.js"); 45373var EnterLeaveEventPlugin = __webpack_require__(/*! ./EnterLeaveEventPlugin */ "./node_modules/react/lib/EnterLeaveEventPlugin.js"); 45374var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 45375var HTMLDOMPropertyConfig = __webpack_require__(/*! ./HTMLDOMPropertyConfig */ "./node_modules/react/lib/HTMLDOMPropertyConfig.js"); 45376var ReactBrowserComponentMixin = __webpack_require__(/*! ./ReactBrowserComponentMixin */ "./node_modules/react/lib/ReactBrowserComponentMixin.js"); 45377var ReactComponentBrowserEnvironment = __webpack_require__(/*! ./ReactComponentBrowserEnvironment */ "./node_modules/react/lib/ReactComponentBrowserEnvironment.js"); 45378var ReactDefaultBatchingStrategy = __webpack_require__(/*! ./ReactDefaultBatchingStrategy */ "./node_modules/react/lib/ReactDefaultBatchingStrategy.js"); 45379var ReactDOMComponent = __webpack_require__(/*! ./ReactDOMComponent */ "./node_modules/react/lib/ReactDOMComponent.js"); 45380var ReactDOMTextComponent = __webpack_require__(/*! ./ReactDOMTextComponent */ "./node_modules/react/lib/ReactDOMTextComponent.js"); 45381var ReactEventListener = __webpack_require__(/*! ./ReactEventListener */ "./node_modules/react/lib/ReactEventListener.js"); 45382var ReactInjection = __webpack_require__(/*! ./ReactInjection */ "./node_modules/react/lib/ReactInjection.js"); 45383var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 45384var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 45385var ReactReconcileTransaction = __webpack_require__(/*! ./ReactReconcileTransaction */ "./node_modules/react/lib/ReactReconcileTransaction.js"); 45386var SelectEventPlugin = __webpack_require__(/*! ./SelectEventPlugin */ "./node_modules/react/lib/SelectEventPlugin.js"); 45387var ServerReactRootIndex = __webpack_require__(/*! ./ServerReactRootIndex */ "./node_modules/react/lib/ServerReactRootIndex.js"); 45388var SimpleEventPlugin = __webpack_require__(/*! ./SimpleEventPlugin */ "./node_modules/react/lib/SimpleEventPlugin.js"); 45389var SVGDOMPropertyConfig = __webpack_require__(/*! ./SVGDOMPropertyConfig */ "./node_modules/react/lib/SVGDOMPropertyConfig.js"); 45390 45391var alreadyInjected = false; 45392 45393function inject() { 45394 if (alreadyInjected) { 45395 // TODO: This is currently true because these injections are shared between 45396 // the client and the server package. They should be built independently 45397 // and not share any injection state. Then this problem will be solved. 45398 return; 45399 } 45400 alreadyInjected = true; 45401 45402 ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); 45403 45404 /** 45405 * Inject modules for resolving DOM hierarchy and plugin ordering. 45406 */ 45407 ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); 45408 ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles); 45409 ReactInjection.EventPluginHub.injectMount(ReactMount); 45410 45411 /** 45412 * Some important event plugins included by default (without having to require 45413 * them). 45414 */ 45415 ReactInjection.EventPluginHub.injectEventPluginsByName({ 45416 SimpleEventPlugin: SimpleEventPlugin, 45417 EnterLeaveEventPlugin: EnterLeaveEventPlugin, 45418 ChangeEventPlugin: ChangeEventPlugin, 45419 SelectEventPlugin: SelectEventPlugin, 45420 BeforeInputEventPlugin: BeforeInputEventPlugin 45421 }); 45422 45423 ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent); 45424 45425 ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent); 45426 45427 ReactInjection.Class.injectMixin(ReactBrowserComponentMixin); 45428 45429 ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); 45430 ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); 45431 45432 ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); 45433 45434 ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); 45435 ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); 45436 45437 ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex); 45438 45439 ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); 45440 45441 if (true) { 45442 var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; 45443 if (/[?&]react_perf\b/.test(url)) { 45444 var ReactDefaultPerf = __webpack_require__(/*! ./ReactDefaultPerf */ "./node_modules/react/lib/ReactDefaultPerf.js"); 45445 ReactDefaultPerf.start(); 45446 } 45447 } 45448} 45449 45450module.exports = { 45451 inject: inject 45452}; 45453 45454/***/ }), 45455
vendor: 9,268 bytes, lines 45456-45703
45456/***/ "./node_modules/react/lib/ReactDefaultPerf.js": 45457/*!****************************************************!*\ 45458 !*** ./node_modules/react/lib/ReactDefaultPerf.js ***! 45459 \****************************************************/ 45460/*! no static exports found */ 45461/***/ (function(module, exports, __webpack_require__) { 45462 45463"use strict"; 45464/** 45465 * Copyright 2013-2015, Facebook, Inc. 45466 * All rights reserved. 45467 * 45468 * This source code is licensed under the BSD-style license found in the 45469 * LICENSE file in the root directory of this source tree. An additional grant 45470 * of patent rights can be found in the PATENTS file in the same directory. 45471 * 45472 * @providesModule ReactDefaultPerf 45473 * @typechecks static-only 45474 */ 45475 45476 45477 45478var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 45479var ReactDefaultPerfAnalysis = __webpack_require__(/*! ./ReactDefaultPerfAnalysis */ "./node_modules/react/lib/ReactDefaultPerfAnalysis.js"); 45480var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 45481var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 45482 45483var performanceNow = __webpack_require__(/*! fbjs/lib/performanceNow */ "./node_modules/fbjs/lib/performanceNow.js"); 45484 45485function roundFloat(val) { 45486 return Math.floor(val * 100) / 100; 45487} 45488 45489function addValue(obj, key, val) { 45490 obj[key] = (obj[key] || 0) + val; 45491} 45492 45493var ReactDefaultPerf = { 45494 _allMeasurements: [], // last item in the list is the current one 45495 _mountStack: [0], 45496 _injected: false, 45497 45498 start: function () { 45499 if (!ReactDefaultPerf._injected) { 45500 ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure); 45501 } 45502 45503 ReactDefaultPerf._allMeasurements.length = 0; 45504 ReactPerf.enableMeasure = true; 45505 }, 45506 45507 stop: function () { 45508 ReactPerf.enableMeasure = false; 45509 }, 45510 45511 getLastMeasurements: function () { 45512 return ReactDefaultPerf._allMeasurements; 45513 }, 45514 45515 printExclusive: function (measurements) { 45516 measurements = measurements || ReactDefaultPerf._allMeasurements; 45517 var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements); 45518 console.table(summary.map(function (item) { 45519 return { 45520 'Component class name': item.componentName, 45521 'Total inclusive time (ms)': roundFloat(item.inclusive), 45522 'Exclusive mount time (ms)': roundFloat(item.exclusive), 45523 'Exclusive render time (ms)': roundFloat(item.render), 45524 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count), 45525 'Render time per instance (ms)': roundFloat(item.render / item.count), 45526 'Instances': item.count 45527 }; 45528 })); 45529 // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct 45530 // number. 45531 }, 45532 45533 printInclusive: function (measurements) { 45534 measurements = measurements || ReactDefaultPerf._allMeasurements; 45535 var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements); 45536 console.table(summary.map(function (item) { 45537 return { 45538 'Owner > component': item.componentName, 45539 'Inclusive time (ms)': roundFloat(item.time), 45540 'Instances': item.count 45541 }; 45542 })); 45543 console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); 45544 }, 45545 45546 getMeasurementsSummaryMap: function (measurements) { 45547 var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true); 45548 return summary.map(function (item) { 45549 return { 45550 'Owner > component': item.componentName, 45551 'Wasted time (ms)': item.time, 45552 'Instances': item.count 45553 }; 45554 }); 45555 }, 45556 45557 printWasted: function (measurements) { 45558 measurements = measurements || ReactDefaultPerf._allMeasurements; 45559 console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); 45560 console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); 45561 }, 45562 45563 printDOM: function (measurements) { 45564 measurements = measurements || ReactDefaultPerf._allMeasurements; 45565 var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements); 45566 console.table(summary.map(function (item) { 45567 var result = {}; 45568 result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id; 45569 result.type = item.type; 45570 result.args = JSON.stringify(item.args); 45571 return result; 45572 })); 45573 console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); 45574 }, 45575 45576 _recordWrite: function (id, fnName, totalTime, args) { 45577 // TODO: totalTime isn't that useful since it doesn't count paints/reflows 45578 var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes; 45579 writes[id] = writes[id] || []; 45580 writes[id].push({ 45581 type: fnName, 45582 time: totalTime, 45583 args: args 45584 }); 45585 }, 45586 45587 measure: function (moduleName, fnName, func) { 45588 return function () { 45589 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 45590 args[_key] = arguments[_key]; 45591 } 45592 45593 var totalTime; 45594 var rv; 45595 var start; 45596 45597 if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') { 45598 // A "measurement" is a set of metrics recorded for each flush. We want 45599 // to group the metrics for a given flush together so we can look at the 45600 // components that rendered and the DOM operations that actually 45601 // happened to determine the amount of "wasted work" performed. 45602 ReactDefaultPerf._allMeasurements.push({ 45603 exclusive: {}, 45604 inclusive: {}, 45605 render: {}, 45606 counts: {}, 45607 writes: {}, 45608 displayNames: {}, 45609 totalTime: 0, 45610 created: {} 45611 }); 45612 start = performanceNow(); 45613 rv = func.apply(this, args); 45614 ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start; 45615 return rv; 45616 } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') { 45617 start = performanceNow(); 45618 rv = func.apply(this, args); 45619 totalTime = performanceNow() - start; 45620 45621 if (fnName === '_mountImageIntoNode') { 45622 var mountID = ReactMount.getID(args[1]); 45623 ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]); 45624 } else if (fnName === 'dangerouslyProcessChildrenUpdates') { 45625 // special format 45626 args[0].forEach(function (update) { 45627 var writeArgs = {}; 45628 if (update.fromIndex !== null) { 45629 writeArgs.fromIndex = update.fromIndex; 45630 } 45631 if (update.toIndex !== null) { 45632 writeArgs.toIndex = update.toIndex; 45633 } 45634 if (update.textContent !== null) { 45635 writeArgs.textContent = update.textContent; 45636 } 45637 if (update.markupIndex !== null) { 45638 writeArgs.markup = args[1][update.markupIndex]; 45639 } 45640 ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs); 45641 }); 45642 } else { 45643 // basic format 45644 var id = args[0]; 45645 if (typeof id === 'object') { 45646 id = ReactMount.getID(args[0]); 45647 } 45648 ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1)); 45649 } 45650 return rv; 45651 } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()? 45652 fnName === '_renderValidatedComponent')) { 45653 45654 if (this._currentElement.type === ReactMount.TopLevelWrapper) { 45655 return func.apply(this, args); 45656 } 45657 45658 var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID; 45659 var isRender = fnName === '_renderValidatedComponent'; 45660 var isMount = fnName === 'mountComponent'; 45661 45662 var mountStack = ReactDefaultPerf._mountStack; 45663 var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]; 45664 45665 if (isRender) { 45666 addValue(entry.counts, rootNodeID, 1); 45667 } else if (isMount) { 45668 entry.created[rootNodeID] = true; 45669 mountStack.push(0); 45670 } 45671 45672 start = performanceNow(); 45673 rv = func.apply(this, args); 45674 totalTime = performanceNow() - start; 45675 45676 if (isRender) { 45677 addValue(entry.render, rootNodeID, totalTime); 45678 } else if (isMount) { 45679 var subMountTime = mountStack.pop(); 45680 mountStack[mountStack.length - 1] += totalTime; 45681 addValue(entry.exclusive, rootNodeID, totalTime - subMountTime); 45682 addValue(entry.inclusive, rootNodeID, totalTime); 45683 } else { 45684 addValue(entry.inclusive, rootNodeID, totalTime); 45685 } 45686 45687 entry.displayNames[rootNodeID] = { 45688 current: this.getName(), 45689 owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>' 45690 }; 45691 45692 return rv; 45693 } else { 45694 return func.apply(this, args); 45695 } 45696 }; 45697 } 45698}; 45699 45700module.exports = ReactDefaultPerf; 45701 45702/***/ }), 45703
vendor: 6,207 bytes, lines 45704-45915
45704/***/ "./node_modules/react/lib/ReactDefaultPerfAnalysis.js": 45705/*!************************************************************!*\ 45706 !*** ./node_modules/react/lib/ReactDefaultPerfAnalysis.js ***! 45707 \************************************************************/ 45708/*! no static exports found */ 45709/***/ (function(module, exports, __webpack_require__) { 45710 45711"use strict"; 45712/** 45713 * Copyright 2013-2015, Facebook, Inc. 45714 * All rights reserved. 45715 * 45716 * This source code is licensed under the BSD-style license found in the 45717 * LICENSE file in the root directory of this source tree. An additional grant 45718 * of patent rights can be found in the PATENTS file in the same directory. 45719 * 45720 * @providesModule ReactDefaultPerfAnalysis 45721 */ 45722 45723 45724 45725var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 45726 45727// Don't try to save users less than 1.2ms (a number I made up) 45728var DONT_CARE_THRESHOLD = 1.2; 45729var DOM_OPERATION_TYPES = { 45730 '_mountImageIntoNode': 'set innerHTML', 45731 INSERT_MARKUP: 'set innerHTML', 45732 MOVE_EXISTING: 'move', 45733 REMOVE_NODE: 'remove', 45734 SET_MARKUP: 'set innerHTML', 45735 TEXT_CONTENT: 'set textContent', 45736 'setValueForProperty': 'update attribute', 45737 'setValueForAttribute': 'update attribute', 45738 'deleteValueForProperty': 'remove attribute', 45739 'setValueForStyles': 'update styles', 45740 'replaceNodeWithMarkup': 'replace', 45741 'updateTextContent': 'set textContent' 45742}; 45743 45744function getTotalTime(measurements) { 45745 // TODO: return number of DOM ops? could be misleading. 45746 // TODO: measure dropped frames after reconcile? 45747 // TODO: log total time of each reconcile and the top-level component 45748 // class that triggered it. 45749 var totalTime = 0; 45750 for (var i = 0; i < measurements.length; i++) { 45751 var measurement = measurements[i]; 45752 totalTime += measurement.totalTime; 45753 } 45754 return totalTime; 45755} 45756 45757function getDOMSummary(measurements) { 45758 var items = []; 45759 measurements.forEach(function (measurement) { 45760 Object.keys(measurement.writes).forEach(function (id) { 45761 measurement.writes[id].forEach(function (write) { 45762 items.push({ 45763 id: id, 45764 type: DOM_OPERATION_TYPES[write.type] || write.type, 45765 args: write.args 45766 }); 45767 }); 45768 }); 45769 }); 45770 return items; 45771} 45772 45773function getExclusiveSummary(measurements) { 45774 var candidates = {}; 45775 var displayName; 45776 45777 for (var i = 0; i < measurements.length; i++) { 45778 var measurement = measurements[i]; 45779 var allIDs = assign({}, measurement.exclusive, measurement.inclusive); 45780 45781 for (var id in allIDs) { 45782 displayName = measurement.displayNames[id].current; 45783 45784 candidates[displayName] = candidates[displayName] || { 45785 componentName: displayName, 45786 inclusive: 0, 45787 exclusive: 0, 45788 render: 0, 45789 count: 0 45790 }; 45791 if (measurement.render[id]) { 45792 candidates[displayName].render += measurement.render[id]; 45793 } 45794 if (measurement.exclusive[id]) { 45795 candidates[displayName].exclusive += measurement.exclusive[id]; 45796 } 45797 if (measurement.inclusive[id]) { 45798 candidates[displayName].inclusive += measurement.inclusive[id]; 45799 } 45800 if (measurement.counts[id]) { 45801 candidates[displayName].count += measurement.counts[id]; 45802 } 45803 } 45804 } 45805 45806 // Now make a sorted array with the results. 45807 var arr = []; 45808 for (displayName in candidates) { 45809 if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) { 45810 arr.push(candidates[displayName]); 45811 } 45812 } 45813 45814 arr.sort(function (a, b) { 45815 return b.exclusive - a.exclusive; 45816 }); 45817 45818 return arr; 45819} 45820 45821function getInclusiveSummary(measurements, onlyClean) { 45822 var candidates = {}; 45823 var inclusiveKey; 45824 45825 for (var i = 0; i < measurements.length; i++) { 45826 var measurement = measurements[i]; 45827 var allIDs = assign({}, measurement.exclusive, measurement.inclusive); 45828 var cleanComponents; 45829 45830 if (onlyClean) { 45831 cleanComponents = getUnchangedComponents(measurement); 45832 } 45833 45834 for (var id in allIDs) { 45835 if (onlyClean && !cleanComponents[id]) { 45836 continue; 45837 } 45838 45839 var displayName = measurement.displayNames[id]; 45840 45841 // Inclusive time is not useful for many components without knowing where 45842 // they are instantiated. So we aggregate inclusive time with both the 45843 // owner and current displayName as the key. 45844 inclusiveKey = displayName.owner + ' > ' + displayName.current; 45845 45846 candidates[inclusiveKey] = candidates[inclusiveKey] || { 45847 componentName: inclusiveKey, 45848 time: 0, 45849 count: 0 45850 }; 45851 45852 if (measurement.inclusive[id]) { 45853 candidates[inclusiveKey].time += measurement.inclusive[id]; 45854 } 45855 if (measurement.counts[id]) { 45856 candidates[inclusiveKey].count += measurement.counts[id]; 45857 } 45858 } 45859 } 45860 45861 // Now make a sorted array with the results. 45862 var arr = []; 45863 for (inclusiveKey in candidates) { 45864 if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) { 45865 arr.push(candidates[inclusiveKey]); 45866 } 45867 } 45868 45869 arr.sort(function (a, b) { 45870 return b.time - a.time; 45871 }); 45872 45873 return arr; 45874} 45875 45876function getUnchangedComponents(measurement) { 45877 // For a given reconcile, look at which components did not actually 45878 // render anything to the DOM and return a mapping of their ID to 45879 // the amount of time it took to render the entire subtree. 45880 var cleanComponents = {}; 45881 var dirtyLeafIDs = Object.keys(measurement.writes); 45882 var allIDs = assign({}, measurement.exclusive, measurement.inclusive); 45883 45884 for (var id in allIDs) { 45885 var isDirty = false; 45886 // For each component that rendered, see if a component that triggered 45887 // a DOM op is in its subtree. 45888 for (var i = 0; i < dirtyLeafIDs.length; i++) { 45889 if (dirtyLeafIDs[i].indexOf(id) === 0) { 45890 isDirty = true; 45891 break; 45892 } 45893 } 45894 // check if component newly created 45895 if (measurement.created[id]) { 45896 isDirty = true; 45897 } 45898 if (!isDirty && measurement.counts[id] > 0) { 45899 cleanComponents[id] = true; 45900 } 45901 } 45902 return cleanComponents; 45903} 45904 45905var ReactDefaultPerfAnalysis = { 45906 getExclusiveSummary: getExclusiveSummary, 45907 getInclusiveSummary: getInclusiveSummary, 45908 getDOMSummary: getDOMSummary, 45909 getTotalTime: getTotalTime 45910}; 45911 45912module.exports = ReactDefaultPerfAnalysis; 45913 45914/***/ }), 45915
vendor: 8,513 bytes, lines 45916-46173
45916/***/ "./node_modules/react/lib/ReactElement.js": 45917/*!************************************************!*\ 45918 !*** ./node_modules/react/lib/ReactElement.js ***! 45919 \************************************************/ 45920/*! no static exports found */ 45921/***/ (function(module, exports, __webpack_require__) { 45922 45923"use strict"; 45924/** 45925 * Copyright 2014-2015, Facebook, Inc. 45926 * All rights reserved. 45927 * 45928 * This source code is licensed under the BSD-style license found in the 45929 * LICENSE file in the root directory of this source tree. An additional grant 45930 * of patent rights can be found in the PATENTS file in the same directory. 45931 * 45932 * @providesModule ReactElement 45933 */ 45934 45935 45936 45937var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 45938 45939var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 45940var canDefineProperty = __webpack_require__(/*! ./canDefineProperty */ "./node_modules/react/lib/canDefineProperty.js"); 45941 45942// The Symbol used to tag the ReactElement type. If there is no native Symbol 45943// nor polyfill, then a plain number is used for performance. 45944var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; 45945 45946var RESERVED_PROPS = { 45947 key: true, 45948 ref: true, 45949 __self: true, 45950 __source: true 45951}; 45952 45953/** 45954 * Base constructor for all React elements. This is only used to make this 45955 * work with a dynamic instanceof check. Nothing should live on this prototype. 45956 * 45957 * @param {*} type 45958 * @param {*} key 45959 * @param {string|object} ref 45960 * @param {*} self A *temporary* helper to detect places where `this` is 45961 * different from the `owner` when React.createElement is called, so that we 45962 * can warn. We want to get rid of owner and replace string `ref`s with arrow 45963 * functions, and as long as `this` and owner are the same, there will be no 45964 * change in behavior. 45965 * @param {*} source An annotation object (added by a transpiler or otherwise) 45966 * indicating filename, line number, and/or other information. 45967 * @param {*} owner 45968 * @param {*} props 45969 * @internal 45970 */ 45971var ReactElement = function (type, key, ref, self, source, owner, props) { 45972 var element = { 45973 // This tag allow us to uniquely identify this as a React Element 45974 $$typeof: REACT_ELEMENT_TYPE, 45975 45976 // Built-in properties that belong on the element 45977 type: type, 45978 key: key, 45979 ref: ref, 45980 props: props, 45981 45982 // Record the component responsible for creating this element. 45983 _owner: owner 45984 }; 45985 45986 if (true) { 45987 // The validation flag is currently mutative. We put it on 45988 // an external backing store so that we can freeze the whole object. 45989 // This can be replaced with a WeakMap once they are implemented in 45990 // commonly used development environments. 45991 element._store = {}; 45992 45993 // To make comparing ReactElements easier for testing purposes, we make 45994 // the validation flag non-enumerable (where possible, which should 45995 // include every environment we run tests in), so the test framework 45996 // ignores it. 45997 if (canDefineProperty) { 45998 Object.defineProperty(element._store, 'validated', { 45999 configurable: false, 46000 enumerable: false, 46001 writable: true, 46002 value: false 46003 }); 46004 // self and source are DEV only properties. 46005 Object.defineProperty(element, '_self', { 46006 configurable: false, 46007 enumerable: false, 46008 writable: false, 46009 value: self 46010 }); 46011 // Two elements created in two different places should be considered 46012 // equal for testing purposes and therefore we hide it from enumeration. 46013 Object.defineProperty(element, '_source', { 46014 configurable: false, 46015 enumerable: false, 46016 writable: false, 46017 value: source 46018 }); 46019 } else { 46020 element._store.validated = false; 46021 element._self = self; 46022 element._source = source; 46023 } 46024 Object.freeze(element.props); 46025 Object.freeze(element); 46026 } 46027 46028 return element; 46029}; 46030 46031ReactElement.createElement = function (type, config, children) { 46032 var propName; 46033 46034 // Reserved names are extracted 46035 var props = {}; 46036 46037 var key = null; 46038 var ref = null; 46039 var self = null; 46040 var source = null; 46041 46042 if (config != null) { 46043 ref = config.ref === undefined ? null : config.ref; 46044 key = config.key === undefined ? null : '' + config.key; 46045 self = config.__self === undefined ? null : config.__self; 46046 source = config.__source === undefined ? null : config.__source; 46047 // Remaining properties are added to a new props object 46048 for (propName in config) { 46049 if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 46050 props[propName] = config[propName]; 46051 } 46052 } 46053 } 46054 46055 // Children can be more than one argument, and those are transferred onto 46056 // the newly allocated props object. 46057 var childrenLength = arguments.length - 2; 46058 if (childrenLength === 1) { 46059 props.children = children; 46060 } else if (childrenLength > 1) { 46061 var childArray = Array(childrenLength); 46062 for (var i = 0; i < childrenLength; i++) { 46063 childArray[i] = arguments[i + 2]; 46064 } 46065 props.children = childArray; 46066 } 46067 46068 // Resolve default props 46069 if (type && type.defaultProps) { 46070 var defaultProps = type.defaultProps; 46071 for (propName in defaultProps) { 46072 if (typeof props[propName] === 'undefined') { 46073 props[propName] = defaultProps[propName]; 46074 } 46075 } 46076 } 46077 46078 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); 46079}; 46080 46081ReactElement.createFactory = function (type) { 46082 var factory = ReactElement.createElement.bind(null, type); 46083 // Expose the type on the factory and the prototype so that it can be 46084 // easily accessed on elements. E.g. `<Foo />.type === Foo`. 46085 // This should not be named `constructor` since this may not be the function 46086 // that created the element, and it may not even be a constructor. 46087 // Legacy hook TODO: Warn if this is accessed 46088 factory.type = type; 46089 return factory; 46090}; 46091 46092ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { 46093 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); 46094 46095 return newElement; 46096}; 46097 46098ReactElement.cloneAndReplaceProps = function (oldElement, newProps) { 46099 var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps); 46100 46101 if (true) { 46102 // If the key on the original is valid, then the clone is valid 46103 newElement._store.validated = oldElement._store.validated; 46104 } 46105 46106 return newElement; 46107}; 46108 46109ReactElement.cloneElement = function (element, config, children) { 46110 var propName; 46111 46112 // Original props are copied 46113 var props = assign({}, element.props); 46114 46115 // Reserved names are extracted 46116 var key = element.key; 46117 var ref = element.ref; 46118 // Self is preserved since the owner is preserved. 46119 var self = element._self; 46120 // Source is preserved since cloneElement is unlikely to be targeted by a 46121 // transpiler, and the original source is probably a better indicator of the 46122 // true owner. 46123 var source = element._source; 46124 46125 // Owner will be preserved, unless ref is overridden 46126 var owner = element._owner; 46127 46128 if (config != null) { 46129 if (config.ref !== undefined) { 46130 // Silently steal the ref from the parent. 46131 ref = config.ref; 46132 owner = ReactCurrentOwner.current; 46133 } 46134 if (config.key !== undefined) { 46135 key = '' + config.key; 46136 } 46137 // Remaining properties override existing props 46138 for (propName in config) { 46139 if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 46140 props[propName] = config[propName]; 46141 } 46142 } 46143 } 46144 46145 // Children can be more than one argument, and those are transferred onto 46146 // the newly allocated props object. 46147 var childrenLength = arguments.length - 2; 46148 if (childrenLength === 1) { 46149 props.children = children; 46150 } else if (childrenLength > 1) { 46151 var childArray = Array(childrenLength); 46152 for (var i = 0; i < childrenLength; i++) { 46153 childArray[i] = arguments[i + 2]; 46154 } 46155 props.children = childArray; 46156 } 46157 46158 return ReactElement(element.type, key, ref, self, source, owner, props); 46159}; 46160 46161/** 46162 * @param {?object} object 46163 * @return {boolean} True if `object` is a valid component. 46164 * @final 46165 */ 46166ReactElement.isValidElement = function (object) { 46167 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 46168}; 46169 46170module.exports = ReactElement; 46171 46172/***/ }), 46173
vendor: 11,412 bytes, lines 46174-46465
46174/***/ "./node_modules/react/lib/ReactElementValidator.js": 46175/*!*********************************************************!*\ 46176 !*** ./node_modules/react/lib/ReactElementValidator.js ***! 46177 \*********************************************************/ 46178/*! no static exports found */ 46179/***/ (function(module, exports, __webpack_require__) { 46180 46181"use strict"; 46182/** 46183 * Copyright 2014-2015, Facebook, Inc. 46184 * All rights reserved. 46185 * 46186 * This source code is licensed under the BSD-style license found in the 46187 * LICENSE file in the root directory of this source tree. An additional grant 46188 * of patent rights can be found in the PATENTS file in the same directory. 46189 * 46190 * @providesModule ReactElementValidator 46191 */ 46192 46193/** 46194 * ReactElementValidator provides a wrapper around a element factory 46195 * which validates the props passed to the element. This is intended to be 46196 * used only in DEV and could be replaced by a static type checker for languages 46197 * that support it. 46198 */ 46199 46200 46201 46202var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 46203var ReactPropTypeLocations = __webpack_require__(/*! ./ReactPropTypeLocations */ "./node_modules/react/lib/ReactPropTypeLocations.js"); 46204var ReactPropTypeLocationNames = __webpack_require__(/*! ./ReactPropTypeLocationNames */ "./node_modules/react/lib/ReactPropTypeLocationNames.js"); 46205var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 46206 46207var canDefineProperty = __webpack_require__(/*! ./canDefineProperty */ "./node_modules/react/lib/canDefineProperty.js"); 46208var getIteratorFn = __webpack_require__(/*! ./getIteratorFn */ "./node_modules/react/lib/getIteratorFn.js"); 46209var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 46210var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 46211 46212function getDeclarationErrorAddendum() { 46213 if (ReactCurrentOwner.current) { 46214 var name = ReactCurrentOwner.current.getName(); 46215 if (name) { 46216 return ' Check the render method of `' + name + '`.'; 46217 } 46218 } 46219 return ''; 46220} 46221 46222/** 46223 * Warn if there's no key explicitly set on dynamic arrays of children or 46224 * object keys are not valid. This allows us to keep track of children between 46225 * updates. 46226 */ 46227var ownerHasKeyUseWarning = {}; 46228 46229var loggedTypeFailures = {}; 46230 46231/** 46232 * Warn if the element doesn't have an explicit key assigned to it. 46233 * This element is in an array. The array could grow and shrink or be 46234 * reordered. All children that haven't already been validated are required to 46235 * have a "key" property assigned to it. 46236 * 46237 * @internal 46238 * @param {ReactElement} element Element that requires a key. 46239 * @param {*} parentType element's parent's type. 46240 */ 46241function validateExplicitKey(element, parentType) { 46242 if (!element._store || element._store.validated || element.key != null) { 46243 return; 46244 } 46245 element._store.validated = true; 46246 46247 var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); 46248 if (addenda === null) { 46249 // we already showed the warning 46250 return; 46251 } 46252 true ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined; 46253} 46254 46255/** 46256 * Shared warning and monitoring code for the key warnings. 46257 * 46258 * @internal 46259 * @param {string} messageType A key used for de-duping warnings. 46260 * @param {ReactElement} element Component that requires a key. 46261 * @param {*} parentType element's parent's type. 46262 * @returns {?object} A set of addenda to use in the warning message, or null 46263 * if the warning has already been shown before (and shouldn't be shown again). 46264 */ 46265function getAddendaForKeyUse(messageType, element, parentType) { 46266 var addendum = getDeclarationErrorAddendum(); 46267 if (!addendum) { 46268 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; 46269 if (parentName) { 46270 addendum = ' Check the top-level render call using <' + parentName + '>.'; 46271 } 46272 } 46273 46274 var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {}); 46275 if (memoizer[addendum]) { 46276 return null; 46277 } 46278 memoizer[addendum] = true; 46279 46280 var addenda = { 46281 parentOrOwner: addendum, 46282 url: ' See https://fb.me/react-warning-keys for more information.', 46283 childOwner: null 46284 }; 46285 46286 // Usually the current owner is the offender, but if it accepts children as a 46287 // property, it may be the creator of the child that's responsible for 46288 // assigning it a key. 46289 if (element && element._owner && element._owner !== ReactCurrentOwner.current) { 46290 // Give the component that originally created this child. 46291 addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; 46292 } 46293 46294 return addenda; 46295} 46296 46297/** 46298 * Ensure that every element either is passed in a static location, in an 46299 * array with an explicit keys property defined, or in an object literal 46300 * with valid key property. 46301 * 46302 * @internal 46303 * @param {ReactNode} node Statically passed child of any type. 46304 * @param {*} parentType node's parent's type. 46305 */ 46306function validateChildKeys(node, parentType) { 46307 if (typeof node !== 'object') { 46308 return; 46309 } 46310 if (Array.isArray(node)) { 46311 for (var i = 0; i < node.length; i++) { 46312 var child = node[i]; 46313 if (ReactElement.isValidElement(child)) { 46314 validateExplicitKey(child, parentType); 46315 } 46316 } 46317 } else if (ReactElement.isValidElement(node)) { 46318 // This element was passed in a valid location. 46319 if (node._store) { 46320 node._store.validated = true; 46321 } 46322 } else if (node) { 46323 var iteratorFn = getIteratorFn(node); 46324 // Entry iterators provide implicit keys. 46325 if (iteratorFn) { 46326 if (iteratorFn !== node.entries) { 46327 var iterator = iteratorFn.call(node); 46328 var step; 46329 while (!(step = iterator.next()).done) { 46330 if (ReactElement.isValidElement(step.value)) { 46331 validateExplicitKey(step.value, parentType); 46332 } 46333 } 46334 } 46335 } 46336 } 46337} 46338 46339/** 46340 * Assert that the props are valid 46341 * 46342 * @param {string} componentName Name of the component for error messages. 46343 * @param {object} propTypes Map of prop name to a ReactPropType 46344 * @param {object} props 46345 * @param {string} location e.g. "prop", "context", "child context" 46346 * @private 46347 */ 46348function checkPropTypes(componentName, propTypes, props, location) { 46349 for (var propName in propTypes) { 46350 if (propTypes.hasOwnProperty(propName)) { 46351 var error; 46352 // Prop type validation may throw. In case they do, we don't want to 46353 // fail the render phase where it didn't fail before. So we log it. 46354 // After these have been cleaned up, we'll let them throw. 46355 try { 46356 // This is intentionally an invariant that gets caught. It's the same 46357 // behavior as without this statement except with a better message. 46358 !(typeof propTypes[propName] === 'function') ? true ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : undefined : undefined; 46359 error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 46360 } catch (ex) { 46361 error = ex; 46362 } 46363 true ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined; 46364 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 46365 // Only monitor this failure once because there tends to be a lot of the 46366 // same error. 46367 loggedTypeFailures[error.message] = true; 46368 46369 var addendum = getDeclarationErrorAddendum(); 46370 true ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; 46371 } 46372 } 46373 } 46374} 46375 46376/** 46377 * Given an element, validate that its props follow the propTypes definition, 46378 * provided by the type. 46379 * 46380 * @param {ReactElement} element 46381 */ 46382function validatePropTypes(element) { 46383 var componentClass = element.type; 46384 if (typeof componentClass !== 'function') { 46385 return; 46386 } 46387 var name = componentClass.displayName || componentClass.name; 46388 if (componentClass.propTypes) { 46389 checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); 46390 } 46391 if (typeof componentClass.getDefaultProps === 'function') { 46392 true ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined; 46393 } 46394} 46395 46396var ReactElementValidator = { 46397 46398 createElement: function (type, props, children) { 46399 var validType = typeof type === 'string' || typeof type === 'function'; 46400 // We warn in this case but don't throw. We expect the element creation to 46401 // succeed and there will likely be errors in render. 46402 true ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined; 46403 46404 var element = ReactElement.createElement.apply(this, arguments); 46405 46406 // The result can be nullish if a mock or a custom function is used. 46407 // TODO: Drop this when these are no longer allowed as the type argument. 46408 if (element == null) { 46409 return element; 46410 } 46411 46412 // Skip key warning if the type isn't valid since our key validation logic 46413 // doesn't expect a non-string/function type and can throw confusing errors. 46414 // We don't want exception behavior to differ between dev and prod. 46415 // (Rendering will throw with a helpful message and as soon as the type is 46416 // fixed, the key warnings will appear.) 46417 if (validType) { 46418 for (var i = 2; i < arguments.length; i++) { 46419 validateChildKeys(arguments[i], type); 46420 } 46421 } 46422 46423 validatePropTypes(element); 46424 46425 return element; 46426 }, 46427 46428 createFactory: function (type) { 46429 var validatedFactory = ReactElementValidator.createElement.bind(null, type); 46430 // Legacy hook TODO: Warn if this is accessed 46431 validatedFactory.type = type; 46432 46433 if (true) { 46434 if (canDefineProperty) { 46435 Object.defineProperty(validatedFactory, 'type', { 46436 enumerable: false, 46437 get: function () { 46438 true ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined; 46439 Object.defineProperty(this, 'type', { 46440 value: type 46441 }); 46442 return type; 46443 } 46444 }); 46445 } 46446 } 46447 46448 return validatedFactory; 46449 }, 46450 46451 cloneElement: function (element, props, children) { 46452 var newElement = ReactElement.cloneElement.apply(this, arguments); 46453 for (var i = 2; i < arguments.length; i++) { 46454 validateChildKeys(arguments[i], newElement.type); 46455 } 46456 validatePropTypes(newElement); 46457 return newElement; 46458 } 46459 46460}; 46461 46462module.exports = ReactElementValidator; 46463 46464/***/ }), 46465
vendor: 2,403 bytes, lines 46466-46531
46466/***/ "./node_modules/react/lib/ReactEmptyComponent.js": 46467/*!*******************************************************!*\ 46468 !*** ./node_modules/react/lib/ReactEmptyComponent.js ***! 46469 \*******************************************************/ 46470/*! no static exports found */ 46471/***/ (function(module, exports, __webpack_require__) { 46472 46473"use strict"; 46474/** 46475 * Copyright 2014-2015, Facebook, Inc. 46476 * All rights reserved. 46477 * 46478 * This source code is licensed under the BSD-style license found in the 46479 * LICENSE file in the root directory of this source tree. An additional grant 46480 * of patent rights can be found in the PATENTS file in the same directory. 46481 * 46482 * @providesModule ReactEmptyComponent 46483 */ 46484 46485 46486 46487var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 46488var ReactEmptyComponentRegistry = __webpack_require__(/*! ./ReactEmptyComponentRegistry */ "./node_modules/react/lib/ReactEmptyComponentRegistry.js"); 46489var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 46490 46491var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 46492 46493var placeholderElement; 46494 46495var ReactEmptyComponentInjection = { 46496 injectEmptyComponent: function (component) { 46497 placeholderElement = ReactElement.createElement(component); 46498 } 46499}; 46500 46501function registerNullComponentID() { 46502 ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID); 46503} 46504 46505var ReactEmptyComponent = function (instantiate) { 46506 this._currentElement = null; 46507 this._rootNodeID = null; 46508 this._renderedComponent = instantiate(placeholderElement); 46509}; 46510assign(ReactEmptyComponent.prototype, { 46511 construct: function (element) {}, 46512 mountComponent: function (rootID, transaction, context) { 46513 transaction.getReactMountReady().enqueue(registerNullComponentID, this); 46514 this._rootNodeID = rootID; 46515 return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context); 46516 }, 46517 receiveComponent: function () {}, 46518 unmountComponent: function (rootID, transaction, context) { 46519 ReactReconciler.unmountComponent(this._renderedComponent); 46520 ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID); 46521 this._rootNodeID = null; 46522 this._renderedComponent = null; 46523 } 46524}); 46525 46526ReactEmptyComponent.injection = ReactEmptyComponentInjection; 46527 46528module.exports = ReactEmptyComponent; 46529 46530/***/ }), 46531
vendor: 1,753 bytes, lines 46532-46590
46532/***/ "./node_modules/react/lib/ReactEmptyComponentRegistry.js": 46533/*!***************************************************************!*\ 46534 !*** ./node_modules/react/lib/ReactEmptyComponentRegistry.js ***! 46535 \***************************************************************/ 46536/*! no static exports found */ 46537/***/ (function(module, exports, __webpack_require__) { 46538 46539"use strict"; 46540/** 46541 * Copyright 2014-2015, Facebook, Inc. 46542 * All rights reserved. 46543 * 46544 * This source code is licensed under the BSD-style license found in the 46545 * LICENSE file in the root directory of this source tree. An additional grant 46546 * of patent rights can be found in the PATENTS file in the same directory. 46547 * 46548 * @providesModule ReactEmptyComponentRegistry 46549 */ 46550 46551 46552 46553// This registry keeps track of the React IDs of the components that rendered to 46554// `null` (in reality a placeholder such as `noscript`) 46555var nullComponentIDsRegistry = {}; 46556 46557/** 46558 * @param {string} id Component's `_rootNodeID`. 46559 * @return {boolean} True if the component is rendered to null. 46560 */ 46561function isNullComponentID(id) { 46562 return !!nullComponentIDsRegistry[id]; 46563} 46564 46565/** 46566 * Mark the component as having rendered to null. 46567 * @param {string} id Component's `_rootNodeID`. 46568 */ 46569function registerNullComponentID(id) { 46570 nullComponentIDsRegistry[id] = true; 46571} 46572 46573/** 46574 * Unmark the component as having rendered to null: it renders to something now. 46575 * @param {string} id Component's `_rootNodeID`. 46576 */ 46577function deregisterNullComponentID(id) { 46578 delete nullComponentIDsRegistry[id]; 46579} 46580 46581var ReactEmptyComponentRegistry = { 46582 isNullComponentID: isNullComponentID, 46583 registerNullComponentID: registerNullComponentID, 46584 deregisterNullComponentID: deregisterNullComponentID 46585}; 46586 46587module.exports = ReactEmptyComponentRegistry; 46588 46589/***/ }), 46590
vendor: 2,565 bytes, lines 46591-46678
46591/***/ "./node_modules/react/lib/ReactErrorUtils.js": 46592/*!***************************************************!*\ 46593 !*** ./node_modules/react/lib/ReactErrorUtils.js ***! 46594 \***************************************************/ 46595/*! no static exports found */ 46596/***/ (function(module, exports, __webpack_require__) { 46597 46598"use strict"; 46599/** 46600 * Copyright 2013-2015, Facebook, Inc. 46601 * All rights reserved. 46602 * 46603 * This source code is licensed under the BSD-style license found in the 46604 * LICENSE file in the root directory of this source tree. An additional grant 46605 * of patent rights can be found in the PATENTS file in the same directory. 46606 * 46607 * @providesModule ReactErrorUtils 46608 * @typechecks 46609 */ 46610 46611 46612 46613var caughtError = null; 46614 46615/** 46616 * Call a function while guarding against errors that happens within it. 46617 * 46618 * @param {?String} name of the guard to use for logging or debugging 46619 * @param {Function} func The function to invoke 46620 * @param {*} a First argument 46621 * @param {*} b Second argument 46622 */ 46623function invokeGuardedCallback(name, func, a, b) { 46624 try { 46625 return func(a, b); 46626 } catch (x) { 46627 if (caughtError === null) { 46628 caughtError = x; 46629 } 46630 return undefined; 46631 } 46632} 46633 46634var ReactErrorUtils = { 46635 invokeGuardedCallback: invokeGuardedCallback, 46636 46637 /** 46638 * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event 46639 * handler are sure to be rethrown by rethrowCaughtError. 46640 */ 46641 invokeGuardedCallbackWithCatch: invokeGuardedCallback, 46642 46643 /** 46644 * During execution of guarded functions we will capture the first error which 46645 * we will rethrow to be handled by the top level error handler. 46646 */ 46647 rethrowCaughtError: function () { 46648 if (caughtError) { 46649 var error = caughtError; 46650 caughtError = null; 46651 throw error; 46652 } 46653 } 46654}; 46655 46656if (true) { 46657 /** 46658 * To help development we can get better devtools integration by simulating a 46659 * real browser event. 46660 */ 46661 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { 46662 var fakeNode = document.createElement('react'); 46663 ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) { 46664 var boundFunc = func.bind(null, a, b); 46665 var evtType = 'react-' + name; 46666 fakeNode.addEventListener(evtType, boundFunc, false); 46667 var evt = document.createEvent('Event'); 46668 evt.initEvent(evtType, false, false); 46669 fakeNode.dispatchEvent(evt); 46670 fakeNode.removeEventListener(evtType, boundFunc, false); 46671 }; 46672 } 46673} 46674 46675module.exports = ReactErrorUtils; 46676 46677/***/ }), 46678
vendor: 1,718 bytes, lines 46679-46727
46679/***/ "./node_modules/react/lib/ReactEventEmitterMixin.js": 46680/*!**********************************************************!*\ 46681 !*** ./node_modules/react/lib/ReactEventEmitterMixin.js ***! 46682 \**********************************************************/ 46683/*! no static exports found */ 46684/***/ (function(module, exports, __webpack_require__) { 46685 46686"use strict"; 46687/** 46688 * Copyright 2013-2015, Facebook, Inc. 46689 * All rights reserved. 46690 * 46691 * This source code is licensed under the BSD-style license found in the 46692 * LICENSE file in the root directory of this source tree. An additional grant 46693 * of patent rights can be found in the PATENTS file in the same directory. 46694 * 46695 * @providesModule ReactEventEmitterMixin 46696 */ 46697 46698 46699 46700var EventPluginHub = __webpack_require__(/*! ./EventPluginHub */ "./node_modules/react/lib/EventPluginHub.js"); 46701 46702function runEventQueueInBatch(events) { 46703 EventPluginHub.enqueueEvents(events); 46704 EventPluginHub.processEventQueue(false); 46705} 46706 46707var ReactEventEmitterMixin = { 46708 46709 /** 46710 * Streams a fired top-level event to `EventPluginHub` where plugins have the 46711 * opportunity to create `ReactEvent`s to be dispatched. 46712 * 46713 * @param {string} topLevelType Record from `EventConstants`. 46714 * @param {object} topLevelTarget The listening component root node. 46715 * @param {string} topLevelTargetID ID of `topLevelTarget`. 46716 * @param {object} nativeEvent Native environment event. 46717 */ 46718 handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 46719 var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); 46720 runEventQueueInBatch(events); 46721 } 46722}; 46723 46724module.exports = ReactEventEmitterMixin; 46725 46726/***/ }), 46727
vendor: 8,418 bytes, lines 46728-46949
46728/***/ "./node_modules/react/lib/ReactEventListener.js": 46729/*!******************************************************!*\ 46730 !*** ./node_modules/react/lib/ReactEventListener.js ***! 46731 \******************************************************/ 46732/*! no static exports found */ 46733/***/ (function(module, exports, __webpack_require__) { 46734 46735"use strict"; 46736/** 46737 * Copyright 2013-2015, Facebook, Inc. 46738 * All rights reserved. 46739 * 46740 * This source code is licensed under the BSD-style license found in the 46741 * LICENSE file in the root directory of this source tree. An additional grant 46742 * of patent rights can be found in the PATENTS file in the same directory. 46743 * 46744 * @providesModule ReactEventListener 46745 * @typechecks static-only 46746 */ 46747 46748 46749 46750var EventListener = __webpack_require__(/*! fbjs/lib/EventListener */ "./node_modules/fbjs/lib/EventListener.js"); 46751var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 46752var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 46753var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 46754var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 46755var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 46756 46757var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 46758var getEventTarget = __webpack_require__(/*! ./getEventTarget */ "./node_modules/react/lib/getEventTarget.js"); 46759var getUnboundedScrollPosition = __webpack_require__(/*! fbjs/lib/getUnboundedScrollPosition */ "./node_modules/fbjs/lib/getUnboundedScrollPosition.js"); 46760 46761var DOCUMENT_FRAGMENT_NODE_TYPE = 11; 46762 46763/** 46764 * Finds the parent React component of `node`. 46765 * 46766 * @param {*} node 46767 * @return {?DOMEventTarget} Parent container, or `null` if the specified node 46768 * is not nested. 46769 */ 46770function findParent(node) { 46771 // TODO: It may be a good idea to cache this to prevent unnecessary DOM 46772 // traversal, but caching is difficult to do correctly without using a 46773 // mutation observer to listen for all DOM changes. 46774 var nodeID = ReactMount.getID(node); 46775 var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); 46776 var container = ReactMount.findReactContainerForID(rootID); 46777 var parent = ReactMount.getFirstReactDOM(container); 46778 return parent; 46779} 46780 46781// Used to store ancestor hierarchy in top level callback 46782function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { 46783 this.topLevelType = topLevelType; 46784 this.nativeEvent = nativeEvent; 46785 this.ancestors = []; 46786} 46787assign(TopLevelCallbackBookKeeping.prototype, { 46788 destructor: function () { 46789 this.topLevelType = null; 46790 this.nativeEvent = null; 46791 this.ancestors.length = 0; 46792 } 46793}); 46794PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); 46795 46796function handleTopLevelImpl(bookKeeping) { 46797 // TODO: Re-enable event.path handling 46798 // 46799 // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) { 46800 // // New browsers have a path attribute on native events 46801 // handleTopLevelWithPath(bookKeeping); 46802 // } else { 46803 // // Legacy browsers don't have a path attribute on native events 46804 // handleTopLevelWithoutPath(bookKeeping); 46805 // } 46806 46807 void handleTopLevelWithPath; // temporarily unused 46808 handleTopLevelWithoutPath(bookKeeping); 46809} 46810 46811// Legacy browsers don't have a path attribute on native events 46812function handleTopLevelWithoutPath(bookKeeping) { 46813 var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window; 46814 46815 // Loop through the hierarchy, in case there's any nested components. 46816 // It's important that we build the array of ancestors before calling any 46817 // event handlers, because event handlers can modify the DOM, leading to 46818 // inconsistencies with ReactMount's node cache. See #1105. 46819 var ancestor = topLevelTarget; 46820 while (ancestor) { 46821 bookKeeping.ancestors.push(ancestor); 46822 ancestor = findParent(ancestor); 46823 } 46824 46825 for (var i = 0; i < bookKeeping.ancestors.length; i++) { 46826 topLevelTarget = bookKeeping.ancestors[i]; 46827 var topLevelTargetID = ReactMount.getID(topLevelTarget) || ''; 46828 ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); 46829 } 46830} 46831 46832// New browsers have a path attribute on native events 46833function handleTopLevelWithPath(bookKeeping) { 46834 var path = bookKeeping.nativeEvent.path; 46835 var currentNativeTarget = path[0]; 46836 var eventsFired = 0; 46837 for (var i = 0; i < path.length; i++) { 46838 var currentPathElement = path[i]; 46839 if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) { 46840 currentNativeTarget = path[i + 1]; 46841 } 46842 // TODO: slow 46843 var reactParent = ReactMount.getFirstReactDOM(currentPathElement); 46844 if (reactParent === currentPathElement) { 46845 var currentPathElementID = ReactMount.getID(currentPathElement); 46846 var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID); 46847 bookKeeping.ancestors.push(currentPathElement); 46848 46849 var topLevelTargetID = ReactMount.getID(currentPathElement) || ''; 46850 eventsFired++; 46851 ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget); 46852 46853 // Jump to the root of this React render tree 46854 while (currentPathElementID !== newRootID) { 46855 i++; 46856 currentPathElement = path[i]; 46857 currentPathElementID = ReactMount.getID(currentPathElement); 46858 } 46859 } 46860 } 46861 if (eventsFired === 0) { 46862 ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); 46863 } 46864} 46865 46866function scrollValueMonitor(cb) { 46867 var scrollPosition = getUnboundedScrollPosition(window); 46868 cb(scrollPosition); 46869} 46870 46871var ReactEventListener = { 46872 _enabled: true, 46873 _handleTopLevel: null, 46874 46875 WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, 46876 46877 setHandleTopLevel: function (handleTopLevel) { 46878 ReactEventListener._handleTopLevel = handleTopLevel; 46879 }, 46880 46881 setEnabled: function (enabled) { 46882 ReactEventListener._enabled = !!enabled; 46883 }, 46884 46885 isEnabled: function () { 46886 return ReactEventListener._enabled; 46887 }, 46888 46889 /** 46890 * Traps top-level events by using event bubbling. 46891 * 46892 * @param {string} topLevelType Record from `EventConstants`. 46893 * @param {string} handlerBaseName Event name (e.g. "click"). 46894 * @param {object} handle Element on which to attach listener. 46895 * @return {?object} An object with a remove function which will forcefully 46896 * remove the listener. 46897 * @internal 46898 */ 46899 trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { 46900 var element = handle; 46901 if (!element) { 46902 return null; 46903 } 46904 return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); 46905 }, 46906 46907 /** 46908 * Traps a top-level event by using event capturing. 46909 * 46910 * @param {string} topLevelType Record from `EventConstants`. 46911 * @param {string} handlerBaseName Event name (e.g. "click"). 46912 * @param {object} handle Element on which to attach listener. 46913 * @return {?object} An object with a remove function which will forcefully 46914 * remove the listener. 46915 * @internal 46916 */ 46917 trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { 46918 var element = handle; 46919 if (!element) { 46920 return null; 46921 } 46922 return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); 46923 }, 46924 46925 monitorScrollValue: function (refresh) { 46926 var callback = scrollValueMonitor.bind(null, refresh); 46927 EventListener.listen(window, 'scroll', callback); 46928 }, 46929 46930 dispatchEvent: function (topLevelType, nativeEvent) { 46931 if (!ReactEventListener._enabled) { 46932 return; 46933 } 46934 46935 var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); 46936 try { 46937 // Event queue being processed in the same cycle allows 46938 // `preventDefault`. 46939 ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); 46940 } finally { 46941 TopLevelCallbackBookKeeping.release(bookKeeping); 46942 } 46943 } 46944}; 46945 46946module.exports = ReactEventListener; 46947 46948/***/ }), 46949
vendor: 2,327 bytes, lines 46950-46998
46950/***/ "./node_modules/react/lib/ReactInjection.js": 46951/*!**************************************************!*\ 46952 !*** ./node_modules/react/lib/ReactInjection.js ***! 46953 \**************************************************/ 46954/*! no static exports found */ 46955/***/ (function(module, exports, __webpack_require__) { 46956 46957"use strict"; 46958/** 46959 * Copyright 2013-2015, Facebook, Inc. 46960 * All rights reserved. 46961 * 46962 * This source code is licensed under the BSD-style license found in the 46963 * LICENSE file in the root directory of this source tree. An additional grant 46964 * of patent rights can be found in the PATENTS file in the same directory. 46965 * 46966 * @providesModule ReactInjection 46967 */ 46968 46969 46970 46971var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 46972var EventPluginHub = __webpack_require__(/*! ./EventPluginHub */ "./node_modules/react/lib/EventPluginHub.js"); 46973var ReactComponentEnvironment = __webpack_require__(/*! ./ReactComponentEnvironment */ "./node_modules/react/lib/ReactComponentEnvironment.js"); 46974var ReactClass = __webpack_require__(/*! ./ReactClass */ "./node_modules/react/lib/ReactClass.js"); 46975var ReactEmptyComponent = __webpack_require__(/*! ./ReactEmptyComponent */ "./node_modules/react/lib/ReactEmptyComponent.js"); 46976var ReactBrowserEventEmitter = __webpack_require__(/*! ./ReactBrowserEventEmitter */ "./node_modules/react/lib/ReactBrowserEventEmitter.js"); 46977var ReactNativeComponent = __webpack_require__(/*! ./ReactNativeComponent */ "./node_modules/react/lib/ReactNativeComponent.js"); 46978var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 46979var ReactRootIndex = __webpack_require__(/*! ./ReactRootIndex */ "./node_modules/react/lib/ReactRootIndex.js"); 46980var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 46981 46982var ReactInjection = { 46983 Component: ReactComponentEnvironment.injection, 46984 Class: ReactClass.injection, 46985 DOMProperty: DOMProperty.injection, 46986 EmptyComponent: ReactEmptyComponent.injection, 46987 EventPluginHub: EventPluginHub.injection, 46988 EventEmitter: ReactBrowserEventEmitter.injection, 46989 NativeComponent: ReactNativeComponent.injection, 46990 Perf: ReactPerf.injection, 46991 RootIndex: ReactRootIndex.injection, 46992 Updates: ReactUpdates.injection 46993}; 46994 46995module.exports = ReactInjection; 46996 46997/***/ }), 46998
vendor: 4,904 bytes, lines 46999-47133
46999/***/ "./node_modules/react/lib/ReactInputSelection.js": 47000/*!*******************************************************!*\ 47001 !*** ./node_modules/react/lib/ReactInputSelection.js ***! 47002 \*******************************************************/ 47003/*! no static exports found */ 47004/***/ (function(module, exports, __webpack_require__) { 47005 47006"use strict"; 47007/** 47008 * Copyright 2013-2015, Facebook, Inc. 47009 * All rights reserved. 47010 * 47011 * This source code is licensed under the BSD-style license found in the 47012 * LICENSE file in the root directory of this source tree. An additional grant 47013 * of patent rights can be found in the PATENTS file in the same directory. 47014 * 47015 * @providesModule ReactInputSelection 47016 */ 47017 47018 47019 47020var ReactDOMSelection = __webpack_require__(/*! ./ReactDOMSelection */ "./node_modules/react/lib/ReactDOMSelection.js"); 47021 47022var containsNode = __webpack_require__(/*! fbjs/lib/containsNode */ "./node_modules/fbjs/lib/containsNode.js"); 47023var focusNode = __webpack_require__(/*! fbjs/lib/focusNode */ "./node_modules/fbjs/lib/focusNode.js"); 47024var getActiveElement = __webpack_require__(/*! fbjs/lib/getActiveElement */ "./node_modules/fbjs/lib/getActiveElement.js"); 47025 47026function isInDocument(node) { 47027 return containsNode(document.documentElement, node); 47028} 47029 47030/** 47031 * @ReactInputSelection: React input selection module. Based on Selection.js, 47032 * but modified to be suitable for react and has a couple of bug fixes (doesn't 47033 * assume buttons have range selections allowed). 47034 * Input selection module for React. 47035 */ 47036var ReactInputSelection = { 47037 47038 hasSelectionCapabilities: function (elem) { 47039 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 47040 return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); 47041 }, 47042 47043 getSelectionInformation: function () { 47044 var focusedElem = getActiveElement(); 47045 return { 47046 focusedElem: focusedElem, 47047 selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null 47048 }; 47049 }, 47050 47051 /** 47052 * @restoreSelection: If any selection information was potentially lost, 47053 * restore it. This is useful when performing operations that could remove dom 47054 * nodes and place them back in, resulting in focus being lost. 47055 */ 47056 restoreSelection: function (priorSelectionInformation) { 47057 var curFocusedElem = getActiveElement(); 47058 var priorFocusedElem = priorSelectionInformation.focusedElem; 47059 var priorSelectionRange = priorSelectionInformation.selectionRange; 47060 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { 47061 if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { 47062 ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); 47063 } 47064 focusNode(priorFocusedElem); 47065 } 47066 }, 47067 47068 /** 47069 * @getSelection: Gets the selection bounds of a focused textarea, input or 47070 * contentEditable node. 47071 * -@input: Look up selection bounds of this input 47072 * -@return {start: selectionStart, end: selectionEnd} 47073 */ 47074 getSelection: function (input) { 47075 var selection; 47076 47077 if ('selectionStart' in input) { 47078 // Modern browser with input or textarea. 47079 selection = { 47080 start: input.selectionStart, 47081 end: input.selectionEnd 47082 }; 47083 } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { 47084 // IE8 input. 47085 var range = document.selection.createRange(); 47086 // There can only be one selection per document in IE, so it must 47087 // be in our element. 47088 if (range.parentElement() === input) { 47089 selection = { 47090 start: -range.moveStart('character', -input.value.length), 47091 end: -range.moveEnd('character', -input.value.length) 47092 }; 47093 } 47094 } else { 47095 // Content editable or old IE textarea. 47096 selection = ReactDOMSelection.getOffsets(input); 47097 } 47098 47099 return selection || { start: 0, end: 0 }; 47100 }, 47101 47102 /** 47103 * @setSelection: Sets the selection bounds of a textarea or input and focuses 47104 * the input. 47105 * -@input Set selection bounds of this input or textarea 47106 * -@offsets Object of same form that is returned from get* 47107 */ 47108 setSelection: function (input, offsets) { 47109 var start = offsets.start; 47110 var end = offsets.end; 47111 if (typeof end === 'undefined') { 47112 end = start; 47113 } 47114 47115 if ('selectionStart' in input) { 47116 input.selectionStart = start; 47117 input.selectionEnd = Math.min(end, input.value.length); 47118 } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { 47119 var range = input.createTextRange(); 47120 range.collapse(true); 47121 range.moveStart('character', start); 47122 range.moveEnd('character', end - start); 47123 range.select(); 47124 } else { 47125 ReactDOMSelection.setOffsets(input, offsets); 47126 } 47127 } 47128}; 47129 47130module.exports = ReactInputSelection; 47131 47132/***/ }), 47133
vendor: 10,878 bytes, lines 47134-47446
47134/***/ "./node_modules/react/lib/ReactInstanceHandles.js": 47135/*!********************************************************!*\ 47136 !*** ./node_modules/react/lib/ReactInstanceHandles.js ***! 47137 \********************************************************/ 47138/*! no static exports found */ 47139/***/ (function(module, exports, __webpack_require__) { 47140 47141"use strict"; 47142/** 47143 * Copyright 2013-2015, Facebook, Inc. 47144 * All rights reserved. 47145 * 47146 * This source code is licensed under the BSD-style license found in the 47147 * LICENSE file in the root directory of this source tree. An additional grant 47148 * of patent rights can be found in the PATENTS file in the same directory. 47149 * 47150 * @providesModule ReactInstanceHandles 47151 * @typechecks static-only 47152 */ 47153 47154 47155 47156var ReactRootIndex = __webpack_require__(/*! ./ReactRootIndex */ "./node_modules/react/lib/ReactRootIndex.js"); 47157 47158var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 47159 47160var SEPARATOR = '.'; 47161var SEPARATOR_LENGTH = SEPARATOR.length; 47162 47163/** 47164 * Maximum depth of traversals before we consider the possibility of a bad ID. 47165 */ 47166var MAX_TREE_DEPTH = 10000; 47167 47168/** 47169 * Creates a DOM ID prefix to use when mounting React components. 47170 * 47171 * @param {number} index A unique integer 47172 * @return {string} React root ID. 47173 * @internal 47174 */ 47175function getReactRootIDString(index) { 47176 return SEPARATOR + index.toString(36); 47177} 47178 47179/** 47180 * Checks if a character in the supplied ID is a separator or the end. 47181 * 47182 * @param {string} id A React DOM ID. 47183 * @param {number} index Index of the character to check. 47184 * @return {boolean} True if the character is a separator or end of the ID. 47185 * @private 47186 */ 47187function isBoundary(id, index) { 47188 return id.charAt(index) === SEPARATOR || index === id.length; 47189} 47190 47191/** 47192 * Checks if the supplied string is a valid React DOM ID. 47193 * 47194 * @param {string} id A React DOM ID, maybe. 47195 * @return {boolean} True if the string is a valid React DOM ID. 47196 * @private 47197 */ 47198function isValidID(id) { 47199 return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR; 47200} 47201 47202/** 47203 * Checks if the first ID is an ancestor of or equal to the second ID. 47204 * 47205 * @param {string} ancestorID 47206 * @param {string} descendantID 47207 * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. 47208 * @internal 47209 */ 47210function isAncestorIDOf(ancestorID, descendantID) { 47211 return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length); 47212} 47213 47214/** 47215 * Gets the parent ID of the supplied React DOM ID, `id`. 47216 * 47217 * @param {string} id ID of a component. 47218 * @return {string} ID of the parent, or an empty string. 47219 * @private 47220 */ 47221function getParentID(id) { 47222 return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; 47223} 47224 47225/** 47226 * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the 47227 * supplied `destinationID`. If they are equal, the ID is returned. 47228 * 47229 * @param {string} ancestorID ID of an ancestor node of `destinationID`. 47230 * @param {string} destinationID ID of the destination node. 47231 * @return {string} Next ID on the path from `ancestorID` to `destinationID`. 47232 * @private 47233 */ 47234function getNextDescendantID(ancestorID, destinationID) { 47235 !(isValidID(ancestorID) && isValidID(destinationID)) ? true ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : undefined : undefined; 47236 !isAncestorIDOf(ancestorID, destinationID) ? true ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : undefined : undefined; 47237 if (ancestorID === destinationID) { 47238 return ancestorID; 47239 } 47240 // Skip over the ancestor and the immediate separator. Traverse until we hit 47241 // another separator or we reach the end of `destinationID`. 47242 var start = ancestorID.length + SEPARATOR_LENGTH; 47243 var i; 47244 for (i = start; i < destinationID.length; i++) { 47245 if (isBoundary(destinationID, i)) { 47246 break; 47247 } 47248 } 47249 return destinationID.substr(0, i); 47250} 47251 47252/** 47253 * Gets the nearest common ancestor ID of two IDs. 47254 * 47255 * Using this ID scheme, the nearest common ancestor ID is the longest common 47256 * prefix of the two IDs that immediately preceded a "marker" in both strings. 47257 * 47258 * @param {string} oneID 47259 * @param {string} twoID 47260 * @return {string} Nearest common ancestor ID, or the empty string if none. 47261 * @private 47262 */ 47263function getFirstCommonAncestorID(oneID, twoID) { 47264 var minLength = Math.min(oneID.length, twoID.length); 47265 if (minLength === 0) { 47266 return ''; 47267 } 47268 var lastCommonMarkerIndex = 0; 47269 // Use `<=` to traverse until the "EOL" of the shorter string. 47270 for (var i = 0; i <= minLength; i++) { 47271 if (isBoundary(oneID, i) && isBoundary(twoID, i)) { 47272 lastCommonMarkerIndex = i; 47273 } else if (oneID.charAt(i) !== twoID.charAt(i)) { 47274 break; 47275 } 47276 } 47277 var longestCommonID = oneID.substr(0, lastCommonMarkerIndex); 47278 !isValidID(longestCommonID) ? true ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : undefined : undefined; 47279 return longestCommonID; 47280} 47281 47282/** 47283 * Traverses the parent path between two IDs (either up or down). The IDs must 47284 * not be the same, and there must exist a parent path between them. If the 47285 * callback returns `false`, traversal is stopped. 47286 * 47287 * @param {?string} start ID at which to start traversal. 47288 * @param {?string} stop ID at which to end traversal. 47289 * @param {function} cb Callback to invoke each ID with. 47290 * @param {*} arg Argument to invoke the callback with. 47291 * @param {?boolean} skipFirst Whether or not to skip the first node. 47292 * @param {?boolean} skipLast Whether or not to skip the last node. 47293 * @private 47294 */ 47295function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { 47296 start = start || ''; 47297 stop = stop || ''; 47298 !(start !== stop) ? true ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : undefined : undefined; 47299 var traverseUp = isAncestorIDOf(stop, start); 47300 !(traverseUp || isAncestorIDOf(start, stop)) ? true ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : undefined : undefined; 47301 // Traverse from `start` to `stop` one depth at a time. 47302 var depth = 0; 47303 var traverse = traverseUp ? getParentID : getNextDescendantID; 47304 for (var id = start;; /* until break */id = traverse(id, stop)) { 47305 var ret; 47306 if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) { 47307 ret = cb(id, traverseUp, arg); 47308 } 47309 if (ret === false || id === stop) { 47310 // Only break //after// visiting `stop`. 47311 break; 47312 } 47313 !(depth++ < MAX_TREE_DEPTH) ? true ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : undefined : undefined; 47314 } 47315} 47316 47317/** 47318 * Manages the IDs assigned to DOM representations of React components. This 47319 * uses a specific scheme in order to traverse the DOM efficiently (e.g. in 47320 * order to simulate events). 47321 * 47322 * @internal 47323 */ 47324var ReactInstanceHandles = { 47325 47326 /** 47327 * Constructs a React root ID 47328 * @return {string} A React root ID. 47329 */ 47330 createReactRootID: function () { 47331 return getReactRootIDString(ReactRootIndex.createReactRootIndex()); 47332 }, 47333 47334 /** 47335 * Constructs a React ID by joining a root ID with a name. 47336 * 47337 * @param {string} rootID Root ID of a parent component. 47338 * @param {string} name A component's name (as flattened children). 47339 * @return {string} A React ID. 47340 * @internal 47341 */ 47342 createReactID: function (rootID, name) { 47343 return rootID + name; 47344 }, 47345 47346 /** 47347 * Gets the DOM ID of the React component that is the root of the tree that 47348 * contains the React component with the supplied DOM ID. 47349 * 47350 * @param {string} id DOM ID of a React component. 47351 * @return {?string} DOM ID of the React component that is the root. 47352 * @internal 47353 */ 47354 getReactRootIDFromNodeID: function (id) { 47355 if (id && id.charAt(0) === SEPARATOR && id.length > 1) { 47356 var index = id.indexOf(SEPARATOR, 1); 47357 return index > -1 ? id.substr(0, index) : id; 47358 } 47359 return null; 47360 }, 47361 47362 /** 47363 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that 47364 * should would receive a `mouseEnter` or `mouseLeave` event. 47365 * 47366 * NOTE: Does not invoke the callback on the nearest common ancestor because 47367 * nothing "entered" or "left" that element. 47368 * 47369 * @param {string} leaveID ID being left. 47370 * @param {string} enterID ID being entered. 47371 * @param {function} cb Callback to invoke on each entered/left ID. 47372 * @param {*} upArg Argument to invoke the callback with on left IDs. 47373 * @param {*} downArg Argument to invoke the callback with on entered IDs. 47374 * @internal 47375 */ 47376 traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) { 47377 var ancestorID = getFirstCommonAncestorID(leaveID, enterID); 47378 if (ancestorID !== leaveID) { 47379 traverseParentPath(leaveID, ancestorID, cb, upArg, false, true); 47380 } 47381 if (ancestorID !== enterID) { 47382 traverseParentPath(ancestorID, enterID, cb, downArg, true, false); 47383 } 47384 }, 47385 47386 /** 47387 * Simulates the traversal of a two-phase, capture/bubble event dispatch. 47388 * 47389 * NOTE: This traversal happens on IDs without touching the DOM. 47390 * 47391 * @param {string} targetID ID of the target node. 47392 * @param {function} cb Callback to invoke. 47393 * @param {*} arg Argument to invoke the callback with. 47394 * @internal 47395 */ 47396 traverseTwoPhase: function (targetID, cb, arg) { 47397 if (targetID) { 47398 traverseParentPath('', targetID, cb, arg, true, false); 47399 traverseParentPath(targetID, '', cb, arg, false, true); 47400 } 47401 }, 47402 47403 /** 47404 * Same as `traverseTwoPhase` but skips the `targetID`. 47405 */ 47406 traverseTwoPhaseSkipTarget: function (targetID, cb, arg) { 47407 if (targetID) { 47408 traverseParentPath('', targetID, cb, arg, true, true); 47409 traverseParentPath(targetID, '', cb, arg, true, true); 47410 } 47411 }, 47412 47413 /** 47414 * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For 47415 * example, passing `.0.$row-0.1` would result in `cb` getting called 47416 * with `.0`, `.0.$row-0`, and `.0.$row-0.1`. 47417 * 47418 * NOTE: This traversal happens on IDs without touching the DOM. 47419 * 47420 * @param {string} targetID ID of the target node. 47421 * @param {function} cb Callback to invoke. 47422 * @param {*} arg Argument to invoke the callback with. 47423 * @internal 47424 */ 47425 traverseAncestors: function (targetID, cb, arg) { 47426 traverseParentPath('', targetID, cb, arg, true, false); 47427 }, 47428 47429 getFirstCommonAncestorID: getFirstCommonAncestorID, 47430 47431 /** 47432 * Exposed for unit testing. 47433 * @private 47434 */ 47435 _getNextDescendantID: getNextDescendantID, 47436 47437 isAncestorIDOf: isAncestorIDOf, 47438 47439 SEPARATOR: SEPARATOR 47440 47441}; 47442 47443module.exports = ReactInstanceHandles; 47444 47445/***/ }), 47446
vendor: 1,582 bytes, lines 47447-47504
47447/***/ "./node_modules/react/lib/ReactInstanceMap.js": 47448/*!****************************************************!*\ 47449 !*** ./node_modules/react/lib/ReactInstanceMap.js ***! 47450 \****************************************************/ 47451/*! no static exports found */ 47452/***/ (function(module, exports, __webpack_require__) { 47453 47454"use strict"; 47455/** 47456 * Copyright 2013-2015, Facebook, Inc. 47457 * All rights reserved. 47458 * 47459 * This source code is licensed under the BSD-style license found in the 47460 * LICENSE file in the root directory of this source tree. An additional grant 47461 * of patent rights can be found in the PATENTS file in the same directory. 47462 * 47463 * @providesModule ReactInstanceMap 47464 */ 47465 47466 47467 47468/** 47469 * `ReactInstanceMap` maintains a mapping from a public facing stateful 47470 * instance (key) and the internal representation (value). This allows public 47471 * methods to accept the user facing instance as an argument and map them back 47472 * to internal methods. 47473 */ 47474 47475// TODO: Replace this with ES6: var ReactInstanceMap = new Map(); 47476var ReactInstanceMap = { 47477 47478 /** 47479 * This API should be called `delete` but we'd have to make sure to always 47480 * transform these to strings for IE support. When this transform is fully 47481 * supported we can rename it. 47482 */ 47483 remove: function (key) { 47484 key._reactInternalInstance = undefined; 47485 }, 47486 47487 get: function (key) { 47488 return key._reactInternalInstance; 47489 }, 47490 47491 has: function (key) { 47492 return key._reactInternalInstance !== undefined; 47493 }, 47494 47495 set: function (key, value) { 47496 key._reactInternalInstance = value; 47497 } 47498 47499}; 47500 47501module.exports = ReactInstanceMap; 47502 47503/***/ }), 47504
vendor: 2,961 bytes, lines 47505-47589
47505/***/ "./node_modules/react/lib/ReactIsomorphic.js": 47506/*!***************************************************!*\ 47507 !*** ./node_modules/react/lib/ReactIsomorphic.js ***! 47508 \***************************************************/ 47509/*! no static exports found */ 47510/***/ (function(module, exports, __webpack_require__) { 47511 47512"use strict"; 47513/** 47514 * Copyright 2013-2015, Facebook, Inc. 47515 * All rights reserved. 47516 * 47517 * This source code is licensed under the BSD-style license found in the 47518 * LICENSE file in the root directory of this source tree. An additional grant 47519 * of patent rights can be found in the PATENTS file in the same directory. 47520 * 47521 * @providesModule ReactIsomorphic 47522 */ 47523 47524 47525 47526var ReactChildren = __webpack_require__(/*! ./ReactChildren */ "./node_modules/react/lib/ReactChildren.js"); 47527var ReactComponent = __webpack_require__(/*! ./ReactComponent */ "./node_modules/react/lib/ReactComponent.js"); 47528var ReactClass = __webpack_require__(/*! ./ReactClass */ "./node_modules/react/lib/ReactClass.js"); 47529var ReactDOMFactories = __webpack_require__(/*! ./ReactDOMFactories */ "./node_modules/react/lib/ReactDOMFactories.js"); 47530var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 47531var ReactElementValidator = __webpack_require__(/*! ./ReactElementValidator */ "./node_modules/react/lib/ReactElementValidator.js"); 47532var ReactPropTypes = __webpack_require__(/*! ./ReactPropTypes */ "./node_modules/react/lib/ReactPropTypes.js"); 47533var ReactVersion = __webpack_require__(/*! ./ReactVersion */ "./node_modules/react/lib/ReactVersion.js"); 47534 47535var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 47536var onlyChild = __webpack_require__(/*! ./onlyChild */ "./node_modules/react/lib/onlyChild.js"); 47537 47538var createElement = ReactElement.createElement; 47539var createFactory = ReactElement.createFactory; 47540var cloneElement = ReactElement.cloneElement; 47541 47542if (true) { 47543 createElement = ReactElementValidator.createElement; 47544 createFactory = ReactElementValidator.createFactory; 47545 cloneElement = ReactElementValidator.cloneElement; 47546} 47547 47548var React = { 47549 47550 // Modern 47551 47552 Children: { 47553 map: ReactChildren.map, 47554 forEach: ReactChildren.forEach, 47555 count: ReactChildren.count, 47556 toArray: ReactChildren.toArray, 47557 only: onlyChild 47558 }, 47559 47560 Component: ReactComponent, 47561 47562 createElement: createElement, 47563 cloneElement: cloneElement, 47564 isValidElement: ReactElement.isValidElement, 47565 47566 // Classic 47567 47568 PropTypes: ReactPropTypes, 47569 createClass: ReactClass.createClass, 47570 createFactory: createFactory, 47571 createMixin: function (mixin) { 47572 // Currently a noop. Will be used to validate and trace mixins. 47573 return mixin; 47574 }, 47575 47576 // This looks DOM specific but these are actually isomorphic helpers 47577 // since they are just generating DOM strings. 47578 DOM: ReactDOMFactories, 47579 47580 version: ReactVersion, 47581 47582 // Hook for JSX spread, don't use this for anything else. 47583 __spread: assign 47584}; 47585 47586module.exports = React; 47587 47588/***/ }), 47589
vendor: 1,782 bytes, lines 47590-47645
47590/***/ "./node_modules/react/lib/ReactMarkupChecksum.js": 47591/*!*******************************************************!*\ 47592 !*** ./node_modules/react/lib/ReactMarkupChecksum.js ***! 47593 \*******************************************************/ 47594/*! no static exports found */ 47595/***/ (function(module, exports, __webpack_require__) { 47596 47597"use strict"; 47598/** 47599 * Copyright 2013-2015, Facebook, Inc. 47600 * All rights reserved. 47601 * 47602 * This source code is licensed under the BSD-style license found in the 47603 * LICENSE file in the root directory of this source tree. An additional grant 47604 * of patent rights can be found in the PATENTS file in the same directory. 47605 * 47606 * @providesModule ReactMarkupChecksum 47607 */ 47608 47609 47610 47611var adler32 = __webpack_require__(/*! ./adler32 */ "./node_modules/react/lib/adler32.js"); 47612 47613var TAG_END = /\/?>/; 47614 47615var ReactMarkupChecksum = { 47616 CHECKSUM_ATTR_NAME: 'data-react-checksum', 47617 47618 /** 47619 * @param {string} markup Markup string 47620 * @return {string} Markup string with checksum attribute attached 47621 */ 47622 addChecksumToMarkup: function (markup) { 47623 var checksum = adler32(markup); 47624 47625 // Add checksum (handle both parent tags and self-closing tags) 47626 return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); 47627 }, 47628 47629 /** 47630 * @param {string} markup to use 47631 * @param {DOMElement} element root React element 47632 * @returns {boolean} whether or not the markup is the same 47633 */ 47634 canReuseMarkup: function (markup, element) { 47635 var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 47636 existingChecksum = existingChecksum && parseInt(existingChecksum, 10); 47637 var markupChecksum = adler32(markup); 47638 return markupChecksum === existingChecksum; 47639 } 47640}; 47641 47642module.exports = ReactMarkupChecksum; 47643 47644/***/ }), 47645
vendor: 37,375 bytes, lines 47646-48506
47646/***/ "./node_modules/react/lib/ReactMount.js": 47647/*!**********************************************!*\ 47648 !*** ./node_modules/react/lib/ReactMount.js ***! 47649 \**********************************************/ 47650/*! no static exports found */ 47651/***/ (function(module, exports, __webpack_require__) { 47652 47653"use strict"; 47654/** 47655 * Copyright 2013-2015, Facebook, Inc. 47656 * All rights reserved. 47657 * 47658 * This source code is licensed under the BSD-style license found in the 47659 * LICENSE file in the root directory of this source tree. An additional grant 47660 * of patent rights can be found in the PATENTS file in the same directory. 47661 * 47662 * @providesModule ReactMount 47663 */ 47664 47665 47666 47667var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 47668var ReactBrowserEventEmitter = __webpack_require__(/*! ./ReactBrowserEventEmitter */ "./node_modules/react/lib/ReactBrowserEventEmitter.js"); 47669var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 47670var ReactDOMFeatureFlags = __webpack_require__(/*! ./ReactDOMFeatureFlags */ "./node_modules/react/lib/ReactDOMFeatureFlags.js"); 47671var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 47672var ReactEmptyComponentRegistry = __webpack_require__(/*! ./ReactEmptyComponentRegistry */ "./node_modules/react/lib/ReactEmptyComponentRegistry.js"); 47673var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 47674var ReactInstanceMap = __webpack_require__(/*! ./ReactInstanceMap */ "./node_modules/react/lib/ReactInstanceMap.js"); 47675var ReactMarkupChecksum = __webpack_require__(/*! ./ReactMarkupChecksum */ "./node_modules/react/lib/ReactMarkupChecksum.js"); 47676var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 47677var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 47678var ReactUpdateQueue = __webpack_require__(/*! ./ReactUpdateQueue */ "./node_modules/react/lib/ReactUpdateQueue.js"); 47679var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 47680 47681var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 47682var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); 47683var containsNode = __webpack_require__(/*! fbjs/lib/containsNode */ "./node_modules/fbjs/lib/containsNode.js"); 47684var instantiateReactComponent = __webpack_require__(/*! ./instantiateReactComponent */ "./node_modules/react/lib/instantiateReactComponent.js"); 47685var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 47686var setInnerHTML = __webpack_require__(/*! ./setInnerHTML */ "./node_modules/react/lib/setInnerHTML.js"); 47687var shouldUpdateReactComponent = __webpack_require__(/*! ./shouldUpdateReactComponent */ "./node_modules/react/lib/shouldUpdateReactComponent.js"); 47688var validateDOMNesting = __webpack_require__(/*! ./validateDOMNesting */ "./node_modules/react/lib/validateDOMNesting.js"); 47689var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 47690 47691var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; 47692var nodeCache = {}; 47693 47694var ELEMENT_NODE_TYPE = 1; 47695var DOC_NODE_TYPE = 9; 47696var DOCUMENT_FRAGMENT_NODE_TYPE = 11; 47697 47698var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2); 47699 47700/** Mapping from reactRootID to React component instance. */ 47701var instancesByReactRootID = {}; 47702 47703/** Mapping from reactRootID to `container` nodes. */ 47704var containersByReactRootID = {}; 47705 47706if (true) { 47707 /** __DEV__-only mapping from reactRootID to root elements. */ 47708 var rootElementsByReactRootID = {}; 47709} 47710 47711// Used to store breadth-first search state in findComponentRoot. 47712var findComponentRootReusableArray = []; 47713 47714/** 47715 * Finds the index of the first character 47716 * that's not common between the two given strings. 47717 * 47718 * @return {number} the index of the character where the strings diverge 47719 */ 47720function firstDifferenceIndex(string1, string2) { 47721 var minLen = Math.min(string1.length, string2.length); 47722 for (var i = 0; i < minLen; i++) { 47723 if (string1.charAt(i) !== string2.charAt(i)) { 47724 return i; 47725 } 47726 } 47727 return string1.length === string2.length ? -1 : minLen; 47728} 47729 47730/** 47731 * @param {DOMElement|DOMDocument} container DOM element that may contain 47732 * a React component 47733 * @return {?*} DOM element that may have the reactRoot ID, or null. 47734 */ 47735function getReactRootElementInContainer(container) { 47736 if (!container) { 47737 return null; 47738 } 47739 47740 if (container.nodeType === DOC_NODE_TYPE) { 47741 return container.documentElement; 47742 } else { 47743 return container.firstChild; 47744 } 47745} 47746 47747/** 47748 * @param {DOMElement} container DOM element that may contain a React component. 47749 * @return {?string} A "reactRoot" ID, if a React component is rendered. 47750 */ 47751function getReactRootID(container) { 47752 var rootElement = getReactRootElementInContainer(container); 47753 return rootElement && ReactMount.getID(rootElement); 47754} 47755 47756/** 47757 * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form 47758 * element can return its control whose name or ID equals ATTR_NAME. All 47759 * DOM nodes support `getAttributeNode` but this can also get called on 47760 * other objects so just return '' if we're given something other than a 47761 * DOM node (such as window). 47762 * 47763 * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node. 47764 * @return {string} ID of the supplied `domNode`. 47765 */ 47766function getID(node) { 47767 var id = internalGetID(node); 47768 if (id) { 47769 if (nodeCache.hasOwnProperty(id)) { 47770 var cached = nodeCache[id]; 47771 if (cached !== node) { 47772 !!isValid(cached, id) ? true ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : undefined : undefined; 47773 47774 nodeCache[id] = node; 47775 } 47776 } else { 47777 nodeCache[id] = node; 47778 } 47779 } 47780 47781 return id; 47782} 47783 47784function internalGetID(node) { 47785 // If node is something like a window, document, or text node, none of 47786 // which support attributes or a .getAttribute method, gracefully return 47787 // the empty string, as if the attribute were missing. 47788 return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; 47789} 47790 47791/** 47792 * Sets the React-specific ID of the given node. 47793 * 47794 * @param {DOMElement} node The DOM node whose ID will be set. 47795 * @param {string} id The value of the ID attribute. 47796 */ 47797function setID(node, id) { 47798 var oldID = internalGetID(node); 47799 if (oldID !== id) { 47800 delete nodeCache[oldID]; 47801 } 47802 node.setAttribute(ATTR_NAME, id); 47803 nodeCache[id] = node; 47804} 47805 47806/** 47807 * Finds the node with the supplied React-generated DOM ID. 47808 * 47809 * @param {string} id A React-generated DOM ID. 47810 * @return {DOMElement} DOM node with the suppled `id`. 47811 * @internal 47812 */ 47813function getNode(id) { 47814 if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { 47815 nodeCache[id] = ReactMount.findReactNodeByID(id); 47816 } 47817 return nodeCache[id]; 47818} 47819 47820/** 47821 * Finds the node with the supplied public React instance. 47822 * 47823 * @param {*} instance A public React instance. 47824 * @return {?DOMElement} DOM node with the suppled `id`. 47825 * @internal 47826 */ 47827function getNodeFromInstance(instance) { 47828 var id = ReactInstanceMap.get(instance)._rootNodeID; 47829 if (ReactEmptyComponentRegistry.isNullComponentID(id)) { 47830 return null; 47831 } 47832 if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { 47833 nodeCache[id] = ReactMount.findReactNodeByID(id); 47834 } 47835 return nodeCache[id]; 47836} 47837 47838/** 47839 * A node is "valid" if it is contained by a currently mounted container. 47840 * 47841 * This means that the node does not have to be contained by a document in 47842 * order to be considered valid. 47843 * 47844 * @param {?DOMElement} node The candidate DOM node. 47845 * @param {string} id The expected ID of the node. 47846 * @return {boolean} Whether the node is contained by a mounted container. 47847 */ 47848function isValid(node, id) { 47849 if (node) { 47850 !(internalGetID(node) === id) ? true ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : undefined : undefined; 47851 47852 var container = ReactMount.findReactContainerForID(id); 47853 if (container && containsNode(container, node)) { 47854 return true; 47855 } 47856 } 47857 47858 return false; 47859} 47860 47861/** 47862 * Causes the cache to forget about one React-specific ID. 47863 * 47864 * @param {string} id The ID to forget. 47865 */ 47866function purgeID(id) { 47867 delete nodeCache[id]; 47868} 47869 47870var deepestNodeSoFar = null; 47871function findDeepestCachedAncestorImpl(ancestorID) { 47872 var ancestor = nodeCache[ancestorID]; 47873 if (ancestor && isValid(ancestor, ancestorID)) { 47874 deepestNodeSoFar = ancestor; 47875 } else { 47876 // This node isn't populated in the cache, so presumably none of its 47877 // descendants are. Break out of the loop. 47878 return false; 47879 } 47880} 47881 47882/** 47883 * Return the deepest cached node whose ID is a prefix of `targetID`. 47884 */ 47885function findDeepestCachedAncestor(targetID) { 47886 deepestNodeSoFar = null; 47887 ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl); 47888 47889 var foundNode = deepestNodeSoFar; 47890 deepestNodeSoFar = null; 47891 return foundNode; 47892} 47893 47894/** 47895 * Mounts this component and inserts it into the DOM. 47896 * 47897 * @param {ReactComponent} componentInstance The instance to mount. 47898 * @param {string} rootID DOM ID of the root node. 47899 * @param {DOMElement} container DOM element to mount into. 47900 * @param {ReactReconcileTransaction} transaction 47901 * @param {boolean} shouldReuseMarkup If true, do not insert markup 47902 */ 47903function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) { 47904 if (ReactDOMFeatureFlags.useCreateElement) { 47905 context = assign({}, context); 47906 if (container.nodeType === DOC_NODE_TYPE) { 47907 context[ownerDocumentContextKey] = container; 47908 } else { 47909 context[ownerDocumentContextKey] = container.ownerDocument; 47910 } 47911 } 47912 if (true) { 47913 if (context === emptyObject) { 47914 context = {}; 47915 } 47916 var tag = container.nodeName.toLowerCase(); 47917 context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null); 47918 } 47919 var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context); 47920 componentInstance._renderedComponent._topLevelWrapper = componentInstance; 47921 ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction); 47922} 47923 47924/** 47925 * Batched mount. 47926 * 47927 * @param {ReactComponent} componentInstance The instance to mount. 47928 * @param {string} rootID DOM ID of the root node. 47929 * @param {DOMElement} container DOM element to mount into. 47930 * @param {boolean} shouldReuseMarkup If true, do not insert markup 47931 */ 47932function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) { 47933 var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( 47934 /* forceHTML */shouldReuseMarkup); 47935 transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context); 47936 ReactUpdates.ReactReconcileTransaction.release(transaction); 47937} 47938 47939/** 47940 * Unmounts a component and removes it from the DOM. 47941 * 47942 * @param {ReactComponent} instance React component instance. 47943 * @param {DOMElement} container DOM element to unmount from. 47944 * @final 47945 * @internal 47946 * @see {ReactMount.unmountComponentAtNode} 47947 */ 47948function unmountComponentFromNode(instance, container) { 47949 ReactReconciler.unmountComponent(instance); 47950 47951 if (container.nodeType === DOC_NODE_TYPE) { 47952 container = container.documentElement; 47953 } 47954 47955 // http://jsperf.com/emptying-a-node 47956 while (container.lastChild) { 47957 container.removeChild(container.lastChild); 47958 } 47959} 47960 47961/** 47962 * True if the supplied DOM node has a direct React-rendered child that is 47963 * not a React root element. Useful for warning in `render`, 47964 * `unmountComponentAtNode`, etc. 47965 * 47966 * @param {?DOMElement} node The candidate DOM node. 47967 * @return {boolean} True if the DOM element contains a direct child that was 47968 * rendered by React but is not a root element. 47969 * @internal 47970 */ 47971function hasNonRootReactChild(node) { 47972 var reactRootID = getReactRootID(node); 47973 return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false; 47974} 47975 47976/** 47977 * Returns the first (deepest) ancestor of a node which is rendered by this copy 47978 * of React. 47979 */ 47980function findFirstReactDOMImpl(node) { 47981 // This node might be from another React instance, so we make sure not to 47982 // examine the node cache here 47983 for (; node && node.parentNode !== node; node = node.parentNode) { 47984 if (node.nodeType !== 1) { 47985 // Not a DOMElement, therefore not a React component 47986 continue; 47987 } 47988 var nodeID = internalGetID(node); 47989 if (!nodeID) { 47990 continue; 47991 } 47992 var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); 47993 47994 // If containersByReactRootID contains the container we find by crawling up 47995 // the tree, we know that this instance of React rendered the node. 47996 // nb. isValid's strategy (with containsNode) does not work because render 47997 // trees may be nested and we don't want a false positive in that case. 47998 var current = node; 47999 var lastID; 48000 do { 48001 lastID = internalGetID(current); 48002 current = current.parentNode; 48003 if (current == null) { 48004 // The passed-in node has been detached from the container it was 48005 // originally rendered into. 48006 return null; 48007 } 48008 } while (lastID !== reactRootID); 48009 48010 if (current === containersByReactRootID[reactRootID]) { 48011 return node; 48012 } 48013 } 48014 return null; 48015} 48016 48017/** 48018 * Temporary (?) hack so that we can store all top-level pending updates on 48019 * composites instead of having to worry about different types of components 48020 * here. 48021 */ 48022var TopLevelWrapper = function () {}; 48023TopLevelWrapper.prototype.isReactComponent = {}; 48024if (true) { 48025 TopLevelWrapper.displayName = 'TopLevelWrapper'; 48026} 48027TopLevelWrapper.prototype.render = function () { 48028 // this.props is actually a ReactElement 48029 return this.props; 48030}; 48031 48032/** 48033 * Mounting is the process of initializing a React component by creating its 48034 * representative DOM elements and inserting them into a supplied `container`. 48035 * Any prior content inside `container` is destroyed in the process. 48036 * 48037 * ReactMount.render( 48038 * component, 48039 * document.getElementById('container') 48040 * ); 48041 * 48042 * <div id="container"> <-- Supplied `container`. 48043 * <div data-reactid=".3"> <-- Rendered reactRoot of React 48044 * // ... component. 48045 * </div> 48046 * </div> 48047 * 48048 * Inside of `container`, the first element rendered is the "reactRoot". 48049 */ 48050var ReactMount = { 48051 48052 TopLevelWrapper: TopLevelWrapper, 48053 48054 /** Exposed for debugging purposes **/ 48055 _instancesByReactRootID: instancesByReactRootID, 48056 48057 /** 48058 * This is a hook provided to support rendering React components while 48059 * ensuring that the apparent scroll position of its `container` does not 48060 * change. 48061 * 48062 * @param {DOMElement} container The `container` being rendered into. 48063 * @param {function} renderCallback This must be called once to do the render. 48064 */ 48065 scrollMonitor: function (container, renderCallback) { 48066 renderCallback(); 48067 }, 48068 48069 /** 48070 * Take a component that's already mounted into the DOM and replace its props 48071 * @param {ReactComponent} prevComponent component instance already in the DOM 48072 * @param {ReactElement} nextElement component instance to render 48073 * @param {DOMElement} container container to render into 48074 * @param {?function} callback function triggered on completion 48075 */ 48076 _updateRootComponent: function (prevComponent, nextElement, container, callback) { 48077 ReactMount.scrollMonitor(container, function () { 48078 ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement); 48079 if (callback) { 48080 ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); 48081 } 48082 }); 48083 48084 if (true) { 48085 // Record the root element in case it later gets transplanted. 48086 rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container); 48087 } 48088 48089 return prevComponent; 48090 }, 48091 48092 /** 48093 * Register a component into the instance map and starts scroll value 48094 * monitoring 48095 * @param {ReactComponent} nextComponent component instance to render 48096 * @param {DOMElement} container container to render into 48097 * @return {string} reactRoot ID prefix 48098 */ 48099 _registerComponent: function (nextComponent, container) { 48100 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : undefined : undefined; 48101 48102 ReactBrowserEventEmitter.ensureScrollValueMonitoring(); 48103 48104 var reactRootID = ReactMount.registerContainer(container); 48105 instancesByReactRootID[reactRootID] = nextComponent; 48106 return reactRootID; 48107 }, 48108 48109 /** 48110 * Render a new component into the DOM. 48111 * @param {ReactElement} nextElement element to render 48112 * @param {DOMElement} container container to render into 48113 * @param {boolean} shouldReuseMarkup if we should skip the markup insertion 48114 * @return {ReactComponent} nextComponent 48115 */ 48116 _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { 48117 // Various parts of our code (such as ReactCompositeComponent's 48118 // _renderValidatedComponent) assume that calls to render aren't nested; 48119 // verify that that's the case. 48120 true ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined; 48121 48122 var componentInstance = instantiateReactComponent(nextElement, null); 48123 var reactRootID = ReactMount._registerComponent(componentInstance, container); 48124 48125 // The initial render is synchronous but any updates that happen during 48126 // rendering, in componentWillMount or componentDidMount, will be batched 48127 // according to the current batching strategy. 48128 48129 ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context); 48130 48131 if (true) { 48132 // Record the root element in case it later gets transplanted. 48133 rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container); 48134 } 48135 48136 return componentInstance; 48137 }, 48138 48139 /** 48140 * Renders a React component into the DOM in the supplied `container`. 48141 * 48142 * If the React component was previously rendered into `container`, this will 48143 * perform an update on it and only mutate the DOM as necessary to reflect the 48144 * latest React component. 48145 * 48146 * @param {ReactComponent} parentComponent The conceptual parent of this render tree. 48147 * @param {ReactElement} nextElement Component element to render. 48148 * @param {DOMElement} container DOM element to render into. 48149 * @param {?function} callback function triggered on completion 48150 * @return {ReactComponent} Component instance rendered in `container`. 48151 */ 48152 renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { 48153 !(parentComponent != null && parentComponent._reactInternalInstance != null) ? true ? invariant(false, 'parentComponent must be a valid React Component') : undefined : undefined; 48154 return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); 48155 }, 48156 48157 _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { 48158 !ReactElement.isValidElement(nextElement) ? true ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : 48159 // Check if it quacks like an element 48160 nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : undefined : undefined; 48161 48162 true ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined; 48163 48164 var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement); 48165 48166 var prevComponent = instancesByReactRootID[getReactRootID(container)]; 48167 48168 if (prevComponent) { 48169 var prevWrappedElement = prevComponent._currentElement; 48170 var prevElement = prevWrappedElement.props; 48171 if (shouldUpdateReactComponent(prevElement, nextElement)) { 48172 var publicInst = prevComponent._renderedComponent.getPublicInstance(); 48173 var updatedCallback = callback && function () { 48174 callback.call(publicInst); 48175 }; 48176 ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback); 48177 return publicInst; 48178 } else { 48179 ReactMount.unmountComponentAtNode(container); 48180 } 48181 } 48182 48183 var reactRootElement = getReactRootElementInContainer(container); 48184 var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); 48185 var containerHasNonRootReactChild = hasNonRootReactChild(container); 48186 48187 if (true) { 48188 true ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined; 48189 48190 if (!containerHasReactMarkup || reactRootElement.nextSibling) { 48191 var rootElementSibling = reactRootElement; 48192 while (rootElementSibling) { 48193 if (internalGetID(rootElementSibling)) { 48194 true ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined; 48195 break; 48196 } 48197 rootElementSibling = rootElementSibling.nextSibling; 48198 } 48199 } 48200 } 48201 48202 var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; 48203 var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance(); 48204 if (callback) { 48205 callback.call(component); 48206 } 48207 return component; 48208 }, 48209 48210 /** 48211 * Renders a React component into the DOM in the supplied `container`. 48212 * 48213 * If the React component was previously rendered into `container`, this will 48214 * perform an update on it and only mutate the DOM as necessary to reflect the 48215 * latest React component. 48216 * 48217 * @param {ReactElement} nextElement Component element to render. 48218 * @param {DOMElement} container DOM element to render into. 48219 * @param {?function} callback function triggered on completion 48220 * @return {ReactComponent} Component instance rendered in `container`. 48221 */ 48222 render: function (nextElement, container, callback) { 48223 return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); 48224 }, 48225 48226 /** 48227 * Registers a container node into which React components will be rendered. 48228 * This also creates the "reactRoot" ID that will be assigned to the element 48229 * rendered within. 48230 * 48231 * @param {DOMElement} container DOM element to register as a container. 48232 * @return {string} The "reactRoot" ID of elements rendered within. 48233 */ 48234 registerContainer: function (container) { 48235 var reactRootID = getReactRootID(container); 48236 if (reactRootID) { 48237 // If one exists, make sure it is a valid "reactRoot" ID. 48238 reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID); 48239 } 48240 if (!reactRootID) { 48241 // No valid "reactRoot" ID found, create one. 48242 reactRootID = ReactInstanceHandles.createReactRootID(); 48243 } 48244 containersByReactRootID[reactRootID] = container; 48245 return reactRootID; 48246 }, 48247 48248 /** 48249 * Unmounts and destroys the React component rendered in the `container`. 48250 * 48251 * @param {DOMElement} container DOM element containing a React component. 48252 * @return {boolean} True if a component was found in and unmounted from 48253 * `container` 48254 */ 48255 unmountComponentAtNode: function (container) { 48256 // Various parts of our code (such as ReactCompositeComponent's 48257 // _renderValidatedComponent) assume that calls to render aren't nested; 48258 // verify that that's the case. (Strictly speaking, unmounting won't cause a 48259 // render but we still don't expect to be in a render call here.) 48260 true ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined; 48261 48262 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : undefined : undefined; 48263 48264 var reactRootID = getReactRootID(container); 48265 var component = instancesByReactRootID[reactRootID]; 48266 if (!component) { 48267 // Check if the node being unmounted was rendered by React, but isn't a 48268 // root node. 48269 var containerHasNonRootReactChild = hasNonRootReactChild(container); 48270 48271 // Check if the container itself is a React root node. 48272 var containerID = internalGetID(container); 48273 var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID); 48274 48275 if (true) { 48276 true ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined; 48277 } 48278 48279 return false; 48280 } 48281 ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container); 48282 delete instancesByReactRootID[reactRootID]; 48283 delete containersByReactRootID[reactRootID]; 48284 if (true) { 48285 delete rootElementsByReactRootID[reactRootID]; 48286 } 48287 return true; 48288 }, 48289 48290 /** 48291 * Finds the container DOM element that contains React component to which the 48292 * supplied DOM `id` belongs. 48293 * 48294 * @param {string} id The ID of an element rendered by a React component. 48295 * @return {?DOMElement} DOM element that contains the `id`. 48296 */ 48297 findReactContainerForID: function (id) { 48298 var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); 48299 var container = containersByReactRootID[reactRootID]; 48300 48301 if (true) { 48302 var rootElement = rootElementsByReactRootID[reactRootID]; 48303 if (rootElement && rootElement.parentNode !== container) { 48304 true ? warning( 48305 // Call internalGetID here because getID calls isValid which calls 48306 // findReactContainerForID (this function). 48307 internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined; 48308 var containerChild = container.firstChild; 48309 if (containerChild && reactRootID === internalGetID(containerChild)) { 48310 // If the container has a new child with the same ID as the old 48311 // root element, then rootElementsByReactRootID[reactRootID] is 48312 // just stale and needs to be updated. The case that deserves a 48313 // warning is when the container is empty. 48314 rootElementsByReactRootID[reactRootID] = containerChild; 48315 } else { 48316 true ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined; 48317 } 48318 } 48319 } 48320 48321 return container; 48322 }, 48323 48324 /** 48325 * Finds an element rendered by React with the supplied ID. 48326 * 48327 * @param {string} id ID of a DOM node in the React component. 48328 * @return {DOMElement} Root DOM node of the React component. 48329 */ 48330 findReactNodeByID: function (id) { 48331 var reactRoot = ReactMount.findReactContainerForID(id); 48332 return ReactMount.findComponentRoot(reactRoot, id); 48333 }, 48334 48335 /** 48336 * Traverses up the ancestors of the supplied node to find a node that is a 48337 * DOM representation of a React component rendered by this copy of React. 48338 * 48339 * @param {*} node 48340 * @return {?DOMEventTarget} 48341 * @internal 48342 */ 48343 getFirstReactDOM: function (node) { 48344 return findFirstReactDOMImpl(node); 48345 }, 48346 48347 /** 48348 * Finds a node with the supplied `targetID` inside of the supplied 48349 * `ancestorNode`. Exploits the ID naming scheme to perform the search 48350 * quickly. 48351 * 48352 * @param {DOMEventTarget} ancestorNode Search from this root. 48353 * @pararm {string} targetID ID of the DOM representation of the component. 48354 * @return {DOMEventTarget} DOM node with the supplied `targetID`. 48355 * @internal 48356 */ 48357 findComponentRoot: function (ancestorNode, targetID) { 48358 var firstChildren = findComponentRootReusableArray; 48359 var childIndex = 0; 48360 48361 var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode; 48362 48363 if (true) { 48364 // This will throw on the next line; give an early warning 48365 true ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined; 48366 } 48367 48368 firstChildren[0] = deepestAncestor.firstChild; 48369 firstChildren.length = 1; 48370 48371 while (childIndex < firstChildren.length) { 48372 var child = firstChildren[childIndex++]; 48373 var targetChild; 48374 48375 while (child) { 48376 var childID = ReactMount.getID(child); 48377 if (childID) { 48378 // Even if we find the node we're looking for, we finish looping 48379 // through its siblings to ensure they're cached so that we don't have 48380 // to revisit this node again. Otherwise, we make n^2 calls to getID 48381 // when visiting the many children of a single node in order. 48382 48383 if (targetID === childID) { 48384 targetChild = child; 48385 } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) { 48386 // If we find a child whose ID is an ancestor of the given ID, 48387 // then we can be sure that we only want to search the subtree 48388 // rooted at this child, so we can throw out the rest of the 48389 // search state. 48390 firstChildren.length = childIndex = 0; 48391 firstChildren.push(child.firstChild); 48392 } 48393 } else { 48394 // If this child had no ID, then there's a chance that it was 48395 // injected automatically by the browser, as when a `<table>` 48396 // element sprouts an extra `<tbody>` child as a side effect of 48397 // `.innerHTML` parsing. Optimistically continue down this 48398 // branch, but not before examining the other siblings. 48399 firstChildren.push(child.firstChild); 48400 } 48401 48402 child = child.nextSibling; 48403 } 48404 48405 if (targetChild) { 48406 // Emptying firstChildren/findComponentRootReusableArray is 48407 // not necessary for correctness, but it helps the GC reclaim 48408 // any nodes that were left at the end of the search. 48409 firstChildren.length = 0; 48410 48411 return targetChild; 48412 } 48413 } 48414 48415 firstChildren.length = 0; 48416 48417 true ? true ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : undefined : undefined; 48418 }, 48419 48420 _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) { 48421 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? true ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : undefined : undefined; 48422 48423 if (shouldReuseMarkup) { 48424 var rootElement = getReactRootElementInContainer(container); 48425 if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { 48426 return; 48427 } else { 48428 var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 48429 rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 48430 48431 var rootMarkup = rootElement.outerHTML; 48432 rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); 48433 48434 var normalizedMarkup = markup; 48435 if (true) { 48436 // because rootMarkup is retrieved from the DOM, various normalizations 48437 // will have occurred which will not be present in `markup`. Here, 48438 // insert markup into a <div> or <iframe> depending on the container 48439 // type to perform the same normalizations before comparing. 48440 var normalizer; 48441 if (container.nodeType === ELEMENT_NODE_TYPE) { 48442 normalizer = document.createElement('div'); 48443 normalizer.innerHTML = markup; 48444 normalizedMarkup = normalizer.innerHTML; 48445 } else { 48446 normalizer = document.createElement('iframe'); 48447 document.body.appendChild(normalizer); 48448 normalizer.contentDocument.write(markup); 48449 normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; 48450 document.body.removeChild(normalizer); 48451 } 48452 } 48453 48454 var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); 48455 var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); 48456 48457 !(container.nodeType !== DOC_NODE_TYPE) ? true ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : undefined : undefined; 48458 48459 if (true) { 48460 true ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined; 48461 } 48462 } 48463 } 48464 48465 !(container.nodeType !== DOC_NODE_TYPE) ? true ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : undefined : undefined; 48466 48467 if (transaction.useCreateElement) { 48468 while (container.lastChild) { 48469 container.removeChild(container.lastChild); 48470 } 48471 container.appendChild(markup); 48472 } else { 48473 setInnerHTML(container, markup); 48474 } 48475 }, 48476 48477 ownerDocumentContextKey: ownerDocumentContextKey, 48478 48479 /** 48480 * React ID utilities. 48481 */ 48482 48483 getReactRootID: getReactRootID, 48484 48485 getID: getID, 48486 48487 setID: setID, 48488 48489 getNode: getNode, 48490 48491 getNodeFromInstance: getNodeFromInstance, 48492 48493 isValid: isValid, 48494 48495 purgeID: purgeID 48496}; 48497 48498ReactPerf.measureMethods(ReactMount, 'ReactMount', { 48499 _renderNewRootComponent: '_renderNewRootComponent', 48500 _mountImageIntoNode: '_mountImageIntoNode' 48501}); 48502 48503module.exports = ReactMount; 48504 48505/***/ }), 48506
vendor: 15,350 bytes, lines 48507-49013
48507/***/ "./node_modules/react/lib/ReactMultiChild.js": 48508/*!***************************************************!*\ 48509 !*** ./node_modules/react/lib/ReactMultiChild.js ***! 48510 \***************************************************/ 48511/*! no static exports found */ 48512/***/ (function(module, exports, __webpack_require__) { 48513 48514"use strict"; 48515/** 48516 * Copyright 2013-2015, Facebook, Inc. 48517 * All rights reserved. 48518 * 48519 * This source code is licensed under the BSD-style license found in the 48520 * LICENSE file in the root directory of this source tree. An additional grant 48521 * of patent rights can be found in the PATENTS file in the same directory. 48522 * 48523 * @providesModule ReactMultiChild 48524 * @typechecks static-only 48525 */ 48526 48527 48528 48529var ReactComponentEnvironment = __webpack_require__(/*! ./ReactComponentEnvironment */ "./node_modules/react/lib/ReactComponentEnvironment.js"); 48530var ReactMultiChildUpdateTypes = __webpack_require__(/*! ./ReactMultiChildUpdateTypes */ "./node_modules/react/lib/ReactMultiChildUpdateTypes.js"); 48531 48532var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 48533var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 48534var ReactChildReconciler = __webpack_require__(/*! ./ReactChildReconciler */ "./node_modules/react/lib/ReactChildReconciler.js"); 48535 48536var flattenChildren = __webpack_require__(/*! ./flattenChildren */ "./node_modules/react/lib/flattenChildren.js"); 48537 48538/** 48539 * Updating children of a component may trigger recursive updates. The depth is 48540 * used to batch recursive updates to render markup more efficiently. 48541 * 48542 * @type {number} 48543 * @private 48544 */ 48545var updateDepth = 0; 48546 48547/** 48548 * Queue of update configuration objects. 48549 * 48550 * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`. 48551 * 48552 * @type {array<object>} 48553 * @private 48554 */ 48555var updateQueue = []; 48556 48557/** 48558 * Queue of markup to be rendered. 48559 * 48560 * @type {array<string>} 48561 * @private 48562 */ 48563var markupQueue = []; 48564 48565/** 48566 * Enqueues markup to be rendered and inserted at a supplied index. 48567 * 48568 * @param {string} parentID ID of the parent component. 48569 * @param {string} markup Markup that renders into an element. 48570 * @param {number} toIndex Destination index. 48571 * @private 48572 */ 48573function enqueueInsertMarkup(parentID, markup, toIndex) { 48574 // NOTE: Null values reduce hidden classes. 48575 updateQueue.push({ 48576 parentID: parentID, 48577 parentNode: null, 48578 type: ReactMultiChildUpdateTypes.INSERT_MARKUP, 48579 markupIndex: markupQueue.push(markup) - 1, 48580 content: null, 48581 fromIndex: null, 48582 toIndex: toIndex 48583 }); 48584} 48585 48586/** 48587 * Enqueues moving an existing element to another index. 48588 * 48589 * @param {string} parentID ID of the parent component. 48590 * @param {number} fromIndex Source index of the existing element. 48591 * @param {number} toIndex Destination index of the element. 48592 * @private 48593 */ 48594function enqueueMove(parentID, fromIndex, toIndex) { 48595 // NOTE: Null values reduce hidden classes. 48596 updateQueue.push({ 48597 parentID: parentID, 48598 parentNode: null, 48599 type: ReactMultiChildUpdateTypes.MOVE_EXISTING, 48600 markupIndex: null, 48601 content: null, 48602 fromIndex: fromIndex, 48603 toIndex: toIndex 48604 }); 48605} 48606 48607/** 48608 * Enqueues removing an element at an index. 48609 * 48610 * @param {string} parentID ID of the parent component. 48611 * @param {number} fromIndex Index of the element to remove. 48612 * @private 48613 */ 48614function enqueueRemove(parentID, fromIndex) { 48615 // NOTE: Null values reduce hidden classes. 48616 updateQueue.push({ 48617 parentID: parentID, 48618 parentNode: null, 48619 type: ReactMultiChildUpdateTypes.REMOVE_NODE, 48620 markupIndex: null, 48621 content: null, 48622 fromIndex: fromIndex, 48623 toIndex: null 48624 }); 48625} 48626 48627/** 48628 * Enqueues setting the markup of a node. 48629 * 48630 * @param {string} parentID ID of the parent component. 48631 * @param {string} markup Markup that renders into an element. 48632 * @private 48633 */ 48634function enqueueSetMarkup(parentID, markup) { 48635 // NOTE: Null values reduce hidden classes. 48636 updateQueue.push({ 48637 parentID: parentID, 48638 parentNode: null, 48639 type: ReactMultiChildUpdateTypes.SET_MARKUP, 48640 markupIndex: null, 48641 content: markup, 48642 fromIndex: null, 48643 toIndex: null 48644 }); 48645} 48646 48647/** 48648 * Enqueues setting the text content. 48649 * 48650 * @param {string} parentID ID of the parent component. 48651 * @param {string} textContent Text content to set. 48652 * @private 48653 */ 48654function enqueueTextContent(parentID, textContent) { 48655 // NOTE: Null values reduce hidden classes. 48656 updateQueue.push({ 48657 parentID: parentID, 48658 parentNode: null, 48659 type: ReactMultiChildUpdateTypes.TEXT_CONTENT, 48660 markupIndex: null, 48661 content: textContent, 48662 fromIndex: null, 48663 toIndex: null 48664 }); 48665} 48666 48667/** 48668 * Processes any enqueued updates. 48669 * 48670 * @private 48671 */ 48672function processQueue() { 48673 if (updateQueue.length) { 48674 ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue); 48675 clearQueue(); 48676 } 48677} 48678 48679/** 48680 * Clears any enqueued updates. 48681 * 48682 * @private 48683 */ 48684function clearQueue() { 48685 updateQueue.length = 0; 48686 markupQueue.length = 0; 48687} 48688 48689/** 48690 * ReactMultiChild are capable of reconciling multiple children. 48691 * 48692 * @class ReactMultiChild 48693 * @internal 48694 */ 48695var ReactMultiChild = { 48696 48697 /** 48698 * Provides common functionality for components that must reconcile multiple 48699 * children. This is used by `ReactDOMComponent` to mount, update, and 48700 * unmount child components. 48701 * 48702 * @lends {ReactMultiChild.prototype} 48703 */ 48704 Mixin: { 48705 48706 _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { 48707 if (true) { 48708 if (this._currentElement) { 48709 try { 48710 ReactCurrentOwner.current = this._currentElement._owner; 48711 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); 48712 } finally { 48713 ReactCurrentOwner.current = null; 48714 } 48715 } 48716 } 48717 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); 48718 }, 48719 48720 _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) { 48721 var nextChildren; 48722 if (true) { 48723 if (this._currentElement) { 48724 try { 48725 ReactCurrentOwner.current = this._currentElement._owner; 48726 nextChildren = flattenChildren(nextNestedChildrenElements); 48727 } finally { 48728 ReactCurrentOwner.current = null; 48729 } 48730 return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); 48731 } 48732 } 48733 nextChildren = flattenChildren(nextNestedChildrenElements); 48734 return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); 48735 }, 48736 48737 /** 48738 * Generates a "mount image" for each of the supplied children. In the case 48739 * of `ReactDOMComponent`, a mount image is a string of markup. 48740 * 48741 * @param {?object} nestedChildren Nested child maps. 48742 * @return {array} An array of mounted representations. 48743 * @internal 48744 */ 48745 mountChildren: function (nestedChildren, transaction, context) { 48746 var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); 48747 this._renderedChildren = children; 48748 var mountImages = []; 48749 var index = 0; 48750 for (var name in children) { 48751 if (children.hasOwnProperty(name)) { 48752 var child = children[name]; 48753 // Inlined for performance, see `ReactInstanceHandles.createReactID`. 48754 var rootID = this._rootNodeID + name; 48755 var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); 48756 child._mountIndex = index++; 48757 mountImages.push(mountImage); 48758 } 48759 } 48760 return mountImages; 48761 }, 48762 48763 /** 48764 * Replaces any rendered children with a text content string. 48765 * 48766 * @param {string} nextContent String of content. 48767 * @internal 48768 */ 48769 updateTextContent: function (nextContent) { 48770 updateDepth++; 48771 var errorThrown = true; 48772 try { 48773 var prevChildren = this._renderedChildren; 48774 // Remove any rendered children. 48775 ReactChildReconciler.unmountChildren(prevChildren); 48776 // TODO: The setTextContent operation should be enough 48777 for (var name in prevChildren) { 48778 if (prevChildren.hasOwnProperty(name)) { 48779 this._unmountChild(prevChildren[name]); 48780 } 48781 } 48782 // Set new text content. 48783 this.setTextContent(nextContent); 48784 errorThrown = false; 48785 } finally { 48786 updateDepth--; 48787 if (!updateDepth) { 48788 if (errorThrown) { 48789 clearQueue(); 48790 } else { 48791 processQueue(); 48792 } 48793 } 48794 } 48795 }, 48796 48797 /** 48798 * Replaces any rendered children with a markup string. 48799 * 48800 * @param {string} nextMarkup String of markup. 48801 * @internal 48802 */ 48803 updateMarkup: function (nextMarkup) { 48804 updateDepth++; 48805 var errorThrown = true; 48806 try { 48807 var prevChildren = this._renderedChildren; 48808 // Remove any rendered children. 48809 ReactChildReconciler.unmountChildren(prevChildren); 48810 for (var name in prevChildren) { 48811 if (prevChildren.hasOwnProperty(name)) { 48812 this._unmountChildByName(prevChildren[name], name); 48813 } 48814 } 48815 this.setMarkup(nextMarkup); 48816 errorThrown = false; 48817 } finally { 48818 updateDepth--; 48819 if (!updateDepth) { 48820 if (errorThrown) { 48821 clearQueue(); 48822 } else { 48823 processQueue(); 48824 } 48825 } 48826 } 48827 }, 48828 48829 /** 48830 * Updates the rendered children with new children. 48831 * 48832 * @param {?object} nextNestedChildrenElements Nested child element maps. 48833 * @param {ReactReconcileTransaction} transaction 48834 * @internal 48835 */ 48836 updateChildren: function (nextNestedChildrenElements, transaction, context) { 48837 updateDepth++; 48838 var errorThrown = true; 48839 try { 48840 this._updateChildren(nextNestedChildrenElements, transaction, context); 48841 errorThrown = false; 48842 } finally { 48843 updateDepth--; 48844 if (!updateDepth) { 48845 if (errorThrown) { 48846 clearQueue(); 48847 } else { 48848 processQueue(); 48849 } 48850 } 48851 } 48852 }, 48853 48854 /** 48855 * Improve performance by isolating this hot code path from the try/catch 48856 * block in `updateChildren`. 48857 * 48858 * @param {?object} nextNestedChildrenElements Nested child element maps. 48859 * @param {ReactReconcileTransaction} transaction 48860 * @final 48861 * @protected 48862 */ 48863 _updateChildren: function (nextNestedChildrenElements, transaction, context) { 48864 var prevChildren = this._renderedChildren; 48865 var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context); 48866 this._renderedChildren = nextChildren; 48867 if (!nextChildren && !prevChildren) { 48868 return; 48869 } 48870 var name; 48871 // `nextIndex` will increment for each child in `nextChildren`, but 48872 // `lastIndex` will be the last index visited in `prevChildren`. 48873 var lastIndex = 0; 48874 var nextIndex = 0; 48875 for (name in nextChildren) { 48876 if (!nextChildren.hasOwnProperty(name)) { 48877 continue; 48878 } 48879 var prevChild = prevChildren && prevChildren[name]; 48880 var nextChild = nextChildren[name]; 48881 if (prevChild === nextChild) { 48882 this.moveChild(prevChild, nextIndex, lastIndex); 48883 lastIndex = Math.max(prevChild._mountIndex, lastIndex); 48884 prevChild._mountIndex = nextIndex; 48885 } else { 48886 if (prevChild) { 48887 // Update `lastIndex` before `_mountIndex` gets unset by unmounting. 48888 lastIndex = Math.max(prevChild._mountIndex, lastIndex); 48889 this._unmountChild(prevChild); 48890 } 48891 // The child must be instantiated before it's mounted. 48892 this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context); 48893 } 48894 nextIndex++; 48895 } 48896 // Remove children that are no longer present. 48897 for (name in prevChildren) { 48898 if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { 48899 this._unmountChild(prevChildren[name]); 48900 } 48901 } 48902 }, 48903 48904 /** 48905 * Unmounts all rendered children. This should be used to clean up children 48906 * when this component is unmounted. 48907 * 48908 * @internal 48909 */ 48910 unmountChildren: function () { 48911 var renderedChildren = this._renderedChildren; 48912 ReactChildReconciler.unmountChildren(renderedChildren); 48913 this._renderedChildren = null; 48914 }, 48915 48916 /** 48917 * Moves a child component to the supplied index. 48918 * 48919 * @param {ReactComponent} child Component to move. 48920 * @param {number} toIndex Destination index of the element. 48921 * @param {number} lastIndex Last index visited of the siblings of `child`. 48922 * @protected 48923 */ 48924 moveChild: function (child, toIndex, lastIndex) { 48925 // If the index of `child` is less than `lastIndex`, then it needs to 48926 // be moved. Otherwise, we do not need to move it because a child will be 48927 // inserted or moved before `child`. 48928 if (child._mountIndex < lastIndex) { 48929 enqueueMove(this._rootNodeID, child._mountIndex, toIndex); 48930 } 48931 }, 48932 48933 /** 48934 * Creates a child component. 48935 * 48936 * @param {ReactComponent} child Component to create. 48937 * @param {string} mountImage Markup to insert. 48938 * @protected 48939 */ 48940 createChild: function (child, mountImage) { 48941 enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex); 48942 }, 48943 48944 /** 48945 * Removes a child component. 48946 * 48947 * @param {ReactComponent} child Child to remove. 48948 * @protected 48949 */ 48950 removeChild: function (child) { 48951 enqueueRemove(this._rootNodeID, child._mountIndex); 48952 }, 48953 48954 /** 48955 * Sets this text content string. 48956 * 48957 * @param {string} textContent Text content to set. 48958 * @protected 48959 */ 48960 setTextContent: function (textContent) { 48961 enqueueTextContent(this._rootNodeID, textContent); 48962 }, 48963 48964 /** 48965 * Sets this markup string. 48966 * 48967 * @param {string} markup Markup to set. 48968 * @protected 48969 */ 48970 setMarkup: function (markup) { 48971 enqueueSetMarkup(this._rootNodeID, markup); 48972 }, 48973 48974 /** 48975 * Mounts a child with the supplied name. 48976 * 48977 * NOTE: This is part of `updateChildren` and is here for readability. 48978 * 48979 * @param {ReactComponent} child Component to mount. 48980 * @param {string} name Name of the child. 48981 * @param {number} index Index at which to insert the child. 48982 * @param {ReactReconcileTransaction} transaction 48983 * @private 48984 */ 48985 _mountChildByNameAtIndex: function (child, name, index, transaction, context) { 48986 // Inlined for performance, see `ReactInstanceHandles.createReactID`. 48987 var rootID = this._rootNodeID + name; 48988 var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); 48989 child._mountIndex = index; 48990 this.createChild(child, mountImage); 48991 }, 48992 48993 /** 48994 * Unmounts a rendered child. 48995 * 48996 * NOTE: This is part of `updateChildren` and is here for readability. 48997 * 48998 * @param {ReactComponent} child Component to unmount. 48999 * @private 49000 */ 49001 _unmountChild: function (child) { 49002 this.removeChild(child); 49003 child._mountIndex = null; 49004 } 49005 49006 } 49007 49008}; 49009 49010module.exports = ReactMultiChild; 49011 49012/***/ }), 49013
vendor: 1,286 bytes, lines 49014-49056
49014/***/ "./node_modules/react/lib/ReactMultiChildUpdateTypes.js": 49015/*!**************************************************************!*\ 49016 !*** ./node_modules/react/lib/ReactMultiChildUpdateTypes.js ***! 49017 \**************************************************************/ 49018/*! no static exports found */ 49019/***/ (function(module, exports, __webpack_require__) { 49020 49021"use strict"; 49022/** 49023 * Copyright 2013-2015, Facebook, Inc. 49024 * All rights reserved. 49025 * 49026 * This source code is licensed under the BSD-style license found in the 49027 * LICENSE file in the root directory of this source tree. An additional grant 49028 * of patent rights can be found in the PATENTS file in the same directory. 49029 * 49030 * @providesModule ReactMultiChildUpdateTypes 49031 */ 49032 49033 49034 49035var keyMirror = __webpack_require__(/*! fbjs/lib/keyMirror */ "./node_modules/fbjs/lib/keyMirror.js"); 49036 49037/** 49038 * When a component's children are updated, a series of update configuration 49039 * objects are created in order to batch and serialize the required changes. 49040 * 49041 * Enumerates all the possible types of update configurations. 49042 * 49043 * @internal 49044 */ 49045var ReactMultiChildUpdateTypes = keyMirror({ 49046 INSERT_MARKUP: null, 49047 MOVE_EXISTING: null, 49048 REMOVE_NODE: null, 49049 SET_MARKUP: null, 49050 TEXT_CONTENT: null 49051}); 49052 49053module.exports = ReactMultiChildUpdateTypes; 49054 49055/***/ }), 49056
vendor: 3,443 bytes, lines 49057-49161
49057/***/ "./node_modules/react/lib/ReactNativeComponent.js": 49058/*!********************************************************!*\ 49059 !*** ./node_modules/react/lib/ReactNativeComponent.js ***! 49060 \********************************************************/ 49061/*! no static exports found */ 49062/***/ (function(module, exports, __webpack_require__) { 49063 49064"use strict"; 49065/** 49066 * Copyright 2014-2015, Facebook, Inc. 49067 * All rights reserved. 49068 * 49069 * This source code is licensed under the BSD-style license found in the 49070 * LICENSE file in the root directory of this source tree. An additional grant 49071 * of patent rights can be found in the PATENTS file in the same directory. 49072 * 49073 * @providesModule ReactNativeComponent 49074 */ 49075 49076 49077 49078var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 49079var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 49080 49081var autoGenerateWrapperClass = null; 49082var genericComponentClass = null; 49083// This registry keeps track of wrapper classes around native tags. 49084var tagToComponentClass = {}; 49085var textComponentClass = null; 49086 49087var ReactNativeComponentInjection = { 49088 // This accepts a class that receives the tag string. This is a catch all 49089 // that can render any kind of tag. 49090 injectGenericComponentClass: function (componentClass) { 49091 genericComponentClass = componentClass; 49092 }, 49093 // This accepts a text component class that takes the text string to be 49094 // rendered as props. 49095 injectTextComponentClass: function (componentClass) { 49096 textComponentClass = componentClass; 49097 }, 49098 // This accepts a keyed object with classes as values. Each key represents a 49099 // tag. That particular tag will use this class instead of the generic one. 49100 injectComponentClasses: function (componentClasses) { 49101 assign(tagToComponentClass, componentClasses); 49102 } 49103}; 49104 49105/** 49106 * Get a composite component wrapper class for a specific tag. 49107 * 49108 * @param {ReactElement} element The tag for which to get the class. 49109 * @return {function} The React class constructor function. 49110 */ 49111function getComponentClassForElement(element) { 49112 if (typeof element.type === 'function') { 49113 return element.type; 49114 } 49115 var tag = element.type; 49116 var componentClass = tagToComponentClass[tag]; 49117 if (componentClass == null) { 49118 tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag); 49119 } 49120 return componentClass; 49121} 49122 49123/** 49124 * Get a native internal component class for a specific tag. 49125 * 49126 * @param {ReactElement} element The element to create. 49127 * @return {function} The internal class constructor function. 49128 */ 49129function createInternalComponent(element) { 49130 !genericComponentClass ? true ? invariant(false, 'There is no registered component for the tag %s', element.type) : undefined : undefined; 49131 return new genericComponentClass(element.type, element.props); 49132} 49133 49134/** 49135 * @param {ReactText} text 49136 * @return {ReactComponent} 49137 */ 49138function createInstanceForText(text) { 49139 return new textComponentClass(text); 49140} 49141 49142/** 49143 * @param {ReactComponent} component 49144 * @return {boolean} 49145 */ 49146function isTextComponent(component) { 49147 return component instanceof textComponentClass; 49148} 49149 49150var ReactNativeComponent = { 49151 getComponentClassForElement: getComponentClassForElement, 49152 createInternalComponent: createInternalComponent, 49153 createInstanceForText: createInstanceForText, 49154 isTextComponent: isTextComponent, 49155 injection: ReactNativeComponentInjection 49156}; 49157 49158module.exports = ReactNativeComponent; 49159 49160/***/ }), 49161
vendor: 4,271 bytes, lines 49162-49290
49162/***/ "./node_modules/react/lib/ReactNoopUpdateQueue.js": 49163/*!********************************************************!*\ 49164 !*** ./node_modules/react/lib/ReactNoopUpdateQueue.js ***! 49165 \********************************************************/ 49166/*! no static exports found */ 49167/***/ (function(module, exports, __webpack_require__) { 49168 49169"use strict"; 49170/** 49171 * Copyright 2015, Facebook, Inc. 49172 * All rights reserved. 49173 * 49174 * This source code is licensed under the BSD-style license found in the 49175 * LICENSE file in the root directory of this source tree. An additional grant 49176 * of patent rights can be found in the PATENTS file in the same directory. 49177 * 49178 * @providesModule ReactNoopUpdateQueue 49179 */ 49180 49181 49182 49183var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 49184 49185function warnTDZ(publicInstance, callerName) { 49186 if (true) { 49187 true ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined; 49188 } 49189} 49190 49191/** 49192 * This is the abstract API for an update queue. 49193 */ 49194var ReactNoopUpdateQueue = { 49195 49196 /** 49197 * Checks whether or not this composite component is mounted. 49198 * @param {ReactClass} publicInstance The instance we want to test. 49199 * @return {boolean} True if mounted, false otherwise. 49200 * @protected 49201 * @final 49202 */ 49203 isMounted: function (publicInstance) { 49204 return false; 49205 }, 49206 49207 /** 49208 * Enqueue a callback that will be executed after all the pending updates 49209 * have processed. 49210 * 49211 * @param {ReactClass} publicInstance The instance to use as `this` context. 49212 * @param {?function} callback Called after state is updated. 49213 * @internal 49214 */ 49215 enqueueCallback: function (publicInstance, callback) {}, 49216 49217 /** 49218 * Forces an update. This should only be invoked when it is known with 49219 * certainty that we are **not** in a DOM transaction. 49220 * 49221 * You may want to call this when you know that some deeper aspect of the 49222 * component's state has changed but `setState` was not called. 49223 * 49224 * This will not invoke `shouldComponentUpdate`, but it will invoke 49225 * `componentWillUpdate` and `componentDidUpdate`. 49226 * 49227 * @param {ReactClass} publicInstance The instance that should rerender. 49228 * @internal 49229 */ 49230 enqueueForceUpdate: function (publicInstance) { 49231 warnTDZ(publicInstance, 'forceUpdate'); 49232 }, 49233 49234 /** 49235 * Replaces all of the state. Always use this or `setState` to mutate state. 49236 * You should treat `this.state` as immutable. 49237 * 49238 * There is no guarantee that `this.state` will be immediately updated, so 49239 * accessing `this.state` after calling this method may return the old value. 49240 * 49241 * @param {ReactClass} publicInstance The instance that should rerender. 49242 * @param {object} completeState Next state. 49243 * @internal 49244 */ 49245 enqueueReplaceState: function (publicInstance, completeState) { 49246 warnTDZ(publicInstance, 'replaceState'); 49247 }, 49248 49249 /** 49250 * Sets a subset of the state. This only exists because _pendingState is 49251 * internal. This provides a merging strategy that is not available to deep 49252 * properties which is confusing. TODO: Expose pendingState or don't use it 49253 * during the merge. 49254 * 49255 * @param {ReactClass} publicInstance The instance that should rerender. 49256 * @param {object} partialState Next partial state to be merged with state. 49257 * @internal 49258 */ 49259 enqueueSetState: function (publicInstance, partialState) { 49260 warnTDZ(publicInstance, 'setState'); 49261 }, 49262 49263 /** 49264 * Sets a subset of the props. 49265 * 49266 * @param {ReactClass} publicInstance The instance that should rerender. 49267 * @param {object} partialProps Subset of the next props. 49268 * @internal 49269 */ 49270 enqueueSetProps: function (publicInstance, partialProps) { 49271 warnTDZ(publicInstance, 'setProps'); 49272 }, 49273 49274 /** 49275 * Replaces all of the props. 49276 * 49277 * @param {ReactClass} publicInstance The instance that should rerender. 49278 * @param {object} props New props. 49279 * @internal 49280 */ 49281 enqueueReplaceProps: function (publicInstance, props) { 49282 warnTDZ(publicInstance, 'replaceProps'); 49283 } 49284 49285}; 49286 49287module.exports = ReactNoopUpdateQueue; 49288 49289/***/ }), 49290
vendor: 3,729 bytes, lines 49291-49392
49291/***/ "./node_modules/react/lib/ReactOwner.js": 49292/*!**********************************************!*\ 49293 !*** ./node_modules/react/lib/ReactOwner.js ***! 49294 \**********************************************/ 49295/*! no static exports found */ 49296/***/ (function(module, exports, __webpack_require__) { 49297 49298"use strict"; 49299/** 49300 * Copyright 2013-2015, Facebook, Inc. 49301 * All rights reserved. 49302 * 49303 * This source code is licensed under the BSD-style license found in the 49304 * LICENSE file in the root directory of this source tree. An additional grant 49305 * of patent rights can be found in the PATENTS file in the same directory. 49306 * 49307 * @providesModule ReactOwner 49308 */ 49309 49310 49311 49312var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 49313 49314/** 49315 * ReactOwners are capable of storing references to owned components. 49316 * 49317 * All components are capable of //being// referenced by owner components, but 49318 * only ReactOwner components are capable of //referencing// owned components. 49319 * The named reference is known as a "ref". 49320 * 49321 * Refs are available when mounted and updated during reconciliation. 49322 * 49323 * var MyComponent = React.createClass({ 49324 * render: function() { 49325 * return ( 49326 * <div onClick={this.handleClick}> 49327 * <CustomComponent ref="custom" /> 49328 * </div> 49329 * ); 49330 * }, 49331 * handleClick: function() { 49332 * this.refs.custom.handleClick(); 49333 * }, 49334 * componentDidMount: function() { 49335 * this.refs.custom.initialize(); 49336 * } 49337 * }); 49338 * 49339 * Refs should rarely be used. When refs are used, they should only be done to 49340 * control data that is not handled by React's data flow. 49341 * 49342 * @class ReactOwner 49343 */ 49344var ReactOwner = { 49345 49346 /** 49347 * @param {?object} object 49348 * @return {boolean} True if `object` is a valid owner. 49349 * @final 49350 */ 49351 isValidOwner: function (object) { 49352 return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); 49353 }, 49354 49355 /** 49356 * Adds a component by ref to an owner component. 49357 * 49358 * @param {ReactComponent} component Component to reference. 49359 * @param {string} ref Name by which to refer to the component. 49360 * @param {ReactOwner} owner Component on which to record the ref. 49361 * @final 49362 * @internal 49363 */ 49364 addComponentAsRefTo: function (component, ref, owner) { 49365 !ReactOwner.isValidOwner(owner) ? true ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : undefined : undefined; 49366 owner.attachRef(ref, component); 49367 }, 49368 49369 /** 49370 * Removes a component by ref from an owner component. 49371 * 49372 * @param {ReactComponent} component Component to dereference. 49373 * @param {string} ref Name of the ref to remove. 49374 * @param {ReactOwner} owner Component on which the ref is recorded. 49375 * @final 49376 * @internal 49377 */ 49378 removeComponentAsRefFrom: function (component, ref, owner) { 49379 !ReactOwner.isValidOwner(owner) ? true ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : undefined : undefined; 49380 // Check that `component` is still the current ref because we do not want to 49381 // detach the ref if another component stole it. 49382 if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) { 49383 owner.detachRef(ref); 49384 } 49385 } 49386 49387}; 49388 49389module.exports = ReactOwner; 49390 49391/***/ }), 49392
vendor: 2,745 bytes, lines 49393-49499
49393/***/ "./node_modules/react/lib/ReactPerf.js": 49394/*!*********************************************!*\ 49395 !*** ./node_modules/react/lib/ReactPerf.js ***! 49396 \*********************************************/ 49397/*! no static exports found */ 49398/***/ (function(module, exports, __webpack_require__) { 49399 49400"use strict"; 49401/** 49402 * Copyright 2013-2015, Facebook, Inc. 49403 * All rights reserved. 49404 * 49405 * This source code is licensed under the BSD-style license found in the 49406 * LICENSE file in the root directory of this source tree. An additional grant 49407 * of patent rights can be found in the PATENTS file in the same directory. 49408 * 49409 * @providesModule ReactPerf 49410 * @typechecks static-only 49411 */ 49412 49413 49414 49415/** 49416 * ReactPerf is a general AOP system designed to measure performance. This 49417 * module only has the hooks: see ReactDefaultPerf for the analysis tool. 49418 */ 49419var ReactPerf = { 49420 /** 49421 * Boolean to enable/disable measurement. Set to false by default to prevent 49422 * accidental logging and perf loss. 49423 */ 49424 enableMeasure: false, 49425 49426 /** 49427 * Holds onto the measure function in use. By default, don't measure 49428 * anything, but we'll override this if we inject a measure function. 49429 */ 49430 storedMeasure: _noMeasure, 49431 49432 /** 49433 * @param {object} object 49434 * @param {string} objectName 49435 * @param {object<string>} methodNames 49436 */ 49437 measureMethods: function (object, objectName, methodNames) { 49438 if (true) { 49439 for (var key in methodNames) { 49440 if (!methodNames.hasOwnProperty(key)) { 49441 continue; 49442 } 49443 object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]); 49444 } 49445 } 49446 }, 49447 49448 /** 49449 * Use this to wrap methods you want to measure. Zero overhead in production. 49450 * 49451 * @param {string} objName 49452 * @param {string} fnName 49453 * @param {function} func 49454 * @return {function} 49455 */ 49456 measure: function (objName, fnName, func) { 49457 if (true) { 49458 var measuredFunc = null; 49459 var wrapper = function () { 49460 if (ReactPerf.enableMeasure) { 49461 if (!measuredFunc) { 49462 measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); 49463 } 49464 return measuredFunc.apply(this, arguments); 49465 } 49466 return func.apply(this, arguments); 49467 }; 49468 wrapper.displayName = objName + '_' + fnName; 49469 return wrapper; 49470 } 49471 return func; 49472 }, 49473 49474 injection: { 49475 /** 49476 * @param {function} measure 49477 */ 49478 injectMeasure: function (measure) { 49479 ReactPerf.storedMeasure = measure; 49480 } 49481 } 49482}; 49483 49484/** 49485 * Simply passes through the measured function, without measuring it. 49486 * 49487 * @param {string} objName 49488 * @param {string} fnName 49489 * @param {function} func 49490 * @return {function} 49491 */ 49492function _noMeasure(objName, fnName, func) { 49493 return func; 49494} 49495 49496module.exports = ReactPerf; 49497 49498/***/ }), 49499
vendor: 947 bytes, lines 49500-49534
49500/***/ "./node_modules/react/lib/ReactPropTypeLocationNames.js": 49501/*!**************************************************************!*\ 49502 !*** ./node_modules/react/lib/ReactPropTypeLocationNames.js ***! 49503 \**************************************************************/ 49504/*! no static exports found */ 49505/***/ (function(module, exports, __webpack_require__) { 49506 49507"use strict"; 49508/** 49509 * Copyright 2013-2015, Facebook, Inc. 49510 * All rights reserved. 49511 * 49512 * This source code is licensed under the BSD-style license found in the 49513 * LICENSE file in the root directory of this source tree. An additional grant 49514 * of patent rights can be found in the PATENTS file in the same directory. 49515 * 49516 * @providesModule ReactPropTypeLocationNames 49517 */ 49518 49519 49520 49521var ReactPropTypeLocationNames = {}; 49522 49523if (true) { 49524 ReactPropTypeLocationNames = { 49525 prop: 'prop', 49526 context: 'context', 49527 childContext: 'child context' 49528 }; 49529} 49530 49531module.exports = ReactPropTypeLocationNames; 49532 49533/***/ }), 49534
vendor: 958 bytes, lines 49535-49567
49535/***/ "./node_modules/react/lib/ReactPropTypeLocations.js": 49536/*!**********************************************************!*\ 49537 !*** ./node_modules/react/lib/ReactPropTypeLocations.js ***! 49538 \**********************************************************/ 49539/*! no static exports found */ 49540/***/ (function(module, exports, __webpack_require__) { 49541 49542"use strict"; 49543/** 49544 * Copyright 2013-2015, Facebook, Inc. 49545 * All rights reserved. 49546 * 49547 * This source code is licensed under the BSD-style license found in the 49548 * LICENSE file in the root directory of this source tree. An additional grant 49549 * of patent rights can be found in the PATENTS file in the same directory. 49550 * 49551 * @providesModule ReactPropTypeLocations 49552 */ 49553 49554 49555 49556var keyMirror = __webpack_require__(/*! fbjs/lib/keyMirror */ "./node_modules/fbjs/lib/keyMirror.js"); 49557 49558var ReactPropTypeLocations = keyMirror({ 49559 prop: null, 49560 context: null, 49561 childContext: null 49562}); 49563 49564module.exports = ReactPropTypeLocations; 49565 49566/***/ }), 49567
vendor: 13,114 bytes, lines 49568-49934
49568/***/ "./node_modules/react/lib/ReactPropTypes.js": 49569/*!**************************************************!*\ 49570 !*** ./node_modules/react/lib/ReactPropTypes.js ***! 49571 \**************************************************/ 49572/*! no static exports found */ 49573/***/ (function(module, exports, __webpack_require__) { 49574 49575"use strict"; 49576/** 49577 * Copyright 2013-2015, Facebook, Inc. 49578 * All rights reserved. 49579 * 49580 * This source code is licensed under the BSD-style license found in the 49581 * LICENSE file in the root directory of this source tree. An additional grant 49582 * of patent rights can be found in the PATENTS file in the same directory. 49583 * 49584 * @providesModule ReactPropTypes 49585 */ 49586 49587 49588 49589var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 49590var ReactPropTypeLocationNames = __webpack_require__(/*! ./ReactPropTypeLocationNames */ "./node_modules/react/lib/ReactPropTypeLocationNames.js"); 49591 49592var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 49593var getIteratorFn = __webpack_require__(/*! ./getIteratorFn */ "./node_modules/react/lib/getIteratorFn.js"); 49594 49595/** 49596 * Collection of methods that allow declaration and validation of props that are 49597 * supplied to React components. Example usage: 49598 * 49599 * var Props = require('ReactPropTypes'); 49600 * var MyArticle = React.createClass({ 49601 * propTypes: { 49602 * // An optional string prop named "description". 49603 * description: Props.string, 49604 * 49605 * // A required enum prop named "category". 49606 * category: Props.oneOf(['News','Photos']).isRequired, 49607 * 49608 * // A prop named "dialog" that requires an instance of Dialog. 49609 * dialog: Props.instanceOf(Dialog).isRequired 49610 * }, 49611 * render: function() { ... } 49612 * }); 49613 * 49614 * A more formal specification of how these methods are used: 49615 * 49616 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) 49617 * decl := ReactPropTypes.{type}(.isRequired)? 49618 * 49619 * Each and every declaration produces a function with the same signature. This 49620 * allows the creation of custom validation functions. For example: 49621 * 49622 * var MyLink = React.createClass({ 49623 * propTypes: { 49624 * // An optional string or URI prop named "href". 49625 * href: function(props, propName, componentName) { 49626 * var propValue = props[propName]; 49627 * if (propValue != null && typeof propValue !== 'string' && 49628 * !(propValue instanceof URI)) { 49629 * return new Error( 49630 * 'Expected a string or an URI for ' + propName + ' in ' + 49631 * componentName 49632 * ); 49633 * } 49634 * } 49635 * }, 49636 * render: function() {...} 49637 * }); 49638 * 49639 * @internal 49640 */ 49641 49642var ANONYMOUS = '<<anonymous>>'; 49643 49644var ReactPropTypes = { 49645 array: createPrimitiveTypeChecker('array'), 49646 bool: createPrimitiveTypeChecker('boolean'), 49647 func: createPrimitiveTypeChecker('function'), 49648 number: createPrimitiveTypeChecker('number'), 49649 object: createPrimitiveTypeChecker('object'), 49650 string: createPrimitiveTypeChecker('string'), 49651 49652 any: createAnyTypeChecker(), 49653 arrayOf: createArrayOfTypeChecker, 49654 element: createElementTypeChecker(), 49655 instanceOf: createInstanceTypeChecker, 49656 node: createNodeChecker(), 49657 objectOf: createObjectOfTypeChecker, 49658 oneOf: createEnumTypeChecker, 49659 oneOfType: createUnionTypeChecker, 49660 shape: createShapeTypeChecker 49661}; 49662 49663function createChainableTypeChecker(validate) { 49664 function checkType(isRequired, props, propName, componentName, location, propFullName) { 49665 componentName = componentName || ANONYMOUS; 49666 propFullName = propFullName || propName; 49667 if (props[propName] == null) { 49668 var locationName = ReactPropTypeLocationNames[location]; 49669 if (isRequired) { 49670 return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.')); 49671 } 49672 return null; 49673 } else { 49674 return validate(props, propName, componentName, location, propFullName); 49675 } 49676 } 49677 49678 var chainedCheckType = checkType.bind(null, false); 49679 chainedCheckType.isRequired = checkType.bind(null, true); 49680 49681 return chainedCheckType; 49682} 49683 49684function createPrimitiveTypeChecker(expectedType) { 49685 function validate(props, propName, componentName, location, propFullName) { 49686 var propValue = props[propName]; 49687 var propType = getPropType(propValue); 49688 if (propType !== expectedType) { 49689 var locationName = ReactPropTypeLocationNames[location]; 49690 // `propValue` being instance of, say, date/regexp, pass the 'object' 49691 // check, but we can offer a more precise error message here rather than 49692 // 'of type `object`'. 49693 var preciseType = getPreciseType(propValue); 49694 49695 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); 49696 } 49697 return null; 49698 } 49699 return createChainableTypeChecker(validate); 49700} 49701 49702function createAnyTypeChecker() { 49703 return createChainableTypeChecker(emptyFunction.thatReturns(null)); 49704} 49705 49706function createArrayOfTypeChecker(typeChecker) { 49707 function validate(props, propName, componentName, location, propFullName) { 49708 var propValue = props[propName]; 49709 if (!Array.isArray(propValue)) { 49710 var locationName = ReactPropTypeLocationNames[location]; 49711 var propType = getPropType(propValue); 49712 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); 49713 } 49714 for (var i = 0; i < propValue.length; i++) { 49715 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 49716 if (error instanceof Error) { 49717 return error; 49718 } 49719 } 49720 return null; 49721 } 49722 return createChainableTypeChecker(validate); 49723} 49724 49725function createElementTypeChecker() { 49726 function validate(props, propName, componentName, location, propFullName) { 49727 if (!ReactElement.isValidElement(props[propName])) { 49728 var locationName = ReactPropTypeLocationNames[location]; 49729 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.')); 49730 } 49731 return null; 49732 } 49733 return createChainableTypeChecker(validate); 49734} 49735 49736function createInstanceTypeChecker(expectedClass) { 49737 function validate(props, propName, componentName, location, propFullName) { 49738 if (!(props[propName] instanceof expectedClass)) { 49739 var locationName = ReactPropTypeLocationNames[location]; 49740 var expectedClassName = expectedClass.name || ANONYMOUS; 49741 var actualClassName = getClassName(props[propName]); 49742 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); 49743 } 49744 return null; 49745 } 49746 return createChainableTypeChecker(validate); 49747} 49748 49749function createEnumTypeChecker(expectedValues) { 49750 if (!Array.isArray(expectedValues)) { 49751 return createChainableTypeChecker(function () { 49752 return new Error('Invalid argument supplied to oneOf, expected an instance of array.'); 49753 }); 49754 } 49755 49756 function validate(props, propName, componentName, location, propFullName) { 49757 var propValue = props[propName]; 49758 for (var i = 0; i < expectedValues.length; i++) { 49759 if (propValue === expectedValues[i]) { 49760 return null; 49761 } 49762 } 49763 49764 var locationName = ReactPropTypeLocationNames[location]; 49765 var valuesString = JSON.stringify(expectedValues); 49766 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); 49767 } 49768 return createChainableTypeChecker(validate); 49769} 49770 49771function createObjectOfTypeChecker(typeChecker) { 49772 function validate(props, propName, componentName, location, propFullName) { 49773 var propValue = props[propName]; 49774 var propType = getPropType(propValue); 49775 if (propType !== 'object') { 49776 var locationName = ReactPropTypeLocationNames[location]; 49777 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); 49778 } 49779 for (var key in propValue) { 49780 if (propValue.hasOwnProperty(key)) { 49781 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 49782 if (error instanceof Error) { 49783 return error; 49784 } 49785 } 49786 } 49787 return null; 49788 } 49789 return createChainableTypeChecker(validate); 49790} 49791 49792function createUnionTypeChecker(arrayOfTypeCheckers) { 49793 if (!Array.isArray(arrayOfTypeCheckers)) { 49794 return createChainableTypeChecker(function () { 49795 return new Error('Invalid argument supplied to oneOfType, expected an instance of array.'); 49796 }); 49797 } 49798 49799 function validate(props, propName, componentName, location, propFullName) { 49800 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 49801 var checker = arrayOfTypeCheckers[i]; 49802 if (checker(props, propName, componentName, location, propFullName, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED') == null) { 49803 return null; 49804 } 49805 } 49806 49807 var locationName = ReactPropTypeLocationNames[location]; 49808 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); 49809 } 49810 return createChainableTypeChecker(validate); 49811} 49812 49813function createNodeChecker() { 49814 function validate(props, propName, componentName, location, propFullName) { 49815 if (!isNode(props[propName])) { 49816 var locationName = ReactPropTypeLocationNames[location]; 49817 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); 49818 } 49819 return null; 49820 } 49821 return createChainableTypeChecker(validate); 49822} 49823 49824function createShapeTypeChecker(shapeTypes) { 49825 function validate(props, propName, componentName, location, propFullName) { 49826 var propValue = props[propName]; 49827 var propType = getPropType(propValue); 49828 if (propType !== 'object') { 49829 var locationName = ReactPropTypeLocationNames[location]; 49830 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 49831 } 49832 for (var key in shapeTypes) { 49833 var checker = shapeTypes[key]; 49834 if (!checker) { 49835 continue; 49836 } 49837 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 49838 if (error) { 49839 return error; 49840 } 49841 } 49842 return null; 49843 } 49844 return createChainableTypeChecker(validate); 49845} 49846 49847function isNode(propValue) { 49848 switch (typeof propValue) { 49849 case 'number': 49850 case 'string': 49851 case 'undefined': 49852 return true; 49853 case 'boolean': 49854 return !propValue; 49855 case 'object': 49856 if (Array.isArray(propValue)) { 49857 return propValue.every(isNode); 49858 } 49859 if (propValue === null || ReactElement.isValidElement(propValue)) { 49860 return true; 49861 } 49862 49863 var iteratorFn = getIteratorFn(propValue); 49864 if (iteratorFn) { 49865 var iterator = iteratorFn.call(propValue); 49866 var step; 49867 if (iteratorFn !== propValue.entries) { 49868 while (!(step = iterator.next()).done) { 49869 if (!isNode(step.value)) { 49870 return false; 49871 } 49872 } 49873 } else { 49874 // Iterator will provide entry [k,v] tuples rather than values. 49875 while (!(step = iterator.next()).done) { 49876 var entry = step.value; 49877 if (entry) { 49878 if (!isNode(entry[1])) { 49879 return false; 49880 } 49881 } 49882 } 49883 } 49884 } else { 49885 return false; 49886 } 49887 49888 return true; 49889 default: 49890 return false; 49891 } 49892} 49893 49894// Equivalent of `typeof` but with special handling for array and regexp. 49895function getPropType(propValue) { 49896 var propType = typeof propValue; 49897 if (Array.isArray(propValue)) { 49898 return 'array'; 49899 } 49900 if (propValue instanceof RegExp) { 49901 // Old webkits (at least until Android 4.0) return 'function' rather than 49902 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ 49903 // passes PropTypes.object. 49904 return 'object'; 49905 } 49906 return propType; 49907} 49908 49909// This handles more types than `getPropType`. Only used for error messages. 49910// See `createPrimitiveTypeChecker`. 49911function getPreciseType(propValue) { 49912 var propType = getPropType(propValue); 49913 if (propType === 'object') { 49914 if (propValue instanceof Date) { 49915 return 'date'; 49916 } else if (propValue instanceof RegExp) { 49917 return 'regexp'; 49918 } 49919 } 49920 return propType; 49921} 49922 49923// Returns class name of the object, if any. 49924function getClassName(propValue) { 49925 if (!propValue.constructor || !propValue.constructor.name) { 49926 return '<<anonymous>>'; 49927 } 49928 return propValue.constructor.name; 49929} 49930 49931module.exports = ReactPropTypes; 49932 49933/***/ }), 49934
vendor: 5,393 bytes, lines 49935-50096
49935/***/ "./node_modules/react/lib/ReactReconcileTransaction.js": 49936/*!*************************************************************!*\ 49937 !*** ./node_modules/react/lib/ReactReconcileTransaction.js ***! 49938 \*************************************************************/ 49939/*! no static exports found */ 49940/***/ (function(module, exports, __webpack_require__) { 49941 49942"use strict"; 49943/** 49944 * Copyright 2013-2015, Facebook, Inc. 49945 * All rights reserved. 49946 * 49947 * This source code is licensed under the BSD-style license found in the 49948 * LICENSE file in the root directory of this source tree. An additional grant 49949 * of patent rights can be found in the PATENTS file in the same directory. 49950 * 49951 * @providesModule ReactReconcileTransaction 49952 * @typechecks static-only 49953 */ 49954 49955 49956 49957var CallbackQueue = __webpack_require__(/*! ./CallbackQueue */ "./node_modules/react/lib/CallbackQueue.js"); 49958var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 49959var ReactBrowserEventEmitter = __webpack_require__(/*! ./ReactBrowserEventEmitter */ "./node_modules/react/lib/ReactBrowserEventEmitter.js"); 49960var ReactDOMFeatureFlags = __webpack_require__(/*! ./ReactDOMFeatureFlags */ "./node_modules/react/lib/ReactDOMFeatureFlags.js"); 49961var ReactInputSelection = __webpack_require__(/*! ./ReactInputSelection */ "./node_modules/react/lib/ReactInputSelection.js"); 49962var Transaction = __webpack_require__(/*! ./Transaction */ "./node_modules/react/lib/Transaction.js"); 49963 49964var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 49965 49966/** 49967 * Ensures that, when possible, the selection range (currently selected text 49968 * input) is not disturbed by performing the transaction. 49969 */ 49970var SELECTION_RESTORATION = { 49971 /** 49972 * @return {Selection} Selection information. 49973 */ 49974 initialize: ReactInputSelection.getSelectionInformation, 49975 /** 49976 * @param {Selection} sel Selection information returned from `initialize`. 49977 */ 49978 close: ReactInputSelection.restoreSelection 49979}; 49980 49981/** 49982 * Suppresses events (blur/focus) that could be inadvertently dispatched due to 49983 * high level DOM manipulations (like temporarily removing a text input from the 49984 * DOM). 49985 */ 49986var EVENT_SUPPRESSION = { 49987 /** 49988 * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before 49989 * the reconciliation. 49990 */ 49991 initialize: function () { 49992 var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); 49993 ReactBrowserEventEmitter.setEnabled(false); 49994 return currentlyEnabled; 49995 }, 49996 49997 /** 49998 * @param {boolean} previouslyEnabled Enabled status of 49999 * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` 50000 * restores the previous value. 50001 */ 50002 close: function (previouslyEnabled) { 50003 ReactBrowserEventEmitter.setEnabled(previouslyEnabled); 50004 } 50005}; 50006 50007/** 50008 * Provides a queue for collecting `componentDidMount` and 50009 * `componentDidUpdate` callbacks during the the transaction. 50010 */ 50011var ON_DOM_READY_QUEUEING = { 50012 /** 50013 * Initializes the internal `onDOMReady` queue. 50014 */ 50015 initialize: function () { 50016 this.reactMountReady.reset(); 50017 }, 50018 50019 /** 50020 * After DOM is flushed, invoke all registered `onDOMReady` callbacks. 50021 */ 50022 close: function () { 50023 this.reactMountReady.notifyAll(); 50024 } 50025}; 50026 50027/** 50028 * Executed within the scope of the `Transaction` instance. Consider these as 50029 * being member methods, but with an implied ordering while being isolated from 50030 * each other. 50031 */ 50032var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; 50033 50034/** 50035 * Currently: 50036 * - The order that these are listed in the transaction is critical: 50037 * - Suppresses events. 50038 * - Restores selection range. 50039 * 50040 * Future: 50041 * - Restore document/overflow scroll positions that were unintentionally 50042 * modified via DOM insertions above the top viewport boundary. 50043 * - Implement/integrate with customized constraint based layout system and keep 50044 * track of which dimensions must be remeasured. 50045 * 50046 * @class ReactReconcileTransaction 50047 */ 50048function ReactReconcileTransaction(forceHTML) { 50049 this.reinitializeTransaction(); 50050 // Only server-side rendering really needs this option (see 50051 // `ReactServerRendering`), but server-side uses 50052 // `ReactServerRenderingTransaction` instead. This option is here so that it's 50053 // accessible and defaults to false when `ReactDOMComponent` and 50054 // `ReactTextComponent` checks it in `mountComponent`.` 50055 this.renderToStaticMarkup = false; 50056 this.reactMountReady = CallbackQueue.getPooled(null); 50057 this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement; 50058} 50059 50060var Mixin = { 50061 /** 50062 * @see Transaction 50063 * @abstract 50064 * @final 50065 * @return {array<object>} List of operation wrap procedures. 50066 * TODO: convert to array<TransactionWrapper> 50067 */ 50068 getTransactionWrappers: function () { 50069 return TRANSACTION_WRAPPERS; 50070 }, 50071 50072 /** 50073 * @return {object} The queue to collect `onDOMReady` callbacks with. 50074 */ 50075 getReactMountReady: function () { 50076 return this.reactMountReady; 50077 }, 50078 50079 /** 50080 * `PooledClass` looks for this, and will invoke this before allowing this 50081 * instance to be reused. 50082 */ 50083 destructor: function () { 50084 CallbackQueue.release(this.reactMountReady); 50085 this.reactMountReady = null; 50086 } 50087}; 50088 50089assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); 50090 50091PooledClass.addPoolingTo(ReactReconcileTransaction); 50092 50093module.exports = ReactReconcileTransaction; 50094 50095/***/ }), 50096
vendor: 3,931 bytes, lines 50097-50214
50097/***/ "./node_modules/react/lib/ReactReconciler.js": 50098/*!***************************************************!*\ 50099 !*** ./node_modules/react/lib/ReactReconciler.js ***! 50100 \***************************************************/ 50101/*! no static exports found */ 50102/***/ (function(module, exports, __webpack_require__) { 50103 50104"use strict"; 50105/** 50106 * Copyright 2013-2015, Facebook, Inc. 50107 * All rights reserved. 50108 * 50109 * This source code is licensed under the BSD-style license found in the 50110 * LICENSE file in the root directory of this source tree. An additional grant 50111 * of patent rights can be found in the PATENTS file in the same directory. 50112 * 50113 * @providesModule ReactReconciler 50114 */ 50115 50116 50117 50118var ReactRef = __webpack_require__(/*! ./ReactRef */ "./node_modules/react/lib/ReactRef.js"); 50119 50120/** 50121 * Helper to call ReactRef.attachRefs with this composite component, split out 50122 * to avoid allocations in the transaction mount-ready queue. 50123 */ 50124function attachRefs() { 50125 ReactRef.attachRefs(this, this._currentElement); 50126} 50127 50128var ReactReconciler = { 50129 50130 /** 50131 * Initializes the component, renders markup, and registers event listeners. 50132 * 50133 * @param {ReactComponent} internalInstance 50134 * @param {string} rootID DOM ID of the root node. 50135 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 50136 * @return {?string} Rendered markup to be inserted into the DOM. 50137 * @final 50138 * @internal 50139 */ 50140 mountComponent: function (internalInstance, rootID, transaction, context) { 50141 var markup = internalInstance.mountComponent(rootID, transaction, context); 50142 if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { 50143 transaction.getReactMountReady().enqueue(attachRefs, internalInstance); 50144 } 50145 return markup; 50146 }, 50147 50148 /** 50149 * Releases any resources allocated by `mountComponent`. 50150 * 50151 * @final 50152 * @internal 50153 */ 50154 unmountComponent: function (internalInstance) { 50155 ReactRef.detachRefs(internalInstance, internalInstance._currentElement); 50156 internalInstance.unmountComponent(); 50157 }, 50158 50159 /** 50160 * Update a component using a new element. 50161 * 50162 * @param {ReactComponent} internalInstance 50163 * @param {ReactElement} nextElement 50164 * @param {ReactReconcileTransaction} transaction 50165 * @param {object} context 50166 * @internal 50167 */ 50168 receiveComponent: function (internalInstance, nextElement, transaction, context) { 50169 var prevElement = internalInstance._currentElement; 50170 50171 if (nextElement === prevElement && context === internalInstance._context) { 50172 // Since elements are immutable after the owner is rendered, 50173 // we can do a cheap identity compare here to determine if this is a 50174 // superfluous reconcile. It's possible for state to be mutable but such 50175 // change should trigger an update of the owner which would recreate 50176 // the element. We explicitly check for the existence of an owner since 50177 // it's possible for an element created outside a composite to be 50178 // deeply mutated and reused. 50179 50180 // TODO: Bailing out early is just a perf optimization right? 50181 // TODO: Removing the return statement should affect correctness? 50182 return; 50183 } 50184 50185 var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); 50186 50187 if (refsChanged) { 50188 ReactRef.detachRefs(internalInstance, prevElement); 50189 } 50190 50191 internalInstance.receiveComponent(nextElement, transaction, context); 50192 50193 if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { 50194 transaction.getReactMountReady().enqueue(attachRefs, internalInstance); 50195 } 50196 }, 50197 50198 /** 50199 * Flush any dirty changes in a component. 50200 * 50201 * @param {ReactComponent} internalInstance 50202 * @param {ReactReconcileTransaction} transaction 50203 * @internal 50204 */ 50205 performUpdateIfNecessary: function (internalInstance, transaction) { 50206 internalInstance.performUpdateIfNecessary(transaction); 50207 } 50208 50209}; 50210 50211module.exports = ReactReconciler; 50212 50213/***/ }), 50214
vendor: 2,697 bytes, lines 50215-50303
50215/***/ "./node_modules/react/lib/ReactRef.js": 50216/*!********************************************!*\ 50217 !*** ./node_modules/react/lib/ReactRef.js ***! 50218 \********************************************/ 50219/*! no static exports found */ 50220/***/ (function(module, exports, __webpack_require__) { 50221 50222"use strict"; 50223/** 50224 * Copyright 2013-2015, Facebook, Inc. 50225 * All rights reserved. 50226 * 50227 * This source code is licensed under the BSD-style license found in the 50228 * LICENSE file in the root directory of this source tree. An additional grant 50229 * of patent rights can be found in the PATENTS file in the same directory. 50230 * 50231 * @providesModule ReactRef 50232 */ 50233 50234 50235 50236var ReactOwner = __webpack_require__(/*! ./ReactOwner */ "./node_modules/react/lib/ReactOwner.js"); 50237 50238var ReactRef = {}; 50239 50240function attachRef(ref, component, owner) { 50241 if (typeof ref === 'function') { 50242 ref(component.getPublicInstance()); 50243 } else { 50244 // Legacy ref 50245 ReactOwner.addComponentAsRefTo(component, ref, owner); 50246 } 50247} 50248 50249function detachRef(ref, component, owner) { 50250 if (typeof ref === 'function') { 50251 ref(null); 50252 } else { 50253 // Legacy ref 50254 ReactOwner.removeComponentAsRefFrom(component, ref, owner); 50255 } 50256} 50257 50258ReactRef.attachRefs = function (instance, element) { 50259 if (element === null || element === false) { 50260 return; 50261 } 50262 var ref = element.ref; 50263 if (ref != null) { 50264 attachRef(ref, instance, element._owner); 50265 } 50266}; 50267 50268ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { 50269 // If either the owner or a `ref` has changed, make sure the newest owner 50270 // has stored a reference to `this`, and the previous owner (if different) 50271 // has forgotten the reference to `this`. We use the element instead 50272 // of the public this.props because the post processing cannot determine 50273 // a ref. The ref conceptually lives on the element. 50274 50275 // TODO: Should this even be possible? The owner cannot change because 50276 // it's forbidden by shouldUpdateReactComponent. The ref can change 50277 // if you swap the keys of but not the refs. Reconsider where this check 50278 // is made. It probably belongs where the key checking and 50279 // instantiateReactComponent is done. 50280 50281 var prevEmpty = prevElement === null || prevElement === false; 50282 var nextEmpty = nextElement === null || nextElement === false; 50283 50284 return( 50285 // This has a few false positives w/r/t empty components. 50286 prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref 50287 ); 50288}; 50289 50290ReactRef.detachRefs = function (instance, element) { 50291 if (element === null || element === false) { 50292 return; 50293 } 50294 var ref = element.ref; 50295 if (ref != null) { 50296 detachRef(ref, instance, element._owner); 50297 } 50298}; 50299 50300module.exports = ReactRef; 50301 50302/***/ }), 50303
vendor: 1,044 bytes, lines 50304-50343
50304/***/ "./node_modules/react/lib/ReactRootIndex.js": 50305/*!**************************************************!*\ 50306 !*** ./node_modules/react/lib/ReactRootIndex.js ***! 50307 \**************************************************/ 50308/*! no static exports found */ 50309/***/ (function(module, exports, __webpack_require__) { 50310 50311"use strict"; 50312/** 50313 * Copyright 2013-2015, Facebook, Inc. 50314 * All rights reserved. 50315 * 50316 * This source code is licensed under the BSD-style license found in the 50317 * LICENSE file in the root directory of this source tree. An additional grant 50318 * of patent rights can be found in the PATENTS file in the same directory. 50319 * 50320 * @providesModule ReactRootIndex 50321 * @typechecks 50322 */ 50323 50324 50325 50326var ReactRootIndexInjection = { 50327 /** 50328 * @param {function} _createReactRootIndex 50329 */ 50330 injectCreateReactRootIndex: function (_createReactRootIndex) { 50331 ReactRootIndex.createReactRootIndex = _createReactRootIndex; 50332 } 50333}; 50334 50335var ReactRootIndex = { 50336 createReactRootIndex: null, 50337 injection: ReactRootIndexInjection 50338}; 50339 50340module.exports = ReactRootIndex; 50341 50342/***/ }), 50343
vendor: 1,046 bytes, lines 50344-50377
50344/***/ "./node_modules/react/lib/ReactServerBatchingStrategy.js": 50345/*!***************************************************************!*\ 50346 !*** ./node_modules/react/lib/ReactServerBatchingStrategy.js ***! 50347 \***************************************************************/ 50348/*! no static exports found */ 50349/***/ (function(module, exports, __webpack_require__) { 50350 50351"use strict"; 50352/** 50353 * Copyright 2014-2015, Facebook, Inc. 50354 * All rights reserved. 50355 * 50356 * This source code is licensed under the BSD-style license found in the 50357 * LICENSE file in the root directory of this source tree. An additional grant 50358 * of patent rights can be found in the PATENTS file in the same directory. 50359 * 50360 * @providesModule ReactServerBatchingStrategy 50361 * @typechecks 50362 */ 50363 50364 50365 50366var ReactServerBatchingStrategy = { 50367 isBatchingUpdates: false, 50368 batchedUpdates: function (callback) { 50369 // Don't do anything here. During the server rendering we don't want to 50370 // schedule any updates. We will simply ignore them. 50371 } 50372}; 50373 50374module.exports = ReactServerBatchingStrategy; 50375 50376/***/ }), 50377
vendor: 4,237 bytes, lines 50378-50471
50378/***/ "./node_modules/react/lib/ReactServerRendering.js": 50379/*!********************************************************!*\ 50380 !*** ./node_modules/react/lib/ReactServerRendering.js ***! 50381 \********************************************************/ 50382/*! no static exports found */ 50383/***/ (function(module, exports, __webpack_require__) { 50384 50385"use strict"; 50386/** 50387 * Copyright 2013-2015, Facebook, Inc. 50388 * All rights reserved. 50389 * 50390 * This source code is licensed under the BSD-style license found in the 50391 * LICENSE file in the root directory of this source tree. An additional grant 50392 * of patent rights can be found in the PATENTS file in the same directory. 50393 * 50394 * @typechecks static-only 50395 * @providesModule ReactServerRendering 50396 */ 50397 50398 50399var ReactDefaultBatchingStrategy = __webpack_require__(/*! ./ReactDefaultBatchingStrategy */ "./node_modules/react/lib/ReactDefaultBatchingStrategy.js"); 50400var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 50401var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 50402var ReactMarkupChecksum = __webpack_require__(/*! ./ReactMarkupChecksum */ "./node_modules/react/lib/ReactMarkupChecksum.js"); 50403var ReactServerBatchingStrategy = __webpack_require__(/*! ./ReactServerBatchingStrategy */ "./node_modules/react/lib/ReactServerBatchingStrategy.js"); 50404var ReactServerRenderingTransaction = __webpack_require__(/*! ./ReactServerRenderingTransaction */ "./node_modules/react/lib/ReactServerRenderingTransaction.js"); 50405var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 50406 50407var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); 50408var instantiateReactComponent = __webpack_require__(/*! ./instantiateReactComponent */ "./node_modules/react/lib/instantiateReactComponent.js"); 50409var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 50410 50411/** 50412 * @param {ReactElement} element 50413 * @return {string} the HTML markup 50414 */ 50415function renderToString(element) { 50416 !ReactElement.isValidElement(element) ? true ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : undefined : undefined; 50417 50418 var transaction; 50419 try { 50420 ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); 50421 50422 var id = ReactInstanceHandles.createReactRootID(); 50423 transaction = ReactServerRenderingTransaction.getPooled(false); 50424 50425 return transaction.perform(function () { 50426 var componentInstance = instantiateReactComponent(element, null); 50427 var markup = componentInstance.mountComponent(id, transaction, emptyObject); 50428 return ReactMarkupChecksum.addChecksumToMarkup(markup); 50429 }, null); 50430 } finally { 50431 ReactServerRenderingTransaction.release(transaction); 50432 // Revert to the DOM batching strategy since these two renderers 50433 // currently share these stateful modules. 50434 ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); 50435 } 50436} 50437 50438/** 50439 * @param {ReactElement} element 50440 * @return {string} the HTML markup, without the extra React ID and checksum 50441 * (for generating static pages) 50442 */ 50443function renderToStaticMarkup(element) { 50444 !ReactElement.isValidElement(element) ? true ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : undefined : undefined; 50445 50446 var transaction; 50447 try { 50448 ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); 50449 50450 var id = ReactInstanceHandles.createReactRootID(); 50451 transaction = ReactServerRenderingTransaction.getPooled(true); 50452 50453 return transaction.perform(function () { 50454 var componentInstance = instantiateReactComponent(element, null); 50455 return componentInstance.mountComponent(id, transaction, emptyObject); 50456 }, null); 50457 } finally { 50458 ReactServerRenderingTransaction.release(transaction); 50459 // Revert to the DOM batching strategy since these two renderers 50460 // currently share these stateful modules. 50461 ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); 50462 } 50463} 50464 50465module.exports = { 50466 renderToString: renderToString, 50467 renderToStaticMarkup: renderToStaticMarkup 50468}; 50469 50470/***/ }), 50471
vendor: 2,989 bytes, lines 50472-50569
50472/***/ "./node_modules/react/lib/ReactServerRenderingTransaction.js": 50473/*!*******************************************************************!*\ 50474 !*** ./node_modules/react/lib/ReactServerRenderingTransaction.js ***! 50475 \*******************************************************************/ 50476/*! no static exports found */ 50477/***/ (function(module, exports, __webpack_require__) { 50478 50479"use strict"; 50480/** 50481 * Copyright 2014-2015, Facebook, Inc. 50482 * All rights reserved. 50483 * 50484 * This source code is licensed under the BSD-style license found in the 50485 * LICENSE file in the root directory of this source tree. An additional grant 50486 * of patent rights can be found in the PATENTS file in the same directory. 50487 * 50488 * @providesModule ReactServerRenderingTransaction 50489 * @typechecks 50490 */ 50491 50492 50493 50494var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 50495var CallbackQueue = __webpack_require__(/*! ./CallbackQueue */ "./node_modules/react/lib/CallbackQueue.js"); 50496var Transaction = __webpack_require__(/*! ./Transaction */ "./node_modules/react/lib/Transaction.js"); 50497 50498var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 50499var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 50500 50501/** 50502 * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks 50503 * during the performing of the transaction. 50504 */ 50505var ON_DOM_READY_QUEUEING = { 50506 /** 50507 * Initializes the internal `onDOMReady` queue. 50508 */ 50509 initialize: function () { 50510 this.reactMountReady.reset(); 50511 }, 50512 50513 close: emptyFunction 50514}; 50515 50516/** 50517 * Executed within the scope of the `Transaction` instance. Consider these as 50518 * being member methods, but with an implied ordering while being isolated from 50519 * each other. 50520 */ 50521var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING]; 50522 50523/** 50524 * @class ReactServerRenderingTransaction 50525 * @param {boolean} renderToStaticMarkup 50526 */ 50527function ReactServerRenderingTransaction(renderToStaticMarkup) { 50528 this.reinitializeTransaction(); 50529 this.renderToStaticMarkup = renderToStaticMarkup; 50530 this.reactMountReady = CallbackQueue.getPooled(null); 50531 this.useCreateElement = false; 50532} 50533 50534var Mixin = { 50535 /** 50536 * @see Transaction 50537 * @abstract 50538 * @final 50539 * @return {array} Empty list of operation wrap procedures. 50540 */ 50541 getTransactionWrappers: function () { 50542 return TRANSACTION_WRAPPERS; 50543 }, 50544 50545 /** 50546 * @return {object} The queue to collect `onDOMReady` callbacks with. 50547 */ 50548 getReactMountReady: function () { 50549 return this.reactMountReady; 50550 }, 50551 50552 /** 50553 * `PooledClass` looks for this, and will invoke this before allowing this 50554 * instance to be reused. 50555 */ 50556 destructor: function () { 50557 CallbackQueue.release(this.reactMountReady); 50558 this.reactMountReady = null; 50559 } 50560}; 50561 50562assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin); 50563 50564PooledClass.addPoolingTo(ReactServerRenderingTransaction); 50565 50566module.exports = ReactServerRenderingTransaction; 50567 50568/***/ }), 50569
vendor: 3,572 bytes, lines 50570-50678
50570/***/ "./node_modules/react/lib/ReactTransitionChildMapping.js": 50571/*!***************************************************************!*\ 50572 !*** ./node_modules/react/lib/ReactTransitionChildMapping.js ***! 50573 \***************************************************************/ 50574/*! no static exports found */ 50575/***/ (function(module, exports, __webpack_require__) { 50576 50577"use strict"; 50578/** 50579 * Copyright 2013-2015, Facebook, Inc. 50580 * All rights reserved. 50581 * 50582 * This source code is licensed under the BSD-style license found in the 50583 * LICENSE file in the root directory of this source tree. An additional grant 50584 * of patent rights can be found in the PATENTS file in the same directory. 50585 * 50586 * @typechecks static-only 50587 * @providesModule ReactTransitionChildMapping 50588 */ 50589 50590 50591 50592var flattenChildren = __webpack_require__(/*! ./flattenChildren */ "./node_modules/react/lib/flattenChildren.js"); 50593 50594var ReactTransitionChildMapping = { 50595 /** 50596 * Given `this.props.children`, return an object mapping key to child. Just 50597 * simple syntactic sugar around flattenChildren(). 50598 * 50599 * @param {*} children `this.props.children` 50600 * @return {object} Mapping of key to child 50601 */ 50602 getChildMapping: function (children) { 50603 if (!children) { 50604 return children; 50605 } 50606 return flattenChildren(children); 50607 }, 50608 50609 /** 50610 * When you're adding or removing children some may be added or removed in the 50611 * same render pass. We want to show *both* since we want to simultaneously 50612 * animate elements in and out. This function takes a previous set of keys 50613 * and a new set of keys and merges them with its best guess of the correct 50614 * ordering. In the future we may expose some of the utilities in 50615 * ReactMultiChild to make this easy, but for now React itself does not 50616 * directly have this concept of the union of prevChildren and nextChildren 50617 * so we implement it here. 50618 * 50619 * @param {object} prev prev children as returned from 50620 * `ReactTransitionChildMapping.getChildMapping()`. 50621 * @param {object} next next children as returned from 50622 * `ReactTransitionChildMapping.getChildMapping()`. 50623 * @return {object} a key set that contains all keys in `prev` and all keys 50624 * in `next` in a reasonable order. 50625 */ 50626 mergeChildMappings: function (prev, next) { 50627 prev = prev || {}; 50628 next = next || {}; 50629 50630 function getValueForKey(key) { 50631 if (next.hasOwnProperty(key)) { 50632 return next[key]; 50633 } else { 50634 return prev[key]; 50635 } 50636 } 50637 50638 // For each key of `next`, the list of keys to insert before that key in 50639 // the combined list 50640 var nextKeysPending = {}; 50641 50642 var pendingKeys = []; 50643 for (var prevKey in prev) { 50644 if (next.hasOwnProperty(prevKey)) { 50645 if (pendingKeys.length) { 50646 nextKeysPending[prevKey] = pendingKeys; 50647 pendingKeys = []; 50648 } 50649 } else { 50650 pendingKeys.push(prevKey); 50651 } 50652 } 50653 50654 var i; 50655 var childMapping = {}; 50656 for (var nextKey in next) { 50657 if (nextKeysPending.hasOwnProperty(nextKey)) { 50658 for (i = 0; i < nextKeysPending[nextKey].length; i++) { 50659 var pendingNextKey = nextKeysPending[nextKey][i]; 50660 childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); 50661 } 50662 } 50663 childMapping[nextKey] = getValueForKey(nextKey); 50664 } 50665 50666 // Finally, add the keys which didn't appear before any key in `next` 50667 for (i = 0; i < pendingKeys.length; i++) { 50668 childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); 50669 } 50670 50671 return childMapping; 50672 } 50673}; 50674 50675module.exports = ReactTransitionChildMapping; 50676 50677/***/ }), 50678
vendor: 3,569 bytes, lines 50679-50798
50679/***/ "./node_modules/react/lib/ReactTransitionEvents.js": 50680/*!*********************************************************!*\ 50681 !*** ./node_modules/react/lib/ReactTransitionEvents.js ***! 50682 \*********************************************************/ 50683/*! no static exports found */ 50684/***/ (function(module, exports, __webpack_require__) { 50685 50686"use strict"; 50687/** 50688 * Copyright 2013-2015, Facebook, Inc. 50689 * All rights reserved. 50690 * 50691 * This source code is licensed under the BSD-style license found in the 50692 * LICENSE file in the root directory of this source tree. An additional grant 50693 * of patent rights can be found in the PATENTS file in the same directory. 50694 * 50695 * @providesModule ReactTransitionEvents 50696 */ 50697 50698 50699 50700var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 50701 50702/** 50703 * EVENT_NAME_MAP is used to determine which event fired when a 50704 * transition/animation ends, based on the style property used to 50705 * define that event. 50706 */ 50707var EVENT_NAME_MAP = { 50708 transitionend: { 50709 'transition': 'transitionend', 50710 'WebkitTransition': 'webkitTransitionEnd', 50711 'MozTransition': 'mozTransitionEnd', 50712 'OTransition': 'oTransitionEnd', 50713 'msTransition': 'MSTransitionEnd' 50714 }, 50715 50716 animationend: { 50717 'animation': 'animationend', 50718 'WebkitAnimation': 'webkitAnimationEnd', 50719 'MozAnimation': 'mozAnimationEnd', 50720 'OAnimation': 'oAnimationEnd', 50721 'msAnimation': 'MSAnimationEnd' 50722 } 50723}; 50724 50725var endEvents = []; 50726 50727function detectEvents() { 50728 var testEl = document.createElement('div'); 50729 var style = testEl.style; 50730 50731 // On some platforms, in particular some releases of Android 4.x, 50732 // the un-prefixed "animation" and "transition" properties are defined on the 50733 // style object but the events that fire will still be prefixed, so we need 50734 // to check if the un-prefixed events are useable, and if not remove them 50735 // from the map 50736 if (!('AnimationEvent' in window)) { 50737 delete EVENT_NAME_MAP.animationend.animation; 50738 } 50739 50740 if (!('TransitionEvent' in window)) { 50741 delete EVENT_NAME_MAP.transitionend.transition; 50742 } 50743 50744 for (var baseEventName in EVENT_NAME_MAP) { 50745 var baseEvents = EVENT_NAME_MAP[baseEventName]; 50746 for (var styleName in baseEvents) { 50747 if (styleName in style) { 50748 endEvents.push(baseEvents[styleName]); 50749 break; 50750 } 50751 } 50752 } 50753} 50754 50755if (ExecutionEnvironment.canUseDOM) { 50756 detectEvents(); 50757} 50758 50759// We use the raw {add|remove}EventListener() call because EventListener 50760// does not know how to remove event listeners and we really should 50761// clean up. Also, these events are not triggered in older browsers 50762// so we should be A-OK here. 50763 50764function addEventListener(node, eventName, eventListener) { 50765 node.addEventListener(eventName, eventListener, false); 50766} 50767 50768function removeEventListener(node, eventName, eventListener) { 50769 node.removeEventListener(eventName, eventListener, false); 50770} 50771 50772var ReactTransitionEvents = { 50773 addEndEventListener: function (node, eventListener) { 50774 if (endEvents.length === 0) { 50775 // If CSS transitions are not supported, trigger an "end animation" 50776 // event immediately. 50777 window.setTimeout(eventListener, 0); 50778 return; 50779 } 50780 endEvents.forEach(function (endEvent) { 50781 addEventListener(node, endEvent, eventListener); 50782 }); 50783 }, 50784 50785 removeEndEventListener: function (node, eventListener) { 50786 if (endEvents.length === 0) { 50787 return; 50788 } 50789 endEvents.forEach(function (endEvent) { 50790 removeEventListener(node, endEvent, eventListener); 50791 }); 50792 } 50793}; 50794 50795module.exports = ReactTransitionEvents; 50796 50797/***/ }), 50798
vendor: 6,731 bytes, lines 50799-51014
50799/***/ "./node_modules/react/lib/ReactTransitionGroup.js": 50800/*!********************************************************!*\ 50801 !*** ./node_modules/react/lib/ReactTransitionGroup.js ***! 50802 \********************************************************/ 50803/*! no static exports found */ 50804/***/ (function(module, exports, __webpack_require__) { 50805 50806"use strict"; 50807/** 50808 * Copyright 2013-2015, Facebook, Inc. 50809 * All rights reserved. 50810 * 50811 * This source code is licensed under the BSD-style license found in the 50812 * LICENSE file in the root directory of this source tree. An additional grant 50813 * of patent rights can be found in the PATENTS file in the same directory. 50814 * 50815 * @providesModule ReactTransitionGroup 50816 */ 50817 50818 50819 50820var React = __webpack_require__(/*! ./React */ "./node_modules/react/lib/React.js"); 50821var ReactTransitionChildMapping = __webpack_require__(/*! ./ReactTransitionChildMapping */ "./node_modules/react/lib/ReactTransitionChildMapping.js"); 50822 50823var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 50824var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 50825 50826var ReactTransitionGroup = React.createClass({ 50827 displayName: 'ReactTransitionGroup', 50828 50829 propTypes: { 50830 component: React.PropTypes.any, 50831 childFactory: React.PropTypes.func 50832 }, 50833 50834 getDefaultProps: function () { 50835 return { 50836 component: 'span', 50837 childFactory: emptyFunction.thatReturnsArgument 50838 }; 50839 }, 50840 50841 getInitialState: function () { 50842 return { 50843 children: ReactTransitionChildMapping.getChildMapping(this.props.children) 50844 }; 50845 }, 50846 50847 componentWillMount: function () { 50848 this.currentlyTransitioningKeys = {}; 50849 this.keysToEnter = []; 50850 this.keysToLeave = []; 50851 }, 50852 50853 componentDidMount: function () { 50854 var initialChildMapping = this.state.children; 50855 for (var key in initialChildMapping) { 50856 if (initialChildMapping[key]) { 50857 this.performAppear(key); 50858 } 50859 } 50860 }, 50861 50862 componentWillReceiveProps: function (nextProps) { 50863 var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children); 50864 var prevChildMapping = this.state.children; 50865 50866 this.setState({ 50867 children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping) 50868 }); 50869 50870 var key; 50871 50872 for (key in nextChildMapping) { 50873 var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key); 50874 if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) { 50875 this.keysToEnter.push(key); 50876 } 50877 } 50878 50879 for (key in prevChildMapping) { 50880 var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key); 50881 if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) { 50882 this.keysToLeave.push(key); 50883 } 50884 } 50885 50886 // If we want to someday check for reordering, we could do it here. 50887 }, 50888 50889 componentDidUpdate: function () { 50890 var keysToEnter = this.keysToEnter; 50891 this.keysToEnter = []; 50892 keysToEnter.forEach(this.performEnter); 50893 50894 var keysToLeave = this.keysToLeave; 50895 this.keysToLeave = []; 50896 keysToLeave.forEach(this.performLeave); 50897 }, 50898 50899 performAppear: function (key) { 50900 this.currentlyTransitioningKeys[key] = true; 50901 50902 var component = this.refs[key]; 50903 50904 if (component.componentWillAppear) { 50905 component.componentWillAppear(this._handleDoneAppearing.bind(this, key)); 50906 } else { 50907 this._handleDoneAppearing(key); 50908 } 50909 }, 50910 50911 _handleDoneAppearing: function (key) { 50912 var component = this.refs[key]; 50913 if (component.componentDidAppear) { 50914 component.componentDidAppear(); 50915 } 50916 50917 delete this.currentlyTransitioningKeys[key]; 50918 50919 var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); 50920 50921 if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { 50922 // This was removed before it had fully appeared. Remove it. 50923 this.performLeave(key); 50924 } 50925 }, 50926 50927 performEnter: function (key) { 50928 this.currentlyTransitioningKeys[key] = true; 50929 50930 var component = this.refs[key]; 50931 50932 if (component.componentWillEnter) { 50933 component.componentWillEnter(this._handleDoneEntering.bind(this, key)); 50934 } else { 50935 this._handleDoneEntering(key); 50936 } 50937 }, 50938 50939 _handleDoneEntering: function (key) { 50940 var component = this.refs[key]; 50941 if (component.componentDidEnter) { 50942 component.componentDidEnter(); 50943 } 50944 50945 delete this.currentlyTransitioningKeys[key]; 50946 50947 var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); 50948 50949 if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { 50950 // This was removed before it had fully entered. Remove it. 50951 this.performLeave(key); 50952 } 50953 }, 50954 50955 performLeave: function (key) { 50956 this.currentlyTransitioningKeys[key] = true; 50957 50958 var component = this.refs[key]; 50959 if (component.componentWillLeave) { 50960 component.componentWillLeave(this._handleDoneLeaving.bind(this, key)); 50961 } else { 50962 // Note that this is somewhat dangerous b/c it calls setState() 50963 // again, effectively mutating the component before all the work 50964 // is done. 50965 this._handleDoneLeaving(key); 50966 } 50967 }, 50968 50969 _handleDoneLeaving: function (key) { 50970 var component = this.refs[key]; 50971 50972 if (component.componentDidLeave) { 50973 component.componentDidLeave(); 50974 } 50975 50976 delete this.currentlyTransitioningKeys[key]; 50977 50978 var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children); 50979 50980 if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { 50981 // This entered again before it fully left. Add it again. 50982 this.performEnter(key); 50983 } else { 50984 this.setState(function (state) { 50985 var newChildren = assign({}, state.children); 50986 delete newChildren[key]; 50987 return { children: newChildren }; 50988 }); 50989 } 50990 }, 50991 50992 render: function () { 50993 // TODO: we could get rid of the need for the wrapper node 50994 // by cloning a single child 50995 var childrenToRender = []; 50996 for (var key in this.state.children) { 50997 var child = this.state.children[key]; 50998 if (child) { 50999 // You may need to apply reactive updates to a child as it is leaving. 51000 // The normal React way to do it won't work since the child will have 51001 // already been removed. In case you need this behavior you can provide 51002 // a childFactory function to wrap every child, even the ones that are 51003 // leaving. 51004 childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); 51005 } 51006 } 51007 return React.createElement(this.props.component, this.props, childrenToRender); 51008 } 51009}); 51010 51011module.exports = ReactTransitionGroup; 51012 51013/***/ }), 51014
vendor: 11,336 bytes, lines 51015-51282
51015/***/ "./node_modules/react/lib/ReactUpdateQueue.js": 51016/*!****************************************************!*\ 51017 !*** ./node_modules/react/lib/ReactUpdateQueue.js ***! 51018 \****************************************************/ 51019/*! no static exports found */ 51020/***/ (function(module, exports, __webpack_require__) { 51021 51022"use strict"; 51023/** 51024 * Copyright 2015, Facebook, Inc. 51025 * All rights reserved. 51026 * 51027 * This source code is licensed under the BSD-style license found in the 51028 * LICENSE file in the root directory of this source tree. An additional grant 51029 * of patent rights can be found in the PATENTS file in the same directory. 51030 * 51031 * @providesModule ReactUpdateQueue 51032 */ 51033 51034 51035 51036var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 51037var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 51038var ReactInstanceMap = __webpack_require__(/*! ./ReactInstanceMap */ "./node_modules/react/lib/ReactInstanceMap.js"); 51039var ReactUpdates = __webpack_require__(/*! ./ReactUpdates */ "./node_modules/react/lib/ReactUpdates.js"); 51040 51041var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 51042var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 51043var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 51044 51045function enqueueUpdate(internalInstance) { 51046 ReactUpdates.enqueueUpdate(internalInstance); 51047} 51048 51049function getInternalInstanceReadyForUpdate(publicInstance, callerName) { 51050 var internalInstance = ReactInstanceMap.get(publicInstance); 51051 if (!internalInstance) { 51052 if (true) { 51053 // Only warn when we have a callerName. Otherwise we should be silent. 51054 // We're probably calling from enqueueCallback. We don't want to warn 51055 // there because we already warned for the corresponding lifecycle method. 51056 true ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined; 51057 } 51058 return null; 51059 } 51060 51061 if (true) { 51062 true ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined; 51063 } 51064 51065 return internalInstance; 51066} 51067 51068/** 51069 * ReactUpdateQueue allows for state updates to be scheduled into a later 51070 * reconciliation step. 51071 */ 51072var ReactUpdateQueue = { 51073 51074 /** 51075 * Checks whether or not this composite component is mounted. 51076 * @param {ReactClass} publicInstance The instance we want to test. 51077 * @return {boolean} True if mounted, false otherwise. 51078 * @protected 51079 * @final 51080 */ 51081 isMounted: function (publicInstance) { 51082 if (true) { 51083 var owner = ReactCurrentOwner.current; 51084 if (owner !== null) { 51085 true ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined; 51086 owner._warnedAboutRefsInRender = true; 51087 } 51088 } 51089 var internalInstance = ReactInstanceMap.get(publicInstance); 51090 if (internalInstance) { 51091 // During componentWillMount and render this will still be null but after 51092 // that will always render to something. At least for now. So we can use 51093 // this hack. 51094 return !!internalInstance._renderedComponent; 51095 } else { 51096 return false; 51097 } 51098 }, 51099 51100 /** 51101 * Enqueue a callback that will be executed after all the pending updates 51102 * have processed. 51103 * 51104 * @param {ReactClass} publicInstance The instance to use as `this` context. 51105 * @param {?function} callback Called after state is updated. 51106 * @internal 51107 */ 51108 enqueueCallback: function (publicInstance, callback) { 51109 !(typeof callback === 'function') ? true ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : undefined : undefined; 51110 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); 51111 51112 // Previously we would throw an error if we didn't have an internal 51113 // instance. Since we want to make it a no-op instead, we mirror the same 51114 // behavior we have in other enqueue* methods. 51115 // We also need to ignore callbacks in componentWillMount. See 51116 // enqueueUpdates. 51117 if (!internalInstance) { 51118 return null; 51119 } 51120 51121 if (internalInstance._pendingCallbacks) { 51122 internalInstance._pendingCallbacks.push(callback); 51123 } else { 51124 internalInstance._pendingCallbacks = [callback]; 51125 } 51126 // TODO: The callback here is ignored when setState is called from 51127 // componentWillMount. Either fix it or disallow doing so completely in 51128 // favor of getInitialState. Alternatively, we can disallow 51129 // componentWillMount during server-side rendering. 51130 enqueueUpdate(internalInstance); 51131 }, 51132 51133 enqueueCallbackInternal: function (internalInstance, callback) { 51134 !(typeof callback === 'function') ? true ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : undefined : undefined; 51135 if (internalInstance._pendingCallbacks) { 51136 internalInstance._pendingCallbacks.push(callback); 51137 } else { 51138 internalInstance._pendingCallbacks = [callback]; 51139 } 51140 enqueueUpdate(internalInstance); 51141 }, 51142 51143 /** 51144 * Forces an update. This should only be invoked when it is known with 51145 * certainty that we are **not** in a DOM transaction. 51146 * 51147 * You may want to call this when you know that some deeper aspect of the 51148 * component's state has changed but `setState` was not called. 51149 * 51150 * This will not invoke `shouldComponentUpdate`, but it will invoke 51151 * `componentWillUpdate` and `componentDidUpdate`. 51152 * 51153 * @param {ReactClass} publicInstance The instance that should rerender. 51154 * @internal 51155 */ 51156 enqueueForceUpdate: function (publicInstance) { 51157 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); 51158 51159 if (!internalInstance) { 51160 return; 51161 } 51162 51163 internalInstance._pendingForceUpdate = true; 51164 51165 enqueueUpdate(internalInstance); 51166 }, 51167 51168 /** 51169 * Replaces all of the state. Always use this or `setState` to mutate state. 51170 * You should treat `this.state` as immutable. 51171 * 51172 * There is no guarantee that `this.state` will be immediately updated, so 51173 * accessing `this.state` after calling this method may return the old value. 51174 * 51175 * @param {ReactClass} publicInstance The instance that should rerender. 51176 * @param {object} completeState Next state. 51177 * @internal 51178 */ 51179 enqueueReplaceState: function (publicInstance, completeState) { 51180 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); 51181 51182 if (!internalInstance) { 51183 return; 51184 } 51185 51186 internalInstance._pendingStateQueue = [completeState]; 51187 internalInstance._pendingReplaceState = true; 51188 51189 enqueueUpdate(internalInstance); 51190 }, 51191 51192 /** 51193 * Sets a subset of the state. This only exists because _pendingState is 51194 * internal. This provides a merging strategy that is not available to deep 51195 * properties which is confusing. TODO: Expose pendingState or don't use it 51196 * during the merge. 51197 * 51198 * @param {ReactClass} publicInstance The instance that should rerender. 51199 * @param {object} partialState Next partial state to be merged with state. 51200 * @internal 51201 */ 51202 enqueueSetState: function (publicInstance, partialState) { 51203 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); 51204 51205 if (!internalInstance) { 51206 return; 51207 } 51208 51209 var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); 51210 queue.push(partialState); 51211 51212 enqueueUpdate(internalInstance); 51213 }, 51214 51215 /** 51216 * Sets a subset of the props. 51217 * 51218 * @param {ReactClass} publicInstance The instance that should rerender. 51219 * @param {object} partialProps Subset of the next props. 51220 * @internal 51221 */ 51222 enqueueSetProps: function (publicInstance, partialProps) { 51223 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps'); 51224 if (!internalInstance) { 51225 return; 51226 } 51227 ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps); 51228 }, 51229 51230 enqueueSetPropsInternal: function (internalInstance, partialProps) { 51231 var topLevelWrapper = internalInstance._topLevelWrapper; 51232 !topLevelWrapper ? true ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : undefined : undefined; 51233 51234 // Merge with the pending element if it exists, otherwise with existing 51235 // element props. 51236 var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; 51237 var element = wrapElement.props; 51238 var props = assign({}, element.props, partialProps); 51239 topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); 51240 51241 enqueueUpdate(topLevelWrapper); 51242 }, 51243 51244 /** 51245 * Replaces all of the props. 51246 * 51247 * @param {ReactClass} publicInstance The instance that should rerender. 51248 * @param {object} props New props. 51249 * @internal 51250 */ 51251 enqueueReplaceProps: function (publicInstance, props) { 51252 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps'); 51253 if (!internalInstance) { 51254 return; 51255 } 51256 ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props); 51257 }, 51258 51259 enqueueReplacePropsInternal: function (internalInstance, props) { 51260 var topLevelWrapper = internalInstance._topLevelWrapper; 51261 !topLevelWrapper ? true ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : undefined : undefined; 51262 51263 // Merge with the pending element if it exists, otherwise with existing 51264 // element props. 51265 var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; 51266 var element = wrapElement.props; 51267 topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); 51268 51269 enqueueUpdate(topLevelWrapper); 51270 }, 51271 51272 enqueueElementInternal: function (internalInstance, newElement) { 51273 internalInstance._pendingElement = newElement; 51274 enqueueUpdate(internalInstance); 51275 } 51276 51277}; 51278 51279module.exports = ReactUpdateQueue; 51280 51281/***/ }), 51282
vendor: 8,998 bytes, lines 51283-51516
51283/***/ "./node_modules/react/lib/ReactUpdates.js": 51284/*!************************************************!*\ 51285 !*** ./node_modules/react/lib/ReactUpdates.js ***! 51286 \************************************************/ 51287/*! no static exports found */ 51288/***/ (function(module, exports, __webpack_require__) { 51289 51290"use strict"; 51291/** 51292 * Copyright 2013-2015, Facebook, Inc. 51293 * All rights reserved. 51294 * 51295 * This source code is licensed under the BSD-style license found in the 51296 * LICENSE file in the root directory of this source tree. An additional grant 51297 * of patent rights can be found in the PATENTS file in the same directory. 51298 * 51299 * @providesModule ReactUpdates 51300 */ 51301 51302 51303 51304var CallbackQueue = __webpack_require__(/*! ./CallbackQueue */ "./node_modules/react/lib/CallbackQueue.js"); 51305var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 51306var ReactPerf = __webpack_require__(/*! ./ReactPerf */ "./node_modules/react/lib/ReactPerf.js"); 51307var ReactReconciler = __webpack_require__(/*! ./ReactReconciler */ "./node_modules/react/lib/ReactReconciler.js"); 51308var Transaction = __webpack_require__(/*! ./Transaction */ "./node_modules/react/lib/Transaction.js"); 51309 51310var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 51311var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 51312 51313var dirtyComponents = []; 51314var asapCallbackQueue = CallbackQueue.getPooled(); 51315var asapEnqueued = false; 51316 51317var batchingStrategy = null; 51318 51319function ensureInjected() { 51320 !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? true ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : undefined : undefined; 51321} 51322 51323var NESTED_UPDATES = { 51324 initialize: function () { 51325 this.dirtyComponentsLength = dirtyComponents.length; 51326 }, 51327 close: function () { 51328 if (this.dirtyComponentsLength !== dirtyComponents.length) { 51329 // Additional updates were enqueued by componentDidUpdate handlers or 51330 // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run 51331 // these new updates so that if A's componentDidUpdate calls setState on 51332 // B, B will update before the callback A's updater provided when calling 51333 // setState. 51334 dirtyComponents.splice(0, this.dirtyComponentsLength); 51335 flushBatchedUpdates(); 51336 } else { 51337 dirtyComponents.length = 0; 51338 } 51339 } 51340}; 51341 51342var UPDATE_QUEUEING = { 51343 initialize: function () { 51344 this.callbackQueue.reset(); 51345 }, 51346 close: function () { 51347 this.callbackQueue.notifyAll(); 51348 } 51349}; 51350 51351var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; 51352 51353function ReactUpdatesFlushTransaction() { 51354 this.reinitializeTransaction(); 51355 this.dirtyComponentsLength = null; 51356 this.callbackQueue = CallbackQueue.getPooled(); 51357 this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false); 51358} 51359 51360assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { 51361 getTransactionWrappers: function () { 51362 return TRANSACTION_WRAPPERS; 51363 }, 51364 51365 destructor: function () { 51366 this.dirtyComponentsLength = null; 51367 CallbackQueue.release(this.callbackQueue); 51368 this.callbackQueue = null; 51369 ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); 51370 this.reconcileTransaction = null; 51371 }, 51372 51373 perform: function (method, scope, a) { 51374 // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` 51375 // with this transaction's wrappers around it. 51376 return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); 51377 } 51378}); 51379 51380PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); 51381 51382function batchedUpdates(callback, a, b, c, d, e) { 51383 ensureInjected(); 51384 batchingStrategy.batchedUpdates(callback, a, b, c, d, e); 51385} 51386 51387/** 51388 * Array comparator for ReactComponents by mount ordering. 51389 * 51390 * @param {ReactComponent} c1 first component you're comparing 51391 * @param {ReactComponent} c2 second component you're comparing 51392 * @return {number} Return value usable by Array.prototype.sort(). 51393 */ 51394function mountOrderComparator(c1, c2) { 51395 return c1._mountOrder - c2._mountOrder; 51396} 51397 51398function runBatchedUpdates(transaction) { 51399 var len = transaction.dirtyComponentsLength; 51400 !(len === dirtyComponents.length) ? true ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : undefined : undefined; 51401 51402 // Since reconciling a component higher in the owner hierarchy usually (not 51403 // always -- see shouldComponentUpdate()) will reconcile children, reconcile 51404 // them before their children by sorting the array. 51405 dirtyComponents.sort(mountOrderComparator); 51406 51407 for (var i = 0; i < len; i++) { 51408 // If a component is unmounted before pending changes apply, it will still 51409 // be here, but we assume that it has cleared its _pendingCallbacks and 51410 // that performUpdateIfNecessary is a noop. 51411 var component = dirtyComponents[i]; 51412 51413 // If performUpdateIfNecessary happens to enqueue any new updates, we 51414 // shouldn't execute the callbacks until the next render happens, so 51415 // stash the callbacks first 51416 var callbacks = component._pendingCallbacks; 51417 component._pendingCallbacks = null; 51418 51419 ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction); 51420 51421 if (callbacks) { 51422 for (var j = 0; j < callbacks.length; j++) { 51423 transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); 51424 } 51425 } 51426 } 51427} 51428 51429var flushBatchedUpdates = function () { 51430 // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents 51431 // array and perform any updates enqueued by mount-ready handlers (i.e., 51432 // componentDidUpdate) but we need to check here too in order to catch 51433 // updates enqueued by setState callbacks and asap calls. 51434 while (dirtyComponents.length || asapEnqueued) { 51435 if (dirtyComponents.length) { 51436 var transaction = ReactUpdatesFlushTransaction.getPooled(); 51437 transaction.perform(runBatchedUpdates, null, transaction); 51438 ReactUpdatesFlushTransaction.release(transaction); 51439 } 51440 51441 if (asapEnqueued) { 51442 asapEnqueued = false; 51443 var queue = asapCallbackQueue; 51444 asapCallbackQueue = CallbackQueue.getPooled(); 51445 queue.notifyAll(); 51446 CallbackQueue.release(queue); 51447 } 51448 } 51449}; 51450flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates); 51451 51452/** 51453 * Mark a component as needing a rerender, adding an optional callback to a 51454 * list of functions which will be executed once the rerender occurs. 51455 */ 51456function enqueueUpdate(component) { 51457 ensureInjected(); 51458 51459 // Various parts of our code (such as ReactCompositeComponent's 51460 // _renderValidatedComponent) assume that calls to render aren't nested; 51461 // verify that that's the case. (This is called by each top-level update 51462 // function, like setProps, setState, forceUpdate, etc.; creation and 51463 // destruction of top-level components is guarded in ReactMount.) 51464 51465 if (!batchingStrategy.isBatchingUpdates) { 51466 batchingStrategy.batchedUpdates(enqueueUpdate, component); 51467 return; 51468 } 51469 51470 dirtyComponents.push(component); 51471} 51472 51473/** 51474 * Enqueue a callback to be run at the end of the current batching cycle. Throws 51475 * if no updates are currently being performed. 51476 */ 51477function asap(callback, context) { 51478 !batchingStrategy.isBatchingUpdates ? true ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : undefined : undefined; 51479 asapCallbackQueue.enqueue(callback, context); 51480 asapEnqueued = true; 51481} 51482 51483var ReactUpdatesInjection = { 51484 injectReconcileTransaction: function (ReconcileTransaction) { 51485 !ReconcileTransaction ? true ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : undefined : undefined; 51486 ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; 51487 }, 51488 51489 injectBatchingStrategy: function (_batchingStrategy) { 51490 !_batchingStrategy ? true ? invariant(false, 'ReactUpdates: must provide a batching strategy') : undefined : undefined; 51491 !(typeof _batchingStrategy.batchedUpdates === 'function') ? true ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : undefined : undefined; 51492 !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? true ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : undefined : undefined; 51493 batchingStrategy = _batchingStrategy; 51494 } 51495}; 51496 51497var ReactUpdates = { 51498 /** 51499 * React references `ReactReconcileTransaction` using this property in order 51500 * to allow dependency injection. 51501 * 51502 * @internal 51503 */ 51504 ReactReconcileTransaction: null, 51505 51506 batchedUpdates: batchedUpdates, 51507 enqueueUpdate: enqueueUpdate, 51508 flushBatchedUpdates: flushBatchedUpdates, 51509 injection: ReactUpdatesInjection, 51510 asap: asap 51511}; 51512 51513module.exports = ReactUpdates; 51514 51515/***/ }), 51516
vendor: 692 bytes, lines 51517-51541
51517/***/ "./node_modules/react/lib/ReactVersion.js": 51518/*!************************************************!*\ 51519 !*** ./node_modules/react/lib/ReactVersion.js ***! 51520 \************************************************/ 51521/*! no static exports found */ 51522/***/ (function(module, exports, __webpack_require__) { 51523 51524"use strict"; 51525/** 51526 * Copyright 2013-2015, Facebook, Inc. 51527 * All rights reserved. 51528 * 51529 * This source code is licensed under the BSD-style license found in the 51530 * LICENSE file in the root directory of this source tree. An additional grant 51531 * of patent rights can be found in the PATENTS file in the same directory. 51532 * 51533 * @providesModule ReactVersion 51534 */ 51535 51536 51537 51538module.exports = '0.14.9'; 51539 51540/***/ }), 51541
vendor: 4,203 bytes, lines 51542-51679
51542/***/ "./node_modules/react/lib/SVGDOMPropertyConfig.js": 51543/*!********************************************************!*\ 51544 !*** ./node_modules/react/lib/SVGDOMPropertyConfig.js ***! 51545 \********************************************************/ 51546/*! no static exports found */ 51547/***/ (function(module, exports, __webpack_require__) { 51548 51549"use strict"; 51550/** 51551 * Copyright 2013-2015, Facebook, Inc. 51552 * All rights reserved. 51553 * 51554 * This source code is licensed under the BSD-style license found in the 51555 * LICENSE file in the root directory of this source tree. An additional grant 51556 * of patent rights can be found in the PATENTS file in the same directory. 51557 * 51558 * @providesModule SVGDOMPropertyConfig 51559 */ 51560 51561 51562 51563var DOMProperty = __webpack_require__(/*! ./DOMProperty */ "./node_modules/react/lib/DOMProperty.js"); 51564 51565var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; 51566 51567var NS = { 51568 xlink: 'http://www.w3.org/1999/xlink', 51569 xml: 'http://www.w3.org/XML/1998/namespace' 51570}; 51571 51572var SVGDOMPropertyConfig = { 51573 Properties: { 51574 clipPath: MUST_USE_ATTRIBUTE, 51575 cx: MUST_USE_ATTRIBUTE, 51576 cy: MUST_USE_ATTRIBUTE, 51577 d: MUST_USE_ATTRIBUTE, 51578 dx: MUST_USE_ATTRIBUTE, 51579 dy: MUST_USE_ATTRIBUTE, 51580 fill: MUST_USE_ATTRIBUTE, 51581 fillOpacity: MUST_USE_ATTRIBUTE, 51582 fontFamily: MUST_USE_ATTRIBUTE, 51583 fontSize: MUST_USE_ATTRIBUTE, 51584 fx: MUST_USE_ATTRIBUTE, 51585 fy: MUST_USE_ATTRIBUTE, 51586 gradientTransform: MUST_USE_ATTRIBUTE, 51587 gradientUnits: MUST_USE_ATTRIBUTE, 51588 markerEnd: MUST_USE_ATTRIBUTE, 51589 markerMid: MUST_USE_ATTRIBUTE, 51590 markerStart: MUST_USE_ATTRIBUTE, 51591 offset: MUST_USE_ATTRIBUTE, 51592 opacity: MUST_USE_ATTRIBUTE, 51593 patternContentUnits: MUST_USE_ATTRIBUTE, 51594 patternUnits: MUST_USE_ATTRIBUTE, 51595 points: MUST_USE_ATTRIBUTE, 51596 preserveAspectRatio: MUST_USE_ATTRIBUTE, 51597 r: MUST_USE_ATTRIBUTE, 51598 rx: MUST_USE_ATTRIBUTE, 51599 ry: MUST_USE_ATTRIBUTE, 51600 spreadMethod: MUST_USE_ATTRIBUTE, 51601 stopColor: MUST_USE_ATTRIBUTE, 51602 stopOpacity: MUST_USE_ATTRIBUTE, 51603 stroke: MUST_USE_ATTRIBUTE, 51604 strokeDasharray: MUST_USE_ATTRIBUTE, 51605 strokeLinecap: MUST_USE_ATTRIBUTE, 51606 strokeOpacity: MUST_USE_ATTRIBUTE, 51607 strokeWidth: MUST_USE_ATTRIBUTE, 51608 textAnchor: MUST_USE_ATTRIBUTE, 51609 transform: MUST_USE_ATTRIBUTE, 51610 version: MUST_USE_ATTRIBUTE, 51611 viewBox: MUST_USE_ATTRIBUTE, 51612 x1: MUST_USE_ATTRIBUTE, 51613 x2: MUST_USE_ATTRIBUTE, 51614 x: MUST_USE_ATTRIBUTE, 51615 xlinkActuate: MUST_USE_ATTRIBUTE, 51616 xlinkArcrole: MUST_USE_ATTRIBUTE, 51617 xlinkHref: MUST_USE_ATTRIBUTE, 51618 xlinkRole: MUST_USE_ATTRIBUTE, 51619 xlinkShow: MUST_USE_ATTRIBUTE, 51620 xlinkTitle: MUST_USE_ATTRIBUTE, 51621 xlinkType: MUST_USE_ATTRIBUTE, 51622 xmlBase: MUST_USE_ATTRIBUTE, 51623 xmlLang: MUST_USE_ATTRIBUTE, 51624 xmlSpace: MUST_USE_ATTRIBUTE, 51625 y1: MUST_USE_ATTRIBUTE, 51626 y2: MUST_USE_ATTRIBUTE, 51627 y: MUST_USE_ATTRIBUTE 51628 }, 51629 DOMAttributeNamespaces: { 51630 xlinkActuate: NS.xlink, 51631 xlinkArcrole: NS.xlink, 51632 xlinkHref: NS.xlink, 51633 xlinkRole: NS.xlink, 51634 xlinkShow: NS.xlink, 51635 xlinkTitle: NS.xlink, 51636 xlinkType: NS.xlink, 51637 xmlBase: NS.xml, 51638 xmlLang: NS.xml, 51639 xmlSpace: NS.xml 51640 }, 51641 DOMAttributeNames: { 51642 clipPath: 'clip-path', 51643 fillOpacity: 'fill-opacity', 51644 fontFamily: 'font-family', 51645 fontSize: 'font-size', 51646 gradientTransform: 'gradientTransform', 51647 gradientUnits: 'gradientUnits', 51648 markerEnd: 'marker-end', 51649 markerMid: 'marker-mid', 51650 markerStart: 'marker-start', 51651 patternContentUnits: 'patternContentUnits', 51652 patternUnits: 'patternUnits', 51653 preserveAspectRatio: 'preserveAspectRatio', 51654 spreadMethod: 'spreadMethod', 51655 stopColor: 'stop-color', 51656 stopOpacity: 'stop-opacity', 51657 strokeDasharray: 'stroke-dasharray', 51658 strokeLinecap: 'stroke-linecap', 51659 strokeOpacity: 'stroke-opacity', 51660 strokeWidth: 'stroke-width', 51661 textAnchor: 'text-anchor', 51662 viewBox: 'viewBox', 51663 xlinkActuate: 'xlink:actuate', 51664 xlinkArcrole: 'xlink:arcrole', 51665 xlinkHref: 'xlink:href', 51666 xlinkRole: 'xlink:role', 51667 xlinkShow: 'xlink:show', 51668 xlinkTitle: 'xlink:title', 51669 xlinkType: 'xlink:type', 51670 xmlBase: 'xml:base', 51671 xmlLang: 'xml:lang', 51672 xmlSpace: 'xml:space' 51673 } 51674}; 51675 51676module.exports = SVGDOMPropertyConfig; 51677 51678/***/ }), 51679
vendor: 7,600 bytes, lines 51680-51891
51680/***/ "./node_modules/react/lib/SelectEventPlugin.js": 51681/*!*****************************************************!*\ 51682 !*** ./node_modules/react/lib/SelectEventPlugin.js ***! 51683 \*****************************************************/ 51684/*! no static exports found */ 51685/***/ (function(module, exports, __webpack_require__) { 51686 51687"use strict"; 51688/** 51689 * Copyright 2013-2015, Facebook, Inc. 51690 * All rights reserved. 51691 * 51692 * This source code is licensed under the BSD-style license found in the 51693 * LICENSE file in the root directory of this source tree. An additional grant 51694 * of patent rights can be found in the PATENTS file in the same directory. 51695 * 51696 * @providesModule SelectEventPlugin 51697 */ 51698 51699 51700 51701var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 51702var EventPropagators = __webpack_require__(/*! ./EventPropagators */ "./node_modules/react/lib/EventPropagators.js"); 51703var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 51704var ReactInputSelection = __webpack_require__(/*! ./ReactInputSelection */ "./node_modules/react/lib/ReactInputSelection.js"); 51705var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 51706 51707var getActiveElement = __webpack_require__(/*! fbjs/lib/getActiveElement */ "./node_modules/fbjs/lib/getActiveElement.js"); 51708var isTextInputElement = __webpack_require__(/*! ./isTextInputElement */ "./node_modules/react/lib/isTextInputElement.js"); 51709var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 51710var shallowEqual = __webpack_require__(/*! fbjs/lib/shallowEqual */ "./node_modules/fbjs/lib/shallowEqual.js"); 51711 51712var topLevelTypes = EventConstants.topLevelTypes; 51713 51714var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; 51715 51716var eventTypes = { 51717 select: { 51718 phasedRegistrationNames: { 51719 bubbled: keyOf({ onSelect: null }), 51720 captured: keyOf({ onSelectCapture: null }) 51721 }, 51722 dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange] 51723 } 51724}; 51725 51726var activeElement = null; 51727var activeElementID = null; 51728var lastSelection = null; 51729var mouseDown = false; 51730 51731// Track whether a listener exists for this plugin. If none exist, we do 51732// not extract events. 51733var hasListener = false; 51734var ON_SELECT_KEY = keyOf({ onSelect: null }); 51735 51736/** 51737 * Get an object which is a unique representation of the current selection. 51738 * 51739 * The return value will not be consistent across nodes or browsers, but 51740 * two identical selections on the same node will return identical objects. 51741 * 51742 * @param {DOMElement} node 51743 * @return {object} 51744 */ 51745function getSelection(node) { 51746 if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { 51747 return { 51748 start: node.selectionStart, 51749 end: node.selectionEnd 51750 }; 51751 } else if (window.getSelection) { 51752 var selection = window.getSelection(); 51753 return { 51754 anchorNode: selection.anchorNode, 51755 anchorOffset: selection.anchorOffset, 51756 focusNode: selection.focusNode, 51757 focusOffset: selection.focusOffset 51758 }; 51759 } else if (document.selection) { 51760 var range = document.selection.createRange(); 51761 return { 51762 parentElement: range.parentElement(), 51763 text: range.text, 51764 top: range.boundingTop, 51765 left: range.boundingLeft 51766 }; 51767 } 51768} 51769 51770/** 51771 * Poll selection to see whether it's changed. 51772 * 51773 * @param {object} nativeEvent 51774 * @return {?SyntheticEvent} 51775 */ 51776function constructSelectEvent(nativeEvent, nativeEventTarget) { 51777 // Ensure we have the right element, and that the user is not dragging a 51778 // selection (this matches native `select` event behavior). In HTML5, select 51779 // fires only on input and textarea thus if there's no focused element we 51780 // won't dispatch. 51781 if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { 51782 return null; 51783 } 51784 51785 // Only fire when selection has actually changed. 51786 var currentSelection = getSelection(activeElement); 51787 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { 51788 lastSelection = currentSelection; 51789 51790 var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget); 51791 51792 syntheticEvent.type = 'select'; 51793 syntheticEvent.target = activeElement; 51794 51795 EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); 51796 51797 return syntheticEvent; 51798 } 51799 51800 return null; 51801} 51802 51803/** 51804 * This plugin creates an `onSelect` event that normalizes select events 51805 * across form elements. 51806 * 51807 * Supported elements are: 51808 * - input (see `isTextInputElement`) 51809 * - textarea 51810 * - contentEditable 51811 * 51812 * This differs from native browser implementations in the following ways: 51813 * - Fires on contentEditable fields as well as inputs. 51814 * - Fires for collapsed selection. 51815 * - Fires after user input. 51816 */ 51817var SelectEventPlugin = { 51818 51819 eventTypes: eventTypes, 51820 51821 /** 51822 * @param {string} topLevelType Record from `EventConstants`. 51823 * @param {DOMEventTarget} topLevelTarget The listening component root node. 51824 * @param {string} topLevelTargetID ID of `topLevelTarget`. 51825 * @param {object} nativeEvent Native browser event. 51826 * @return {*} An accumulation of synthetic events. 51827 * @see {EventPluginHub.extractEvents} 51828 */ 51829 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 51830 if (!hasListener) { 51831 return null; 51832 } 51833 51834 switch (topLevelType) { 51835 // Track the input node that has focus. 51836 case topLevelTypes.topFocus: 51837 if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') { 51838 activeElement = topLevelTarget; 51839 activeElementID = topLevelTargetID; 51840 lastSelection = null; 51841 } 51842 break; 51843 case topLevelTypes.topBlur: 51844 activeElement = null; 51845 activeElementID = null; 51846 lastSelection = null; 51847 break; 51848 51849 // Don't fire the event while the user is dragging. This matches the 51850 // semantics of the native select event. 51851 case topLevelTypes.topMouseDown: 51852 mouseDown = true; 51853 break; 51854 case topLevelTypes.topContextMenu: 51855 case topLevelTypes.topMouseUp: 51856 mouseDown = false; 51857 return constructSelectEvent(nativeEvent, nativeEventTarget); 51858 51859 // Chrome and IE fire non-standard event when selection is changed (and 51860 // sometimes when it hasn't). IE's event fires out of order with respect 51861 // to key and input events on deletion, so we discard it. 51862 // 51863 // Firefox doesn't support selectionchange, so check selection status 51864 // after each key entry. The selection changes after keydown and before 51865 // keyup, but we check on keydown as well in the case of holding down a 51866 // key, when multiple keydown events are fired but only one keyup is. 51867 // This is also our approach for IE handling, for the reason above. 51868 case topLevelTypes.topSelectionChange: 51869 if (skipSelectionChangeEvent) { 51870 break; 51871 } 51872 // falls through 51873 case topLevelTypes.topKeyDown: 51874 case topLevelTypes.topKeyUp: 51875 return constructSelectEvent(nativeEvent, nativeEventTarget); 51876 } 51877 51878 return null; 51879 }, 51880 51881 didPutListener: function (id, registrationName, listener) { 51882 if (registrationName === ON_SELECT_KEY) { 51883 hasListener = true; 51884 } 51885 } 51886}; 51887 51888module.exports = SelectEventPlugin; 51889 51890/***/ }), 51891
vendor: 1,213 bytes, lines 51892-51931
51892/***/ "./node_modules/react/lib/ServerReactRootIndex.js": 51893/*!********************************************************!*\ 51894 !*** ./node_modules/react/lib/ServerReactRootIndex.js ***! 51895 \********************************************************/ 51896/*! no static exports found */ 51897/***/ (function(module, exports, __webpack_require__) { 51898 51899"use strict"; 51900/** 51901 * Copyright 2013-2015, Facebook, Inc. 51902 * All rights reserved. 51903 * 51904 * This source code is licensed under the BSD-style license found in the 51905 * LICENSE file in the root directory of this source tree. An additional grant 51906 * of patent rights can be found in the PATENTS file in the same directory. 51907 * 51908 * @providesModule ServerReactRootIndex 51909 * @typechecks 51910 */ 51911 51912 51913 51914/** 51915 * Size of the reactRoot ID space. We generate random numbers for React root 51916 * IDs and if there's a collision the events and DOM update system will 51917 * get confused. In the future we need a way to generate GUIDs but for 51918 * now this will work on a smaller scale. 51919 */ 51920var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); 51921 51922var ServerReactRootIndex = { 51923 createReactRootIndex: function () { 51924 return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); 51925 } 51926}; 51927 51928module.exports = ServerReactRootIndex; 51929 51930/***/ }), 51931
vendor: 18,810 bytes, lines 51932-52529
51932/***/ "./node_modules/react/lib/SimpleEventPlugin.js": 51933/*!*****************************************************!*\ 51934 !*** ./node_modules/react/lib/SimpleEventPlugin.js ***! 51935 \*****************************************************/ 51936/*! no static exports found */ 51937/***/ (function(module, exports, __webpack_require__) { 51938 51939"use strict"; 51940/** 51941 * Copyright 2013-2015, Facebook, Inc. 51942 * All rights reserved. 51943 * 51944 * This source code is licensed under the BSD-style license found in the 51945 * LICENSE file in the root directory of this source tree. An additional grant 51946 * of patent rights can be found in the PATENTS file in the same directory. 51947 * 51948 * @providesModule SimpleEventPlugin 51949 */ 51950 51951 51952 51953var EventConstants = __webpack_require__(/*! ./EventConstants */ "./node_modules/react/lib/EventConstants.js"); 51954var EventListener = __webpack_require__(/*! fbjs/lib/EventListener */ "./node_modules/fbjs/lib/EventListener.js"); 51955var EventPropagators = __webpack_require__(/*! ./EventPropagators */ "./node_modules/react/lib/EventPropagators.js"); 51956var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 51957var SyntheticClipboardEvent = __webpack_require__(/*! ./SyntheticClipboardEvent */ "./node_modules/react/lib/SyntheticClipboardEvent.js"); 51958var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 51959var SyntheticFocusEvent = __webpack_require__(/*! ./SyntheticFocusEvent */ "./node_modules/react/lib/SyntheticFocusEvent.js"); 51960var SyntheticKeyboardEvent = __webpack_require__(/*! ./SyntheticKeyboardEvent */ "./node_modules/react/lib/SyntheticKeyboardEvent.js"); 51961var SyntheticMouseEvent = __webpack_require__(/*! ./SyntheticMouseEvent */ "./node_modules/react/lib/SyntheticMouseEvent.js"); 51962var SyntheticDragEvent = __webpack_require__(/*! ./SyntheticDragEvent */ "./node_modules/react/lib/SyntheticDragEvent.js"); 51963var SyntheticTouchEvent = __webpack_require__(/*! ./SyntheticTouchEvent */ "./node_modules/react/lib/SyntheticTouchEvent.js"); 51964var SyntheticUIEvent = __webpack_require__(/*! ./SyntheticUIEvent */ "./node_modules/react/lib/SyntheticUIEvent.js"); 51965var SyntheticWheelEvent = __webpack_require__(/*! ./SyntheticWheelEvent */ "./node_modules/react/lib/SyntheticWheelEvent.js"); 51966 51967var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 51968var getEventCharCode = __webpack_require__(/*! ./getEventCharCode */ "./node_modules/react/lib/getEventCharCode.js"); 51969var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 51970var keyOf = __webpack_require__(/*! fbjs/lib/keyOf */ "./node_modules/fbjs/lib/keyOf.js"); 51971 51972var topLevelTypes = EventConstants.topLevelTypes; 51973 51974var eventTypes = { 51975 abort: { 51976 phasedRegistrationNames: { 51977 bubbled: keyOf({ onAbort: true }), 51978 captured: keyOf({ onAbortCapture: true }) 51979 } 51980 }, 51981 blur: { 51982 phasedRegistrationNames: { 51983 bubbled: keyOf({ onBlur: true }), 51984 captured: keyOf({ onBlurCapture: true }) 51985 } 51986 }, 51987 canPlay: { 51988 phasedRegistrationNames: { 51989 bubbled: keyOf({ onCanPlay: true }), 51990 captured: keyOf({ onCanPlayCapture: true }) 51991 } 51992 }, 51993 canPlayThrough: { 51994 phasedRegistrationNames: { 51995 bubbled: keyOf({ onCanPlayThrough: true }), 51996 captured: keyOf({ onCanPlayThroughCapture: true }) 51997 } 51998 }, 51999 click: { 52000 phasedRegistrationNames: { 52001 bubbled: keyOf({ onClick: true }), 52002 captured: keyOf({ onClickCapture: true }) 52003 } 52004 }, 52005 contextMenu: { 52006 phasedRegistrationNames: { 52007 bubbled: keyOf({ onContextMenu: true }), 52008 captured: keyOf({ onContextMenuCapture: true }) 52009 } 52010 }, 52011 copy: { 52012 phasedRegistrationNames: { 52013 bubbled: keyOf({ onCopy: true }), 52014 captured: keyOf({ onCopyCapture: true }) 52015 } 52016 }, 52017 cut: { 52018 phasedRegistrationNames: { 52019 bubbled: keyOf({ onCut: true }), 52020 captured: keyOf({ onCutCapture: true }) 52021 } 52022 }, 52023 doubleClick: { 52024 phasedRegistrationNames: { 52025 bubbled: keyOf({ onDoubleClick: true }), 52026 captured: keyOf({ onDoubleClickCapture: true }) 52027 } 52028 }, 52029 drag: { 52030 phasedRegistrationNames: { 52031 bubbled: keyOf({ onDrag: true }), 52032 captured: keyOf({ onDragCapture: true }) 52033 } 52034 }, 52035 dragEnd: { 52036 phasedRegistrationNames: { 52037 bubbled: keyOf({ onDragEnd: true }), 52038 captured: keyOf({ onDragEndCapture: true }) 52039 } 52040 }, 52041 dragEnter: { 52042 phasedRegistrationNames: { 52043 bubbled: keyOf({ onDragEnter: true }), 52044 captured: keyOf({ onDragEnterCapture: true }) 52045 } 52046 }, 52047 dragExit: { 52048 phasedRegistrationNames: { 52049 bubbled: keyOf({ onDragExit: true }), 52050 captured: keyOf({ onDragExitCapture: true }) 52051 } 52052 }, 52053 dragLeave: { 52054 phasedRegistrationNames: { 52055 bubbled: keyOf({ onDragLeave: true }), 52056 captured: keyOf({ onDragLeaveCapture: true }) 52057 } 52058 }, 52059 dragOver: { 52060 phasedRegistrationNames: { 52061 bubbled: keyOf({ onDragOver: true }), 52062 captured: keyOf({ onDragOverCapture: true }) 52063 } 52064 }, 52065 dragStart: { 52066 phasedRegistrationNames: { 52067 bubbled: keyOf({ onDragStart: true }), 52068 captured: keyOf({ onDragStartCapture: true }) 52069 } 52070 }, 52071 drop: { 52072 phasedRegistrationNames: { 52073 bubbled: keyOf({ onDrop: true }), 52074 captured: keyOf({ onDropCapture: true }) 52075 } 52076 }, 52077 durationChange: { 52078 phasedRegistrationNames: { 52079 bubbled: keyOf({ onDurationChange: true }), 52080 captured: keyOf({ onDurationChangeCapture: true }) 52081 } 52082 }, 52083 emptied: { 52084 phasedRegistrationNames: { 52085 bubbled: keyOf({ onEmptied: true }), 52086 captured: keyOf({ onEmptiedCapture: true }) 52087 } 52088 }, 52089 encrypted: { 52090 phasedRegistrationNames: { 52091 bubbled: keyOf({ onEncrypted: true }), 52092 captured: keyOf({ onEncryptedCapture: true }) 52093 } 52094 }, 52095 ended: { 52096 phasedRegistrationNames: { 52097 bubbled: keyOf({ onEnded: true }), 52098 captured: keyOf({ onEndedCapture: true }) 52099 } 52100 }, 52101 error: { 52102 phasedRegistrationNames: { 52103 bubbled: keyOf({ onError: true }), 52104 captured: keyOf({ onErrorCapture: true }) 52105 } 52106 }, 52107 focus: { 52108 phasedRegistrationNames: { 52109 bubbled: keyOf({ onFocus: true }), 52110 captured: keyOf({ onFocusCapture: true }) 52111 } 52112 }, 52113 input: { 52114 phasedRegistrationNames: { 52115 bubbled: keyOf({ onInput: true }), 52116 captured: keyOf({ onInputCapture: true }) 52117 } 52118 }, 52119 keyDown: { 52120 phasedRegistrationNames: { 52121 bubbled: keyOf({ onKeyDown: true }), 52122 captured: keyOf({ onKeyDownCapture: true }) 52123 } 52124 }, 52125 keyPress: { 52126 phasedRegistrationNames: { 52127 bubbled: keyOf({ onKeyPress: true }), 52128 captured: keyOf({ onKeyPressCapture: true }) 52129 } 52130 }, 52131 keyUp: { 52132 phasedRegistrationNames: { 52133 bubbled: keyOf({ onKeyUp: true }), 52134 captured: keyOf({ onKeyUpCapture: true }) 52135 } 52136 }, 52137 load: { 52138 phasedRegistrationNames: { 52139 bubbled: keyOf({ onLoad: true }), 52140 captured: keyOf({ onLoadCapture: true }) 52141 } 52142 }, 52143 loadedData: { 52144 phasedRegistrationNames: { 52145 bubbled: keyOf({ onLoadedData: true }), 52146 captured: keyOf({ onLoadedDataCapture: true }) 52147 } 52148 }, 52149 loadedMetadata: { 52150 phasedRegistrationNames: { 52151 bubbled: keyOf({ onLoadedMetadata: true }), 52152 captured: keyOf({ onLoadedMetadataCapture: true }) 52153 } 52154 }, 52155 loadStart: { 52156 phasedRegistrationNames: { 52157 bubbled: keyOf({ onLoadStart: true }), 52158 captured: keyOf({ onLoadStartCapture: true }) 52159 } 52160 }, 52161 // Note: We do not allow listening to mouseOver events. Instead, use the 52162 // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`. 52163 mouseDown: { 52164 phasedRegistrationNames: { 52165 bubbled: keyOf({ onMouseDown: true }), 52166 captured: keyOf({ onMouseDownCapture: true }) 52167 } 52168 }, 52169 mouseMove: { 52170 phasedRegistrationNames: { 52171 bubbled: keyOf({ onMouseMove: true }), 52172 captured: keyOf({ onMouseMoveCapture: true }) 52173 } 52174 }, 52175 mouseOut: { 52176 phasedRegistrationNames: { 52177 bubbled: keyOf({ onMouseOut: true }), 52178 captured: keyOf({ onMouseOutCapture: true }) 52179 } 52180 }, 52181 mouseOver: { 52182 phasedRegistrationNames: { 52183 bubbled: keyOf({ onMouseOver: true }), 52184 captured: keyOf({ onMouseOverCapture: true }) 52185 } 52186 }, 52187 mouseUp: { 52188 phasedRegistrationNames: { 52189 bubbled: keyOf({ onMouseUp: true }), 52190 captured: keyOf({ onMouseUpCapture: true }) 52191 } 52192 }, 52193 paste: { 52194 phasedRegistrationNames: { 52195 bubbled: keyOf({ onPaste: true }), 52196 captured: keyOf({ onPasteCapture: true }) 52197 } 52198 }, 52199 pause: { 52200 phasedRegistrationNames: { 52201 bubbled: keyOf({ onPause: true }), 52202 captured: keyOf({ onPauseCapture: true }) 52203 } 52204 }, 52205 play: { 52206 phasedRegistrationNames: { 52207 bubbled: keyOf({ onPlay: true }), 52208 captured: keyOf({ onPlayCapture: true }) 52209 } 52210 }, 52211 playing: { 52212 phasedRegistrationNames: { 52213 bubbled: keyOf({ onPlaying: true }), 52214 captured: keyOf({ onPlayingCapture: true }) 52215 } 52216 }, 52217 progress: { 52218 phasedRegistrationNames: { 52219 bubbled: keyOf({ onProgress: true }), 52220 captured: keyOf({ onProgressCapture: true }) 52221 } 52222 }, 52223 rateChange: { 52224 phasedRegistrationNames: { 52225 bubbled: keyOf({ onRateChange: true }), 52226 captured: keyOf({ onRateChangeCapture: true }) 52227 } 52228 }, 52229 reset: { 52230 phasedRegistrationNames: { 52231 bubbled: keyOf({ onReset: true }), 52232 captured: keyOf({ onResetCapture: true }) 52233 } 52234 }, 52235 scroll: { 52236 phasedRegistrationNames: { 52237 bubbled: keyOf({ onScroll: true }), 52238 captured: keyOf({ onScrollCapture: true }) 52239 } 52240 }, 52241 seeked: { 52242 phasedRegistrationNames: { 52243 bubbled: keyOf({ onSeeked: true }), 52244 captured: keyOf({ onSeekedCapture: true }) 52245 } 52246 }, 52247 seeking: { 52248 phasedRegistrationNames: { 52249 bubbled: keyOf({ onSeeking: true }), 52250 captured: keyOf({ onSeekingCapture: true }) 52251 } 52252 }, 52253 stalled: { 52254 phasedRegistrationNames: { 52255 bubbled: keyOf({ onStalled: true }), 52256 captured: keyOf({ onStalledCapture: true }) 52257 } 52258 }, 52259 submit: { 52260 phasedRegistrationNames: { 52261 bubbled: keyOf({ onSubmit: true }), 52262 captured: keyOf({ onSubmitCapture: true }) 52263 } 52264 }, 52265 suspend: { 52266 phasedRegistrationNames: { 52267 bubbled: keyOf({ onSuspend: true }), 52268 captured: keyOf({ onSuspendCapture: true }) 52269 } 52270 }, 52271 timeUpdate: { 52272 phasedRegistrationNames: { 52273 bubbled: keyOf({ onTimeUpdate: true }), 52274 captured: keyOf({ onTimeUpdateCapture: true }) 52275 } 52276 }, 52277 touchCancel: { 52278 phasedRegistrationNames: { 52279 bubbled: keyOf({ onTouchCancel: true }), 52280 captured: keyOf({ onTouchCancelCapture: true }) 52281 } 52282 }, 52283 touchEnd: { 52284 phasedRegistrationNames: { 52285 bubbled: keyOf({ onTouchEnd: true }), 52286 captured: keyOf({ onTouchEndCapture: true }) 52287 } 52288 }, 52289 touchMove: { 52290 phasedRegistrationNames: { 52291 bubbled: keyOf({ onTouchMove: true }), 52292 captured: keyOf({ onTouchMoveCapture: true }) 52293 } 52294 }, 52295 touchStart: { 52296 phasedRegistrationNames: { 52297 bubbled: keyOf({ onTouchStart: true }), 52298 captured: keyOf({ onTouchStartCapture: true }) 52299 } 52300 }, 52301 volumeChange: { 52302 phasedRegistrationNames: { 52303 bubbled: keyOf({ onVolumeChange: true }), 52304 captured: keyOf({ onVolumeChangeCapture: true }) 52305 } 52306 }, 52307 waiting: { 52308 phasedRegistrationNames: { 52309 bubbled: keyOf({ onWaiting: true }), 52310 captured: keyOf({ onWaitingCapture: true }) 52311 } 52312 }, 52313 wheel: { 52314 phasedRegistrationNames: { 52315 bubbled: keyOf({ onWheel: true }), 52316 captured: keyOf({ onWheelCapture: true }) 52317 } 52318 } 52319}; 52320 52321var topLevelEventsToDispatchConfig = { 52322 topAbort: eventTypes.abort, 52323 topBlur: eventTypes.blur, 52324 topCanPlay: eventTypes.canPlay, 52325 topCanPlayThrough: eventTypes.canPlayThrough, 52326 topClick: eventTypes.click, 52327 topContextMenu: eventTypes.contextMenu, 52328 topCopy: eventTypes.copy, 52329 topCut: eventTypes.cut, 52330 topDoubleClick: eventTypes.doubleClick, 52331 topDrag: eventTypes.drag, 52332 topDragEnd: eventTypes.dragEnd, 52333 topDragEnter: eventTypes.dragEnter, 52334 topDragExit: eventTypes.dragExit, 52335 topDragLeave: eventTypes.dragLeave, 52336 topDragOver: eventTypes.dragOver, 52337 topDragStart: eventTypes.dragStart, 52338 topDrop: eventTypes.drop, 52339 topDurationChange: eventTypes.durationChange, 52340 topEmptied: eventTypes.emptied, 52341 topEncrypted: eventTypes.encrypted, 52342 topEnded: eventTypes.ended, 52343 topError: eventTypes.error, 52344 topFocus: eventTypes.focus, 52345 topInput: eventTypes.input, 52346 topKeyDown: eventTypes.keyDown, 52347 topKeyPress: eventTypes.keyPress, 52348 topKeyUp: eventTypes.keyUp, 52349 topLoad: eventTypes.load, 52350 topLoadedData: eventTypes.loadedData, 52351 topLoadedMetadata: eventTypes.loadedMetadata, 52352 topLoadStart: eventTypes.loadStart, 52353 topMouseDown: eventTypes.mouseDown, 52354 topMouseMove: eventTypes.mouseMove, 52355 topMouseOut: eventTypes.mouseOut, 52356 topMouseOver: eventTypes.mouseOver, 52357 topMouseUp: eventTypes.mouseUp, 52358 topPaste: eventTypes.paste, 52359 topPause: eventTypes.pause, 52360 topPlay: eventTypes.play, 52361 topPlaying: eventTypes.playing, 52362 topProgress: eventTypes.progress, 52363 topRateChange: eventTypes.rateChange, 52364 topReset: eventTypes.reset, 52365 topScroll: eventTypes.scroll, 52366 topSeeked: eventTypes.seeked, 52367 topSeeking: eventTypes.seeking, 52368 topStalled: eventTypes.stalled, 52369 topSubmit: eventTypes.submit, 52370 topSuspend: eventTypes.suspend, 52371 topTimeUpdate: eventTypes.timeUpdate, 52372 topTouchCancel: eventTypes.touchCancel, 52373 topTouchEnd: eventTypes.touchEnd, 52374 topTouchMove: eventTypes.touchMove, 52375 topTouchStart: eventTypes.touchStart, 52376 topVolumeChange: eventTypes.volumeChange, 52377 topWaiting: eventTypes.waiting, 52378 topWheel: eventTypes.wheel 52379}; 52380 52381for (var type in topLevelEventsToDispatchConfig) { 52382 topLevelEventsToDispatchConfig[type].dependencies = [type]; 52383} 52384 52385var ON_CLICK_KEY = keyOf({ onClick: null }); 52386var onClickListeners = {}; 52387 52388var SimpleEventPlugin = { 52389 52390 eventTypes: eventTypes, 52391 52392 /** 52393 * @param {string} topLevelType Record from `EventConstants`. 52394 * @param {DOMEventTarget} topLevelTarget The listening component root node. 52395 * @param {string} topLevelTargetID ID of `topLevelTarget`. 52396 * @param {object} nativeEvent Native browser event. 52397 * @return {*} An accumulation of synthetic events. 52398 * @see {EventPluginHub.extractEvents} 52399 */ 52400 extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { 52401 var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; 52402 if (!dispatchConfig) { 52403 return null; 52404 } 52405 var EventConstructor; 52406 switch (topLevelType) { 52407 case topLevelTypes.topAbort: 52408 case topLevelTypes.topCanPlay: 52409 case topLevelTypes.topCanPlayThrough: 52410 case topLevelTypes.topDurationChange: 52411 case topLevelTypes.topEmptied: 52412 case topLevelTypes.topEncrypted: 52413 case topLevelTypes.topEnded: 52414 case topLevelTypes.topError: 52415 case topLevelTypes.topInput: 52416 case topLevelTypes.topLoad: 52417 case topLevelTypes.topLoadedData: 52418 case topLevelTypes.topLoadedMetadata: 52419 case topLevelTypes.topLoadStart: 52420 case topLevelTypes.topPause: 52421 case topLevelTypes.topPlay: 52422 case topLevelTypes.topPlaying: 52423 case topLevelTypes.topProgress: 52424 case topLevelTypes.topRateChange: 52425 case topLevelTypes.topReset: 52426 case topLevelTypes.topSeeked: 52427 case topLevelTypes.topSeeking: 52428 case topLevelTypes.topStalled: 52429 case topLevelTypes.topSubmit: 52430 case topLevelTypes.topSuspend: 52431 case topLevelTypes.topTimeUpdate: 52432 case topLevelTypes.topVolumeChange: 52433 case topLevelTypes.topWaiting: 52434 // HTML Events 52435 // @see http://www.w3.org/TR/html5/index.html#events-0 52436 EventConstructor = SyntheticEvent; 52437 break; 52438 case topLevelTypes.topKeyPress: 52439 // FireFox creates a keypress event for function keys too. This removes 52440 // the unwanted keypress events. Enter is however both printable and 52441 // non-printable. One would expect Tab to be as well (but it isn't). 52442 if (getEventCharCode(nativeEvent) === 0) { 52443 return null; 52444 } 52445 /* falls through */ 52446 case topLevelTypes.topKeyDown: 52447 case topLevelTypes.topKeyUp: 52448 EventConstructor = SyntheticKeyboardEvent; 52449 break; 52450 case topLevelTypes.topBlur: 52451 case topLevelTypes.topFocus: 52452 EventConstructor = SyntheticFocusEvent; 52453 break; 52454 case topLevelTypes.topClick: 52455 // Firefox creates a click event on right mouse clicks. This removes the 52456 // unwanted click events. 52457 if (nativeEvent.button === 2) { 52458 return null; 52459 } 52460 /* falls through */ 52461 case topLevelTypes.topContextMenu: 52462 case topLevelTypes.topDoubleClick: 52463 case topLevelTypes.topMouseDown: 52464 case topLevelTypes.topMouseMove: 52465 case topLevelTypes.topMouseOut: 52466 case topLevelTypes.topMouseOver: 52467 case topLevelTypes.topMouseUp: 52468 EventConstructor = SyntheticMouseEvent; 52469 break; 52470 case topLevelTypes.topDrag: 52471 case topLevelTypes.topDragEnd: 52472 case topLevelTypes.topDragEnter: 52473 case topLevelTypes.topDragExit: 52474 case topLevelTypes.topDragLeave: 52475 case topLevelTypes.topDragOver: 52476 case topLevelTypes.topDragStart: 52477 case topLevelTypes.topDrop: 52478 EventConstructor = SyntheticDragEvent; 52479 break; 52480 case topLevelTypes.topTouchCancel: 52481 case topLevelTypes.topTouchEnd: 52482 case topLevelTypes.topTouchMove: 52483 case topLevelTypes.topTouchStart: 52484 EventConstructor = SyntheticTouchEvent; 52485 break; 52486 case topLevelTypes.topScroll: 52487 EventConstructor = SyntheticUIEvent; 52488 break; 52489 case topLevelTypes.topWheel: 52490 EventConstructor = SyntheticWheelEvent; 52491 break; 52492 case topLevelTypes.topCopy: 52493 case topLevelTypes.topCut: 52494 case topLevelTypes.topPaste: 52495 EventConstructor = SyntheticClipboardEvent; 52496 break; 52497 } 52498 !EventConstructor ? true ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : undefined : undefined; 52499 var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget); 52500 EventPropagators.accumulateTwoPhaseDispatches(event); 52501 return event; 52502 }, 52503 52504 didPutListener: function (id, registrationName, listener) { 52505 // Mobile Safari does not fire properly bubble click events on 52506 // non-interactive elements, which means delegated click listeners do not 52507 // fire. The workaround for this bug involves attaching an empty click 52508 // listener on the target node. 52509 if (registrationName === ON_CLICK_KEY) { 52510 var node = ReactMount.getNode(id); 52511 if (!onClickListeners[id]) { 52512 onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction); 52513 } 52514 } 52515 }, 52516 52517 willDeleteListener: function (id, registrationName) { 52518 if (registrationName === ON_CLICK_KEY) { 52519 onClickListeners[id].remove(); 52520 delete onClickListeners[id]; 52521 } 52522 } 52523 52524}; 52525 52526module.exports = SimpleEventPlugin; 52527 52528/***/ }), 52529
vendor: 1,648 bytes, lines 52530-52579
52530/***/ "./node_modules/react/lib/SyntheticClipboardEvent.js": 52531/*!***********************************************************!*\ 52532 !*** ./node_modules/react/lib/SyntheticClipboardEvent.js ***! 52533 \***********************************************************/ 52534/*! no static exports found */ 52535/***/ (function(module, exports, __webpack_require__) { 52536 52537"use strict"; 52538/** 52539 * Copyright 2013-2015, Facebook, Inc. 52540 * All rights reserved. 52541 * 52542 * This source code is licensed under the BSD-style license found in the 52543 * LICENSE file in the root directory of this source tree. An additional grant 52544 * of patent rights can be found in the PATENTS file in the same directory. 52545 * 52546 * @providesModule SyntheticClipboardEvent 52547 * @typechecks static-only 52548 */ 52549 52550 52551 52552var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 52553 52554/** 52555 * @interface Event 52556 * @see http://www.w3.org/TR/clipboard-apis/ 52557 */ 52558var ClipboardEventInterface = { 52559 clipboardData: function (event) { 52560 return 'clipboardData' in event ? event.clipboardData : window.clipboardData; 52561 } 52562}; 52563 52564/** 52565 * @param {object} dispatchConfig Configuration used to dispatch this event. 52566 * @param {string} dispatchMarker Marker identifying the event target. 52567 * @param {object} nativeEvent Native browser event. 52568 * @extends {SyntheticUIEvent} 52569 */ 52570function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52571 SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 52572} 52573 52574SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); 52575 52576module.exports = SyntheticClipboardEvent; 52577 52578/***/ }), 52579
vendor: 1,588 bytes, lines 52580-52627
52580/***/ "./node_modules/react/lib/SyntheticCompositionEvent.js": 52581/*!*************************************************************!*\ 52582 !*** ./node_modules/react/lib/SyntheticCompositionEvent.js ***! 52583 \*************************************************************/ 52584/*! no static exports found */ 52585/***/ (function(module, exports, __webpack_require__) { 52586 52587"use strict"; 52588/** 52589 * Copyright 2013-2015, Facebook, Inc. 52590 * All rights reserved. 52591 * 52592 * This source code is licensed under the BSD-style license found in the 52593 * LICENSE file in the root directory of this source tree. An additional grant 52594 * of patent rights can be found in the PATENTS file in the same directory. 52595 * 52596 * @providesModule SyntheticCompositionEvent 52597 * @typechecks static-only 52598 */ 52599 52600 52601 52602var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 52603 52604/** 52605 * @interface Event 52606 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents 52607 */ 52608var CompositionEventInterface = { 52609 data: null 52610}; 52611 52612/** 52613 * @param {object} dispatchConfig Configuration used to dispatch this event. 52614 * @param {string} dispatchMarker Marker identifying the event target. 52615 * @param {object} nativeEvent Native browser event. 52616 * @extends {SyntheticUIEvent} 52617 */ 52618function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52619 SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 52620} 52621 52622SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); 52623 52624module.exports = SyntheticCompositionEvent; 52625 52626/***/ }), 52627
vendor: 1,530 bytes, lines 52628-52675
52628/***/ "./node_modules/react/lib/SyntheticDragEvent.js": 52629/*!******************************************************!*\ 52630 !*** ./node_modules/react/lib/SyntheticDragEvent.js ***! 52631 \******************************************************/ 52632/*! no static exports found */ 52633/***/ (function(module, exports, __webpack_require__) { 52634 52635"use strict"; 52636/** 52637 * Copyright 2013-2015, Facebook, Inc. 52638 * All rights reserved. 52639 * 52640 * This source code is licensed under the BSD-style license found in the 52641 * LICENSE file in the root directory of this source tree. An additional grant 52642 * of patent rights can be found in the PATENTS file in the same directory. 52643 * 52644 * @providesModule SyntheticDragEvent 52645 * @typechecks static-only 52646 */ 52647 52648 52649 52650var SyntheticMouseEvent = __webpack_require__(/*! ./SyntheticMouseEvent */ "./node_modules/react/lib/SyntheticMouseEvent.js"); 52651 52652/** 52653 * @interface DragEvent 52654 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 52655 */ 52656var DragEventInterface = { 52657 dataTransfer: null 52658}; 52659 52660/** 52661 * @param {object} dispatchConfig Configuration used to dispatch this event. 52662 * @param {string} dispatchMarker Marker identifying the event target. 52663 * @param {object} nativeEvent Native browser event. 52664 * @extends {SyntheticUIEvent} 52665 */ 52666function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52667 SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 52668} 52669 52670SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); 52671 52672module.exports = SyntheticDragEvent; 52673 52674/***/ }), 52675
vendor: 6,214 bytes, lines 52676-52866
52676/***/ "./node_modules/react/lib/SyntheticEvent.js": 52677/*!**************************************************!*\ 52678 !*** ./node_modules/react/lib/SyntheticEvent.js ***! 52679 \**************************************************/ 52680/*! no static exports found */ 52681/***/ (function(module, exports, __webpack_require__) { 52682 52683"use strict"; 52684/** 52685 * Copyright 2013-2015, Facebook, Inc. 52686 * All rights reserved. 52687 * 52688 * This source code is licensed under the BSD-style license found in the 52689 * LICENSE file in the root directory of this source tree. An additional grant 52690 * of patent rights can be found in the PATENTS file in the same directory. 52691 * 52692 * @providesModule SyntheticEvent 52693 * @typechecks static-only 52694 */ 52695 52696 52697 52698var PooledClass = __webpack_require__(/*! ./PooledClass */ "./node_modules/react/lib/PooledClass.js"); 52699 52700var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 52701var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 52702var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 52703 52704/** 52705 * @interface Event 52706 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 52707 */ 52708var EventInterface = { 52709 type: null, 52710 target: null, 52711 // currentTarget is set when dispatching; no use in copying it here 52712 currentTarget: emptyFunction.thatReturnsNull, 52713 eventPhase: null, 52714 bubbles: null, 52715 cancelable: null, 52716 timeStamp: function (event) { 52717 return event.timeStamp || Date.now(); 52718 }, 52719 defaultPrevented: null, 52720 isTrusted: null 52721}; 52722 52723/** 52724 * Synthetic events are dispatched by event plugins, typically in response to a 52725 * top-level event delegation handler. 52726 * 52727 * These systems should generally use pooling to reduce the frequency of garbage 52728 * collection. The system should check `isPersistent` to determine whether the 52729 * event should be released into the pool after being dispatched. Users that 52730 * need a persisted event should invoke `persist`. 52731 * 52732 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by 52733 * normalizing browser quirks. Subclasses do not necessarily have to implement a 52734 * DOM interface; custom application-specific events can also subclass this. 52735 * 52736 * @param {object} dispatchConfig Configuration used to dispatch this event. 52737 * @param {string} dispatchMarker Marker identifying the event target. 52738 * @param {object} nativeEvent Native browser event. 52739 */ 52740function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52741 this.dispatchConfig = dispatchConfig; 52742 this.dispatchMarker = dispatchMarker; 52743 this.nativeEvent = nativeEvent; 52744 52745 var Interface = this.constructor.Interface; 52746 for (var propName in Interface) { 52747 if (!Interface.hasOwnProperty(propName)) { 52748 continue; 52749 } 52750 var normalize = Interface[propName]; 52751 if (normalize) { 52752 this[propName] = normalize(nativeEvent); 52753 } else { 52754 if (propName === 'target') { 52755 this.target = nativeEventTarget; 52756 } else { 52757 this[propName] = nativeEvent[propName]; 52758 } 52759 } 52760 } 52761 52762 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; 52763 if (defaultPrevented) { 52764 this.isDefaultPrevented = emptyFunction.thatReturnsTrue; 52765 } else { 52766 this.isDefaultPrevented = emptyFunction.thatReturnsFalse; 52767 } 52768 this.isPropagationStopped = emptyFunction.thatReturnsFalse; 52769} 52770 52771assign(SyntheticEvent.prototype, { 52772 52773 preventDefault: function () { 52774 this.defaultPrevented = true; 52775 var event = this.nativeEvent; 52776 if (true) { 52777 true ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined; 52778 } 52779 if (!event) { 52780 return; 52781 } 52782 52783 if (event.preventDefault) { 52784 event.preventDefault(); 52785 } else { 52786 event.returnValue = false; 52787 } 52788 this.isDefaultPrevented = emptyFunction.thatReturnsTrue; 52789 }, 52790 52791 stopPropagation: function () { 52792 var event = this.nativeEvent; 52793 if (true) { 52794 true ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined; 52795 } 52796 if (!event) { 52797 return; 52798 } 52799 52800 if (event.stopPropagation) { 52801 event.stopPropagation(); 52802 } else { 52803 event.cancelBubble = true; 52804 } 52805 this.isPropagationStopped = emptyFunction.thatReturnsTrue; 52806 }, 52807 52808 /** 52809 * We release all dispatched `SyntheticEvent`s after each event loop, adding 52810 * them back into the pool. This allows a way to hold onto a reference that 52811 * won't be added back into the pool. 52812 */ 52813 persist: function () { 52814 this.isPersistent = emptyFunction.thatReturnsTrue; 52815 }, 52816 52817 /** 52818 * Checks if this event should be released back into the pool. 52819 * 52820 * @return {boolean} True if this should not be released, false otherwise. 52821 */ 52822 isPersistent: emptyFunction.thatReturnsFalse, 52823 52824 /** 52825 * `PooledClass` looks for `destructor` on each instance it releases. 52826 */ 52827 destructor: function () { 52828 var Interface = this.constructor.Interface; 52829 for (var propName in Interface) { 52830 this[propName] = null; 52831 } 52832 this.dispatchConfig = null; 52833 this.dispatchMarker = null; 52834 this.nativeEvent = null; 52835 } 52836 52837}); 52838 52839SyntheticEvent.Interface = EventInterface; 52840 52841/** 52842 * Helper to reduce boilerplate when creating subclasses. 52843 * 52844 * @param {function} Class 52845 * @param {?object} Interface 52846 */ 52847SyntheticEvent.augmentClass = function (Class, Interface) { 52848 var Super = this; 52849 52850 var prototype = Object.create(Super.prototype); 52851 assign(prototype, Class.prototype); 52852 Class.prototype = prototype; 52853 Class.prototype.constructor = Class; 52854 52855 Class.Interface = assign({}, Super.Interface, Interface); 52856 Class.augmentClass = Super.augmentClass; 52857 52858 PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); 52859}; 52860 52861PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); 52862 52863module.exports = SyntheticEvent; 52864 52865/***/ }), 52866
vendor: 1,527 bytes, lines 52867-52914
52867/***/ "./node_modules/react/lib/SyntheticFocusEvent.js": 52868/*!*******************************************************!*\ 52869 !*** ./node_modules/react/lib/SyntheticFocusEvent.js ***! 52870 \*******************************************************/ 52871/*! no static exports found */ 52872/***/ (function(module, exports, __webpack_require__) { 52873 52874"use strict"; 52875/** 52876 * Copyright 2013-2015, Facebook, Inc. 52877 * All rights reserved. 52878 * 52879 * This source code is licensed under the BSD-style license found in the 52880 * LICENSE file in the root directory of this source tree. An additional grant 52881 * of patent rights can be found in the PATENTS file in the same directory. 52882 * 52883 * @providesModule SyntheticFocusEvent 52884 * @typechecks static-only 52885 */ 52886 52887 52888 52889var SyntheticUIEvent = __webpack_require__(/*! ./SyntheticUIEvent */ "./node_modules/react/lib/SyntheticUIEvent.js"); 52890 52891/** 52892 * @interface FocusEvent 52893 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 52894 */ 52895var FocusEventInterface = { 52896 relatedTarget: null 52897}; 52898 52899/** 52900 * @param {object} dispatchConfig Configuration used to dispatch this event. 52901 * @param {string} dispatchMarker Marker identifying the event target. 52902 * @param {object} nativeEvent Native browser event. 52903 * @extends {SyntheticUIEvent} 52904 */ 52905function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52906 SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 52907} 52908 52909SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); 52910 52911module.exports = SyntheticFocusEvent; 52912 52913/***/ }), 52914
vendor: 1,548 bytes, lines 52915-52963
52915/***/ "./node_modules/react/lib/SyntheticInputEvent.js": 52916/*!*******************************************************!*\ 52917 !*** ./node_modules/react/lib/SyntheticInputEvent.js ***! 52918 \*******************************************************/ 52919/*! no static exports found */ 52920/***/ (function(module, exports, __webpack_require__) { 52921 52922"use strict"; 52923/** 52924 * Copyright 2013-2015, Facebook, Inc. 52925 * All rights reserved. 52926 * 52927 * This source code is licensed under the BSD-style license found in the 52928 * LICENSE file in the root directory of this source tree. An additional grant 52929 * of patent rights can be found in the PATENTS file in the same directory. 52930 * 52931 * @providesModule SyntheticInputEvent 52932 * @typechecks static-only 52933 */ 52934 52935 52936 52937var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 52938 52939/** 52940 * @interface Event 52941 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 52942 * /#events-inputevents 52943 */ 52944var InputEventInterface = { 52945 data: null 52946}; 52947 52948/** 52949 * @param {object} dispatchConfig Configuration used to dispatch this event. 52950 * @param {string} dispatchMarker Marker identifying the event target. 52951 * @param {object} nativeEvent Native browser event. 52952 * @extends {SyntheticUIEvent} 52953 */ 52954function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 52955 SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 52956} 52957 52958SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); 52959 52960module.exports = SyntheticInputEvent; 52961 52962/***/ }), 52963
vendor: 3,373 bytes, lines 52964-53059
52964/***/ "./node_modules/react/lib/SyntheticKeyboardEvent.js": 52965/*!**********************************************************!*\ 52966 !*** ./node_modules/react/lib/SyntheticKeyboardEvent.js ***! 52967 \**********************************************************/ 52968/*! no static exports found */ 52969/***/ (function(module, exports, __webpack_require__) { 52970 52971"use strict"; 52972/** 52973 * Copyright 2013-2015, Facebook, Inc. 52974 * All rights reserved. 52975 * 52976 * This source code is licensed under the BSD-style license found in the 52977 * LICENSE file in the root directory of this source tree. An additional grant 52978 * of patent rights can be found in the PATENTS file in the same directory. 52979 * 52980 * @providesModule SyntheticKeyboardEvent 52981 * @typechecks static-only 52982 */ 52983 52984 52985 52986var SyntheticUIEvent = __webpack_require__(/*! ./SyntheticUIEvent */ "./node_modules/react/lib/SyntheticUIEvent.js"); 52987 52988var getEventCharCode = __webpack_require__(/*! ./getEventCharCode */ "./node_modules/react/lib/getEventCharCode.js"); 52989var getEventKey = __webpack_require__(/*! ./getEventKey */ "./node_modules/react/lib/getEventKey.js"); 52990var getEventModifierState = __webpack_require__(/*! ./getEventModifierState */ "./node_modules/react/lib/getEventModifierState.js"); 52991 52992/** 52993 * @interface KeyboardEvent 52994 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 52995 */ 52996var KeyboardEventInterface = { 52997 key: getEventKey, 52998 location: null, 52999 ctrlKey: null, 53000 shiftKey: null, 53001 altKey: null, 53002 metaKey: null, 53003 repeat: null, 53004 locale: null, 53005 getModifierState: getEventModifierState, 53006 // Legacy Interface 53007 charCode: function (event) { 53008 // `charCode` is the result of a KeyPress event and represents the value of 53009 // the actual printable character. 53010 53011 // KeyPress is deprecated, but its replacement is not yet final and not 53012 // implemented in any major browser. Only KeyPress has charCode. 53013 if (event.type === 'keypress') { 53014 return getEventCharCode(event); 53015 } 53016 return 0; 53017 }, 53018 keyCode: function (event) { 53019 // `keyCode` is the result of a KeyDown/Up event and represents the value of 53020 // physical keyboard key. 53021 53022 // The actual meaning of the value depends on the users' keyboard layout 53023 // which cannot be detected. Assuming that it is a US keyboard layout 53024 // provides a surprisingly accurate mapping for US and European users. 53025 // Due to this, it is left to the user to implement at this time. 53026 if (event.type === 'keydown' || event.type === 'keyup') { 53027 return event.keyCode; 53028 } 53029 return 0; 53030 }, 53031 which: function (event) { 53032 // `which` is an alias for either `keyCode` or `charCode` depending on the 53033 // type of the event. 53034 if (event.type === 'keypress') { 53035 return getEventCharCode(event); 53036 } 53037 if (event.type === 'keydown' || event.type === 'keyup') { 53038 return event.keyCode; 53039 } 53040 return 0; 53041 } 53042}; 53043 53044/** 53045 * @param {object} dispatchConfig Configuration used to dispatch this event. 53046 * @param {string} dispatchMarker Marker identifying the event target. 53047 * @param {object} nativeEvent Native browser event. 53048 * @extends {SyntheticUIEvent} 53049 */ 53050function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 53051 SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 53052} 53053 53054SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); 53055 53056module.exports = SyntheticKeyboardEvent; 53057 53058/***/ }), 53059
vendor: 2,734 bytes, lines 53060-53143
53060/***/ "./node_modules/react/lib/SyntheticMouseEvent.js": 53061/*!*******************************************************!*\ 53062 !*** ./node_modules/react/lib/SyntheticMouseEvent.js ***! 53063 \*******************************************************/ 53064/*! no static exports found */ 53065/***/ (function(module, exports, __webpack_require__) { 53066 53067"use strict"; 53068/** 53069 * Copyright 2013-2015, Facebook, Inc. 53070 * All rights reserved. 53071 * 53072 * This source code is licensed under the BSD-style license found in the 53073 * LICENSE file in the root directory of this source tree. An additional grant 53074 * of patent rights can be found in the PATENTS file in the same directory. 53075 * 53076 * @providesModule SyntheticMouseEvent 53077 * @typechecks static-only 53078 */ 53079 53080 53081 53082var SyntheticUIEvent = __webpack_require__(/*! ./SyntheticUIEvent */ "./node_modules/react/lib/SyntheticUIEvent.js"); 53083var ViewportMetrics = __webpack_require__(/*! ./ViewportMetrics */ "./node_modules/react/lib/ViewportMetrics.js"); 53084 53085var getEventModifierState = __webpack_require__(/*! ./getEventModifierState */ "./node_modules/react/lib/getEventModifierState.js"); 53086 53087/** 53088 * @interface MouseEvent 53089 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 53090 */ 53091var MouseEventInterface = { 53092 screenX: null, 53093 screenY: null, 53094 clientX: null, 53095 clientY: null, 53096 ctrlKey: null, 53097 shiftKey: null, 53098 altKey: null, 53099 metaKey: null, 53100 getModifierState: getEventModifierState, 53101 button: function (event) { 53102 // Webkit, Firefox, IE9+ 53103 // which: 1 2 3 53104 // button: 0 1 2 (standard) 53105 var button = event.button; 53106 if ('which' in event) { 53107 return button; 53108 } 53109 // IE<9 53110 // which: undefined 53111 // button: 0 0 0 53112 // button: 1 4 2 (onmouseup) 53113 return button === 2 ? 2 : button === 4 ? 1 : 0; 53114 }, 53115 buttons: null, 53116 relatedTarget: function (event) { 53117 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); 53118 }, 53119 // "Proprietary" Interface. 53120 pageX: function (event) { 53121 return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; 53122 }, 53123 pageY: function (event) { 53124 return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; 53125 } 53126}; 53127 53128/** 53129 * @param {object} dispatchConfig Configuration used to dispatch this event. 53130 * @param {string} dispatchMarker Marker identifying the event target. 53131 * @param {object} nativeEvent Native browser event. 53132 * @extends {SyntheticUIEvent} 53133 */ 53134function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 53135 SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 53136} 53137 53138SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); 53139 53140module.exports = SyntheticMouseEvent; 53141 53142/***/ }), 53143
vendor: 1,807 bytes, lines 53144-53200
53144/***/ "./node_modules/react/lib/SyntheticTouchEvent.js": 53145/*!*******************************************************!*\ 53146 !*** ./node_modules/react/lib/SyntheticTouchEvent.js ***! 53147 \*******************************************************/ 53148/*! no static exports found */ 53149/***/ (function(module, exports, __webpack_require__) { 53150 53151"use strict"; 53152/** 53153 * Copyright 2013-2015, Facebook, Inc. 53154 * All rights reserved. 53155 * 53156 * This source code is licensed under the BSD-style license found in the 53157 * LICENSE file in the root directory of this source tree. An additional grant 53158 * of patent rights can be found in the PATENTS file in the same directory. 53159 * 53160 * @providesModule SyntheticTouchEvent 53161 * @typechecks static-only 53162 */ 53163 53164 53165 53166var SyntheticUIEvent = __webpack_require__(/*! ./SyntheticUIEvent */ "./node_modules/react/lib/SyntheticUIEvent.js"); 53167 53168var getEventModifierState = __webpack_require__(/*! ./getEventModifierState */ "./node_modules/react/lib/getEventModifierState.js"); 53169 53170/** 53171 * @interface TouchEvent 53172 * @see http://www.w3.org/TR/touch-events/ 53173 */ 53174var TouchEventInterface = { 53175 touches: null, 53176 targetTouches: null, 53177 changedTouches: null, 53178 altKey: null, 53179 metaKey: null, 53180 ctrlKey: null, 53181 shiftKey: null, 53182 getModifierState: getEventModifierState 53183}; 53184 53185/** 53186 * @param {object} dispatchConfig Configuration used to dispatch this event. 53187 * @param {string} dispatchMarker Marker identifying the event target. 53188 * @param {object} nativeEvent Native browser event. 53189 * @extends {SyntheticUIEvent} 53190 */ 53191function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 53192 SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 53193} 53194 53195SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); 53196 53197module.exports = SyntheticTouchEvent; 53198 53199/***/ }), 53200
vendor: 2,095 bytes, lines 53201-53271
53201/***/ "./node_modules/react/lib/SyntheticUIEvent.js": 53202/*!****************************************************!*\ 53203 !*** ./node_modules/react/lib/SyntheticUIEvent.js ***! 53204 \****************************************************/ 53205/*! no static exports found */ 53206/***/ (function(module, exports, __webpack_require__) { 53207 53208"use strict"; 53209/** 53210 * Copyright 2013-2015, Facebook, Inc. 53211 * All rights reserved. 53212 * 53213 * This source code is licensed under the BSD-style license found in the 53214 * LICENSE file in the root directory of this source tree. An additional grant 53215 * of patent rights can be found in the PATENTS file in the same directory. 53216 * 53217 * @providesModule SyntheticUIEvent 53218 * @typechecks static-only 53219 */ 53220 53221 53222 53223var SyntheticEvent = __webpack_require__(/*! ./SyntheticEvent */ "./node_modules/react/lib/SyntheticEvent.js"); 53224 53225var getEventTarget = __webpack_require__(/*! ./getEventTarget */ "./node_modules/react/lib/getEventTarget.js"); 53226 53227/** 53228 * @interface UIEvent 53229 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 53230 */ 53231var UIEventInterface = { 53232 view: function (event) { 53233 if (event.view) { 53234 return event.view; 53235 } 53236 53237 var target = getEventTarget(event); 53238 if (target != null && target.window === target) { 53239 // target is a window object 53240 return target; 53241 } 53242 53243 var doc = target.ownerDocument; 53244 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 53245 if (doc) { 53246 return doc.defaultView || doc.parentWindow; 53247 } else { 53248 return window; 53249 } 53250 }, 53251 detail: function (event) { 53252 return event.detail || 0; 53253 } 53254}; 53255 53256/** 53257 * @param {object} dispatchConfig Configuration used to dispatch this event. 53258 * @param {string} dispatchMarker Marker identifying the event target. 53259 * @param {object} nativeEvent Native browser event. 53260 * @extends {SyntheticEvent} 53261 */ 53262function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 53263 SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 53264} 53265 53266SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); 53267 53268module.exports = SyntheticUIEvent; 53269 53270/***/ }), 53271
vendor: 2,400 bytes, lines 53272-53337
53272/***/ "./node_modules/react/lib/SyntheticWheelEvent.js": 53273/*!*******************************************************!*\ 53274 !*** ./node_modules/react/lib/SyntheticWheelEvent.js ***! 53275 \*******************************************************/ 53276/*! no static exports found */ 53277/***/ (function(module, exports, __webpack_require__) { 53278 53279"use strict"; 53280/** 53281 * Copyright 2013-2015, Facebook, Inc. 53282 * All rights reserved. 53283 * 53284 * This source code is licensed under the BSD-style license found in the 53285 * LICENSE file in the root directory of this source tree. An additional grant 53286 * of patent rights can be found in the PATENTS file in the same directory. 53287 * 53288 * @providesModule SyntheticWheelEvent 53289 * @typechecks static-only 53290 */ 53291 53292 53293 53294var SyntheticMouseEvent = __webpack_require__(/*! ./SyntheticMouseEvent */ "./node_modules/react/lib/SyntheticMouseEvent.js"); 53295 53296/** 53297 * @interface WheelEvent 53298 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 53299 */ 53300var WheelEventInterface = { 53301 deltaX: function (event) { 53302 return 'deltaX' in event ? event.deltaX : 53303 // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 53304 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; 53305 }, 53306 deltaY: function (event) { 53307 return 'deltaY' in event ? event.deltaY : 53308 // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 53309 'wheelDeltaY' in event ? -event.wheelDeltaY : 53310 // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 53311 'wheelDelta' in event ? -event.wheelDelta : 0; 53312 }, 53313 deltaZ: null, 53314 53315 // Browsers without "deltaMode" is reporting in raw wheel delta where one 53316 // notch on the scroll is always +/- 120, roughly equivalent to pixels. 53317 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or 53318 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. 53319 deltaMode: null 53320}; 53321 53322/** 53323 * @param {object} dispatchConfig Configuration used to dispatch this event. 53324 * @param {string} dispatchMarker Marker identifying the event target. 53325 * @param {object} nativeEvent Native browser event. 53326 * @extends {SyntheticMouseEvent} 53327 */ 53328function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 53329 SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 53330} 53331 53332SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); 53333 53334module.exports = SyntheticWheelEvent; 53335 53336/***/ }), 53337
vendor: 9,838 bytes, lines 53338-53579
53338/***/ "./node_modules/react/lib/Transaction.js": 53339/*!***********************************************!*\ 53340 !*** ./node_modules/react/lib/Transaction.js ***! 53341 \***********************************************/ 53342/*! no static exports found */ 53343/***/ (function(module, exports, __webpack_require__) { 53344 53345"use strict"; 53346/** 53347 * Copyright 2013-2015, Facebook, Inc. 53348 * All rights reserved. 53349 * 53350 * This source code is licensed under the BSD-style license found in the 53351 * LICENSE file in the root directory of this source tree. An additional grant 53352 * of patent rights can be found in the PATENTS file in the same directory. 53353 * 53354 * @providesModule Transaction 53355 */ 53356 53357 53358 53359var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 53360 53361/** 53362 * `Transaction` creates a black box that is able to wrap any method such that 53363 * certain invariants are maintained before and after the method is invoked 53364 * (Even if an exception is thrown while invoking the wrapped method). Whoever 53365 * instantiates a transaction can provide enforcers of the invariants at 53366 * creation time. The `Transaction` class itself will supply one additional 53367 * automatic invariant for you - the invariant that any transaction instance 53368 * should not be run while it is already being run. You would typically create a 53369 * single instance of a `Transaction` for reuse multiple times, that potentially 53370 * is used to wrap several different methods. Wrappers are extremely simple - 53371 * they only require implementing two methods. 53372 * 53373 * <pre> 53374 * wrappers (injected at creation time) 53375 * + + 53376 * | | 53377 * +-----------------|--------|--------------+ 53378 * | v | | 53379 * | +---------------+ | | 53380 * | +--| wrapper1 |---|----+ | 53381 * | | +---------------+ v | | 53382 * | | +-------------+ | | 53383 * | | +----| wrapper2 |--------+ | 53384 * | | | +-------------+ | | | 53385 * | | | | | | 53386 * | v v v v | wrapper 53387 * | +---+ +---+ +---------+ +---+ +---+ | invariants 53388 * perform(anyMethod) | | | | | | | | | | | | maintained 53389 * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> 53390 * | | | | | | | | | | | | 53391 * | | | | | | | | | | | | 53392 * | | | | | | | | | | | | 53393 * | +---+ +---+ +---------+ +---+ +---+ | 53394 * | initialize close | 53395 * +-----------------------------------------+ 53396 * </pre> 53397 * 53398 * Use cases: 53399 * - Preserving the input selection ranges before/after reconciliation. 53400 * Restoring selection even in the event of an unexpected error. 53401 * - Deactivating events while rearranging the DOM, preventing blurs/focuses, 53402 * while guaranteeing that afterwards, the event system is reactivated. 53403 * - Flushing a queue of collected DOM mutations to the main UI thread after a 53404 * reconciliation takes place in a worker thread. 53405 * - Invoking any collected `componentDidUpdate` callbacks after rendering new 53406 * content. 53407 * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue 53408 * to preserve the `scrollTop` (an automatic scroll aware DOM). 53409 * - (Future use case): Layout calculations before and after DOM updates. 53410 * 53411 * Transactional plugin API: 53412 * - A module that has an `initialize` method that returns any precomputation. 53413 * - and a `close` method that accepts the precomputation. `close` is invoked 53414 * when the wrapped process is completed, or has failed. 53415 * 53416 * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules 53417 * that implement `initialize` and `close`. 53418 * @return {Transaction} Single transaction for reuse in thread. 53419 * 53420 * @class Transaction 53421 */ 53422var Mixin = { 53423 /** 53424 * Sets up this instance so that it is prepared for collecting metrics. Does 53425 * so such that this setup method may be used on an instance that is already 53426 * initialized, in a way that does not consume additional memory upon reuse. 53427 * That can be useful if you decide to make your subclass of this mixin a 53428 * "PooledClass". 53429 */ 53430 reinitializeTransaction: function () { 53431 this.transactionWrappers = this.getTransactionWrappers(); 53432 if (this.wrapperInitData) { 53433 this.wrapperInitData.length = 0; 53434 } else { 53435 this.wrapperInitData = []; 53436 } 53437 this._isInTransaction = false; 53438 }, 53439 53440 _isInTransaction: false, 53441 53442 /** 53443 * @abstract 53444 * @return {Array<TransactionWrapper>} Array of transaction wrappers. 53445 */ 53446 getTransactionWrappers: null, 53447 53448 isInTransaction: function () { 53449 return !!this._isInTransaction; 53450 }, 53451 53452 /** 53453 * Executes the function within a safety window. Use this for the top level 53454 * methods that result in large amounts of computation/mutations that would 53455 * need to be safety checked. The optional arguments helps prevent the need 53456 * to bind in many cases. 53457 * 53458 * @param {function} method Member of scope to call. 53459 * @param {Object} scope Scope to invoke from. 53460 * @param {Object?=} a Argument to pass to the method. 53461 * @param {Object?=} b Argument to pass to the method. 53462 * @param {Object?=} c Argument to pass to the method. 53463 * @param {Object?=} d Argument to pass to the method. 53464 * @param {Object?=} e Argument to pass to the method. 53465 * @param {Object?=} f Argument to pass to the method. 53466 * 53467 * @return {*} Return value from `method`. 53468 */ 53469 perform: function (method, scope, a, b, c, d, e, f) { 53470 !!this.isInTransaction() ? true ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : undefined : undefined; 53471 var errorThrown; 53472 var ret; 53473 try { 53474 this._isInTransaction = true; 53475 // Catching errors makes debugging more difficult, so we start with 53476 // errorThrown set to true before setting it to false after calling 53477 // close -- if it's still set to true in the finally block, it means 53478 // one of these calls threw. 53479 errorThrown = true; 53480 this.initializeAll(0); 53481 ret = method.call(scope, a, b, c, d, e, f); 53482 errorThrown = false; 53483 } finally { 53484 try { 53485 if (errorThrown) { 53486 // If `method` throws, prefer to show that stack trace over any thrown 53487 // by invoking `closeAll`. 53488 try { 53489 this.closeAll(0); 53490 } catch (err) {} 53491 } else { 53492 // Since `method` didn't throw, we don't want to silence the exception 53493 // here. 53494 this.closeAll(0); 53495 } 53496 } finally { 53497 this._isInTransaction = false; 53498 } 53499 } 53500 return ret; 53501 }, 53502 53503 initializeAll: function (startIndex) { 53504 var transactionWrappers = this.transactionWrappers; 53505 for (var i = startIndex; i < transactionWrappers.length; i++) { 53506 var wrapper = transactionWrappers[i]; 53507 try { 53508 // Catching errors makes debugging more difficult, so we start with the 53509 // OBSERVED_ERROR state before overwriting it with the real return value 53510 // of initialize -- if it's still set to OBSERVED_ERROR in the finally 53511 // block, it means wrapper.initialize threw. 53512 this.wrapperInitData[i] = Transaction.OBSERVED_ERROR; 53513 this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; 53514 } finally { 53515 if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) { 53516 // The initializer for wrapper i threw an error; initialize the 53517 // remaining wrappers but silence any exceptions from them to ensure 53518 // that the first error is the one to bubble up. 53519 try { 53520 this.initializeAll(i + 1); 53521 } catch (err) {} 53522 } 53523 } 53524 } 53525 }, 53526 53527 /** 53528 * Invokes each of `this.transactionWrappers.close[i]` functions, passing into 53529 * them the respective return values of `this.transactionWrappers.init[i]` 53530 * (`close`rs that correspond to initializers that failed will not be 53531 * invoked). 53532 */ 53533 closeAll: function (startIndex) { 53534 !this.isInTransaction() ? true ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : undefined : undefined; 53535 var transactionWrappers = this.transactionWrappers; 53536 for (var i = startIndex; i < transactionWrappers.length; i++) { 53537 var wrapper = transactionWrappers[i]; 53538 var initData = this.wrapperInitData[i]; 53539 var errorThrown; 53540 try { 53541 // Catching errors makes debugging more difficult, so we start with 53542 // errorThrown set to true before setting it to false after calling 53543 // close -- if it's still set to true in the finally block, it means 53544 // wrapper.close threw. 53545 errorThrown = true; 53546 if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) { 53547 wrapper.close.call(this, initData); 53548 } 53549 errorThrown = false; 53550 } finally { 53551 if (errorThrown) { 53552 // The closer for wrapper i threw an error; close the remaining 53553 // wrappers but silence any exceptions from them to ensure that the 53554 // first error is the one to bubble up. 53555 try { 53556 this.closeAll(i + 1); 53557 } catch (e) {} 53558 } 53559 } 53560 } 53561 this.wrapperInitData.length = 0; 53562 } 53563}; 53564 53565var Transaction = { 53566 53567 Mixin: Mixin, 53568 53569 /** 53570 * Token to look for to determine if an error occurred. 53571 */ 53572 OBSERVED_ERROR: {} 53573 53574}; 53575 53576module.exports = Transaction; 53577 53578/***/ }), 53579
vendor: 963 bytes, lines 53580-53617
53580/***/ "./node_modules/react/lib/ViewportMetrics.js": 53581/*!***************************************************!*\ 53582 !*** ./node_modules/react/lib/ViewportMetrics.js ***! 53583 \***************************************************/ 53584/*! no static exports found */ 53585/***/ (function(module, exports, __webpack_require__) { 53586 53587"use strict"; 53588/** 53589 * Copyright 2013-2015, Facebook, Inc. 53590 * All rights reserved. 53591 * 53592 * This source code is licensed under the BSD-style license found in the 53593 * LICENSE file in the root directory of this source tree. An additional grant 53594 * of patent rights can be found in the PATENTS file in the same directory. 53595 * 53596 * @providesModule ViewportMetrics 53597 */ 53598 53599 53600 53601var ViewportMetrics = { 53602 53603 currentScrollLeft: 0, 53604 53605 currentScrollTop: 0, 53606 53607 refreshScrollValues: function (scrollPosition) { 53608 ViewportMetrics.currentScrollLeft = scrollPosition.x; 53609 ViewportMetrics.currentScrollTop = scrollPosition.y; 53610 } 53611 53612}; 53613 53614module.exports = ViewportMetrics; 53615 53616/***/ }), 53617
vendor: 2,081 bytes, lines 53618-53687
53618/***/ "./node_modules/react/lib/accumulateInto.js": 53619/*!**************************************************!*\ 53620 !*** ./node_modules/react/lib/accumulateInto.js ***! 53621 \**************************************************/ 53622/*! no static exports found */ 53623/***/ (function(module, exports, __webpack_require__) { 53624 53625"use strict"; 53626/** 53627 * Copyright 2014-2015, Facebook, Inc. 53628 * All rights reserved. 53629 * 53630 * This source code is licensed under the BSD-style license found in the 53631 * LICENSE file in the root directory of this source tree. An additional grant 53632 * of patent rights can be found in the PATENTS file in the same directory. 53633 * 53634 * @providesModule accumulateInto 53635 */ 53636 53637 53638 53639var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 53640 53641/** 53642 * 53643 * Accumulates items that must not be null or undefined into the first one. This 53644 * is used to conserve memory by avoiding array allocations, and thus sacrifices 53645 * API cleanness. Since `current` can be null before being passed in and not 53646 * null after this function, make sure to assign it back to `current`: 53647 * 53648 * `a = accumulateInto(a, b);` 53649 * 53650 * This API should be sparingly used. Try `accumulate` for something cleaner. 53651 * 53652 * @return {*|array<*>} An accumulation of items. 53653 */ 53654 53655function accumulateInto(current, next) { 53656 !(next != null) ? true ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : undefined : undefined; 53657 if (current == null) { 53658 return next; 53659 } 53660 53661 // Both are not empty. Warning: Never call x.concat(y) when you are not 53662 // certain that x is an Array (x could be a string with concat method). 53663 var currentIsArray = Array.isArray(current); 53664 var nextIsArray = Array.isArray(next); 53665 53666 if (currentIsArray && nextIsArray) { 53667 current.push.apply(current, next); 53668 return current; 53669 } 53670 53671 if (currentIsArray) { 53672 current.push(next); 53673 return current; 53674 } 53675 53676 if (nextIsArray) { 53677 // A bit too dangerous to mutate `next`. 53678 return [current].concat(next); 53679 } 53680 53681 return [current, next]; 53682} 53683 53684module.exports = accumulateInto; 53685 53686/***/ }), 53687
vendor: 1,489 bytes, lines 53688-53740
53688/***/ "./node_modules/react/lib/adler32.js": 53689/*!*******************************************!*\ 53690 !*** ./node_modules/react/lib/adler32.js ***! 53691 \*******************************************/ 53692/*! no static exports found */ 53693/***/ (function(module, exports, __webpack_require__) { 53694 53695"use strict"; 53696/** 53697 * Copyright 2013-2015, Facebook, Inc. 53698 * All rights reserved. 53699 * 53700 * This source code is licensed under the BSD-style license found in the 53701 * LICENSE file in the root directory of this source tree. An additional grant 53702 * of patent rights can be found in the PATENTS file in the same directory. 53703 * 53704 * @providesModule adler32 53705 */ 53706 53707 53708 53709var MOD = 65521; 53710 53711// adler32 is not cryptographically strong, and is only used to sanity check that 53712// markup generated on the server matches the markup generated on the client. 53713// This implementation (a modified version of the SheetJS version) has been optimized 53714// for our use case, at the expense of conforming to the adler32 specification 53715// for non-ascii inputs. 53716function adler32(data) { 53717 var a = 1; 53718 var b = 0; 53719 var i = 0; 53720 var l = data.length; 53721 var m = l & ~0x3; 53722 while (i < m) { 53723 for (; i < Math.min(i + 4096, m); i += 4) { 53724 b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); 53725 } 53726 a %= MOD; 53727 b %= MOD; 53728 } 53729 for (; i < l; i++) { 53730 b += a += data.charCodeAt(i); 53731 } 53732 a %= MOD; 53733 b %= MOD; 53734 return a | b << 16; 53735} 53736 53737module.exports = adler32; 53738 53739/***/ }), 53740
vendor: 929 bytes, lines 53741-53775
53741/***/ "./node_modules/react/lib/canDefineProperty.js": 53742/*!*****************************************************!*\ 53743 !*** ./node_modules/react/lib/canDefineProperty.js ***! 53744 \*****************************************************/ 53745/*! no static exports found */ 53746/***/ (function(module, exports, __webpack_require__) { 53747 53748"use strict"; 53749/** 53750 * Copyright 2013-2015, Facebook, Inc. 53751 * All rights reserved. 53752 * 53753 * This source code is licensed under the BSD-style license found in the 53754 * LICENSE file in the root directory of this source tree. An additional grant 53755 * of patent rights can be found in the PATENTS file in the same directory. 53756 * 53757 * @providesModule canDefineProperty 53758 */ 53759 53760 53761 53762var canDefineProperty = false; 53763if (true) { 53764 try { 53765 Object.defineProperty({}, 'x', { get: function () {} }); 53766 canDefineProperty = true; 53767 } catch (x) { 53768 // IE will fail on defineProperty 53769 } 53770} 53771 53772module.exports = canDefineProperty; 53773 53774/***/ }), 53775
vendor: 2,327 bytes, lines 53776-53841
53776/***/ "./node_modules/react/lib/dangerousStyleValue.js": 53777/*!*******************************************************!*\ 53778 !*** ./node_modules/react/lib/dangerousStyleValue.js ***! 53779 \*******************************************************/ 53780/*! no static exports found */ 53781/***/ (function(module, exports, __webpack_require__) { 53782 53783"use strict"; 53784/** 53785 * Copyright 2013-2015, Facebook, Inc. 53786 * All rights reserved. 53787 * 53788 * This source code is licensed under the BSD-style license found in the 53789 * LICENSE file in the root directory of this source tree. An additional grant 53790 * of patent rights can be found in the PATENTS file in the same directory. 53791 * 53792 * @providesModule dangerousStyleValue 53793 * @typechecks static-only 53794 */ 53795 53796 53797 53798var CSSProperty = __webpack_require__(/*! ./CSSProperty */ "./node_modules/react/lib/CSSProperty.js"); 53799 53800var isUnitlessNumber = CSSProperty.isUnitlessNumber; 53801 53802/** 53803 * Convert a value into the proper css writable value. The style name `name` 53804 * should be logical (no hyphens), as specified 53805 * in `CSSProperty.isUnitlessNumber`. 53806 * 53807 * @param {string} name CSS property name such as `topMargin`. 53808 * @param {*} value CSS property value such as `10px`. 53809 * @return {string} Normalized style value with dimensions applied. 53810 */ 53811function dangerousStyleValue(name, value) { 53812 // Note that we've removed escapeTextForBrowser() calls here since the 53813 // whole string will be escaped when the attribute is injected into 53814 // the markup. If you provide unsafe user data here they can inject 53815 // arbitrary CSS which may be problematic (I couldn't repro this): 53816 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet 53817 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ 53818 // This is not an XSS hole but instead a potential CSS injection issue 53819 // which has lead to a greater discussion about how we're going to 53820 // trust URLs moving forward. See #2115901 53821 53822 var isEmpty = value == null || typeof value === 'boolean' || value === ''; 53823 if (isEmpty) { 53824 return ''; 53825 } 53826 53827 var isNonNumeric = isNaN(value); 53828 if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { 53829 return '' + value; // cast to string 53830 } 53831 53832 if (typeof value === 'string') { 53833 value = value.trim(); 53834 } 53835 return value + 'px'; 53836} 53837 53838module.exports = dangerousStyleValue; 53839 53840/***/ }), 53841
vendor: 2,123 bytes, lines 53842-53900
53842/***/ "./node_modules/react/lib/deprecated.js": 53843/*!**********************************************!*\ 53844 !*** ./node_modules/react/lib/deprecated.js ***! 53845 \**********************************************/ 53846/*! no static exports found */ 53847/***/ (function(module, exports, __webpack_require__) { 53848 53849"use strict"; 53850/** 53851 * Copyright 2013-2015, Facebook, Inc. 53852 * All rights reserved. 53853 * 53854 * This source code is licensed under the BSD-style license found in the 53855 * LICENSE file in the root directory of this source tree. An additional grant 53856 * of patent rights can be found in the PATENTS file in the same directory. 53857 * 53858 * @providesModule deprecated 53859 */ 53860 53861 53862 53863var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 53864var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 53865 53866/** 53867 * This will log a single deprecation notice per function and forward the call 53868 * on to the new API. 53869 * 53870 * @param {string} fnName The name of the function 53871 * @param {string} newModule The module that fn will exist in 53872 * @param {string} newPackage The module that fn will exist in 53873 * @param {*} ctx The context this forwarded call should run in 53874 * @param {function} fn The function to forward on to 53875 * @return {function} The function that will warn once and then call fn 53876 */ 53877function deprecated(fnName, newModule, newPackage, ctx, fn) { 53878 var warned = false; 53879 if (true) { 53880 var newFn = function () { 53881 true ? warning(warned, 53882 // Require examples in this string must be split to prevent React's 53883 // build tools from mistaking them for real requires. 53884 // Otherwise the build tools will attempt to build a '%s' module. 53885 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined; 53886 warned = true; 53887 return fn.apply(ctx, arguments); 53888 }; 53889 // We need to make sure all properties of the original fn are copied over. 53890 // In particular, this is needed to support PropTypes 53891 return assign(newFn, fn); 53892 } 53893 53894 return fn; 53895} 53896 53897module.exports = deprecated; 53898 53899/***/ }), 53900
vendor: 1,222 bytes, lines 53901-53949
53901/***/ "./node_modules/react/lib/escapeTextContentForBrowser.js": 53902/*!***************************************************************!*\ 53903 !*** ./node_modules/react/lib/escapeTextContentForBrowser.js ***! 53904 \***************************************************************/ 53905/*! no static exports found */ 53906/***/ (function(module, exports, __webpack_require__) { 53907 53908"use strict"; 53909/** 53910 * Copyright 2013-2015, Facebook, Inc. 53911 * All rights reserved. 53912 * 53913 * This source code is licensed under the BSD-style license found in the 53914 * LICENSE file in the root directory of this source tree. An additional grant 53915 * of patent rights can be found in the PATENTS file in the same directory. 53916 * 53917 * @providesModule escapeTextContentForBrowser 53918 */ 53919 53920 53921 53922var ESCAPE_LOOKUP = { 53923 '&': '&', 53924 '>': '>', 53925 '<': '<', 53926 '"': '"', 53927 '\'': ''' 53928}; 53929 53930var ESCAPE_REGEX = /[&><"']/g; 53931 53932function escaper(match) { 53933 return ESCAPE_LOOKUP[match]; 53934} 53935 53936/** 53937 * Escapes text to prevent scripting attacks. 53938 * 53939 * @param {*} text Text value to escape. 53940 * @return {string} An escaped string. 53941 */ 53942function escapeTextContentForBrowser(text) { 53943 return ('' + text).replace(ESCAPE_REGEX, escaper); 53944} 53945 53946module.exports = escapeTextContentForBrowser; 53947 53948/***/ }), 53949
vendor: 2,636 bytes, lines 53950-54009
53950/***/ "./node_modules/react/lib/findDOMNode.js": 53951/*!***********************************************!*\ 53952 !*** ./node_modules/react/lib/findDOMNode.js ***! 53953 \***********************************************/ 53954/*! no static exports found */ 53955/***/ (function(module, exports, __webpack_require__) { 53956 53957"use strict"; 53958/** 53959 * Copyright 2013-2015, Facebook, Inc. 53960 * All rights reserved. 53961 * 53962 * This source code is licensed under the BSD-style license found in the 53963 * LICENSE file in the root directory of this source tree. An additional grant 53964 * of patent rights can be found in the PATENTS file in the same directory. 53965 * 53966 * @providesModule findDOMNode 53967 * @typechecks static-only 53968 */ 53969 53970 53971 53972var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 53973var ReactInstanceMap = __webpack_require__(/*! ./ReactInstanceMap */ "./node_modules/react/lib/ReactInstanceMap.js"); 53974var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 53975 53976var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 53977var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 53978 53979/** 53980 * Returns the DOM node rendered by this element. 53981 * 53982 * @param {ReactComponent|DOMElement} componentOrElement 53983 * @return {?DOMElement} The root node of this element. 53984 */ 53985function findDOMNode(componentOrElement) { 53986 if (true) { 53987 var owner = ReactCurrentOwner.current; 53988 if (owner !== null) { 53989 true ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined; 53990 owner._warnedAboutRefsInRender = true; 53991 } 53992 } 53993 if (componentOrElement == null) { 53994 return null; 53995 } 53996 if (componentOrElement.nodeType === 1) { 53997 return componentOrElement; 53998 } 53999 if (ReactInstanceMap.has(componentOrElement)) { 54000 return ReactMount.getNodeFromInstance(componentOrElement); 54001 } 54002 !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? true ? invariant(false, 'findDOMNode was called on an unmounted component.') : undefined : undefined; 54003 true ? true ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : undefined : undefined; 54004} 54005 54006module.exports = findDOMNode; 54007 54008/***/ }), 54009
vendor: 2,034 bytes, lines 54010-54068
54010/***/ "./node_modules/react/lib/flattenChildren.js": 54011/*!***************************************************!*\ 54012 !*** ./node_modules/react/lib/flattenChildren.js ***! 54013 \***************************************************/ 54014/*! no static exports found */ 54015/***/ (function(module, exports, __webpack_require__) { 54016 54017"use strict"; 54018/** 54019 * Copyright 2013-2015, Facebook, Inc. 54020 * All rights reserved. 54021 * 54022 * This source code is licensed under the BSD-style license found in the 54023 * LICENSE file in the root directory of this source tree. An additional grant 54024 * of patent rights can be found in the PATENTS file in the same directory. 54025 * 54026 * @providesModule flattenChildren 54027 */ 54028 54029 54030 54031var traverseAllChildren = __webpack_require__(/*! ./traverseAllChildren */ "./node_modules/react/lib/traverseAllChildren.js"); 54032var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 54033 54034/** 54035 * @param {function} traverseContext Context passed through traversal. 54036 * @param {?ReactComponent} child React child component. 54037 * @param {!string} name String name of key path to child. 54038 */ 54039function flattenSingleChildIntoContext(traverseContext, child, name) { 54040 // We found a component instance. 54041 var result = traverseContext; 54042 var keyUnique = result[name] === undefined; 54043 if (true) { 54044 true ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined; 54045 } 54046 if (keyUnique && child != null) { 54047 result[name] = child; 54048 } 54049} 54050 54051/** 54052 * Flattens children that are typically specified as `props.children`. Any null 54053 * children will not be included in the resulting object. 54054 * @return {!object} flattened children keyed by name. 54055 */ 54056function flattenChildren(children) { 54057 if (children == null) { 54058 return children; 54059 } 54060 var result = {}; 54061 traverseAllChildren(children, flattenSingleChildIntoContext, result); 54062 return result; 54063} 54064 54065module.exports = flattenChildren; 54066 54067/***/ }), 54068
vendor: 1,230 bytes, lines 54069-54108
54069/***/ "./node_modules/react/lib/forEachAccumulated.js": 54070/*!******************************************************!*\ 54071 !*** ./node_modules/react/lib/forEachAccumulated.js ***! 54072 \******************************************************/ 54073/*! no static exports found */ 54074/***/ (function(module, exports, __webpack_require__) { 54075 54076"use strict"; 54077/** 54078 * Copyright 2013-2015, Facebook, Inc. 54079 * All rights reserved. 54080 * 54081 * This source code is licensed under the BSD-style license found in the 54082 * LICENSE file in the root directory of this source tree. An additional grant 54083 * of patent rights can be found in the PATENTS file in the same directory. 54084 * 54085 * @providesModule forEachAccumulated 54086 */ 54087 54088 54089 54090/** 54091 * @param {array} arr an "accumulation" of items which is either an Array or 54092 * a single item. Useful when paired with the `accumulate` module. This is a 54093 * simple utility that allows us to reason about a collection of items, but 54094 * handling the case when there is exactly one item (and we do not need to 54095 * allocate an array). 54096 */ 54097var forEachAccumulated = function (arr, cb, scope) { 54098 if (Array.isArray(arr)) { 54099 arr.forEach(cb, scope); 54100 } else if (arr) { 54101 cb.call(scope, arr); 54102 } 54103}; 54104 54105module.exports = forEachAccumulated; 54106 54107/***/ }), 54108
vendor: 1,893 bytes, lines 54109-54169
54109/***/ "./node_modules/react/lib/getEventCharCode.js": 54110/*!****************************************************!*\ 54111 !*** ./node_modules/react/lib/getEventCharCode.js ***! 54112 \****************************************************/ 54113/*! no static exports found */ 54114/***/ (function(module, exports, __webpack_require__) { 54115 54116"use strict"; 54117/** 54118 * Copyright 2013-2015, Facebook, Inc. 54119 * All rights reserved. 54120 * 54121 * This source code is licensed under the BSD-style license found in the 54122 * LICENSE file in the root directory of this source tree. An additional grant 54123 * of patent rights can be found in the PATENTS file in the same directory. 54124 * 54125 * @providesModule getEventCharCode 54126 * @typechecks static-only 54127 */ 54128 54129 54130 54131/** 54132 * `charCode` represents the actual "character code" and is safe to use with 54133 * `String.fromCharCode`. As such, only keys that correspond to printable 54134 * characters produce a valid `charCode`, the only exception to this is Enter. 54135 * The Tab-key is considered non-printable and does not have a `charCode`, 54136 * presumably because it does not produce a tab-character in browsers. 54137 * 54138 * @param {object} nativeEvent Native browser event. 54139 * @return {number} Normalized `charCode` property. 54140 */ 54141function getEventCharCode(nativeEvent) { 54142 var charCode; 54143 var keyCode = nativeEvent.keyCode; 54144 54145 if ('charCode' in nativeEvent) { 54146 charCode = nativeEvent.charCode; 54147 54148 // FF does not set `charCode` for the Enter-key, check against `keyCode`. 54149 if (charCode === 0 && keyCode === 13) { 54150 charCode = 13; 54151 } 54152 } else { 54153 // IE8 does not implement `charCode`, but `keyCode` has the correct value. 54154 charCode = keyCode; 54155 } 54156 54157 // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. 54158 // Must not discard the (non-)printable Enter-key. 54159 if (charCode >= 32 || charCode === 13) { 54160 return charCode; 54161 } 54162 54163 return 0; 54164} 54165 54166module.exports = getEventCharCode; 54167 54168/***/ }), 54169
vendor: 3,300 bytes, lines 54170-54283
54170/***/ "./node_modules/react/lib/getEventKey.js": 54171/*!***********************************************!*\ 54172 !*** ./node_modules/react/lib/getEventKey.js ***! 54173 \***********************************************/ 54174/*! no static exports found */ 54175/***/ (function(module, exports, __webpack_require__) { 54176 54177"use strict"; 54178/** 54179 * Copyright 2013-2015, Facebook, Inc. 54180 * All rights reserved. 54181 * 54182 * This source code is licensed under the BSD-style license found in the 54183 * LICENSE file in the root directory of this source tree. An additional grant 54184 * of patent rights can be found in the PATENTS file in the same directory. 54185 * 54186 * @providesModule getEventKey 54187 * @typechecks static-only 54188 */ 54189 54190 54191 54192var getEventCharCode = __webpack_require__(/*! ./getEventCharCode */ "./node_modules/react/lib/getEventCharCode.js"); 54193 54194/** 54195 * Normalization of deprecated HTML5 `key` values 54196 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 54197 */ 54198var normalizeKey = { 54199 'Esc': 'Escape', 54200 'Spacebar': ' ', 54201 'Left': 'ArrowLeft', 54202 'Up': 'ArrowUp', 54203 'Right': 'ArrowRight', 54204 'Down': 'ArrowDown', 54205 'Del': 'Delete', 54206 'Win': 'OS', 54207 'Menu': 'ContextMenu', 54208 'Apps': 'ContextMenu', 54209 'Scroll': 'ScrollLock', 54210 'MozPrintableKey': 'Unidentified' 54211}; 54212 54213/** 54214 * Translation from legacy `keyCode` to HTML5 `key` 54215 * Only special keys supported, all others depend on keyboard layout or browser 54216 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 54217 */ 54218var translateToKey = { 54219 8: 'Backspace', 54220 9: 'Tab', 54221 12: 'Clear', 54222 13: 'Enter', 54223 16: 'Shift', 54224 17: 'Control', 54225 18: 'Alt', 54226 19: 'Pause', 54227 20: 'CapsLock', 54228 27: 'Escape', 54229 32: ' ', 54230 33: 'PageUp', 54231 34: 'PageDown', 54232 35: 'End', 54233 36: 'Home', 54234 37: 'ArrowLeft', 54235 38: 'ArrowUp', 54236 39: 'ArrowRight', 54237 40: 'ArrowDown', 54238 45: 'Insert', 54239 46: 'Delete', 54240 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', 54241 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', 54242 144: 'NumLock', 54243 145: 'ScrollLock', 54244 224: 'Meta' 54245}; 54246 54247/** 54248 * @param {object} nativeEvent Native browser event. 54249 * @return {string} Normalized `key` property. 54250 */ 54251function getEventKey(nativeEvent) { 54252 if (nativeEvent.key) { 54253 // Normalize inconsistent values reported by browsers due to 54254 // implementations of a working draft specification. 54255 54256 // FireFox implements `key` but returns `MozPrintableKey` for all 54257 // printable characters (normalized to `Unidentified`), ignore it. 54258 var key = normalizeKey[nativeEvent.key] || nativeEvent.key; 54259 if (key !== 'Unidentified') { 54260 return key; 54261 } 54262 } 54263 54264 // Browser does not implement `key`, polyfill as much of it as we can. 54265 if (nativeEvent.type === 'keypress') { 54266 var charCode = getEventCharCode(nativeEvent); 54267 54268 // The enter-key is technically both printable and non-printable and can 54269 // thus be captured by `keypress`, no other non-printable key should. 54270 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); 54271 } 54272 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { 54273 // While user keyboard layout determines the actual meaning of each 54274 // `keyCode` value, almost all function keys have a universal value. 54275 return translateToKey[nativeEvent.keyCode] || 'Unidentified'; 54276 } 54277 return ''; 54278} 54279 54280module.exports = getEventKey; 54281 54282/***/ }), 54283
vendor: 1,647 bytes, lines 54284-54338
54284/***/ "./node_modules/react/lib/getEventModifierState.js": 54285/*!*********************************************************!*\ 54286 !*** ./node_modules/react/lib/getEventModifierState.js ***! 54287 \*********************************************************/ 54288/*! no static exports found */ 54289/***/ (function(module, exports, __webpack_require__) { 54290 54291"use strict"; 54292/** 54293 * Copyright 2013-2015, Facebook, Inc. 54294 * All rights reserved. 54295 * 54296 * This source code is licensed under the BSD-style license found in the 54297 * LICENSE file in the root directory of this source tree. An additional grant 54298 * of patent rights can be found in the PATENTS file in the same directory. 54299 * 54300 * @providesModule getEventModifierState 54301 * @typechecks static-only 54302 */ 54303 54304 54305 54306/** 54307 * Translation from modifier key to the associated property in the event. 54308 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers 54309 */ 54310 54311var modifierKeyToProp = { 54312 'Alt': 'altKey', 54313 'Control': 'ctrlKey', 54314 'Meta': 'metaKey', 54315 'Shift': 'shiftKey' 54316}; 54317 54318// IE8 does not implement getModifierState so we simply map it to the only 54319// modifier keys exposed by the event itself, does not support Lock-keys. 54320// Currently, all major browsers except Chrome seems to support Lock-keys. 54321function modifierStateGetter(keyArg) { 54322 var syntheticEvent = this; 54323 var nativeEvent = syntheticEvent.nativeEvent; 54324 if (nativeEvent.getModifierState) { 54325 return nativeEvent.getModifierState(keyArg); 54326 } 54327 var keyProp = modifierKeyToProp[keyArg]; 54328 return keyProp ? !!nativeEvent[keyProp] : false; 54329} 54330 54331function getEventModifierState(nativeEvent) { 54332 return modifierStateGetter; 54333} 54334 54335module.exports = getEventModifierState; 54336 54337/***/ }), 54338
vendor: 1,251 bytes, lines 54339-54378
54339/***/ "./node_modules/react/lib/getEventTarget.js": 54340/*!**************************************************!*\ 54341 !*** ./node_modules/react/lib/getEventTarget.js ***! 54342 \**************************************************/ 54343/*! no static exports found */ 54344/***/ (function(module, exports, __webpack_require__) { 54345 54346"use strict"; 54347/** 54348 * Copyright 2013-2015, Facebook, Inc. 54349 * All rights reserved. 54350 * 54351 * This source code is licensed under the BSD-style license found in the 54352 * LICENSE file in the root directory of this source tree. An additional grant 54353 * of patent rights can be found in the PATENTS file in the same directory. 54354 * 54355 * @providesModule getEventTarget 54356 * @typechecks static-only 54357 */ 54358 54359 54360 54361/** 54362 * Gets the target node from a native browser event by accounting for 54363 * inconsistencies in browser DOM APIs. 54364 * 54365 * @param {object} nativeEvent Native browser event. 54366 * @return {DOMEventTarget} Target node. 54367 */ 54368function getEventTarget(nativeEvent) { 54369 var target = nativeEvent.target || nativeEvent.srcElement || window; 54370 // Safari may fire events on text nodes (Node.TEXT_NODE is 3). 54371 // @see http://www.quirksmode.org/js/events_properties.html 54372 return target.nodeType === 3 ? target.parentNode : target; 54373} 54374 54375module.exports = getEventTarget; 54376 54377/***/ }), 54378
vendor: 1,488 bytes, lines 54379-54429
54379/***/ "./node_modules/react/lib/getIteratorFn.js": 54380/*!*************************************************!*\ 54381 !*** ./node_modules/react/lib/getIteratorFn.js ***! 54382 \*************************************************/ 54383/*! no static exports found */ 54384/***/ (function(module, exports, __webpack_require__) { 54385 54386"use strict"; 54387/** 54388 * Copyright 2013-2015, Facebook, Inc. 54389 * All rights reserved. 54390 * 54391 * This source code is licensed under the BSD-style license found in the 54392 * LICENSE file in the root directory of this source tree. An additional grant 54393 * of patent rights can be found in the PATENTS file in the same directory. 54394 * 54395 * @providesModule getIteratorFn 54396 * @typechecks static-only 54397 */ 54398 54399 54400 54401/* global Symbol */ 54402var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 54403var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. 54404 54405/** 54406 * Returns the iterator method function contained on the iterable object. 54407 * 54408 * Be sure to invoke the function with the iterable as context: 54409 * 54410 * var iteratorFn = getIteratorFn(myIterable); 54411 * if (iteratorFn) { 54412 * var iterator = iteratorFn.call(myIterable); 54413 * ... 54414 * } 54415 * 54416 * @param {?object} maybeIterable 54417 * @return {?function} 54418 */ 54419function getIteratorFn(maybeIterable) { 54420 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 54421 if (typeof iteratorFn === 'function') { 54422 return iteratorFn; 54423 } 54424} 54425 54426module.exports = getIteratorFn; 54427 54428/***/ }), 54429
vendor: 2,023 bytes, lines 54430-54513
54430/***/ "./node_modules/react/lib/getNodeForCharacterOffset.js": 54431/*!*************************************************************!*\ 54432 !*** ./node_modules/react/lib/getNodeForCharacterOffset.js ***! 54433 \*************************************************************/ 54434/*! no static exports found */ 54435/***/ (function(module, exports, __webpack_require__) { 54436 54437"use strict"; 54438/** 54439 * Copyright 2013-2015, Facebook, Inc. 54440 * All rights reserved. 54441 * 54442 * This source code is licensed under the BSD-style license found in the 54443 * LICENSE file in the root directory of this source tree. An additional grant 54444 * of patent rights can be found in the PATENTS file in the same directory. 54445 * 54446 * @providesModule getNodeForCharacterOffset 54447 */ 54448 54449 54450 54451/** 54452 * Given any node return the first leaf node without children. 54453 * 54454 * @param {DOMElement|DOMTextNode} node 54455 * @return {DOMElement|DOMTextNode} 54456 */ 54457function getLeafNode(node) { 54458 while (node && node.firstChild) { 54459 node = node.firstChild; 54460 } 54461 return node; 54462} 54463 54464/** 54465 * Get the next sibling within a container. This will walk up the 54466 * DOM if a node's siblings have been exhausted. 54467 * 54468 * @param {DOMElement|DOMTextNode} node 54469 * @return {?DOMElement|DOMTextNode} 54470 */ 54471function getSiblingNode(node) { 54472 while (node) { 54473 if (node.nextSibling) { 54474 return node.nextSibling; 54475 } 54476 node = node.parentNode; 54477 } 54478} 54479 54480/** 54481 * Get object describing the nodes which contain characters at offset. 54482 * 54483 * @param {DOMElement|DOMTextNode} root 54484 * @param {number} offset 54485 * @return {?object} 54486 */ 54487function getNodeForCharacterOffset(root, offset) { 54488 var node = getLeafNode(root); 54489 var nodeStart = 0; 54490 var nodeEnd = 0; 54491 54492 while (node) { 54493 if (node.nodeType === 3) { 54494 nodeEnd = nodeStart + node.textContent.length; 54495 54496 if (nodeStart <= offset && nodeEnd >= offset) { 54497 return { 54498 node: node, 54499 offset: offset - nodeStart 54500 }; 54501 } 54502 54503 nodeStart = nodeEnd; 54504 } 54505 54506 node = getLeafNode(getSiblingNode(node)); 54507 } 54508} 54509 54510module.exports = getNodeForCharacterOffset; 54511 54512/***/ }), 54513
vendor: 1,414 bytes, lines 54514-54557
54514/***/ "./node_modules/react/lib/getTextContentAccessor.js": 54515/*!**********************************************************!*\ 54516 !*** ./node_modules/react/lib/getTextContentAccessor.js ***! 54517 \**********************************************************/ 54518/*! no static exports found */ 54519/***/ (function(module, exports, __webpack_require__) { 54520 54521"use strict"; 54522/** 54523 * Copyright 2013-2015, Facebook, Inc. 54524 * All rights reserved. 54525 * 54526 * This source code is licensed under the BSD-style license found in the 54527 * LICENSE file in the root directory of this source tree. An additional grant 54528 * of patent rights can be found in the PATENTS file in the same directory. 54529 * 54530 * @providesModule getTextContentAccessor 54531 */ 54532 54533 54534 54535var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 54536 54537var contentKey = null; 54538 54539/** 54540 * Gets the key used to access text content on a DOM node. 54541 * 54542 * @return {?string} Key used to access text content. 54543 * @internal 54544 */ 54545function getTextContentAccessor() { 54546 if (!contentKey && ExecutionEnvironment.canUseDOM) { 54547 // Prefer textContent to innerText because many browsers support both but 54548 // SVG <text> elements don't support innerText even when <div> does. 54549 contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; 54550 } 54551 return contentKey; 54552} 54553 54554module.exports = getTextContentAccessor; 54555 54556/***/ }), 54557
vendor: 5,052 bytes, lines 54558-54680
54558/***/ "./node_modules/react/lib/instantiateReactComponent.js": 54559/*!*************************************************************!*\ 54560 !*** ./node_modules/react/lib/instantiateReactComponent.js ***! 54561 \*************************************************************/ 54562/*! no static exports found */ 54563/***/ (function(module, exports, __webpack_require__) { 54564 54565"use strict"; 54566/** 54567 * Copyright 2013-2015, Facebook, Inc. 54568 * All rights reserved. 54569 * 54570 * This source code is licensed under the BSD-style license found in the 54571 * LICENSE file in the root directory of this source tree. An additional grant 54572 * of patent rights can be found in the PATENTS file in the same directory. 54573 * 54574 * @providesModule instantiateReactComponent 54575 * @typechecks static-only 54576 */ 54577 54578 54579 54580var ReactCompositeComponent = __webpack_require__(/*! ./ReactCompositeComponent */ "./node_modules/react/lib/ReactCompositeComponent.js"); 54581var ReactEmptyComponent = __webpack_require__(/*! ./ReactEmptyComponent */ "./node_modules/react/lib/ReactEmptyComponent.js"); 54582var ReactNativeComponent = __webpack_require__(/*! ./ReactNativeComponent */ "./node_modules/react/lib/ReactNativeComponent.js"); 54583 54584var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 54585var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 54586var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 54587 54588// To avoid a cyclic dependency, we create the final class in this module 54589var ReactCompositeComponentWrapper = function () {}; 54590assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, { 54591 _instantiateReactComponent: instantiateReactComponent 54592}); 54593 54594function getDeclarationErrorAddendum(owner) { 54595 if (owner) { 54596 var name = owner.getName(); 54597 if (name) { 54598 return ' Check the render method of `' + name + '`.'; 54599 } 54600 } 54601 return ''; 54602} 54603 54604/** 54605 * Check if the type reference is a known internal type. I.e. not a user 54606 * provided composite type. 54607 * 54608 * @param {function} type 54609 * @return {boolean} Returns true if this is a valid internal type. 54610 */ 54611function isInternalComponentType(type) { 54612 return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; 54613} 54614 54615/** 54616 * Given a ReactNode, create an instance that will actually be mounted. 54617 * 54618 * @param {ReactNode} node 54619 * @return {object} A new instance of the element's constructor. 54620 * @protected 54621 */ 54622function instantiateReactComponent(node) { 54623 var instance; 54624 54625 if (node === null || node === false) { 54626 instance = new ReactEmptyComponent(instantiateReactComponent); 54627 } else if (typeof node === 'object') { 54628 var element = node; 54629 !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? true ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : undefined : undefined; 54630 54631 // Special case string values 54632 if (typeof element.type === 'string') { 54633 instance = ReactNativeComponent.createInternalComponent(element); 54634 } else if (isInternalComponentType(element.type)) { 54635 // This is temporarily available for custom components that are not string 54636 // representations. I.e. ART. Once those are updated to use the string 54637 // representation, we can drop this code path. 54638 instance = new element.type(element); 54639 } else { 54640 instance = new ReactCompositeComponentWrapper(); 54641 } 54642 } else if (typeof node === 'string' || typeof node === 'number') { 54643 instance = ReactNativeComponent.createInstanceForText(node); 54644 } else { 54645 true ? true ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : undefined : undefined; 54646 } 54647 54648 if (true) { 54649 true ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined; 54650 } 54651 54652 // Sets up the instance. This can probably just move into the constructor now. 54653 instance.construct(node); 54654 54655 // These two fields are used by the DOM and ART diffing algorithms 54656 // respectively. Instead of using expandos on components, we should be 54657 // storing the state needed by the diffing algorithms elsewhere. 54658 instance._mountIndex = 0; 54659 instance._mountImage = null; 54660 54661 if (true) { 54662 instance._isOwnerNecessary = false; 54663 instance._warnedAboutRefsInRender = false; 54664 } 54665 54666 // Internal instances should fully constructed at this point, so they should 54667 // not get any new fields added to them at this point. 54668 if (true) { 54669 if (Object.preventExtensions) { 54670 Object.preventExtensions(instance); 54671 } 54672 } 54673 54674 return instance; 54675} 54676 54677module.exports = instantiateReactComponent; 54678 54679/***/ }), 54680
vendor: 2,368 bytes, lines 54681-54751
54681/***/ "./node_modules/react/lib/isEventSupported.js": 54682/*!****************************************************!*\ 54683 !*** ./node_modules/react/lib/isEventSupported.js ***! 54684 \****************************************************/ 54685/*! no static exports found */ 54686/***/ (function(module, exports, __webpack_require__) { 54687 54688"use strict"; 54689/** 54690 * Copyright 2013-2015, Facebook, Inc. 54691 * All rights reserved. 54692 * 54693 * This source code is licensed under the BSD-style license found in the 54694 * LICENSE file in the root directory of this source tree. An additional grant 54695 * of patent rights can be found in the PATENTS file in the same directory. 54696 * 54697 * @providesModule isEventSupported 54698 */ 54699 54700 54701 54702var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 54703 54704var useHasFeature; 54705if (ExecutionEnvironment.canUseDOM) { 54706 useHasFeature = document.implementation && document.implementation.hasFeature && 54707 // always returns true in newer browsers as per the standard. 54708 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature 54709 document.implementation.hasFeature('', '') !== true; 54710} 54711 54712/** 54713 * Checks if an event is supported in the current execution environment. 54714 * 54715 * NOTE: This will not work correctly for non-generic events such as `change`, 54716 * `reset`, `load`, `error`, and `select`. 54717 * 54718 * Borrows from Modernizr. 54719 * 54720 * @param {string} eventNameSuffix Event name, e.g. "click". 54721 * @param {?boolean} capture Check if the capture phase is supported. 54722 * @return {boolean} True if the event is supported. 54723 * @internal 54724 * @license Modernizr 3.0.0pre (Custom Build) | MIT 54725 */ 54726function isEventSupported(eventNameSuffix, capture) { 54727 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { 54728 return false; 54729 } 54730 54731 var eventName = 'on' + eventNameSuffix; 54732 var isSupported = (eventName in document); 54733 54734 if (!isSupported) { 54735 var element = document.createElement('div'); 54736 element.setAttribute(eventName, 'return;'); 54737 isSupported = typeof element[eventName] === 'function'; 54738 } 54739 54740 if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { 54741 // This is the only way to test support for the `wheel` event in IE9+. 54742 isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); 54743 } 54744 54745 return isSupported; 54746} 54747 54748module.exports = isEventSupported; 54749 54750/***/ }), 54751
vendor: 1,366 bytes, lines 54752-54802
54752/***/ "./node_modules/react/lib/isTextInputElement.js": 54753/*!******************************************************!*\ 54754 !*** ./node_modules/react/lib/isTextInputElement.js ***! 54755 \******************************************************/ 54756/*! no static exports found */ 54757/***/ (function(module, exports, __webpack_require__) { 54758 54759"use strict"; 54760/** 54761 * Copyright 2013-2015, Facebook, Inc. 54762 * All rights reserved. 54763 * 54764 * This source code is licensed under the BSD-style license found in the 54765 * LICENSE file in the root directory of this source tree. An additional grant 54766 * of patent rights can be found in the PATENTS file in the same directory. 54767 * 54768 * @providesModule isTextInputElement 54769 */ 54770 54771 54772 54773/** 54774 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 54775 */ 54776var supportedInputTypes = { 54777 'color': true, 54778 'date': true, 54779 'datetime': true, 54780 'datetime-local': true, 54781 'email': true, 54782 'month': true, 54783 'number': true, 54784 'password': true, 54785 'range': true, 54786 'search': true, 54787 'tel': true, 54788 'text': true, 54789 'time': true, 54790 'url': true, 54791 'week': true 54792}; 54793 54794function isTextInputElement(elem) { 54795 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 54796 return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea'); 54797} 54798 54799module.exports = isTextInputElement; 54800 54801/***/ }), 54802
vendor: 1,589 bytes, lines 54803-54846
54803/***/ "./node_modules/react/lib/onlyChild.js": 54804/*!*********************************************!*\ 54805 !*** ./node_modules/react/lib/onlyChild.js ***! 54806 \*********************************************/ 54807/*! no static exports found */ 54808/***/ (function(module, exports, __webpack_require__) { 54809 54810"use strict"; 54811/** 54812 * Copyright 2013-2015, Facebook, Inc. 54813 * All rights reserved. 54814 * 54815 * This source code is licensed under the BSD-style license found in the 54816 * LICENSE file in the root directory of this source tree. An additional grant 54817 * of patent rights can be found in the PATENTS file in the same directory. 54818 * 54819 * @providesModule onlyChild 54820 */ 54821 54822 54823var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 54824 54825var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 54826 54827/** 54828 * Returns the first child in a collection of children and verifies that there 54829 * is only one child in the collection. The current implementation of this 54830 * function assumes that a single child gets passed without a wrapper, but the 54831 * purpose of this helper function is to abstract away the particular structure 54832 * of children. 54833 * 54834 * @param {?object} children Child collection structure. 54835 * @return {ReactComponent} The first and only `ReactComponent` contained in the 54836 * structure. 54837 */ 54838function onlyChild(children) { 54839 !ReactElement.isValidElement(children) ? true ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : undefined : undefined; 54840 return children; 54841} 54842 54843module.exports = onlyChild; 54844 54845/***/ }), 54846
vendor: 1,202 bytes, lines 54847-54883
54847/***/ "./node_modules/react/lib/quoteAttributeValueForBrowser.js": 54848/*!*****************************************************************!*\ 54849 !*** ./node_modules/react/lib/quoteAttributeValueForBrowser.js ***! 54850 \*****************************************************************/ 54851/*! no static exports found */ 54852/***/ (function(module, exports, __webpack_require__) { 54853 54854"use strict"; 54855/** 54856 * Copyright 2013-2015, Facebook, Inc. 54857 * All rights reserved. 54858 * 54859 * This source code is licensed under the BSD-style license found in the 54860 * LICENSE file in the root directory of this source tree. An additional grant 54861 * of patent rights can be found in the PATENTS file in the same directory. 54862 * 54863 * @providesModule quoteAttributeValueForBrowser 54864 */ 54865 54866 54867 54868var escapeTextContentForBrowser = __webpack_require__(/*! ./escapeTextContentForBrowser */ "./node_modules/react/lib/escapeTextContentForBrowser.js"); 54869 54870/** 54871 * Escapes attribute value to prevent scripting attacks. 54872 * 54873 * @param {*} value Value to escape. 54874 * @return {string} An escaped string. 54875 */ 54876function quoteAttributeValueForBrowser(value) { 54877 return '"' + escapeTextContentForBrowser(value) + '"'; 54878} 54879 54880module.exports = quoteAttributeValueForBrowser; 54881 54882/***/ }), 54883
vendor: 890 bytes, lines 54884-54910
54884/***/ "./node_modules/react/lib/renderSubtreeIntoContainer.js": 54885/*!**************************************************************!*\ 54886 !*** ./node_modules/react/lib/renderSubtreeIntoContainer.js ***! 54887 \**************************************************************/ 54888/*! no static exports found */ 54889/***/ (function(module, exports, __webpack_require__) { 54890 54891"use strict"; 54892/** 54893 * Copyright 2013-2015, Facebook, Inc. 54894 * All rights reserved. 54895 * 54896 * This source code is licensed under the BSD-style license found in the 54897 * LICENSE file in the root directory of this source tree. An additional grant 54898 * of patent rights can be found in the PATENTS file in the same directory. 54899 * 54900* @providesModule renderSubtreeIntoContainer 54901*/ 54902 54903 54904 54905var ReactMount = __webpack_require__(/*! ./ReactMount */ "./node_modules/react/lib/ReactMount.js"); 54906 54907module.exports = ReactMount.renderSubtreeIntoContainer; 54908 54909/***/ }), 54910
vendor: 3,728 bytes, lines 54911-55011
54911/***/ "./node_modules/react/lib/setInnerHTML.js": 54912/*!************************************************!*\ 54913 !*** ./node_modules/react/lib/setInnerHTML.js ***! 54914 \************************************************/ 54915/*! no static exports found */ 54916/***/ (function(module, exports, __webpack_require__) { 54917 54918"use strict"; 54919/** 54920 * Copyright 2013-2015, Facebook, Inc. 54921 * All rights reserved. 54922 * 54923 * This source code is licensed under the BSD-style license found in the 54924 * LICENSE file in the root directory of this source tree. An additional grant 54925 * of patent rights can be found in the PATENTS file in the same directory. 54926 * 54927 * @providesModule setInnerHTML 54928 */ 54929 54930/* globals MSApp */ 54931 54932 54933 54934var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 54935 54936var WHITESPACE_TEST = /^[ \r\n\t\f]/; 54937var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; 54938 54939/** 54940 * Set the innerHTML property of a node, ensuring that whitespace is preserved 54941 * even in IE8. 54942 * 54943 * @param {DOMElement} node 54944 * @param {string} html 54945 * @internal 54946 */ 54947var setInnerHTML = function (node, html) { 54948 node.innerHTML = html; 54949}; 54950 54951// Win8 apps: Allow all html to be inserted 54952if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { 54953 setInnerHTML = function (node, html) { 54954 MSApp.execUnsafeLocalFunction(function () { 54955 node.innerHTML = html; 54956 }); 54957 }; 54958} 54959 54960if (ExecutionEnvironment.canUseDOM) { 54961 // IE8: When updating a just created node with innerHTML only leading 54962 // whitespace is removed. When updating an existing node with innerHTML 54963 // whitespace in root TextNodes is also collapsed. 54964 // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html 54965 54966 // Feature detection; only IE8 is known to behave improperly like this. 54967 var testElement = document.createElement('div'); 54968 testElement.innerHTML = ' '; 54969 if (testElement.innerHTML === '') { 54970 setInnerHTML = function (node, html) { 54971 // Magic theory: IE8 supposedly differentiates between added and updated 54972 // nodes when processing innerHTML, innerHTML on updated nodes suffers 54973 // from worse whitespace behavior. Re-adding a node like this triggers 54974 // the initial and more favorable whitespace behavior. 54975 // TODO: What to do on a detached node? 54976 if (node.parentNode) { 54977 node.parentNode.replaceChild(node, node); 54978 } 54979 54980 // We also implement a workaround for non-visible tags disappearing into 54981 // thin air on IE8, this only happens if there is no visible text 54982 // in-front of the non-visible tags. Piggyback on the whitespace fix 54983 // and simply check if any non-visible tags appear in the source. 54984 if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { 54985 // Recover leading whitespace by temporarily prepending any character. 54986 // \uFEFF has the potential advantage of being zero-width/invisible. 54987 // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode 54988 // in hopes that this is preserved even if "\uFEFF" is transformed to 54989 // the actual Unicode character (by Babel, for example). 54990 // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 54991 node.innerHTML = String.fromCharCode(0xFEFF) + html; 54992 54993 // deleteData leaves an empty `TextNode` which offsets the index of all 54994 // children. Definitely want to avoid this. 54995 var textNode = node.firstChild; 54996 if (textNode.data.length === 1) { 54997 node.removeChild(textNode); 54998 } else { 54999 textNode.deleteData(0, 1); 55000 } 55001 } else { 55002 node.innerHTML = html; 55003 } 55004 }; 55005 } 55006} 55007 55008module.exports = setInnerHTML; 55009 55010/***/ }), 55011
vendor: 1,723 bytes, lines 55012-55062
55012/***/ "./node_modules/react/lib/setTextContent.js": 55013/*!**************************************************!*\ 55014 !*** ./node_modules/react/lib/setTextContent.js ***! 55015 \**************************************************/ 55016/*! no static exports found */ 55017/***/ (function(module, exports, __webpack_require__) { 55018 55019"use strict"; 55020/** 55021 * Copyright 2013-2015, Facebook, Inc. 55022 * All rights reserved. 55023 * 55024 * This source code is licensed under the BSD-style license found in the 55025 * LICENSE file in the root directory of this source tree. An additional grant 55026 * of patent rights can be found in the PATENTS file in the same directory. 55027 * 55028 * @providesModule setTextContent 55029 */ 55030 55031 55032 55033var ExecutionEnvironment = __webpack_require__(/*! fbjs/lib/ExecutionEnvironment */ "./node_modules/fbjs/lib/ExecutionEnvironment.js"); 55034var escapeTextContentForBrowser = __webpack_require__(/*! ./escapeTextContentForBrowser */ "./node_modules/react/lib/escapeTextContentForBrowser.js"); 55035var setInnerHTML = __webpack_require__(/*! ./setInnerHTML */ "./node_modules/react/lib/setInnerHTML.js"); 55036 55037/** 55038 * Set the textContent property of a node, ensuring that whitespace is preserved 55039 * even in IE8. innerText is a poor substitute for textContent and, among many 55040 * issues, inserts <br> instead of the literal newline chars. innerHTML behaves 55041 * as it should. 55042 * 55043 * @param {DOMElement} node 55044 * @param {string} text 55045 * @internal 55046 */ 55047var setTextContent = function (node, text) { 55048 node.textContent = text; 55049}; 55050 55051if (ExecutionEnvironment.canUseDOM) { 55052 if (!('textContent' in document.documentElement)) { 55053 setTextContent = function (node, text) { 55054 setInnerHTML(node, escapeTextContentForBrowser(text)); 55055 }; 55056 } 55057} 55058 55059module.exports = setTextContent; 55060 55061/***/ }), 55062
vendor: 1,857 bytes, lines 55063-55116
55063/***/ "./node_modules/react/lib/shouldUpdateReactComponent.js": 55064/*!**************************************************************!*\ 55065 !*** ./node_modules/react/lib/shouldUpdateReactComponent.js ***! 55066 \**************************************************************/ 55067/*! no static exports found */ 55068/***/ (function(module, exports, __webpack_require__) { 55069 55070"use strict"; 55071/** 55072 * Copyright 2013-2015, Facebook, Inc. 55073 * All rights reserved. 55074 * 55075 * This source code is licensed under the BSD-style license found in the 55076 * LICENSE file in the root directory of this source tree. An additional grant 55077 * of patent rights can be found in the PATENTS file in the same directory. 55078 * 55079 * @providesModule shouldUpdateReactComponent 55080 * @typechecks static-only 55081 */ 55082 55083 55084 55085/** 55086 * Given a `prevElement` and `nextElement`, determines if the existing 55087 * instance should be updated as opposed to being destroyed or replaced by a new 55088 * instance. Both arguments are elements. This ensures that this logic can 55089 * operate on stateless trees without any backing instance. 55090 * 55091 * @param {?object} prevElement 55092 * @param {?object} nextElement 55093 * @return {boolean} True if the existing instance should be updated. 55094 * @protected 55095 */ 55096function shouldUpdateReactComponent(prevElement, nextElement) { 55097 var prevEmpty = prevElement === null || prevElement === false; 55098 var nextEmpty = nextElement === null || nextElement === false; 55099 if (prevEmpty || nextEmpty) { 55100 return prevEmpty === nextEmpty; 55101 } 55102 55103 var prevType = typeof prevElement; 55104 var nextType = typeof nextElement; 55105 if (prevType === 'string' || prevType === 'number') { 55106 return nextType === 'string' || nextType === 'number'; 55107 } else { 55108 return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; 55109 } 55110 return false; 55111} 55112 55113module.exports = shouldUpdateReactComponent; 55114 55115/***/ }), 55116
vendor: 7,464 bytes, lines 55117-55316
55117/***/ "./node_modules/react/lib/traverseAllChildren.js": 55118/*!*******************************************************!*\ 55119 !*** ./node_modules/react/lib/traverseAllChildren.js ***! 55120 \*******************************************************/ 55121/*! no static exports found */ 55122/***/ (function(module, exports, __webpack_require__) { 55123 55124"use strict"; 55125/** 55126 * Copyright 2013-2015, Facebook, Inc. 55127 * All rights reserved. 55128 * 55129 * This source code is licensed under the BSD-style license found in the 55130 * LICENSE file in the root directory of this source tree. An additional grant 55131 * of patent rights can be found in the PATENTS file in the same directory. 55132 * 55133 * @providesModule traverseAllChildren 55134 */ 55135 55136 55137 55138var ReactCurrentOwner = __webpack_require__(/*! ./ReactCurrentOwner */ "./node_modules/react/lib/ReactCurrentOwner.js"); 55139var ReactElement = __webpack_require__(/*! ./ReactElement */ "./node_modules/react/lib/ReactElement.js"); 55140var ReactInstanceHandles = __webpack_require__(/*! ./ReactInstanceHandles */ "./node_modules/react/lib/ReactInstanceHandles.js"); 55141 55142var getIteratorFn = __webpack_require__(/*! ./getIteratorFn */ "./node_modules/react/lib/getIteratorFn.js"); 55143var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); 55144var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 55145 55146var SEPARATOR = ReactInstanceHandles.SEPARATOR; 55147var SUBSEPARATOR = ':'; 55148 55149/** 55150 * TODO: Test that a single child and an array with one item have the same key 55151 * pattern. 55152 */ 55153 55154var userProvidedKeyEscaperLookup = { 55155 '=': '=0', 55156 '.': '=1', 55157 ':': '=2' 55158}; 55159 55160var userProvidedKeyEscapeRegex = /[=.:]/g; 55161 55162var didWarnAboutMaps = false; 55163 55164function userProvidedKeyEscaper(match) { 55165 return userProvidedKeyEscaperLookup[match]; 55166} 55167 55168/** 55169 * Generate a key string that identifies a component within a set. 55170 * 55171 * @param {*} component A component that could contain a manual key. 55172 * @param {number} index Index that is used if a manual key is not provided. 55173 * @return {string} 55174 */ 55175function getComponentKey(component, index) { 55176 if (component && component.key != null) { 55177 // Explicit key 55178 return wrapUserProvidedKey(component.key); 55179 } 55180 // Implicit key determined by the index in the set 55181 return index.toString(36); 55182} 55183 55184/** 55185 * Escape a component key so that it is safe to use in a reactid. 55186 * 55187 * @param {*} text Component key to be escaped. 55188 * @return {string} An escaped string. 55189 */ 55190function escapeUserProvidedKey(text) { 55191 return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper); 55192} 55193 55194/** 55195 * Wrap a `key` value explicitly provided by the user to distinguish it from 55196 * implicitly-generated keys generated by a component's index in its parent. 55197 * 55198 * @param {string} key Value of a user-provided `key` attribute 55199 * @return {string} 55200 */ 55201function wrapUserProvidedKey(key) { 55202 return '$' + escapeUserProvidedKey(key); 55203} 55204 55205/** 55206 * @param {?*} children Children tree container. 55207 * @param {!string} nameSoFar Name of the key path so far. 55208 * @param {!function} callback Callback to invoke with each child found. 55209 * @param {?*} traverseContext Used to pass information throughout the traversal 55210 * process. 55211 * @return {!number} The number of children in this subtree. 55212 */ 55213function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { 55214 var type = typeof children; 55215 55216 if (type === 'undefined' || type === 'boolean') { 55217 // All of the above are perceived as null. 55218 children = null; 55219 } 55220 55221 if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { 55222 callback(traverseContext, children, 55223 // If it's the only child, treat the name as if it was wrapped in an array 55224 // so that it's consistent if the number of children grows. 55225 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); 55226 return 1; 55227 } 55228 55229 var child; 55230 var nextName; 55231 var subtreeCount = 0; // Count of children found in the current subtree. 55232 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; 55233 55234 if (Array.isArray(children)) { 55235 for (var i = 0; i < children.length; i++) { 55236 child = children[i]; 55237 nextName = nextNamePrefix + getComponentKey(child, i); 55238 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 55239 } 55240 } else { 55241 var iteratorFn = getIteratorFn(children); 55242 if (iteratorFn) { 55243 var iterator = iteratorFn.call(children); 55244 var step; 55245 if (iteratorFn !== children.entries) { 55246 var ii = 0; 55247 while (!(step = iterator.next()).done) { 55248 child = step.value; 55249 nextName = nextNamePrefix + getComponentKey(child, ii++); 55250 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 55251 } 55252 } else { 55253 if (true) { 55254 true ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined; 55255 didWarnAboutMaps = true; 55256 } 55257 // Iterator will provide entry [k,v] tuples rather than values. 55258 while (!(step = iterator.next()).done) { 55259 var entry = step.value; 55260 if (entry) { 55261 child = entry[1]; 55262 nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); 55263 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 55264 } 55265 } 55266 } 55267 } else if (type === 'object') { 55268 var addendum = ''; 55269 if (true) { 55270 addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; 55271 if (children._isReactElement) { 55272 addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; 55273 } 55274 if (ReactCurrentOwner.current) { 55275 var name = ReactCurrentOwner.current.getName(); 55276 if (name) { 55277 addendum += ' Check the render method of `' + name + '`.'; 55278 } 55279 } 55280 } 55281 var childrenString = String(children); 55282 true ? true ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : undefined : undefined; 55283 } 55284 } 55285 55286 return subtreeCount; 55287} 55288 55289/** 55290 * Traverses children that are typically specified as `props.children`, but 55291 * might also be specified through attributes: 55292 * 55293 * - `traverseAllChildren(this.props.children, ...)` 55294 * - `traverseAllChildren(this.props.leftPanelChildren, ...)` 55295 * 55296 * The `traverseContext` is an optional argument that is passed through the 55297 * entire traversal. It can be used to store accumulations or anything else that 55298 * the callback might find relevant. 55299 * 55300 * @param {?*} children Children tree object. 55301 * @param {!function} callback To invoke upon traversing each child. 55302 * @param {?*} traverseContext Context for traversal. 55303 * @return {!number} The number of children in this subtree. 55304 */ 55305function traverseAllChildren(children, callback, traverseContext) { 55306 if (children == null) { 55307 return 0; 55308 } 55309 55310 return traverseAllChildrenImpl(children, '', callback, traverseContext); 55311} 55312 55313module.exports = traverseAllChildren; 55314 55315/***/ }), 55316
vendor: 13,532 bytes, lines 55317-55690
55317/***/ "./node_modules/react/lib/validateDOMNesting.js": 55318/*!******************************************************!*\ 55319 !*** ./node_modules/react/lib/validateDOMNesting.js ***! 55320 \******************************************************/ 55321/*! no static exports found */ 55322/***/ (function(module, exports, __webpack_require__) { 55323 55324"use strict"; 55325/** 55326 * Copyright 2015, Facebook, Inc. 55327 * All rights reserved. 55328 * 55329 * This source code is licensed under the BSD-style license found in the 55330 * LICENSE file in the root directory of this source tree. An additional grant 55331 * of patent rights can be found in the PATENTS file in the same directory. 55332 * 55333 * @providesModule validateDOMNesting 55334 */ 55335 55336 55337 55338var assign = __webpack_require__(/*! ./Object.assign */ "./node_modules/react/lib/Object.assign.js"); 55339var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); 55340var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); 55341 55342var validateDOMNesting = emptyFunction; 55343 55344if (true) { 55345 // This validation code was written based on the HTML5 parsing spec: 55346 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 55347 // 55348 // Note: this does not catch all invalid nesting, nor does it try to (as it's 55349 // not clear what practical benefit doing so provides); instead, we warn only 55350 // for cases where the parser will give a parse tree differing from what React 55351 // intended. For example, <b><div></div></b> is invalid but we don't warn 55352 // because it still parses correctly; we do warn for other cases like nested 55353 // <p> tags where the beginning of the second element implicitly closes the 55354 // first, causing a confusing mess. 55355 55356 // https://html.spec.whatwg.org/multipage/syntax.html#special 55357 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; 55358 55359 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 55360 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', 55361 55362 // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point 55363 // TODO: Distinguish by namespace here -- for <title>, including it here 55364 // errs on the side of fewer warnings 55365 'foreignObject', 'desc', 'title']; 55366 55367 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope 55368 var buttonScopeTags = inScopeTags.concat(['button']); 55369 55370 // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags 55371 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; 55372 55373 var emptyAncestorInfo = { 55374 parentTag: null, 55375 55376 formTag: null, 55377 aTagInScope: null, 55378 buttonTagInScope: null, 55379 nobrTagInScope: null, 55380 pTagInButtonScope: null, 55381 55382 listItemTagAutoclosing: null, 55383 dlItemTagAutoclosing: null 55384 }; 55385 55386 var updatedAncestorInfo = function (oldInfo, tag, instance) { 55387 var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo); 55388 var info = { tag: tag, instance: instance }; 55389 55390 if (inScopeTags.indexOf(tag) !== -1) { 55391 ancestorInfo.aTagInScope = null; 55392 ancestorInfo.buttonTagInScope = null; 55393 ancestorInfo.nobrTagInScope = null; 55394 } 55395 if (buttonScopeTags.indexOf(tag) !== -1) { 55396 ancestorInfo.pTagInButtonScope = null; 55397 } 55398 55399 // See rules for 'li', 'dd', 'dt' start tags in 55400 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 55401 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { 55402 ancestorInfo.listItemTagAutoclosing = null; 55403 ancestorInfo.dlItemTagAutoclosing = null; 55404 } 55405 55406 ancestorInfo.parentTag = info; 55407 55408 if (tag === 'form') { 55409 ancestorInfo.formTag = info; 55410 } 55411 if (tag === 'a') { 55412 ancestorInfo.aTagInScope = info; 55413 } 55414 if (tag === 'button') { 55415 ancestorInfo.buttonTagInScope = info; 55416 } 55417 if (tag === 'nobr') { 55418 ancestorInfo.nobrTagInScope = info; 55419 } 55420 if (tag === 'p') { 55421 ancestorInfo.pTagInButtonScope = info; 55422 } 55423 if (tag === 'li') { 55424 ancestorInfo.listItemTagAutoclosing = info; 55425 } 55426 if (tag === 'dd' || tag === 'dt') { 55427 ancestorInfo.dlItemTagAutoclosing = info; 55428 } 55429 55430 return ancestorInfo; 55431 }; 55432 55433 /** 55434 * Returns whether 55435 */ 55436 var isTagValidWithParent = function (tag, parentTag) { 55437 // First, let's check if we're in an unusual parsing mode... 55438 switch (parentTag) { 55439 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect 55440 case 'select': 55441 return tag === 'option' || tag === 'optgroup' || tag === '#text'; 55442 case 'optgroup': 55443 return tag === 'option' || tag === '#text'; 55444 // Strictly speaking, seeing an <option> doesn't mean we're in a <select> 55445 // but 55446 case 'option': 55447 return tag === '#text'; 55448 55449 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd 55450 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption 55451 // No special behavior since these rules fall back to "in body" mode for 55452 // all except special table nodes which cause bad parsing behavior anyway. 55453 55454 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr 55455 case 'tr': 55456 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; 55457 55458 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody 55459 case 'tbody': 55460 case 'thead': 55461 case 'tfoot': 55462 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; 55463 55464 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup 55465 case 'colgroup': 55466 return tag === 'col' || tag === 'template'; 55467 55468 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable 55469 case 'table': 55470 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; 55471 55472 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead 55473 case 'head': 55474 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; 55475 55476 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element 55477 case 'html': 55478 return tag === 'head' || tag === 'body'; 55479 } 55480 55481 // Probably in the "in body" parsing mode, so we outlaw only tag combos 55482 // where the parsing rules cause implicit opens or closes to be added. 55483 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 55484 switch (tag) { 55485 case 'h1': 55486 case 'h2': 55487 case 'h3': 55488 case 'h4': 55489 case 'h5': 55490 case 'h6': 55491 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; 55492 55493 case 'rp': 55494 case 'rt': 55495 return impliedEndTags.indexOf(parentTag) === -1; 55496 55497 case 'caption': 55498 case 'col': 55499 case 'colgroup': 55500 case 'frame': 55501 case 'head': 55502 case 'tbody': 55503 case 'td': 55504 case 'tfoot': 55505 case 'th': 55506 case 'thead': 55507 case 'tr': 55508 // These tags are only valid with a few parents that have special child 55509 // parsing rules -- if we're down here, then none of those matched and 55510 // so we allow it only if we don't know what the parent is, as all other 55511 // cases are invalid. 55512 return parentTag == null; 55513 } 55514 55515 return true; 55516 }; 55517 55518 /** 55519 * Returns whether 55520 */ 55521 var findInvalidAncestorForTag = function (tag, ancestorInfo) { 55522 switch (tag) { 55523 case 'address': 55524 case 'article': 55525 case 'aside': 55526 case 'blockquote': 55527 case 'center': 55528 case 'details': 55529 case 'dialog': 55530 case 'dir': 55531 case 'div': 55532 case 'dl': 55533 case 'fieldset': 55534 case 'figcaption': 55535 case 'figure': 55536 case 'footer': 55537 case 'header': 55538 case 'hgroup': 55539 case 'main': 55540 case 'menu': 55541 case 'nav': 55542 case 'ol': 55543 case 'p': 55544 case 'section': 55545 case 'summary': 55546 case 'ul': 55547 55548 case 'pre': 55549 case 'listing': 55550 55551 case 'table': 55552 55553 case 'hr': 55554 55555 case 'xmp': 55556 55557 case 'h1': 55558 case 'h2': 55559 case 'h3': 55560 case 'h4': 55561 case 'h5': 55562 case 'h6': 55563 return ancestorInfo.pTagInButtonScope; 55564 55565 case 'form': 55566 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; 55567 55568 case 'li': 55569 return ancestorInfo.listItemTagAutoclosing; 55570 55571 case 'dd': 55572 case 'dt': 55573 return ancestorInfo.dlItemTagAutoclosing; 55574 55575 case 'button': 55576 return ancestorInfo.buttonTagInScope; 55577 55578 case 'a': 55579 // Spec says something about storing a list of markers, but it sounds 55580 // equivalent to this check. 55581 return ancestorInfo.aTagInScope; 55582 55583 case 'nobr': 55584 return ancestorInfo.nobrTagInScope; 55585 } 55586 55587 return null; 55588 }; 55589 55590 /** 55591 * Given a ReactCompositeComponent instance, return a list of its recursive 55592 * owners, starting at the root and ending with the instance itself. 55593 */ 55594 var findOwnerStack = function (instance) { 55595 if (!instance) { 55596 return []; 55597 } 55598 55599 var stack = []; 55600 /*eslint-disable space-after-keywords */ 55601 do { 55602 /*eslint-enable space-after-keywords */ 55603 stack.push(instance); 55604 } while (instance = instance._currentElement._owner); 55605 stack.reverse(); 55606 return stack; 55607 }; 55608 55609 var didWarn = {}; 55610 55611 validateDOMNesting = function (childTag, childInstance, ancestorInfo) { 55612 ancestorInfo = ancestorInfo || emptyAncestorInfo; 55613 var parentInfo = ancestorInfo.parentTag; 55614 var parentTag = parentInfo && parentInfo.tag; 55615 55616 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; 55617 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); 55618 var problematic = invalidParent || invalidAncestor; 55619 55620 if (problematic) { 55621 var ancestorTag = problematic.tag; 55622 var ancestorInstance = problematic.instance; 55623 55624 var childOwner = childInstance && childInstance._currentElement._owner; 55625 var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; 55626 55627 var childOwners = findOwnerStack(childOwner); 55628 var ancestorOwners = findOwnerStack(ancestorOwner); 55629 55630 var minStackLen = Math.min(childOwners.length, ancestorOwners.length); 55631 var i; 55632 55633 var deepestCommon = -1; 55634 for (i = 0; i < minStackLen; i++) { 55635 if (childOwners[i] === ancestorOwners[i]) { 55636 deepestCommon = i; 55637 } else { 55638 break; 55639 } 55640 } 55641 55642 var UNKNOWN = '(unknown)'; 55643 var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { 55644 return inst.getName() || UNKNOWN; 55645 }); 55646 var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { 55647 return inst.getName() || UNKNOWN; 55648 }); 55649 var ownerInfo = [].concat( 55650 // If the parent and child instances have a common owner ancestor, start 55651 // with that -- otherwise we just start with the parent's owners. 55652 deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, 55653 // If we're warning about an invalid (non-parent) ancestry, add '...' 55654 invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); 55655 55656 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; 55657 if (didWarn[warnKey]) { 55658 return; 55659 } 55660 didWarn[warnKey] = true; 55661 55662 if (invalidParent) { 55663 var info = ''; 55664 if (ancestorTag === 'table' && childTag === 'tr') { 55665 info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; 55666 } 55667 true ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined; 55668 } else { 55669 true ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined; 55670 } 55671 } 55672 }; 55673 55674 validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2); 55675 55676 validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; 55677 55678 // For testing 55679 validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { 55680 ancestorInfo = ancestorInfo || emptyAncestorInfo; 55681 var parentInfo = ancestorInfo.parentTag; 55682 var parentTag = parentInfo && parentInfo.tag; 55683 return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); 55684 }; 55685} 55686 55687module.exports = validateDOMNesting; 55688 55689/***/ }), 55690
vendor: 378 bytes, lines 55691-55705
55691/***/ "./node_modules/react/react.js": 55692/*!*************************************!*\ 55693 !*** ./node_modules/react/react.js ***! 55694 \*************************************/ 55695/*! no static exports found */ 55696/***/ (function(module, exports, __webpack_require__) { 55697 55698"use strict"; 55699 55700 55701module.exports = __webpack_require__(/*! ./lib/React */ "./node_modules/react/lib/React.js"); 55702 55703 55704/***/ }), 55705
vendor: 10,739 bytes, lines 55706-56114
55706/***/ "./node_modules/style-loader/lib/addStyles.js": 55707/*!****************************************************!*\ 55708 !*** ./node_modules/style-loader/lib/addStyles.js ***! 55709 \****************************************************/ 55710/*! no static exports found */ 55711/***/ (function(module, exports, __webpack_require__) { 55712 55713/* 55714 MIT License http://www.opensource.org/licenses/mit-license.php 55715 Author Tobias Koppers @sokra 55716*/ 55717 55718var stylesInDom = {}; 55719 55720var memoize = function (fn) { 55721 var memo; 55722 55723 return function () { 55724 if (typeof memo === "undefined") memo = fn.apply(this, arguments); 55725 return memo; 55726 }; 55727}; 55728 55729var isOldIE = memoize(function () { 55730 // Test for IE <= 9 as proposed by Browserhacks 55731 // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 55732 // Tests for existence of standard globals is to allow style-loader 55733 // to operate correctly into non-standard environments 55734 // @see https://github.com/webpack-contrib/style-loader/issues/177 55735 return window && document && document.all && !window.atob; 55736}); 55737 55738var getTarget = function (target, parent) { 55739 if (parent){ 55740 return parent.querySelector(target); 55741 } 55742 return document.querySelector(target); 55743}; 55744 55745var getElement = (function (fn) { 55746 var memo = {}; 55747 55748 return function(target, parent) { 55749 // If passing function in options, then use it for resolve "head" element. 55750 // Useful for Shadow Root style i.e 55751 // { 55752 // insertInto: function () { return document.querySelector("#foo").shadowRoot } 55753 // } 55754 if (typeof target === 'function') { 55755 return target(); 55756 } 55757 if (typeof memo[target] === "undefined") { 55758 var styleTarget = getTarget.call(this, target, parent); 55759 // Special case to return head of iframe instead of iframe itself 55760 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { 55761 try { 55762 // This will throw an exception if access to iframe is blocked 55763 // due to cross-origin restrictions 55764 styleTarget = styleTarget.contentDocument.head; 55765 } catch(e) { 55766 styleTarget = null; 55767 } 55768 } 55769 memo[target] = styleTarget; 55770 } 55771 return memo[target] 55772 }; 55773})(); 55774 55775var singleton = null; 55776var singletonCounter = 0; 55777var stylesInsertedAtTop = []; 55778 55779var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js"); 55780 55781module.exports = function(list, options) { 55782 if (typeof DEBUG !== "undefined" && DEBUG) { 55783 if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); 55784 } 55785 55786 options = options || {}; 55787 55788 options.attrs = typeof options.attrs === "object" ? options.attrs : {}; 55789 55790 // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> 55791 // tags it will allow on a page 55792 if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE(); 55793 55794 // By default, add <style> tags to the <head> element 55795 if (!options.insertInto) options.insertInto = "head"; 55796 55797 // By default, add <style> tags to the bottom of the target 55798 if (!options.insertAt) options.insertAt = "bottom"; 55799 55800 var styles = listToStyles(list, options); 55801 55802 addStylesToDom(styles, options); 55803 55804 return function update (newList) { 55805 var mayRemove = []; 55806 55807 for (var i = 0; i < styles.length; i++) { 55808 var item = styles[i]; 55809 var domStyle = stylesInDom[item.id]; 55810 55811 domStyle.refs--; 55812 mayRemove.push(domStyle); 55813 } 55814 55815 if(newList) { 55816 var newStyles = listToStyles(newList, options); 55817 addStylesToDom(newStyles, options); 55818 } 55819 55820 for (var i = 0; i < mayRemove.length; i++) { 55821 var domStyle = mayRemove[i]; 55822 55823 if(domStyle.refs === 0) { 55824 for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); 55825 55826 delete stylesInDom[domStyle.id]; 55827 } 55828 } 55829 }; 55830}; 55831 55832function addStylesToDom (styles, options) { 55833 for (var i = 0; i < styles.length; i++) { 55834 var item = styles[i]; 55835 var domStyle = stylesInDom[item.id]; 55836 55837 if(domStyle) { 55838 domStyle.refs++; 55839 55840 for(var j = 0; j < domStyle.parts.length; j++) { 55841 domStyle.parts[j](item.parts[j]); 55842 } 55843 55844 for(; j < item.parts.length; j++) { 55845 domStyle.parts.push(addStyle(item.parts[j], options)); 55846 } 55847 } else { 55848 var parts = []; 55849 55850 for(var j = 0; j < item.parts.length; j++) { 55851 parts.push(addStyle(item.parts[j], options)); 55852 } 55853 55854 stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; 55855 } 55856 } 55857} 55858 55859function listToStyles (list, options) { 55860 var styles = []; 55861 var newStyles = {}; 55862 55863 for (var i = 0; i < list.length; i++) { 55864 var item = list[i]; 55865 var id = options.base ? item[0] + options.base : item[0]; 55866 var css = item[1]; 55867 var media = item[2]; 55868 var sourceMap = item[3]; 55869 var part = {css: css, media: media, sourceMap: sourceMap}; 55870 55871 if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); 55872 else newStyles[id].parts.push(part); 55873 } 55874 55875 return styles; 55876} 55877 55878function insertStyleElement (options, style) { 55879 var target = getElement(options.insertInto) 55880 55881 if (!target) { 55882 throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); 55883 } 55884 55885 var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; 55886 55887 if (options.insertAt === "top") { 55888 if (!lastStyleElementInsertedAtTop) { 55889 target.insertBefore(style, target.firstChild); 55890 } else if (lastStyleElementInsertedAtTop.nextSibling) { 55891 target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); 55892 } else { 55893 target.appendChild(style); 55894 } 55895 stylesInsertedAtTop.push(style); 55896 } else if (options.insertAt === "bottom") { 55897 target.appendChild(style); 55898 } else if (typeof options.insertAt === "object" && options.insertAt.before) { 55899 var nextSibling = getElement(options.insertAt.before, target); 55900 target.insertBefore(style, nextSibling); 55901 } else { 55902 throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); 55903 } 55904} 55905 55906function removeStyleElement (style) { 55907 if (style.parentNode === null) return false; 55908 style.parentNode.removeChild(style); 55909 55910 var idx = stylesInsertedAtTop.indexOf(style); 55911 if(idx >= 0) { 55912 stylesInsertedAtTop.splice(idx, 1); 55913 } 55914} 55915 55916function createStyleElement (options) { 55917 var style = document.createElement("style"); 55918 55919 if(options.attrs.type === undefined) { 55920 options.attrs.type = "text/css"; 55921 } 55922 55923 if(options.attrs.nonce === undefined) { 55924 var nonce = getNonce(); 55925 if (nonce) { 55926 options.attrs.nonce = nonce; 55927 } 55928 } 55929 55930 addAttrs(style, options.attrs); 55931 insertStyleElement(options, style); 55932 55933 return style; 55934} 55935 55936function createLinkElement (options) { 55937 var link = document.createElement("link"); 55938 55939 if(options.attrs.type === undefined) { 55940 options.attrs.type = "text/css"; 55941 } 55942 options.attrs.rel = "stylesheet"; 55943 55944 addAttrs(link, options.attrs); 55945 insertStyleElement(options, link); 55946 55947 return link; 55948} 55949 55950function addAttrs (el, attrs) { 55951 Object.keys(attrs).forEach(function (key) { 55952 el.setAttribute(key, attrs[key]); 55953 }); 55954} 55955 55956function getNonce() { 55957 if (false) {} 55958 55959 return __webpack_require__.nc; 55960} 55961 55962function addStyle (obj, options) { 55963 var style, update, remove, result; 55964 55965 // If a transform function was defined, run it on the css 55966 if (options.transform && obj.css) { 55967 result = typeof options.transform === 'function' 55968 ? options.transform(obj.css) 55969 : options.transform.default(obj.css); 55970 55971 if (result) { 55972 // If transform returns a value, use that instead of the original css. 55973 // This allows running runtime transformations on the css. 55974 obj.css = result; 55975 } else { 55976 // If the transform function returns a falsy value, don't add this css. 55977 // This allows conditional loading of css 55978 return function() { 55979 // noop 55980 }; 55981 } 55982 } 55983 55984 if (options.singleton) { 55985 var styleIndex = singletonCounter++; 55986 55987 style = singleton || (singleton = createStyleElement(options)); 55988 55989 update = applyToSingletonTag.bind(null, style, styleIndex, false); 55990 remove = applyToSingletonTag.bind(null, style, styleIndex, true); 55991 55992 } else if ( 55993 obj.sourceMap && 55994 typeof URL === "function" && 55995 typeof URL.createObjectURL === "function" && 55996 typeof URL.revokeObjectURL === "function" && 55997 typeof Blob === "function" && 55998 typeof btoa === "function" 55999 ) { 56000 style = createLinkElement(options); 56001 update = updateLink.bind(null, style, options); 56002 remove = function () { 56003 removeStyleElement(style); 56004 56005 if(style.href) URL.revokeObjectURL(style.href); 56006 }; 56007 } else { 56008 style = createStyleElement(options); 56009 update = applyToTag.bind(null, style); 56010 remove = function () { 56011 removeStyleElement(style); 56012 }; 56013 } 56014 56015 update(obj); 56016 56017 return function updateStyle (newObj) { 56018 if (newObj) { 56019 if ( 56020 newObj.css === obj.css && 56021 newObj.media === obj.media && 56022 newObj.sourceMap === obj.sourceMap 56023 ) { 56024 return; 56025 } 56026 56027 update(obj = newObj); 56028 } else { 56029 remove(); 56030 } 56031 }; 56032} 56033 56034var replaceText = (function () { 56035 var textStore = []; 56036 56037 return function (index, replacement) { 56038 textStore[index] = replacement; 56039 56040 return textStore.filter(Boolean).join('\n'); 56041 }; 56042})(); 56043 56044function applyToSingletonTag (style, index, remove, obj) { 56045 var css = remove ? "" : obj.css; 56046 56047 if (style.styleSheet) { 56048 style.styleSheet.cssText = replaceText(index, css); 56049 } else { 56050 var cssNode = document.createTextNode(css); 56051 var childNodes = style.childNodes; 56052 56053 if (childNodes[index]) style.removeChild(childNodes[index]); 56054 56055 if (childNodes.length) { 56056 style.insertBefore(cssNode, childNodes[index]); 56057 } else { 56058 style.appendChild(cssNode); 56059 } 56060 } 56061} 56062 56063function applyToTag (style, obj) { 56064 var css = obj.css; 56065 var media = obj.media; 56066 56067 if(media) { 56068 style.setAttribute("media", media) 56069 } 56070 56071 if(style.styleSheet) { 56072 style.styleSheet.cssText = css; 56073 } else { 56074 while(style.firstChild) { 56075 style.removeChild(style.firstChild); 56076 } 56077 56078 style.appendChild(document.createTextNode(css)); 56079 } 56080} 56081 56082function updateLink (link, options, obj) { 56083 var css = obj.css; 56084 var sourceMap = obj.sourceMap; 56085 56086 /* 56087 If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled 56088 and there is no publicPath defined then lets turn convertToAbsoluteUrls 56089 on by default. Otherwise default to the convertToAbsoluteUrls option 56090 directly 56091 */ 56092 var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; 56093 56094 if (options.convertToAbsoluteUrls || autoFixUrls) { 56095 css = fixUrls(css); 56096 } 56097 56098 if (sourceMap) { 56099 // http://stackoverflow.com/a/26603875 56100 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; 56101 } 56102 56103 var blob = new Blob([css], { type: "text/css" }); 56104 56105 var oldSrc = link.href; 56106 56107 link.href = URL.createObjectURL(blob); 56108 56109 if(oldSrc) URL.revokeObjectURL(oldSrc); 56110} 56111 56112 56113/***/ }), 56114
vendor: 3,300 bytes, lines 56115-56214
56115/***/ "./node_modules/style-loader/lib/urls.js": 56116/*!***********************************************!*\ 56117 !*** ./node_modules/style-loader/lib/urls.js ***! 56118 \***********************************************/ 56119/*! no static exports found */ 56120/***/ (function(module, exports) { 56121 56122 56123/** 56124 * When source maps are enabled, `style-loader` uses a link element with a data-uri to 56125 * embed the css on the page. This breaks all relative urls because now they are relative to a 56126 * bundle instead of the current page. 56127 * 56128 * One solution is to only use full urls, but that may be impossible. 56129 * 56130 * Instead, this function "fixes" the relative urls to be absolute according to the current page location. 56131 * 56132 * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. 56133 * 56134 */ 56135 56136module.exports = function (css) { 56137 // get current location 56138 var location = typeof window !== "undefined" && window.location; 56139 56140 if (!location) { 56141 throw new Error("fixUrls requires window.location"); 56142 } 56143 56144 // blank or null? 56145 if (!css || typeof css !== "string") { 56146 return css; 56147 } 56148 56149 var baseUrl = location.protocol + "//" + location.host; 56150 var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); 56151 56152 // convert each url(...) 56153 /* 56154 This regular expression is just a way to recursively match brackets within 56155 a string. 56156 56157 /url\s*\( = Match on the word "url" with any whitespace after it and then a parens 56158 ( = Start a capturing group 56159 (?: = Start a non-capturing group 56160 [^)(] = Match anything that isn't a parentheses 56161 | = OR 56162 \( = Match a start parentheses 56163 (?: = Start another non-capturing groups 56164 [^)(]+ = Match anything that isn't a parentheses 56165 | = OR 56166 \( = Match a start parentheses 56167 [^)(]* = Match anything that isn't a parentheses 56168 \) = Match a end parentheses 56169 ) = End Group 56170 *\) = Match anything and then a close parens 56171 ) = Close non-capturing group 56172 * = Match anything 56173 ) = Close capturing group 56174 \) = Match a close parens 56175 56176 /gi = Get all matches, not the first. Be case insensitive. 56177 */ 56178 var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { 56179 // strip quotes (if they exist) 56180 var unquotedOrigUrl = origUrl 56181 .trim() 56182 .replace(/^"(.*)"$/, function(o, $1){ return $1; }) 56183 .replace(/^'(.*)'$/, function(o, $1){ return $1; }); 56184 56185 // already a full url? no change 56186 if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { 56187 return fullMatch; 56188 } 56189 56190 // convert the url to a full url 56191 var newUrl; 56192 56193 if (unquotedOrigUrl.indexOf("//") === 0) { 56194 //TODO: should we add protocol? 56195 newUrl = unquotedOrigUrl; 56196 } else if (unquotedOrigUrl.indexOf("/") === 0) { 56197 // path should be relative to the base url 56198 newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' 56199 } else { 56200 // path should be relative to current directory 56201 newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' 56202 } 56203 56204 // send back the fixed url(...) 56205 return "url(" + JSON.stringify(newUrl) + ")"; 56206 }); 56207 56208 // send back the fixed css 56209 return fixedCss; 56210}; 56211 56212 56213/***/ }), 56214
vendor: 724 bytes, lines 56215-56245
56215/***/ "./node_modules/webpack/buildin/global.js": 56216/*!***********************************!*\ 56217 !*** (webpack)/buildin/global.js ***! 56218 \***********************************/ 56219/*! no static exports found */ 56220/***/ (function(module, exports) { 56221 56222var g; 56223 56224// This works in non-strict mode 56225g = (function() { 56226 return this; 56227})(); 56228 56229try { 56230 // This works if eval is allowed (see CSP) 56231 g = g || new Function("return this")(); 56232} catch (e) { 56233 // This works if the window reference is available 56234 if (typeof window === "object") g = window; 56235} 56236 56237// g can still be undefined, but nothing to do about it... 56238// We return undefined, instead of nothing here, so it's 56239// easier to handle this case. if(!global) { ...} 56240 56241module.exports = g; 56242 56243 56244/***/ }), 56245
vendor: 746 bytes, lines 56246-56277
56246/***/ "./node_modules/webpack/buildin/module.js": 56247/*!***********************************!*\ 56248 !*** (webpack)/buildin/module.js ***! 56249 \***********************************/ 56250/*! no static exports found */ 56251/***/ (function(module, exports) { 56252 56253module.exports = function(module) { 56254 if (!module.webpackPolyfill) { 56255 module.deprecate = function() {}; 56256 module.paths = []; 56257 // module.parent = undefined by default 56258 if (!module.children) module.children = []; 56259 Object.defineProperty(module, "loaded", { 56260 enumerable: true, 56261 get: function() { 56262 return module.l; 56263 } 56264 }); 56265 Object.defineProperty(module, "id", { 56266 enumerable: true, 56267 get: function() { 56268 return module.i; 56269 } 56270 }); 56271 module.webpackPolyfill = 1; 56272 } 56273 return module; 56274}; 56275 56276 56277/***/ })
56277, 56278 56279/***/ 0: 56280/*!***************************************!*\ 56281 !*** multi ./assets/js/src/index.jsx ***! 56282 \***************************************/ 56283/*! no static exports found */ 56284/***/ (function(module, exports, __webpack_require__) { 56285 56286module.exports = __webpack_require__(/*! /Users/robertbossaert/Sites/yard-zorg-sites-saas/app/Components/Core-Legacy/assets/js/src/index.jsx */"./assets/js/src/index.jsx"); 56287 56288 56289/***/ }) 56290 56291/******/ });
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.