| Total Complexity | 307 |
| Complexity/F | 1.92 |
| Lines of Code | 1908 |
| Function Count | 160 |
| Duplicated Lines | 67 |
| Ratio | 3.51 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like public/js/bootstrap.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
| 1 | View Code Duplication | /******/ (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 | /******/ // identity function for calling harmony imports with the correct context |
||
| 37 | /******/ __webpack_require__.i = function(value) { return value; }; |
||
| 38 | /******/ |
||
| 39 | /******/ // define getter function for harmony exports |
||
| 40 | /******/ __webpack_require__.d = function(exports, name, getter) { |
||
| 41 | /******/ if(!__webpack_require__.o(exports, name)) { |
||
| 42 | /******/ Object.defineProperty(exports, name, { |
||
| 43 | /******/ configurable: false, |
||
| 44 | /******/ enumerable: true, |
||
| 45 | /******/ get: getter |
||
| 46 | /******/ }); |
||
| 47 | /******/ } |
||
| 48 | /******/ }; |
||
| 49 | /******/ |
||
| 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
||
| 51 | /******/ __webpack_require__.n = function(module) { |
||
| 52 | /******/ var getter = module && module.__esModule ? |
||
| 53 | /******/ function getDefault() { return module['default']; } : |
||
| 54 | /******/ function getModuleExports() { return module; }; |
||
| 55 | /******/ __webpack_require__.d(getter, 'a', getter); |
||
| 56 | /******/ return getter; |
||
| 57 | /******/ }; |
||
| 58 | /******/ |
||
| 59 | /******/ // Object.prototype.hasOwnProperty.call |
||
| 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||
| 61 | /******/ |
||
| 62 | /******/ // __webpack_public_path__ |
||
| 63 | /******/ __webpack_require__.p = "./"; |
||
| 64 | /******/ |
||
| 65 | /******/ // Load entry module and return exports |
||
| 66 | /******/ return __webpack_require__(__webpack_require__.s = 35); |
||
| 67 | /******/ }) |
||
| 68 | /************************************************************************/ |
||
| 69 | /******/ ([ |
||
| 70 | /* 0 */ |
||
| 71 | /***/ (function(module, exports, __webpack_require__) { |
||
| 72 | |||
| 73 | "use strict"; |
||
| 74 | |||
| 75 | |||
| 76 | var bind = __webpack_require__(7); |
||
| 77 | var isBuffer = __webpack_require__(32); |
||
| 78 | |||
| 79 | /*global toString:true*/ |
||
| 80 | |||
| 81 | // utils is a library of generic helper functions non-specific to axios |
||
| 82 | |||
| 83 | var toString = Object.prototype.toString; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Determine if a value is an Array |
||
| 87 | * |
||
| 88 | * @param {Object} val The value to test |
||
| 89 | * @returns {boolean} True if value is an Array, otherwise false |
||
| 90 | */ |
||
| 91 | function isArray(val) { |
||
| 92 | return toString.call(val) === '[object Array]'; |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Determine if a value is an ArrayBuffer |
||
| 97 | * |
||
| 98 | * @param {Object} val The value to test |
||
| 99 | * @returns {boolean} True if value is an ArrayBuffer, otherwise false |
||
| 100 | */ |
||
| 101 | function isArrayBuffer(val) { |
||
| 102 | return toString.call(val) === '[object ArrayBuffer]'; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Determine if a value is a FormData |
||
| 107 | * |
||
| 108 | * @param {Object} val The value to test |
||
| 109 | * @returns {boolean} True if value is an FormData, otherwise false |
||
| 110 | */ |
||
| 111 | function isFormData(val) { |
||
| 112 | return (typeof FormData !== 'undefined') && (val instanceof FormData); |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Determine if a value is a view on an ArrayBuffer |
||
| 117 | * |
||
| 118 | * @param {Object} val The value to test |
||
| 119 | * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false |
||
| 120 | */ |
||
| 121 | function isArrayBufferView(val) { |
||
| 122 | var result; |
||
| 123 | if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { |
||
| 124 | result = ArrayBuffer.isView(val); |
||
| 125 | } else { |
||
| 126 | result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); |
||
| 127 | } |
||
| 128 | return result; |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Determine if a value is a String |
||
| 133 | * |
||
| 134 | * @param {Object} val The value to test |
||
| 135 | * @returns {boolean} True if value is a String, otherwise false |
||
| 136 | */ |
||
| 137 | function isString(val) { |
||
| 138 | return typeof val === 'string'; |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Determine if a value is a Number |
||
| 143 | * |
||
| 144 | * @param {Object} val The value to test |
||
| 145 | * @returns {boolean} True if value is a Number, otherwise false |
||
| 146 | */ |
||
| 147 | function isNumber(val) { |
||
| 148 | return typeof val === 'number'; |
||
| 149 | } |
||
| 150 | |||
| 151 | /** |
||
| 152 | * Determine if a value is undefined |
||
| 153 | * |
||
| 154 | * @param {Object} val The value to test |
||
| 155 | * @returns {boolean} True if the value is undefined, otherwise false |
||
| 156 | */ |
||
| 157 | function isUndefined(val) { |
||
| 158 | return typeof val === 'undefined'; |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * Determine if a value is an Object |
||
| 163 | * |
||
| 164 | * @param {Object} val The value to test |
||
| 165 | * @returns {boolean} True if value is an Object, otherwise false |
||
| 166 | */ |
||
| 167 | function isObject(val) { |
||
| 168 | return val !== null && typeof val === 'object'; |
||
| 169 | } |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Determine if a value is a Date |
||
| 173 | * |
||
| 174 | * @param {Object} val The value to test |
||
| 175 | * @returns {boolean} True if value is a Date, otherwise false |
||
| 176 | */ |
||
| 177 | function isDate(val) { |
||
| 178 | return toString.call(val) === '[object Date]'; |
||
| 179 | } |
||
| 180 | |||
| 181 | /** |
||
| 182 | * Determine if a value is a File |
||
| 183 | * |
||
| 184 | * @param {Object} val The value to test |
||
| 185 | * @returns {boolean} True if value is a File, otherwise false |
||
| 186 | */ |
||
| 187 | function isFile(val) { |
||
| 188 | return toString.call(val) === '[object File]'; |
||
| 189 | } |
||
| 190 | |||
| 191 | /** |
||
| 192 | * Determine if a value is a Blob |
||
| 193 | * |
||
| 194 | * @param {Object} val The value to test |
||
| 195 | * @returns {boolean} True if value is a Blob, otherwise false |
||
| 196 | */ |
||
| 197 | function isBlob(val) { |
||
| 198 | return toString.call(val) === '[object Blob]'; |
||
| 199 | } |
||
| 200 | |||
| 201 | /** |
||
| 202 | * Determine if a value is a Function |
||
| 203 | * |
||
| 204 | * @param {Object} val The value to test |
||
| 205 | * @returns {boolean} True if value is a Function, otherwise false |
||
| 206 | */ |
||
| 207 | function isFunction(val) { |
||
| 208 | return toString.call(val) === '[object Function]'; |
||
| 209 | } |
||
| 210 | |||
| 211 | /** |
||
| 212 | * Determine if a value is a Stream |
||
| 213 | * |
||
| 214 | * @param {Object} val The value to test |
||
| 215 | * @returns {boolean} True if value is a Stream, otherwise false |
||
| 216 | */ |
||
| 217 | function isStream(val) { |
||
| 218 | return isObject(val) && isFunction(val.pipe); |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Determine if a value is a URLSearchParams object |
||
| 223 | * |
||
| 224 | * @param {Object} val The value to test |
||
| 225 | * @returns {boolean} True if value is a URLSearchParams object, otherwise false |
||
| 226 | */ |
||
| 227 | function isURLSearchParams(val) { |
||
| 228 | return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; |
||
| 229 | } |
||
| 230 | |||
| 231 | /** |
||
| 232 | * Trim excess whitespace off the beginning and end of a string |
||
| 233 | * |
||
| 234 | * @param {String} str The String to trim |
||
| 235 | * @returns {String} The String freed of excess whitespace |
||
| 236 | */ |
||
| 237 | function trim(str) { |
||
| 238 | return str.replace(/^\s*/, '').replace(/\s*$/, ''); |
||
| 239 | } |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Determine if we're running in a standard browser environment |
||
| 243 | * |
||
| 244 | * This allows axios to run in a web worker, and react-native. |
||
| 245 | * Both environments support XMLHttpRequest, but not fully standard globals. |
||
| 246 | * |
||
| 247 | * web workers: |
||
| 248 | * typeof window -> undefined |
||
| 249 | * typeof document -> undefined |
||
| 250 | * |
||
| 251 | * react-native: |
||
| 252 | * navigator.product -> 'ReactNative' |
||
| 253 | */ |
||
| 254 | function isStandardBrowserEnv() { |
||
| 255 | if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { |
||
| 256 | return false; |
||
| 257 | } |
||
| 258 | return ( |
||
| 259 | typeof window !== 'undefined' && |
||
| 260 | typeof document !== 'undefined' |
||
| 261 | ); |
||
| 262 | } |
||
| 263 | |||
| 264 | /** |
||
| 265 | * Iterate over an Array or an Object invoking a function for each item. |
||
| 266 | * |
||
| 267 | * If `obj` is an Array callback will be called passing |
||
| 268 | * the value, index, and complete array for each item. |
||
| 269 | * |
||
| 270 | * If 'obj' is an Object callback will be called passing |
||
| 271 | * the value, key, and complete object for each property. |
||
| 272 | * |
||
| 273 | * @param {Object|Array} obj The object to iterate |
||
| 274 | * @param {Function} fn The callback to invoke for each item |
||
| 275 | */ |
||
| 276 | function forEach(obj, fn) { |
||
| 277 | // Don't bother if no value provided |
||
| 278 | if (obj === null || typeof obj === 'undefined') { |
||
| 279 | return; |
||
| 280 | } |
||
| 281 | |||
| 282 | // Force an array if not already something iterable |
||
| 283 | if (typeof obj !== 'object') { |
||
| 284 | /*eslint no-param-reassign:0*/ |
||
| 285 | obj = [obj]; |
||
| 286 | } |
||
| 287 | |||
| 288 | if (isArray(obj)) { |
||
| 289 | // Iterate over array values |
||
| 290 | for (var i = 0, l = obj.length; i < l; i++) { |
||
| 291 | fn.call(null, obj[i], i, obj); |
||
| 292 | } |
||
| 293 | } else { |
||
| 294 | // Iterate over object keys |
||
| 295 | for (var key in obj) { |
||
| 296 | if (Object.prototype.hasOwnProperty.call(obj, key)) { |
||
| 297 | fn.call(null, obj[key], key, obj); |
||
| 298 | } |
||
| 299 | } |
||
| 300 | } |
||
| 301 | } |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Accepts varargs expecting each argument to be an object, then |
||
| 305 | * immutably merges the properties of each object and returns result. |
||
| 306 | * |
||
| 307 | * When multiple objects contain the same key the later object in |
||
| 308 | * the arguments list will take precedence. |
||
| 309 | * |
||
| 310 | * Example: |
||
| 311 | * |
||
| 312 | * ```js |
||
| 313 | * var result = merge({foo: 123}, {foo: 456}); |
||
| 314 | * console.log(result.foo); // outputs 456 |
||
| 315 | * ``` |
||
| 316 | * |
||
| 317 | * @param {Object} obj1 Object to merge |
||
| 318 | * @returns {Object} Result of all merge properties |
||
| 319 | */ |
||
| 320 | function merge(/* obj1, obj2, obj3, ... */) { |
||
| 321 | var result = {}; |
||
| 322 | function assignValue(val, key) { |
||
| 323 | if (typeof result[key] === 'object' && typeof val === 'object') { |
||
| 324 | result[key] = merge(result[key], val); |
||
| 325 | } else { |
||
| 326 | result[key] = val; |
||
| 327 | } |
||
| 328 | } |
||
| 329 | |||
| 330 | for (var i = 0, l = arguments.length; i < l; i++) { |
||
| 331 | forEach(arguments[i], assignValue); |
||
| 332 | } |
||
| 333 | return result; |
||
| 334 | } |
||
| 335 | |||
| 336 | /** |
||
| 337 | * Extends object a by mutably adding to it the properties of object b. |
||
| 338 | * |
||
| 339 | * @param {Object} a The object to be extended |
||
| 340 | * @param {Object} b The object to copy properties from |
||
| 341 | * @param {Object} thisArg The object to bind function to |
||
| 342 | * @return {Object} The resulting value of object a |
||
| 343 | */ |
||
| 344 | function extend(a, b, thisArg) { |
||
| 345 | forEach(b, function assignValue(val, key) { |
||
| 346 | if (thisArg && typeof val === 'function') { |
||
| 347 | a[key] = bind(val, thisArg); |
||
| 348 | } else { |
||
| 349 | a[key] = val; |
||
| 350 | } |
||
| 351 | }); |
||
| 352 | return a; |
||
| 353 | } |
||
| 354 | |||
| 355 | module.exports = { |
||
| 356 | isArray: isArray, |
||
| 357 | isArrayBuffer: isArrayBuffer, |
||
| 358 | isBuffer: isBuffer, |
||
| 359 | isFormData: isFormData, |
||
| 360 | isArrayBufferView: isArrayBufferView, |
||
| 361 | isString: isString, |
||
| 362 | isNumber: isNumber, |
||
| 363 | isObject: isObject, |
||
| 364 | isUndefined: isUndefined, |
||
| 365 | isDate: isDate, |
||
| 366 | isFile: isFile, |
||
| 367 | isBlob: isBlob, |
||
| 368 | isFunction: isFunction, |
||
| 369 | isStream: isStream, |
||
| 370 | isURLSearchParams: isURLSearchParams, |
||
| 371 | isStandardBrowserEnv: isStandardBrowserEnv, |
||
| 372 | forEach: forEach, |
||
| 373 | merge: merge, |
||
| 374 | extend: extend, |
||
| 375 | trim: trim |
||
| 376 | }; |
||
| 377 | |||
| 378 | |||
| 379 | /***/ }), |
||
| 380 | /* 1 */, |
||
| 381 | /* 2 */ |
||
| 382 | /***/ (function(module, exports, __webpack_require__) { |
||
| 383 | |||
| 384 | "use strict"; |
||
| 385 | /* WEBPACK VAR INJECTION */(function(process) { |
||
| 386 | |||
| 387 | var utils = __webpack_require__(0); |
||
| 388 | var normalizeHeaderName = __webpack_require__(29); |
||
| 389 | |||
| 390 | var DEFAULT_CONTENT_TYPE = { |
||
| 391 | 'Content-Type': 'application/x-www-form-urlencoded' |
||
| 392 | }; |
||
| 393 | |||
| 394 | function setContentTypeIfUnset(headers, value) { |
||
| 395 | if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { |
||
| 396 | headers['Content-Type'] = value; |
||
| 397 | } |
||
| 398 | } |
||
| 399 | |||
| 400 | function getDefaultAdapter() { |
||
| 401 | var adapter; |
||
| 402 | if (typeof XMLHttpRequest !== 'undefined') { |
||
| 403 | // For browsers use XHR adapter |
||
| 404 | adapter = __webpack_require__(3); |
||
| 405 | } else if (typeof process !== 'undefined') { |
||
| 406 | // For node use HTTP adapter |
||
| 407 | adapter = __webpack_require__(3); |
||
| 408 | } |
||
| 409 | return adapter; |
||
| 410 | } |
||
| 411 | |||
| 412 | var defaults = { |
||
| 413 | adapter: getDefaultAdapter(), |
||
| 414 | |||
| 415 | transformRequest: [function transformRequest(data, headers) { |
||
| 416 | normalizeHeaderName(headers, 'Content-Type'); |
||
| 417 | if (utils.isFormData(data) || |
||
| 418 | utils.isArrayBuffer(data) || |
||
| 419 | utils.isBuffer(data) || |
||
| 420 | utils.isStream(data) || |
||
| 421 | utils.isFile(data) || |
||
| 422 | utils.isBlob(data) |
||
| 423 | ) { |
||
| 424 | return data; |
||
| 425 | } |
||
| 426 | if (utils.isArrayBufferView(data)) { |
||
| 427 | return data.buffer; |
||
| 428 | } |
||
| 429 | if (utils.isURLSearchParams(data)) { |
||
| 430 | setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); |
||
| 431 | return data.toString(); |
||
| 432 | } |
||
| 433 | if (utils.isObject(data)) { |
||
| 434 | setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); |
||
| 435 | return JSON.stringify(data); |
||
| 436 | } |
||
| 437 | return data; |
||
| 438 | }], |
||
| 439 | |||
| 440 | transformResponse: [function transformResponse(data) { |
||
| 441 | /*eslint no-param-reassign:0*/ |
||
| 442 | if (typeof data === 'string') { |
||
| 443 | try { |
||
| 444 | data = JSON.parse(data); |
||
| 445 | } catch (e) { /* Ignore */ } |
||
| 446 | } |
||
| 447 | return data; |
||
| 448 | }], |
||
| 449 | |||
| 450 | timeout: 0, |
||
| 451 | |||
| 452 | xsrfCookieName: 'XSRF-TOKEN', |
||
| 453 | xsrfHeaderName: 'X-XSRF-TOKEN', |
||
| 454 | |||
| 455 | maxContentLength: -1, |
||
| 456 | |||
| 457 | validateStatus: function validateStatus(status) { |
||
| 458 | return status >= 200 && status < 300; |
||
| 459 | } |
||
| 460 | }; |
||
| 461 | |||
| 462 | defaults.headers = { |
||
| 463 | common: { |
||
| 464 | 'Accept': 'application/json, text/plain, */*' |
||
| 465 | } |
||
| 466 | }; |
||
| 467 | |||
| 468 | utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { |
||
| 469 | defaults.headers[method] = {}; |
||
| 470 | }); |
||
| 471 | |||
| 472 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
||
| 473 | defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); |
||
| 474 | }); |
||
| 475 | |||
| 476 | module.exports = defaults; |
||
| 477 | |||
| 478 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) |
||
| 479 | |||
| 480 | /***/ }), |
||
| 481 | /* 3 */ |
||
| 482 | /***/ (function(module, exports, __webpack_require__) { |
||
| 483 | |||
| 484 | "use strict"; |
||
| 485 | /* WEBPACK VAR INJECTION */(function(process) { |
||
| 486 | |||
| 487 | var utils = __webpack_require__(0); |
||
| 488 | var settle = __webpack_require__(21); |
||
| 489 | var buildURL = __webpack_require__(24); |
||
| 490 | var parseHeaders = __webpack_require__(30); |
||
| 491 | var isURLSameOrigin = __webpack_require__(28); |
||
| 492 | var createError = __webpack_require__(6); |
||
| 493 | var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(23); |
||
| 494 | |||
| 495 | module.exports = function xhrAdapter(config) { |
||
| 496 | return new Promise(function dispatchXhrRequest(resolve, reject) { |
||
| 497 | var requestData = config.data; |
||
| 498 | var requestHeaders = config.headers; |
||
| 499 | |||
| 500 | if (utils.isFormData(requestData)) { |
||
| 501 | delete requestHeaders['Content-Type']; // Let the browser set it |
||
| 502 | } |
||
| 503 | |||
| 504 | var request = new XMLHttpRequest(); |
||
| 505 | var loadEvent = 'onreadystatechange'; |
||
| 506 | var xDomain = false; |
||
| 507 | |||
| 508 | // For IE 8/9 CORS support |
||
| 509 | // Only supports POST and GET calls and doesn't returns the response headers. |
||
| 510 | // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest. |
||
| 511 | if (process.env.NODE_ENV !== 'test' && |
||
| 512 | typeof window !== 'undefined' && |
||
| 513 | window.XDomainRequest && !('withCredentials' in request) && |
||
| 514 | !isURLSameOrigin(config.url)) { |
||
| 515 | request = new window.XDomainRequest(); |
||
| 516 | loadEvent = 'onload'; |
||
| 517 | xDomain = true; |
||
| 518 | request.onprogress = function handleProgress() {}; |
||
| 519 | request.ontimeout = function handleTimeout() {}; |
||
| 520 | } |
||
| 521 | |||
| 522 | // HTTP basic authentication |
||
| 523 | if (config.auth) { |
||
| 524 | var username = config.auth.username || ''; |
||
| 525 | var password = config.auth.password || ''; |
||
| 526 | requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); |
||
| 527 | } |
||
| 528 | |||
| 529 | request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); |
||
| 530 | |||
| 531 | // Set the request timeout in MS |
||
| 532 | request.timeout = config.timeout; |
||
| 533 | |||
| 534 | // Listen for ready state |
||
| 535 | request[loadEvent] = function handleLoad() { |
||
| 536 | if (!request || (request.readyState !== 4 && !xDomain)) { |
||
| 537 | return; |
||
| 538 | } |
||
| 539 | |||
| 540 | // The request errored out and we didn't get a response, this will be |
||
| 541 | // handled by onerror instead |
||
| 542 | // With one exception: request that using file: protocol, most browsers |
||
| 543 | // will return status as 0 even though it's a successful request |
||
| 544 | if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { |
||
| 545 | return; |
||
| 546 | } |
||
| 547 | |||
| 548 | // Prepare the response |
||
| 549 | var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; |
||
| 550 | var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; |
||
| 551 | var response = { |
||
| 552 | data: responseData, |
||
| 553 | // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201) |
||
| 554 | status: request.status === 1223 ? 204 : request.status, |
||
| 555 | statusText: request.status === 1223 ? 'No Content' : request.statusText, |
||
| 556 | headers: responseHeaders, |
||
| 557 | config: config, |
||
| 558 | request: request |
||
| 559 | }; |
||
| 560 | |||
| 561 | settle(resolve, reject, response); |
||
| 562 | |||
| 563 | // Clean up request |
||
| 564 | request = null; |
||
| 565 | }; |
||
| 566 | |||
| 567 | // Handle low level network errors |
||
| 568 | request.onerror = function handleError() { |
||
| 569 | // Real errors are hidden from us by the browser |
||
| 570 | // onerror should only fire if it's a network error |
||
| 571 | reject(createError('Network Error', config, null, request)); |
||
| 572 | |||
| 573 | // Clean up request |
||
| 574 | request = null; |
||
| 575 | }; |
||
| 576 | |||
| 577 | // Handle timeout |
||
| 578 | request.ontimeout = function handleTimeout() { |
||
| 579 | reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', |
||
| 580 | request)); |
||
| 581 | |||
| 582 | // Clean up request |
||
| 583 | request = null; |
||
| 584 | }; |
||
| 585 | |||
| 586 | // Add xsrf header |
||
| 587 | // This is only done if running in a standard browser environment. |
||
| 588 | // Specifically not if we're in a web worker, or react-native. |
||
| 589 | if (utils.isStandardBrowserEnv()) { |
||
| 590 | var cookies = __webpack_require__(26); |
||
| 591 | |||
| 592 | // Add xsrf header |
||
| 593 | var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? |
||
| 594 | cookies.read(config.xsrfCookieName) : |
||
| 595 | undefined; |
||
| 596 | |||
| 597 | if (xsrfValue) { |
||
| 598 | requestHeaders[config.xsrfHeaderName] = xsrfValue; |
||
| 599 | } |
||
| 600 | } |
||
| 601 | |||
| 602 | // Add headers to the request |
||
| 603 | if ('setRequestHeader' in request) { |
||
| 604 | utils.forEach(requestHeaders, function setRequestHeader(val, key) { |
||
| 605 | if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { |
||
| 606 | // Remove Content-Type if data is undefined |
||
| 607 | delete requestHeaders[key]; |
||
| 608 | } else { |
||
| 609 | // Otherwise add header to the request |
||
| 610 | request.setRequestHeader(key, val); |
||
| 611 | } |
||
| 612 | }); |
||
| 613 | } |
||
| 614 | |||
| 615 | // Add withCredentials to request if needed |
||
| 616 | if (config.withCredentials) { |
||
| 617 | request.withCredentials = true; |
||
| 618 | } |
||
| 619 | |||
| 620 | // Add responseType to request if needed |
||
| 621 | if (config.responseType) { |
||
| 622 | try { |
||
| 623 | request.responseType = config.responseType; |
||
| 624 | } catch (e) { |
||
| 625 | // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. |
||
| 626 | // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. |
||
| 627 | if (config.responseType !== 'json') { |
||
| 628 | throw e; |
||
| 629 | } |
||
| 630 | } |
||
| 631 | } |
||
| 632 | |||
| 633 | // Handle progress if needed |
||
| 634 | if (typeof config.onDownloadProgress === 'function') { |
||
| 635 | request.addEventListener('progress', config.onDownloadProgress); |
||
| 636 | } |
||
| 637 | |||
| 638 | // Not all browsers support upload events |
||
| 639 | if (typeof config.onUploadProgress === 'function' && request.upload) { |
||
| 640 | request.upload.addEventListener('progress', config.onUploadProgress); |
||
| 641 | } |
||
| 642 | |||
| 643 | if (config.cancelToken) { |
||
| 644 | // Handle cancellation |
||
| 645 | config.cancelToken.promise.then(function onCanceled(cancel) { |
||
| 646 | if (!request) { |
||
| 647 | return; |
||
| 648 | } |
||
| 649 | |||
| 650 | request.abort(); |
||
| 651 | reject(cancel); |
||
| 652 | // Clean up request |
||
| 653 | request = null; |
||
| 654 | }); |
||
| 655 | } |
||
| 656 | |||
| 657 | if (requestData === undefined) { |
||
| 658 | requestData = null; |
||
| 659 | } |
||
| 660 | |||
| 661 | // Send the request |
||
| 662 | request.send(requestData); |
||
| 663 | }); |
||
| 664 | }; |
||
| 665 | |||
| 666 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) |
||
| 667 | |||
| 668 | /***/ }), |
||
| 669 | /* 4 */ |
||
| 670 | /***/ (function(module, exports, __webpack_require__) { |
||
| 671 | |||
| 672 | "use strict"; |
||
| 673 | |||
| 674 | |||
| 675 | /** |
||
| 676 | * A `Cancel` is an object that is thrown when an operation is canceled. |
||
| 677 | * |
||
| 678 | * @class |
||
| 679 | * @param {string=} message The message. |
||
| 680 | */ |
||
| 681 | function Cancel(message) { |
||
| 682 | this.message = message; |
||
| 683 | } |
||
| 684 | |||
| 685 | Cancel.prototype.toString = function toString() { |
||
| 686 | return 'Cancel' + (this.message ? ': ' + this.message : ''); |
||
| 687 | }; |
||
| 688 | |||
| 689 | Cancel.prototype.__CANCEL__ = true; |
||
| 690 | |||
| 691 | module.exports = Cancel; |
||
| 692 | |||
| 693 | |||
| 694 | /***/ }), |
||
| 695 | /* 5 */ |
||
| 696 | /***/ (function(module, exports, __webpack_require__) { |
||
| 697 | |||
| 698 | "use strict"; |
||
| 699 | |||
| 700 | |||
| 701 | module.exports = function isCancel(value) { |
||
| 702 | return !!(value && value.__CANCEL__); |
||
| 703 | }; |
||
| 704 | |||
| 705 | |||
| 706 | /***/ }), |
||
| 707 | /* 6 */ |
||
| 708 | /***/ (function(module, exports, __webpack_require__) { |
||
| 709 | |||
| 710 | "use strict"; |
||
| 711 | |||
| 712 | |||
| 713 | var enhanceError = __webpack_require__(20); |
||
| 714 | |||
| 715 | /** |
||
| 716 | * Create an Error with the specified message, config, error code, request and response. |
||
| 717 | * |
||
| 718 | * @param {string} message The error message. |
||
| 719 | * @param {Object} config The config. |
||
| 720 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). |
||
| 721 | * @param {Object} [request] The request. |
||
| 722 | * @param {Object} [response] The response. |
||
| 723 | * @returns {Error} The created error. |
||
| 724 | */ |
||
| 725 | module.exports = function createError(message, config, code, request, response) { |
||
| 726 | var error = new Error(message); |
||
| 727 | return enhanceError(error, config, code, request, response); |
||
| 728 | }; |
||
| 729 | |||
| 730 | |||
| 731 | /***/ }), |
||
| 732 | /* 7 */ |
||
| 733 | /***/ (function(module, exports, __webpack_require__) { |
||
| 734 | |||
| 735 | "use strict"; |
||
| 736 | |||
| 737 | |||
| 738 | module.exports = function bind(fn, thisArg) { |
||
| 739 | return function wrap() { |
||
| 740 | var args = new Array(arguments.length); |
||
| 741 | for (var i = 0; i < args.length; i++) { |
||
| 742 | args[i] = arguments[i]; |
||
| 743 | } |
||
| 744 | return fn.apply(thisArg, args); |
||
| 745 | }; |
||
| 746 | }; |
||
| 747 | |||
| 748 | |||
| 749 | /***/ }), |
||
| 750 | /* 8 */ |
||
| 751 | /***/ (function(module, exports) { |
||
| 752 | |||
| 753 | // shim for using process in browser |
||
| 754 | var process = module.exports = {}; |
||
| 755 | |||
| 756 | // cached from whatever global is present so that test runners that stub it |
||
| 757 | // don't break things. But we need to wrap it in a try catch in case it is |
||
| 758 | // wrapped in strict mode code which doesn't define any globals. It's inside a |
||
| 759 | // function because try/catches deoptimize in certain engines. |
||
| 760 | |||
| 761 | var cachedSetTimeout; |
||
| 762 | var cachedClearTimeout; |
||
| 763 | |||
| 764 | function defaultSetTimout() { |
||
| 765 | throw new Error('setTimeout has not been defined'); |
||
| 766 | } |
||
| 767 | function defaultClearTimeout () { |
||
| 768 | throw new Error('clearTimeout has not been defined'); |
||
| 769 | } |
||
| 770 | (function () { |
||
| 771 | try { |
||
| 772 | if (typeof setTimeout === 'function') { |
||
| 773 | cachedSetTimeout = setTimeout; |
||
| 774 | } else { |
||
| 775 | cachedSetTimeout = defaultSetTimout; |
||
| 776 | } |
||
| 777 | } catch (e) { |
||
| 778 | cachedSetTimeout = defaultSetTimout; |
||
| 779 | } |
||
| 780 | try { |
||
| 781 | if (typeof clearTimeout === 'function') { |
||
| 782 | cachedClearTimeout = clearTimeout; |
||
| 783 | } else { |
||
| 784 | cachedClearTimeout = defaultClearTimeout; |
||
| 785 | } |
||
| 786 | } catch (e) { |
||
| 787 | cachedClearTimeout = defaultClearTimeout; |
||
| 788 | } |
||
| 789 | } ()) |
||
| 790 | function runTimeout(fun) { |
||
| 791 | if (cachedSetTimeout === setTimeout) { |
||
| 792 | //normal enviroments in sane situations |
||
| 793 | return setTimeout(fun, 0); |
||
| 794 | } |
||
| 795 | // if setTimeout wasn't available but was latter defined |
||
| 796 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { |
||
| 797 | cachedSetTimeout = setTimeout; |
||
| 798 | return setTimeout(fun, 0); |
||
| 799 | } |
||
| 800 | try { |
||
| 801 | // when when somebody has screwed with setTimeout but no I.E. maddness |
||
| 802 | return cachedSetTimeout(fun, 0); |
||
| 803 | } catch(e){ |
||
| 804 | try { |
||
| 805 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally |
||
| 806 | return cachedSetTimeout.call(null, fun, 0); |
||
| 807 | } catch(e){ |
||
| 808 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error |
||
| 809 | return cachedSetTimeout.call(this, fun, 0); |
||
| 810 | } |
||
| 811 | } |
||
| 812 | |||
| 813 | |||
| 814 | } |
||
| 815 | function runClearTimeout(marker) { |
||
| 816 | if (cachedClearTimeout === clearTimeout) { |
||
| 817 | //normal enviroments in sane situations |
||
| 818 | return clearTimeout(marker); |
||
| 819 | } |
||
| 820 | // if clearTimeout wasn't available but was latter defined |
||
| 821 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { |
||
| 822 | cachedClearTimeout = clearTimeout; |
||
| 823 | return clearTimeout(marker); |
||
| 824 | } |
||
| 825 | try { |
||
| 826 | // when when somebody has screwed with setTimeout but no I.E. maddness |
||
| 827 | return cachedClearTimeout(marker); |
||
| 828 | } catch (e){ |
||
| 829 | try { |
||
| 830 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally |
||
| 831 | return cachedClearTimeout.call(null, marker); |
||
| 832 | } catch (e){ |
||
| 833 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. |
||
| 834 | // Some versions of I.E. have different rules for clearTimeout vs setTimeout |
||
| 835 | return cachedClearTimeout.call(this, marker); |
||
| 836 | } |
||
| 837 | } |
||
| 838 | |||
| 839 | |||
| 840 | |||
| 841 | } |
||
| 842 | var queue = []; |
||
| 843 | var draining = false; |
||
| 844 | var currentQueue; |
||
| 845 | var queueIndex = -1; |
||
| 846 | |||
| 847 | function cleanUpNextTick() { |
||
| 848 | if (!draining || !currentQueue) { |
||
| 849 | return; |
||
| 850 | } |
||
| 851 | draining = false; |
||
| 852 | if (currentQueue.length) { |
||
| 853 | queue = currentQueue.concat(queue); |
||
| 854 | } else { |
||
| 855 | queueIndex = -1; |
||
| 856 | } |
||
| 857 | if (queue.length) { |
||
| 858 | drainQueue(); |
||
| 859 | } |
||
| 860 | } |
||
| 861 | |||
| 862 | function drainQueue() { |
||
| 863 | if (draining) { |
||
| 864 | return; |
||
| 865 | } |
||
| 866 | var timeout = runTimeout(cleanUpNextTick); |
||
| 867 | draining = true; |
||
| 868 | |||
| 869 | var len = queue.length; |
||
| 870 | while(len) { |
||
| 871 | currentQueue = queue; |
||
| 872 | queue = []; |
||
| 873 | while (++queueIndex < len) { |
||
| 874 | if (currentQueue) { |
||
| 875 | currentQueue[queueIndex].run(); |
||
| 876 | } |
||
| 877 | } |
||
| 878 | queueIndex = -1; |
||
| 879 | len = queue.length; |
||
| 880 | } |
||
| 881 | currentQueue = null; |
||
| 882 | draining = false; |
||
| 883 | runClearTimeout(timeout); |
||
| 884 | } |
||
| 885 | |||
| 886 | process.nextTick = function (fun) { |
||
| 887 | var args = new Array(arguments.length - 1); |
||
| 888 | if (arguments.length > 1) { |
||
| 889 | for (var i = 1; i < arguments.length; i++) { |
||
| 890 | args[i - 1] = arguments[i]; |
||
| 891 | } |
||
| 892 | } |
||
| 893 | queue.push(new Item(fun, args)); |
||
| 894 | if (queue.length === 1 && !draining) { |
||
| 895 | runTimeout(drainQueue); |
||
| 896 | } |
||
| 897 | }; |
||
| 898 | |||
| 899 | // v8 likes predictible objects |
||
| 900 | function Item(fun, array) { |
||
| 901 | this.fun = fun; |
||
| 902 | this.array = array; |
||
| 903 | } |
||
| 904 | Item.prototype.run = function () { |
||
| 905 | this.fun.apply(null, this.array); |
||
| 906 | }; |
||
| 907 | process.title = 'browser'; |
||
| 908 | process.browser = true; |
||
| 909 | process.env = {}; |
||
| 910 | process.argv = []; |
||
| 911 | process.version = ''; // empty string to avoid regexp issues |
||
| 912 | process.versions = {}; |
||
| 913 | |||
| 914 | function noop() {} |
||
| 915 | |||
| 916 | process.on = noop; |
||
| 917 | process.addListener = noop; |
||
| 918 | process.once = noop; |
||
| 919 | process.off = noop; |
||
| 920 | process.removeListener = noop; |
||
| 921 | process.removeAllListeners = noop; |
||
| 922 | process.emit = noop; |
||
| 923 | process.prependListener = noop; |
||
| 924 | process.prependOnceListener = noop; |
||
| 925 | |||
| 926 | process.listeners = function (name) { return [] } |
||
| 927 | |||
| 928 | process.binding = function (name) { |
||
| 929 | throw new Error('process.binding is not supported'); |
||
| 930 | }; |
||
| 931 | |||
| 932 | process.cwd = function () { return '/' }; |
||
| 933 | process.chdir = function (dir) { |
||
| 934 | throw new Error('process.chdir is not supported'); |
||
| 935 | }; |
||
| 936 | process.umask = function() { return 0; }; |
||
| 937 | |||
| 938 | |||
| 939 | /***/ }), |
||
| 940 | /* 9 */, |
||
| 941 | /* 10 */, |
||
| 942 | /* 11 */ |
||
| 943 | /***/ (function(module, exports, __webpack_require__) { |
||
| 944 | |||
| 945 | // window._ = require('lodash'); |
||
| 946 | |||
| 947 | /** |
||
| 948 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support |
||
| 949 | * for JavaScript based Bootstrap features such as modals and tabs. This |
||
| 950 | * code may be modified to fit the specific needs of your application. |
||
| 951 | */ |
||
| 952 | |||
| 953 | // try { |
||
| 954 | // window.$ = window.jQuery = require('jquery'); |
||
| 955 | // |
||
| 956 | // require('bootstrap-sass'); |
||
| 957 | // } catch (e) {} |
||
| 958 | |||
| 959 | /** |
||
| 960 | * We'll load the axios HTTP library which allows us to easily issue requests |
||
| 961 | * to our Laravel back-end. This library automatically handles sending the |
||
| 962 | * CSRF token as a header based on the value of the "XSRF" token cookie. |
||
| 963 | */ |
||
| 964 | |||
| 965 | window.axios = __webpack_require__(14); |
||
| 966 | |||
| 967 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; |
||
| 968 | |||
| 969 | /** |
||
| 970 | * Next we will register the CSRF Token as a common header with Axios so that |
||
| 971 | * all outgoing HTTP requests automatically have it attached. This is just |
||
| 972 | * a simple convenience so we don't have to attach every token manually. |
||
| 973 | */ |
||
| 974 | |||
| 975 | var token = document.head.querySelector('meta[name="csrf-token"]'); |
||
| 976 | |||
| 977 | if (token) { |
||
| 978 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; |
||
| 979 | } else { |
||
| 980 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); |
||
| 981 | } |
||
| 982 | |||
| 983 | /** |
||
| 984 | * Echo exposes an expressive API for subscribing to channels and listening |
||
| 985 | * for events that are broadcast by Laravel. Echo and event broadcasting |
||
| 986 | * allows your team to easily build robust real-time web applications. |
||
| 987 | */ |
||
| 988 | |||
| 989 | // import Echo from 'laravel-echo' |
||
| 990 | |||
| 991 | // window.Pusher = require('pusher-js'); |
||
| 992 | |||
| 993 | // window.Echo = new Echo({ |
||
| 994 | // broadcaster: 'pusher', |
||
| 995 | // key: 'your-pusher-key', |
||
| 996 | // cluster: 'mt1', |
||
| 997 | // encrypted: true |
||
| 998 | // }); |
||
| 999 | |||
| 1000 | /***/ }), |
||
| 1001 | /* 12 */, |
||
| 1002 | /* 13 */ |
||
| 1003 | /***/ (function(module, exports) { |
||
| 1004 | |||
| 1005 | // removed by extract-text-webpack-plugin |
||
| 1006 | |||
| 1007 | /***/ }), |
||
| 1008 | /* 14 */ |
||
| 1009 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1010 | |||
| 1011 | module.exports = __webpack_require__(15); |
||
| 1012 | |||
| 1013 | /***/ }), |
||
| 1014 | /* 15 */ |
||
| 1015 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1016 | |||
| 1017 | "use strict"; |
||
| 1018 | |||
| 1019 | |||
| 1020 | var utils = __webpack_require__(0); |
||
| 1021 | var bind = __webpack_require__(7); |
||
| 1022 | var Axios = __webpack_require__(17); |
||
| 1023 | var defaults = __webpack_require__(2); |
||
| 1024 | |||
| 1025 | /** |
||
| 1026 | * Create an instance of Axios |
||
| 1027 | * |
||
| 1028 | * @param {Object} defaultConfig The default config for the instance |
||
| 1029 | * @return {Axios} A new instance of Axios |
||
| 1030 | */ |
||
| 1031 | function createInstance(defaultConfig) { |
||
| 1032 | var context = new Axios(defaultConfig); |
||
| 1033 | var instance = bind(Axios.prototype.request, context); |
||
| 1034 | |||
| 1035 | // Copy axios.prototype to instance |
||
| 1036 | utils.extend(instance, Axios.prototype, context); |
||
| 1037 | |||
| 1038 | // Copy context to instance |
||
| 1039 | utils.extend(instance, context); |
||
| 1040 | |||
| 1041 | return instance; |
||
| 1042 | } |
||
| 1043 | |||
| 1044 | // Create the default instance to be exported |
||
| 1045 | var axios = createInstance(defaults); |
||
| 1046 | |||
| 1047 | // Expose Axios class to allow class inheritance |
||
| 1048 | axios.Axios = Axios; |
||
| 1049 | |||
| 1050 | // Factory for creating new instances |
||
| 1051 | axios.create = function create(instanceConfig) { |
||
| 1052 | return createInstance(utils.merge(defaults, instanceConfig)); |
||
| 1053 | }; |
||
| 1054 | |||
| 1055 | // Expose Cancel & CancelToken |
||
| 1056 | axios.Cancel = __webpack_require__(4); |
||
| 1057 | axios.CancelToken = __webpack_require__(16); |
||
| 1058 | axios.isCancel = __webpack_require__(5); |
||
| 1059 | |||
| 1060 | // Expose all/spread |
||
| 1061 | axios.all = function all(promises) { |
||
| 1062 | return Promise.all(promises); |
||
| 1063 | }; |
||
| 1064 | axios.spread = __webpack_require__(31); |
||
| 1065 | |||
| 1066 | module.exports = axios; |
||
| 1067 | |||
| 1068 | // Allow use of default import syntax in TypeScript |
||
| 1069 | module.exports.default = axios; |
||
| 1070 | |||
| 1071 | |||
| 1072 | /***/ }), |
||
| 1073 | /* 16 */ |
||
| 1074 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1075 | |||
| 1076 | "use strict"; |
||
| 1077 | |||
| 1078 | |||
| 1079 | var Cancel = __webpack_require__(4); |
||
| 1080 | |||
| 1081 | /** |
||
| 1082 | * A `CancelToken` is an object that can be used to request cancellation of an operation. |
||
| 1083 | * |
||
| 1084 | * @class |
||
| 1085 | * @param {Function} executor The executor function. |
||
| 1086 | */ |
||
| 1087 | function CancelToken(executor) { |
||
| 1088 | if (typeof executor !== 'function') { |
||
| 1089 | throw new TypeError('executor must be a function.'); |
||
| 1090 | } |
||
| 1091 | |||
| 1092 | var resolvePromise; |
||
| 1093 | this.promise = new Promise(function promiseExecutor(resolve) { |
||
| 1094 | resolvePromise = resolve; |
||
| 1095 | }); |
||
| 1096 | |||
| 1097 | var token = this; |
||
| 1098 | executor(function cancel(message) { |
||
| 1099 | if (token.reason) { |
||
| 1100 | // Cancellation has already been requested |
||
| 1101 | return; |
||
| 1102 | } |
||
| 1103 | |||
| 1104 | token.reason = new Cancel(message); |
||
| 1105 | resolvePromise(token.reason); |
||
| 1106 | }); |
||
| 1107 | } |
||
| 1108 | |||
| 1109 | /** |
||
| 1110 | * Throws a `Cancel` if cancellation has been requested. |
||
| 1111 | */ |
||
| 1112 | CancelToken.prototype.throwIfRequested = function throwIfRequested() { |
||
| 1113 | if (this.reason) { |
||
| 1114 | throw this.reason; |
||
| 1115 | } |
||
| 1116 | }; |
||
| 1117 | |||
| 1118 | /** |
||
| 1119 | * Returns an object that contains a new `CancelToken` and a function that, when called, |
||
| 1120 | * cancels the `CancelToken`. |
||
| 1121 | */ |
||
| 1122 | CancelToken.source = function source() { |
||
| 1123 | var cancel; |
||
| 1124 | var token = new CancelToken(function executor(c) { |
||
| 1125 | cancel = c; |
||
| 1126 | }); |
||
| 1127 | return { |
||
| 1128 | token: token, |
||
| 1129 | cancel: cancel |
||
| 1130 | }; |
||
| 1131 | }; |
||
| 1132 | |||
| 1133 | module.exports = CancelToken; |
||
| 1134 | |||
| 1135 | |||
| 1136 | /***/ }), |
||
| 1137 | /* 17 */ |
||
| 1138 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1139 | |||
| 1140 | "use strict"; |
||
| 1141 | |||
| 1142 | |||
| 1143 | var defaults = __webpack_require__(2); |
||
| 1144 | var utils = __webpack_require__(0); |
||
| 1145 | var InterceptorManager = __webpack_require__(18); |
||
| 1146 | var dispatchRequest = __webpack_require__(19); |
||
| 1147 | |||
| 1148 | /** |
||
| 1149 | * Create a new instance of Axios |
||
| 1150 | * |
||
| 1151 | * @param {Object} instanceConfig The default config for the instance |
||
| 1152 | */ |
||
| 1153 | function Axios(instanceConfig) { |
||
| 1154 | this.defaults = instanceConfig; |
||
| 1155 | this.interceptors = { |
||
| 1156 | request: new InterceptorManager(), |
||
| 1157 | response: new InterceptorManager() |
||
| 1158 | }; |
||
| 1159 | } |
||
| 1160 | |||
| 1161 | /** |
||
| 1162 | * Dispatch a request |
||
| 1163 | * |
||
| 1164 | * @param {Object} config The config specific for this request (merged with this.defaults) |
||
| 1165 | */ |
||
| 1166 | Axios.prototype.request = function request(config) { |
||
| 1167 | /*eslint no-param-reassign:0*/ |
||
| 1168 | // Allow for axios('example/url'[, config]) a la fetch API |
||
| 1169 | if (typeof config === 'string') { |
||
| 1170 | config = utils.merge({ |
||
| 1171 | url: arguments[0] |
||
| 1172 | }, arguments[1]); |
||
| 1173 | } |
||
| 1174 | |||
| 1175 | config = utils.merge(defaults, this.defaults, { method: 'get' }, config); |
||
| 1176 | config.method = config.method.toLowerCase(); |
||
| 1177 | |||
| 1178 | // Hook up interceptors middleware |
||
| 1179 | var chain = [dispatchRequest, undefined]; |
||
| 1180 | var promise = Promise.resolve(config); |
||
| 1181 | |||
| 1182 | this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { |
||
| 1183 | chain.unshift(interceptor.fulfilled, interceptor.rejected); |
||
| 1184 | }); |
||
| 1185 | |||
| 1186 | this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { |
||
| 1187 | chain.push(interceptor.fulfilled, interceptor.rejected); |
||
| 1188 | }); |
||
| 1189 | |||
| 1190 | while (chain.length) { |
||
| 1191 | promise = promise.then(chain.shift(), chain.shift()); |
||
| 1192 | } |
||
| 1193 | |||
| 1194 | return promise; |
||
| 1195 | }; |
||
| 1196 | |||
| 1197 | // Provide aliases for supported request methods |
||
| 1198 | utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { |
||
| 1199 | /*eslint func-names:0*/ |
||
| 1200 | Axios.prototype[method] = function(url, config) { |
||
| 1201 | return this.request(utils.merge(config || {}, { |
||
| 1202 | method: method, |
||
| 1203 | url: url |
||
| 1204 | })); |
||
| 1205 | }; |
||
| 1206 | }); |
||
| 1207 | |||
| 1208 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
||
| 1209 | /*eslint func-names:0*/ |
||
| 1210 | Axios.prototype[method] = function(url, data, config) { |
||
| 1211 | return this.request(utils.merge(config || {}, { |
||
| 1212 | method: method, |
||
| 1213 | url: url, |
||
| 1214 | data: data |
||
| 1215 | })); |
||
| 1216 | }; |
||
| 1217 | }); |
||
| 1218 | |||
| 1219 | module.exports = Axios; |
||
| 1220 | |||
| 1221 | |||
| 1222 | /***/ }), |
||
| 1223 | /* 18 */ |
||
| 1224 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1225 | |||
| 1226 | "use strict"; |
||
| 1227 | |||
| 1228 | |||
| 1229 | var utils = __webpack_require__(0); |
||
| 1230 | |||
| 1231 | function InterceptorManager() { |
||
| 1232 | this.handlers = []; |
||
| 1233 | } |
||
| 1234 | |||
| 1235 | /** |
||
| 1236 | * Add a new interceptor to the stack |
||
| 1237 | * |
||
| 1238 | * @param {Function} fulfilled The function to handle `then` for a `Promise` |
||
| 1239 | * @param {Function} rejected The function to handle `reject` for a `Promise` |
||
| 1240 | * |
||
| 1241 | * @return {Number} An ID used to remove interceptor later |
||
| 1242 | */ |
||
| 1243 | InterceptorManager.prototype.use = function use(fulfilled, rejected) { |
||
| 1244 | this.handlers.push({ |
||
| 1245 | fulfilled: fulfilled, |
||
| 1246 | rejected: rejected |
||
| 1247 | }); |
||
| 1248 | return this.handlers.length - 1; |
||
| 1249 | }; |
||
| 1250 | |||
| 1251 | /** |
||
| 1252 | * Remove an interceptor from the stack |
||
| 1253 | * |
||
| 1254 | * @param {Number} id The ID that was returned by `use` |
||
| 1255 | */ |
||
| 1256 | InterceptorManager.prototype.eject = function eject(id) { |
||
| 1257 | if (this.handlers[id]) { |
||
| 1258 | this.handlers[id] = null; |
||
| 1259 | } |
||
| 1260 | }; |
||
| 1261 | |||
| 1262 | /** |
||
| 1263 | * Iterate over all the registered interceptors |
||
| 1264 | * |
||
| 1265 | * This method is particularly useful for skipping over any |
||
| 1266 | * interceptors that may have become `null` calling `eject`. |
||
| 1267 | * |
||
| 1268 | * @param {Function} fn The function to call for each interceptor |
||
| 1269 | */ |
||
| 1270 | InterceptorManager.prototype.forEach = function forEach(fn) { |
||
| 1271 | utils.forEach(this.handlers, function forEachHandler(h) { |
||
| 1272 | if (h !== null) { |
||
| 1273 | fn(h); |
||
| 1274 | } |
||
| 1275 | }); |
||
| 1276 | }; |
||
| 1277 | |||
| 1278 | module.exports = InterceptorManager; |
||
| 1279 | |||
| 1280 | |||
| 1281 | /***/ }), |
||
| 1282 | /* 19 */ |
||
| 1283 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1284 | |||
| 1285 | "use strict"; |
||
| 1286 | |||
| 1287 | |||
| 1288 | var utils = __webpack_require__(0); |
||
| 1289 | var transformData = __webpack_require__(22); |
||
| 1290 | var isCancel = __webpack_require__(5); |
||
| 1291 | var defaults = __webpack_require__(2); |
||
| 1292 | var isAbsoluteURL = __webpack_require__(27); |
||
| 1293 | var combineURLs = __webpack_require__(25); |
||
| 1294 | |||
| 1295 | /** |
||
| 1296 | * Throws a `Cancel` if cancellation has been requested. |
||
| 1297 | */ |
||
| 1298 | function throwIfCancellationRequested(config) { |
||
| 1299 | if (config.cancelToken) { |
||
| 1300 | config.cancelToken.throwIfRequested(); |
||
| 1301 | } |
||
| 1302 | } |
||
| 1303 | |||
| 1304 | /** |
||
| 1305 | * Dispatch a request to the server using the configured adapter. |
||
| 1306 | * |
||
| 1307 | * @param {object} config The config that is to be used for the request |
||
| 1308 | * @returns {Promise} The Promise to be fulfilled |
||
| 1309 | */ |
||
| 1310 | module.exports = function dispatchRequest(config) { |
||
| 1311 | throwIfCancellationRequested(config); |
||
| 1312 | |||
| 1313 | // Support baseURL config |
||
| 1314 | if (config.baseURL && !isAbsoluteURL(config.url)) { |
||
| 1315 | config.url = combineURLs(config.baseURL, config.url); |
||
| 1316 | } |
||
| 1317 | |||
| 1318 | // Ensure headers exist |
||
| 1319 | config.headers = config.headers || {}; |
||
| 1320 | |||
| 1321 | // Transform request data |
||
| 1322 | config.data = transformData( |
||
| 1323 | config.data, |
||
| 1324 | config.headers, |
||
| 1325 | config.transformRequest |
||
| 1326 | ); |
||
| 1327 | |||
| 1328 | // Flatten headers |
||
| 1329 | config.headers = utils.merge( |
||
| 1330 | config.headers.common || {}, |
||
| 1331 | config.headers[config.method] || {}, |
||
| 1332 | config.headers || {} |
||
| 1333 | ); |
||
| 1334 | |||
| 1335 | utils.forEach( |
||
| 1336 | ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], |
||
| 1337 | function cleanHeaderConfig(method) { |
||
| 1338 | delete config.headers[method]; |
||
| 1339 | } |
||
| 1340 | ); |
||
| 1341 | |||
| 1342 | var adapter = config.adapter || defaults.adapter; |
||
| 1343 | |||
| 1344 | return adapter(config).then(function onAdapterResolution(response) { |
||
| 1345 | throwIfCancellationRequested(config); |
||
| 1346 | |||
| 1347 | // Transform response data |
||
| 1348 | response.data = transformData( |
||
| 1349 | response.data, |
||
| 1350 | response.headers, |
||
| 1351 | config.transformResponse |
||
| 1352 | ); |
||
| 1353 | |||
| 1354 | return response; |
||
| 1355 | }, function onAdapterRejection(reason) { |
||
| 1356 | if (!isCancel(reason)) { |
||
| 1357 | throwIfCancellationRequested(config); |
||
| 1358 | |||
| 1359 | // Transform response data |
||
| 1360 | if (reason && reason.response) { |
||
| 1361 | reason.response.data = transformData( |
||
| 1362 | reason.response.data, |
||
| 1363 | reason.response.headers, |
||
| 1364 | config.transformResponse |
||
| 1365 | ); |
||
| 1366 | } |
||
| 1367 | } |
||
| 1368 | |||
| 1369 | return Promise.reject(reason); |
||
| 1370 | }); |
||
| 1371 | }; |
||
| 1372 | |||
| 1373 | |||
| 1374 | /***/ }), |
||
| 1375 | /* 20 */ |
||
| 1376 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1377 | |||
| 1378 | "use strict"; |
||
| 1379 | |||
| 1380 | |||
| 1381 | /** |
||
| 1382 | * Update an Error with the specified config, error code, and response. |
||
| 1383 | * |
||
| 1384 | * @param {Error} error The error to update. |
||
| 1385 | * @param {Object} config The config. |
||
| 1386 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). |
||
| 1387 | * @param {Object} [request] The request. |
||
| 1388 | * @param {Object} [response] The response. |
||
| 1389 | * @returns {Error} The error. |
||
| 1390 | */ |
||
| 1391 | module.exports = function enhanceError(error, config, code, request, response) { |
||
| 1392 | error.config = config; |
||
| 1393 | if (code) { |
||
| 1394 | error.code = code; |
||
| 1395 | } |
||
| 1396 | error.request = request; |
||
| 1397 | error.response = response; |
||
| 1398 | return error; |
||
| 1399 | }; |
||
| 1400 | |||
| 1401 | |||
| 1402 | /***/ }), |
||
| 1403 | /* 21 */ |
||
| 1404 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1405 | |||
| 1406 | "use strict"; |
||
| 1407 | |||
| 1408 | |||
| 1409 | var createError = __webpack_require__(6); |
||
| 1410 | |||
| 1411 | /** |
||
| 1412 | * Resolve or reject a Promise based on response status. |
||
| 1413 | * |
||
| 1414 | * @param {Function} resolve A function that resolves the promise. |
||
| 1415 | * @param {Function} reject A function that rejects the promise. |
||
| 1416 | * @param {object} response The response. |
||
| 1417 | */ |
||
| 1418 | module.exports = function settle(resolve, reject, response) { |
||
| 1419 | var validateStatus = response.config.validateStatus; |
||
| 1420 | // Note: status is not exposed by XDomainRequest |
||
| 1421 | if (!response.status || !validateStatus || validateStatus(response.status)) { |
||
| 1422 | resolve(response); |
||
| 1423 | } else { |
||
| 1424 | reject(createError( |
||
| 1425 | 'Request failed with status code ' + response.status, |
||
| 1426 | response.config, |
||
| 1427 | null, |
||
| 1428 | response.request, |
||
| 1429 | response |
||
| 1430 | )); |
||
| 1431 | } |
||
| 1432 | }; |
||
| 1433 | |||
| 1434 | |||
| 1435 | /***/ }), |
||
| 1436 | /* 22 */ |
||
| 1437 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1438 | |||
| 1439 | "use strict"; |
||
| 1440 | |||
| 1441 | |||
| 1442 | var utils = __webpack_require__(0); |
||
| 1443 | |||
| 1444 | /** |
||
| 1445 | * Transform the data for a request or a response |
||
| 1446 | * |
||
| 1447 | * @param {Object|String} data The data to be transformed |
||
| 1448 | * @param {Array} headers The headers for the request or response |
||
| 1449 | * @param {Array|Function} fns A single function or Array of functions |
||
| 1450 | * @returns {*} The resulting transformed data |
||
| 1451 | */ |
||
| 1452 | module.exports = function transformData(data, headers, fns) { |
||
| 1453 | /*eslint no-param-reassign:0*/ |
||
| 1454 | utils.forEach(fns, function transform(fn) { |
||
| 1455 | data = fn(data, headers); |
||
| 1456 | }); |
||
| 1457 | |||
| 1458 | return data; |
||
| 1459 | }; |
||
| 1460 | |||
| 1461 | |||
| 1462 | /***/ }), |
||
| 1463 | /* 23 */ |
||
| 1464 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1465 | |||
| 1466 | "use strict"; |
||
| 1467 | |||
| 1468 | |||
| 1469 | // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js |
||
| 1470 | |||
| 1471 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; |
||
| 1472 | |||
| 1473 | function E() { |
||
| 1474 | this.message = 'String contains an invalid character'; |
||
| 1475 | } |
||
| 1476 | E.prototype = new Error; |
||
| 1477 | E.prototype.code = 5; |
||
| 1478 | E.prototype.name = 'InvalidCharacterError'; |
||
| 1479 | |||
| 1480 | function btoa(input) { |
||
| 1481 | var str = String(input); |
||
| 1482 | var output = ''; |
||
| 1483 | for ( |
||
| 1484 | // initialize result and counter |
||
| 1485 | var block, charCode, idx = 0, map = chars; |
||
| 1486 | // if the next str index does not exist: |
||
| 1487 | // change the mapping table to "=" |
||
| 1488 | // check if d has no fractional digits |
||
| 1489 | str.charAt(idx | 0) || (map = '=', idx % 1); |
||
| 1490 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 |
||
| 1491 | output += map.charAt(63 & block >> 8 - idx % 1 * 8) |
||
| 1492 | ) { |
||
| 1493 | charCode = str.charCodeAt(idx += 3 / 4); |
||
| 1494 | if (charCode > 0xFF) { |
||
| 1495 | throw new E(); |
||
| 1496 | } |
||
| 1497 | block = block << 8 | charCode; |
||
| 1498 | } |
||
| 1499 | return output; |
||
| 1500 | } |
||
| 1501 | |||
| 1502 | module.exports = btoa; |
||
| 1503 | |||
| 1504 | |||
| 1505 | /***/ }), |
||
| 1506 | /* 24 */ |
||
| 1507 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1508 | |||
| 1509 | "use strict"; |
||
| 1510 | |||
| 1511 | |||
| 1512 | var utils = __webpack_require__(0); |
||
| 1513 | |||
| 1514 | function encode(val) { |
||
| 1515 | return encodeURIComponent(val). |
||
| 1516 | replace(/%40/gi, '@'). |
||
| 1517 | replace(/%3A/gi, ':'). |
||
| 1518 | replace(/%24/g, '$'). |
||
| 1519 | replace(/%2C/gi, ','). |
||
| 1520 | replace(/%20/g, '+'). |
||
| 1521 | replace(/%5B/gi, '['). |
||
| 1522 | replace(/%5D/gi, ']'); |
||
| 1523 | } |
||
| 1524 | |||
| 1525 | /** |
||
| 1526 | * Build a URL by appending params to the end |
||
| 1527 | * |
||
| 1528 | * @param {string} url The base of the url (e.g., http://www.google.com) |
||
| 1529 | * @param {object} [params] The params to be appended |
||
| 1530 | * @returns {string} The formatted url |
||
| 1531 | */ |
||
| 1532 | module.exports = function buildURL(url, params, paramsSerializer) { |
||
| 1533 | /*eslint no-param-reassign:0*/ |
||
| 1534 | if (!params) { |
||
| 1535 | return url; |
||
| 1536 | } |
||
| 1537 | |||
| 1538 | var serializedParams; |
||
| 1539 | if (paramsSerializer) { |
||
| 1540 | serializedParams = paramsSerializer(params); |
||
| 1541 | } else if (utils.isURLSearchParams(params)) { |
||
| 1542 | serializedParams = params.toString(); |
||
| 1543 | } else { |
||
| 1544 | var parts = []; |
||
| 1545 | |||
| 1546 | utils.forEach(params, function serialize(val, key) { |
||
| 1547 | if (val === null || typeof val === 'undefined') { |
||
| 1548 | return; |
||
| 1549 | } |
||
| 1550 | |||
| 1551 | if (utils.isArray(val)) { |
||
| 1552 | key = key + '[]'; |
||
| 1553 | } |
||
| 1554 | |||
| 1555 | if (!utils.isArray(val)) { |
||
| 1556 | val = [val]; |
||
| 1557 | } |
||
| 1558 | |||
| 1559 | utils.forEach(val, function parseValue(v) { |
||
| 1560 | if (utils.isDate(v)) { |
||
| 1561 | v = v.toISOString(); |
||
| 1562 | } else if (utils.isObject(v)) { |
||
| 1563 | v = JSON.stringify(v); |
||
| 1564 | } |
||
| 1565 | parts.push(encode(key) + '=' + encode(v)); |
||
| 1566 | }); |
||
| 1567 | }); |
||
| 1568 | |||
| 1569 | serializedParams = parts.join('&'); |
||
| 1570 | } |
||
| 1571 | |||
| 1572 | if (serializedParams) { |
||
| 1573 | url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; |
||
| 1574 | } |
||
| 1575 | |||
| 1576 | return url; |
||
| 1577 | }; |
||
| 1578 | |||
| 1579 | |||
| 1580 | /***/ }), |
||
| 1581 | /* 25 */ |
||
| 1582 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1583 | |||
| 1584 | "use strict"; |
||
| 1585 | |||
| 1586 | |||
| 1587 | /** |
||
| 1588 | * Creates a new URL by combining the specified URLs |
||
| 1589 | * |
||
| 1590 | * @param {string} baseURL The base URL |
||
| 1591 | * @param {string} relativeURL The relative URL |
||
| 1592 | * @returns {string} The combined URL |
||
| 1593 | */ |
||
| 1594 | module.exports = function combineURLs(baseURL, relativeURL) { |
||
| 1595 | return relativeURL |
||
| 1596 | ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') |
||
| 1597 | : baseURL; |
||
| 1598 | }; |
||
| 1599 | |||
| 1600 | |||
| 1601 | /***/ }), |
||
| 1602 | /* 26 */ |
||
| 1603 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1604 | |||
| 1605 | "use strict"; |
||
| 1606 | |||
| 1607 | |||
| 1608 | var utils = __webpack_require__(0); |
||
| 1609 | |||
| 1610 | module.exports = ( |
||
| 1611 | utils.isStandardBrowserEnv() ? |
||
| 1612 | |||
| 1613 | // Standard browser envs support document.cookie |
||
| 1614 | (function standardBrowserEnv() { |
||
| 1615 | return { |
||
| 1616 | write: function write(name, value, expires, path, domain, secure) { |
||
| 1617 | var cookie = []; |
||
| 1618 | cookie.push(name + '=' + encodeURIComponent(value)); |
||
| 1619 | |||
| 1620 | if (utils.isNumber(expires)) { |
||
| 1621 | cookie.push('expires=' + new Date(expires).toGMTString()); |
||
| 1622 | } |
||
| 1623 | |||
| 1624 | if (utils.isString(path)) { |
||
| 1625 | cookie.push('path=' + path); |
||
| 1626 | } |
||
| 1627 | |||
| 1628 | if (utils.isString(domain)) { |
||
| 1629 | cookie.push('domain=' + domain); |
||
| 1630 | } |
||
| 1631 | |||
| 1632 | if (secure === true) { |
||
| 1633 | cookie.push('secure'); |
||
| 1634 | } |
||
| 1635 | |||
| 1636 | document.cookie = cookie.join('; '); |
||
| 1637 | }, |
||
| 1638 | |||
| 1639 | read: function read(name) { |
||
| 1640 | var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); |
||
| 1641 | return (match ? decodeURIComponent(match[3]) : null); |
||
| 1642 | }, |
||
| 1643 | |||
| 1644 | remove: function remove(name) { |
||
| 1645 | this.write(name, '', Date.now() - 86400000); |
||
| 1646 | } |
||
| 1647 | }; |
||
| 1648 | })() : |
||
| 1649 | |||
| 1650 | // Non standard browser env (web workers, react-native) lack needed support. |
||
| 1651 | (function nonStandardBrowserEnv() { |
||
| 1652 | return { |
||
| 1653 | write: function write() {}, |
||
| 1654 | read: function read() { return null; }, |
||
| 1655 | remove: function remove() {} |
||
| 1656 | }; |
||
| 1657 | })() |
||
| 1658 | ); |
||
| 1659 | |||
| 1660 | |||
| 1661 | /***/ }), |
||
| 1662 | /* 27 */ |
||
| 1663 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1664 | |||
| 1665 | "use strict"; |
||
| 1666 | |||
| 1667 | |||
| 1668 | /** |
||
| 1669 | * Determines whether the specified URL is absolute |
||
| 1670 | * |
||
| 1671 | * @param {string} url The URL to test |
||
| 1672 | * @returns {boolean} True if the specified URL is absolute, otherwise false |
||
| 1673 | */ |
||
| 1674 | module.exports = function isAbsoluteURL(url) { |
||
| 1675 | // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). |
||
| 1676 | // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed |
||
| 1677 | // by any combination of letters, digits, plus, period, or hyphen. |
||
| 1678 | return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); |
||
| 1679 | }; |
||
| 1680 | |||
| 1681 | |||
| 1682 | /***/ }), |
||
| 1683 | /* 28 */ |
||
| 1684 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1685 | |||
| 1686 | "use strict"; |
||
| 1687 | |||
| 1688 | |||
| 1689 | var utils = __webpack_require__(0); |
||
| 1690 | |||
| 1691 | module.exports = ( |
||
| 1692 | utils.isStandardBrowserEnv() ? |
||
| 1693 | |||
| 1694 | // Standard browser envs have full support of the APIs needed to test |
||
| 1695 | // whether the request URL is of the same origin as current location. |
||
| 1696 | (function standardBrowserEnv() { |
||
| 1697 | var msie = /(msie|trident)/i.test(navigator.userAgent); |
||
| 1698 | var urlParsingNode = document.createElement('a'); |
||
| 1699 | var originURL; |
||
| 1700 | |||
| 1701 | /** |
||
| 1702 | * Parse a URL to discover it's components |
||
| 1703 | * |
||
| 1704 | * @param {String} url The URL to be parsed |
||
| 1705 | * @returns {Object} |
||
| 1706 | */ |
||
| 1707 | function resolveURL(url) { |
||
| 1708 | var href = url; |
||
| 1709 | |||
| 1710 | if (msie) { |
||
| 1711 | // IE needs attribute set twice to normalize properties |
||
| 1712 | urlParsingNode.setAttribute('href', href); |
||
| 1713 | href = urlParsingNode.href; |
||
| 1714 | } |
||
| 1715 | |||
| 1716 | urlParsingNode.setAttribute('href', href); |
||
| 1717 | |||
| 1718 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils |
||
| 1719 | return { |
||
| 1720 | href: urlParsingNode.href, |
||
| 1721 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
||
| 1722 | host: urlParsingNode.host, |
||
| 1723 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
||
| 1724 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
||
| 1725 | hostname: urlParsingNode.hostname, |
||
| 1726 | port: urlParsingNode.port, |
||
| 1727 | pathname: (urlParsingNode.pathname.charAt(0) === '/') ? |
||
| 1728 | urlParsingNode.pathname : |
||
| 1729 | '/' + urlParsingNode.pathname |
||
| 1730 | }; |
||
| 1731 | } |
||
| 1732 | |||
| 1733 | originURL = resolveURL(window.location.href); |
||
| 1734 | |||
| 1735 | /** |
||
| 1736 | * Determine if a URL shares the same origin as the current location |
||
| 1737 | * |
||
| 1738 | * @param {String} requestURL The URL to test |
||
| 1739 | * @returns {boolean} True if URL shares the same origin, otherwise false |
||
| 1740 | */ |
||
| 1741 | return function isURLSameOrigin(requestURL) { |
||
| 1742 | var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; |
||
| 1743 | return (parsed.protocol === originURL.protocol && |
||
| 1744 | parsed.host === originURL.host); |
||
| 1745 | }; |
||
| 1746 | })() : |
||
| 1747 | |||
| 1748 | // Non standard browser envs (web workers, react-native) lack needed support. |
||
| 1749 | (function nonStandardBrowserEnv() { |
||
| 1750 | return function isURLSameOrigin() { |
||
| 1751 | return true; |
||
| 1752 | }; |
||
| 1753 | })() |
||
| 1754 | ); |
||
| 1755 | |||
| 1756 | |||
| 1757 | /***/ }), |
||
| 1758 | /* 29 */ |
||
| 1759 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1760 | |||
| 1761 | "use strict"; |
||
| 1762 | |||
| 1763 | |||
| 1764 | var utils = __webpack_require__(0); |
||
| 1765 | |||
| 1766 | module.exports = function normalizeHeaderName(headers, normalizedName) { |
||
| 1767 | utils.forEach(headers, function processHeader(value, name) { |
||
| 1768 | if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { |
||
| 1769 | headers[normalizedName] = value; |
||
| 1770 | delete headers[name]; |
||
| 1771 | } |
||
| 1772 | }); |
||
| 1773 | }; |
||
| 1774 | |||
| 1775 | |||
| 1776 | /***/ }), |
||
| 1777 | /* 30 */ |
||
| 1778 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1779 | |||
| 1780 | "use strict"; |
||
| 1781 | |||
| 1782 | |||
| 1783 | var utils = __webpack_require__(0); |
||
| 1784 | |||
| 1785 | // Headers whose duplicates are ignored by node |
||
| 1786 | // c.f. https://nodejs.org/api/http.html#http_message_headers |
||
| 1787 | var ignoreDuplicateOf = [ |
||
| 1788 | 'age', 'authorization', 'content-length', 'content-type', 'etag', |
||
| 1789 | 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', |
||
| 1790 | 'last-modified', 'location', 'max-forwards', 'proxy-authorization', |
||
| 1791 | 'referer', 'retry-after', 'user-agent' |
||
| 1792 | ]; |
||
| 1793 | |||
| 1794 | /** |
||
| 1795 | * Parse headers into an object |
||
| 1796 | * |
||
| 1797 | * ``` |
||
| 1798 | * Date: Wed, 27 Aug 2014 08:58:49 GMT |
||
| 1799 | * Content-Type: application/json |
||
| 1800 | * Connection: keep-alive |
||
| 1801 | * Transfer-Encoding: chunked |
||
| 1802 | * ``` |
||
| 1803 | * |
||
| 1804 | * @param {String} headers Headers needing to be parsed |
||
| 1805 | * @returns {Object} Headers parsed into an object |
||
| 1806 | */ |
||
| 1807 | module.exports = function parseHeaders(headers) { |
||
| 1808 | var parsed = {}; |
||
| 1809 | var key; |
||
| 1810 | var val; |
||
| 1811 | var i; |
||
| 1812 | |||
| 1813 | if (!headers) { return parsed; } |
||
| 1814 | |||
| 1815 | utils.forEach(headers.split('\n'), function parser(line) { |
||
| 1816 | i = line.indexOf(':'); |
||
| 1817 | key = utils.trim(line.substr(0, i)).toLowerCase(); |
||
| 1818 | val = utils.trim(line.substr(i + 1)); |
||
| 1819 | |||
| 1820 | if (key) { |
||
| 1821 | if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { |
||
| 1822 | return; |
||
| 1823 | } |
||
| 1824 | if (key === 'set-cookie') { |
||
| 1825 | parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); |
||
| 1826 | } else { |
||
| 1827 | parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; |
||
| 1828 | } |
||
| 1829 | } |
||
| 1830 | }); |
||
| 1831 | |||
| 1832 | return parsed; |
||
| 1833 | }; |
||
| 1834 | |||
| 1835 | |||
| 1836 | /***/ }), |
||
| 1837 | /* 31 */ |
||
| 1838 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1839 | |||
| 1840 | "use strict"; |
||
| 1841 | |||
| 1842 | |||
| 1843 | /** |
||
| 1844 | * Syntactic sugar for invoking a function and expanding an array for arguments. |
||
| 1845 | * |
||
| 1846 | * Common use case would be to use `Function.prototype.apply`. |
||
| 1847 | * |
||
| 1848 | * ```js |
||
| 1849 | * function f(x, y, z) {} |
||
| 1850 | * var args = [1, 2, 3]; |
||
| 1851 | * f.apply(null, args); |
||
| 1852 | * ``` |
||
| 1853 | * |
||
| 1854 | * With `spread` this example can be re-written. |
||
| 1855 | * |
||
| 1856 | * ```js |
||
| 1857 | * spread(function(x, y, z) {})([1, 2, 3]); |
||
| 1858 | * ``` |
||
| 1859 | * |
||
| 1860 | * @param {Function} callback |
||
| 1861 | * @returns {Function} |
||
| 1862 | */ |
||
| 1863 | module.exports = function spread(callback) { |
||
| 1864 | return function wrap(arr) { |
||
| 1865 | return callback.apply(null, arr); |
||
| 1866 | }; |
||
| 1867 | }; |
||
| 1868 | |||
| 1869 | |||
| 1870 | /***/ }), |
||
| 1871 | /* 32 */ |
||
| 1872 | /***/ (function(module, exports) { |
||
| 1873 | |||
| 1874 | /*! |
||
| 1875 | * Determine if an object is a Buffer |
||
| 1876 | * |
||
| 1877 | * @author Feross Aboukhadijeh <https://feross.org> |
||
| 1878 | * @license MIT |
||
| 1879 | */ |
||
| 1880 | |||
| 1881 | // The _isBuffer check is for Safari 5-7 support, because it's missing |
||
| 1882 | // Object.prototype.constructor. Remove this eventually |
||
| 1883 | module.exports = function (obj) { |
||
| 1884 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) |
||
| 1885 | } |
||
| 1886 | |||
| 1887 | function isBuffer (obj) { |
||
| 1888 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) |
||
| 1889 | } |
||
| 1890 | |||
| 1891 | // For Node v0.10 support. Remove this eventually. |
||
| 1892 | function isSlowBuffer (obj) { |
||
| 1893 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) |
||
| 1894 | } |
||
| 1895 | |||
| 1896 | |||
| 1897 | /***/ }), |
||
| 1898 | /* 33 */, |
||
| 1899 | /* 34 */, |
||
| 1900 | /* 35 */ |
||
| 1901 | /***/ (function(module, exports, __webpack_require__) { |
||
| 1902 | |||
| 1903 | __webpack_require__(11); |
||
| 1904 | module.exports = __webpack_require__(13); |
||
| 1905 | |||
| 1906 | |||
| 1907 | /***/ }) |
||
| 1908 | /******/ ]); |