Cloudflare - Version 3.0.0

Version Description

  • 2016-09-15 =

Added

  • Added one-click application oft WordPress specific recommended settings
  • Added ability to purge the CloudFlare cache
  • Integrated with WordPress cache management to automatically clear the CloudFlare cache on updating site appearance
  • Added ability to change CloudFlare settings (Always Online mode, Im Under Attack, Image Optimization, Security Level, Web Application Firewall)
  • Added Analytics showing Cached Requests, bandwidth used, unique visitors, threats blocked
  • Added Header rewrite to prevent a redirect loop when Cloudflares Universal SSL is enabled
  • Added HTTP/2 Server Push support
  • Added Support for PHP 5.3+

Removed

  • Removed HTTPS Protocol Rewriting
  • Removed submission of spam comments
  • Removed ability to toggle Development Mode On/Off

Changed

  • Updated user interface
  • Started to support WordPress 3.4+ instead of 2.8+ because we depend on the WordPress Options API
Download this release

Release Info

Developer furkan811
Plugin Icon 128x128 Cloudflare
Version 3.0.0
Comparing to
See all releases

Version 3.0.0

.editorconfig ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is for unifying the coding style for different editors and IDEs
2
+ # editorconfig.org
3
+
4
+ # WordPress Coding Standards
5
+ # https://make.wordpress.org/core/handbook/coding-standards/
6
+
7
+ root = true
8
+
9
+ [*]
10
+ charset = utf-8
11
+ end_of_line = lf
12
+ insert_final_newline = true
13
+ trim_trailing_whitespace = true
14
+ indent_style = tab
15
+
16
+ [{.jshintrc,*.json,*.yml}]
17
+ indent_style = space
18
+ indent_size = 2
19
+
20
+ [{*.txt,wp-config-sample.php}]
21
+ end_of_line = crlf
LICENSE.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2016, CloudFlare. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
assets/analytics-welcome.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 389 384" enable-background="new 0 0 389 384"><path fill="#3A82C2" d="M194.5 378.2C91.7 378.2 8.1 294.5 8.1 191.8 8.1 89 91.7 5.3 194.5 5.3c102.8 0 186.4 83.6 186.4 186.4 0 102.8-83.6 186.5-186.4 186.5zm0-369C93.8 9.2 11.9 91.1 11.9 191.8c0 100.7 81.9 182.6 182.6 182.6 100.7 0 182.6-81.9 182.6-182.6 0-100.7-81.9-182.6-182.6-182.6zM194.5 358.6c-92 0-166.8-74.8-166.8-166.8S102.5 24.9 194.5 24.9s166.8 74.8 166.8 166.8-74.8 166.9-166.8 166.9zm0-329.8c-89.9 0-163 73.1-163 163s73.1 163 163 163 163-73.1 163-163-73.1-163-163-163zM194.5 339c-81.2 0-147.2-66-147.2-147.2s66-147.2 147.2-147.2 147.2 66 147.2 147.2S275.7 339 194.5 339zm0-290.6c-79.1 0-143.4 64.3-143.4 143.4s64.3 143.4 143.4 143.4 143.4-64.3 143.4-143.4S273.6 48.4 194.5 48.4zM194.5 319.4c-70.4 0-127.6-57.2-127.6-127.6 0-70.4 57.2-127.6 127.6-127.6 70.4 0 127.6 57.2 127.6 127.6 0 70.3-57.2 127.6-127.6 127.6zm0-251.4c-68.2 0-123.8 55.5-123.8 123.8s55.5 123.8 123.8 123.8S318.3 260 318.3 191.8 262.7 68 194.5 68zM194.5 299.8c-59.6 0-108-48.5-108-108s48.5-108 108-108 108 48.5 108 108-48.4 108-108 108zm0-212.2c-57.4 0-104.2 46.7-104.2 104.2S137 296 194.5 296s104.2-46.7 104.2-104.2S251.9 87.6 194.5 87.6zM194.5 280.2c-48.7 0-88.4-39.7-88.4-88.4s39.7-88.4 88.4-88.4 88.4 39.7 88.4 88.4-39.7 88.4-88.4 88.4zm0-173c-46.6 0-84.5 37.9-84.5 84.5s37.9 84.5 84.5 84.5 84.5-37.9 84.5-84.5-37.9-84.5-84.5-84.5zM194.5 260.5c-37.9 0-68.8-30.9-68.8-68.8s30.9-68.8 68.8-68.8 68.8 30.9 68.8 68.8c0 38-30.9 68.8-68.8 68.8zm0-133.7c-35.8 0-64.9 29.1-64.9 64.9 0 35.8 29.1 64.9 64.9 64.9 35.8 0 64.9-29.1 64.9-64.9 0-35.8-29.1-64.9-64.9-64.9z"/><circle fill="#9BCA3E" cx="142.1" cy="258.3" r="11.6"/><path fill="#2F7BBF" d="M142.1 265c-3.3 0-6-3-6-6h2.8c0 2 1.5 3.2 3.2 3.2s3.2-1.2 3.2-3.2h2.8c0 3-2.7 6-6 6zM144.4 252.6h3.5v3.5h-3.5zM136.3 252.6h3.5v3.5h-3.5z"/><path fill="#63A1D7" d="M80.8 141.7c0 10.6-8 18.9-18.6 18.9-10.6 0-19.1-8.6-19.1-19.6H61v-18.3c10 0 19.8 8.4 19.8 19zM57 137v-19.8c-10 1.1-18.7 9.8-19.7 19.8H57z"/><circle fill="#204361" cx="194.5" cy="191.8" r="52.5"/><path fill="#ECECEC" d="M194.5 144.4c-26.1 0-47.3 21.2-47.3 47.3 0 13.3 5.5 25.3 14.3 33.9l66.9-66.9c-8.6-8.8-20.6-14.3-33.9-14.3z"/><path fill="#fff" d="M161.5 225.6c8.5 8.3 20.2 13.4 33 13.4 26.1 0 47.3-21.2 47.3-47.3 0-12.9-5.1-24.5-13.4-33l-66.9 66.9z"/><path fill="#204361" d="M194.3 160.2c-.8 0-1.4-.6-1.4-1.4V149c0-.8.6-1.4 1.4-1.4s1.4.6 1.4 1.4v9.8c0 .7-.6 1.4-1.4 1.4zM194.3 235.9c-.8 0-1.4-.6-1.4-1.4v-9.8c0-.8.6-1.4 1.4-1.4s1.4.6 1.4 1.4v9.8c0 .8-.6 1.4-1.4 1.4zM161 193.2h-9.8c-.8 0-1.4-.6-1.4-1.4s.6-1.4 1.4-1.4h9.8c.8 0 1.4.6 1.4 1.4s-.6 1.4-1.4 1.4zM236.8 193.2H227c-.8 0-1.4-.6-1.4-1.4s.6-1.4 1.4-1.4h9.8c.8 0 1.4.6 1.4 1.4s-.6 1.4-1.4 1.4z"/><path fill="#3A82C2" d="M215 212.4c-.3 0-.7-.1-.9-.3l-21.6-18.6 24.7-40.6c.4-.7 1.3-.9 2-.5s.9 1.3.5 2L196.2 193l19.7 17c.6.5.7 1.4.2 2-.3.2-.7.4-1.1.4z"/><path fill="#63A1D7" d="M243.5 272.1c-5.3 0-9.5 4.3-9.5 9.5 0 5.3 9.5 14.3 9.5 14.3s9.5-9.1 9.5-14.3c.1-5.2-4.2-9.5-9.5-9.5zm0 13.6c-2.3 0-4.1-1.8-4.1-4.1s1.8-4.1 4.1-4.1 4.1 1.8 4.1 4.1-1.8 4.1-4.1 4.1z"/><path fill="#F68B20" d="M81.7 255h-9.6l3.8-15.8-25 22.8h9.6l-3.8 15.8z"/><path fill="#9BCA3E" d="M251.6 112c-4.3-.1-7.6-3.7-7.5-7.9.1-4.3 3.7-7.6 7.9-7.5 4.3.1 7.6 3.7 7.5 7.9-.1 4.3-3.6 7.6-7.9 7.5zm-.6-4.6l4.8-4.5-1.5-1.6-3.2 3-1.5-1.6-1.6 1.5 3 3.2z"/><path fill="#63A1D7" d="M325.1 161.2h-17.5l-3.8 12.5v12.5h25v-12.5l-3.7-12.5zm1.3 22.5h-20v-7.5h20v7.5zm-2.5-2.5h-2.5v-2.5h2.5v2.5z"/></svg>
assets/details-arrows.png ADDED
Binary file
assets/hero-bg-clouds.png ADDED
Binary file
assets/icon-bolt.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#2F7BBF" d="M18 8h-5l2-8L2 12h5l-2 8z"/></svg>
assets/icon-lock.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#2F7BBF" d="M17 6V0H3v6H1v14h18V6h-2zm-3-3v3H6V3h8zm-2 13H8v-6h4v6z"/></svg>
assets/icon-pin.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#2F7BBF" d="M10 0C5.6 0 2.1 3.5 2.1 7.9S10 19.8 10 19.8s7.9-7.5 7.9-11.9S14.4 0 10 0zm0 11.3c-1.9 0-3.4-1.5-3.4-3.4S8.1 4.5 10 4.5s3.4 1.5 3.4 3.4-1.5 3.4-3.4 3.4z"/></svg>
assets/icon-shield.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#2F7BBF" d="M10 0H1v16l9 4 9-4V0h-9zm6 14l-6 2V3h6v11z"/></svg>
assets/icons-seee324dde5.png ADDED
Binary file
assets/icons_2x-s6333fe7591.png ADDED
Binary file
assets/layers-2x.png ADDED
Binary file
assets/layers.png ADDED
Binary file
assets/logo-reverse.svg ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1110.8 195.2" enable-background="new 0 0 1110.8 195.2" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <g>
8
+ <g>
9
+ <g>
10
+ <path fill="#FFFFFF" d="M958,84.5h-22.3l-21.9,39.6h-29.4V84.5h-15.2v47.4h56l5-9h34.1l5.2,9h15.4L958,84.5z M933.5,116
11
+ L947,91.4h0.2l13.6,24.6H933.5z"/>
12
+ <path fill="#FFFFFF" d="M1031.9,116.1c11.7-1.2,16.2-4.9,16.2-15.3c0-13.3-7-16.3-28.1-16.3h-35v47.4h15.2V92.2h19.8
13
+ c11.4-0.1,13,1.8,13,8.5c0,6.4-2,7.7-11.9,7.9H1004l27.5,23.1h19.2L1031.9,116.1z"/>
14
+ <path fill="#FFFFFF" d="M1070.4,104.1h37v7.5h-37v12.6h39.3v7.8h-54.5V84.5h54.2v7.8h-39V104.1z"/>
15
+ </g>
16
+ <g>
17
+ <path fill="#FFFFFF" d="M522.5,122.9h-28.8c-11.8,0-15.4-6.3-15.4-12.4V97.6c0-9.1,5-11.3,18.3-11.3h22.5v0h8.2v-8.9h-30.7
18
+ c-25.1,0-35.8,5.5-35.8,20.3v12.9c0,11.3,5.3,21.4,32.8,21.4h33.6v-8.9L522.5,122.9L522.5,122.9z"/>
19
+ </g>
20
+ <g>
21
+ <path fill="#FFFFFF" d="M548.3,124h36.9v7.8h-52.1V84.4h15.2V124z"/>
22
+ </g>
23
+ <g>
24
+ <path fill="#FFFFFF" d="M651.7,101.2V114c0,15.2-9.8,18.1-33.7,18.1c-24.5,0-33.4-2.5-33.4-18.1v-12.8
25
+ c0-14.7,8.3-17.3,33.4-17.3C640.7,83.9,651.7,86,651.7,101.2z M599.7,101.2V114c0,9.4,3.1,10.3,18.2,10.3
26
+ c13.8,0,18.5-1.1,18.5-10.3v-12.8c0.3-8.9-5.1-9.5-18.5-9.5C601.6,91.7,600.1,93.7,599.7,101.2z"/>
27
+ </g>
28
+ <g>
29
+ <path fill="#FFFFFF" d="M723,84.3V118c0,13.2-13.8,14.1-33,14.1c-18.5,0-32.8-0.8-32.8-14.1V84.3h15.2V118
30
+ c0,4.9,3,6.3,17.6,6.3c14,0,17.8-1.2,17.8-6.3V84.3H723z"/>
31
+ </g>
32
+ <g>
33
+ <path fill="#FFFFFF" d="M731.1,84.4h37.7c21.8,0,31.1,4.7,31.1,17.6v11.2c0,9.9-4.6,18.6-28.6,18.6h-40.3V84.4z M771.3,124
34
+ c10.2,0,13.4-5.5,13.4-10.8V102c0-7.9-4.3-9.9-15.9-9.9h-22.6V124H771.3z"/>
35
+ </g>
36
+ <g>
37
+ <path fill="#FFFFFF" d="M822.8,101.1h39.9v8.5h-39.9v22.2h-17.2V78h59.2v8.8h-42V101.1z"/>
38
+ </g>
39
+ </g>
40
+ </g>
41
+ </g>
42
+
43
+ <radialGradient id="SVGID_1_" cx="339.2699" cy="109.2709" r="80.8503" fx="337.2908" fy="113.4299" gradientUnits="userSpaceOnUse">
44
+ <stop offset="0" style="stop-color:#FFFFFF"/>
45
+ <stop offset="0.1902" style="stop-color:#FCE800"/>
46
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
47
+ </radialGradient>
48
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" points="332.6,57.5 342.2,23.9 343.6,24.1 344.6,59.3
49
+ 362.6,29.5 364.2,30.3 355.8,64.1 381.3,39.9 382.6,41.1 365.4,71.7 396.4,55.3 397.4,56.5 372.8,81.7 407,73.9 407.8,75.3
50
+ 377.4,93.1 412.6,94.4 412.6,95.9 378.6,105.3 412.4,115.3 412.4,116.7 377.2,117.3 407,135.9 406.2,137.5 372.3,128.9
51
+ 396.2,154.3 395.4,155.7 365,138.3 381.3,169.1 379.8,170.3 354.8,145.7 363,179.5 361.4,180.5 343.6,150.3 343.1,185.1
52
+ 341.2,185.5 331.6,151.9 321.6,185.5 319.8,185.1 319.8,150.3 318.8,149.9 299.4,179.1 307.8,145.3 282.2,169.3 280.8,168.1
53
+ 298.2,137.7 267,153.9 266,152.7 290.6,127.9 256.2,135.5 255.8,134.1 286.2,116.3 251.4,114.9 250.8,113.5 284.6,103.9
54
+ 251.2,94.1 251.4,92.5 286.4,91.9 256.8,73.9 257,72.3 291.3,80.9 267,55.3 268.2,53.9 299,70.7 282.2,40.3 283.2,39.1 309,63.7
55
+ 300.6,29.5 300.3,28.9 320.6,59.3 321,23.9 323,23.9 "/>
56
+ <g>
57
+ <path fill="#F68B1F" d="M427.5,170.7c0-33.6-27.2-60.8-60.8-60.8c-13.6,0-26.1,4.4-36.2,11.9c1.3-6.4,1.9-13,1.9-19.7
58
+ C332.5,46.3,287.2,1,231.3,1c-44.5,0-82.3,28.7-95.9,68.7c-7.6-5.7-17.1-9.1-27.3-9.1c-25.2,0-45.6,20.4-45.6,45.6
59
+ c0,3.9,0.5,7.7,1.4,11.3C29,118.5,1,147.1,1,182.2c0,4.1,0.4,8.1,1.1,12h420.7C425.9,187,427.5,179,427.5,170.7z"/>
60
+ </g>
61
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="231.347" y1="81.211" x2="231.347" y2="1.91">
62
+ <stop offset="0" style="stop-color:#F68B1F"/>
63
+ <stop offset="1" style="stop-color:#FFFFFF"/>
64
+ </linearGradient>
65
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_2_)" d="M320.7,102.3c0,49.3-40.1,80.5-89.4,80.5
66
+ c-49.3,0-89.2-31.2-89.2-80.5S182,13,231.3,13C280.7,13,320.7,53,320.7,102.3"/>
67
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M307,102.9c0,30.2-34.1,54.6-76.2,54.6
68
+ c-42.1,0-76.2-24.5-76.2-54.6c0-30.2,34.1-54.6,76.2-54.6C272.9,48.3,307,72.7,307,102.9"/>
69
+
70
+ <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="101.1775" y1="148.0421" x2="126.395" y2="173.2596" gradientTransform="matrix(0.9642 0.2653 -0.2653 0.9642 31.8692 -95.1941)">
71
+ <stop offset="0" style="stop-color:#FFFFFF"/>
72
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
73
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
74
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
75
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
76
+ <stop offset="0.7282" style="stop-color:#F69028"/>
77
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
78
+ </linearGradient>
79
+ <circle fill="url(#SVGID_3_)" cx="108.3" cy="106.4" r="33.7"/>
80
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M135.7,93.5c5.7,9.9-1.4,24.7-16,33.1c-14.5,8.4-31,7.2-36.7-2.7
81
+ c-5.7-9.9,1.4-24.7,16-33.1C113.6,82.4,130,83.6,135.7,93.5"/>
82
+ <g>
83
+ <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="5.8597" y1="82.1805" x2="101.2378" y2="229.0325">
84
+ <stop offset="0" style="stop-color:#FFFFFF"/>
85
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
86
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
87
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
88
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
89
+ <stop offset="0.7282" style="stop-color:#F69028"/>
90
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
91
+ </linearGradient>
92
+ <path fill="url(#SVGID_4_)" d="M118.9,182.1c0-29.4-23.8-53.2-53.2-53.2c-29.4,0-53.2,23.8-53.2,53.2c0,0.1,0,0.2,0,0.3h106.4
93
+ C118.9,182.3,118.9,182.2,118.9,182.1z"/>
94
+ </g>
95
+ <g>
96
+ <linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="384.5498" y1="119.1828" x2="369.9152" y2="162.0772">
97
+ <stop offset="0" style="stop-color:#FFFFFF"/>
98
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
99
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
100
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
101
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
102
+ <stop offset="0.7282" style="stop-color:#F69028"/>
103
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
104
+ </linearGradient>
105
+ <path fill="url(#SVGID_5_)" d="M415.8,170.2c0-26.8-21.7-48.5-48.5-48.5c-26.8,0-48.5,21.7-48.5,48.5c0,3.8,0.4,7.4,1.3,11h94.5
106
+ C415.3,177.7,415.8,174,415.8,170.2z"/>
107
+ </g>
108
+ <g>
109
+ <linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="215.2657" y1="138.7798" x2="215.2657" y2="185.6538">
110
+ <stop offset="0" style="stop-color:#F68B1F"/>
111
+ <stop offset="0.5308" style="stop-color:#CB672F"/>
112
+ <stop offset="1" style="stop-color:#A1453F"/>
113
+ </linearGradient>
114
+ <polygon fill="url(#SVGID_6_)" points="417.8,182.9 416,179.3 414,175.9 411.2,171.5 408.4,167.9 405,163.7 401.6,160.1
115
+ 397.6,156.3 393.8,153.1 389.6,150.1 385.4,147.5 380.8,144.9 376.8,142.9 372.8,141.3 369.2,140.3 365.6,139.5 362,138.9
116
+ 357.8,138.5 83,139.1 78.6,139.3 74.2,139.5 69.4,140.1 65.4,140.9 60.2,142.1 56.6,143.3 52.8,144.7 49,146.1 44.2,148.5
117
+ 40.6,150.3 36,153.3 31.8,156.5 27.4,160.1 23.6,163.9 20.6,167.5 17.4,171.7 15,175.9 13.2,179.5 12.2,182.9 11.6,185.8
118
+ 419,185.8 "/>
119
+ </g>
120
+
121
+ <radialGradient id="SVGID_7_" cx="271.3896" cy="133.3459" r="108.2159" fx="338.517" fy="113.7265" gradientUnits="userSpaceOnUse">
122
+ <stop offset="0" style="stop-color:#FFFFFF"/>
123
+ <stop offset="0.1334" style="stop-color:#FCE800"/>
124
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
125
+ </radialGradient>
126
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_7_)" points="338.6,113.9 375.4,162.1 374,163.1 331,124.5
127
+ 166,154.5 165.8,152.9 319.2,117.7 234.8,88.9 235.8,87.7 "/>
128
+ </g>
129
+ </svg>
assets/logo-symbol.svg ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 439.4 207.4" enable-background="new 0 0 439.4 207.4" xml:space="preserve">
5
+ <g>
6
+
7
+ <radialGradient id="SVGID_1_" cx="344.6563" cy="115.3711" r="80.8503" fx="342.6772" fy="119.5301" gradientUnits="userSpaceOnUse">
8
+ <stop offset="0" style="stop-color:#FFFFFF"/>
9
+ <stop offset="0.1902" style="stop-color:#FCE800"/>
10
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
11
+ </radialGradient>
12
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" points="338,63.6 347.6,30 349,30.2 350,65.4 368,35.6
13
+ 369.6,36.4 361.2,70.2 386.7,46 388,47.2 370.8,77.8 401.8,61.4 402.8,62.6 378.2,87.8 412.4,80 413.2,81.4 382.8,99.2 418,100.5
14
+ 418,102 384,111.4 417.8,121.4 417.8,122.8 382.6,123.4 412.4,142 411.6,143.6 377.7,135 401.6,160.4 400.8,161.8 370.4,144.4
15
+ 386.7,175.2 385.2,176.4 360.2,151.8 368.4,185.6 366.8,186.6 349,156.4 348.4,191.2 346.6,191.6 337,158 327,191.6 325.2,191.2
16
+ 325.2,156.4 324.2,156 304.8,185.2 313.2,151.4 287.6,175.4 286.2,174.2 303.6,143.8 272.4,160 271.4,158.8 296,134 261.6,141.6
17
+ 261.2,140.2 291.6,122.4 256.8,121 256.2,119.6 289.9,110 256.6,100.2 256.8,98.6 291.8,98 262.2,80 262.4,78.4 296.7,87
18
+ 272.4,61.4 273.6,60 304.4,76.8 287.6,46.4 288.6,45.2 314.4,69.8 306,35.6 305.7,35 325.9,65.4 326.4,30 328.4,30 "/>
19
+ <g>
20
+ <path fill="#F68B1F" d="M432.9,176.9c0-33.6-27.2-60.8-60.8-60.8c-13.6,0-26.1,4.4-36.2,11.9c1.3-6.4,1.9-13,1.9-19.7
21
+ c0-55.9-45.3-101.2-101.3-101.2c-44.5,0-82.3,28.7-95.9,68.7c-7.6-5.7-17.1-9.1-27.3-9.1c-25.2,0-45.6,20.4-45.6,45.6
22
+ c0,3.9,0.5,7.7,1.4,11.3c-34.9,1-62.9,29.6-62.9,64.8c0,4.1,0.4,8.1,1.1,12h420.7C431.3,193.1,432.9,185.1,432.9,176.9z"/>
23
+ </g>
24
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="236.7335" y1="87.3112" x2="236.7335" y2="8.0102">
25
+ <stop offset="0" style="stop-color:#F68B1F"/>
26
+ <stop offset="1" style="stop-color:#FFFFFF"/>
27
+ </linearGradient>
28
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_2_)" d="M326,108.4c0,49.3-40.1,80.5-89.4,80.5
29
+ c-49.3,0-89.2-31.2-89.2-80.5s40-89.3,89.3-89.3C286.1,19.1,326,59.1,326,108.4"/>
30
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M312.4,109c0,30.2-34.1,54.6-76.2,54.6
31
+ c-42.1,0-76.2-24.5-76.2-54.6c0-30.2,34.1-54.6,76.2-54.6C278.2,54.4,312.4,78.8,312.4,109"/>
32
+
33
+ <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="94.0415" y1="61.5134" x2="119.2589" y2="86.7309" gradientTransform="matrix(0.9642 0.2653 -0.2653 0.9642 21.1801 -3.7698)">
34
+ <stop offset="0" style="stop-color:#FFFFFF"/>
35
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
36
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
37
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
38
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
39
+ <stop offset="0.7282" style="stop-color:#F69028"/>
40
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
41
+ </linearGradient>
42
+ <circle fill="url(#SVGID_3_)" cx="113.7" cy="112.5" r="33.7"/>
43
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M141.1,99.6c5.7,9.9-1.4,24.7-16,33.1c-14.5,8.4-31,7.2-36.7-2.7
44
+ c-5.7-9.9,1.4-24.7,16-33.1C119,88.5,135.4,89.7,141.1,99.6"/>
45
+ <g>
46
+ <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="11.2461" y1="88.2807" x2="106.6242" y2="235.1327">
47
+ <stop offset="0" style="stop-color:#FFFFFF"/>
48
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
49
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
50
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
51
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
52
+ <stop offset="0.7282" style="stop-color:#F69028"/>
53
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
54
+ </linearGradient>
55
+ <path fill="url(#SVGID_4_)" d="M124.3,188.2c0-29.4-23.8-53.2-53.2-53.2c-29.4,0-53.2,23.8-53.2,53.2c0,0.1,0,0.2,0,0.3h106.4
56
+ C124.3,188.4,124.3,188.3,124.3,188.2z"/>
57
+ </g>
58
+ <g>
59
+ <linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="389.9363" y1="125.283" x2="375.3016" y2="168.1774">
60
+ <stop offset="0" style="stop-color:#FFFFFF"/>
61
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
62
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
63
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
64
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
65
+ <stop offset="0.7282" style="stop-color:#F69028"/>
66
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
67
+ </linearGradient>
68
+ <path fill="url(#SVGID_5_)" d="M421.2,176.3c0-26.8-21.7-48.5-48.5-48.5c-26.8,0-48.5,21.7-48.5,48.5c0,3.8,0.4,7.4,1.3,11h94.5
69
+ C420.7,183.8,421.2,180.1,421.2,176.3z"/>
70
+ </g>
71
+ <g>
72
+ <linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="220.6522" y1="144.88" x2="220.6522" y2="191.754">
73
+ <stop offset="0" style="stop-color:#F68B1F"/>
74
+ <stop offset="0.5308" style="stop-color:#CB672F"/>
75
+ <stop offset="1" style="stop-color:#A1453F"/>
76
+ </linearGradient>
77
+ <polygon fill="url(#SVGID_6_)" points="423.2,189 421.4,185.4 419.4,182 416.6,177.6 413.8,174 410.4,169.8 407,166.2 403,162.4
78
+ 399.2,159.2 395,156.2 390.8,153.6 386.2,151 382.2,149 378.2,147.4 374.6,146.4 371,145.6 367.4,145 363.2,144.6 88.4,145.2
79
+ 84,145.4 79.6,145.6 74.8,146.2 70.8,147 65.6,148.2 62,149.4 58.2,150.8 54.4,152.2 49.6,154.6 46,156.4 41.4,159.4 37.2,162.6
80
+ 32.8,166.2 29,170 26,173.6 22.8,177.8 20.4,182 18.6,185.6 17.6,189 16.9,191.9 424.4,191.9 "/>
81
+ </g>
82
+
83
+ <radialGradient id="SVGID_7_" cx="276.776" cy="139.4461" r="108.2159" fx="343.9035" fy="119.8267" gradientUnits="userSpaceOnUse">
84
+ <stop offset="0" style="stop-color:#FFFFFF"/>
85
+ <stop offset="0.1334" style="stop-color:#FCE800"/>
86
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
87
+ </radialGradient>
88
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_7_)" points="344,120 380.8,168.2 379.4,169.2 336.4,130.6
89
+ 171.4,160.6 171.2,159 324.6,123.8 240.2,95 241.2,93.8 "/>
90
+ </g>
91
+ </svg>
assets/logo.svg ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1110.8 195.2" enable-background="new 0 0 1110.8 195.2" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <g>
8
+ <g>
9
+ <g>
10
+ <path fill="#414042" d="M958,84.5h-22.3l-21.9,39.6h-29.4V84.5h-15.2v47.4h56l5-9h34.1l5.2,9h15.4L958,84.5z M933.5,116
11
+ L947,91.4h0.2l13.6,24.6H933.5z"/>
12
+ <path fill="#414042" d="M1031.9,116.1c11.7-1.2,16.2-4.9,16.2-15.3c0-13.3-7-16.3-28.1-16.3h-35v47.4h15.2V92.2h19.8
13
+ c11.4-0.1,13,1.8,13,8.5c0,6.4-2,7.7-11.9,7.9H1004l27.5,23.1h19.2L1031.9,116.1z"/>
14
+ <path fill="#414042" d="M1070.4,104.1h37v7.5h-37v12.6h39.3v7.8h-54.5V84.5h54.2v7.8h-39V104.1z"/>
15
+ </g>
16
+ <g>
17
+ <path fill="#414042" d="M522.5,122.9h-28.8c-11.8,0-15.4-6.3-15.4-12.4V97.6c0-9.1,5-11.3,18.3-11.3h22.5v0h8.2v-8.9h-30.7
18
+ c-25.1,0-35.8,5.5-35.8,20.3v12.9c0,11.3,5.3,21.4,32.8,21.4h33.6v-8.9L522.5,122.9L522.5,122.9z"/>
19
+ </g>
20
+ <g>
21
+ <path fill="#414042" d="M548.3,124h36.9v7.8h-52.1V84.4h15.2V124z"/>
22
+ </g>
23
+ <g>
24
+ <path fill="#414042" d="M651.7,101.2V114c0,15.2-9.8,18.1-33.7,18.1c-24.5,0-33.4-2.5-33.4-18.1v-12.8
25
+ c0-14.7,8.3-17.3,33.4-17.3C640.7,83.9,651.7,86,651.7,101.2z M599.7,101.2V114c0,9.4,3.1,10.3,18.2,10.3
26
+ c13.8,0,18.5-1.1,18.5-10.3v-12.8c0.3-8.9-5.1-9.5-18.5-9.5C601.6,91.7,600.1,93.7,599.7,101.2z"/>
27
+ </g>
28
+ <g>
29
+ <path fill="#414042" d="M723,84.3V118c0,13.2-13.8,14.1-33,14.1c-18.5,0-32.8-0.8-32.8-14.1V84.3h15.2V118
30
+ c0,4.9,3,6.3,17.6,6.3c14,0,17.8-1.2,17.8-6.3V84.3H723z"/>
31
+ </g>
32
+ <g>
33
+ <path fill="#414042" d="M731.1,84.4h37.7c21.8,0,31.1,4.7,31.1,17.6v11.2c0,9.9-4.6,18.6-28.6,18.6h-40.3V84.4z M771.3,124
34
+ c10.2,0,13.4-5.5,13.4-10.8V102c0-7.9-4.3-9.9-15.9-9.9h-22.6V124H771.3z"/>
35
+ </g>
36
+ <g>
37
+ <path fill="#414042" d="M822.8,101.1h39.9v8.5h-39.9v22.2h-17.2V78h59.2v8.8h-42V101.1z"/>
38
+ </g>
39
+ </g>
40
+ </g>
41
+ </g>
42
+
43
+ <radialGradient id="SVGID_1_" cx="339.2699" cy="109.2709" r="80.8503" fx="337.2908" fy="113.4299" gradientUnits="userSpaceOnUse">
44
+ <stop offset="0" style="stop-color:#FFFFFF"/>
45
+ <stop offset="0.1902" style="stop-color:#FCE800"/>
46
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
47
+ </radialGradient>
48
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" points="332.6,57.5 342.2,23.9 343.6,24.1 344.6,59.3
49
+ 362.6,29.5 364.2,30.3 355.8,64.1 381.3,39.9 382.6,41.1 365.4,71.7 396.4,55.3 397.4,56.5 372.8,81.7 407,73.9 407.8,75.3
50
+ 377.4,93.1 412.6,94.4 412.6,95.9 378.6,105.3 412.4,115.3 412.4,116.7 377.2,117.3 407,135.9 406.2,137.5 372.3,128.9
51
+ 396.2,154.3 395.4,155.7 365,138.3 381.3,169.1 379.8,170.3 354.8,145.7 363,179.5 361.4,180.5 343.6,150.3 343.1,185.1
52
+ 341.2,185.5 331.6,151.9 321.6,185.5 319.8,185.1 319.8,150.3 318.8,149.9 299.4,179.1 307.8,145.3 282.2,169.3 280.8,168.1
53
+ 298.2,137.7 267,153.9 266,152.7 290.6,127.9 256.2,135.5 255.8,134.1 286.2,116.3 251.4,114.9 250.8,113.5 284.6,103.9
54
+ 251.2,94.1 251.4,92.5 286.4,91.9 256.8,73.9 257,72.3 291.3,80.9 267,55.3 268.2,53.9 299,70.7 282.2,40.3 283.2,39.1 309,63.7
55
+ 300.6,29.5 300.3,28.9 320.6,59.3 321,23.9 323,23.9 "/>
56
+ <g>
57
+ <path fill="#F68B1F" d="M427.5,170.7c0-33.6-27.2-60.8-60.8-60.8c-13.6,0-26.1,4.4-36.2,11.9c1.3-6.4,1.9-13,1.9-19.7
58
+ C332.5,46.3,287.2,1,231.3,1c-44.5,0-82.3,28.7-95.9,68.7c-7.6-5.7-17.1-9.1-27.3-9.1c-25.2,0-45.6,20.4-45.6,45.6
59
+ c0,3.9,0.5,7.7,1.4,11.3C29,118.5,1,147.1,1,182.2c0,4.1,0.4,8.1,1.1,12h420.7C425.9,187,427.5,179,427.5,170.7z"/>
60
+ </g>
61
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="231.347" y1="81.211" x2="231.347" y2="1.91">
62
+ <stop offset="0" style="stop-color:#F68B1F"/>
63
+ <stop offset="1" style="stop-color:#FFFFFF"/>
64
+ </linearGradient>
65
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_2_)" d="M320.7,102.3c0,49.3-40.1,80.5-89.4,80.5
66
+ c-49.3,0-89.2-31.2-89.2-80.5S182,13,231.3,13C280.7,13,320.7,53,320.7,102.3"/>
67
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M307,102.9c0,30.2-34.1,54.6-76.2,54.6
68
+ c-42.1,0-76.2-24.5-76.2-54.6c0-30.2,34.1-54.6,76.2-54.6C272.9,48.3,307,72.7,307,102.9"/>
69
+
70
+ <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="101.1775" y1="148.0421" x2="126.395" y2="173.2596" gradientTransform="matrix(0.9642 0.2653 -0.2653 0.9642 31.8692 -95.1941)">
71
+ <stop offset="0" style="stop-color:#FFFFFF"/>
72
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
73
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
74
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
75
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
76
+ <stop offset="0.7282" style="stop-color:#F69028"/>
77
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
78
+ </linearGradient>
79
+ <circle fill="url(#SVGID_3_)" cx="108.3" cy="106.4" r="33.7"/>
80
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#F68B1F" d="M135.7,93.5c5.7,9.9-1.4,24.7-16,33.1c-14.5,8.4-31,7.2-36.7-2.7
81
+ c-5.7-9.9,1.4-24.7,16-33.1C113.6,82.4,130,83.6,135.7,93.5"/>
82
+ <g>
83
+ <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="5.8597" y1="82.1805" x2="101.2378" y2="229.0325">
84
+ <stop offset="0" style="stop-color:#FFFFFF"/>
85
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
86
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
87
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
88
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
89
+ <stop offset="0.7282" style="stop-color:#F69028"/>
90
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
91
+ </linearGradient>
92
+ <path fill="url(#SVGID_4_)" d="M118.9,182.1c0-29.4-23.8-53.2-53.2-53.2c-29.4,0-53.2,23.8-53.2,53.2c0,0.1,0,0.2,0,0.3h106.4
93
+ C118.9,182.3,118.9,182.2,118.9,182.1z"/>
94
+ </g>
95
+ <g>
96
+ <linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="384.5498" y1="119.1828" x2="369.9152" y2="162.0772">
97
+ <stop offset="0" style="stop-color:#FFFFFF"/>
98
+ <stop offset="4.820809e-02" style="stop-color:#FEF6ED"/>
99
+ <stop offset="0.2569" style="stop-color:#FBD0A5"/>
100
+ <stop offset="0.4442" style="stop-color:#F9B26B"/>
101
+ <stop offset="0.6034" style="stop-color:#F79D42"/>
102
+ <stop offset="0.7282" style="stop-color:#F69028"/>
103
+ <stop offset="0.8033" style="stop-color:#F68B1F"/>
104
+ </linearGradient>
105
+ <path fill="url(#SVGID_5_)" d="M415.8,170.2c0-26.8-21.7-48.5-48.5-48.5c-26.8,0-48.5,21.7-48.5,48.5c0,3.8,0.4,7.4,1.3,11h94.5
106
+ C415.3,177.7,415.8,174,415.8,170.2z"/>
107
+ </g>
108
+ <g>
109
+ <linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="215.2657" y1="138.7798" x2="215.2657" y2="185.6538">
110
+ <stop offset="0" style="stop-color:#F68B1F"/>
111
+ <stop offset="0.5308" style="stop-color:#CB672F"/>
112
+ <stop offset="1" style="stop-color:#A1453F"/>
113
+ </linearGradient>
114
+ <polygon fill="url(#SVGID_6_)" points="417.8,182.9 416,179.3 414,175.9 411.2,171.5 408.4,167.9 405,163.7 401.6,160.1
115
+ 397.6,156.3 393.8,153.1 389.6,150.1 385.4,147.5 380.8,144.9 376.8,142.9 372.8,141.3 369.2,140.3 365.6,139.5 362,138.9
116
+ 357.8,138.5 83,139.1 78.6,139.3 74.2,139.5 69.4,140.1 65.4,140.9 60.2,142.1 56.6,143.3 52.8,144.7 49,146.1 44.2,148.5
117
+ 40.6,150.3 36,153.3 31.8,156.5 27.4,160.1 23.6,163.9 20.6,167.5 17.4,171.7 15,175.9 13.2,179.5 12.2,182.9 11.6,185.8
118
+ 419,185.8 "/>
119
+ </g>
120
+
121
+ <radialGradient id="SVGID_7_" cx="271.3896" cy="133.3459" r="108.2159" fx="338.517" fy="113.7265" gradientUnits="userSpaceOnUse">
122
+ <stop offset="0" style="stop-color:#FFFFFF"/>
123
+ <stop offset="0.1334" style="stop-color:#FCE800"/>
124
+ <stop offset="0.8593" style="stop-color:#EC8F27"/>
125
+ </radialGradient>
126
+ <polygon fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_7_)" points="338.6,113.9 375.4,162.1 374,163.1 331,124.5
127
+ 166,154.5 165.8,152.9 319.2,117.7 234.8,88.9 235.8,87.7 "/>
128
+ </g>
129
+ </svg>
assets/modal-two-factor-auth.png ADDED
Binary file
assets/modal-two-factor-auth_2x.png ADDED
Binary file
assets/overview-welcome-yjs.svg ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="373px" height="374px" viewBox="0 0 373 374" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <!-- Generator: Sketch 3.3.3 (12072) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Artwork</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="YJS-CHina" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
8
+ <g id="overview-yjs-banner" sketch:type="MSArtboardGroup" transform="translate(-610.000000, -152.000000)">
9
+ <g id="banner" sketch:type="MSLayerGroup" transform="translate(31.000000, 151.000000)">
10
+ <g id="Example-module-Copy-2" transform="translate(0.000000, 0.500000)" sketch:type="MSShapeGroup">
11
+ <g id="Artwork" transform="translate(579.000000, 0.000000)">
12
+ <g id="Imported-Layers" transform="translate(0.000000, 0.900391)">
13
+ <path d="M186.5,373.177 C83.704,373.177 0.073,289.546 0.073,186.75 C0.073,83.954 83.704,0.323 186.5,0.323 C289.296,0.323 372.927,83.954 372.927,186.75 C372.927,289.546 289.296,373.177 186.5,373.177 L186.5,373.177 Z M186.5,4.177 C85.829,4.177 3.927,86.079 3.927,186.75 C3.927,287.421 85.829,369.323 186.5,369.323 C287.171,369.323 369.073,287.421 369.073,186.75 C369.073,86.079 287.171,4.177 186.5,4.177 L186.5,4.177 Z" id="Fill-2" fill="#3982C2"></path>
14
+ <path d="M186.5,353.572 C94.514,353.572 19.678,278.736 19.678,186.75 C19.678,94.764 94.514,19.928 186.5,19.928 C278.486,19.928 353.322,94.764 353.322,186.75 C353.322,278.736 278.486,353.572 186.5,353.572 L186.5,353.572 Z M186.5,23.781 C96.639,23.781 23.531,96.889 23.531,186.75 C23.531,276.611 96.639,349.719 186.5,349.719 C276.361,349.719 349.469,276.611 349.469,186.75 C349.469,96.889 276.361,23.781 186.5,23.781 L186.5,23.781 Z" id="Fill-3" fill="#3982C2"></path>
15
+ <path d="M186.5,333.968 C105.324,333.968 39.283,267.926 39.283,186.75 C39.283,105.574 105.324,39.533 186.5,39.533 C267.676,39.533 333.718,105.574 333.718,186.75 C333.718,267.926 267.676,333.968 186.5,333.968 L186.5,333.968 Z M186.5,43.386 C107.449,43.386 43.136,107.699 43.136,186.75 C43.136,265.801 107.449,330.114 186.5,330.114 C265.551,330.114 329.864,265.801 329.864,186.75 C329.864,107.699 265.551,43.386 186.5,43.386 L186.5,43.386 Z" id="Fill-4" fill="#3982C2"></path>
16
+ <path d="M186.5,314.362 C116.134,314.362 58.887,257.115 58.887,186.75 C58.887,116.384 116.134,59.137 186.5,59.137 C256.865,59.137 314.112,116.384 314.112,186.75 C314.112,257.115 256.865,314.362 186.5,314.362 L186.5,314.362 Z M186.5,62.991 C118.259,62.991 62.741,118.509 62.741,186.75 C62.741,254.991 118.259,310.509 186.5,310.509 C254.741,310.509 310.259,254.991 310.259,186.75 C310.259,118.509 254.741,62.991 186.5,62.991 L186.5,62.991 Z" id="Fill-5" fill="#3982C2"></path>
17
+ <path d="M186.5,294.758 C126.944,294.758 78.492,246.306 78.492,186.75 C78.492,127.194 126.944,78.742 186.5,78.742 C246.056,78.742 294.508,127.194 294.508,186.75 C294.508,246.306 246.056,294.758 186.5,294.758 L186.5,294.758 Z M186.5,82.596 C129.069,82.596 82.346,129.319 82.346,186.75 C82.346,244.181 129.069,290.904 186.5,290.904 C243.931,290.904 290.654,244.181 290.654,186.75 C290.654,129.319 243.931,82.596 186.5,82.596 L186.5,82.596 Z" id="Fill-6" fill="#3982C2"></path>
18
+ <path d="M186.5,275.153 C137.754,275.153 98.097,235.496 98.097,186.75 C98.097,138.004 137.754,98.347 186.5,98.347 C235.246,98.347 274.903,138.004 274.903,186.75 C274.903,235.496 235.246,275.153 186.5,275.153 L186.5,275.153 Z M186.5,102.2 C139.879,102.2 101.95,140.129 101.95,186.75 C101.95,233.371 139.879,271.3 186.5,271.3 C233.121,271.3 271.05,233.371 271.05,186.75 C271.05,140.129 233.121,102.2 186.5,102.2 L186.5,102.2 Z" id="Fill-7" fill="#3982C2"></path>
19
+ <path d="M186.5,255.549 C148.564,255.549 117.701,224.685 117.701,186.75 C117.701,148.814 148.564,117.951 186.5,117.951 C224.435,117.951 255.299,148.814 255.299,186.75 C255.299,224.685 224.435,255.549 186.5,255.549 L186.5,255.549 Z M186.5,121.805 C150.689,121.805 121.555,150.939 121.555,186.75 C121.555,222.56 150.689,251.695 186.5,251.695 C222.31,251.695 251.445,222.56 251.445,186.75 C251.445,150.939 222.31,121.805 186.5,121.805 L186.5,121.805 Z" id="Fill-8" fill="#3982C2"></path>
20
+ <path d="M235.529,237.133 C230.267,237.133 226,241.399 226,246.662 C226,251.925 235.529,261 235.529,261 C235.529,261 245.059,251.925 245.059,246.662 C245.059,241.399 240.792,237.133 235.529,237.133 L235.529,237.133 Z M235.529,250.746 C233.274,250.746 231.445,248.918 231.445,246.662 C231.445,244.406 233.274,242.578 235.529,242.578 C237.785,242.578 239.613,244.406 239.613,246.662 C239.613,248.918 237.785,250.746 235.529,250.746 L235.529,250.746 Z" id="Fill-9" fill="#63A1D7"></path>
21
+ </g>
22
+ <path d="M208.9525,181.994667 L192.093,181.994667 L198.8375,154.5 L155,194.199795 L171.8595,194.199795 L165.11675,221.694462 L208.9525,181.994667" id="Imported-Layers" fill="#F78B20"></path>
23
+ <g id="Imported-Layers" transform="translate(259.000000, 141.500000)">
24
+ <path d="M0,10 C0,15.523 4.477,20 10,20 C15.523,20 20,15.523 20,10 C20,4.477 15.523,0 10,0 C4.477,0 0,4.477 0,10" id="Fill-1" fill="#9BCA3E"></path>
25
+ <path d="M6,10.5 C6,12.709 7.791,14.5 10,14.5 C12.209,14.5 14,12.709 14,10.5" id="Stroke-2" stroke="#2F7BBF" stroke-width="2.4"></path>
26
+ <path d="M5,5 L8,5 L8,8 L5,8 L5,5 Z" id="Fill-3" fill="#2F7BBF"></path>
27
+ <path d="M12,5 L15,5 L15,8 L12,8 L12,5 Z" id="Fill-4" fill="#2F7BBF"></path>
28
+ </g>
29
+ <path d="M86.529,154.5 C81.267,154.5 77,158.766 77,164.029 C77,169.292 86.529,178.367 86.529,178.367 C86.529,178.367 96.059,169.292 96.059,164.029 C96.059,158.766 91.792,154.5 86.529,154.5 L86.529,154.5 Z M86.529,168.113 C84.274,168.113 82.445,166.285 82.445,164.029 C82.445,161.773 84.274,159.945 86.529,159.945 C88.785,159.945 90.613,161.773 90.613,164.029 C90.613,166.285 88.785,168.113 86.529,168.113 L86.529,168.113 Z" id="Imported-Layers" fill="#63A1D7"></path>
30
+ <path d="M310.292,219.5 L292.758,219.5 L289,232.024 L289,244.549 L314.05,244.549 L314.05,232.024 L310.292,219.5 L310.292,219.5 Z M291.505,234.529 L311.545,234.529 L311.545,242.044 L291.505,242.044 L291.505,234.529 Z M306.535,237.034 L309.04,237.034 L309.04,239.539 L306.535,239.539 L306.535,237.034 Z" id="Imported-Layers" fill="#63A1D7"></path>
31
+ </g>
32
+ </g>
33
+ </g>
34
+ </g>
35
+ </g>
36
+ </svg>
assets/overview-welcome.svg ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 462 387" enable-background="new 0 0 462 387" xml:space="preserve">
6
+ <g>
7
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,385C374.1,385,460,299.1,460,193.5
8
+ S374.1,2,268.5,2S77,87.9,77,193.5S162.9,385,268.5,385z"/>
9
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,364.7c94.4,0,171.2-76.8,171.2-171.2
10
+ S362.9,22.3,268.5,22.3S97.3,99.1,97.3,193.5S174.1,364.7,268.5,364.7z"/>
11
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,344.3c83.2,0,150.8-67.6,150.8-150.8
12
+ S351.7,42.7,268.5,42.7s-150.8,67.6-150.8,150.8S185.3,344.3,268.5,344.3z"/>
13
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,324c72,0,130.5-58.5,130.5-130.5
14
+ S340.5,63,268.5,63S138,121.5,138,193.5S196.5,324,268.5,324z"/>
15
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,303.6c60.8,0,110.1-49.4,110.1-110.1
16
+ S329.3,83.4,268.5,83.4s-110.1,49.4-110.1,110.1S207.7,303.6,268.5,303.6z"/>
17
+ <path fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" d="M268.5,283.3c49.5,0,89.8-40.2,89.8-89.8
18
+ s-40.2-89.8-89.8-89.8s-89.8,40.2-89.8,89.8S219,283.3,268.5,283.3z"/>
19
+ <circle fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10" cx="268.5" cy="193.5" r="69.4"/>
20
+ </g>
21
+ <path id="firewall_2_" fill="#63A1D7" d="M229,278.5v17.8l10.5,4.6l10.5-4.6v-17.8h-11.4H229z M233,282.5h6v13.8l-6-2.3V282.5z"/>
22
+ <g>
23
+ <polygon fill="#63A1D7" points="51,261.5 38.4,261.5 27,269.3 27,259.3 27,254.3 27,237.5 51,237.5 "/>
24
+ <polygon fill="#63A1D7" points="21,237.5 21,261.5 10.9,261.5 0,269.3 0,259.3 0,254.3 0,237.5 "/>
25
+ </g>
26
+ <g>
27
+ <polygon fill="#FFFFFF" points="338,249.5 345.3,249.5 351,254.7 351,249.1 351,246.3 351,236.5 338,236.5 "/>
28
+ <polygon fill="#FFFFFF" points="354,236.5 354,249.5 360.6,249.5 366,254.7 366,249.1 366,246.3 366,236.5 "/>
29
+ </g>
30
+ <path fill="#F68B20" d="M126.1,208.8c0-4.3-3.5-7.7-7.7-7.7c-1.1,0-2.1,0.2-3.1,0.6c-0.2-8.6-7.3-15.5-15.9-15.5
31
+ c-7,0-12.9,4.5-15.1,10.8c-1.2-0.9-2.7-1.4-4.3-1.4c-4,0-7.2,3.2-7.2,7.2c0,0.6,0.1,1.2,0.2,1.8c0,0,0,0,0,0c-0.5,0-0.9,0.1-1.4,0.1
32
+ c-2.7,0.6-4.7,3-4.7,5.9c0,3.3,2.7,6,6,6c-0.2,0,45.9,0,45.9,0C122.9,216.2,126.1,212.9,126.1,208.8z"/>
33
+ <g>
34
+ <circle fill="#9BCA3E" cx="147.6" cy="148.8" r="9.5"/>
35
+ <path fill="none" stroke="#2F7BBF" stroke-width="2.28" stroke-miterlimit="10" d="M151.4,149.3c0,2.1-1.7,3.8-3.8,3.8
36
+ s-3.8-1.7-3.8-3.8v0"/>
37
+ <rect x="149.5" y="144.1" fill="#2F7BBF" width="2.8" height="2.8"/>
38
+ <rect x="142.8" y="144.1" fill="#2F7BBF" width="2.8" height="2.8"/>
39
+ </g>
40
+ <path id="Domains" fill="#FFFFFF" d="M134,255.5v46h46v-46H134z M145,259.5h5v5h-5V259.5z M138,259.5h5v5h-5V259.5z M176,297.5h-38
41
+ v-28h38V297.5z M154,292.5h-11v-18h11V292.5z M171,278.5h-11v-4h11V278.5z M171,285.5h-11v-4h11V285.5z M171,292.5h-11v-5h11V292.5z
42
+ "/>
43
+ <g>
44
+
45
+ <line fill="none" stroke="#FFFFFF" stroke-width="5.3428" stroke-linecap="round" stroke-miterlimit="10" x1="203.3" y1="140.2" x2="198.8" y2="132.9"/>
46
+
47
+ <line fill="none" stroke="#FFFFFF" stroke-width="5.3428" stroke-linecap="round" stroke-miterlimit="10" x1="185.1" y1="172.2" x2="176.8" y2="170.2"/>
48
+
49
+ <line fill="none" stroke="#FFFFFF" stroke-width="5.3428" stroke-linecap="round" stroke-miterlimit="10" x1="187.2" y1="209.9" x2="179.9" y2="214.5"/>
50
+ <g>
51
+ <circle fill="#FFFFFF" cx="313.6" cy="203" r="12.9"/>
52
+ <circle fill="#FFFFFF" cx="220.1" cy="180.8" r="7.4"/>
53
+ <polygon fill="#63A1D7" points="282.8,198.9 285.2,189.4 284.9,189.4 287.1,180.7 225.7,147 219.3,174.8 216.5,186.9 210,215
54
+ 280.4,210.5 282.5,201.4 282.4,201.4 "/>
55
+
56
+ <rect x="273.9" y="180.4" transform="matrix(0.9744 0.2248 -0.2248 0.9744 52.1496 -61.3494)" fill="#143959" width="43.2" height="35.8"/>
57
+
58
+ <rect x="273.7" y="215.7" transform="matrix(0.9744 0.2248 -0.2248 0.9744 56.5985 -59.7748)" fill="#63A1D7" width="34.1" height="5.9"/>
59
+ <polygon fill="#143959" points="277.8,251.6 291.2,221.7 306.5,225.3 293.1,255.1 "/>
60
+ </g>
61
+ </g>
62
+ </svg>
assets/plan-changed-success.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 645 645"><g fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10"><path d="M319.8 526.2c113.5 0 205.9-92.3 205.9-205.9s-92.3-205.9-205.9-205.9S114 206.8 114 320.4s92.3 205.8 205.8 205.8z"/><path d="M319.8 504.4c101.5 0 184-82.6 184-184s-82.6-184-184-184-184 82.6-184 184 82.5 184 184 184z"/><path d="M319.8 482.5c89.4 0 162.1-72.7 162.1-162.1s-72.7-162.1-162.1-162.1S157.7 231 157.7 320.4s72.7 162.1 162.1 162.1z"/><path d="M319.8 460.6c77.4 0 140.3-62.9 140.3-140.3S397.2 180 319.8 180s-140.3 63-140.3 140.4 62.9 140.2 140.3 140.2z"/><path d="M319.8 438.7c65.4 0 118.4-53.1 118.4-118.4S385.1 202 319.8 202s-118.4 53-118.4 118.4 53.1 118.3 118.4 118.3z"/><path d="M319.8 416.9c53.2 0 96.5-43.2 96.5-96.5s-43.2-96.5-96.5-96.5-96.5 43.2-96.5 96.5 43.3 96.5 96.5 96.5z"/><circle cx="319.8" cy="320.4" r="74.6"/></g><path fill="#FFF" d="M378.4 437.5v13.2l7.5 3.3 7.5-3.3v-13.2h-15zm3.2 3.3h4.3v10l-4.3-1.6v-8.4z"/><path fill="#143959" d="M225.9 251.3h191v142.4h-191z"/><circle fill="#FFF" cx="233.6" cy="261.1" r="2.5"/><circle fill="#FFF" cx="243.3" cy="261.1" r="2.5"/><circle fill="#FFF" cx="253.1" cy="261.1" r="2.5"/><path fill="#FFF" d="M231 268.8h180.4v119.9H231z"/><path fill="#EBEBEB" d="M231 288.9h180.4v42.9H231z"/><path fill="#7E7E7E" d="M280.9 297.8H362v5.6h-81.1z"/><path fill="#C9C9C9" d="M240.8 339.4h29.6V369h-29.6zm43.3 0h29.6V369h-29.6zm43.5 0h29.6V369h-29.6zm43.4 0h29.6V369H371z"/><path fill="#7E7E7E" d="M264.8 311.9h113.4v2.8H264.8z"/><path fill="#C9C9C9" d="M240.8 376.6h29.6v2.8h-29.6zm0 6.1h29.6v2.8h-29.6zm43.3-6.1h29.6v2.8h-29.6zm0 6.1h29.6v2.8h-29.6zm43.5-6.1h29.6v2.8h-29.6zm0 6.1h29.6v2.8h-29.6zm43.4-6.1h29.6v2.8H371zm0 6.1h29.6v2.8H371zm16.1-105.2h18.1v2.8h-18.1zm-24.8 0h18.1v2.8h-18.1zm-24 0h18.1v2.8h-18.1z"/><path fill="#7E7E7E" d="M264.8 319.9h113.4v2.8H264.8z"/><circle fill="#C9C9C9" cx="248.4" cy="278.9" r="4.8"/><path fill="#FFF" d="M332.1 159.7v-3.9H323v3.9h-1.3v9.1h11.7v-9.1h-1.3zm-2-1.9v1.9h-5.3v-1.9h5.3zm-1.3 8.4h-2.6v-3.9h2.6v3.9z"/><path fill="#F68B20" d="M191.2 388.1h-16.9l4.8-19.4-36.2 29.1h16.8l-4.8 19.3"/><g fill="#63A1D7"><path d="M260.3 181.6h-22.1l-4.7 15.8v15.8h31.7v-15.8l-4.9-15.8zm1.6 28.5h-25.4v-9.5h25.4v9.5z"/><path d="M255.5 203.8h3.1v3.1h-3.1z"/></g><path fill="#9BCA3E" d="M167.7 273.1v-7.5h-7.5v-6.5h7.5v-7.5h6.4v7.5h7.5v6.5h-7.5v7.5h-6.4zM329 495.6v-7.5h-7.5v-6.4h7.5v-7.5h6.5v7.5h7.5v6.4h-7.5v7.5H329zm130-84.9V401h-9.7v-8.6h9.7v-10.8h8.6v10.8h10.8v8.6h-10.8v9.7H459zm-68.8-212.9V186h-11.8v-10.8h11.8v-12.9H401v12.9h12.9V186H401v11.8h-10.8zM109.7 359.1v-11.8H97.8v-10.8h11.8v-12.9h10.8v12.9h12.9v10.8h-12.9v11.8h-10.7zm121.4 78.4v-4.3h-4.3v-4.3h4.3v-5.4h4.3v5.4h5.4v4.3h-5.4v4.3h-4.3zm-24.7-99.9v-4.3h-4.3V329h4.3v-5.4h4.3v5.4h5.4v4.3h-5.4v4.3h-4.3zm275.2-16.2v-4.3h-4.3v-4.3h4.3v-5.4h4.3v5.4h5.4v4.3h-5.4v4.3h-4.3zM310.7 205.3V201h-4.3v-4.3h4.3v-5.4h4.3v5.4h5.4v4.3H315v4.3h-4.3zM186 151.6v-4.3h-4.3V143h4.3v-5.4h4.3v5.4h5.4v4.3h-5.4v4.3H186zm346.1 75.2v-4.3h-4.3v-4.3h4.3v-5.4h4.3v5.4h5.4v4.3h-5.4v4.3h-4.3z"/><path fill="#63A1D7" d="M505.3 237.6v15.1h-17.2v-15.1h6.5v-4.3H473v4.3h6.4v15.1h-17.2v-15.1h6.4V229h12.9v-4.3H475v-15h17.2v15h-6.5v4.3h12.9v8.6h6.7z"/></svg>
assets/request-submitted-success.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 645 645"><g fill="none" stroke="#3A82C2" stroke-width="4" stroke-miterlimit="10"><path d="M403.4 502.6c113.5 0 205.9-92.3 205.9-205.9S517 90.8 403.4 90.8s-205.9 92.3-205.9 205.9 92.4 205.9 205.9 205.9z"/><path d="M403.4 480.7c101.5 0 184-82.6 184-184s-82.6-184-184-184-183.9 82.6-183.9 184 82.5 184 183.9 184z"/><path d="M403.4 458.8c89.4 0 162.1-72.7 162.1-162.1s-72.7-162.1-162.1-162.1-162.1 72.7-162.1 162.1S314 458.8 403.4 458.8z"/><path d="M403.4 437c77.4 0 140.3-62.9 140.3-140.3s-62.9-140.3-140.3-140.3-140.2 62.9-140.2 140.3S326.2 437 403.4 437z"/><path d="M403.4 415.1c65.4 0 118.4-53.1 118.4-118.4s-53.1-118.4-118.4-118.4S285 231.3 285 296.7s53.2 118.4 118.4 118.4z"/><path d="M403.4 393.2c53.2 0 96.5-43.2 96.5-96.5s-43.2-96.5-96.5-96.5-96.5 43.2-96.5 96.5 43.3 96.5 96.5 96.5z"/><circle cx="403.4" cy="296.7" r="74.6"/></g><path fill="#FFF" d="M383.6 237.6h-84.9v67.7h17.2v17l21.2-17h46.5v-67.7z"/><path fill="#2F7BBF" d="M320.1 275.2H362v8.6h-41.9zm0-16.1H362v8.6h-41.9z"/><path fill="#63A1D7" d="M377.1 387h31.5l13.7 11.8V387h11.8v-45.2h-57V387z"/><path fill="#2F7BBF" d="M391.1 367.7h29v5.4h-29zm0-10.8h29v5.4h-29z"/><path fill="#F68B20" d="M254.1 289.2h-15.2L245 264l-39.7 35.9h15.3l-6.1 25.2"/><circle fill="#9BCA3E" cx="584.3" cy="359.3" r="13.3"/><path fill="none" stroke="#2F7BBF" stroke-width="2.981" stroke-miterlimit="10" d="M578.9 359.9c0 2.9 2.4 5.4 5.4 5.4 2.9 0 5.4-2.4 5.4-5.4"/><path fill="#2F7BBF" d="M577.6 352.6h4v4h-4zm9.4 0h4v4h-4z"/><path fill="#63A1D7" d="M518.8 244.5V300c-8.2 8.6-19.8 14.1-32.7 14.1-24.3 0-44.1-19.2-44.9-43.3v-54.2l77.6 27.9z"/><path fill="#2F7BBF" d="M480.1 255.3l-8.9 18.3h8.9"/><path fill="none" stroke="#143959" stroke-width="2" stroke-miterlimit="10" d="M469.7 238s-9.1-6.2-18.3 0"/><path fill="#FFF" d="M492.5 285.1c0 5.9-6 10.8-13.4 10.8s-13.4-4.8-13.4-10.8"/><path d="M488.8 258c0-4.5 3.7-8.2 8.1-8.2 4.4 0 8.1 3.9 8.1 8.2h3.2m-4.2-4.1l3.9-1m-38.2 5.1c0-4.5-3.7-8.2-8.2-8.2-4.4 0-8.2 3.9-8.2 8.2h-3.2m4.4-4.1l-4-1" fill="none" stroke="#143959" stroke-width="2" stroke-miterlimit="10"/><circle fill="#2F7BBF" cx="489.2" cy="269.4" r="1.3"/><circle fill="#2F7BBF" cx="496.5" cy="265.7" r="1.3"/><circle fill="#2F7BBF" cx="504" cy="269.4" r="1.3"/><circle fill="#2F7BBF" cx="453.7" cy="269.4" r="1.3"/><circle fill="#2F7BBF" cx="461" cy="265.7" r="1.3"/><circle fill="#2F7BBF" cx="468.4" cy="269.4" r="1.3"/><path fill="#143959" d="M430.6 237.6c0-30.7 24.9-55.7 55.7-55.7s55.7 24.9 55.7 55.7v84.9h-23v-74L441.4 221v49.5c.4 11.3 4.9 21.6 12.3 29.2v22.7h-22.6l-.3-83c-.2-.6-.2-1.2-.2-1.8z"/><path fill="#63A1D7" d="M541.6 258.2c0 5.9-4.8 10.8-10.8 10.8v-21.5c5.9 0 10.8 4.8 10.8 10.7z"/><path fill="#FFF" d="M148.7 261.2h-7.6v-7.5h-6.4v7.5h-7.5v6.5h7.5v7.5h6.4v-7.5h7.6"/><g fill="#9BCA3E"><circle cx="173.1" cy="359.3" r="10.8"/><circle cx="130.1" cy="359.3" r="10.8"/><circle cx="87.1" cy="359.3" r="10.8"/></g></svg>
assets/select2-cf-white.png ADDED
Binary file
assets/select2-cf.png ADDED
Binary file
assets/select2x2-cf-white.png ADDED
Binary file
assets/select2x2-cf.png ADDED
Binary file
assets/spinner.gif ADDED
Binary file
assets/throbber.gif ADDED
Binary file
assets/vertical-range.png ADDED
Binary file
assets/yjs-background.jpg ADDED
Binary file
assets/yjs-background_2x.jpg ADDED
Binary file
assets/yjs-logo.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1076 384"><style>.st0{fill:#8CC32B;} .st1{fill:#666666;} .st2{fill:#999999;} .st3{fill:none;stroke:#999999;stroke-miterlimit:10;} .st4{fill:#2276BD;} .st5{clip-path:url(#SVGID_2_);fill:url(#SVGID_3_);} .st6{clip-path:url(#SVGID_5_);fill:url(#SVGID_6_);}</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33.1-12.4c-.2-3.2-4.6-6.8-10.7-6.8-8.1 0-12 5.7-12 11.7 0 4.1 2.9 11.2 12 11.2 5.1 0 9.9-2.4 11.1-7.7h2.3c-1.3 6.6-7 9.6-13.3 9.6-8.3 0-14.3-5.3-14.3-13.2 0-8.9 6.5-13.7 14.3-13.7 7.7 0 12.8 4.5 13 8.8h-2.4zm19.4-8.8c9 0 14.3 6.4 14.3 13.4 0 7.2-5.2 13.4-14.3 13.4-9 0-14.3-6.3-14.3-13.4.1-7 5.3-13.4 14.3-13.4m0 24.9c8.1 0 12-5.7 12-11.5 0-5.7-4-11.5-12-11.5s-12 5.7-12 11.5 4 11.5 12 11.5m18.4-24.1h2.3v4.3h.1c2-3.3 5.7-5.1 9.7-5.1 6.2 0 8.7 2.7 9.7 5.9 1.8-3.9 5.1-5.9 9.8-5.9 7.3 0 10.5 3.2 10.5 8.9v17.2h-2.3v-16.4c0-4.2-2.3-7.7-8.2-7.7-6.2 0-9.4 3.2-9.4 8.6v15.6h-2.3v-16.9c0-4.5-2.3-7.3-8.2-7.3-5.5 0-9.4 3.3-9.4 9v15.1h-2.3v-25.3z"/><path class="st3" d="M606.9 274.9h-86.6m529.1 0h-86.6"/><path class="st0" d="M324 79.3c-81.2 83.1-127.2 114.4-127.2 114.4h87.8L324 79.3z"/><path class="st4" d="M122.1 95.5c4.9-1.9 12.5-4.7 23.6-6.5 6.2-1 12.5-1.5 18.9-1.5 2.8 0 5.5.1 8.2.3 5.5-4.2 11.5-7.6 17.9-10.3 5.9-2.5 12.2-4.3 18.7-5.3 4.2-.7 8.4-1 12.8-1 19.2 0 36.9 6.7 50.8 17.8 1.5 1.2 3 2.5 4.5 3.9l25.2-22.5c-20.8-20.3-49.2-32.8-80.5-32.8-29.1 0-55.6 10.8-75.8 28.5-4.4 3.9-8.6 8.1-12.4 12.6-4.4 5.1-8.4 10.8-11.9 16.8M368 87.7c-9.2 0-18.1 1.1-26.6 3.1L329 131.3c1.9-1.1 3.9-2 6-2.9 1.8-.8 3.7-1.5 5.6-2.2 8.6-3.1 17.8-4.8 27.4-4.8 45.1 0 81.7 36.6 81.7 81.7 0 43.8-34.4 79.5-77.7 81.6h-96.1c-5.3 7.2-11.3 13.9-17.9 20-5.5 5.1-11.5 9.2-17.8 13.3H379c58.6-5.5 104.4-54.8 104.4-114.8 0-63.8-51.6-115.5-115.4-115.5"/><defs><path id="SVGID_4_" d="M57.4 160.2c-.1.1-.1.3-.2.5-.2.6-.5 1.3-.7 1.9-.1.2-.2.5-.3.7-.2.6-.4 1.2-.6 1.7-.2.7-.5 1.4-.7 2.1-.1.2-.1.4-.2.5-.2.6-.4 1.3-.6 1.9v.1C51 180 49.4 191 49.4 202.4c0 63.7 51.7 115.3 115.4 115.3 30.1 0 57.4-11.5 77.9-30.3 11.9-11 21.5-24.4 28-39.5H233c-14.7 22-39.7 36.5-68.1 36.5-45.2 0-81.8-36.6-81.8-81.8v-2.3c1.1-44.1 37.2-79.6 81.7-79.6 10.6 0 20.7 2 30 5.7 7.5-9.6 16.6-17.8 27-24.3-14.6-8.1-31.2-13.3-48.8-14.6-2.7-.2-5.5-.3-8.2-.3-48.8 0-90.5 30.3-107.4 73"/></defs><clipPath id="SVGID_2_"><use xlink:href="#SVGID_4_" overflow="visible"/></clipPath><linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-419" y1="1052.999" x2="-418" y2="1052.999" gradientTransform="matrix(0 230.6822 230.6822 0 -242748.188 96743.055)"><stop offset="0" stop-color="#2276BD"/><stop offset=".202" stop-color="#2276BD"/><stop offset=".622" stop-color="#7EB853"/><stop offset=".818" stop-color="#8CC32C"/><stop offset="1" stop-color="#8CC32C"/></linearGradient><path class="st5" d="M49.3 87.2h221.3v230.7H49.3z"/><path class="st0" d="M239.6 232.1h36c1.6-5 4.9-15.3 5.7-20.6H247c-1.3 5.4-5.1 15.7-7.4 20.6"/></svg>
cloudflare.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: CloudFlare
4
+ Plugin URI: http://www.cloudflare.com/wiki/CloudFlareWordPressPlugin
5
+ Description: CloudFlare integrates your blog with the CloudFlare platform.
6
+ Version: 3.0.0
7
+ Author: Ian Pye, Jerome Chen, James Greene, Simon Moore, David Fritsch, John Wineman (CloudFlare Team)
8
+ License: GPLv2
9
+ */
10
+
11
+ require_once 'vendor/autoload.php';
12
+
13
+ const CF_MIN_PHP_VERSION = '5.3';
14
+ const CF_MIN_WP_VERSION = '3.4';
15
+
16
+ if (!defined('ABSPATH')) { // Exit if accessed directly
17
+ exit;
18
+ }
19
+
20
+ // Load Init Script
21
+ add_action('init', array('\CF\Hooks\Init', 'init'), 1);
22
+
23
+ // Load Activation Script
24
+ register_activation_hook(__FILE__, array('\CF\Hooks\Activation', 'init'));
25
+
26
+ // Load Deactivation Script
27
+ register_deactivation_hook(__FILE__, array('\CF\Hooks\Deactivation', 'init'));
28
+
29
+ // Load Uninstall Script
30
+ register_uninstall_hook(__FILE__, array('\CF\Hooks\Uninstall', 'init'));
31
+
32
+ //Register proxy AJAX endpoint
33
+ add_action('wp_ajax_cloudflare_proxy', array('\CF\Hooks\Init', 'initProxy'));
34
+
35
+ // Load AutomaticCache
36
+ add_action('init', array('\CF\Hooks\AutomaticCache', 'init'));
37
+
38
+ // Enable HTTP2 Server Push
39
+ add_action('init', array('\CF\Hooks\HTTP2ServerPush', 'init'));
compiled.js ADDED
@@ -0,0 +1,85036 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () { var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
2
+
3
+ },{}],2:[function(_dereq_,module,exports){
4
+ // shim for using process in browser
5
+ var process = module.exports = {};
6
+
7
+ // cached from whatever global is present so that test runners that stub it
8
+ // don't break things. But we need to wrap it in a try catch in case it is
9
+ // wrapped in strict mode code which doesn't define any globals. It's inside a
10
+ // function because try/catches deoptimize in certain engines.
11
+
12
+ var cachedSetTimeout;
13
+ var cachedClearTimeout;
14
+
15
+ function defaultSetTimout() {
16
+ throw new Error('setTimeout has not been defined');
17
+ }
18
+ function defaultClearTimeout () {
19
+ throw new Error('clearTimeout has not been defined');
20
+ }
21
+ (function () {
22
+ try {
23
+ if (typeof setTimeout === 'function') {
24
+ cachedSetTimeout = setTimeout;
25
+ } else {
26
+ cachedSetTimeout = defaultSetTimout;
27
+ }
28
+ } catch (e) {
29
+ cachedSetTimeout = defaultSetTimout;
30
+ }
31
+ try {
32
+ if (typeof clearTimeout === 'function') {
33
+ cachedClearTimeout = clearTimeout;
34
+ } else {
35
+ cachedClearTimeout = defaultClearTimeout;
36
+ }
37
+ } catch (e) {
38
+ cachedClearTimeout = defaultClearTimeout;
39
+ }
40
+ } ())
41
+ function runTimeout(fun) {
42
+ if (cachedSetTimeout === setTimeout) {
43
+ //normal enviroments in sane situations
44
+ return setTimeout(fun, 0);
45
+ }
46
+ // if setTimeout wasn't available but was latter defined
47
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
48
+ cachedSetTimeout = setTimeout;
49
+ return setTimeout(fun, 0);
50
+ }
51
+ try {
52
+ // when when somebody has screwed with setTimeout but no I.E. maddness
53
+ return cachedSetTimeout(fun, 0);
54
+ } catch(e){
55
+ try {
56
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
57
+ return cachedSetTimeout.call(null, fun, 0);
58
+ } catch(e){
59
+ // 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
60
+ return cachedSetTimeout.call(this, fun, 0);
61
+ }
62
+ }
63
+
64
+
65
+ }
66
+ function runClearTimeout(marker) {
67
+ if (cachedClearTimeout === clearTimeout) {
68
+ //normal enviroments in sane situations
69
+ return clearTimeout(marker);
70
+ }
71
+ // if clearTimeout wasn't available but was latter defined
72
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
73
+ cachedClearTimeout = clearTimeout;
74
+ return clearTimeout(marker);
75
+ }
76
+ try {
77
+ // when when somebody has screwed with setTimeout but no I.E. maddness
78
+ return cachedClearTimeout(marker);
79
+ } catch (e){
80
+ try {
81
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
82
+ return cachedClearTimeout.call(null, marker);
83
+ } catch (e){
84
+ // 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.
85
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
86
+ return cachedClearTimeout.call(this, marker);
87
+ }
88
+ }
89
+
90
+
91
+
92
+ }
93
+ var queue = [];
94
+ var draining = false;
95
+ var currentQueue;
96
+ var queueIndex = -1;
97
+
98
+ function cleanUpNextTick() {
99
+ if (!draining || !currentQueue) {
100
+ return;
101
+ }
102
+ draining = false;
103
+ if (currentQueue.length) {
104
+ queue = currentQueue.concat(queue);
105
+ } else {
106
+ queueIndex = -1;
107
+ }
108
+ if (queue.length) {
109
+ drainQueue();
110
+ }
111
+ }
112
+
113
+ function drainQueue() {
114
+ if (draining) {
115
+ return;
116
+ }
117
+ var timeout = runTimeout(cleanUpNextTick);
118
+ draining = true;
119
+
120
+ var len = queue.length;
121
+ while(len) {
122
+ currentQueue = queue;
123
+ queue = [];
124
+ while (++queueIndex < len) {
125
+ if (currentQueue) {
126
+ currentQueue[queueIndex].run();
127
+ }
128
+ }
129
+ queueIndex = -1;
130
+ len = queue.length;
131
+ }
132
+ currentQueue = null;
133
+ draining = false;
134
+ runClearTimeout(timeout);
135
+ }
136
+
137
+ process.nextTick = function (fun) {
138
+ var args = new Array(arguments.length - 1);
139
+ if (arguments.length > 1) {
140
+ for (var i = 1; i < arguments.length; i++) {
141
+ args[i - 1] = arguments[i];
142
+ }
143
+ }
144
+ queue.push(new Item(fun, args));
145
+ if (queue.length === 1 && !draining) {
146
+ runTimeout(drainQueue);
147
+ }
148
+ };
149
+
150
+ // v8 likes predictible objects
151
+ function Item(fun, array) {
152
+ this.fun = fun;
153
+ this.array = array;
154
+ }
155
+ Item.prototype.run = function () {
156
+ this.fun.apply(null, this.array);
157
+ };
158
+ process.title = 'browser';
159
+ process.browser = true;
160
+ process.env = {};
161
+ process.argv = [];
162
+ process.version = ''; // empty string to avoid regexp issues
163
+ process.versions = {};
164
+
165
+ function noop() {}
166
+
167
+ process.on = noop;
168
+ process.addListener = noop;
169
+ process.once = noop;
170
+ process.off = noop;
171
+ process.removeListener = noop;
172
+ process.removeAllListeners = noop;
173
+ process.emit = noop;
174
+
175
+ process.binding = function (name) {
176
+ throw new Error('process.binding is not supported');
177
+ };
178
+
179
+ process.cwd = function () { return '/' };
180
+ process.chdir = function (dir) {
181
+ throw new Error('process.chdir is not supported');
182
+ };
183
+ process.umask = function() { return 0; };
184
+
185
+ },{}],3:[function(_dereq_,module,exports){
186
+ 'use strict';
187
+
188
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
189
+
190
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
191
+
192
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
193
+
194
+ var React = _dereq_('react');
195
+ var PropTypes = React.PropTypes;
196
+
197
+ var Button = function (_React$Component) {
198
+ _inherits(Button, _React$Component);
199
+
200
+ function Button() {
201
+ _classCallCheck(this, Button);
202
+
203
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
204
+ }
205
+
206
+ Button.prototype.render = function render() {
207
+ var _props = this.props;
208
+ var disabled = _props.disabled;
209
+ var loading = _props.loading;
210
+
211
+ var type = this.props.submit ? 'submit' : 'button';
212
+ var className = 'cf-btn cf-btn--' + this.props.type;
213
+
214
+ if (loading) {
215
+ className += ' cf-btn--loading';
216
+ }
217
+
218
+ // Unless the disabled state is explicitly set, the button is disabled when loading.
219
+ var isDisabled = (disabled !== undefined ? disabled : loading) || false;
220
+
221
+ return React.createElement(
222
+ 'button',
223
+ {
224
+ type: type,
225
+ className: className,
226
+ disabled: isDisabled,
227
+ onClick: this.props.onClick },
228
+ this.props.children
229
+ );
230
+ };
231
+
232
+ return Button;
233
+ }(React.Component);
234
+
235
+ Button.propTypes = {
236
+ onClick: PropTypes.func.isRequired,
237
+ submit: PropTypes.bool,
238
+ type: PropTypes.oneOf(['default', 'primary', 'success', 'warning', 'danger']).isRequired,
239
+ disabled: PropTypes.bool,
240
+ loading: PropTypes.bool
241
+ };
242
+ Button.defaultProps = {
243
+ type: 'default',
244
+ submit: false
245
+ };
246
+ ;
247
+
248
+ module.exports = Button;
249
+ },{"react":511}],4:[function(_dereq_,module,exports){
250
+ 'use strict';
251
+
252
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
253
+
254
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
255
+
256
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
257
+
258
+ var React = _dereq_('react');
259
+
260
+ var ButtonGroup = function (_React$Component) {
261
+ _inherits(ButtonGroup, _React$Component);
262
+
263
+ function ButtonGroup() {
264
+ _classCallCheck(this, ButtonGroup);
265
+
266
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
267
+ }
268
+
269
+ ButtonGroup.prototype.render = function render() {
270
+ return React.createElement(
271
+ 'div',
272
+ { className: 'cf-btn__group' },
273
+ this.props.children
274
+ );
275
+ };
276
+
277
+ return ButtonGroup;
278
+ }(React.Component);
279
+
280
+ ;
281
+
282
+ module.exports = ButtonGroup;
283
+ },{"react":511}],5:[function(_dereq_,module,exports){
284
+ 'use strict';
285
+
286
+ exports.Button = _dereq_('./Button');
287
+ exports.ButtonGroup = _dereq_('./ButtonGroup');
288
+ },{"./Button":3,"./ButtonGroup":4}],6:[function(_dereq_,module,exports){
289
+ "use strict";
290
+
291
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
292
+
293
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
294
+
295
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
296
+
297
+ var React = _dereq_('react');
298
+
299
+ var Card = function (_React$Component) {
300
+ _inherits(Card, _React$Component);
301
+
302
+ function Card() {
303
+ _classCallCheck(this, Card);
304
+
305
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
306
+ }
307
+
308
+ Card.prototype.render = function render() {
309
+ return React.createElement(
310
+ "section",
311
+ { className: "cf-card" },
312
+ this.props.children
313
+ );
314
+ };
315
+
316
+ return Card;
317
+ }(React.Component);
318
+
319
+ module.exports = Card;
320
+ },{"react":511}],7:[function(_dereq_,module,exports){
321
+ "use strict";
322
+
323
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
324
+
325
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
326
+
327
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
328
+
329
+ var React = _dereq_('react');
330
+ var PropTypes = React.PropTypes;
331
+
332
+ var CardContent = function (_React$Component) {
333
+ _inherits(CardContent, _React$Component);
334
+
335
+ function CardContent() {
336
+ _classCallCheck(this, CardContent);
337
+
338
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
339
+ }
340
+
341
+ CardContent.prototype.render = function render() {
342
+ return React.createElement(
343
+ "div",
344
+ { className: "cf-card__content" },
345
+ React.createElement(
346
+ "h3",
347
+ { className: "cf-card__title" },
348
+ this.props.title
349
+ ),
350
+ this.props.children,
351
+ this.props.footerMessage ? React.createElement(
352
+ "div",
353
+ { className: "cf-card__footer_message" },
354
+ this.props.footerMessage
355
+ ) : null
356
+ );
357
+ };
358
+
359
+ return CardContent;
360
+ }(React.Component);
361
+
362
+ CardContent.propTypes = {
363
+ title: PropTypes.any.isRequired,
364
+ footerMessage: PropTypes.string
365
+ };
366
+
367
+
368
+ module.exports = CardContent;
369
+ },{"react":511}],8:[function(_dereq_,module,exports){
370
+ "use strict";
371
+
372
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
373
+
374
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
375
+
376
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
377
+
378
+ var React = _dereq_('react');
379
+
380
+ var CardControl = function (_React$Component) {
381
+ _inherits(CardControl, _React$Component);
382
+
383
+ function CardControl() {
384
+ _classCallCheck(this, CardControl);
385
+
386
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
387
+ }
388
+
389
+ CardControl.prototype.render = function render() {
390
+ return React.createElement(
391
+ "div",
392
+ { className: "cf-card__control" },
393
+ this.props.children
394
+ );
395
+ };
396
+
397
+ return CardControl;
398
+ }(React.Component);
399
+
400
+ module.exports = CardControl;
401
+ },{"react":511}],9:[function(_dereq_,module,exports){
402
+ 'use strict';
403
+
404
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
405
+
406
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
407
+
408
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
409
+
410
+ var React = _dereq_('react');
411
+ var PropTypes = React.PropTypes;
412
+
413
+ var CardSection = _dereq_('./CardSection');
414
+ var CardToolbar = _dereq_('./CardToolbar');
415
+ var CardToolbarLink = _dereq_('./CardToolbarLink');
416
+ var CardPropTypes = _dereq_('./CardPropTypes');
417
+
418
+ var UNIQUE_ID = 0;
419
+
420
+ var CardDrawers = function (_React$Component) {
421
+ _inherits(CardDrawers, _React$Component);
422
+
423
+ function CardDrawers() {
424
+ var _temp, _this, _ret;
425
+
426
+ _classCallCheck(this, CardDrawers);
427
+
428
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
429
+ args[_key] = arguments[_key];
430
+ }
431
+
432
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this._cardId = UNIQUE_ID++, _temp), _possibleConstructorReturn(_this, _ret);
433
+ }
434
+
435
+ CardDrawers.prototype.render = function render() {
436
+ var _this2 = this;
437
+
438
+ var links = [];
439
+ var drawers = [];
440
+
441
+ this.props.drawers.forEach(function (drawer) {
442
+ var isActive = drawer.id === _this2.props.active;
443
+ var id = 'card-' + _this2._cardId + '-drawer-' + drawer.id;
444
+
445
+ links.push(React.createElement(
446
+ CardToolbarLink,
447
+ {
448
+ key: drawer.id,
449
+ id: id,
450
+ isActive: isActive,
451
+ onClick: _this2.props.onClick.bind(null, drawer.id) },
452
+ drawer.name
453
+ ));
454
+
455
+ var className = 'cf-card__drawer';
456
+
457
+ if (isActive) {
458
+ className += ' cf-card__drawer--active';
459
+ }
460
+
461
+ drawers.push(React.createElement(
462
+ 'div',
463
+ {
464
+ key: drawer.id,
465
+ role: 'tabpanel',
466
+ 'aria-labelledby': id,
467
+ 'aria-hidden': isActive ? 'false' : 'true',
468
+ className: className },
469
+ isActive && drawer.content
470
+ ));
471
+ });
472
+
473
+ var containerClassName = 'cf-card__drawers_container';
474
+
475
+ if (this.props.active) {
476
+ containerClassName += ' cf-card__drawers_container--open';
477
+ }
478
+
479
+ return React.createElement(
480
+ CardSection,
481
+ null,
482
+ React.createElement(CardToolbar, { controls: this.props.controls, links: links }),
483
+ React.createElement(
484
+ 'div',
485
+ { className: containerClassName },
486
+ drawers
487
+ )
488
+ );
489
+ };
490
+
491
+ return CardDrawers;
492
+ }(React.Component);
493
+
494
+ CardDrawers.propTypes = {
495
+ onClick: PropTypes.func.isRequired,
496
+
497
+ active: PropTypes.string,
498
+ drawers: CardPropTypes.cardDrawers.isRequired,
499
+
500
+ // for an optional control to put on the left side of the toolbar
501
+ controls: PropTypes.any
502
+ };
503
+
504
+
505
+ module.exports = CardDrawers;
506
+ },{"./CardPropTypes":12,"./CardSection":13,"./CardToolbar":14,"./CardToolbarLink":15,"react":511}],10:[function(_dereq_,module,exports){
507
+ "use strict";
508
+
509
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
510
+
511
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
512
+
513
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
514
+
515
+ var React = _dereq_('react');
516
+
517
+ var CardLoadingText = function (_React$Component) {
518
+ _inherits(CardLoadingText, _React$Component);
519
+
520
+ function CardLoadingText() {
521
+ _classCallCheck(this, CardLoadingText);
522
+
523
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
524
+ }
525
+
526
+ CardLoadingText.prototype.render = function render() {
527
+ return React.createElement("div", { className: "cf-card__loading_text" });
528
+ };
529
+
530
+ return CardLoadingText;
531
+ }(React.Component);
532
+
533
+ module.exports = CardLoadingText;
534
+ },{"react":511}],11:[function(_dereq_,module,exports){
535
+ 'use strict';
536
+
537
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
538
+
539
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
540
+
541
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
542
+
543
+ var React = _dereq_('react');
544
+ var PropTypes = React.PropTypes;
545
+
546
+ var CardMessages = function (_React$Component) {
547
+ _inherits(CardMessages, _React$Component);
548
+
549
+ function CardMessages() {
550
+ _classCallCheck(this, CardMessages);
551
+
552
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
553
+ }
554
+
555
+ CardMessages.prototype.render = function render() {
556
+ return React.createElement(
557
+ 'div',
558
+ { className: 'cf-card__messages' },
559
+ this.props.messages.map(function (message, index) {
560
+ return React.createElement(
561
+ 'div',
562
+ { key: index, role: 'alert', className: 'cf-card__message cf-card__message--' + message.type },
563
+ message.content
564
+ );
565
+ })
566
+ );
567
+ };
568
+
569
+ return CardMessages;
570
+ }(React.Component);
571
+
572
+ CardMessages.propTypes = {
573
+ messages: PropTypes.arrayOf(PropTypes.shape({
574
+ type: PropTypes.oneOf(['info', 'success', 'error', 'warning']),
575
+ content: PropTypes.any.isRequired
576
+ })).isRequired
577
+ };
578
+
579
+
580
+ module.exports = CardMessages;
581
+ },{"react":511}],12:[function(_dereq_,module,exports){
582
+ 'use strict';
583
+
584
+ var React = _dereq_('react');
585
+ var PropTypes = React.PropTypes;
586
+
587
+
588
+ var cardDrawer = PropTypes.shape({
589
+ id: PropTypes.string.isRequired,
590
+ name: PropTypes.string.isRequired,
591
+ content: PropTypes.any.isRequired
592
+ });
593
+
594
+ var cardDrawers = PropTypes.arrayOf(cardDrawer);
595
+
596
+ module.exports = {
597
+ cardDrawer: cardDrawer,
598
+ cardDrawers: cardDrawers
599
+ };
600
+ },{"react":511}],13:[function(_dereq_,module,exports){
601
+ 'use strict';
602
+
603
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
604
+
605
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
606
+
607
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
608
+
609
+ var React = _dereq_('react');
610
+ var PropTypes = React.PropTypes;
611
+
612
+ var CardSection = function (_React$Component) {
613
+ _inherits(CardSection, _React$Component);
614
+
615
+ function CardSection() {
616
+ _classCallCheck(this, CardSection);
617
+
618
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
619
+ }
620
+
621
+ CardSection.prototype.render = function render() {
622
+ return React.createElement(
623
+ 'div',
624
+ { className: 'cf-card__section cf-card__section--' + this.props.status },
625
+ this.props.children
626
+ );
627
+ };
628
+
629
+ return CardSection;
630
+ }(React.Component);
631
+
632
+ CardSection.propTypes = {
633
+ status: PropTypes.oneOf(['default', 'error'])
634
+ };
635
+ CardSection.defaultProps = {
636
+ status: 'default'
637
+ };
638
+
639
+
640
+ module.exports = CardSection;
641
+ },{"react":511}],14:[function(_dereq_,module,exports){
642
+ "use strict";
643
+
644
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
645
+
646
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
647
+
648
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
649
+
650
+ var React = _dereq_('react');
651
+ var PropTypes = React.PropTypes;
652
+
653
+ var CardToolbar = function (_React$Component) {
654
+ _inherits(CardToolbar, _React$Component);
655
+
656
+ function CardToolbar() {
657
+ _classCallCheck(this, CardToolbar);
658
+
659
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
660
+ }
661
+
662
+ CardToolbar.prototype.render = function render() {
663
+ return React.createElement(
664
+ "div",
665
+ { className: "cf-card__toolbar" },
666
+ React.createElement(
667
+ "div",
668
+ { className: "cf-card__toolbar_controls" },
669
+ this.props.controls
670
+ ),
671
+ React.createElement(
672
+ "div",
673
+ { className: "cf-card__toolbar_links", role: "tablist" },
674
+ this.props.links
675
+ )
676
+ );
677
+ };
678
+
679
+ return CardToolbar;
680
+ }(React.Component);
681
+
682
+ CardToolbar.propTypes = {
683
+ controls: PropTypes.any,
684
+ links: PropTypes.any
685
+ };
686
+
687
+
688
+ module.exports = CardToolbar;
689
+ },{"react":511}],15:[function(_dereq_,module,exports){
690
+ 'use strict';
691
+
692
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
693
+
694
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
695
+
696
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
697
+
698
+ var React = _dereq_('react');
699
+ var Link = _dereq_('cf-component-link');
700
+ var PropTypes = React.PropTypes;
701
+
702
+ var CardToolbarLink = function (_React$Component) {
703
+ _inherits(CardToolbarLink, _React$Component);
704
+
705
+ function CardToolbarLink() {
706
+ var _temp, _this, _ret;
707
+
708
+ _classCallCheck(this, CardToolbarLink);
709
+
710
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
711
+ args[_key] = arguments[_key];
712
+ }
713
+
714
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (e) {
715
+ e.preventDefault();
716
+ _this.props.onClick();
717
+ }, _temp), _possibleConstructorReturn(_this, _ret);
718
+ }
719
+
720
+ CardToolbarLink.prototype.render = function render() {
721
+ var className = 'cf-card__toolbar_link';
722
+
723
+ if (this.props.isActive) {
724
+ className += ' cf-card__toolbar_link--open';
725
+ }
726
+
727
+ return React.createElement(
728
+ Link,
729
+ { role: 'tab', id: this.props.id, className: className, onClick: this.handleClick },
730
+ this.props.children
731
+ );
732
+ };
733
+
734
+ return CardToolbarLink;
735
+ }(React.Component);
736
+
737
+ CardToolbarLink.propTypes = {
738
+ onClick: PropTypes.func.isRequired,
739
+ isActive: PropTypes.bool.isRequired,
740
+ id: PropTypes.string
741
+ };
742
+
743
+
744
+ module.exports = CardToolbarLink;
745
+ },{"cf-component-link":18,"react":511}],16:[function(_dereq_,module,exports){
746
+ 'use strict';
747
+
748
+ exports.Card = _dereq_('./Card');
749
+ exports.CardContent = _dereq_('./CardContent');
750
+ exports.CardControl = _dereq_('./CardControl');
751
+ exports.CardDrawers = _dereq_('./CardDrawers');
752
+ exports.CardLoadingText = _dereq_('./CardLoadingText');
753
+ exports.CardMessages = _dereq_('./CardMessages');
754
+ exports.CardPropTypes = _dereq_('./CardPropTypes');
755
+ exports.CardSection = _dereq_('./CardSection');
756
+ },{"./Card":6,"./CardContent":7,"./CardControl":8,"./CardDrawers":9,"./CardLoadingText":10,"./CardMessages":11,"./CardPropTypes":12,"./CardSection":13}],17:[function(_dereq_,module,exports){
757
+ 'use strict';
758
+
759
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
760
+
761
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
762
+
763
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
764
+
765
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
766
+
767
+ var React = _dereq_('react');
768
+ var PropTypes = React.PropTypes;
769
+
770
+ var _require = _dereq_('cf-util-route-handler');
771
+
772
+ var routeTo = _require.routeTo;
773
+
774
+ var Link = function (_React$Component) {
775
+ _inherits(Link, _React$Component);
776
+
777
+ function Link(props, context) {
778
+ _classCallCheck(this, Link);
779
+
780
+ if (!props.to && !props.onClick) {
781
+ throw new Error('<Link/> requires either a `to` or `onClick` prop');
782
+ }
783
+
784
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
785
+
786
+ _this.handleClick = function (e) {
787
+ e.preventDefault();
788
+
789
+ if (_this.props.disabled) {
790
+ return;
791
+ }
792
+
793
+ if (_this.props.to) {
794
+ routeTo(_this.props.to);
795
+ } else {
796
+ _this.props.onClick(e);
797
+ }
798
+ };
799
+
800
+ return _this;
801
+ }
802
+
803
+ Link.prototype.render = function render() {
804
+ var _props = this.props;
805
+ var tagName = _props.tagName;
806
+ var to = _props.to;
807
+ var children = _props.children;
808
+ var className = _props.className;
809
+ var disabled = _props.disabled;
810
+
811
+ var props = _objectWithoutProperties(_props, ['tagName', 'to', 'children', 'className', 'disabled']);
812
+
813
+ if (!props.href && tagName === 'a') {
814
+ props.href = to || '#!';
815
+ }
816
+
817
+ if (!props.role) {
818
+ if (to && tagName !== 'a') {
819
+ props.role = 'link';
820
+ } else if (!to) {
821
+ props.role = 'button';
822
+ }
823
+ }
824
+
825
+ props.className = 'cf-link';
826
+
827
+ if (disabled) {
828
+ props.className += ' cf-link--disabled';
829
+ props.disabled = true;
830
+ }
831
+
832
+ if (className) {
833
+ props.className += ' ' + className;
834
+ }
835
+
836
+ props.onClick = this.handleClick;
837
+
838
+ return React.createElement(tagName, props, children);
839
+ };
840
+
841
+ return Link;
842
+ }(React.Component);
843
+
844
+ Link.propTypes = {
845
+ to: PropTypes.string,
846
+ onClick: PropTypes.func,
847
+ tagName: PropTypes.string,
848
+ disabled: PropTypes.bool
849
+ };
850
+ Link.defaultProps = {
851
+ tagName: 'a'
852
+ };
853
+
854
+
855
+ module.exports = Link;
856
+ },{"cf-util-route-handler":19,"react":511}],18:[function(_dereq_,module,exports){
857
+ 'use strict';
858
+
859
+ module.exports = _dereq_('./Link');
860
+ },{"./Link":17}],19:[function(_dereq_,module,exports){
861
+ 'use strict';
862
+
863
+ module.exports = _dereq_('./routeHandler');
864
+ },{"./routeHandler":20}],20:[function(_dereq_,module,exports){
865
+ 'use strict';
866
+
867
+ var handler = void 0;
868
+
869
+ function handleRoutes(callback) {
870
+ if (handler) {
871
+ console.error('Warning: Route Handler: Only one handler is allowed at a time');
872
+ return;
873
+ }
874
+
875
+ handler = callback;
876
+ }
877
+
878
+ function routeTo(url) {
879
+ if (!handler) {
880
+ console.error('Warning: Route Handler: A handler needs to be setup before you can route');
881
+ return;
882
+ }
883
+
884
+ handler(url);
885
+ }
886
+
887
+ function __resetRouteHandler() {
888
+ handler = null;
889
+ }
890
+
891
+ module.exports = { handleRoutes: handleRoutes, routeTo: routeTo, __resetRouteHandler: __resetRouteHandler };
892
+ },{}],21:[function(_dereq_,module,exports){
893
+ 'use strict';
894
+
895
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
896
+
897
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
898
+
899
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
900
+
901
+ var React = _dereq_('react');
902
+ var PropTypes = React.PropTypes;
903
+
904
+ var Checkbox = function (_React$Component) {
905
+ _inherits(Checkbox, _React$Component);
906
+
907
+ function Checkbox() {
908
+ var _temp, _this, _ret;
909
+
910
+ _classCallCheck(this, Checkbox);
911
+
912
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
913
+ args[_key] = arguments[_key];
914
+ }
915
+
916
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) {
917
+ _this.props.onChange(e.target.checked);
918
+ }, _temp), _possibleConstructorReturn(_this, _ret);
919
+ }
920
+
921
+ Checkbox.prototype.render = function render() {
922
+ var className = 'cf-checkbox';
923
+
924
+ if (this.props.checked) {
925
+ className += ' cf-checkbox--checked';
926
+ }
927
+
928
+ return React.createElement(
929
+ 'label',
930
+ { htmlFor: this.props.name, className: className },
931
+ React.createElement('input', { type: 'checkbox',
932
+ className: 'cf-checkbox__input',
933
+ id: this.props.name,
934
+ name: this.props.name,
935
+ value: this.props.value,
936
+ checked: this.props.checked,
937
+ onChange: this.handleChange }),
938
+ this.props.label && React.createElement(
939
+ 'span',
940
+ { className: 'cf-checkbox__label' },
941
+ this.props.label
942
+ )
943
+ );
944
+ };
945
+
946
+ return Checkbox;
947
+ }(React.Component);
948
+
949
+ Checkbox.propTypes = {
950
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
951
+ name: PropTypes.string.isRequired,
952
+ value: PropTypes.string.isRequired,
953
+ checked: PropTypes.bool.isRequired,
954
+ onChange: PropTypes.func.isRequired
955
+ };
956
+
957
+
958
+ module.exports = Checkbox;
959
+ },{"react":511}],22:[function(_dereq_,module,exports){
960
+ 'use strict';
961
+
962
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
963
+
964
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
965
+
966
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
967
+
968
+ var React = _dereq_('react');
969
+ var PropTypes = React.PropTypes;
970
+
971
+ var Checkbox = _dereq_('./Checkbox');
972
+ var includes = _dereq_('lodash/includes');
973
+
974
+ var CheckboxGroup = function (_React$Component) {
975
+ _inherits(CheckboxGroup, _React$Component);
976
+
977
+ function CheckboxGroup() {
978
+ var _temp, _this, _ret;
979
+
980
+ _classCallCheck(this, CheckboxGroup);
981
+
982
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
983
+ args[_key] = arguments[_key];
984
+ }
985
+
986
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (value, checked) {
987
+ var values = _this.props.options.filter(function (option) {
988
+ if (option.value === value) {
989
+ return checked;
990
+ }
991
+
992
+ return includes(_this.props.values, option.value);
993
+ }).map(function (option) {
994
+ return option.value;
995
+ });
996
+
997
+ _this.props.onChange(values);
998
+ }, _temp), _possibleConstructorReturn(_this, _ret);
999
+ }
1000
+
1001
+ CheckboxGroup.prototype.render = function render() {
1002
+ var _this2 = this;
1003
+
1004
+ return React.createElement(
1005
+ 'div',
1006
+ { className: 'cf-checkbox__group' },
1007
+ this.props.options.map(function (option) {
1008
+ return React.createElement(Checkbox, {
1009
+ key: option.name,
1010
+ label: option.label,
1011
+ name: option.name,
1012
+ value: option.value,
1013
+ checked: includes(_this2.props.values, option.value),
1014
+ onChange: function onChange(val) {
1015
+ return _this2.handleChange(option.value, val);
1016
+ } });
1017
+ })
1018
+ );
1019
+ };
1020
+
1021
+ return CheckboxGroup;
1022
+ }(React.Component);
1023
+
1024
+ CheckboxGroup.propTypes = {
1025
+ values: PropTypes.arrayOf(PropTypes.string).isRequired,
1026
+ onChange: PropTypes.func.isRequired,
1027
+ options: PropTypes.arrayOf(PropTypes.shape({
1028
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
1029
+ name: PropTypes.string.isRequired,
1030
+ value: PropTypes.string.isRequired
1031
+ })).isRequired
1032
+ };
1033
+
1034
+
1035
+ module.exports = CheckboxGroup;
1036
+ },{"./Checkbox":21,"lodash/includes":36,"react":511}],23:[function(_dereq_,module,exports){
1037
+ 'use strict';
1038
+
1039
+ exports.Checkbox = _dereq_('./Checkbox');
1040
+ exports.CheckboxGroup = _dereq_('./CheckboxGroup');
1041
+ },{"./Checkbox":21,"./CheckboxGroup":22}],24:[function(_dereq_,module,exports){
1042
+ var baseTimes = _dereq_('./_baseTimes'),
1043
+ isArguments = _dereq_('./isArguments'),
1044
+ isArray = _dereq_('./isArray'),
1045
+ isIndex = _dereq_('./_isIndex');
1046
+
1047
+ /** Used for built-in method references. */
1048
+ var objectProto = Object.prototype;
1049
+
1050
+ /** Used to check objects for own properties. */
1051
+ var hasOwnProperty = objectProto.hasOwnProperty;
1052
+
1053
+ /**
1054
+ * Creates an array of the enumerable property names of the array-like `value`.
1055
+ *
1056
+ * @private
1057
+ * @param {*} value The value to query.
1058
+ * @param {boolean} inherited Specify returning inherited property names.
1059
+ * @returns {Array} Returns the array of property names.
1060
+ */
1061
+ function arrayLikeKeys(value, inherited) {
1062
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
1063
+ // Safari 9 makes `arguments.length` enumerable in strict mode.
1064
+ var result = (isArray(value) || isArguments(value))
1065
+ ? baseTimes(value.length, String)
1066
+ : [];
1067
+
1068
+ var length = result.length,
1069
+ skipIndexes = !!length;
1070
+
1071
+ for (var key in value) {
1072
+ if ((inherited || hasOwnProperty.call(value, key)) &&
1073
+ !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
1074
+ result.push(key);
1075
+ }
1076
+ }
1077
+ return result;
1078
+ }
1079
+
1080
+ module.exports = arrayLikeKeys;
1081
+
1082
+ },{"./_baseTimes":30,"./_isIndex":32,"./isArguments":37,"./isArray":38}],25:[function(_dereq_,module,exports){
1083
+ /**
1084
+ * A specialized version of `_.map` for arrays without support for iteratee
1085
+ * shorthands.
1086
+ *
1087
+ * @private
1088
+ * @param {Array} [array] The array to iterate over.
1089
+ * @param {Function} iteratee The function invoked per iteration.
1090
+ * @returns {Array} Returns the new mapped array.
1091
+ */
1092
+ function arrayMap(array, iteratee) {
1093
+ var index = -1,
1094
+ length = array ? array.length : 0,
1095
+ result = Array(length);
1096
+
1097
+ while (++index < length) {
1098
+ result[index] = iteratee(array[index], index, array);
1099
+ }
1100
+ return result;
1101
+ }
1102
+
1103
+ module.exports = arrayMap;
1104
+
1105
+ },{}],26:[function(_dereq_,module,exports){
1106
+ /**
1107
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
1108
+ * support for iteratee shorthands.
1109
+ *
1110
+ * @private
1111
+ * @param {Array} array The array to inspect.
1112
+ * @param {Function} predicate The function invoked per iteration.
1113
+ * @param {number} fromIndex The index to search from.
1114
+ * @param {boolean} [fromRight] Specify iterating from right to left.
1115
+ * @returns {number} Returns the index of the matched value, else `-1`.
1116
+ */
1117
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
1118
+ var length = array.length,
1119
+ index = fromIndex + (fromRight ? 1 : -1);
1120
+
1121
+ while ((fromRight ? index-- : ++index < length)) {
1122
+ if (predicate(array[index], index, array)) {
1123
+ return index;
1124
+ }
1125
+ }
1126
+ return -1;
1127
+ }
1128
+
1129
+ module.exports = baseFindIndex;
1130
+
1131
+ },{}],27:[function(_dereq_,module,exports){
1132
+ var baseFindIndex = _dereq_('./_baseFindIndex'),
1133
+ baseIsNaN = _dereq_('./_baseIsNaN');
1134
+
1135
+ /**
1136
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
1137
+ *
1138
+ * @private
1139
+ * @param {Array} array The array to inspect.
1140
+ * @param {*} value The value to search for.
1141
+ * @param {number} fromIndex The index to search from.
1142
+ * @returns {number} Returns the index of the matched value, else `-1`.
1143
+ */
1144
+ function baseIndexOf(array, value, fromIndex) {
1145
+ if (value !== value) {
1146
+ return baseFindIndex(array, baseIsNaN, fromIndex);
1147
+ }
1148
+ var index = fromIndex - 1,
1149
+ length = array.length;
1150
+
1151
+ while (++index < length) {
1152
+ if (array[index] === value) {
1153
+ return index;
1154
+ }
1155
+ }
1156
+ return -1;
1157
+ }
1158
+
1159
+ module.exports = baseIndexOf;
1160
+
1161
+ },{"./_baseFindIndex":26,"./_baseIsNaN":28}],28:[function(_dereq_,module,exports){
1162
+ /**
1163
+ * The base implementation of `_.isNaN` without support for number objects.
1164
+ *
1165
+ * @private
1166
+ * @param {*} value The value to check.
1167
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
1168
+ */
1169
+ function baseIsNaN(value) {
1170
+ return value !== value;
1171
+ }
1172
+
1173
+ module.exports = baseIsNaN;
1174
+
1175
+ },{}],29:[function(_dereq_,module,exports){
1176
+ var isPrototype = _dereq_('./_isPrototype'),
1177
+ nativeKeys = _dereq_('./_nativeKeys');
1178
+
1179
+ /** Used for built-in method references. */
1180
+ var objectProto = Object.prototype;
1181
+
1182
+ /** Used to check objects for own properties. */
1183
+ var hasOwnProperty = objectProto.hasOwnProperty;
1184
+
1185
+ /**
1186
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1187
+ *
1188
+ * @private
1189
+ * @param {Object} object The object to query.
1190
+ * @returns {Array} Returns the array of property names.
1191
+ */
1192
+ function baseKeys(object) {
1193
+ if (!isPrototype(object)) {
1194
+ return nativeKeys(object);
1195
+ }
1196
+ var result = [];
1197
+ for (var key in Object(object)) {
1198
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
1199
+ result.push(key);
1200
+ }
1201
+ }
1202
+ return result;
1203
+ }
1204
+
1205
+ module.exports = baseKeys;
1206
+
1207
+ },{"./_isPrototype":33,"./_nativeKeys":34}],30:[function(_dereq_,module,exports){
1208
+ /**
1209
+ * The base implementation of `_.times` without support for iteratee shorthands
1210
+ * or max array length checks.
1211
+ *
1212
+ * @private
1213
+ * @param {number} n The number of times to invoke `iteratee`.
1214
+ * @param {Function} iteratee The function invoked per iteration.
1215
+ * @returns {Array} Returns the array of results.
1216
+ */
1217
+ function baseTimes(n, iteratee) {
1218
+ var index = -1,
1219
+ result = Array(n);
1220
+
1221
+ while (++index < n) {
1222
+ result[index] = iteratee(index);
1223
+ }
1224
+ return result;
1225
+ }
1226
+
1227
+ module.exports = baseTimes;
1228
+
1229
+ },{}],31:[function(_dereq_,module,exports){
1230
+ var arrayMap = _dereq_('./_arrayMap');
1231
+
1232
+ /**
1233
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
1234
+ * array of `object` property values corresponding to the property names
1235
+ * of `props`.
1236
+ *
1237
+ * @private
1238
+ * @param {Object} object The object to query.
1239
+ * @param {Array} props The property names to get values for.
1240
+ * @returns {Object} Returns the array of property values.
1241
+ */
1242
+ function baseValues(object, props) {
1243
+ return arrayMap(props, function(key) {
1244
+ return object[key];
1245
+ });
1246
+ }
1247
+
1248
+ module.exports = baseValues;
1249
+
1250
+ },{"./_arrayMap":25}],32:[function(_dereq_,module,exports){
1251
+ /** Used as references for various `Number` constants. */
1252
+ var MAX_SAFE_INTEGER = 9007199254740991;
1253
+
1254
+ /** Used to detect unsigned integer values. */
1255
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1256
+
1257
+ /**
1258
+ * Checks if `value` is a valid array-like index.
1259
+ *
1260
+ * @private
1261
+ * @param {*} value The value to check.
1262
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1263
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1264
+ */
1265
+ function isIndex(value, length) {
1266
+ length = length == null ? MAX_SAFE_INTEGER : length;
1267
+ return !!length &&
1268
+ (typeof value == 'number' || reIsUint.test(value)) &&
1269
+ (value > -1 && value % 1 == 0 && value < length);
1270
+ }
1271
+
1272
+ module.exports = isIndex;
1273
+
1274
+ },{}],33:[function(_dereq_,module,exports){
1275
+ /** Used for built-in method references. */
1276
+ var objectProto = Object.prototype;
1277
+
1278
+ /**
1279
+ * Checks if `value` is likely a prototype object.
1280
+ *
1281
+ * @private
1282
+ * @param {*} value The value to check.
1283
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1284
+ */
1285
+ function isPrototype(value) {
1286
+ var Ctor = value && value.constructor,
1287
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1288
+
1289
+ return value === proto;
1290
+ }
1291
+
1292
+ module.exports = isPrototype;
1293
+
1294
+ },{}],34:[function(_dereq_,module,exports){
1295
+ var overArg = _dereq_('./_overArg');
1296
+
1297
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1298
+ var nativeKeys = overArg(Object.keys, Object);
1299
+
1300
+ module.exports = nativeKeys;
1301
+
1302
+ },{"./_overArg":35}],35:[function(_dereq_,module,exports){
1303
+ /**
1304
+ * Creates a unary function that invokes `func` with its argument transformed.
1305
+ *
1306
+ * @private
1307
+ * @param {Function} func The function to wrap.
1308
+ * @param {Function} transform The argument transform.
1309
+ * @returns {Function} Returns the new function.
1310
+ */
1311
+ function overArg(func, transform) {
1312
+ return function(arg) {
1313
+ return func(transform(arg));
1314
+ };
1315
+ }
1316
+
1317
+ module.exports = overArg;
1318
+
1319
+ },{}],36:[function(_dereq_,module,exports){
1320
+ var baseIndexOf = _dereq_('./_baseIndexOf'),
1321
+ isArrayLike = _dereq_('./isArrayLike'),
1322
+ isString = _dereq_('./isString'),
1323
+ toInteger = _dereq_('./toInteger'),
1324
+ values = _dereq_('./values');
1325
+
1326
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1327
+ var nativeMax = Math.max;
1328
+
1329
+ /**
1330
+ * Checks if `value` is in `collection`. If `collection` is a string, it's
1331
+ * checked for a substring of `value`, otherwise
1332
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1333
+ * is used for equality comparisons. If `fromIndex` is negative, it's used as
1334
+ * the offset from the end of `collection`.
1335
+ *
1336
+ * @static
1337
+ * @memberOf _
1338
+ * @since 0.1.0
1339
+ * @category Collection
1340
+ * @param {Array|Object|string} collection The collection to inspect.
1341
+ * @param {*} value The value to search for.
1342
+ * @param {number} [fromIndex=0] The index to search from.
1343
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
1344
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
1345
+ * @example
1346
+ *
1347
+ * _.includes([1, 2, 3], 1);
1348
+ * // => true
1349
+ *
1350
+ * _.includes([1, 2, 3], 1, 2);
1351
+ * // => false
1352
+ *
1353
+ * _.includes({ 'a': 1, 'b': 2 }, 1);
1354
+ * // => true
1355
+ *
1356
+ * _.includes('abcd', 'bc');
1357
+ * // => true
1358
+ */
1359
+ function includes(collection, value, fromIndex, guard) {
1360
+ collection = isArrayLike(collection) ? collection : values(collection);
1361
+ fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
1362
+
1363
+ var length = collection.length;
1364
+ if (fromIndex < 0) {
1365
+ fromIndex = nativeMax(length + fromIndex, 0);
1366
+ }
1367
+ return isString(collection)
1368
+ ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
1369
+ : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
1370
+ }
1371
+
1372
+ module.exports = includes;
1373
+
1374
+ },{"./_baseIndexOf":27,"./isArrayLike":39,"./isString":45,"./toInteger":49,"./values":51}],37:[function(_dereq_,module,exports){
1375
+ var isArrayLikeObject = _dereq_('./isArrayLikeObject');
1376
+
1377
+ /** `Object#toString` result references. */
1378
+ var argsTag = '[object Arguments]';
1379
+
1380
+ /** Used for built-in method references. */
1381
+ var objectProto = Object.prototype;
1382
+
1383
+ /** Used to check objects for own properties. */
1384
+ var hasOwnProperty = objectProto.hasOwnProperty;
1385
+
1386
+ /**
1387
+ * Used to resolve the
1388
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1389
+ * of values.
1390
+ */
1391
+ var objectToString = objectProto.toString;
1392
+
1393
+ /** Built-in value references. */
1394
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
1395
+
1396
+ /**
1397
+ * Checks if `value` is likely an `arguments` object.
1398
+ *
1399
+ * @static
1400
+ * @memberOf _
1401
+ * @since 0.1.0
1402
+ * @category Lang
1403
+ * @param {*} value The value to check.
1404
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1405
+ * else `false`.
1406
+ * @example
1407
+ *
1408
+ * _.isArguments(function() { return arguments; }());
1409
+ * // => true
1410
+ *
1411
+ * _.isArguments([1, 2, 3]);
1412
+ * // => false
1413
+ */
1414
+ function isArguments(value) {
1415
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
1416
+ return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
1417
+ (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
1418
+ }
1419
+
1420
+ module.exports = isArguments;
1421
+
1422
+ },{"./isArrayLikeObject":40}],38:[function(_dereq_,module,exports){
1423
+ /**
1424
+ * Checks if `value` is classified as an `Array` object.
1425
+ *
1426
+ * @static
1427
+ * @memberOf _
1428
+ * @since 0.1.0
1429
+ * @category Lang
1430
+ * @param {*} value The value to check.
1431
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1432
+ * @example
1433
+ *
1434
+ * _.isArray([1, 2, 3]);
1435
+ * // => true
1436
+ *
1437
+ * _.isArray(document.body.children);
1438
+ * // => false
1439
+ *
1440
+ * _.isArray('abc');
1441
+ * // => false
1442
+ *
1443
+ * _.isArray(_.noop);
1444
+ * // => false
1445
+ */
1446
+ var isArray = Array.isArray;
1447
+
1448
+ module.exports = isArray;
1449
+
1450
+ },{}],39:[function(_dereq_,module,exports){
1451
+ var isFunction = _dereq_('./isFunction'),
1452
+ isLength = _dereq_('./isLength');
1453
+
1454
+ /**
1455
+ * Checks if `value` is array-like. A value is considered array-like if it's
1456
+ * not a function and has a `value.length` that's an integer greater than or
1457
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1458
+ *
1459
+ * @static
1460
+ * @memberOf _
1461
+ * @since 4.0.0
1462
+ * @category Lang
1463
+ * @param {*} value The value to check.
1464
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1465
+ * @example
1466
+ *
1467
+ * _.isArrayLike([1, 2, 3]);
1468
+ * // => true
1469
+ *
1470
+ * _.isArrayLike(document.body.children);
1471
+ * // => true
1472
+ *
1473
+ * _.isArrayLike('abc');
1474
+ * // => true
1475
+ *
1476
+ * _.isArrayLike(_.noop);
1477
+ * // => false
1478
+ */
1479
+ function isArrayLike(value) {
1480
+ return value != null && isLength(value.length) && !isFunction(value);
1481
+ }
1482
+
1483
+ module.exports = isArrayLike;
1484
+
1485
+ },{"./isFunction":41,"./isLength":42}],40:[function(_dereq_,module,exports){
1486
+ var isArrayLike = _dereq_('./isArrayLike'),
1487
+ isObjectLike = _dereq_('./isObjectLike');
1488
+
1489
+ /**
1490
+ * This method is like `_.isArrayLike` except that it also checks if `value`
1491
+ * is an object.
1492
+ *
1493
+ * @static
1494
+ * @memberOf _
1495
+ * @since 4.0.0
1496
+ * @category Lang
1497
+ * @param {*} value The value to check.
1498
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
1499
+ * else `false`.
1500
+ * @example
1501
+ *
1502
+ * _.isArrayLikeObject([1, 2, 3]);
1503
+ * // => true
1504
+ *
1505
+ * _.isArrayLikeObject(document.body.children);
1506
+ * // => true
1507
+ *
1508
+ * _.isArrayLikeObject('abc');
1509
+ * // => false
1510
+ *
1511
+ * _.isArrayLikeObject(_.noop);
1512
+ * // => false
1513
+ */
1514
+ function isArrayLikeObject(value) {
1515
+ return isObjectLike(value) && isArrayLike(value);
1516
+ }
1517
+
1518
+ module.exports = isArrayLikeObject;
1519
+
1520
+ },{"./isArrayLike":39,"./isObjectLike":44}],41:[function(_dereq_,module,exports){
1521
+ var isObject = _dereq_('./isObject');
1522
+
1523
+ /** `Object#toString` result references. */
1524
+ var funcTag = '[object Function]',
1525
+ genTag = '[object GeneratorFunction]';
1526
+
1527
+ /** Used for built-in method references. */
1528
+ var objectProto = Object.prototype;
1529
+
1530
+ /**
1531
+ * Used to resolve the
1532
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1533
+ * of values.
1534
+ */
1535
+ var objectToString = objectProto.toString;
1536
+
1537
+ /**
1538
+ * Checks if `value` is classified as a `Function` object.
1539
+ *
1540
+ * @static
1541
+ * @memberOf _
1542
+ * @since 0.1.0
1543
+ * @category Lang
1544
+ * @param {*} value The value to check.
1545
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1546
+ * @example
1547
+ *
1548
+ * _.isFunction(_);
1549
+ * // => true
1550
+ *
1551
+ * _.isFunction(/abc/);
1552
+ * // => false
1553
+ */
1554
+ function isFunction(value) {
1555
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1556
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
1557
+ var tag = isObject(value) ? objectToString.call(value) : '';
1558
+ return tag == funcTag || tag == genTag;
1559
+ }
1560
+
1561
+ module.exports = isFunction;
1562
+
1563
+ },{"./isObject":43}],42:[function(_dereq_,module,exports){
1564
+ /** Used as references for various `Number` constants. */
1565
+ var MAX_SAFE_INTEGER = 9007199254740991;
1566
+
1567
+ /**
1568
+ * Checks if `value` is a valid array-like length.
1569
+ *
1570
+ * **Note:** This method is loosely based on
1571
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1572
+ *
1573
+ * @static
1574
+ * @memberOf _
1575
+ * @since 4.0.0
1576
+ * @category Lang
1577
+ * @param {*} value The value to check.
1578
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1579
+ * @example
1580
+ *
1581
+ * _.isLength(3);
1582
+ * // => true
1583
+ *
1584
+ * _.isLength(Number.MIN_VALUE);
1585
+ * // => false
1586
+ *
1587
+ * _.isLength(Infinity);
1588
+ * // => false
1589
+ *
1590
+ * _.isLength('3');
1591
+ * // => false
1592
+ */
1593
+ function isLength(value) {
1594
+ return typeof value == 'number' &&
1595
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1596
+ }
1597
+
1598
+ module.exports = isLength;
1599
+
1600
+ },{}],43:[function(_dereq_,module,exports){
1601
+ /**
1602
+ * Checks if `value` is the
1603
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1604
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1605
+ *
1606
+ * @static
1607
+ * @memberOf _
1608
+ * @since 0.1.0
1609
+ * @category Lang
1610
+ * @param {*} value The value to check.
1611
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1612
+ * @example
1613
+ *
1614
+ * _.isObject({});
1615
+ * // => true
1616
+ *
1617
+ * _.isObject([1, 2, 3]);
1618
+ * // => true
1619
+ *
1620
+ * _.isObject(_.noop);
1621
+ * // => true
1622
+ *
1623
+ * _.isObject(null);
1624
+ * // => false
1625
+ */
1626
+ function isObject(value) {
1627
+ var type = typeof value;
1628
+ return !!value && (type == 'object' || type == 'function');
1629
+ }
1630
+
1631
+ module.exports = isObject;
1632
+
1633
+ },{}],44:[function(_dereq_,module,exports){
1634
+ /**
1635
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1636
+ * and has a `typeof` result of "object".
1637
+ *
1638
+ * @static
1639
+ * @memberOf _
1640
+ * @since 4.0.0
1641
+ * @category Lang
1642
+ * @param {*} value The value to check.
1643
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1644
+ * @example
1645
+ *
1646
+ * _.isObjectLike({});
1647
+ * // => true
1648
+ *
1649
+ * _.isObjectLike([1, 2, 3]);
1650
+ * // => true
1651
+ *
1652
+ * _.isObjectLike(_.noop);
1653
+ * // => false
1654
+ *
1655
+ * _.isObjectLike(null);
1656
+ * // => false
1657
+ */
1658
+ function isObjectLike(value) {
1659
+ return !!value && typeof value == 'object';
1660
+ }
1661
+
1662
+ module.exports = isObjectLike;
1663
+
1664
+ },{}],45:[function(_dereq_,module,exports){
1665
+ var isArray = _dereq_('./isArray'),
1666
+ isObjectLike = _dereq_('./isObjectLike');
1667
+
1668
+ /** `Object#toString` result references. */
1669
+ var stringTag = '[object String]';
1670
+
1671
+ /** Used for built-in method references. */
1672
+ var objectProto = Object.prototype;
1673
+
1674
+ /**
1675
+ * Used to resolve the
1676
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1677
+ * of values.
1678
+ */
1679
+ var objectToString = objectProto.toString;
1680
+
1681
+ /**
1682
+ * Checks if `value` is classified as a `String` primitive or object.
1683
+ *
1684
+ * @static
1685
+ * @since 0.1.0
1686
+ * @memberOf _
1687
+ * @category Lang
1688
+ * @param {*} value The value to check.
1689
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
1690
+ * @example
1691
+ *
1692
+ * _.isString('abc');
1693
+ * // => true
1694
+ *
1695
+ * _.isString(1);
1696
+ * // => false
1697
+ */
1698
+ function isString(value) {
1699
+ return typeof value == 'string' ||
1700
+ (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
1701
+ }
1702
+
1703
+ module.exports = isString;
1704
+
1705
+ },{"./isArray":38,"./isObjectLike":44}],46:[function(_dereq_,module,exports){
1706
+ var isObjectLike = _dereq_('./isObjectLike');
1707
+
1708
+ /** `Object#toString` result references. */
1709
+ var symbolTag = '[object Symbol]';
1710
+
1711
+ /** Used for built-in method references. */
1712
+ var objectProto = Object.prototype;
1713
+
1714
+ /**
1715
+ * Used to resolve the
1716
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1717
+ * of values.
1718
+ */
1719
+ var objectToString = objectProto.toString;
1720
+
1721
+ /**
1722
+ * Checks if `value` is classified as a `Symbol` primitive or object.
1723
+ *
1724
+ * @static
1725
+ * @memberOf _
1726
+ * @since 4.0.0
1727
+ * @category Lang
1728
+ * @param {*} value The value to check.
1729
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1730
+ * @example
1731
+ *
1732
+ * _.isSymbol(Symbol.iterator);
1733
+ * // => true
1734
+ *
1735
+ * _.isSymbol('abc');
1736
+ * // => false
1737
+ */
1738
+ function isSymbol(value) {
1739
+ return typeof value == 'symbol' ||
1740
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
1741
+ }
1742
+
1743
+ module.exports = isSymbol;
1744
+
1745
+ },{"./isObjectLike":44}],47:[function(_dereq_,module,exports){
1746
+ var arrayLikeKeys = _dereq_('./_arrayLikeKeys'),
1747
+ baseKeys = _dereq_('./_baseKeys'),
1748
+ isArrayLike = _dereq_('./isArrayLike');
1749
+
1750
+ /**
1751
+ * Creates an array of the own enumerable property names of `object`.
1752
+ *
1753
+ * **Note:** Non-object values are coerced to objects. See the
1754
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1755
+ * for more details.
1756
+ *
1757
+ * @static
1758
+ * @since 0.1.0
1759
+ * @memberOf _
1760
+ * @category Object
1761
+ * @param {Object} object The object to query.
1762
+ * @returns {Array} Returns the array of property names.
1763
+ * @example
1764
+ *
1765
+ * function Foo() {
1766
+ * this.a = 1;
1767
+ * this.b = 2;
1768
+ * }
1769
+ *
1770
+ * Foo.prototype.c = 3;
1771
+ *
1772
+ * _.keys(new Foo);
1773
+ * // => ['a', 'b'] (iteration order is not guaranteed)
1774
+ *
1775
+ * _.keys('hi');
1776
+ * // => ['0', '1']
1777
+ */
1778
+ function keys(object) {
1779
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1780
+ }
1781
+
1782
+ module.exports = keys;
1783
+
1784
+ },{"./_arrayLikeKeys":24,"./_baseKeys":29,"./isArrayLike":39}],48:[function(_dereq_,module,exports){
1785
+ var toNumber = _dereq_('./toNumber');
1786
+
1787
+ /** Used as references for various `Number` constants. */
1788
+ var INFINITY = 1 / 0,
1789
+ MAX_INTEGER = 1.7976931348623157e+308;
1790
+
1791
+ /**
1792
+ * Converts `value` to a finite number.
1793
+ *
1794
+ * @static
1795
+ * @memberOf _
1796
+ * @since 4.12.0
1797
+ * @category Lang
1798
+ * @param {*} value The value to convert.
1799
+ * @returns {number} Returns the converted number.
1800
+ * @example
1801
+ *
1802
+ * _.toFinite(3.2);
1803
+ * // => 3.2
1804
+ *
1805
+ * _.toFinite(Number.MIN_VALUE);
1806
+ * // => 5e-324
1807
+ *
1808
+ * _.toFinite(Infinity);
1809
+ * // => 1.7976931348623157e+308
1810
+ *
1811
+ * _.toFinite('3.2');
1812
+ * // => 3.2
1813
+ */
1814
+ function toFinite(value) {
1815
+ if (!value) {
1816
+ return value === 0 ? value : 0;
1817
+ }
1818
+ value = toNumber(value);
1819
+ if (value === INFINITY || value === -INFINITY) {
1820
+ var sign = (value < 0 ? -1 : 1);
1821
+ return sign * MAX_INTEGER;
1822
+ }
1823
+ return value === value ? value : 0;
1824
+ }
1825
+
1826
+ module.exports = toFinite;
1827
+
1828
+ },{"./toNumber":50}],49:[function(_dereq_,module,exports){
1829
+ var toFinite = _dereq_('./toFinite');
1830
+
1831
+ /**
1832
+ * Converts `value` to an integer.
1833
+ *
1834
+ * **Note:** This method is loosely based on
1835
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
1836
+ *
1837
+ * @static
1838
+ * @memberOf _
1839
+ * @since 4.0.0
1840
+ * @category Lang
1841
+ * @param {*} value The value to convert.
1842
+ * @returns {number} Returns the converted integer.
1843
+ * @example
1844
+ *
1845
+ * _.toInteger(3.2);
1846
+ * // => 3
1847
+ *
1848
+ * _.toInteger(Number.MIN_VALUE);
1849
+ * // => 0
1850
+ *
1851
+ * _.toInteger(Infinity);
1852
+ * // => 1.7976931348623157e+308
1853
+ *
1854
+ * _.toInteger('3.2');
1855
+ * // => 3
1856
+ */
1857
+ function toInteger(value) {
1858
+ var result = toFinite(value),
1859
+ remainder = result % 1;
1860
+
1861
+ return result === result ? (remainder ? result - remainder : result) : 0;
1862
+ }
1863
+
1864
+ module.exports = toInteger;
1865
+
1866
+ },{"./toFinite":48}],50:[function(_dereq_,module,exports){
1867
+ var isObject = _dereq_('./isObject'),
1868
+ isSymbol = _dereq_('./isSymbol');
1869
+
1870
+ /** Used as references for various `Number` constants. */
1871
+ var NAN = 0 / 0;
1872
+
1873
+ /** Used to match leading and trailing whitespace. */
1874
+ var reTrim = /^\s+|\s+$/g;
1875
+
1876
+ /** Used to detect bad signed hexadecimal string values. */
1877
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
1878
+
1879
+ /** Used to detect binary string values. */
1880
+ var reIsBinary = /^0b[01]+$/i;
1881
+
1882
+ /** Used to detect octal string values. */
1883
+ var reIsOctal = /^0o[0-7]+$/i;
1884
+
1885
+ /** Built-in method references without a dependency on `root`. */
1886
+ var freeParseInt = parseInt;
1887
+
1888
+ /**
1889
+ * Converts `value` to a number.
1890
+ *
1891
+ * @static
1892
+ * @memberOf _
1893
+ * @since 4.0.0
1894
+ * @category Lang
1895
+ * @param {*} value The value to process.
1896
+ * @returns {number} Returns the number.
1897
+ * @example
1898
+ *
1899
+ * _.toNumber(3.2);
1900
+ * // => 3.2
1901
+ *
1902
+ * _.toNumber(Number.MIN_VALUE);
1903
+ * // => 5e-324
1904
+ *
1905
+ * _.toNumber(Infinity);
1906
+ * // => Infinity
1907
+ *
1908
+ * _.toNumber('3.2');
1909
+ * // => 3.2
1910
+ */
1911
+ function toNumber(value) {
1912
+ if (typeof value == 'number') {
1913
+ return value;
1914
+ }
1915
+ if (isSymbol(value)) {
1916
+ return NAN;
1917
+ }
1918
+ if (isObject(value)) {
1919
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
1920
+ value = isObject(other) ? (other + '') : other;
1921
+ }
1922
+ if (typeof value != 'string') {
1923
+ return value === 0 ? value : +value;
1924
+ }
1925
+ value = value.replace(reTrim, '');
1926
+ var isBinary = reIsBinary.test(value);
1927
+ return (isBinary || reIsOctal.test(value))
1928
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
1929
+ : (reIsBadHex.test(value) ? NAN : +value);
1930
+ }
1931
+
1932
+ module.exports = toNumber;
1933
+
1934
+ },{"./isObject":43,"./isSymbol":46}],51:[function(_dereq_,module,exports){
1935
+ var baseValues = _dereq_('./_baseValues'),
1936
+ keys = _dereq_('./keys');
1937
+
1938
+ /**
1939
+ * Creates an array of the own enumerable string keyed property values of `object`.
1940
+ *
1941
+ * **Note:** Non-object values are coerced to objects.
1942
+ *
1943
+ * @static
1944
+ * @since 0.1.0
1945
+ * @memberOf _
1946
+ * @category Object
1947
+ * @param {Object} object The object to query.
1948
+ * @returns {Array} Returns the array of property values.
1949
+ * @example
1950
+ *
1951
+ * function Foo() {
1952
+ * this.a = 1;
1953
+ * this.b = 2;
1954
+ * }
1955
+ *
1956
+ * Foo.prototype.c = 3;
1957
+ *
1958
+ * _.values(new Foo);
1959
+ * // => [1, 2] (iteration order is not guaranteed)
1960
+ *
1961
+ * _.values('hi');
1962
+ * // => ['h', 'i']
1963
+ */
1964
+ function values(object) {
1965
+ return object ? baseValues(object, keys(object)) : [];
1966
+ }
1967
+
1968
+ module.exports = values;
1969
+
1970
+ },{"./_baseValues":31,"./keys":47}],52:[function(_dereq_,module,exports){
1971
+ (function (global){
1972
+ 'use strict';
1973
+
1974
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1975
+
1976
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1977
+
1978
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1979
+
1980
+ var React = _dereq_('react');
1981
+ var PropTypes = React.PropTypes;
1982
+
1983
+ var DropdownRegistry = _dereq_('./DropdownRegistry');
1984
+
1985
+ var _require = _dereq_('exenv');
1986
+
1987
+ var canUseDOM = _require.canUseDOM;
1988
+
1989
+ var Dropdown = function (_React$Component) {
1990
+ _inherits(Dropdown, _React$Component);
1991
+
1992
+ Dropdown.prototype.getChildContext = function getChildContext() {
1993
+ return {
1994
+ dropdownRegistry: this.dropdownRegistry
1995
+ };
1996
+ };
1997
+
1998
+ function Dropdown(props, context) {
1999
+ _classCallCheck(this, Dropdown);
2000
+
2001
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
2002
+
2003
+ _this.handleDocumentKeydown = function (event) {
2004
+ var keyCode = event.keyCode;
2005
+
2006
+ if (keyCode === 40) {
2007
+ // down
2008
+ event.preventDefault();
2009
+ _this.dropdownRegistry.focusNext();
2010
+ } else if (keyCode === 38) {
2011
+ // up
2012
+ event.preventDefault();
2013
+ _this.dropdownRegistry.focusPrev();
2014
+ } else if (keyCode === 27) {
2015
+ // esc
2016
+ _this.props.onClose();
2017
+ }
2018
+ };
2019
+
2020
+ _this.handleDocumentClick = function (event) {
2021
+ _this.props.onClose();
2022
+ };
2023
+
2024
+ _this.dropdownRegistry = new DropdownRegistry();
2025
+ return _this;
2026
+ }
2027
+
2028
+ Dropdown.prototype.componentDidMount = function componentDidMount() {
2029
+ if (canUseDOM) {
2030
+ global.document.addEventListener('keydown', this.handleDocumentKeydown);
2031
+ global.document.addEventListener('click', this.handleDocumentClick);
2032
+ }
2033
+ };
2034
+
2035
+ Dropdown.prototype.componentWillUnmount = function componentWillUnmount() {
2036
+ if (canUseDOM) {
2037
+ global.document.removeEventListener('keydown', this.handleDocumentKeydown);
2038
+ global.document.removeEventListener('click', this.handleDocumentClick);
2039
+ }
2040
+ };
2041
+
2042
+ Dropdown.prototype.render = function render() {
2043
+ return React.createElement(
2044
+ 'ul',
2045
+ { role: 'menu', className: 'cf-dropdown cf-dropdown--' + this.props.align },
2046
+ this.props.children
2047
+ );
2048
+ };
2049
+
2050
+ return Dropdown;
2051
+ }(React.Component);
2052
+
2053
+ Dropdown.propTypes = {
2054
+ onClose: PropTypes.func.isRequired,
2055
+ align: PropTypes.oneOf(['left', 'right'])
2056
+ };
2057
+ Dropdown.defaultProps = {
2058
+ align: 'left'
2059
+ };
2060
+ Dropdown.childContextTypes = {
2061
+ dropdownRegistry: PropTypes.instanceOf(DropdownRegistry).isRequired
2062
+ };
2063
+
2064
+
2065
+ module.exports = Dropdown;
2066
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2067
+
2068
+ },{"./DropdownRegistry":54,"exenv":61,"react":511}],53:[function(_dereq_,module,exports){
2069
+ 'use strict';
2070
+
2071
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2072
+
2073
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2074
+
2075
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2076
+
2077
+ var React = _dereq_('react');
2078
+ var PropTypes = React.PropTypes;
2079
+
2080
+ var _require = _dereq_('react-dom');
2081
+
2082
+ var findDOMNode = _require.findDOMNode;
2083
+
2084
+ var Link = _dereq_('cf-component-link');
2085
+ var DropdownRegistry = _dereq_('./DropdownRegistry');
2086
+
2087
+ var DropdownLink = function (_React$Component) {
2088
+ _inherits(DropdownLink, _React$Component);
2089
+
2090
+ function DropdownLink(props, context) {
2091
+ _classCallCheck(this, DropdownLink);
2092
+
2093
+ if (!props.to && !props.onClick) {
2094
+ throw new Error('<DropdownLink/> requires either a `to` or `onClick` prop');
2095
+ }
2096
+
2097
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
2098
+
2099
+ _this.handleLinkFocus = function (e) {
2100
+ _this.dropdownRegistry.setFocusedChild(_this);
2101
+ };
2102
+
2103
+ _this.handleLinkBlur = function (e) {
2104
+ _this.dropdownRegistry.removeFocusedChild();
2105
+ };
2106
+
2107
+ _this.dropdownRegistry = context.dropdownRegistry;
2108
+ return _this;
2109
+ }
2110
+
2111
+ DropdownLink.prototype.componentWillMount = function componentWillMount() {
2112
+ this.dropdownRegistry.addChild(this);
2113
+ };
2114
+
2115
+ DropdownLink.prototype.componentWillUnmount = function componentWillUnmount() {
2116
+ this.dropdownRegistry.removeChild(this);
2117
+ };
2118
+
2119
+ DropdownLink.prototype.focus = function focus() {
2120
+ findDOMNode(this.refs.link).focus();
2121
+ };
2122
+
2123
+ DropdownLink.prototype.render = function render() {
2124
+ return React.createElement(
2125
+ 'li',
2126
+ { className: 'cf-dropdown__link', role: 'menuitem' },
2127
+ React.createElement(
2128
+ Link,
2129
+ { ref: 'link',
2130
+ to: this.props.to,
2131
+ onClick: this.props.onClick,
2132
+ onFocus: this.handleLinkFocus,
2133
+ onBlur: this.handleLinkBlur },
2134
+ this.props.children
2135
+ )
2136
+ );
2137
+ };
2138
+
2139
+ return DropdownLink;
2140
+ }(React.Component);
2141
+
2142
+ DropdownLink.propTypes = {
2143
+ to: PropTypes.string,
2144
+ onClick: PropTypes.func
2145
+ };
2146
+ DropdownLink.contextTypes = {
2147
+ dropdownRegistry: PropTypes.instanceOf(DropdownRegistry).isRequired
2148
+ };
2149
+
2150
+
2151
+ module.exports = DropdownLink;
2152
+ },{"./DropdownRegistry":54,"cf-component-link":58,"react":511,"react-dom":276}],54:[function(_dereq_,module,exports){
2153
+ "use strict";
2154
+
2155
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2156
+
2157
+ var DropdownRegistry = function () {
2158
+ function DropdownRegistry() {
2159
+ _classCallCheck(this, DropdownRegistry);
2160
+
2161
+ this._links = [];
2162
+ this._currentFocusIndex = -1;
2163
+ }
2164
+
2165
+ DropdownRegistry.prototype.addChild = function addChild(child) {
2166
+ this._links.push(child);
2167
+ };
2168
+
2169
+ DropdownRegistry.prototype.removeChild = function removeChild(child) {
2170
+ this._links.splice(this._links.indexOf(child), 1);
2171
+ };
2172
+
2173
+ DropdownRegistry.prototype._focusChildAt = function _focusChildAt(index) {
2174
+ if (this._links[index]) {
2175
+ this._links[index].focus();
2176
+ }
2177
+ };
2178
+
2179
+ DropdownRegistry.prototype.focusNext = function focusNext() {
2180
+ this._focusChildAt(this._currentFocusIndex + 1);
2181
+ };
2182
+
2183
+ DropdownRegistry.prototype.focusPrev = function focusPrev() {
2184
+ this._focusChildAt(this._currentFocusIndex - 1);
2185
+ };
2186
+
2187
+ DropdownRegistry.prototype.setFocusedChild = function setFocusedChild(child) {
2188
+ this._currentFocusIndex = this._links.indexOf(child);
2189
+ };
2190
+
2191
+ DropdownRegistry.prototype.removeFocusedChild = function removeFocusedChild(child) {
2192
+ this._currentFocusIndex = -1;
2193
+ };
2194
+
2195
+ return DropdownRegistry;
2196
+ }();
2197
+
2198
+ module.exports = DropdownRegistry;
2199
+ },{}],55:[function(_dereq_,module,exports){
2200
+ "use strict";
2201
+
2202
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2203
+
2204
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2205
+
2206
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2207
+
2208
+ var React = _dereq_('react');
2209
+
2210
+ var DropdownSeparator = function (_React$Component) {
2211
+ _inherits(DropdownSeparator, _React$Component);
2212
+
2213
+ function DropdownSeparator() {
2214
+ _classCallCheck(this, DropdownSeparator);
2215
+
2216
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2217
+ }
2218
+
2219
+ DropdownSeparator.prototype.render = function render() {
2220
+ return React.createElement("div", { className: "cf-dropdown__separator", role: "separator" });
2221
+ };
2222
+
2223
+ return DropdownSeparator;
2224
+ }(React.Component);
2225
+
2226
+ module.exports = DropdownSeparator;
2227
+ },{"react":511}],56:[function(_dereq_,module,exports){
2228
+ 'use strict';
2229
+
2230
+ exports.Dropdown = _dereq_('./Dropdown');
2231
+ exports.DropdownLink = _dereq_('./DropdownLink');
2232
+ exports.DropdownSeparator = _dereq_('./DropdownSeparator');
2233
+ },{"./Dropdown":52,"./DropdownLink":53,"./DropdownSeparator":55}],57:[function(_dereq_,module,exports){
2234
+ arguments[4][17][0].apply(exports,arguments)
2235
+ },{"cf-util-route-handler":59,"dup":17,"react":511}],58:[function(_dereq_,module,exports){
2236
+ arguments[4][18][0].apply(exports,arguments)
2237
+ },{"./Link":57,"dup":18}],59:[function(_dereq_,module,exports){
2238
+ arguments[4][19][0].apply(exports,arguments)
2239
+ },{"./routeHandler":60,"dup":19}],60:[function(_dereq_,module,exports){
2240
+ arguments[4][20][0].apply(exports,arguments)
2241
+ },{"dup":20}],61:[function(_dereq_,module,exports){
2242
+ /*!
2243
+ Copyright (c) 2015 Jed Watson.
2244
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
2245
+ All rights reserved.
2246
+ */
2247
+ /* global define */
2248
+
2249
+ (function () {
2250
+ 'use strict';
2251
+
2252
+ var canUseDOM = !!(
2253
+ typeof window !== 'undefined' &&
2254
+ window.document &&
2255
+ window.document.createElement
2256
+ );
2257
+
2258
+ var ExecutionEnvironment = {
2259
+
2260
+ canUseDOM: canUseDOM,
2261
+
2262
+ canUseWorkers: typeof Worker !== 'undefined',
2263
+
2264
+ canUseEventListeners:
2265
+ canUseDOM && !!(window.addEventListener || window.attachEvent),
2266
+
2267
+ canUseViewport: canUseDOM && !!window.screen
2268
+
2269
+ };
2270
+
2271
+ if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
2272
+ define(function () {
2273
+ return ExecutionEnvironment;
2274
+ });
2275
+ } else if (typeof module !== 'undefined' && module.exports) {
2276
+ module.exports = ExecutionEnvironment;
2277
+ } else {
2278
+ window.ExecutionEnvironment = ExecutionEnvironment;
2279
+ }
2280
+
2281
+ }());
2282
+
2283
+ },{}],62:[function(_dereq_,module,exports){
2284
+ 'use strict';
2285
+
2286
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2287
+
2288
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2289
+
2290
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2291
+
2292
+ var React = _dereq_('react');
2293
+ var PropTypes = React.PropTypes;
2294
+
2295
+ var Flex = function (_React$Component) {
2296
+ _inherits(Flex, _React$Component);
2297
+
2298
+ function Flex() {
2299
+ _classCallCheck(this, Flex);
2300
+
2301
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2302
+ }
2303
+
2304
+ Flex.prototype.render = function render() {
2305
+ var className = 'cf-flex';
2306
+
2307
+ if (this.props.spacing) {
2308
+ className += ' cf-flex--' + this.props.spacing;
2309
+ }
2310
+
2311
+ return React.createElement(
2312
+ 'div',
2313
+ { className: className },
2314
+ this.props.children
2315
+ );
2316
+ };
2317
+
2318
+ return Flex;
2319
+ }(React.Component);
2320
+
2321
+ Flex.propTypes = {
2322
+ spacing: PropTypes.oneOf([false, 'thin', 'wide']).isRequired
2323
+ };
2324
+
2325
+
2326
+ module.exports = Flex;
2327
+ },{"react":511}],63:[function(_dereq_,module,exports){
2328
+ 'use strict';
2329
+
2330
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2331
+
2332
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2333
+
2334
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2335
+
2336
+ var React = _dereq_('react');
2337
+ var PropTypes = React.PropTypes;
2338
+
2339
+ var FlexItem = function (_React$Component) {
2340
+ _inherits(FlexItem, _React$Component);
2341
+
2342
+ function FlexItem() {
2343
+ _classCallCheck(this, FlexItem);
2344
+
2345
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2346
+ }
2347
+
2348
+ FlexItem.prototype.render = function render() {
2349
+ var className = 'cf-flex__item';
2350
+
2351
+ if (this.props.collapse) {
2352
+ className += ' cf-flex__item--collapse';
2353
+ }
2354
+
2355
+ return React.createElement(
2356
+ 'div',
2357
+ { className: className },
2358
+ this.props.children
2359
+ );
2360
+ };
2361
+
2362
+ return FlexItem;
2363
+ }(React.Component);
2364
+
2365
+ FlexItem.propTypes = {
2366
+ collapse: PropTypes.bool
2367
+ };
2368
+ FlexItem.defaultProps = {
2369
+ collapse: false
2370
+ };
2371
+
2372
+
2373
+ module.exports = FlexItem;
2374
+ },{"react":511}],64:[function(_dereq_,module,exports){
2375
+ 'use strict';
2376
+
2377
+ exports.Flex = _dereq_('./Flex');
2378
+ exports.FlexItem = _dereq_('./FlexItem');
2379
+ },{"./Flex":62,"./FlexItem":63}],65:[function(_dereq_,module,exports){
2380
+ 'use strict';
2381
+
2382
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2383
+
2384
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2385
+
2386
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2387
+
2388
+ var React = _dereq_('react');
2389
+ var PropTypes = React.PropTypes;
2390
+
2391
+ var Form = function (_React$Component) {
2392
+ _inherits(Form, _React$Component);
2393
+
2394
+ function Form() {
2395
+ _classCallCheck(this, Form);
2396
+
2397
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2398
+ }
2399
+
2400
+ Form.prototype.render = function render() {
2401
+ var className = 'cf-form cf-form--' + this.props.layout;
2402
+ return React.createElement(
2403
+ 'form',
2404
+ { className: className, onSubmit: this.props.onSubmit },
2405
+ this.props.children
2406
+ );
2407
+ };
2408
+
2409
+ return Form;
2410
+ }(React.Component);
2411
+
2412
+ Form.propTypes = {
2413
+ layout: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,
2414
+ onSubmit: PropTypes.func.isRequired
2415
+ };
2416
+
2417
+
2418
+ module.exports = Form;
2419
+ },{"react":511}],66:[function(_dereq_,module,exports){
2420
+ "use strict";
2421
+
2422
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2423
+
2424
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2425
+
2426
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2427
+
2428
+ var React = _dereq_('react');
2429
+ var PropTypes = React.PropTypes;
2430
+
2431
+ var FormFieldError = function (_React$Component) {
2432
+ _inherits(FormFieldError, _React$Component);
2433
+
2434
+ function FormFieldError() {
2435
+ _classCallCheck(this, FormFieldError);
2436
+
2437
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2438
+ }
2439
+
2440
+ FormFieldError.prototype.render = function render() {
2441
+ var _this2 = this;
2442
+
2443
+ if (!this.props.field.invalid) {
2444
+ // Turn this into "null" after upgraded to React 15+
2445
+ return React.createElement("noscript", null);
2446
+ }
2447
+
2448
+ return React.createElement(
2449
+ "div",
2450
+ { className: "cf-form__field-error" },
2451
+ Object.keys(this.props.validations).map(function (validation) {
2452
+ return React.createElement(
2453
+ "p",
2454
+ { key: validation },
2455
+ _this2.props.validations[validation]
2456
+ );
2457
+ })
2458
+ );
2459
+ };
2460
+
2461
+ return FormFieldError;
2462
+ }(React.Component);
2463
+
2464
+ FormFieldError.propTypes = {
2465
+ field: PropTypes.object.isRequired,
2466
+ validations: PropTypes.object.isRequired
2467
+ };
2468
+
2469
+
2470
+ module.exports = FormFieldError;
2471
+ },{"react":511}],67:[function(_dereq_,module,exports){
2472
+ "use strict";
2473
+
2474
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2475
+
2476
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2477
+
2478
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2479
+
2480
+ var React = _dereq_('react');
2481
+ var PropTypes = React.PropTypes;
2482
+
2483
+ var FormFieldset = function (_React$Component) {
2484
+ _inherits(FormFieldset, _React$Component);
2485
+
2486
+ function FormFieldset() {
2487
+ _classCallCheck(this, FormFieldset);
2488
+
2489
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2490
+ }
2491
+
2492
+ FormFieldset.prototype.render = function render() {
2493
+ return React.createElement(
2494
+ "fieldset",
2495
+ { className: "cf-form__fieldset" },
2496
+ React.createElement(
2497
+ "legend",
2498
+ { className: "cf-form__fieldset_legend" },
2499
+ this.props.legend
2500
+ ),
2501
+ React.createElement(
2502
+ "div",
2503
+ { className: "cf-form__fieldset_content" },
2504
+ this.props.children
2505
+ )
2506
+ );
2507
+ };
2508
+
2509
+ return FormFieldset;
2510
+ }(React.Component);
2511
+
2512
+ FormFieldset.propTypes = {
2513
+ legend: PropTypes.string.isRequired
2514
+ };
2515
+
2516
+
2517
+ module.exports = FormFieldset;
2518
+ },{"react":511}],68:[function(_dereq_,module,exports){
2519
+ "use strict";
2520
+
2521
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2522
+
2523
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2524
+
2525
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2526
+
2527
+ var React = _dereq_('react');
2528
+ var PropTypes = React.PropTypes;
2529
+
2530
+ var FormFooter = function (_React$Component) {
2531
+ _inherits(FormFooter, _React$Component);
2532
+
2533
+ function FormFooter() {
2534
+ _classCallCheck(this, FormFooter);
2535
+
2536
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2537
+ }
2538
+
2539
+ FormFooter.prototype.render = function render() {
2540
+ return React.createElement(
2541
+ "div",
2542
+ { className: "cf-form__footer" },
2543
+ this.props.children
2544
+ );
2545
+ };
2546
+
2547
+ return FormFooter;
2548
+ }(React.Component);
2549
+
2550
+ module.exports = FormFooter;
2551
+ },{"react":511}],69:[function(_dereq_,module,exports){
2552
+ "use strict";
2553
+
2554
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2555
+
2556
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2557
+
2558
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2559
+
2560
+ var React = _dereq_('react');
2561
+ var PropTypes = React.PropTypes;
2562
+
2563
+ var FormHeader = function (_React$Component) {
2564
+ _inherits(FormHeader, _React$Component);
2565
+
2566
+ function FormHeader() {
2567
+ _classCallCheck(this, FormHeader);
2568
+
2569
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2570
+ }
2571
+
2572
+ FormHeader.prototype.render = function render() {
2573
+ return React.createElement(
2574
+ "div",
2575
+ { className: "cf-form__header" },
2576
+ React.createElement(
2577
+ "h3",
2578
+ { className: "cf-form__title" },
2579
+ this.props.title
2580
+ )
2581
+ );
2582
+ };
2583
+
2584
+ return FormHeader;
2585
+ }(React.Component);
2586
+
2587
+ FormHeader.propTypes = {
2588
+ title: PropTypes.string.isRequired
2589
+ };
2590
+
2591
+
2592
+ module.exports = FormHeader;
2593
+ },{"react":511}],70:[function(_dereq_,module,exports){
2594
+ 'use strict';
2595
+
2596
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2597
+
2598
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2599
+
2600
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2601
+
2602
+ var React = _dereq_('react');
2603
+ var PropTypes = React.PropTypes;
2604
+
2605
+ var FormLabel = function (_React$Component) {
2606
+ _inherits(FormLabel, _React$Component);
2607
+
2608
+ function FormLabel() {
2609
+ _classCallCheck(this, FormLabel);
2610
+
2611
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2612
+ }
2613
+
2614
+ FormLabel.prototype.render = function render() {
2615
+ var className = 'cf-form__label';
2616
+
2617
+ if (this.props.hidden) {
2618
+ className += ' cf-form__label--hidden';
2619
+ }
2620
+
2621
+ return React.createElement(
2622
+ 'label',
2623
+ { className: className },
2624
+ this.props.children
2625
+ );
2626
+ };
2627
+
2628
+ return FormLabel;
2629
+ }(React.Component);
2630
+
2631
+ FormLabel.propTypes = {
2632
+ hidden: PropTypes.bool
2633
+ };
2634
+
2635
+
2636
+ module.exports = FormLabel;
2637
+ },{"react":511}],71:[function(_dereq_,module,exports){
2638
+ 'use strict';
2639
+
2640
+ exports.Form = _dereq_('./Form');
2641
+ exports.FormHeader = _dereq_('./FormHeader');
2642
+ exports.FormFooter = _dereq_('./FormFooter');
2643
+ exports.FormFieldset = _dereq_('./FormFieldset');
2644
+ exports.FormLabel = _dereq_('./FormLabel');
2645
+ exports.FormFieldError = _dereq_('./FormFieldError');
2646
+ },{"./Form":65,"./FormFieldError":66,"./FormFieldset":67,"./FormFooter":68,"./FormHeader":69,"./FormLabel":70}],72:[function(_dereq_,module,exports){
2647
+ 'use strict';
2648
+
2649
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2650
+
2651
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2652
+
2653
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2654
+
2655
+ var React = _dereq_('react');
2656
+ var PropTypes = React.PropTypes;
2657
+
2658
+ var Heading = function (_React$Component) {
2659
+ _inherits(Heading, _React$Component);
2660
+
2661
+ function Heading() {
2662
+ _classCallCheck(this, Heading);
2663
+
2664
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2665
+ }
2666
+
2667
+ Heading.prototype.render = function render() {
2668
+ var tagName = 'h' + this.props.size;
2669
+ var className = 'cf-heading cf-heading--' + this.props.size;
2670
+ return React.createElement(tagName, { className: className }, this.props.children);
2671
+ };
2672
+
2673
+ return Heading;
2674
+ }(React.Component);
2675
+
2676
+ Heading.propTypes = {
2677
+ size: PropTypes.oneOf([1, 2, 3, 4, 5, 6]).isRequired
2678
+ };
2679
+
2680
+
2681
+ module.exports = Heading;
2682
+ },{"react":511}],73:[function(_dereq_,module,exports){
2683
+ "use strict";
2684
+
2685
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2686
+
2687
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2688
+
2689
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2690
+
2691
+ var React = _dereq_('react');
2692
+
2693
+ var HeadingCaption = function (_React$Component) {
2694
+ _inherits(HeadingCaption, _React$Component);
2695
+
2696
+ function HeadingCaption() {
2697
+ _classCallCheck(this, HeadingCaption);
2698
+
2699
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2700
+ }
2701
+
2702
+ HeadingCaption.prototype.render = function render() {
2703
+ return React.createElement(
2704
+ "small",
2705
+ { className: "cf-heading__caption" },
2706
+ this.props.children
2707
+ );
2708
+ };
2709
+
2710
+ return HeadingCaption;
2711
+ }(React.Component);
2712
+
2713
+ module.exports = HeadingCaption;
2714
+ },{"react":511}],74:[function(_dereq_,module,exports){
2715
+ 'use strict';
2716
+
2717
+ exports.Heading = _dereq_('./Heading');
2718
+ exports.HeadingCaption = _dereq_('./HeadingCaption');
2719
+ },{"./Heading":72,"./HeadingCaption":73}],75:[function(_dereq_,module,exports){
2720
+ 'use strict';
2721
+
2722
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2723
+
2724
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2725
+
2726
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2727
+
2728
+ var React = _dereq_('react');
2729
+ var PropTypes = React.PropTypes;
2730
+
2731
+ var Input = function (_React$Component) {
2732
+ _inherits(Input, _React$Component);
2733
+
2734
+ function Input() {
2735
+ var _temp, _this, _ret;
2736
+
2737
+ _classCallCheck(this, Input);
2738
+
2739
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
2740
+ args[_key] = arguments[_key];
2741
+ }
2742
+
2743
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) {
2744
+ _this.props.onChange(e.target.value);
2745
+ }, _temp), _possibleConstructorReturn(_this, _ret);
2746
+ }
2747
+
2748
+ Input.prototype.render = function render() {
2749
+ var className = 'cf-input cf-input--' + this.props.type;
2750
+
2751
+ if (this.props.invalid) {
2752
+ className += ' cf-input--invalid';
2753
+ }
2754
+
2755
+ return React.createElement('input', {
2756
+ type: this.props.type,
2757
+ className: className,
2758
+ name: this.props.name,
2759
+ value: this.props.value,
2760
+ onChange: this.handleChange,
2761
+ placeholder: this.props.placeholder });
2762
+ };
2763
+
2764
+ return Input;
2765
+ }(React.Component);
2766
+
2767
+ Input.propTypes = {
2768
+ type: PropTypes.oneOf(['text', 'email', 'number', 'password', 'search']),
2769
+ name: PropTypes.string.isRequired,
2770
+ value: PropTypes.string.isRequired,
2771
+ onChange: PropTypes.func.isRequired,
2772
+ placeholder: PropTypes.string,
2773
+ invalid: PropTypes.bool
2774
+ };
2775
+ Input.defaultProps = {
2776
+ type: 'text'
2777
+ };
2778
+
2779
+
2780
+ module.exports = Input;
2781
+ },{"react":511}],76:[function(_dereq_,module,exports){
2782
+ 'use strict';
2783
+
2784
+ module.exports = _dereq_('./Input');
2785
+ },{"./Input":75}],77:[function(_dereq_,module,exports){
2786
+ 'use strict';
2787
+
2788
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2789
+
2790
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2791
+
2792
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2793
+
2794
+ var React = _dereq_('react');
2795
+ var PropTypes = React.PropTypes;
2796
+
2797
+ var LayoutColumn = function (_React$Component) {
2798
+ _inherits(LayoutColumn, _React$Component);
2799
+
2800
+ function LayoutColumn() {
2801
+ _classCallCheck(this, LayoutColumn);
2802
+
2803
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2804
+ }
2805
+
2806
+ LayoutColumn.prototype.render = function render() {
2807
+ var width = (this.props.width * 100).toPrecision(5) + '%';
2808
+ return React.createElement(
2809
+ 'div',
2810
+ { className: 'cf-layout__column', style: { width: width } },
2811
+ this.props.children
2812
+ );
2813
+ };
2814
+
2815
+ return LayoutColumn;
2816
+ }(React.Component);
2817
+
2818
+ LayoutColumn.propTypes = {
2819
+ width: PropTypes.number.isRequired
2820
+ };
2821
+
2822
+
2823
+ module.exports = LayoutColumn;
2824
+ },{"react":511}],78:[function(_dereq_,module,exports){
2825
+ "use strict";
2826
+
2827
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2828
+
2829
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2830
+
2831
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2832
+
2833
+ var React = _dereq_('react');
2834
+
2835
+ var LayoutContainer = function (_React$Component) {
2836
+ _inherits(LayoutContainer, _React$Component);
2837
+
2838
+ function LayoutContainer() {
2839
+ _classCallCheck(this, LayoutContainer);
2840
+
2841
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2842
+ }
2843
+
2844
+ LayoutContainer.prototype.render = function render() {
2845
+ return React.createElement(
2846
+ "div",
2847
+ { className: "cf-layout__container" },
2848
+ this.props.children
2849
+ );
2850
+ };
2851
+
2852
+ return LayoutContainer;
2853
+ }(React.Component);
2854
+
2855
+ module.exports = LayoutContainer;
2856
+ },{"react":511}],79:[function(_dereq_,module,exports){
2857
+ "use strict";
2858
+
2859
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2860
+
2861
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2862
+
2863
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2864
+
2865
+ var React = _dereq_('react');
2866
+
2867
+ var LayoutRow = function (_React$Component) {
2868
+ _inherits(LayoutRow, _React$Component);
2869
+
2870
+ function LayoutRow() {
2871
+ _classCallCheck(this, LayoutRow);
2872
+
2873
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
2874
+ }
2875
+
2876
+ LayoutRow.prototype.render = function render() {
2877
+ return React.createElement(
2878
+ "div",
2879
+ { className: "cf-layout__row" },
2880
+ this.props.children
2881
+ );
2882
+ };
2883
+
2884
+ return LayoutRow;
2885
+ }(React.Component);
2886
+
2887
+ module.exports = LayoutRow;
2888
+ },{"react":511}],80:[function(_dereq_,module,exports){
2889
+ 'use strict';
2890
+
2891
+ exports.LayoutContainer = _dereq_('./LayoutContainer');
2892
+ exports.LayoutRow = _dereq_('./LayoutRow');
2893
+ exports.LayoutColumn = _dereq_('./LayoutColumn');
2894
+ },{"./LayoutColumn":77,"./LayoutContainer":78,"./LayoutRow":79}],81:[function(_dereq_,module,exports){
2895
+ 'use strict';
2896
+
2897
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
2898
+
2899
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2900
+
2901
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2902
+
2903
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2904
+
2905
+ var React = _dereq_('react');
2906
+ var PropTypes = React.PropTypes;
2907
+
2908
+ var _require = _dereq_('cf-util-route-handler');
2909
+
2910
+ var routeTo = _require.routeTo;
2911
+
2912
+ var Link = function (_React$Component) {
2913
+ _inherits(Link, _React$Component);
2914
+
2915
+ function Link(props, context) {
2916
+ _classCallCheck(this, Link);
2917
+
2918
+ if (!props.to && !props.onClick) {
2919
+ throw new Error('<Link/> requires either a `to` or `onClick` prop');
2920
+ }
2921
+
2922
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
2923
+
2924
+ _this.handleClick = function (e) {
2925
+ e.preventDefault();
2926
+
2927
+ if (_this.props.disabled) {
2928
+ return;
2929
+ }
2930
+
2931
+ if (_this.props.to) {
2932
+ routeTo(_this.props.to);
2933
+ } else {
2934
+ _this.props.onClick(e);
2935
+ }
2936
+ };
2937
+
2938
+ return _this;
2939
+ }
2940
+
2941
+ Link.prototype.render = function render() {
2942
+ var _props = this.props;
2943
+ var tagName = _props.tagName;
2944
+ var to = _props.to;
2945
+ var children = _props.children;
2946
+ var className = _props.className;
2947
+ var disabled = _props.disabled;
2948
+
2949
+ var props = _objectWithoutProperties(_props, ['tagName', 'to', 'children', 'className', 'disabled']);
2950
+
2951
+ if (!props.href && tagName === 'a') {
2952
+ props.href = to || '#!';
2953
+ }
2954
+
2955
+ if (!props.role) {
2956
+ if (to && tagName !== 'a') {
2957
+ props.role = 'link';
2958
+ } else if (!to) {
2959
+ props.role = 'button';
2960
+ }
2961
+ }
2962
+
2963
+ props.className = 'cf-link';
2964
+
2965
+ if (disabled) {
2966
+ props.className += ' cf-link--disabled';
2967
+ props.disabled = true;
2968
+ }
2969
+
2970
+ if (className) {
2971
+ props.className += ' ' + className;
2972
+ }
2973
+
2974
+ props.onClick = this.handleClick;
2975
+
2976
+ return React.createElement(tagName, props, children);
2977
+ };
2978
+
2979
+ return Link;
2980
+ }(React.Component);
2981
+
2982
+ Link.propTypes = {
2983
+ to: PropTypes.string,
2984
+ onClick: PropTypes.func,
2985
+ tagName: PropTypes.string,
2986
+ disabled: PropTypes.bool
2987
+ };
2988
+ Link.defaultProps = {
2989
+ tagName: 'a'
2990
+ };
2991
+
2992
+ module.exports = Link;
2993
+ },{"cf-util-route-handler":83,"react":511}],82:[function(_dereq_,module,exports){
2994
+ arguments[4][18][0].apply(exports,arguments)
2995
+ },{"./Link":81,"dup":18}],83:[function(_dereq_,module,exports){
2996
+ 'use strict';
2997
+
2998
+ exports.__esModule = true;
2999
+ exports.handleRoutes = handleRoutes;
3000
+ exports.routeTo = routeTo;
3001
+ var handler = undefined;
3002
+
3003
+ function handleRoutes(callback) {
3004
+ if (handler) {
3005
+ throw new Error('Only one handler is allowed at a time');
3006
+ }
3007
+
3008
+ handler = callback;
3009
+ }
3010
+
3011
+ function routeTo(url) {
3012
+ if (!handler) {
3013
+ throw new Error('A handler needs to be setup before you can route');
3014
+ }
3015
+
3016
+ handler(url);
3017
+ }
3018
+ },{}],84:[function(_dereq_,module,exports){
3019
+ 'use strict';
3020
+
3021
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3022
+
3023
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3024
+
3025
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3026
+
3027
+ var React = _dereq_('react');
3028
+ var PropTypes = React.PropTypes;
3029
+
3030
+ var List = function (_React$Component) {
3031
+ _inherits(List, _React$Component);
3032
+
3033
+ function List() {
3034
+ _classCallCheck(this, List);
3035
+
3036
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3037
+ }
3038
+
3039
+ List.prototype.render = function render() {
3040
+ var tagName = 'ul';
3041
+ var className = 'cf-list';
3042
+
3043
+ if (this.props.ordered) {
3044
+ tagName = 'ol';
3045
+ className += ' cf-list--ordered';
3046
+ }
3047
+
3048
+ if (this.props.unstyled) {
3049
+ className += ' cf-list--unstyled';
3050
+ }
3051
+
3052
+ return React.createElement(tagName, { className: className }, this.props.children);
3053
+ };
3054
+
3055
+ return List;
3056
+ }(React.Component);
3057
+
3058
+ List.propTypes = {
3059
+ ordered: PropTypes.bool,
3060
+ unstyled: PropTypes.bool
3061
+ };
3062
+ List.defaultProps = {
3063
+ ordered: false,
3064
+ unstyled: false
3065
+ };
3066
+
3067
+
3068
+ module.exports = List;
3069
+ },{"react":511}],85:[function(_dereq_,module,exports){
3070
+ "use strict";
3071
+
3072
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3073
+
3074
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3075
+
3076
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3077
+
3078
+ var React = _dereq_('react');
3079
+
3080
+ var ListItem = function (_React$Component) {
3081
+ _inherits(ListItem, _React$Component);
3082
+
3083
+ function ListItem() {
3084
+ _classCallCheck(this, ListItem);
3085
+
3086
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3087
+ }
3088
+
3089
+ ListItem.prototype.render = function render() {
3090
+ return React.createElement(
3091
+ "li",
3092
+ { className: "cf-list__item" },
3093
+ this.props.children
3094
+ );
3095
+ };
3096
+
3097
+ return ListItem;
3098
+ }(React.Component);
3099
+
3100
+ module.exports = ListItem;
3101
+ },{"react":511}],86:[function(_dereq_,module,exports){
3102
+ 'use strict';
3103
+
3104
+ exports.List = _dereq_('./List');
3105
+ exports.ListItem = _dereq_('./ListItem');
3106
+ },{"./List":84,"./ListItem":85}],87:[function(_dereq_,module,exports){
3107
+ 'use strict';
3108
+
3109
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3110
+
3111
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3112
+
3113
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3114
+
3115
+ var React = _dereq_('react');
3116
+ var Icon = _dereq_('cf-component-icon');
3117
+
3118
+ var Loading = function (_React$Component) {
3119
+ _inherits(Loading, _React$Component);
3120
+
3121
+ function Loading() {
3122
+ _classCallCheck(this, Loading);
3123
+
3124
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3125
+ }
3126
+
3127
+ Loading.prototype.render = function render() {
3128
+ return React.createElement(Icon, { type: 'loading', label: 'Loading' });
3129
+ };
3130
+
3131
+ return Loading;
3132
+ }(React.Component);
3133
+
3134
+ module.exports = Loading;
3135
+ },{"cf-component-icon":90,"react":511}],88:[function(_dereq_,module,exports){
3136
+ 'use strict';
3137
+
3138
+ module.exports = _dereq_('./Loading');
3139
+ },{"./Loading":87}],89:[function(_dereq_,module,exports){
3140
+ 'use strict';
3141
+
3142
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3143
+
3144
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3145
+
3146
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3147
+
3148
+ var React = _dereq_('react');
3149
+ var PropTypes = React.PropTypes;
3150
+
3151
+ var _require = _dereq_('./options');
3152
+
3153
+ var TYPES = _require.TYPES;
3154
+ var SIZES = _require.SIZES;
3155
+
3156
+ var Icon = function (_React$Component) {
3157
+ _inherits(Icon, _React$Component);
3158
+
3159
+ function Icon() {
3160
+ _classCallCheck(this, Icon);
3161
+
3162
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3163
+ }
3164
+
3165
+ Icon.prototype.render = function render() {
3166
+ var className = 'cf-icon cf-icon--' + this.props.type;
3167
+
3168
+ if (this.props.size) {
3169
+ className += ' cf-icon--' + this.props.size;
3170
+ }
3171
+
3172
+ if (this.props.border) className += ' cf-icon--border';
3173
+ if (this.props.spin) className += ' cf-icon--spin';
3174
+ if (this.props.muted) className += ' cf-icon--muted';
3175
+ if (this.props.white) className += ' cf-icon--white';
3176
+
3177
+ return React.createElement(
3178
+ 'i',
3179
+ { className: className },
3180
+ this.props.label && React.createElement(
3181
+ 'span',
3182
+ { className: 'cf-icon__label' },
3183
+ this.props.label
3184
+ )
3185
+ );
3186
+ };
3187
+
3188
+ return Icon;
3189
+ }(React.Component);
3190
+
3191
+ Icon.propTypes = {
3192
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
3193
+ type: PropTypes.oneOf(TYPES).isRequired,
3194
+ size: PropTypes.oneOf(SIZES),
3195
+ border: PropTypes.bool,
3196
+ spin: PropTypes.bool,
3197
+ muted: PropTypes.bool,
3198
+ white: PropTypes.bool
3199
+ };
3200
+ ;
3201
+
3202
+ module.exports = Icon;
3203
+ },{"./options":91,"react":511}],90:[function(_dereq_,module,exports){
3204
+ 'use strict';
3205
+
3206
+ module.exports = _dereq_('./Icon');
3207
+ },{"./Icon":89}],91:[function(_dereq_,module,exports){
3208
+ 'use strict';
3209
+
3210
+ exports.TYPES = ('caret-up chevron-up caret-down chevron-down caret-left chevron-left ' + 'caret-right chevron-right ok-sign exclamation-sign info-sign pause time ' + 'ok clipboard bolt chart drive filter flowchart hamburger lock list file ' + 'shield plus happy sad search wrench remove remove-sign speech gear help ' + 'widen calendar facebook twitter googleplus linkedin resize-horizontal ' + 'upload loading close').split(' ');
3211
+
3212
+ exports.SIZES = '2x 3x 4x large xlarge'.split(' ');
3213
+ },{}],92:[function(_dereq_,module,exports){
3214
+ 'use strict';
3215
+
3216
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3217
+
3218
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3219
+
3220
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3221
+
3222
+ var React = _dereq_('react');
3223
+ var PropTypes = React.PropTypes;
3224
+
3225
+ var ReactModal2 = _dereq_('react-modal2').default;
3226
+
3227
+ var _require = _dereq_('react-gateway');
3228
+
3229
+ var Gateway = _require.Gateway;
3230
+
3231
+ var ReactCSSTransitionGroup = _dereq_('react-addons-css-transition-group');
3232
+
3233
+ var Modal = function (_React$Component) {
3234
+ _inherits(Modal, _React$Component);
3235
+
3236
+ function Modal() {
3237
+ _classCallCheck(this, Modal);
3238
+
3239
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3240
+ }
3241
+
3242
+ Modal.prototype.render = function render() {
3243
+ var modalClassName = 'cf-modal';
3244
+
3245
+ if (this.props.type === 'confirm') {
3246
+ modalClassName += ' cf-modal--confirm';
3247
+ }
3248
+
3249
+ return React.createElement(
3250
+ Gateway,
3251
+ { into: 'modal' },
3252
+ React.createElement(
3253
+ ReactCSSTransitionGroup,
3254
+ {
3255
+ transitionName: 'cf-transition-modal',
3256
+ transitionAppear: true,
3257
+ transitionAppearTimeout: 200,
3258
+ transitionEnterTimeout: 200,
3259
+ transitionLeaveTimeout: 200 },
3260
+ this.props.isOpen && React.createElement(
3261
+ 'div',
3262
+ { className: 'cf-modal__backdrop-scroller' },
3263
+ React.createElement(
3264
+ 'div',
3265
+ { className: 'cf-modal__backdrop-outer' },
3266
+ React.createElement(
3267
+ ReactModal2,
3268
+ {
3269
+ ref: 'modal',
3270
+ key: 'modal',
3271
+ backdropClassName: 'cf-modal__backdrop',
3272
+ modalClassName: modalClassName,
3273
+ closeOnEsc: this.props.closeOnEsc,
3274
+ closeOnBackdropClick: this.props.closeOnBackdropClick,
3275
+ onClose: this.props.onRequestClose },
3276
+ this.props.children
3277
+ )
3278
+ )
3279
+ )
3280
+ )
3281
+ );
3282
+ };
3283
+
3284
+ return Modal;
3285
+ }(React.Component);
3286
+
3287
+ Modal.propTypes = {
3288
+ type: PropTypes.oneOf(['confirm']),
3289
+ isOpen: PropTypes.bool.isRequired,
3290
+ onRequestClose: PropTypes.func.isRequired,
3291
+ closeOnEsc: PropTypes.bool,
3292
+ closeOnBackdropClick: PropTypes.bool
3293
+ };
3294
+ Modal.defaultProps = {
3295
+ closeOnEsc: true,
3296
+ closeOnBackdropClick: true
3297
+ };
3298
+
3299
+ module.exports = Modal;
3300
+ },{"react":511,"react-addons-css-transition-group":272,"react-gateway":281,"react-modal2":101}],93:[function(_dereq_,module,exports){
3301
+ "use strict";
3302
+
3303
+ var React = _dereq_('react');
3304
+
3305
+ function ModalActions(props) {
3306
+ return React.createElement(
3307
+ "div",
3308
+ { className: "cf-modal__actions" },
3309
+ props.children
3310
+ );
3311
+ }
3312
+
3313
+ module.exports = ModalActions;
3314
+ },{"react":511}],94:[function(_dereq_,module,exports){
3315
+ "use strict";
3316
+
3317
+ var React = _dereq_('react');
3318
+
3319
+ function ModalBody(props) {
3320
+ return React.createElement(
3321
+ "div",
3322
+ { className: "cf-modal__body" },
3323
+ props.children
3324
+ );
3325
+ }
3326
+
3327
+ module.exports = ModalBody;
3328
+ },{"react":511}],95:[function(_dereq_,module,exports){
3329
+ "use strict";
3330
+
3331
+ var React = _dereq_('react');
3332
+ var PropTypes = React.PropTypes;
3333
+
3334
+ function ModalClose(props) {
3335
+ return React.createElement("span", { className: "cf-modal__close", onClick: props.onClick });
3336
+ }
3337
+
3338
+ ModalClose.propTypes = {
3339
+ onClick: PropTypes.func.isRequired
3340
+ };
3341
+
3342
+ module.exports = ModalClose;
3343
+ },{"react":511}],96:[function(_dereq_,module,exports){
3344
+ 'use strict';
3345
+
3346
+ var React = _dereq_('react');
3347
+ var PropTypes = React.PropTypes;
3348
+
3349
+ function ModalFooter(props) {
3350
+ var className = 'cf-modal__footer';
3351
+
3352
+ if (props.simple) {
3353
+ className += ' cf-modal__footer--simple';
3354
+ }
3355
+
3356
+ return React.createElement(
3357
+ 'div',
3358
+ { className: className },
3359
+ props.children
3360
+ );
3361
+ }
3362
+
3363
+ ModalFooter.propTypes = {
3364
+ simple: PropTypes.bool
3365
+ };
3366
+ ModalFooter.defaultProps = {
3367
+ simple: false
3368
+ };
3369
+
3370
+ module.exports = ModalFooter;
3371
+ },{"react":511}],97:[function(_dereq_,module,exports){
3372
+ "use strict";
3373
+
3374
+ var React = _dereq_('react');
3375
+
3376
+ function ModalHeader(props) {
3377
+ return React.createElement(
3378
+ "header",
3379
+ { className: "cf-modal__header" },
3380
+ props.children
3381
+ );
3382
+ }
3383
+
3384
+ module.exports = ModalHeader;
3385
+ },{"react":511}],98:[function(_dereq_,module,exports){
3386
+ "use strict";
3387
+
3388
+ var React = _dereq_('react');
3389
+
3390
+ function ModalTitle(props) {
3391
+ return React.createElement(
3392
+ "h4",
3393
+ { className: "cf-modal__title" },
3394
+ props.children
3395
+ );
3396
+ }
3397
+
3398
+ module.exports = ModalTitle;
3399
+ },{"react":511}],99:[function(_dereq_,module,exports){
3400
+ 'use strict';
3401
+
3402
+ exports.Modal = _dereq_('./Modal');
3403
+ exports.ModalActions = _dereq_('./ModalActions');
3404
+ exports.ModalBody = _dereq_('./ModalBody');
3405
+ exports.ModalClose = _dereq_('./ModalClose');
3406
+ exports.ModalFooter = _dereq_('./ModalFooter');
3407
+ exports.ModalHeader = _dereq_('./ModalHeader');
3408
+ exports.ModalTitle = _dereq_('./ModalTitle');
3409
+ },{"./Modal":92,"./ModalActions":93,"./ModalBody":94,"./ModalClose":95,"./ModalFooter":96,"./ModalHeader":97,"./ModalTitle":98}],100:[function(_dereq_,module,exports){
3410
+ 'use strict';
3411
+
3412
+ exports.__esModule = true;
3413
+
3414
+ var _react = _dereq_('react');
3415
+
3416
+ var _react2 = _interopRequireDefault(_react);
3417
+
3418
+ var _a11yFocusScope = _dereq_('a11y-focus-scope');
3419
+
3420
+ var _a11yFocusScope2 = _interopRequireDefault(_a11yFocusScope);
3421
+
3422
+ var _a11yFocusStore = _dereq_('a11y-focus-store');
3423
+
3424
+ var _a11yFocusStore2 = _interopRequireDefault(_a11yFocusStore);
3425
+
3426
+ var _exenv = _dereq_('exenv');
3427
+
3428
+ var _exenv2 = _interopRequireDefault(_exenv);
3429
+
3430
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3431
+
3432
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3433
+
3434
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3435
+
3436
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3437
+
3438
+ function setFocusOn(applicationElement, element) {
3439
+ _a11yFocusStore2.default.storeFocus();
3440
+ if (applicationElement) applicationElement.setAttribute('aria-hidden', 'true');
3441
+ _a11yFocusScope2.default.scopeFocus(element);
3442
+ }
3443
+
3444
+ function resetFocus(applicationElement) {
3445
+ _a11yFocusScope2.default.unscopeFocus();
3446
+ if (applicationElement) applicationElement.removeAttribute('aria-hidden');
3447
+ _a11yFocusStore2.default.restoreFocus();
3448
+ }
3449
+
3450
+ var ReactModal2 = function (_React$Component) {
3451
+ _inherits(ReactModal2, _React$Component);
3452
+
3453
+ function ReactModal2() {
3454
+ var _temp, _this, _ret;
3455
+
3456
+ _classCallCheck(this, ReactModal2);
3457
+
3458
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
3459
+ args[_key] = arguments[_key];
3460
+ }
3461
+
3462
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleDocumentKeydown = function (event) {
3463
+ if (_this.props.closeOnEsc && event.keyCode === 27) {
3464
+ _this.props.onClose();
3465
+ }
3466
+ }, _this.handleBackdropClick = function () {
3467
+ if (_this.props.closeOnBackdropClick) {
3468
+ _this.props.onClose();
3469
+ }
3470
+ }, _this.handleModalClick = function (event) {
3471
+ event.stopPropagation();
3472
+ }, _temp), _possibleConstructorReturn(_this, _ret);
3473
+ }
3474
+
3475
+ ReactModal2.getApplicationElement = function getApplicationElement() {
3476
+ console.warn('`ReactModal2.getApplicationElement` needs to be set for accessibility reasons');
3477
+ };
3478
+
3479
+ ReactModal2.prototype.componentDidMount = function componentDidMount() {
3480
+ if (_exenv2.default.canUseDOM) {
3481
+ setFocusOn(ReactModal2.getApplicationElement(), this.refs.modal);
3482
+ document.addEventListener('keydown', this.handleDocumentKeydown);
3483
+ }
3484
+ };
3485
+
3486
+ ReactModal2.prototype.componentWillUnmount = function componentWillUnmount() {
3487
+ if (_exenv2.default.canUseDOM) {
3488
+ resetFocus(ReactModal2.getApplicationElement());
3489
+ document.removeEventListener('keydown', this.handleDocumentKeydown);
3490
+ }
3491
+ };
3492
+
3493
+ ReactModal2.prototype.render = function render() {
3494
+ return _react2.default.createElement(
3495
+ 'div',
3496
+ { ref: 'backdrop',
3497
+ className: this.props.backdropClassName,
3498
+ style: this.props.backdropStyles,
3499
+ onClick: this.handleBackdropClick },
3500
+ _react2.default.createElement(
3501
+ 'div',
3502
+ { ref: 'modal',
3503
+ className: this.props.modalClassName,
3504
+ style: this.props.modalStyles,
3505
+ onClick: this.handleModalClick,
3506
+ tabIndex: '-1' },
3507
+ this.props.children
3508
+ )
3509
+ );
3510
+ };
3511
+
3512
+ return ReactModal2;
3513
+ }(_react2.default.Component);
3514
+
3515
+ ReactModal2.propTypes = {
3516
+ onClose: _react2.default.PropTypes.func.isRequired,
3517
+
3518
+ closeOnEsc: _react2.default.PropTypes.bool,
3519
+ closeOnBackdropClick: _react2.default.PropTypes.bool,
3520
+
3521
+ backdropClassName: _react2.default.PropTypes.string,
3522
+ backdropStyles: _react2.default.PropTypes.object,
3523
+
3524
+ modalClassName: _react2.default.PropTypes.string,
3525
+ modalStyles: _react2.default.PropTypes.object
3526
+ };
3527
+ ReactModal2.defaultProps = {
3528
+ closeOnEsc: true,
3529
+ closeOnBackdropClick: true
3530
+ };
3531
+ exports.default = ReactModal2;
3532
+ },{"a11y-focus-scope":102,"a11y-focus-store":105,"exenv":106,"react":511}],101:[function(_dereq_,module,exports){
3533
+ 'use strict';
3534
+
3535
+ exports.__esModule = true;
3536
+ exports.default = undefined;
3537
+
3538
+ var _Modal = _dereq_('./Modal');
3539
+
3540
+ var _Modal2 = _interopRequireDefault(_Modal);
3541
+
3542
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3543
+
3544
+ exports.default = _Modal2.default;
3545
+ },{"./Modal":100}],102:[function(_dereq_,module,exports){
3546
+ 'use strict';
3547
+
3548
+ var tabbable = _dereq_('tabbable');
3549
+ var focusin = _dereq_('focusin');
3550
+ var polyfilled = false;
3551
+
3552
+ function init(element) {
3553
+
3554
+ // lazily polyfill focusin for firefox
3555
+ if (!polyfilled) {
3556
+ focusin.polyfill();
3557
+ polyfilled = true;
3558
+ }
3559
+
3560
+ function focus() {
3561
+ (tabbable(element)[0] || element).focus()
3562
+ }
3563
+
3564
+ function onFocusIn(event) {
3565
+ if (element !== event.target && !element.contains(event.target)) {
3566
+ focus();
3567
+ }
3568
+ }
3569
+
3570
+ focus();
3571
+
3572
+ document.addEventListener('focusin', onFocusIn);
3573
+
3574
+ return function teardown() {
3575
+ document.removeEventListener('focusin', onFocusIn);
3576
+ };
3577
+ }
3578
+
3579
+ var teardownFn;
3580
+
3581
+ exports.scopeFocus = function(element) {
3582
+ if (teardownFn) teardownFn();
3583
+ teardownFn = init(element);
3584
+ };
3585
+
3586
+ exports.unscopeFocus = function() {
3587
+ if (teardownFn) teardownFn();
3588
+ teardownFn = null;
3589
+ };
3590
+
3591
+ },{"focusin":103,"tabbable":104}],103:[function(_dereq_,module,exports){
3592
+ /* from https://gist.github.com/nuxodin/9250e56a3ce6c0446efa */
3593
+
3594
+ function polyfill () {
3595
+ var w = window
3596
+ var d = w.document
3597
+
3598
+ if (w.onfocusin === undefined) {
3599
+ d.addEventListener('focus', addPolyfill, true)
3600
+ d.addEventListener('blur', addPolyfill, true)
3601
+ d.addEventListener('focusin', removePolyfill, true)
3602
+ d.addEventListener('focusout', removePolyfill, true)
3603
+ }
3604
+
3605
+ function addPolyfill (e) {
3606
+ var type = e.type === 'focus' ? 'focusin' : 'focusout'
3607
+ var event = new window.CustomEvent(type, { bubbles: true, cancelable: false })
3608
+ event.c1Generated = true
3609
+ e.target.dispatchEvent(event)
3610
+ }
3611
+
3612
+ function removePolyfill (e) {
3613
+ if (!e.c1Generated) {
3614
+ d.removeEventListener('focus', addPolyfill, true)
3615
+ d.removeEventListener('blur', addPolyfill, true)
3616
+ d.removeEventListener('focusin', removePolyfill, true)
3617
+ d.removeEventListener('focusout', removePolyfill, true)
3618
+ }
3619
+ setTimeout(function () {
3620
+ d.removeEventListener('focusin', removePolyfill, true)
3621
+ d.removeEventListener('focusout', removePolyfill, true)
3622
+ })
3623
+ }
3624
+ }
3625
+
3626
+ module.exports = {
3627
+ polyfill: polyfill
3628
+ }
3629
+
3630
+ },{}],104:[function(_dereq_,module,exports){
3631
+ module.exports = function(el) {
3632
+ var basicTabbables = [];
3633
+ var orderedTabbables = [];
3634
+ var isHidden = createIsHidden();
3635
+
3636
+ var candidates = el.querySelectorAll('input, select, a[href], textarea, button, [tabindex]');
3637
+
3638
+ var candidate, candidateIndex;
3639
+ for (var i = 0, l = candidates.length; i < l; i++) {
3640
+ candidate = candidates[i];
3641
+ candidateIndex = candidate.tabIndex;
3642
+
3643
+ if (
3644
+ candidateIndex < 0
3645
+ || (candidate.tagName === 'INPUT' && candidate.type === 'hidden')
3646
+ || candidate.disabled
3647
+ || isHidden(candidate)
3648
+ ) {
3649
+ continue;
3650
+ }
3651
+
3652
+ if (candidateIndex === 0) {
3653
+ basicTabbables.push(candidate);
3654
+ } else {
3655
+ orderedTabbables.push({
3656
+ tabIndex: candidateIndex,
3657
+ node: candidate,
3658
+ });
3659
+ }
3660
+ }
3661
+
3662
+ var tabbableNodes = orderedTabbables
3663
+ .sort(function(a, b) {
3664
+ return a.tabIndex - b.tabIndex;
3665
+ })
3666
+ .map(function(a) {
3667
+ return a.node
3668
+ });
3669
+
3670
+ Array.prototype.push.apply(tabbableNodes, basicTabbables);
3671
+
3672
+ return tabbableNodes;
3673
+ }
3674
+
3675
+ function createIsHidden() {
3676
+ // Node cache must be refreshed on every check, in case
3677
+ // the content of the element has changed
3678
+ var nodeCache = [];
3679
+
3680
+ return function isHidden(node) {
3681
+ if (node === document.documentElement) return false;
3682
+
3683
+ // Find the cached node (Array.prototype.find not available in IE9)
3684
+ for (var i = 0, length = nodeCache.length; i < length; i++) {
3685
+ if (nodeCache[i][0] === node) return nodeCache[i][1];
3686
+ }
3687
+
3688
+ var result = false;
3689
+ var style = window.getComputedStyle(node);
3690
+ if (style.visibility === 'hidden' || style.display === 'none') {
3691
+ result = true;
3692
+ } else if (node.parentNode) {
3693
+ result = isHidden(node.parentNode);
3694
+ }
3695
+
3696
+ nodeCache.push([node, result]);
3697
+
3698
+ return result;
3699
+ }
3700
+ }
3701
+
3702
+ },{}],105:[function(_dereq_,module,exports){
3703
+ 'use strict';
3704
+
3705
+ var storedFocusElement;
3706
+
3707
+ exports.storeFocus = function() {
3708
+ storedFocusElement = document.activeElement;
3709
+ };
3710
+
3711
+ exports.clearStoredFocus = function() {
3712
+ storedFocusElement = null;
3713
+ };
3714
+
3715
+ exports.restoreFocus = function() {
3716
+ if (!storedFocusElement) return;
3717
+ try { storedFocusElement.focus(); } catch (err) {}
3718
+ storedFocusElement = null;
3719
+ };
3720
+
3721
+ },{}],106:[function(_dereq_,module,exports){
3722
+ arguments[4][61][0].apply(exports,arguments)
3723
+ },{"dup":61}],107:[function(_dereq_,module,exports){
3724
+ 'use strict';
3725
+
3726
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3727
+
3728
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3729
+
3730
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3731
+
3732
+ var React = _dereq_('react');
3733
+ var PropTypes = React.PropTypes;
3734
+
3735
+ var raf = _dereq_('raf');
3736
+
3737
+ var Notification = function (_React$Component) {
3738
+ _inherits(Notification, _React$Component);
3739
+
3740
+ function Notification() {
3741
+ var _temp, _this, _ret;
3742
+
3743
+ _classCallCheck(this, Notification);
3744
+
3745
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
3746
+ args[_key] = arguments[_key];
3747
+ }
3748
+
3749
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
3750
+ persist: _this.props.persist,
3751
+ timeoutId: null
3752
+ }, _temp), _possibleConstructorReturn(_this, _ret);
3753
+ }
3754
+
3755
+ Notification.prototype.componentDidMount = function componentDidMount() {
3756
+ var _this2 = this;
3757
+
3758
+ // Wait two frames to ensure that the notification has rendered for the
3759
+ // animation to occur. Stupid browsers...
3760
+ this._raf = raf(function () {
3761
+ _this2._raf = raf(function () {
3762
+ _this2._raf = null;
3763
+ _this2.startTimeout();
3764
+ });
3765
+ });
3766
+ };
3767
+
3768
+ Notification.prototype.componentWillUnmount = function componentWillUnmount() {
3769
+ this.stopTimeout();
3770
+ };
3771
+
3772
+ Notification.prototype.startTimeout = function startTimeout() {
3773
+ var _this3 = this;
3774
+
3775
+ if (this.state.persist) {
3776
+ return;
3777
+ }
3778
+ this.stopTimeout();
3779
+ var timeoutId = setTimeout(function () {
3780
+ return _this3.props.onClose();
3781
+ }, this.props.delay);
3782
+ this.setState({ timeoutId: timeoutId });
3783
+ };
3784
+
3785
+ Notification.prototype.stopTimeout = function stopTimeout() {
3786
+ if (this._raf) {
3787
+ raf.cancel(this._raf);
3788
+ this._raf = null;
3789
+ }
3790
+ if (this.state.timeoutId) {
3791
+ clearTimeout(this.state.timeoutId);
3792
+ this.setState({ timeoutId: null });
3793
+ }
3794
+ };
3795
+
3796
+ Notification.prototype.handleMouseEnter = function handleMouseEnter() {
3797
+ this.stopTimeout();
3798
+ };
3799
+
3800
+ Notification.prototype.handleMouseLeave = function handleMouseLeave() {
3801
+ this.startTimeout();
3802
+ };
3803
+
3804
+ Notification.prototype.handleClickClose = function handleClickClose() {
3805
+ this.props.onClose();
3806
+ };
3807
+
3808
+ Notification.prototype.handleClick = function handleClick() {
3809
+ this.stopTimeout();
3810
+ this.setState({
3811
+ persist: true
3812
+ });
3813
+ };
3814
+
3815
+ Notification.prototype.render = function render() {
3816
+ var className = 'cf-notifications__item';
3817
+ var progress = void 0;
3818
+
3819
+ className += ' cf-notifications__item--' + this.props.type;
3820
+
3821
+ if (this.state.persist) {
3822
+ className += ' cf-notifications__item--persist';
3823
+ } else {
3824
+ var progressClassName = 'cf-notifications__item_progress';
3825
+ var progressStyles = {};
3826
+
3827
+ if (this.state.timeoutId) {
3828
+ progressClassName += ' cf-notifications__item_progress--active';
3829
+ progressStyles.transitionDuration = this.props.delay + 'ms';
3830
+ }
3831
+
3832
+ progress = React.createElement('span', { className: progressClassName, style: progressStyles });
3833
+ }
3834
+
3835
+ var close = void 0;
3836
+
3837
+ if (this.props.closable) {
3838
+ close = React.createElement('span', {
3839
+ className: 'cf-notifications__item_close',
3840
+ onClick: this.handleClickClose.bind(this) });
3841
+ }
3842
+
3843
+ return React.createElement(
3844
+ 'div',
3845
+ {
3846
+ role: 'alert',
3847
+ className: className,
3848
+ onClick: this.handleClick.bind(this),
3849
+ onMouseEnter: this.handleMouseEnter.bind(this),
3850
+ onMouseLeave: this.handleMouseLeave.bind(this) },
3851
+ progress,
3852
+ close,
3853
+ React.createElement(
3854
+ 'span',
3855
+ { className: 'cf-notifications__item_message' },
3856
+ this.props.message
3857
+ )
3858
+ );
3859
+ };
3860
+
3861
+ return Notification;
3862
+ }(React.Component);
3863
+
3864
+ Notification.propTypes = {
3865
+ type: PropTypes.oneOf(['success', 'error', 'info', 'warning']),
3866
+ message: PropTypes.string.isRequired,
3867
+
3868
+ closable: PropTypes.bool,
3869
+ delay: PropTypes.number,
3870
+ persist: PropTypes.bool,
3871
+
3872
+ onClose: PropTypes.func.isRequired
3873
+ };
3874
+ Notification.defaultProps = {
3875
+ closable: true,
3876
+ delay: 4000,
3877
+ persist: false
3878
+ };
3879
+
3880
+
3881
+ module.exports = Notification;
3882
+ },{"raf":111,"react":511}],108:[function(_dereq_,module,exports){
3883
+ "use strict";
3884
+
3885
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3886
+
3887
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3888
+
3889
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3890
+
3891
+ var React = _dereq_('react');
3892
+
3893
+ var NotificationGlobalContainer = function (_React$Component) {
3894
+ _inherits(NotificationGlobalContainer, _React$Component);
3895
+
3896
+ function NotificationGlobalContainer() {
3897
+ _classCallCheck(this, NotificationGlobalContainer);
3898
+
3899
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3900
+ }
3901
+
3902
+ NotificationGlobalContainer.prototype.render = function render() {
3903
+ return React.createElement(
3904
+ "div",
3905
+ { className: "cf-notifications__global_container" },
3906
+ this.props.children
3907
+ );
3908
+ };
3909
+
3910
+ return NotificationGlobalContainer;
3911
+ }(React.Component);
3912
+
3913
+ module.exports = NotificationGlobalContainer;
3914
+ },{"react":511}],109:[function(_dereq_,module,exports){
3915
+ "use strict";
3916
+
3917
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3918
+
3919
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3920
+
3921
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3922
+
3923
+ var React = _dereq_('react');
3924
+
3925
+ var NotificationList = function (_React$Component) {
3926
+ _inherits(NotificationList, _React$Component);
3927
+
3928
+ function NotificationList() {
3929
+ _classCallCheck(this, NotificationList);
3930
+
3931
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
3932
+ }
3933
+
3934
+ NotificationList.prototype.render = function render() {
3935
+ return React.createElement(
3936
+ "div",
3937
+ { className: "cf-notifications" },
3938
+ this.props.children
3939
+ );
3940
+ };
3941
+
3942
+ return NotificationList;
3943
+ }(React.Component);
3944
+
3945
+ module.exports = NotificationList;
3946
+ },{"react":511}],110:[function(_dereq_,module,exports){
3947
+ 'use strict';
3948
+
3949
+ exports.NotificationList = _dereq_('./NotificationList');
3950
+ exports.Notification = _dereq_('./Notification');
3951
+ exports.NotificationGlobalContainer = _dereq_('./NotificationGlobalContainer');
3952
+ },{"./Notification":107,"./NotificationGlobalContainer":108,"./NotificationList":109}],111:[function(_dereq_,module,exports){
3953
+ (function (global){
3954
+ var now = _dereq_('performance-now')
3955
+ , root = typeof window === 'undefined' ? global : window
3956
+ , vendors = ['moz', 'webkit']
3957
+ , suffix = 'AnimationFrame'
3958
+ , raf = root['request' + suffix]
3959
+ , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
3960
+
3961
+ for(var i = 0; !raf && i < vendors.length; i++) {
3962
+ raf = root[vendors[i] + 'Request' + suffix]
3963
+ caf = root[vendors[i] + 'Cancel' + suffix]
3964
+ || root[vendors[i] + 'CancelRequest' + suffix]
3965
+ }
3966
+
3967
+ // Some versions of FF have rAF but not cAF
3968
+ if(!raf || !caf) {
3969
+ var last = 0
3970
+ , id = 0
3971
+ , queue = []
3972
+ , frameDuration = 1000 / 60
3973
+
3974
+ raf = function(callback) {
3975
+ if(queue.length === 0) {
3976
+ var _now = now()
3977
+ , next = Math.max(0, frameDuration - (_now - last))
3978
+ last = next + _now
3979
+ setTimeout(function() {
3980
+ var cp = queue.slice(0)
3981
+ // Clear queue here to prevent
3982
+ // callbacks from appending listeners
3983
+ // to the current frame's queue
3984
+ queue.length = 0
3985
+ for(var i = 0; i < cp.length; i++) {
3986
+ if(!cp[i].cancelled) {
3987
+ try{
3988
+ cp[i].callback(last)
3989
+ } catch(e) {
3990
+ setTimeout(function() { throw e }, 0)
3991
+ }
3992
+ }
3993
+ }
3994
+ }, Math.round(next))
3995
+ }
3996
+ queue.push({
3997
+ handle: ++id,
3998
+ callback: callback,
3999
+ cancelled: false
4000
+ })
4001
+ return id
4002
+ }
4003
+
4004
+ caf = function(handle) {
4005
+ for(var i = 0; i < queue.length; i++) {
4006
+ if(queue[i].handle === handle) {
4007
+ queue[i].cancelled = true
4008
+ }
4009
+ }
4010
+ }
4011
+ }
4012
+
4013
+ module.exports = function(fn) {
4014
+ // Wrap in a new function to prevent
4015
+ // `cancel` potentially being assigned
4016
+ // to the native rAF function
4017
+ return raf.call(root, fn)
4018
+ }
4019
+ module.exports.cancel = function() {
4020
+ caf.apply(root, arguments)
4021
+ }
4022
+ module.exports.polyfill = function() {
4023
+ root.requestAnimationFrame = raf
4024
+ root.cancelAnimationFrame = caf
4025
+ }
4026
+
4027
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4028
+
4029
+ },{"performance-now":112}],112:[function(_dereq_,module,exports){
4030
+ (function (process){
4031
+ // Generated by CoffeeScript 1.7.1
4032
+ (function() {
4033
+ var getNanoSeconds, hrtime, loadTime;
4034
+
4035
+ if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
4036
+ module.exports = function() {
4037
+ return performance.now();
4038
+ };
4039
+ } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
4040
+ module.exports = function() {
4041
+ return (getNanoSeconds() - loadTime) / 1e6;
4042
+ };
4043
+ hrtime = process.hrtime;
4044
+ getNanoSeconds = function() {
4045
+ var hr;
4046
+ hr = hrtime();
4047
+ return hr[0] * 1e9 + hr[1];
4048
+ };
4049
+ loadTime = getNanoSeconds();
4050
+ } else if (Date.now) {
4051
+ module.exports = function() {
4052
+ return Date.now() - loadTime;
4053
+ };
4054
+ loadTime = Date.now();
4055
+ } else {
4056
+ module.exports = function() {
4057
+ return new Date().getTime() - loadTime;
4058
+ };
4059
+ loadTime = new Date().getTime();
4060
+ }
4061
+
4062
+ }).call(this);
4063
+
4064
+ }).call(this,_dereq_('_process'))
4065
+
4066
+ },{"_process":2}],113:[function(_dereq_,module,exports){
4067
+ 'use strict';
4068
+
4069
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4070
+
4071
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4072
+
4073
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4074
+
4075
+ var React = _dereq_('react');
4076
+ var PropTypes = React.PropTypes;
4077
+
4078
+ var Radio = function (_React$Component) {
4079
+ _inherits(Radio, _React$Component);
4080
+
4081
+ function Radio() {
4082
+ var _temp, _this, _ret;
4083
+
4084
+ _classCallCheck(this, Radio);
4085
+
4086
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
4087
+ args[_key] = arguments[_key];
4088
+ }
4089
+
4090
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) {
4091
+ _this.props.onChange(e.target.value);
4092
+ }, _temp), _possibleConstructorReturn(_this, _ret);
4093
+ }
4094
+
4095
+ Radio.prototype.render = function render() {
4096
+ var className = 'cf-radio';
4097
+
4098
+ if (this.props.checked) {
4099
+ className += ' cf-radio--checked';
4100
+ }
4101
+
4102
+ return React.createElement(
4103
+ 'label',
4104
+ { htmlFor: this.props.name, className: className },
4105
+ React.createElement('input', { type: 'radio',
4106
+ className: 'cf-radio__input',
4107
+ id: this.props.name,
4108
+ name: this.props.name,
4109
+ value: this.props.value,
4110
+ checked: this.props.checked,
4111
+ onChange: this.handleChange }),
4112
+ this.props.label && React.createElement(
4113
+ 'span',
4114
+ { className: 'cf-radio__label' },
4115
+ this.props.label
4116
+ )
4117
+ );
4118
+ };
4119
+
4120
+ return Radio;
4121
+ }(React.Component);
4122
+
4123
+ Radio.propTypes = {
4124
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
4125
+ name: PropTypes.string.isRequired,
4126
+ value: PropTypes.string.isRequired,
4127
+ checked: PropTypes.bool.isRequired,
4128
+ onChange: PropTypes.func.isRequired
4129
+ };
4130
+
4131
+
4132
+ module.exports = Radio;
4133
+ },{"react":511}],114:[function(_dereq_,module,exports){
4134
+ 'use strict';
4135
+
4136
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4137
+
4138
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4139
+
4140
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4141
+
4142
+ var React = _dereq_('react');
4143
+ var PropTypes = React.PropTypes;
4144
+
4145
+ var Radio = _dereq_('./Radio');
4146
+
4147
+ var RadioGroup = function (_React$Component) {
4148
+ _inherits(RadioGroup, _React$Component);
4149
+
4150
+ function RadioGroup() {
4151
+ _classCallCheck(this, RadioGroup);
4152
+
4153
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
4154
+ }
4155
+
4156
+ RadioGroup.prototype.render = function render() {
4157
+ var _this2 = this;
4158
+
4159
+ return React.createElement(
4160
+ 'div',
4161
+ { className: 'cf-radio__group' },
4162
+ this.props.options.map(function (option) {
4163
+ return React.createElement(Radio, {
4164
+ key: option.name,
4165
+ label: option.label,
4166
+ name: option.name,
4167
+ value: option.value,
4168
+ checked: _this2.props.value === option.value,
4169
+ onChange: _this2.props.onChange });
4170
+ })
4171
+ );
4172
+ };
4173
+
4174
+ return RadioGroup;
4175
+ }(React.Component);
4176
+
4177
+ RadioGroup.propTypes = {
4178
+ value: PropTypes.string.isRequired,
4179
+ onChange: PropTypes.func.isRequired,
4180
+ options: PropTypes.arrayOf(PropTypes.shape({
4181
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
4182
+ name: PropTypes.string.isRequired,
4183
+ value: PropTypes.string.isRequired
4184
+ })).isRequired
4185
+ };
4186
+
4187
+
4188
+ module.exports = RadioGroup;
4189
+ },{"./Radio":113,"react":511}],115:[function(_dereq_,module,exports){
4190
+ 'use strict';
4191
+
4192
+ exports.Radio = _dereq_('./Radio');
4193
+ exports.RadioGroup = _dereq_('./RadioGroup');
4194
+ },{"./Radio":113,"./RadioGroup":114}],116:[function(_dereq_,module,exports){
4195
+ 'use strict';
4196
+
4197
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4198
+
4199
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4200
+
4201
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4202
+
4203
+ var React = _dereq_('react');
4204
+ var PropTypes = React.PropTypes;
4205
+
4206
+ var ReactSelect = _dereq_('react-select');
4207
+
4208
+ var Select = function (_React$Component) {
4209
+ _inherits(Select, _React$Component);
4210
+
4211
+ function Select() {
4212
+ _classCallCheck(this, Select);
4213
+
4214
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
4215
+ }
4216
+
4217
+ Select.prototype.render = function render() {
4218
+ return React.createElement(
4219
+ 'div',
4220
+ { className: 'cf-select' },
4221
+ this.props.label && React.createElement(
4222
+ 'label',
4223
+ null,
4224
+ this.props.label
4225
+ ),
4226
+ React.createElement(ReactSelect
4227
+ // Simplify if this isnt a searchable select
4228
+ , { searchable: this.props.searchable,
4229
+ clearable: this.props.searchable,
4230
+ backspaceRemoves: this.props.searchable,
4231
+
4232
+ onChange: this.props.onChange,
4233
+ onBlur: this.props.onBlur,
4234
+ onFocus: this.props.onFocus,
4235
+
4236
+ multi: this.props.multi,
4237
+ value: this.props.value,
4238
+ options: this.props.options,
4239
+ placeholder: this.props.placeholder })
4240
+ );
4241
+ };
4242
+
4243
+ return Select;
4244
+ }(React.Component);
4245
+
4246
+ Select.propTypes = {
4247
+ label: PropTypes.string,
4248
+
4249
+ onChange: PropTypes.func.isRequired,
4250
+ onBlur: PropTypes.func,
4251
+ onFocus: PropTypes.func,
4252
+
4253
+ multi: PropTypes.bool,
4254
+ searchable: PropTypes.bool,
4255
+
4256
+ value: PropTypes.any,
4257
+ options: PropTypes.arrayOf(PropTypes.shape({
4258
+ label: PropTypes.string.isRequired,
4259
+ value: PropTypes.any.isRequired
4260
+ })),
4261
+ placeholder: PropTypes.string
4262
+ };
4263
+ Select.defaultProps = {
4264
+ multi: false,
4265
+ searchable: false
4266
+ };
4267
+ ;
4268
+
4269
+ module.exports = Select;
4270
+ },{"react":511,"react-select":119}],117:[function(_dereq_,module,exports){
4271
+ 'use strict';
4272
+
4273
+ module.exports = _dereq_('./Select');
4274
+ },{"./Select":116}],118:[function(_dereq_,module,exports){
4275
+ 'use strict';
4276
+
4277
+ var React = _dereq_('react');
4278
+ var classes = _dereq_('classnames');
4279
+
4280
+ var Option = React.createClass({
4281
+ displayName: 'Option',
4282
+
4283
+ propTypes: {
4284
+ addLabelText: React.PropTypes.string, // string rendered in case of allowCreate option passed to ReactSelect
4285
+ className: React.PropTypes.string, // className (based on mouse position)
4286
+ mouseDown: React.PropTypes.func, // method to handle click on option element
4287
+ mouseEnter: React.PropTypes.func, // method to handle mouseEnter on option element
4288
+ mouseLeave: React.PropTypes.func, // method to handle mouseLeave on option element
4289
+ option: React.PropTypes.object.isRequired, // object that is base for that option
4290
+ renderFunc: React.PropTypes.func // method passed to ReactSelect component to render label text
4291
+ },
4292
+ blockEvent: function blockEvent(event) {
4293
+ event.preventDefault();
4294
+ if (event.target.tagName !== 'A' || !('href' in event.target)) {
4295
+ return;
4296
+ }
4297
+
4298
+ if (event.target.target) {
4299
+ window.open(event.target.href);
4300
+ } else {
4301
+ window.location.href = event.target.href;
4302
+ }
4303
+ },
4304
+ handleMouseDown: function handleMouseDown(e) {
4305
+ this.props.mouseDown(this.props.option, e);
4306
+ },
4307
+ handleMouseEnter: function handleMouseEnter(e) {
4308
+ this.props.mouseEnter(this.props.option, e);
4309
+ },
4310
+ handleMouseLeave: function handleMouseLeave(e) {
4311
+ this.props.mouseLeave(this.props.option, e);
4312
+ },
4313
+ render: function render() {
4314
+ var option = this.props.option;
4315
+ var label = option.create ? this.props.addLabelText.replace('{label}', option.label) : this.props.renderFunc(option);
4316
+ var optionClasses = classes(this.props.className, option.className);
4317
+
4318
+ return option.disabled ? React.createElement(
4319
+ 'div',
4320
+ { className: optionClasses,
4321
+ onMouseDown: this.blockEvent,
4322
+ onClick: this.blockEvent },
4323
+ label
4324
+ ) : React.createElement(
4325
+ 'div',
4326
+ { className: optionClasses,
4327
+ style: option.style,
4328
+ onMouseDown: this.handleMouseDown,
4329
+ onMouseEnter: this.handleMouseEnter,
4330
+ onMouseLeave: this.handleMouseLeave,
4331
+ onClick: this.handleMouseDown,
4332
+ title: option.title },
4333
+ label
4334
+ );
4335
+ }
4336
+ });
4337
+
4338
+ module.exports = Option;
4339
+ },{"classnames":122,"react":511}],119:[function(_dereq_,module,exports){
4340
+ /* disable some rules until we refactor more completely; fixing them now would
4341
+ cause conflicts with some open PRs unnecessarily. */
4342
+ /* eslint react/jsx-sort-prop-types: 0, react/sort-comp: 0, react/prop-types: 0 */
4343
+
4344
+ 'use strict';
4345
+
4346
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4347
+
4348
+ function _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; }
4349
+
4350
+ var React = _dereq_('react');
4351
+ var ReactDOM = _dereq_('react-dom');
4352
+ var Input = _dereq_('react-input-autosize');
4353
+ var classes = _dereq_('classnames');
4354
+ var Value = _dereq_('./Value');
4355
+ var SingleValue = _dereq_('./SingleValue');
4356
+ var Option = _dereq_('./Option');
4357
+
4358
+ var requestId = 0;
4359
+
4360
+ var Select = React.createClass({
4361
+
4362
+ displayName: 'Select',
4363
+
4364
+ propTypes: {
4365
+ addLabelText: React.PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
4366
+ allowCreate: React.PropTypes.bool, // whether to allow creation of new entries
4367
+ asyncOptions: React.PropTypes.func, // function to call to get options
4368
+ autoload: React.PropTypes.bool, // whether to auto-load the default async options set
4369
+ backspaceRemoves: React.PropTypes.bool, // whether backspace removes an item if there is no text input
4370
+ cacheAsyncResults: React.PropTypes.bool, // whether to allow cache
4371
+ className: React.PropTypes.string, // className for the outer element
4372
+ clearAllText: React.PropTypes.string, // title for the "clear" control when multi: true
4373
+ clearValueText: React.PropTypes.string, // title for the "clear" control
4374
+ clearable: React.PropTypes.bool, // should it be possible to reset value
4375
+ delimiter: React.PropTypes.string, // delimiter to use to join multiple values
4376
+ disabled: React.PropTypes.bool, // whether the Select is disabled or not
4377
+ filterOption: React.PropTypes.func, // method to filter a single option (option, filterString)
4378
+ filterOptions: React.PropTypes.func, // method to filter the options array: function ([options], filterString, [values])
4379
+ ignoreCase: React.PropTypes.bool, // whether to perform case-insensitive filtering
4380
+ inputProps: React.PropTypes.object, // custom attributes for the Input (in the Select-control) e.g: {'data-foo': 'bar'}
4381
+ isLoading: React.PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
4382
+ labelKey: React.PropTypes.string, // path of the label value in option objects
4383
+ matchPos: React.PropTypes.string, // (any|start) match the start or entire string when filtering
4384
+ matchProp: React.PropTypes.string, // (any|label|value) which option property to filter on
4385
+ multi: React.PropTypes.bool, // multi-value input
4386
+ name: React.PropTypes.string, // field name, for hidden <input /> tag
4387
+ newOptionCreator: React.PropTypes.func, // factory to create new options when allowCreate set
4388
+ noResultsText: React.PropTypes.string, // placeholder displayed when there are no matching search results
4389
+ onBlur: React.PropTypes.func, // onBlur handler: function (event) {}
4390
+ onChange: React.PropTypes.func, // onChange handler: function (newValue) {}
4391
+ onFocus: React.PropTypes.func, // onFocus handler: function (event) {}
4392
+ onInputChange: React.PropTypes.func, // onInputChange handler: function (inputValue) {}
4393
+ onOptionLabelClick: React.PropTypes.func, // onCLick handler for value labels: function (value, event) {}
4394
+ optionComponent: React.PropTypes.func, // option component to render in dropdown
4395
+ optionRenderer: React.PropTypes.func, // optionRenderer: function (option) {}
4396
+ options: React.PropTypes.array, // array of options
4397
+ placeholder: React.PropTypes.string, // field placeholder, displayed when there's no value
4398
+ searchable: React.PropTypes.bool, // whether to enable searching feature or not
4399
+ searchingText: React.PropTypes.string, // message to display whilst options are loading via asyncOptions
4400
+ searchPromptText: React.PropTypes.string, // label to prompt for search input
4401
+ singleValueComponent: React.PropTypes.func, // single value component when multiple is set to false
4402
+ value: React.PropTypes.any, // initial field value
4403
+ valueComponent: React.PropTypes.func, // value component to render in multiple mode
4404
+ valueKey: React.PropTypes.string, // path of the label value in option objects
4405
+ valueRenderer: React.PropTypes.func // valueRenderer: function (option) {}
4406
+ },
4407
+
4408
+ getDefaultProps: function getDefaultProps() {
4409
+ return {
4410
+ addLabelText: 'Add "{label}"?',
4411
+ allowCreate: false,
4412
+ asyncOptions: undefined,
4413
+ autoload: true,
4414
+ backspaceRemoves: true,
4415
+ cacheAsyncResults: true,
4416
+ className: undefined,
4417
+ clearAllText: 'Clear all',
4418
+ clearValueText: 'Clear value',
4419
+ clearable: true,
4420
+ delimiter: ',',
4421
+ disabled: false,
4422
+ ignoreCase: true,
4423
+ inputProps: {},
4424
+ isLoading: false,
4425
+ labelKey: 'label',
4426
+ matchPos: 'any',
4427
+ matchProp: 'any',
4428
+ name: undefined,
4429
+ newOptionCreator: undefined,
4430
+ noResultsText: 'No results found',
4431
+ onChange: undefined,
4432
+ onInputChange: undefined,
4433
+ onOptionLabelClick: undefined,
4434
+ optionComponent: Option,
4435
+ options: undefined,
4436
+ placeholder: 'Select...',
4437
+ searchable: true,
4438
+ searchingText: 'Searching...',
4439
+ searchPromptText: 'Type to search',
4440
+ singleValueComponent: SingleValue,
4441
+ value: undefined,
4442
+ valueComponent: Value,
4443
+ valueKey: 'value'
4444
+ };
4445
+ },
4446
+
4447
+ getInitialState: function getInitialState() {
4448
+ return {
4449
+ /*
4450
+ * set by getStateFromValue on componentWillMount:
4451
+ * - value
4452
+ * - values
4453
+ * - filteredOptions
4454
+ * - inputValue
4455
+ * - placeholder
4456
+ * - focusedOption
4457
+ */
4458
+ isFocused: false,
4459
+ isLoading: false,
4460
+ isOpen: false,
4461
+ options: this.props.options
4462
+ };
4463
+ },
4464
+
4465
+ componentWillMount: function componentWillMount() {
4466
+ var _this = this;
4467
+
4468
+ this._optionsCache = {};
4469
+ this._optionsFilterString = '';
4470
+ this._closeMenuIfClickedOutside = function (event) {
4471
+ if (!_this.state.isOpen) {
4472
+ return;
4473
+ }
4474
+ var menuElem = ReactDOM.findDOMNode(_this.refs.selectMenuContainer);
4475
+ var controlElem = ReactDOM.findDOMNode(_this.refs.control);
4476
+
4477
+ var eventOccuredOutsideMenu = _this.clickedOutsideElement(menuElem, event);
4478
+ var eventOccuredOutsideControl = _this.clickedOutsideElement(controlElem, event);
4479
+
4480
+ // Hide dropdown menu if click occurred outside of menu
4481
+ if (eventOccuredOutsideMenu && eventOccuredOutsideControl) {
4482
+ _this.setState({
4483
+ isOpen: false
4484
+ }, _this._unbindCloseMenuIfClickedOutside);
4485
+ }
4486
+ };
4487
+ this._bindCloseMenuIfClickedOutside = function () {
4488
+ if (!document.addEventListener && document.attachEvent) {
4489
+ document.attachEvent('onclick', _this._closeMenuIfClickedOutside);
4490
+ } else {
4491
+ document.addEventListener('click', _this._closeMenuIfClickedOutside);
4492
+ }
4493
+ };
4494
+ this._unbindCloseMenuIfClickedOutside = function () {
4495
+ if (!document.removeEventListener && document.detachEvent) {
4496
+ document.detachEvent('onclick', _this._closeMenuIfClickedOutside);
4497
+ } else {
4498
+ document.removeEventListener('click', _this._closeMenuIfClickedOutside);
4499
+ }
4500
+ };
4501
+ this.setState(this.getStateFromValue(this.props.value));
4502
+ },
4503
+
4504
+ componentDidMount: function componentDidMount() {
4505
+ if (this.props.asyncOptions && this.props.autoload) {
4506
+ this.autoloadAsyncOptions();
4507
+ }
4508
+ },
4509
+
4510
+ componentWillUnmount: function componentWillUnmount() {
4511
+ clearTimeout(this._blurTimeout);
4512
+ clearTimeout(this._focusTimeout);
4513
+ if (this.state.isOpen) {
4514
+ this._unbindCloseMenuIfClickedOutside();
4515
+ }
4516
+ },
4517
+
4518
+ componentWillReceiveProps: function componentWillReceiveProps(newProps) {
4519
+ var _this2 = this;
4520
+
4521
+ var optionsChanged = false;
4522
+ if (JSON.stringify(newProps.options) !== JSON.stringify(this.props.options)) {
4523
+ optionsChanged = true;
4524
+ this.setState({
4525
+ options: newProps.options,
4526
+ filteredOptions: this.filterOptions(newProps.options)
4527
+ });
4528
+ }
4529
+ if (newProps.value !== this.state.value || newProps.placeholder !== this.props.placeholder || optionsChanged) {
4530
+ var setState = function setState(newState) {
4531
+ _this2.setState(_this2.getStateFromValue(newProps.value, newState && newState.options || newProps.options, newProps.placeholder));
4532
+ };
4533
+ if (this.props.asyncOptions) {
4534
+ this.loadAsyncOptions(newProps.value, {}, setState);
4535
+ } else {
4536
+ setState();
4537
+ }
4538
+ }
4539
+ },
4540
+
4541
+ componentDidUpdate: function componentDidUpdate() {
4542
+ var _this3 = this;
4543
+
4544
+ if (!this.props.disabled && this._focusAfterUpdate) {
4545
+ clearTimeout(this._blurTimeout);
4546
+ clearTimeout(this._focusTimeout);
4547
+ this._focusTimeout = setTimeout(function () {
4548
+ if (!_this3.isMounted()) return;
4549
+ _this3.getInputNode().focus();
4550
+ _this3._focusAfterUpdate = false;
4551
+ }, 50);
4552
+ }
4553
+ if (this._focusedOptionReveal) {
4554
+ if (this.refs.focused && this.refs.menu) {
4555
+ var focusedDOM = ReactDOM.findDOMNode(this.refs.focused);
4556
+ var menuDOM = ReactDOM.findDOMNode(this.refs.menu);
4557
+ var focusedRect = focusedDOM.getBoundingClientRect();
4558
+ var menuRect = menuDOM.getBoundingClientRect();
4559
+
4560
+ if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
4561
+ menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
4562
+ }
4563
+ }
4564
+ this._focusedOptionReveal = false;
4565
+ }
4566
+ },
4567
+
4568
+ focus: function focus() {
4569
+ this.getInputNode().focus();
4570
+ },
4571
+
4572
+ clickedOutsideElement: function clickedOutsideElement(element, event) {
4573
+ var eventTarget = event.target ? event.target : event.srcElement;
4574
+ while (eventTarget != null) {
4575
+ if (eventTarget === element) return false;
4576
+ eventTarget = eventTarget.offsetParent;
4577
+ }
4578
+ return true;
4579
+ },
4580
+
4581
+ getStateFromValue: function getStateFromValue(value, options, placeholder) {
4582
+ var _this4 = this;
4583
+
4584
+ if (!options) {
4585
+ options = this.state.options;
4586
+ }
4587
+ if (!placeholder) {
4588
+ placeholder = this.props.placeholder;
4589
+ }
4590
+
4591
+ // reset internal filter string
4592
+ this._optionsFilterString = '';
4593
+
4594
+ var values = this.initValuesArray(value, options);
4595
+ var filteredOptions = this.filterOptions(options, values);
4596
+
4597
+ var focusedOption;
4598
+ var valueForState = null;
4599
+ if (!this.props.multi && values.length) {
4600
+ focusedOption = values[0];
4601
+ valueForState = values[0][this.props.valueKey];
4602
+ } else {
4603
+ focusedOption = this.getFirstFocusableOption(filteredOptions);
4604
+ valueForState = values.map(function (v) {
4605
+ return v[_this4.props.valueKey];
4606
+ }).join(this.props.delimiter);
4607
+ }
4608
+
4609
+ return {
4610
+ value: valueForState,
4611
+ values: values,
4612
+ inputValue: '',
4613
+ filteredOptions: filteredOptions,
4614
+ placeholder: !this.props.multi && values.length ? values[0][this.props.labelKey] : placeholder,
4615
+ focusedOption: focusedOption
4616
+ };
4617
+ },
4618
+
4619
+ getFirstFocusableOption: function getFirstFocusableOption(options) {
4620
+ for (var optionIndex = 0; optionIndex < options.length; ++optionIndex) {
4621
+ if (!options[optionIndex].disabled) {
4622
+ return options[optionIndex];
4623
+ }
4624
+ }
4625
+ },
4626
+
4627
+ initValuesArray: function initValuesArray(values, options) {
4628
+ var _this5 = this;
4629
+
4630
+ if (!Array.isArray(values)) {
4631
+ if (typeof values === 'string') {
4632
+ values = values === '' ? [] : this.props.multi ? values.split(this.props.delimiter) : [values];
4633
+ } else {
4634
+ values = values !== undefined && values !== null ? [values] : [];
4635
+ }
4636
+ }
4637
+ return values.map(function (val) {
4638
+ if (typeof val === 'string' || typeof val === 'number') {
4639
+ var _ref;
4640
+
4641
+ for (var key in options) {
4642
+ if (options.hasOwnProperty(key) && options[key] && (options[key][_this5.props.valueKey] === val || typeof options[key][_this5.props.valueKey] === 'number' && options[key][_this5.props.valueKey].toString() === val)) {
4643
+ return options[key];
4644
+ }
4645
+ }
4646
+ return _ref = {}, _defineProperty(_ref, _this5.props.valueKey, val), _defineProperty(_ref, _this5.props.labelKey, val), _ref;
4647
+ } else {
4648
+ return val;
4649
+ }
4650
+ });
4651
+ },
4652
+
4653
+ setValue: function setValue(value, focusAfterUpdate) {
4654
+ if (focusAfterUpdate || focusAfterUpdate === undefined) {
4655
+ this._focusAfterUpdate = true;
4656
+ }
4657
+ var newState = this.getStateFromValue(value);
4658
+ newState.isOpen = false;
4659
+ this.fireChangeEvent(newState);
4660
+ this.setState(newState);
4661
+ },
4662
+
4663
+ selectValue: function selectValue(value) {
4664
+ if (!this.props.multi) {
4665
+ this.setValue(value);
4666
+ } else if (value) {
4667
+ this.addValue(value);
4668
+ }
4669
+ this._unbindCloseMenuIfClickedOutside();
4670
+ },
4671
+
4672
+ addValue: function addValue(value) {
4673
+ this.setValue(this.state.values.concat(value));
4674
+ },
4675
+
4676
+ popValue: function popValue() {
4677
+ this.setValue(this.state.values.slice(0, this.state.values.length - 1));
4678
+ },
4679
+
4680
+ removeValue: function removeValue(valueToRemove) {
4681
+ this.setValue(this.state.values.filter(function (value) {
4682
+ return value !== valueToRemove;
4683
+ }));
4684
+ },
4685
+
4686
+ clearValue: function clearValue(event) {
4687
+ // if the event was triggered by a mousedown and not the primary
4688
+ // button, ignore it.
4689
+ if (event && event.type === 'mousedown' && event.button !== 0) {
4690
+ return;
4691
+ }
4692
+ event.stopPropagation();
4693
+ event.preventDefault();
4694
+ this.setValue(null);
4695
+ },
4696
+
4697
+ resetValue: function resetValue() {
4698
+ this.setValue(this.state.value === '' ? null : this.state.value);
4699
+ },
4700
+
4701
+ getInputNode: function getInputNode() {
4702
+ var input = this.refs.input;
4703
+ return this.props.searchable ? input : ReactDOM.findDOMNode(input);
4704
+ },
4705
+
4706
+ fireChangeEvent: function fireChangeEvent(newState) {
4707
+ if (newState.value !== this.state.value && this.props.onChange) {
4708
+ this.props.onChange(newState.value, newState.values);
4709
+ }
4710
+ },
4711
+
4712
+ handleMouseDown: function handleMouseDown(event) {
4713
+ // if the event was triggered by a mousedown and not the primary
4714
+ // button, or if the component is disabled, ignore it.
4715
+ if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
4716
+ return;
4717
+ }
4718
+ event.stopPropagation();
4719
+ event.preventDefault();
4720
+
4721
+ // for the non-searchable select, close the dropdown when button is clicked
4722
+ if (this.state.isOpen && !this.props.searchable) {
4723
+ this.setState({
4724
+ isOpen: false
4725
+ }, this._unbindCloseMenuIfClickedOutside);
4726
+ return;
4727
+ }
4728
+
4729
+ if (this.state.isFocused) {
4730
+ this.setState({
4731
+ isOpen: true
4732
+ }, this._bindCloseMenuIfClickedOutside);
4733
+ } else {
4734
+ this._openAfterFocus = true;
4735
+ this.getInputNode().focus();
4736
+ }
4737
+ },
4738
+
4739
+ handleMouseDownOnMenu: function handleMouseDownOnMenu(event) {
4740
+ // if the event was triggered by a mousedown and not the primary
4741
+ // button, or if the component is disabled, ignore it.
4742
+ if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
4743
+ return;
4744
+ }
4745
+ event.stopPropagation();
4746
+ event.preventDefault();
4747
+ },
4748
+
4749
+ handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
4750
+ // if the event was triggered by a mousedown and not the primary
4751
+ // button, or if the component is disabled, ignore it.
4752
+ if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
4753
+ return;
4754
+ }
4755
+ // If not focused, handleMouseDown will handle it
4756
+ if (!this.state.isOpen) {
4757
+ return;
4758
+ }
4759
+ event.stopPropagation();
4760
+ event.preventDefault();
4761
+ this.setState({
4762
+ isOpen: false
4763
+ }, this._unbindCloseMenuIfClickedOutside);
4764
+ },
4765
+
4766
+ handleInputFocus: function handleInputFocus(event) {
4767
+ var _this6 = this;
4768
+
4769
+ var newIsOpen = this.state.isOpen || this._openAfterFocus;
4770
+ this.setState({
4771
+ isFocused: true,
4772
+ isOpen: newIsOpen
4773
+ }, function () {
4774
+ if (newIsOpen) {
4775
+ _this6._bindCloseMenuIfClickedOutside();
4776
+ } else {
4777
+ _this6._unbindCloseMenuIfClickedOutside();
4778
+ }
4779
+ });
4780
+ this._openAfterFocus = false;
4781
+ if (this.props.onFocus) {
4782
+ this.props.onFocus(event);
4783
+ }
4784
+ },
4785
+
4786
+ handleInputBlur: function handleInputBlur(event) {
4787
+ var _this7 = this;
4788
+
4789
+ var menuDOM = ReactDOM.findDOMNode(this.refs.menu);
4790
+ if (document.activeElement.isEqualNode(menuDOM)) {
4791
+ return;
4792
+ }
4793
+ this._blurTimeout = setTimeout(function () {
4794
+ if (_this7._focusAfterUpdate || !_this7.isMounted()) return;
4795
+ _this7.setState({
4796
+ inputValue: '',
4797
+ isFocused: false,
4798
+ isOpen: false
4799
+ });
4800
+ }, 50);
4801
+ if (this.props.onBlur) {
4802
+ this.props.onBlur(event);
4803
+ }
4804
+ },
4805
+
4806
+ handleKeyDown: function handleKeyDown(event) {
4807
+ if (this.props.disabled) return;
4808
+ switch (event.keyCode) {
4809
+ case 8:
4810
+ // backspace
4811
+ if (!this.state.inputValue && this.props.backspaceRemoves) {
4812
+ event.preventDefault();
4813
+ this.popValue();
4814
+ }
4815
+ return;
4816
+ case 9:
4817
+ // tab
4818
+ if (event.shiftKey || !this.state.isOpen || !this.state.focusedOption) {
4819
+ return;
4820
+ }
4821
+ this.selectFocusedOption();
4822
+ break;
4823
+ case 13:
4824
+ // enter
4825
+ if (!this.state.isOpen) return;
4826
+ this.selectFocusedOption();
4827
+ break;
4828
+ case 27:
4829
+ // escape
4830
+ if (this.state.isOpen) {
4831
+ this.resetValue();
4832
+ } else if (this.props.clearable) {
4833
+ this.clearValue(event);
4834
+ }
4835
+ break;
4836
+ case 38:
4837
+ // up
4838
+ this.focusPreviousOption();
4839
+ break;
4840
+ case 40:
4841
+ // down
4842
+ this.focusNextOption();
4843
+ break;
4844
+ case 188:
4845
+ // ,
4846
+ if (this.props.allowCreate && this.props.multi) {
4847
+ event.preventDefault();
4848
+ event.stopPropagation();
4849
+ this.selectFocusedOption();
4850
+ } else {
4851
+ return;
4852
+ }
4853
+ break;
4854
+ default:
4855
+ return;
4856
+ }
4857
+ event.preventDefault();
4858
+ },
4859
+
4860
+ // Ensures that the currently focused option is available in filteredOptions.
4861
+ // If not, returns the first available option.
4862
+ _getNewFocusedOption: function _getNewFocusedOption(filteredOptions) {
4863
+ for (var key in filteredOptions) {
4864
+ if (filteredOptions.hasOwnProperty(key) && filteredOptions[key] === this.state.focusedOption) {
4865
+ return filteredOptions[key];
4866
+ }
4867
+ }
4868
+ return this.getFirstFocusableOption(filteredOptions);
4869
+ },
4870
+
4871
+ handleInputChange: function handleInputChange(event) {
4872
+ // assign an internal variable because we need to use
4873
+ // the latest value before setState() has completed.
4874
+ this._optionsFilterString = event.target.value;
4875
+ if (this.props.onInputChange) {
4876
+ this.props.onInputChange(event.target.value);
4877
+ }
4878
+ if (this.props.asyncOptions) {
4879
+ this.setState({
4880
+ isLoading: true,
4881
+ inputValue: event.target.value
4882
+ });
4883
+ this.loadAsyncOptions(event.target.value, {
4884
+ isLoading: false,
4885
+ isOpen: true
4886
+ }, this._bindCloseMenuIfClickedOutside);
4887
+ } else {
4888
+ var filteredOptions = this.filterOptions(this.state.options);
4889
+ this.setState({
4890
+ isOpen: true,
4891
+ inputValue: event.target.value,
4892
+ filteredOptions: filteredOptions,
4893
+ focusedOption: this._getNewFocusedOption(filteredOptions)
4894
+ }, this._bindCloseMenuIfClickedOutside);
4895
+ }
4896
+ },
4897
+
4898
+ autoloadAsyncOptions: function autoloadAsyncOptions() {
4899
+ var _this8 = this;
4900
+
4901
+ this.setState({
4902
+ isLoading: true
4903
+ });
4904
+ this.loadAsyncOptions('', { isLoading: false }, function () {
4905
+ // update with new options but don't focus
4906
+ _this8.setValue(_this8.props.value, false);
4907
+ });
4908
+ },
4909
+
4910
+ loadAsyncOptions: function loadAsyncOptions(input, state, callback) {
4911
+ if (input === undefined) input = '';
4912
+
4913
+ var _this9 = this;
4914
+
4915
+ var thisRequestId = this._currentRequestId = requestId++;
4916
+ if (this.props.cacheAsyncResults) {
4917
+ for (var i = 0; i <= input.length; i++) {
4918
+ var cacheKey = input.slice(0, i);
4919
+ if (this._optionsCache[cacheKey] && (input === cacheKey || this._optionsCache[cacheKey].complete)) {
4920
+ var options = this._optionsCache[cacheKey].options;
4921
+ var filteredOptions = this.filterOptions(options);
4922
+ var newState = {
4923
+ options: options,
4924
+ filteredOptions: filteredOptions,
4925
+ focusedOption: this._getNewFocusedOption(filteredOptions)
4926
+ };
4927
+ for (var key in state) {
4928
+ if (state.hasOwnProperty(key)) {
4929
+ newState[key] = state[key];
4930
+ }
4931
+ }
4932
+ this.setState(newState);
4933
+ if (callback) callback.call(this, newState);
4934
+ return;
4935
+ }
4936
+ }
4937
+ }
4938
+
4939
+ var optionsResponseHandler = function optionsResponseHandler(err, data) {
4940
+ if (err) throw err;
4941
+ if (_this9.props.cacheAsyncResults) {
4942
+ _this9._optionsCache[input] = data;
4943
+ }
4944
+ if (thisRequestId !== _this9._currentRequestId) {
4945
+ return;
4946
+ }
4947
+ var filteredOptions = _this9.filterOptions(data.options);
4948
+ var newState = {
4949
+ options: data.options,
4950
+ filteredOptions: filteredOptions,
4951
+ focusedOption: _this9._getNewFocusedOption(filteredOptions)
4952
+ };
4953
+ for (var key in state) {
4954
+ if (state.hasOwnProperty(key)) {
4955
+ newState[key] = state[key];
4956
+ }
4957
+ }
4958
+ _this9.setState(newState);
4959
+ if (callback) callback.call(_this9, newState);
4960
+ };
4961
+
4962
+ var asyncOpts = this.props.asyncOptions(input, optionsResponseHandler);
4963
+
4964
+ if (asyncOpts && typeof asyncOpts.then === 'function') {
4965
+ asyncOpts.then(function (data) {
4966
+ optionsResponseHandler(null, data);
4967
+ }, function (err) {
4968
+ optionsResponseHandler(err);
4969
+ });
4970
+ }
4971
+ },
4972
+
4973
+ filterOptions: function filterOptions(options, values) {
4974
+ var _this10 = this;
4975
+
4976
+ var filterValue = this._optionsFilterString;
4977
+ var exclude = (values || this.state.values).map(function (i) {
4978
+ return i[_this10.props.valueKey];
4979
+ });
4980
+ if (this.props.filterOptions) {
4981
+ return this.props.filterOptions.call(this, options, filterValue, exclude);
4982
+ } else {
4983
+ var filterOption = function filterOption(op) {
4984
+ if (this.props.multi && exclude.indexOf(op[this.props.valueKey]) > -1) return false;
4985
+ if (this.props.filterOption) return this.props.filterOption.call(this, op, filterValue);
4986
+ var valueTest = String(op[this.props.valueKey]);
4987
+ var labelTest = String(op[this.props.labelKey]);
4988
+ if (this.props.ignoreCase) {
4989
+ valueTest = valueTest.toLowerCase();
4990
+ labelTest = labelTest.toLowerCase();
4991
+ filterValue = filterValue.toLowerCase();
4992
+ }
4993
+ return !filterValue || this.props.matchPos === 'start' ? this.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || this.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : this.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || this.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
4994
+ };
4995
+ return (options || []).filter(filterOption, this);
4996
+ }
4997
+ },
4998
+
4999
+ selectFocusedOption: function selectFocusedOption() {
5000
+ if (this.props.allowCreate && !this.state.focusedOption) {
5001
+ return this.selectValue(this.state.inputValue);
5002
+ }
5003
+
5004
+ if (this.state.focusedOption) {
5005
+ return this.selectValue(this.state.focusedOption);
5006
+ }
5007
+ },
5008
+
5009
+ focusOption: function focusOption(op) {
5010
+ this.setState({
5011
+ focusedOption: op
5012
+ });
5013
+ },
5014
+
5015
+ focusNextOption: function focusNextOption() {
5016
+ this.focusAdjacentOption('next');
5017
+ },
5018
+
5019
+ focusPreviousOption: function focusPreviousOption() {
5020
+ this.focusAdjacentOption('previous');
5021
+ },
5022
+
5023
+ focusAdjacentOption: function focusAdjacentOption(dir) {
5024
+ this._focusedOptionReveal = true;
5025
+ var ops = this.state.filteredOptions.filter(function (op) {
5026
+ return !op.disabled;
5027
+ });
5028
+ if (!this.state.isOpen) {
5029
+ this.setState({
5030
+ isOpen: true,
5031
+ inputValue: '',
5032
+ focusedOption: this.state.focusedOption || ops[dir === 'next' ? 0 : ops.length - 1]
5033
+ }, this._bindCloseMenuIfClickedOutside);
5034
+ return;
5035
+ }
5036
+ if (!ops.length) {
5037
+ return;
5038
+ }
5039
+ var focusedIndex = -1;
5040
+ for (var i = 0; i < ops.length; i++) {
5041
+ if (this.state.focusedOption === ops[i]) {
5042
+ focusedIndex = i;
5043
+ break;
5044
+ }
5045
+ }
5046
+ var focusedOption = ops[0];
5047
+ if (dir === 'next' && focusedIndex > -1 && focusedIndex < ops.length - 1) {
5048
+ focusedOption = ops[focusedIndex + 1];
5049
+ } else if (dir === 'previous') {
5050
+ if (focusedIndex > 0) {
5051
+ focusedOption = ops[focusedIndex - 1];
5052
+ } else {
5053
+ focusedOption = ops[ops.length - 1];
5054
+ }
5055
+ }
5056
+ this.setState({
5057
+ focusedOption: focusedOption
5058
+ });
5059
+ },
5060
+
5061
+ unfocusOption: function unfocusOption(op) {
5062
+ if (this.state.focusedOption === op) {
5063
+ this.setState({
5064
+ focusedOption: null
5065
+ });
5066
+ }
5067
+ },
5068
+
5069
+ renderOptionLabel: function renderOptionLabel(op) {
5070
+ return op[this.props.labelKey];
5071
+ },
5072
+
5073
+ buildMenu: function buildMenu() {
5074
+ var focusedValue = this.state.focusedOption ? this.state.focusedOption[this.props.valueKey] : null;
5075
+ var renderLabel = this.props.optionRenderer || this.renderOptionLabel;
5076
+ if (this.state.filteredOptions.length > 0) {
5077
+ focusedValue = focusedValue == null ? this.state.filteredOptions[0] : focusedValue;
5078
+ }
5079
+ // Add the current value to the filtered options in last resort
5080
+ var options = this.state.filteredOptions;
5081
+ if (this.props.allowCreate && this.state.inputValue.trim()) {
5082
+ var inputValue = this.state.inputValue;
5083
+ options = options.slice();
5084
+ var newOption = this.props.newOptionCreator ? this.props.newOptionCreator(inputValue) : {
5085
+ value: inputValue,
5086
+ label: inputValue,
5087
+ create: true
5088
+ };
5089
+ options.unshift(newOption);
5090
+ }
5091
+ var ops = Object.keys(options).map(function (key) {
5092
+ var op = options[key];
5093
+ var isSelected = this.state.value === op[this.props.valueKey];
5094
+ var isFocused = focusedValue === op[this.props.valueKey];
5095
+ var optionClass = classes({
5096
+ 'Select-option': true,
5097
+ 'is-selected': isSelected,
5098
+ 'is-focused': isFocused,
5099
+ 'is-disabled': op.disabled
5100
+ });
5101
+ var ref = isFocused ? 'focused' : null;
5102
+ var optionResult = React.createElement(this.props.optionComponent, {
5103
+ key: 'option-' + op[this.props.valueKey],
5104
+ className: optionClass,
5105
+ renderFunc: renderLabel,
5106
+ mouseDown: this.selectValue,
5107
+ mouseEnter: this.focusOption,
5108
+ mouseLeave: this.unfocusOption,
5109
+ addLabelText: this.props.addLabelText,
5110
+ option: op,
5111
+ ref: ref
5112
+ });
5113
+ return optionResult;
5114
+ }, this);
5115
+
5116
+ if (ops.length) {
5117
+ return ops;
5118
+ } else {
5119
+ var noResultsText, promptClass;
5120
+ if (this.isLoading()) {
5121
+ promptClass = 'Select-searching';
5122
+ noResultsText = this.props.searchingText;
5123
+ } else if (this.state.inputValue || !this.props.asyncOptions) {
5124
+ promptClass = 'Select-noresults';
5125
+ noResultsText = this.props.noResultsText;
5126
+ } else {
5127
+ promptClass = 'Select-search-prompt';
5128
+ noResultsText = this.props.searchPromptText;
5129
+ }
5130
+
5131
+ return React.createElement(
5132
+ 'div',
5133
+ { className: promptClass },
5134
+ noResultsText
5135
+ );
5136
+ }
5137
+ },
5138
+
5139
+ handleOptionLabelClick: function handleOptionLabelClick(value, event) {
5140
+ if (this.props.onOptionLabelClick) {
5141
+ this.props.onOptionLabelClick(value, event);
5142
+ }
5143
+ },
5144
+
5145
+ isLoading: function isLoading() {
5146
+ return this.props.isLoading || this.state.isLoading;
5147
+ },
5148
+
5149
+ render: function render() {
5150
+ var selectClass = classes('Select', this.props.className, {
5151
+ 'Select--multi': this.props.multi,
5152
+ 'is-searchable': this.props.searchable,
5153
+ 'is-open': this.state.isOpen,
5154
+ 'is-focused': this.state.isFocused,
5155
+ 'is-loading': this.isLoading(),
5156
+ 'is-disabled': this.props.disabled,
5157
+ 'has-value': this.state.value
5158
+ });
5159
+ var value = [];
5160
+ if (this.props.multi) {
5161
+ this.state.values.forEach(function (val) {
5162
+ var renderLabel = this.props.valueRenderer || this.renderOptionLabel;
5163
+ var onOptionLabelClick = this.handleOptionLabelClick.bind(this, val);
5164
+ var onRemove = this.removeValue.bind(this, val);
5165
+ var valueComponent = React.createElement(this.props.valueComponent, {
5166
+ key: val[this.props.valueKey],
5167
+ option: val,
5168
+ renderer: renderLabel,
5169
+ optionLabelClick: !!this.props.onOptionLabelClick,
5170
+ onOptionLabelClick: onOptionLabelClick,
5171
+ onRemove: onRemove,
5172
+ disabled: this.props.disabled
5173
+ });
5174
+ value.push(valueComponent);
5175
+ }, this);
5176
+ }
5177
+
5178
+ if (!this.state.inputValue && (!this.props.multi || !value.length)) {
5179
+ var val = this.state.values[0] || null;
5180
+ if (this.props.valueRenderer && !!this.state.values.length) {
5181
+ value.push(React.createElement(Value, {
5182
+ key: 0,
5183
+ option: val,
5184
+ renderer: this.props.valueRenderer,
5185
+ disabled: this.props.disabled }));
5186
+ } else {
5187
+ var singleValueComponent = React.createElement(this.props.singleValueComponent, {
5188
+ key: 'placeholder',
5189
+ value: val,
5190
+ placeholder: this.state.placeholder
5191
+ });
5192
+ value.push(singleValueComponent);
5193
+ }
5194
+ }
5195
+
5196
+ // loading spinner
5197
+ var loading = this.isLoading() ? React.createElement(
5198
+ 'span',
5199
+ { className: 'Select-loading-zone', 'aria-hidden': 'true' },
5200
+ React.createElement('span', { className: 'Select-loading' })
5201
+ ) : null;
5202
+
5203
+ // clear "x" button
5204
+ var clear = this.props.clearable && this.state.value && !this.props.disabled && !this.isLoading() ? React.createElement(
5205
+ 'span',
5206
+ { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, onMouseDown: this.clearValue, onTouchEnd: this.clearValue, onClick: this.clearValue },
5207
+ React.createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '&times;' } })
5208
+ ) : null;
5209
+
5210
+ // indicator arrow
5211
+ var arrow = React.createElement(
5212
+ 'span',
5213
+ { className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
5214
+ React.createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
5215
+ );
5216
+
5217
+ var menu;
5218
+ var menuProps;
5219
+ if (this.state.isOpen) {
5220
+ menuProps = {
5221
+ ref: 'menu',
5222
+ className: 'Select-menu',
5223
+ onMouseDown: this.handleMouseDownOnMenu
5224
+ };
5225
+ menu = React.createElement(
5226
+ 'div',
5227
+ { ref: 'selectMenuContainer', className: 'Select-menu-outer' },
5228
+ React.createElement(
5229
+ 'div',
5230
+ menuProps,
5231
+ this.buildMenu()
5232
+ )
5233
+ );
5234
+ }
5235
+
5236
+ var input;
5237
+ var inputProps = {
5238
+ ref: 'input',
5239
+ className: 'Select-input ' + (this.props.inputProps.className || ''),
5240
+ tabIndex: this.props.tabIndex || 0,
5241
+ onFocus: this.handleInputFocus,
5242
+ onBlur: this.handleInputBlur
5243
+ };
5244
+ for (var key in this.props.inputProps) {
5245
+ if (this.props.inputProps.hasOwnProperty(key) && key !== 'className') {
5246
+ inputProps[key] = this.props.inputProps[key];
5247
+ }
5248
+ }
5249
+
5250
+ if (!this.props.disabled) {
5251
+ if (this.props.searchable) {
5252
+ input = React.createElement(Input, _extends({ value: this.state.inputValue, onChange: this.handleInputChange, minWidth: '5' }, inputProps));
5253
+ } else {
5254
+ input = React.createElement(
5255
+ 'div',
5256
+ inputProps,
5257
+ ' '
5258
+ );
5259
+ }
5260
+ } else if (!this.props.multi || !this.state.values.length) {
5261
+ input = React.createElement(
5262
+ 'div',
5263
+ { className: 'Select-input' },
5264
+ ' '
5265
+ );
5266
+ }
5267
+
5268
+ return React.createElement(
5269
+ 'div',
5270
+ { ref: 'wrapper', className: selectClass },
5271
+ React.createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: this.state.value, disabled: this.props.disabled }),
5272
+ React.createElement(
5273
+ 'div',
5274
+ { className: 'Select-control', ref: 'control', onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
5275
+ value,
5276
+ input,
5277
+ loading,
5278
+ clear,
5279
+ arrow
5280
+ ),
5281
+ menu
5282
+ );
5283
+ }
5284
+ });
5285
+
5286
+ module.exports = Select;
5287
+ },{"./Option":118,"./SingleValue":120,"./Value":121,"classnames":122,"react":511,"react-dom":276,"react-input-autosize":123}],120:[function(_dereq_,module,exports){
5288
+ 'use strict';
5289
+
5290
+ var React = _dereq_('react');
5291
+ var classes = _dereq_('classnames');
5292
+
5293
+ var SingleValue = React.createClass({
5294
+ displayName: 'SingleValue',
5295
+
5296
+ propTypes: {
5297
+ placeholder: React.PropTypes.string, // this is default value provided by React-Select based component
5298
+ value: React.PropTypes.object // selected option
5299
+ },
5300
+ render: function render() {
5301
+ var classNames = classes('Select-placeholder', this.props.value && this.props.value.className);
5302
+ return React.createElement(
5303
+ 'div',
5304
+ {
5305
+ className: classNames,
5306
+ style: this.props.value && this.props.value.style,
5307
+ title: this.props.value && this.props.value.title
5308
+ },
5309
+ this.props.placeholder
5310
+ );
5311
+ }
5312
+ });
5313
+
5314
+ module.exports = SingleValue;
5315
+ },{"classnames":122,"react":511}],121:[function(_dereq_,module,exports){
5316
+ 'use strict';
5317
+
5318
+ var React = _dereq_('react');
5319
+ var classes = _dereq_('classnames');
5320
+
5321
+ var Value = React.createClass({
5322
+
5323
+ displayName: 'Value',
5324
+
5325
+ propTypes: {
5326
+ disabled: React.PropTypes.bool, // disabled prop passed to ReactSelect
5327
+ onOptionLabelClick: React.PropTypes.func, // method to handle click on value label
5328
+ onRemove: React.PropTypes.func, // method to handle remove of that value
5329
+ option: React.PropTypes.object.isRequired, // option passed to component
5330
+ optionLabelClick: React.PropTypes.bool, // indicates if onOptionLabelClick should be handled
5331
+ renderer: React.PropTypes.func // method to render option label passed to ReactSelect
5332
+ },
5333
+
5334
+ blockEvent: function blockEvent(event) {
5335
+ event.stopPropagation();
5336
+ },
5337
+
5338
+ handleOnRemove: function handleOnRemove(event) {
5339
+ if (!this.props.disabled) {
5340
+ this.props.onRemove(event);
5341
+ }
5342
+ },
5343
+
5344
+ render: function render() {
5345
+ var label = this.props.option.label;
5346
+ if (this.props.renderer) {
5347
+ label = this.props.renderer(this.props.option);
5348
+ }
5349
+
5350
+ if (!this.props.onRemove && !this.props.optionLabelClick) {
5351
+ return React.createElement(
5352
+ 'div',
5353
+ {
5354
+ className: classes('Select-value', this.props.option.className),
5355
+ style: this.props.option.style,
5356
+ title: this.props.option.title
5357
+ },
5358
+ label
5359
+ );
5360
+ }
5361
+
5362
+ if (this.props.optionLabelClick) {
5363
+ label = React.createElement(
5364
+ 'a',
5365
+ { className: classes('Select-item-label__a', this.props.option.className),
5366
+ onMouseDown: this.blockEvent,
5367
+ onTouchEnd: this.props.onOptionLabelClick,
5368
+ onClick: this.props.onOptionLabelClick,
5369
+ style: this.props.option.style,
5370
+ title: this.props.option.title },
5371
+ label
5372
+ );
5373
+ }
5374
+
5375
+ return React.createElement(
5376
+ 'div',
5377
+ { className: classes('Select-item', this.props.option.className),
5378
+ style: this.props.option.style,
5379
+ title: this.props.option.title },
5380
+ React.createElement(
5381
+ 'span',
5382
+ { className: 'Select-item-icon',
5383
+ onMouseDown: this.blockEvent,
5384
+ onClick: this.handleOnRemove,
5385
+ onTouchEnd: this.handleOnRemove },
5386
+ '×'
5387
+ ),
5388
+ React.createElement(
5389
+ 'span',
5390
+ { className: 'Select-item-label' },
5391
+ label
5392
+ )
5393
+ );
5394
+ }
5395
+
5396
+ });
5397
+
5398
+ module.exports = Value;
5399
+ },{"classnames":122,"react":511}],122:[function(_dereq_,module,exports){
5400
+ /*!
5401
+ Copyright (c) 2016 Jed Watson.
5402
+ Licensed under the MIT License (MIT), see
5403
+ http://jedwatson.github.io/classnames
5404
+ */
5405
+ /* global define */
5406
+
5407
+ (function () {
5408
+ 'use strict';
5409
+
5410
+ var hasOwn = {}.hasOwnProperty;
5411
+
5412
+ function classNames () {
5413
+ var classes = [];
5414
+
5415
+ for (var i = 0; i < arguments.length; i++) {
5416
+ var arg = arguments[i];
5417
+ if (!arg) continue;
5418
+
5419
+ var argType = typeof arg;
5420
+
5421
+ if (argType === 'string' || argType === 'number') {
5422
+ classes.push(arg);
5423
+ } else if (Array.isArray(arg)) {
5424
+ classes.push(classNames.apply(null, arg));
5425
+ } else if (argType === 'object') {
5426
+ for (var key in arg) {
5427
+ if (hasOwn.call(arg, key) && arg[key]) {
5428
+ classes.push(key);
5429
+ }
5430
+ }
5431
+ }
5432
+ }
5433
+
5434
+ return classes.join(' ');
5435
+ }
5436
+
5437
+ if (typeof module !== 'undefined' && module.exports) {
5438
+ module.exports = classNames;
5439
+ } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
5440
+ // register as 'classnames', consistent with npm package name
5441
+ define('classnames', [], function () {
5442
+ return classNames;
5443
+ });
5444
+ } else {
5445
+ window.classNames = classNames;
5446
+ }
5447
+ }());
5448
+
5449
+ },{}],123:[function(_dereq_,module,exports){
5450
+ 'use strict';
5451
+
5452
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
5453
+
5454
+ var React = _dereq_('react');
5455
+
5456
+ var sizerStyle = { position: 'absolute', visibility: 'hidden', height: 0, width: 0, overflow: 'scroll', whiteSpace: 'pre' };
5457
+
5458
+ var nextFrame = typeof window !== 'undefined' ? (function () {
5459
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {
5460
+ window.setTimeout(callback, 1000 / 60);
5461
+ };
5462
+ })().bind(window) : undefined; // If window is undefined, then we can't define a nextFrame function
5463
+
5464
+ var AutosizeInput = React.createClass({
5465
+ displayName: 'AutosizeInput',
5466
+
5467
+ propTypes: {
5468
+ value: React.PropTypes.any, // field value
5469
+ defaultValue: React.PropTypes.any, // default field value
5470
+ onChange: React.PropTypes.func, // onChange handler: function(newValue) {}
5471
+ style: React.PropTypes.object, // css styles for the outer element
5472
+ className: React.PropTypes.string, // className for the outer element
5473
+ minWidth: React.PropTypes.oneOfType([// minimum width for input element
5474
+ React.PropTypes.number, React.PropTypes.string]),
5475
+ inputStyle: React.PropTypes.object, // css styles for the input element
5476
+ inputClassName: React.PropTypes.string // className for the input element
5477
+ },
5478
+ getDefaultProps: function getDefaultProps() {
5479
+ return {
5480
+ minWidth: 1
5481
+ };
5482
+ },
5483
+ getInitialState: function getInitialState() {
5484
+ return {
5485
+ inputWidth: this.props.minWidth
5486
+ };
5487
+ },
5488
+ componentDidMount: function componentDidMount() {
5489
+ this.copyInputStyles();
5490
+ this.updateInputWidth();
5491
+ },
5492
+ componentDidUpdate: function componentDidUpdate() {
5493
+ this.updateInputWidth();
5494
+ },
5495
+ copyInputStyles: function copyInputStyles() {
5496
+ if (!this.isMounted() || !window.getComputedStyle) {
5497
+ return;
5498
+ }
5499
+ var inputStyle = window.getComputedStyle(this.refs.input);
5500
+ if (!inputStyle) {
5501
+ return;
5502
+ }
5503
+ var widthNode = this.refs.sizer;
5504
+ widthNode.style.fontSize = inputStyle.fontSize;
5505
+ widthNode.style.fontFamily = inputStyle.fontFamily;
5506
+ widthNode.style.fontWeight = inputStyle.fontWeight;
5507
+ widthNode.style.fontStyle = inputStyle.fontStyle;
5508
+ widthNode.style.letterSpacing = inputStyle.letterSpacing;
5509
+ if (this.props.placeholder) {
5510
+ var placeholderNode = this.refs.placeholderSizer;
5511
+ placeholderNode.style.fontSize = inputStyle.fontSize;
5512
+ placeholderNode.style.fontFamily = inputStyle.fontFamily;
5513
+ placeholderNode.style.fontWeight = inputStyle.fontWeight;
5514
+ placeholderNode.style.fontStyle = inputStyle.fontStyle;
5515
+ placeholderNode.style.letterSpacing = inputStyle.letterSpacing;
5516
+ }
5517
+ },
5518
+ updateInputWidth: function updateInputWidth() {
5519
+ if (!this.isMounted() || typeof this.refs.sizer.scrollWidth === 'undefined') {
5520
+ return;
5521
+ }
5522
+ var newInputWidth = undefined;
5523
+ if (this.props.placeholder) {
5524
+ newInputWidth = Math.max(this.refs.sizer.scrollWidth, this.refs.placeholderSizer.scrollWidth) + 2;
5525
+ } else {
5526
+ newInputWidth = this.refs.sizer.scrollWidth + 2;
5527
+ }
5528
+ if (newInputWidth < this.props.minWidth) {
5529
+ newInputWidth = this.props.minWidth;
5530
+ }
5531
+ if (newInputWidth !== this.state.inputWidth) {
5532
+ this.setState({
5533
+ inputWidth: newInputWidth
5534
+ });
5535
+ }
5536
+ },
5537
+ getInput: function getInput() {
5538
+ return this.refs.input;
5539
+ },
5540
+ focus: function focus() {
5541
+ this.refs.input.focus();
5542
+ },
5543
+ blur: function blur() {
5544
+ this.refs.input.blur();
5545
+ },
5546
+ select: function select() {
5547
+ this.refs.input.select();
5548
+ },
5549
+ render: function render() {
5550
+ var sizerValue = this.props.defaultValue || this.props.value || '';
5551
+ var wrapperStyle = this.props.style || {};
5552
+ if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
5553
+ var inputStyle = _extends({}, this.props.inputStyle);
5554
+ inputStyle.width = this.state.inputWidth + 'px';
5555
+ inputStyle.boxSizing = 'content-box';
5556
+ var placeholder = this.props.placeholder ? React.createElement(
5557
+ 'div',
5558
+ { ref: 'placeholderSizer', style: sizerStyle },
5559
+ this.props.placeholder
5560
+ ) : null;
5561
+ return React.createElement(
5562
+ 'div',
5563
+ { className: this.props.className, style: wrapperStyle },
5564
+ React.createElement('input', _extends({}, this.props, { ref: 'input', className: this.props.inputClassName, style: inputStyle })),
5565
+ React.createElement(
5566
+ 'div',
5567
+ { ref: 'sizer', style: sizerStyle },
5568
+ sizerValue
5569
+ ),
5570
+ placeholder
5571
+ );
5572
+ }
5573
+ });
5574
+
5575
+ module.exports = AutosizeInput;
5576
+ },{"react":511}],124:[function(_dereq_,module,exports){
5577
+ 'use strict';
5578
+
5579
+ exports.__esModule = true;
5580
+
5581
+ var _react = _dereq_('react');
5582
+
5583
+ var _react2 = _interopRequireDefault(_react);
5584
+
5585
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5586
+
5587
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5588
+
5589
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5590
+
5591
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5592
+
5593
+ var Table = (function (_React$Component) {
5594
+ _inherits(Table, _React$Component);
5595
+
5596
+ function Table() {
5597
+ _classCallCheck(this, Table);
5598
+
5599
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5600
+ }
5601
+
5602
+ Table.prototype.render = function render() {
5603
+ var className = 'cf-table';
5604
+
5605
+ if (this.props.striped) className += ' cf-table--striped';
5606
+ if (this.props.hover) className += ' cf-table--hover';
5607
+ if (this.props.bordered) className += ' cf-table--bordered';
5608
+ if (this.props.condensed) className += ' cf-table--condensed';
5609
+
5610
+ return _react2.default.createElement(
5611
+ 'table',
5612
+ { className: className },
5613
+ this.props.children
5614
+ );
5615
+ };
5616
+
5617
+ return Table;
5618
+ })(_react2.default.Component);
5619
+
5620
+ Table.propTypes = {
5621
+ striped: _react.PropTypes.bool,
5622
+ hover: _react.PropTypes.bool,
5623
+ bordered: _react.PropTypes.bool,
5624
+ condensed: _react.PropTypes.bool
5625
+ };
5626
+ Table.defaultProps = {
5627
+ striped: false,
5628
+ hover: false,
5629
+ bordered: true,
5630
+ condensed: false
5631
+ };
5632
+ exports.default = Table;
5633
+ },{"react":511}],125:[function(_dereq_,module,exports){
5634
+ "use strict";
5635
+
5636
+ exports.__esModule = true;
5637
+
5638
+ var _react = _dereq_("react");
5639
+
5640
+ var _react2 = _interopRequireDefault(_react);
5641
+
5642
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5643
+
5644
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5645
+
5646
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5647
+
5648
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5649
+
5650
+ var TableBody = (function (_React$Component) {
5651
+ _inherits(TableBody, _React$Component);
5652
+
5653
+ function TableBody() {
5654
+ _classCallCheck(this, TableBody);
5655
+
5656
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5657
+ }
5658
+
5659
+ TableBody.prototype.render = function render() {
5660
+ return _react2.default.createElement(
5661
+ "tbody",
5662
+ { className: "cf-table__body" },
5663
+ this.props.children
5664
+ );
5665
+ };
5666
+
5667
+ return TableBody;
5668
+ })(_react2.default.Component);
5669
+
5670
+ exports.default = TableBody;
5671
+ },{"react":511}],126:[function(_dereq_,module,exports){
5672
+ 'use strict';
5673
+
5674
+ exports.__esModule = true;
5675
+
5676
+ var _react = _dereq_('react');
5677
+
5678
+ var _react2 = _interopRequireDefault(_react);
5679
+
5680
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5681
+
5682
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5683
+
5684
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5685
+
5686
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5687
+
5688
+ var TableCell = (function (_React$Component) {
5689
+ _inherits(TableCell, _React$Component);
5690
+
5691
+ function TableCell() {
5692
+ _classCallCheck(this, TableCell);
5693
+
5694
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5695
+ }
5696
+
5697
+ TableCell.prototype.render = function render() {
5698
+ var className = 'cf-table__cell';
5699
+
5700
+ if (this.props.sortable) className += ' cf-table__cell--sortable';
5701
+
5702
+ return _react2.default.createElement(
5703
+ 'td',
5704
+ { className: className },
5705
+ this.props.children
5706
+ );
5707
+ };
5708
+
5709
+ return TableCell;
5710
+ })(_react2.default.Component);
5711
+
5712
+ TableCell.propTypes = {
5713
+ sortable: _react.PropTypes.bool,
5714
+ editable: _react.PropTypes.bool
5715
+ };
5716
+ exports.default = TableCell;
5717
+ },{"react":511}],127:[function(_dereq_,module,exports){
5718
+ "use strict";
5719
+
5720
+ exports.__esModule = true;
5721
+
5722
+ var _react = _dereq_("react");
5723
+
5724
+ var _react2 = _interopRequireDefault(_react);
5725
+
5726
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5727
+
5728
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5729
+
5730
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5731
+
5732
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5733
+
5734
+ var TableFoot = (function (_React$Component) {
5735
+ _inherits(TableFoot, _React$Component);
5736
+
5737
+ function TableFoot() {
5738
+ _classCallCheck(this, TableFoot);
5739
+
5740
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5741
+ }
5742
+
5743
+ TableFoot.prototype.render = function render() {
5744
+ return _react2.default.createElement(
5745
+ "tfoot",
5746
+ { className: "cf-table__foot" },
5747
+ this.props.children
5748
+ );
5749
+ };
5750
+
5751
+ return TableFoot;
5752
+ })(_react2.default.Component);
5753
+
5754
+ exports.default = TableFoot;
5755
+ },{"react":511}],128:[function(_dereq_,module,exports){
5756
+ "use strict";
5757
+
5758
+ exports.__esModule = true;
5759
+
5760
+ var _react = _dereq_("react");
5761
+
5762
+ var _react2 = _interopRequireDefault(_react);
5763
+
5764
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5765
+
5766
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5767
+
5768
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5769
+
5770
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5771
+
5772
+ var TableHead = (function (_React$Component) {
5773
+ _inherits(TableHead, _React$Component);
5774
+
5775
+ function TableHead() {
5776
+ _classCallCheck(this, TableHead);
5777
+
5778
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5779
+ }
5780
+
5781
+ TableHead.prototype.render = function render() {
5782
+ return _react2.default.createElement(
5783
+ "thead",
5784
+ { className: "cf-table__head" },
5785
+ this.props.children
5786
+ );
5787
+ };
5788
+
5789
+ return TableHead;
5790
+ })(_react2.default.Component);
5791
+
5792
+ exports.default = TableHead;
5793
+ },{"react":511}],129:[function(_dereq_,module,exports){
5794
+ 'use strict';
5795
+
5796
+ exports.__esModule = true;
5797
+
5798
+ var _react = _dereq_('react');
5799
+
5800
+ var _react2 = _interopRequireDefault(_react);
5801
+
5802
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5803
+
5804
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5805
+
5806
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5807
+
5808
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5809
+
5810
+ var TableCell = (function (_React$Component) {
5811
+ _inherits(TableCell, _React$Component);
5812
+
5813
+ function TableCell() {
5814
+ _classCallCheck(this, TableCell);
5815
+
5816
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5817
+ }
5818
+
5819
+ TableCell.prototype.render = function render() {
5820
+ var className = 'cf-table__cell cf-table__cell--head';
5821
+
5822
+ if (this.props.sortable) className += ' cf-table__cell--sortable';
5823
+
5824
+ return _react2.default.createElement(
5825
+ 'th',
5826
+ { className: className },
5827
+ this.props.children
5828
+ );
5829
+ };
5830
+
5831
+ return TableCell;
5832
+ })(_react2.default.Component);
5833
+
5834
+ TableCell.propTypes = {
5835
+ sortable: _react.PropTypes.bool,
5836
+ editable: _react.PropTypes.bool
5837
+ };
5838
+ exports.default = TableCell;
5839
+ },{"react":511}],130:[function(_dereq_,module,exports){
5840
+ 'use strict';
5841
+
5842
+ exports.__esModule = true;
5843
+
5844
+ var _react = _dereq_('react');
5845
+
5846
+ var _react2 = _interopRequireDefault(_react);
5847
+
5848
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5849
+
5850
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5851
+
5852
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5853
+
5854
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5855
+
5856
+ var Table = (function (_React$Component) {
5857
+ _inherits(Table, _React$Component);
5858
+
5859
+ function Table() {
5860
+ _classCallCheck(this, Table);
5861
+
5862
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5863
+ }
5864
+
5865
+ Table.prototype.render = function render() {
5866
+ var className = 'cf-table__row cf-table__row--' + this.props.type;
5867
+
5868
+ if (this.props.accent) {
5869
+ className += ' cf-table__row--accent-' + this.props.accent;
5870
+ }
5871
+
5872
+ return _react2.default.createElement(
5873
+ 'tr',
5874
+ { className: className },
5875
+ this.props.children
5876
+ );
5877
+ };
5878
+
5879
+ return Table;
5880
+ })(_react2.default.Component);
5881
+
5882
+ Table.propTypes = {
5883
+ type: _react.PropTypes.oneOf(['default', 'info', 'success', 'warning', 'error']),
5884
+ accent: _react.PropTypes.oneOf([false, 'gray', 'orange', 'pink', 'red', 'green', 'purple'])
5885
+ };
5886
+ Table.defaultProps = {
5887
+ type: 'default',
5888
+ accent: false
5889
+ };
5890
+ exports.default = Table;
5891
+ },{"react":511}],131:[function(_dereq_,module,exports){
5892
+ 'use strict';
5893
+
5894
+ exports.__esModule = true;
5895
+ exports.TableRow = exports.TableHeadCell = exports.TableHead = exports.TableFoot = exports.TableCell = exports.TableBody = exports.Table = undefined;
5896
+
5897
+ var _Table2 = _dereq_('./Table');
5898
+
5899
+ var _Table3 = _interopRequireDefault(_Table2);
5900
+
5901
+ var _TableBody2 = _dereq_('./TableBody');
5902
+
5903
+ var _TableBody3 = _interopRequireDefault(_TableBody2);
5904
+
5905
+ var _TableCell2 = _dereq_('./TableCell');
5906
+
5907
+ var _TableCell3 = _interopRequireDefault(_TableCell2);
5908
+
5909
+ var _TableFoot2 = _dereq_('./TableFoot');
5910
+
5911
+ var _TableFoot3 = _interopRequireDefault(_TableFoot2);
5912
+
5913
+ var _TableHead2 = _dereq_('./TableHead');
5914
+
5915
+ var _TableHead3 = _interopRequireDefault(_TableHead2);
5916
+
5917
+ var _TableHeadCell2 = _dereq_('./TableHeadCell');
5918
+
5919
+ var _TableHeadCell3 = _interopRequireDefault(_TableHeadCell2);
5920
+
5921
+ var _TableRow2 = _dereq_('./TableRow');
5922
+
5923
+ var _TableRow3 = _interopRequireDefault(_TableRow2);
5924
+
5925
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5926
+
5927
+ exports.Table = _Table3.default;
5928
+ exports.TableBody = _TableBody3.default;
5929
+ exports.TableCell = _TableCell3.default;
5930
+ exports.TableFoot = _TableFoot3.default;
5931
+ exports.TableHead = _TableHead3.default;
5932
+ exports.TableHeadCell = _TableHeadCell3.default;
5933
+ exports.TableRow = _TableRow3.default;
5934
+ },{"./Table":124,"./TableBody":125,"./TableCell":126,"./TableFoot":127,"./TableHead":128,"./TableHeadCell":129,"./TableRow":130}],132:[function(_dereq_,module,exports){
5935
+ 'use strict';
5936
+
5937
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5938
+
5939
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5940
+
5941
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5942
+
5943
+ var React = _dereq_('react');
5944
+ var PropTypes = React.PropTypes;
5945
+
5946
+ var Viewport = _dereq_('cf-component-viewport');
5947
+ var Select = _dereq_('cf-component-select');
5948
+
5949
+ var Tabs = function (_React$Component) {
5950
+ _inherits(Tabs, _React$Component);
5951
+
5952
+ function Tabs() {
5953
+ _classCallCheck(this, Tabs);
5954
+
5955
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
5956
+ }
5957
+
5958
+ Tabs.prototype.getChildContext = function getChildContext() {
5959
+ return {
5960
+ activeTab: this.props.activeTab
5961
+ };
5962
+ };
5963
+
5964
+ Tabs.prototype.handleChange = function handleChange(id) {
5965
+ if (id !== this.props.active) {
5966
+ this.props.onChange(id);
5967
+ }
5968
+ };
5969
+
5970
+ Tabs.prototype.handleKeyDown = function handleKeyDown(id, event) {
5971
+ if (event.which === 13) {
5972
+ this.handleChange(id);
5973
+ }
5974
+ };
5975
+
5976
+ Tabs.prototype.render = function render() {
5977
+ var _this2 = this;
5978
+
5979
+ return React.createElement(
5980
+ 'section',
5981
+ { className: 'cf-tabs' },
5982
+ React.createElement(
5983
+ Viewport,
5984
+ { size: 'mobile' },
5985
+ React.createElement(Select, {
5986
+ onChange: this.handleChange,
5987
+ value: this.props.activeTab,
5988
+ options: this.props.tabs.map(function (tab) {
5989
+ return {
5990
+ value: tab.id,
5991
+ label: tab.label
5992
+ };
5993
+ }) })
5994
+ ),
5995
+ React.createElement(
5996
+ Viewport,
5997
+ { not: true, size: 'mobile' },
5998
+ React.createElement(
5999
+ 'ul',
6000
+ { className: 'cf-tabs__group', role: 'tablist' },
6001
+ this.props.tabs.map(function (tab) {
6002
+ var selected = tab.id === _this2.props.activeTab;
6003
+
6004
+ var className = 'cf-tabs__item';
6005
+ if (selected) {
6006
+ className += ' cf-tabs__item--active';
6007
+ }
6008
+
6009
+ return React.createElement(
6010
+ 'li',
6011
+ { key: tab.id,
6012
+ role: 'tab',
6013
+ tabIndex: 0,
6014
+ 'aria-controls': tab.id,
6015
+ 'aria-selected': selected,
6016
+ className: className,
6017
+ onKeyDown: _this2.handleKeyDown.bind(_this2, tab.id),
6018
+ onClick: _this2.handleChange.bind(_this2, tab.id) },
6019
+ tab.label
6020
+ );
6021
+ })
6022
+ )
6023
+ ),
6024
+ this.props.children
6025
+ );
6026
+ };
6027
+
6028
+ return Tabs;
6029
+ }(React.Component);
6030
+
6031
+ Tabs.propTypes = {
6032
+ onChange: PropTypes.func.isRequired,
6033
+ activeTab: PropTypes.string.isRequired,
6034
+ tabs: PropTypes.arrayOf(PropTypes.shape({
6035
+ id: PropTypes.string.isRequired,
6036
+ label: PropTypes.string.isRequired
6037
+ })).isRequired
6038
+ };
6039
+ Tabs.childContextTypes = {
6040
+ activeTab: PropTypes.string.isRequired
6041
+ };
6042
+
6043
+
6044
+ module.exports = Tabs;
6045
+ },{"cf-component-select":117,"cf-component-viewport":137,"react":511}],133:[function(_dereq_,module,exports){
6046
+ "use strict";
6047
+
6048
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6049
+
6050
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6051
+
6052
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6053
+
6054
+ var React = _dereq_('react');
6055
+ var PropTypes = React.PropTypes;
6056
+
6057
+ var TabsPanel = function (_React$Component) {
6058
+ _inherits(TabsPanel, _React$Component);
6059
+
6060
+ function TabsPanel() {
6061
+ _classCallCheck(this, TabsPanel);
6062
+
6063
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
6064
+ }
6065
+
6066
+ TabsPanel.prototype.render = function render() {
6067
+ var selected = this.context.activeTab === this.props.id;
6068
+
6069
+ return React.createElement(
6070
+ "div",
6071
+ {
6072
+ className: "cf-tabs__panel",
6073
+ role: "tabpanel",
6074
+ "aria-labelledby": this.props.id,
6075
+ "aria-hidden": !selected,
6076
+ style: { display: selected ? 'block' : 'none' } },
6077
+ this.props.children
6078
+ );
6079
+ };
6080
+
6081
+ return TabsPanel;
6082
+ }(React.Component);
6083
+
6084
+ TabsPanel.propTypes = {
6085
+ id: PropTypes.string.isRequired
6086
+ };
6087
+ TabsPanel.contextTypes = {
6088
+ activeTab: PropTypes.string.isRequired
6089
+ };
6090
+
6091
+
6092
+ module.exports = TabsPanel;
6093
+ },{"react":511}],134:[function(_dereq_,module,exports){
6094
+ 'use strict';
6095
+
6096
+ exports.Tabs = _dereq_('./Tabs');
6097
+ exports.TabsPanel = _dereq_('./TabsPanel');
6098
+ },{"./Tabs":132,"./TabsPanel":133}],135:[function(_dereq_,module,exports){
6099
+ 'use strict';
6100
+
6101
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6102
+
6103
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6104
+
6105
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6106
+
6107
+ var React = _dereq_('react');
6108
+ var PropTypes = React.PropTypes;
6109
+
6110
+ var MediaQuery = _dereq_('react-responsive');
6111
+ var buildMediaQuery = _dereq_('./buildMediaQuery');
6112
+
6113
+ var SIZES = {
6114
+ mobile: { minWidth: null, maxWidth: '15.6em' },
6115
+ mobileWide: { minWidth: '15.6em', maxWidth: '32.4em' },
6116
+ tablet: { minWidth: '32.4em', maxWidth: '49.2em' },
6117
+ desktop: { minWidth: '49.2em', maxWidth: '66em' },
6118
+ desktopLarge: { minWidth: '66em', maxWidth: null }
6119
+ };
6120
+
6121
+ var Viewport = function (_React$Component) {
6122
+ _inherits(Viewport, _React$Component);
6123
+
6124
+ function Viewport() {
6125
+ _classCallCheck(this, Viewport);
6126
+
6127
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
6128
+ }
6129
+
6130
+ Viewport.prototype.render = function render() {
6131
+ var _props = this.props;
6132
+ var size = _props.size;
6133
+ var not = _props.not;
6134
+
6135
+ var mediaQuery = buildMediaQuery(SIZES[size], not);
6136
+
6137
+ return React.createElement(
6138
+ MediaQuery,
6139
+ { query: mediaQuery },
6140
+ this.props.children
6141
+ );
6142
+ };
6143
+
6144
+ return Viewport;
6145
+ }(React.Component);
6146
+
6147
+ Viewport.propTypes = {
6148
+ not: PropTypes.bool,
6149
+ size: PropTypes.oneOf(['mobile', 'mobileWide', 'tablet', 'desktop', 'desktopLarge']).isRequired
6150
+ };
6151
+ Viewport.defaultProps = {
6152
+ not: false
6153
+ };
6154
+
6155
+
6156
+ module.exports = Viewport;
6157
+ },{"./buildMediaQuery":136,"react":511,"react-responsive":142}],136:[function(_dereq_,module,exports){
6158
+ 'use strict';
6159
+
6160
+ function buildMediaQuery(_ref, not) {
6161
+ var minWidth = _ref.minWidth;
6162
+ var maxWidth = _ref.maxWidth;
6163
+
6164
+ var query = '';
6165
+
6166
+ if (minWidth) {
6167
+ query += '(min-width: ' + minWidth + ')';
6168
+ }
6169
+
6170
+ if (minWidth && maxWidth) {
6171
+ query += ' and ';
6172
+ }
6173
+
6174
+ if (maxWidth) {
6175
+ query += '(max-width: ' + maxWidth + ')';
6176
+ }
6177
+
6178
+ if (not) {
6179
+ query = 'not all and ' + query;
6180
+ }
6181
+
6182
+ return query;
6183
+ }
6184
+
6185
+ module.exports = buildMediaQuery;
6186
+ },{}],137:[function(_dereq_,module,exports){
6187
+ 'use strict';
6188
+
6189
+ module.exports = _dereq_('./Viewport');
6190
+ },{"./Viewport":135}],138:[function(_dereq_,module,exports){
6191
+ 'use strict';
6192
+
6193
+ var uppercasePattern = /[A-Z]/g;
6194
+ var msPattern = /^ms-/;
6195
+
6196
+ function hyphenateStyleName(string) {
6197
+ return string
6198
+ .replace(uppercasePattern, '-$&')
6199
+ .toLowerCase()
6200
+ .replace(msPattern, '-ms-');
6201
+ }
6202
+
6203
+ module.exports = hyphenateStyleName;
6204
+
6205
+ },{}],139:[function(_dereq_,module,exports){
6206
+ 'use strict';
6207
+
6208
+ var staticMatch = _dereq_('css-mediaquery').match;
6209
+ var dynamicMatch = typeof window !== 'undefined' ? window.matchMedia : null;
6210
+
6211
+ // our fake MediaQueryList
6212
+ function Mql(query, values){
6213
+ var self = this;
6214
+ if(dynamicMatch){
6215
+ var mql = dynamicMatch.call(window, query);
6216
+ this.matches = mql.matches;
6217
+ this.media = mql.media;
6218
+ // TODO: is there a time it makes sense to remove this listener?
6219
+ mql.addListener(update);
6220
+ } else {
6221
+ this.matches = staticMatch(query, values);
6222
+ this.media = query;
6223
+ }
6224
+
6225
+ this.addListener = addListener;
6226
+ this.removeListener = removeListener;
6227
+
6228
+ function addListener(listener){
6229
+ if(mql){
6230
+ mql.addListener(listener);
6231
+ }
6232
+ }
6233
+
6234
+ function removeListener(listener){
6235
+ if(mql){
6236
+ mql.removeListener(listener);
6237
+ }
6238
+ }
6239
+
6240
+ // update ourselves!
6241
+ function update(evt){
6242
+ self.matches = evt.matches;
6243
+ self.media = evt.media;
6244
+ }
6245
+ }
6246
+
6247
+ function matchMedia(query, values){
6248
+ return new Mql(query, values);
6249
+ }
6250
+
6251
+ module.exports = matchMedia;
6252
+
6253
+ },{"css-mediaquery":140}],140:[function(_dereq_,module,exports){
6254
+ /*
6255
+ Copyright (c) 2014, Yahoo! Inc. All rights reserved.
6256
+ Copyrights licensed under the New BSD License.
6257
+ See the accompanying LICENSE file for terms.
6258
+ */
6259
+
6260
+ 'use strict';
6261
+
6262
+ exports.match = matchQuery;
6263
+ exports.parse = parseQuery;
6264
+
6265
+ // -----------------------------------------------------------------------------
6266
+
6267
+ var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i,
6268
+ RE_MQ_EXPRESSION = /\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/,
6269
+ RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/,
6270
+ RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/,
6271
+ RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/;
6272
+
6273
+ function matchQuery(mediaQuery, values) {
6274
+ return parseQuery(mediaQuery).some(function (query) {
6275
+ var inverse = query.inverse;
6276
+
6277
+ // Either the parsed or specified `type` is "all", or the types must be
6278
+ // equal for a match.
6279
+ var typeMatch = query.type === 'all' || values.type === query.type;
6280
+
6281
+ // Quit early when `type` doesn't match, but take "not" into account.
6282
+ if ((typeMatch && inverse) || !(typeMatch || inverse)) {
6283
+ return false;
6284
+ }
6285
+
6286
+ var expressionsMatch = query.expressions.every(function (expression) {
6287
+ var feature = expression.feature,
6288
+ modifier = expression.modifier,
6289
+ expValue = expression.value,
6290
+ value = values[feature];
6291
+
6292
+ // Missing or falsy values don't match.
6293
+ if (!value) { return false; }
6294
+
6295
+ switch (feature) {
6296
+ case 'orientation':
6297
+ case 'scan':
6298
+ return value.toLowerCase() === expValue.toLowerCase();
6299
+
6300
+ case 'width':
6301
+ case 'height':
6302
+ case 'device-width':
6303
+ case 'device-height':
6304
+ expValue = toPx(expValue);
6305
+ value = toPx(value);
6306
+ break;
6307
+
6308
+ case 'resolution':
6309
+ expValue = toDpi(expValue);
6310
+ value = toDpi(value);
6311
+ break;
6312
+
6313
+ case 'aspect-ratio':
6314
+ case 'device-aspect-ratio':
6315
+ case /* Deprecated */ 'device-pixel-ratio':
6316
+ expValue = toDecimal(expValue);
6317
+ value = toDecimal(value);
6318
+ break;
6319
+
6320
+ case 'grid':
6321
+ case 'color':
6322
+ case 'color-index':
6323
+ case 'monochrome':
6324
+ expValue = parseInt(expValue, 10) || 1;
6325
+ value = parseInt(value, 10) || 0;
6326
+ break;
6327
+ }
6328
+
6329
+ switch (modifier) {
6330
+ case 'min': return value >= expValue;
6331
+ case 'max': return value <= expValue;
6332
+ default : return value === expValue;
6333
+ }
6334
+ });
6335
+
6336
+ return (expressionsMatch && !inverse) || (!expressionsMatch && inverse);
6337
+ });
6338
+ }
6339
+
6340
+ function parseQuery(mediaQuery) {
6341
+ return mediaQuery.split(',').map(function (query) {
6342
+ query = query.trim();
6343
+
6344
+ var captures = query.match(RE_MEDIA_QUERY),
6345
+ modifier = captures[1],
6346
+ type = captures[2],
6347
+ expressions = captures[3] || '',
6348
+ parsed = {};
6349
+
6350
+ parsed.inverse = !!modifier && modifier.toLowerCase() === 'not';
6351
+ parsed.type = type ? type.toLowerCase() : 'all';
6352
+
6353
+ // Split expressions into a list.
6354
+ expressions = expressions.match(/\([^\)]+\)/g) || [];
6355
+
6356
+ parsed.expressions = expressions.map(function (expression) {
6357
+ var captures = expression.match(RE_MQ_EXPRESSION),
6358
+ feature = captures[1].toLowerCase().match(RE_MQ_FEATURE);
6359
+
6360
+ return {
6361
+ modifier: feature[1],
6362
+ feature : feature[2],
6363
+ value : captures[2]
6364
+ };
6365
+ });
6366
+
6367
+ return parsed;
6368
+ });
6369
+ }
6370
+
6371
+ // -- Utilities ----------------------------------------------------------------
6372
+
6373
+ function toDecimal(ratio) {
6374
+ var decimal = Number(ratio),
6375
+ numbers;
6376
+
6377
+ if (!decimal) {
6378
+ numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/);
6379
+ decimal = numbers[1] / numbers[2];
6380
+ }
6381
+
6382
+ return decimal;
6383
+ }
6384
+
6385
+ function toDpi(resolution) {
6386
+ var value = parseFloat(resolution),
6387
+ units = String(resolution).match(RE_RESOLUTION_UNIT)[1];
6388
+
6389
+ switch (units) {
6390
+ case 'dpcm': return value / 2.54;
6391
+ case 'dppx': return value * 96;
6392
+ default : return value;
6393
+ }
6394
+ }
6395
+
6396
+ function toPx(length) {
6397
+ var value = parseFloat(length),
6398
+ units = String(length).match(RE_LENGTH_UNIT)[1];
6399
+
6400
+ switch (units) {
6401
+ case 'em' : return value * 16;
6402
+ case 'rem': return value * 16;
6403
+ case 'cm' : return value * 96 / 2.54;
6404
+ case 'mm' : return value * 96 / 2.54 / 10;
6405
+ case 'in' : return value * 96;
6406
+ case 'pt' : return value * 72;
6407
+ case 'pc' : return value * 72 / 12;
6408
+ default : return value;
6409
+ }
6410
+ }
6411
+
6412
+ },{}],141:[function(_dereq_,module,exports){
6413
+ 'use strict';
6414
+ /* eslint-disable no-unused-vars */
6415
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
6416
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
6417
+
6418
+ function toObject(val) {
6419
+ if (val === null || val === undefined) {
6420
+ throw new TypeError('Object.assign cannot be called with null or undefined');
6421
+ }
6422
+
6423
+ return Object(val);
6424
+ }
6425
+
6426
+ function shouldUseNative() {
6427
+ try {
6428
+ if (!Object.assign) {
6429
+ return false;
6430
+ }
6431
+
6432
+ // Detect buggy property enumeration order in older V8 versions.
6433
+
6434
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
6435
+ var test1 = new String('abc'); // eslint-disable-line
6436
+ test1[5] = 'de';
6437
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
6438
+ return false;
6439
+ }
6440
+
6441
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
6442
+ var test2 = {};
6443
+ for (var i = 0; i < 10; i++) {
6444
+ test2['_' + String.fromCharCode(i)] = i;
6445
+ }
6446
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
6447
+ return test2[n];
6448
+ });
6449
+ if (order2.join('') !== '0123456789') {
6450
+ return false;
6451
+ }
6452
+
6453
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
6454
+ var test3 = {};
6455
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
6456
+ test3[letter] = letter;
6457
+ });
6458
+ if (Object.keys(Object.assign({}, test3)).join('') !==
6459
+ 'abcdefghijklmnopqrst') {
6460
+ return false;
6461
+ }
6462
+
6463
+ return true;
6464
+ } catch (e) {
6465
+ // We don't expect any of the above to throw, but better to be safe.
6466
+ return false;
6467
+ }
6468
+ }
6469
+
6470
+ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
6471
+ var from;
6472
+ var to = toObject(target);
6473
+ var symbols;
6474
+
6475
+ for (var s = 1; s < arguments.length; s++) {
6476
+ from = Object(arguments[s]);
6477
+
6478
+ for (var key in from) {
6479
+ if (hasOwnProperty.call(from, key)) {
6480
+ to[key] = from[key];
6481
+ }
6482
+ }
6483
+
6484
+ if (Object.getOwnPropertySymbols) {
6485
+ symbols = Object.getOwnPropertySymbols(from);
6486
+ for (var i = 0; i < symbols.length; i++) {
6487
+ if (propIsEnumerable.call(from, symbols[i])) {
6488
+ to[symbols[i]] = from[symbols[i]];
6489
+ }
6490
+ }
6491
+ }
6492
+ }
6493
+
6494
+ return to;
6495
+ };
6496
+
6497
+ },{}],142:[function(_dereq_,module,exports){
6498
+ 'use strict';
6499
+
6500
+ var React = _dereq_('react');
6501
+ var matchMedia = _dereq_('matchmedia');
6502
+ var hyphenate = _dereq_('hyphenate-style-name');
6503
+ var mediaQuery = _dereq_('./mediaQuery');
6504
+ var toQuery = _dereq_('./toQuery');
6505
+ var assign = _dereq_('object-assign');
6506
+
6507
+ var defaultTypes = {
6508
+ component: React.PropTypes.node,
6509
+ query: React.PropTypes.string,
6510
+ values: React.PropTypes.shape(mediaQuery.matchers),
6511
+ children: React.PropTypes.array
6512
+ };
6513
+ var mediaKeys = Object.keys(mediaQuery.all);
6514
+ var excludedQueryKeys = Object.keys(defaultTypes);
6515
+ var excludedPropKeys = excludedQueryKeys.concat(mediaKeys);
6516
+
6517
+ function omit(object, keys){
6518
+ var newObject = assign({}, object);
6519
+ keys.forEach(function(key){
6520
+ delete newObject[key];
6521
+ });
6522
+ return newObject;
6523
+ }
6524
+
6525
+ var mq = React.createClass({
6526
+ displayName: 'MediaQuery',
6527
+
6528
+ getDefaultProps: function(){
6529
+ return {
6530
+ values: {}
6531
+ };
6532
+ },
6533
+
6534
+ getInitialState: function(){
6535
+ return {
6536
+ matches: false
6537
+ };
6538
+ },
6539
+
6540
+ componentWillMount: function(){
6541
+ this.updateQuery(this.props);
6542
+ },
6543
+
6544
+ componentWillReceiveProps: function(props){
6545
+ this.updateQuery(props);
6546
+ },
6547
+
6548
+ updateQuery: function(props){
6549
+ var values;
6550
+ if (props.query) {
6551
+ this.query = props.query;
6552
+ } else {
6553
+ this.query = toQuery(omit(props, excludedQueryKeys));
6554
+ }
6555
+
6556
+ if (!this.query) {
6557
+ throw new Error('Invalid or missing MediaQuery!');
6558
+ }
6559
+
6560
+ if (props.values) {
6561
+ values = Object.keys(props.values)
6562
+ .reduce(function(result, key){
6563
+ result[hyphenate(key)] = props.values[key];
6564
+ return result;
6565
+ }, {});
6566
+ }
6567
+
6568
+ if (this._mql) {
6569
+ this._mql.removeListener(this.updateMatches);
6570
+ }
6571
+
6572
+ this._mql = matchMedia(this.query, values);
6573
+ this._mql.addListener(this.updateMatches);
6574
+ this.updateMatches();
6575
+ },
6576
+
6577
+ componentWillUnmount: function(){
6578
+ this._mql.removeListener(this.updateMatches);
6579
+ },
6580
+
6581
+ updateMatches: function(){
6582
+ if (this._mql.matches === this.state.matches) {
6583
+ return;
6584
+ }
6585
+ this.setState({
6586
+ matches: this._mql.matches
6587
+ });
6588
+ },
6589
+
6590
+ render: function(){
6591
+ if (this.state.matches === false) {
6592
+ return null;
6593
+ }
6594
+ var props = omit(this.props, excludedPropKeys);
6595
+ var hasMergeProps = Object.keys(props).length > 0;
6596
+ var wrapChildren = this.props.component ||
6597
+ React.Children.count(this.props.children) > 1 ||
6598
+ typeof this.props.children === 'string' ||
6599
+ this.props.children === undefined;
6600
+ if (wrapChildren) {
6601
+ return React.createElement(
6602
+ this.props.component || 'div',
6603
+ props,
6604
+ this.props.children
6605
+ );
6606
+ } else if (hasMergeProps) {
6607
+ return React.cloneElement(
6608
+ this.props.children,
6609
+ props
6610
+ );
6611
+ } else {
6612
+ return this.props.children;
6613
+ }
6614
+ }
6615
+ });
6616
+
6617
+ module.exports = mq;
6618
+
6619
+ },{"./mediaQuery":143,"./toQuery":144,"hyphenate-style-name":138,"matchmedia":139,"object-assign":141,"react":511}],143:[function(_dereq_,module,exports){
6620
+ var PropTypes = _dereq_('react').PropTypes;
6621
+ var assign = _dereq_('object-assign');
6622
+
6623
+ var stringOrNumber = PropTypes.oneOfType([
6624
+ PropTypes.string,
6625
+ PropTypes.number
6626
+ ]);
6627
+
6628
+ // properties that match media queries
6629
+ var matchers = {
6630
+ orientation: PropTypes.oneOf([
6631
+ 'portrait',
6632
+ 'landscape'
6633
+ ]),
6634
+
6635
+ scan: PropTypes.oneOf([
6636
+ 'progressive',
6637
+ 'interlace'
6638
+ ]),
6639
+
6640
+ aspectRatio: PropTypes.string,
6641
+ deviceAspectRatio: PropTypes.string,
6642
+
6643
+ height: stringOrNumber,
6644
+ deviceHeight: stringOrNumber,
6645
+
6646
+ width: stringOrNumber,
6647
+ deviceWidth: stringOrNumber,
6648
+
6649
+ color: PropTypes.bool,
6650
+
6651
+ colorIndex: PropTypes.bool,
6652
+
6653
+ monochrome: PropTypes.bool,
6654
+ resolution: stringOrNumber
6655
+ };
6656
+
6657
+ // media features
6658
+ var features = {
6659
+ minAspectRatio: PropTypes.string,
6660
+ maxAspectRatio: PropTypes.string,
6661
+ minDeviceAspectRatio: PropTypes.string,
6662
+ maxDeviceAspectRatio: PropTypes.string,
6663
+
6664
+ minHeight: stringOrNumber,
6665
+ maxHeight: stringOrNumber,
6666
+ minDeviceHeight: stringOrNumber,
6667
+ maxDeviceHeight: stringOrNumber,
6668
+
6669
+ minWidth: stringOrNumber,
6670
+ maxWidth: stringOrNumber,
6671
+ minDeviceWidth: stringOrNumber,
6672
+ maxDeviceWidth: stringOrNumber,
6673
+
6674
+ minColor: PropTypes.number,
6675
+ maxColor: PropTypes.number,
6676
+
6677
+ minColorIndex: PropTypes.number,
6678
+ maxColorIndex: PropTypes.number,
6679
+
6680
+ minMonochrome: PropTypes.number,
6681
+ maxMonochrome: PropTypes.number,
6682
+
6683
+ minResolution: stringOrNumber,
6684
+ maxResolution: stringOrNumber
6685
+ };
6686
+
6687
+ assign(features, matchers);
6688
+
6689
+ // media types
6690
+ var types = {
6691
+ all: PropTypes.bool,
6692
+ grid: PropTypes.bool,
6693
+ aural: PropTypes.bool,
6694
+ braille: PropTypes.bool,
6695
+ handheld: PropTypes.bool,
6696
+ print: PropTypes.bool,
6697
+ projection: PropTypes.bool,
6698
+ screen: PropTypes.bool,
6699
+ tty: PropTypes.bool,
6700
+ tv: PropTypes.bool,
6701
+ embossed: PropTypes.bool
6702
+ };
6703
+
6704
+ var all = {};
6705
+ assign(all, types);
6706
+ assign(all, features);
6707
+
6708
+ // add the type property
6709
+ assign(matchers, { type: Object.keys(types) });
6710
+
6711
+ module.exports = {
6712
+ all: all,
6713
+ types: types,
6714
+ matchers: matchers,
6715
+ features: features
6716
+ };
6717
+
6718
+ },{"object-assign":141,"react":511}],144:[function(_dereq_,module,exports){
6719
+ 'use strict';
6720
+
6721
+ var hyphenate = _dereq_('hyphenate-style-name');
6722
+ var mq = _dereq_('./mediaQuery');
6723
+
6724
+ function negate(cond) {
6725
+ return 'not ' + cond;
6726
+ }
6727
+
6728
+ function keyVal(k, v) {
6729
+ var realKey = hyphenate(k);
6730
+
6731
+ // px shorthand
6732
+ if (typeof v === 'number') {
6733
+ v = v+'px';
6734
+ }
6735
+ if (v === true) {
6736
+ return k;
6737
+ }
6738
+ if (v === false) {
6739
+ return negate(k);
6740
+ }
6741
+ return '('+realKey+': '+v+')';
6742
+ }
6743
+
6744
+ function join(conds) {
6745
+ return conds.join(' and ');
6746
+ }
6747
+
6748
+ module.exports = function(obj){
6749
+ var rules = [];
6750
+ Object.keys(mq.all).forEach(function(k){
6751
+ var v = obj[k];
6752
+ if (v != null) {
6753
+ rules.push(keyVal(k, v));
6754
+ }
6755
+ });
6756
+ return join(rules);
6757
+ };
6758
+
6759
+ },{"./mediaQuery":143,"hyphenate-style-name":138}],145:[function(_dereq_,module,exports){
6760
+ 'use strict';
6761
+
6762
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6763
+
6764
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6765
+
6766
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6767
+
6768
+ var React = _dereq_('react');
6769
+ var PropTypes = React.PropTypes;
6770
+
6771
+ var requiredIf = _dereq_('react-required-if');
6772
+
6773
+ var Textarea = function (_React$Component) {
6774
+ _inherits(Textarea, _React$Component);
6775
+
6776
+ function Textarea() {
6777
+ var _temp, _this, _ret;
6778
+
6779
+ _classCallCheck(this, Textarea);
6780
+
6781
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
6782
+ args[_key] = arguments[_key];
6783
+ }
6784
+
6785
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) {
6786
+ if (_this.props.onChange) {
6787
+ _this.props.onChange(e.target.value);
6788
+ }
6789
+ }, _temp), _possibleConstructorReturn(_this, _ret);
6790
+ }
6791
+
6792
+ Textarea.prototype.render = function render() {
6793
+ var className = 'cf-textarea';
6794
+
6795
+ if (this.props.disabled) className += ' cf-textarea--disabled';
6796
+ if (this.props.readOnly) className += ' cf-textarea--readonly';
6797
+
6798
+ return React.createElement('textarea', {
6799
+ className: className,
6800
+ name: this.props.name,
6801
+ value: this.props.value,
6802
+ disabled: this.props.disabled,
6803
+ readOnly: this.props.readOnly,
6804
+ onChange: this.handleChange,
6805
+ onFocus: this.props.onFocus,
6806
+ onBlur: this.props.onBlur });
6807
+ };
6808
+
6809
+ return Textarea;
6810
+ }(React.Component);
6811
+
6812
+ Textarea.propTypes = {
6813
+ name: PropTypes.string.isRequired,
6814
+ value: PropTypes.string.isRequired,
6815
+ disabled: PropTypes.bool,
6816
+ readOnly: PropTypes.bool,
6817
+ onChange: requiredIf(PropTypes.func, function (props) {
6818
+ return !props.disabled && !props.readOnly;
6819
+ }),
6820
+ onFocus: PropTypes.func,
6821
+ onBlur: PropTypes.func
6822
+ };
6823
+
6824
+
6825
+ module.exports = Textarea;
6826
+ },{"react":511,"react-required-if":147}],146:[function(_dereq_,module,exports){
6827
+ 'use strict';
6828
+
6829
+ module.exports = _dereq_('./Textarea');
6830
+ },{"./Textarea":145}],147:[function(_dereq_,module,exports){
6831
+ module.exports = function requiredIf(type, condition) {
6832
+ return function(props) {
6833
+ const test = condition(props) ? type.isRequired : type;
6834
+ return test.apply(this, arguments);
6835
+ };
6836
+ };
6837
+
6838
+ },{}],148:[function(_dereq_,module,exports){
6839
+ 'use strict';
6840
+
6841
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6842
+
6843
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6844
+
6845
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6846
+
6847
+ var React = _dereq_('react');
6848
+ var PropTypes = React.PropTypes;
6849
+
6850
+ var Toggle = function (_React$Component) {
6851
+ _inherits(Toggle, _React$Component);
6852
+
6853
+ function Toggle() {
6854
+ var _temp, _this, _ret;
6855
+
6856
+ _classCallCheck(this, Toggle);
6857
+
6858
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
6859
+ args[_key] = arguments[_key];
6860
+ }
6861
+
6862
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleChange = function (e) {
6863
+ _this.props.onChange(e.target.checked);
6864
+ }, _temp), _possibleConstructorReturn(_this, _ret);
6865
+ }
6866
+
6867
+ Toggle.prototype.render = function render() {
6868
+ var className = 'cf-toggle';
6869
+
6870
+ if (this.props.value) {
6871
+ className += ' cf-toggle--active';
6872
+ }
6873
+
6874
+ return React.createElement(
6875
+ 'label',
6876
+ { htmlFor: this.props.name, className: className },
6877
+ React.createElement('input', {
6878
+ className: 'cf-toggle__checkbox',
6879
+ type: 'checkbox',
6880
+ id: this.props.name,
6881
+ name: this.props.name,
6882
+ checked: this.props.value,
6883
+ onChange: this.handleChange,
6884
+ onFocus: this.props.onFocus,
6885
+ onBlur: this.props.onBlur }),
6886
+ React.createElement(
6887
+ 'span',
6888
+ { className: 'cf-toggle__label' },
6889
+ this.props.label
6890
+ ),
6891
+ React.createElement('span', { className: 'cf-toggle__handle' })
6892
+ );
6893
+ };
6894
+
6895
+ return Toggle;
6896
+ }(React.Component);
6897
+
6898
+ Toggle.propTypes = {
6899
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired,
6900
+ name: PropTypes.string,
6901
+ value: PropTypes.bool,
6902
+ onChange: PropTypes.func,
6903
+ onFocus: PropTypes.func,
6904
+ onBlur: PropTypes.func
6905
+ };
6906
+
6907
+
6908
+ module.exports = Toggle;
6909
+ },{"react":511}],149:[function(_dereq_,module,exports){
6910
+ 'use strict';
6911
+
6912
+ module.exports = _dereq_('./Toggle');
6913
+ },{"./Toggle":148}],150:[function(_dereq_,module,exports){
6914
+ 'use strict';
6915
+
6916
+ var superagent = _dereq_('superagent');
6917
+ var createLogger = _dereq_('cf-util-logger');
6918
+
6919
+ var logRequest = createLogger('http:request');
6920
+ var logError = createLogger('http:error');
6921
+ var logSuccess = createLogger('http:success');
6922
+
6923
+ // Mapping of http request types to superagent methods.
6924
+ var METHODS = {
6925
+ GET: 'get',
6926
+ POST: 'post',
6927
+ PUT: 'put',
6928
+ PATCH: 'patch',
6929
+ DELETE: 'del'
6930
+ };
6931
+
6932
+ // Store beforeSend callbacks.
6933
+ var beforeSendCallbacks = [];
6934
+
6935
+ /**
6936
+ * Modify request options before they are sent.
6937
+ * Useful for authentication or other middleware.
6938
+ *
6939
+ * ```js
6940
+ * beforeSend(function(opts) {
6941
+ * opts.url = '/api/v4' + opts.url;
6942
+ * });
6943
+ * ```
6944
+ *
6945
+ * @param {Function} callback
6946
+ */
6947
+ function beforeSend(callback) {
6948
+ beforeSendCallbacks.push(callback);
6949
+ }
6950
+
6951
+ /**
6952
+ * Perform an http request.
6953
+ *
6954
+ * ```js
6955
+ * request('POST', '/posts', {
6956
+ * body: {
6957
+ * title: 'A New Post',
6958
+ * content: 'Contents of the new post.'
6959
+ * }
6960
+ * }, function(res) {
6961
+ * console.log(res.body); // > { result: { id: 1, title: 'A New Post', content: 'Contents of the new post.' } }
6962
+ * }, function(err) {
6963
+ * console.log(res.body); // > { errors: [{ message: 'Error!' }] }
6964
+ * });
6965
+ * ```
6966
+ *
6967
+ * @param {String} method - GET/POST/PUT/PATCH/DELETE
6968
+ * @param {String} url
6969
+ * @param {Object} [opts]
6970
+ * @param {Object} [opts.parameters]
6971
+ * @param {Object} [opts.headers]
6972
+ * @param {Object} [opts.body]
6973
+ * @param {Function} [callback]
6974
+ * @returns {Function} Abort request.
6975
+ */
6976
+ function request(method, url, opts, callback) {
6977
+ opts = opts || {};
6978
+
6979
+ opts.method = method;
6980
+ opts.url = url;
6981
+ opts.callback = callback;
6982
+
6983
+ // Allow beforeSend to modify request options.
6984
+ beforeSendCallbacks.forEach(function (cb) {
6985
+ return cb(opts);
6986
+ });
6987
+
6988
+ // Configure request
6989
+ var req = superagent[METHODS[opts.method]](opts.url);
6990
+
6991
+ if (opts.parameters) {
6992
+ req.query(opts.parameters);
6993
+ }
6994
+
6995
+ if (opts.headers) {
6996
+ req.set(opts.headers);
6997
+ }
6998
+
6999
+ if (opts.body) {
7000
+ req.send(opts.body);
7001
+ }
7002
+
7003
+ var logMessage = opts.method + ' ' + opts.url;
7004
+
7005
+ logRequest(logMessage);
7006
+
7007
+ // Send request
7008
+ req.end(function (err, res) {
7009
+ logMessage = logMessage + ' (' + res.status + ' ' + res.statusText + ')';
7010
+
7011
+ var result = {
7012
+ headers: res.headers,
7013
+ status: res.status,
7014
+ body: res.body,
7015
+ text: res.text
7016
+ };
7017
+
7018
+ if (err) {
7019
+ logError(logMessage);
7020
+ opts.callback(result);
7021
+ } else {
7022
+ logSuccess(logMessage);
7023
+ opts.callback(null, result);
7024
+ }
7025
+ });
7026
+
7027
+ // Return abort function
7028
+ return function () {
7029
+ req.abort();
7030
+ };
7031
+ }
7032
+
7033
+ /**
7034
+ * Perform a GET request.
7035
+ */
7036
+ function get() {
7037
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
7038
+ args[_key] = arguments[_key];
7039
+ }
7040
+
7041
+ return request.apply(undefined, ['GET'].concat(args));
7042
+ }
7043
+
7044
+ /**
7045
+ * Perform a POST request.
7046
+ */
7047
+ function post() {
7048
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
7049
+ args[_key2] = arguments[_key2];
7050
+ }
7051
+
7052
+ return request.apply(undefined, ['POST'].concat(args));
7053
+ }
7054
+
7055
+ /**
7056
+ * Perform a PUT request.
7057
+ */
7058
+ function put() {
7059
+ for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
7060
+ args[_key3] = arguments[_key3];
7061
+ }
7062
+
7063
+ return request.apply(undefined, ['PUT'].concat(args));
7064
+ }
7065
+
7066
+ /**
7067
+ * Perform a PATCH request.
7068
+ */
7069
+ function patch() {
7070
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
7071
+ args[_key4] = arguments[_key4];
7072
+ }
7073
+
7074
+ return request.apply(undefined, ['PATCH'].concat(args));
7075
+ }
7076
+
7077
+ /**
7078
+ * Perform a DELETE request.
7079
+ */
7080
+ function del() {
7081
+ for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
7082
+ args[_key5] = arguments[_key5];
7083
+ }
7084
+
7085
+ return request.apply(undefined, ['DELETE'].concat(args));
7086
+ }
7087
+
7088
+ module.exports = { beforeSend: beforeSend, request: request, get: get, post: post, put: put, patch: patch, del: del };
7089
+ },{"cf-util-logger":153,"superagent":157}],151:[function(_dereq_,module,exports){
7090
+ 'use strict';
7091
+
7092
+ module.exports = _dereq_('./http');
7093
+ },{"./http":150}],152:[function(_dereq_,module,exports){
7094
+ 'use strict';
7095
+
7096
+ var debug = _dereq_('debug');
7097
+
7098
+ function createLogger(name) {
7099
+ var logger = debug(name);
7100
+
7101
+ return function (message) {
7102
+ logger(message);
7103
+ };
7104
+ }
7105
+
7106
+ module.exports = createLogger;
7107
+ },{"debug":154}],153:[function(_dereq_,module,exports){
7108
+ 'use strict';
7109
+
7110
+ module.exports = _dereq_('./createLogger');
7111
+ },{"./createLogger":152}],154:[function(_dereq_,module,exports){
7112
+
7113
+ /**
7114
+ * This is the web browser implementation of `debug()`.
7115
+ *
7116
+ * Expose `debug()` as the module.
7117
+ */
7118
+
7119
+ exports = module.exports = _dereq_('./debug');
7120
+ exports.log = log;
7121
+ exports.formatArgs = formatArgs;
7122
+ exports.save = save;
7123
+ exports.load = load;
7124
+ exports.useColors = useColors;
7125
+ exports.storage = 'undefined' != typeof chrome
7126
+ && 'undefined' != typeof chrome.storage
7127
+ ? chrome.storage.local
7128
+ : localstorage();
7129
+
7130
+ /**
7131
+ * Colors.
7132
+ */
7133
+
7134
+ exports.colors = [
7135
+ 'lightseagreen',
7136
+ 'forestgreen',
7137
+ 'goldenrod',
7138
+ 'dodgerblue',
7139
+ 'darkorchid',
7140
+ 'crimson'
7141
+ ];
7142
+
7143
+ /**
7144
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
7145
+ * and the Firebug extension (any Firefox version) are known
7146
+ * to support "%c" CSS customizations.
7147
+ *
7148
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
7149
+ */
7150
+
7151
+ function useColors() {
7152
+ // is webkit? http://stackoverflow.com/a/16459606/376773
7153
+ return ('WebkitAppearance' in document.documentElement.style) ||
7154
+ // is firebug? http://stackoverflow.com/a/398120/376773
7155
+ (window.console && (console.firebug || (console.exception && console.table))) ||
7156
+ // is firefox >= v31?
7157
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
7158
+ (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
7159
+ }
7160
+
7161
+ /**
7162
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
7163
+ */
7164
+
7165
+ exports.formatters.j = function(v) {
7166
+ return JSON.stringify(v);
7167
+ };
7168
+
7169
+
7170
+ /**
7171
+ * Colorize log arguments if enabled.
7172
+ *
7173
+ * @api public
7174
+ */
7175
+
7176
+ function formatArgs() {
7177
+ var args = arguments;
7178
+ var useColors = this.useColors;
7179
+
7180
+ args[0] = (useColors ? '%c' : '')
7181
+ + this.namespace
7182
+ + (useColors ? ' %c' : ' ')
7183
+ + args[0]
7184
+ + (useColors ? '%c ' : ' ')
7185
+ + '+' + exports.humanize(this.diff);
7186
+
7187
+ if (!useColors) return args;
7188
+
7189
+ var c = 'color: ' + this.color;
7190
+ args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
7191
+
7192
+ // the final "%c" is somewhat tricky, because there could be other
7193
+ // arguments passed either before or after the %c, so we need to
7194
+ // figure out the correct index to insert the CSS into
7195
+ var index = 0;
7196
+ var lastC = 0;
7197
+ args[0].replace(/%[a-z%]/g, function(match) {
7198
+ if ('%%' === match) return;
7199
+ index++;
7200
+ if ('%c' === match) {
7201
+ // we only are interested in the *last* %c
7202
+ // (the user may have provided their own)
7203
+ lastC = index;
7204
+ }
7205
+ });
7206
+
7207
+ args.splice(lastC, 0, c);
7208
+ return args;
7209
+ }
7210
+
7211
+ /**
7212
+ * Invokes `console.log()` when available.
7213
+ * No-op when `console.log` is not a "function".
7214
+ *
7215
+ * @api public
7216
+ */
7217
+
7218
+ function log() {
7219
+ // this hackery is required for IE8/9, where
7220
+ // the `console.log` function doesn't have 'apply'
7221
+ return 'object' === typeof console
7222
+ && console.log
7223
+ && Function.prototype.apply.call(console.log, console, arguments);
7224
+ }
7225
+
7226
+ /**
7227
+ * Save `namespaces`.
7228
+ *
7229
+ * @param {String} namespaces
7230
+ * @api private
7231
+ */
7232
+
7233
+ function save(namespaces) {
7234
+ try {
7235
+ if (null == namespaces) {
7236
+ exports.storage.removeItem('debug');
7237
+ } else {
7238
+ exports.storage.debug = namespaces;
7239
+ }
7240
+ } catch(e) {}
7241
+ }
7242
+
7243
+ /**
7244
+ * Load `namespaces`.
7245
+ *
7246
+ * @return {String} returns the previously persisted debug modes
7247
+ * @api private
7248
+ */
7249
+
7250
+ function load() {
7251
+ var r;
7252
+ try {
7253
+ r = exports.storage.debug;
7254
+ } catch(e) {}
7255
+ return r;
7256
+ }
7257
+
7258
+ /**
7259
+ * Enable namespaces listed in `localStorage.debug` initially.
7260
+ */
7261
+
7262
+ exports.enable(load());
7263
+
7264
+ /**
7265
+ * Localstorage attempts to return the localstorage.
7266
+ *
7267
+ * This is necessary because safari throws
7268
+ * when a user disables cookies/localstorage
7269
+ * and you attempt to access it.
7270
+ *
7271
+ * @return {LocalStorage}
7272
+ * @api private
7273
+ */
7274
+
7275
+ function localstorage(){
7276
+ try {
7277
+ return window.localStorage;
7278
+ } catch (e) {}
7279
+ }
7280
+
7281
+ },{"./debug":155}],155:[function(_dereq_,module,exports){
7282
+
7283
+ /**
7284
+ * This is the common logic for both the Node.js and web browser
7285
+ * implementations of `debug()`.
7286
+ *
7287
+ * Expose `debug()` as the module.
7288
+ */
7289
+
7290
+ exports = module.exports = debug;
7291
+ exports.coerce = coerce;
7292
+ exports.disable = disable;
7293
+ exports.enable = enable;
7294
+ exports.enabled = enabled;
7295
+ exports.humanize = _dereq_('ms');
7296
+
7297
+ /**
7298
+ * The currently active debug mode names, and names to skip.
7299
+ */
7300
+
7301
+ exports.names = [];
7302
+ exports.skips = [];
7303
+
7304
+ /**
7305
+ * Map of special "%n" handling functions, for the debug "format" argument.
7306
+ *
7307
+ * Valid key names are a single, lowercased letter, i.e. "n".
7308
+ */
7309
+
7310
+ exports.formatters = {};
7311
+
7312
+ /**
7313
+ * Previously assigned color.
7314
+ */
7315
+
7316
+ var prevColor = 0;
7317
+
7318
+ /**
7319
+ * Previous log timestamp.
7320
+ */
7321
+
7322
+ var prevTime;
7323
+
7324
+ /**
7325
+ * Select a color.
7326
+ *
7327
+ * @return {Number}
7328
+ * @api private
7329
+ */
7330
+
7331
+ function selectColor() {
7332
+ return exports.colors[prevColor++ % exports.colors.length];
7333
+ }
7334
+
7335
+ /**
7336
+ * Create a debugger with the given `namespace`.
7337
+ *
7338
+ * @param {String} namespace
7339
+ * @return {Function}
7340
+ * @api public
7341
+ */
7342
+
7343
+ function debug(namespace) {
7344
+
7345
+ // define the `disabled` version
7346
+ function disabled() {
7347
+ }
7348
+ disabled.enabled = false;
7349
+
7350
+ // define the `enabled` version
7351
+ function enabled() {
7352
+
7353
+ var self = enabled;
7354
+
7355
+ // set `diff` timestamp
7356
+ var curr = +new Date();
7357
+ var ms = curr - (prevTime || curr);
7358
+ self.diff = ms;
7359
+ self.prev = prevTime;
7360
+ self.curr = curr;
7361
+ prevTime = curr;
7362
+
7363
+ // add the `color` if not set
7364
+ if (null == self.useColors) self.useColors = exports.useColors();
7365
+ if (null == self.color && self.useColors) self.color = selectColor();
7366
+
7367
+ var args = Array.prototype.slice.call(arguments);
7368
+
7369
+ args[0] = exports.coerce(args[0]);
7370
+
7371
+ if ('string' !== typeof args[0]) {
7372
+ // anything else let's inspect with %o
7373
+ args = ['%o'].concat(args);
7374
+ }
7375
+
7376
+ // apply any `formatters` transformations
7377
+ var index = 0;
7378
+ args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
7379
+ // if we encounter an escaped % then don't increase the array index
7380
+ if (match === '%%') return match;
7381
+ index++;
7382
+ var formatter = exports.formatters[format];
7383
+ if ('function' === typeof formatter) {
7384
+ var val = args[index];
7385
+ match = formatter.call(self, val);
7386
+
7387
+ // now we need to remove `args[index]` since it's inlined in the `format`
7388
+ args.splice(index, 1);
7389
+ index--;
7390
+ }
7391
+ return match;
7392
+ });
7393
+
7394
+ if ('function' === typeof exports.formatArgs) {
7395
+ args = exports.formatArgs.apply(self, args);
7396
+ }
7397
+ var logFn = enabled.log || exports.log || console.log.bind(console);
7398
+ logFn.apply(self, args);
7399
+ }
7400
+ enabled.enabled = true;
7401
+
7402
+ var fn = exports.enabled(namespace) ? enabled : disabled;
7403
+
7404
+ fn.namespace = namespace;
7405
+
7406
+ return fn;
7407
+ }
7408
+
7409
+ /**
7410
+ * Enables a debug mode by namespaces. This can include modes
7411
+ * separated by a colon and wildcards.
7412
+ *
7413
+ * @param {String} namespaces
7414
+ * @api public
7415
+ */
7416
+
7417
+ function enable(namespaces) {
7418
+ exports.save(namespaces);
7419
+
7420
+ var split = (namespaces || '').split(/[\s,]+/);
7421
+ var len = split.length;
7422
+
7423
+ for (var i = 0; i < len; i++) {
7424
+ if (!split[i]) continue; // ignore empty strings
7425
+ namespaces = split[i].replace(/\*/g, '.*?');
7426
+ if (namespaces[0] === '-') {
7427
+ exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
7428
+ } else {
7429
+ exports.names.push(new RegExp('^' + namespaces + '$'));
7430
+ }
7431
+ }
7432
+ }
7433
+
7434
+ /**
7435
+ * Disable debug output.
7436
+ *
7437
+ * @api public
7438
+ */
7439
+
7440
+ function disable() {
7441
+ exports.enable('');
7442
+ }
7443
+
7444
+ /**
7445
+ * Returns true if the given mode name is enabled, false otherwise.
7446
+ *
7447
+ * @param {String} name
7448
+ * @return {Boolean}
7449
+ * @api public
7450
+ */
7451
+
7452
+ function enabled(name) {
7453
+ var i, len;
7454
+ for (i = 0, len = exports.skips.length; i < len; i++) {
7455
+ if (exports.skips[i].test(name)) {
7456
+ return false;
7457
+ }
7458
+ }
7459
+ for (i = 0, len = exports.names.length; i < len; i++) {
7460
+ if (exports.names[i].test(name)) {
7461
+ return true;
7462
+ }
7463
+ }
7464
+ return false;
7465
+ }
7466
+
7467
+ /**
7468
+ * Coerce `val`.
7469
+ *
7470
+ * @param {Mixed} val
7471
+ * @return {Mixed}
7472
+ * @api private
7473
+ */
7474
+
7475
+ function coerce(val) {
7476
+ if (val instanceof Error) return val.stack || val.message;
7477
+ return val;
7478
+ }
7479
+
7480
+ },{"ms":156}],156:[function(_dereq_,module,exports){
7481
+ /**
7482
+ * Helpers.
7483
+ */
7484
+
7485
+ var s = 1000;
7486
+ var m = s * 60;
7487
+ var h = m * 60;
7488
+ var d = h * 24;
7489
+ var y = d * 365.25;
7490
+
7491
+ /**
7492
+ * Parse or format the given `val`.
7493
+ *
7494
+ * Options:
7495
+ *
7496
+ * - `long` verbose formatting [false]
7497
+ *
7498
+ * @param {String|Number} val
7499
+ * @param {Object} options
7500
+ * @return {String|Number}
7501
+ * @api public
7502
+ */
7503
+
7504
+ module.exports = function(val, options){
7505
+ options = options || {};
7506
+ if ('string' == typeof val) return parse(val);
7507
+ return options.long
7508
+ ? long(val)
7509
+ : short(val);
7510
+ };
7511
+
7512
+ /**
7513
+ * Parse the given `str` and return milliseconds.
7514
+ *
7515
+ * @param {String} str
7516
+ * @return {Number}
7517
+ * @api private
7518
+ */
7519
+
7520
+ function parse(str) {
7521
+ str = '' + str;
7522
+ if (str.length > 10000) return;
7523
+ var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
7524
+ if (!match) return;
7525
+ var n = parseFloat(match[1]);
7526
+ var type = (match[2] || 'ms').toLowerCase();
7527
+ switch (type) {
7528
+ case 'years':
7529
+ case 'year':
7530
+ case 'yrs':
7531
+ case 'yr':
7532
+ case 'y':
7533
+ return n * y;
7534
+ case 'days':
7535
+ case 'day':
7536
+ case 'd':
7537
+ return n * d;
7538
+ case 'hours':
7539
+ case 'hour':
7540
+ case 'hrs':
7541
+ case 'hr':
7542
+ case 'h':
7543
+ return n * h;
7544
+ case 'minutes':
7545
+ case 'minute':
7546
+ case 'mins':
7547
+ case 'min':
7548
+ case 'm':
7549
+ return n * m;
7550
+ case 'seconds':
7551
+ case 'second':
7552
+ case 'secs':
7553
+ case 'sec':
7554
+ case 's':
7555
+ return n * s;
7556
+ case 'milliseconds':
7557
+ case 'millisecond':
7558
+ case 'msecs':
7559
+ case 'msec':
7560
+ case 'ms':
7561
+ return n;
7562
+ }
7563
+ }
7564
+
7565
+ /**
7566
+ * Short format for `ms`.
7567
+ *
7568
+ * @param {Number} ms
7569
+ * @return {String}
7570
+ * @api private
7571
+ */
7572
+
7573
+ function short(ms) {
7574
+ if (ms >= d) return Math.round(ms / d) + 'd';
7575
+ if (ms >= h) return Math.round(ms / h) + 'h';
7576
+ if (ms >= m) return Math.round(ms / m) + 'm';
7577
+ if (ms >= s) return Math.round(ms / s) + 's';
7578
+ return ms + 'ms';
7579
+ }
7580
+
7581
+ /**
7582
+ * Long format for `ms`.
7583
+ *
7584
+ * @param {Number} ms
7585
+ * @return {String}
7586
+ * @api private
7587
+ */
7588
+
7589
+ function long(ms) {
7590
+ return plural(ms, d, 'day')
7591
+ || plural(ms, h, 'hour')
7592
+ || plural(ms, m, 'minute')
7593
+ || plural(ms, s, 'second')
7594
+ || ms + ' ms';
7595
+ }
7596
+
7597
+ /**
7598
+ * Pluralization helper.
7599
+ */
7600
+
7601
+ function plural(ms, n, name) {
7602
+ if (ms < n) return;
7603
+ if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
7604
+ return Math.ceil(ms / n) + ' ' + name + 's';
7605
+ }
7606
+
7607
+ },{}],157:[function(_dereq_,module,exports){
7608
+ /**
7609
+ * Module dependencies.
7610
+ */
7611
+
7612
+ var Emitter = _dereq_('emitter');
7613
+ var reduce = _dereq_('reduce');
7614
+ var requestBase = _dereq_('./request-base');
7615
+ var isObject = _dereq_('./is-object');
7616
+
7617
+ /**
7618
+ * Root reference for iframes.
7619
+ */
7620
+
7621
+ var root;
7622
+ if (typeof window !== 'undefined') { // Browser window
7623
+ root = window;
7624
+ } else if (typeof self !== 'undefined') { // Web Worker
7625
+ root = self;
7626
+ } else { // Other environments
7627
+ root = this;
7628
+ }
7629
+
7630
+ /**
7631
+ * Noop.
7632
+ */
7633
+
7634
+ function noop(){};
7635
+
7636
+ /**
7637
+ * Check if `obj` is a host object,
7638
+ * we don't want to serialize these :)
7639
+ *
7640
+ * TODO: future proof, move to compoent land
7641
+ *
7642
+ * @param {Object} obj
7643
+ * @return {Boolean}
7644
+ * @api private
7645
+ */
7646
+
7647
+ function isHost(obj) {
7648
+ var str = {}.toString.call(obj);
7649
+
7650
+ switch (str) {
7651
+ case '[object File]':
7652
+ case '[object Blob]':
7653
+ case '[object FormData]':
7654
+ return true;
7655
+ default:
7656
+ return false;
7657
+ }
7658
+ }
7659
+
7660
+ /**
7661
+ * Expose `request`.
7662
+ */
7663
+
7664
+ var request = module.exports = _dereq_('./request').bind(null, Request);
7665
+
7666
+ /**
7667
+ * Determine XHR.
7668
+ */
7669
+
7670
+ request.getXHR = function () {
7671
+ if (root.XMLHttpRequest
7672
+ && (!root.location || 'file:' != root.location.protocol
7673
+ || !root.ActiveXObject)) {
7674
+ return new XMLHttpRequest;
7675
+ } else {
7676
+ try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
7677
+ try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
7678
+ try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
7679
+ try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
7680
+ }
7681
+ return false;
7682
+ };
7683
+
7684
+ /**
7685
+ * Removes leading and trailing whitespace, added to support IE.
7686
+ *
7687
+ * @param {String} s
7688
+ * @return {String}
7689
+ * @api private
7690
+ */
7691
+
7692
+ var trim = ''.trim
7693
+ ? function(s) { return s.trim(); }
7694
+ : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
7695
+
7696
+ /**
7697
+ * Serialize the given `obj`.
7698
+ *
7699
+ * @param {Object} obj
7700
+ * @return {String}
7701
+ * @api private
7702
+ */
7703
+
7704
+ function serialize(obj) {
7705
+ if (!isObject(obj)) return obj;
7706
+ var pairs = [];
7707
+ for (var key in obj) {
7708
+ if (null != obj[key]) {
7709
+ pushEncodedKeyValuePair(pairs, key, obj[key]);
7710
+ }
7711
+ }
7712
+ return pairs.join('&');
7713
+ }
7714
+
7715
+ /**
7716
+ * Helps 'serialize' with serializing arrays.
7717
+ * Mutates the pairs array.
7718
+ *
7719
+ * @param {Array} pairs
7720
+ * @param {String} key
7721
+ * @param {Mixed} val
7722
+ */
7723
+
7724
+ function pushEncodedKeyValuePair(pairs, key, val) {
7725
+ if (Array.isArray(val)) {
7726
+ return val.forEach(function(v) {
7727
+ pushEncodedKeyValuePair(pairs, key, v);
7728
+ });
7729
+ }
7730
+ pairs.push(encodeURIComponent(key)
7731
+ + '=' + encodeURIComponent(val));
7732
+ }
7733
+
7734
+ /**
7735
+ * Expose serialization method.
7736
+ */
7737
+
7738
+ request.serializeObject = serialize;
7739
+
7740
+ /**
7741
+ * Parse the given x-www-form-urlencoded `str`.
7742
+ *
7743
+ * @param {String} str
7744
+ * @return {Object}
7745
+ * @api private
7746
+ */
7747
+
7748
+ function parseString(str) {
7749
+ var obj = {};
7750
+ var pairs = str.split('&');
7751
+ var parts;
7752
+ var pair;
7753
+
7754
+ for (var i = 0, len = pairs.length; i < len; ++i) {
7755
+ pair = pairs[i];
7756
+ parts = pair.split('=');
7757
+ obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
7758
+ }
7759
+
7760
+ return obj;
7761
+ }
7762
+
7763
+ /**
7764
+ * Expose parser.
7765
+ */
7766
+
7767
+ request.parseString = parseString;
7768
+
7769
+ /**
7770
+ * Default MIME type map.
7771
+ *
7772
+ * superagent.types.xml = 'application/xml';
7773
+ *
7774
+ */
7775
+
7776
+ request.types = {
7777
+ html: 'text/html',
7778
+ json: 'application/json',
7779
+ xml: 'application/xml',
7780
+ urlencoded: 'application/x-www-form-urlencoded',
7781
+ 'form': 'application/x-www-form-urlencoded',
7782
+ 'form-data': 'application/x-www-form-urlencoded'
7783
+ };
7784
+
7785
+ /**
7786
+ * Default serialization map.
7787
+ *
7788
+ * superagent.serialize['application/xml'] = function(obj){
7789
+ * return 'generated xml here';
7790
+ * };
7791
+ *
7792
+ */
7793
+
7794
+ request.serialize = {
7795
+ 'application/x-www-form-urlencoded': serialize,
7796
+ 'application/json': JSON.stringify
7797
+ };
7798
+
7799
+ /**
7800
+ * Default parsers.
7801
+ *
7802
+ * superagent.parse['application/xml'] = function(str){
7803
+ * return { object parsed from str };
7804
+ * };
7805
+ *
7806
+ */
7807
+
7808
+ request.parse = {
7809
+ 'application/x-www-form-urlencoded': parseString,
7810
+ 'application/json': JSON.parse
7811
+ };
7812
+
7813
+ /**
7814
+ * Parse the given header `str` into
7815
+ * an object containing the mapped fields.
7816
+ *
7817
+ * @param {String} str
7818
+ * @return {Object}
7819
+ * @api private
7820
+ */
7821
+
7822
+ function parseHeader(str) {
7823
+ var lines = str.split(/\r?\n/);
7824
+ var fields = {};
7825
+ var index;
7826
+ var line;
7827
+ var field;
7828
+ var val;
7829
+
7830
+ lines.pop(); // trailing CRLF
7831
+
7832
+ for (var i = 0, len = lines.length; i < len; ++i) {
7833
+ line = lines[i];
7834
+ index = line.indexOf(':');
7835
+ field = line.slice(0, index).toLowerCase();
7836
+ val = trim(line.slice(index + 1));
7837
+ fields[field] = val;
7838
+ }
7839
+
7840
+ return fields;
7841
+ }
7842
+
7843
+ /**
7844
+ * Check if `mime` is json or has +json structured syntax suffix.
7845
+ *
7846
+ * @param {String} mime
7847
+ * @return {Boolean}
7848
+ * @api private
7849
+ */
7850
+
7851
+ function isJSON(mime) {
7852
+ return /[\/+]json\b/.test(mime);
7853
+ }
7854
+
7855
+ /**
7856
+ * Return the mime type for the given `str`.
7857
+ *
7858
+ * @param {String} str
7859
+ * @return {String}
7860
+ * @api private
7861
+ */
7862
+
7863
+ function type(str){
7864
+ return str.split(/ *; */).shift();
7865
+ };
7866
+
7867
+ /**
7868
+ * Return header field parameters.
7869
+ *
7870
+ * @param {String} str
7871
+ * @return {Object}
7872
+ * @api private
7873
+ */
7874
+
7875
+ function params(str){
7876
+ return reduce(str.split(/ *; */), function(obj, str){
7877
+ var parts = str.split(/ *= */)
7878
+ , key = parts.shift()
7879
+ , val = parts.shift();
7880
+
7881
+ if (key && val) obj[key] = val;
7882
+ return obj;
7883
+ }, {});
7884
+ };
7885
+
7886
+ /**
7887
+ * Initialize a new `Response` with the given `xhr`.
7888
+ *
7889
+ * - set flags (.ok, .error, etc)
7890
+ * - parse header
7891
+ *
7892
+ * Examples:
7893
+ *
7894
+ * Aliasing `superagent` as `request` is nice:
7895
+ *
7896
+ * request = superagent;
7897
+ *
7898
+ * We can use the promise-like API, or pass callbacks:
7899
+ *
7900
+ * request.get('/').end(function(res){});
7901
+ * request.get('/', function(res){});
7902
+ *
7903
+ * Sending data can be chained:
7904
+ *
7905
+ * request
7906
+ * .post('/user')
7907
+ * .send({ name: 'tj' })
7908
+ * .end(function(res){});
7909
+ *
7910
+ * Or passed to `.send()`:
7911
+ *
7912
+ * request
7913
+ * .post('/user')
7914
+ * .send({ name: 'tj' }, function(res){});
7915
+ *
7916
+ * Or passed to `.post()`:
7917
+ *
7918
+ * request
7919
+ * .post('/user', { name: 'tj' })
7920
+ * .end(function(res){});
7921
+ *
7922
+ * Or further reduced to a single call for simple cases:
7923
+ *
7924
+ * request
7925
+ * .post('/user', { name: 'tj' }, function(res){});
7926
+ *
7927
+ * @param {XMLHTTPRequest} xhr
7928
+ * @param {Object} options
7929
+ * @api private
7930
+ */
7931
+
7932
+ function Response(req, options) {
7933
+ options = options || {};
7934
+ this.req = req;
7935
+ this.xhr = this.req.xhr;
7936
+ // responseText is accessible only if responseType is '' or 'text' and on older browsers
7937
+ this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')
7938
+ ? this.xhr.responseText
7939
+ : null;
7940
+ this.statusText = this.req.xhr.statusText;
7941
+ this.setStatusProperties(this.xhr.status);
7942
+ this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
7943
+ // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
7944
+ // getResponseHeader still works. so we get content-type even if getting
7945
+ // other headers fails.
7946
+ this.header['content-type'] = this.xhr.getResponseHeader('content-type');
7947
+ this.setHeaderProperties(this.header);
7948
+ this.body = this.req.method != 'HEAD'
7949
+ ? this.parseBody(this.text ? this.text : this.xhr.response)
7950
+ : null;
7951
+ }
7952
+
7953
+ /**
7954
+ * Get case-insensitive `field` value.
7955
+ *
7956
+ * @param {String} field
7957
+ * @return {String}
7958
+ * @api public
7959
+ */
7960
+
7961
+ Response.prototype.get = function(field){
7962
+ return this.header[field.toLowerCase()];
7963
+ };
7964
+
7965
+ /**
7966
+ * Set header related properties:
7967
+ *
7968
+ * - `.type` the content type without params
7969
+ *
7970
+ * A response of "Content-Type: text/plain; charset=utf-8"
7971
+ * will provide you with a `.type` of "text/plain".
7972
+ *
7973
+ * @param {Object} header
7974
+ * @api private
7975
+ */
7976
+
7977
+ Response.prototype.setHeaderProperties = function(header){
7978
+ // content-type
7979
+ var ct = this.header['content-type'] || '';
7980
+ this.type = type(ct);
7981
+
7982
+ // params
7983
+ var obj = params(ct);
7984
+ for (var key in obj) this[key] = obj[key];
7985
+ };
7986
+
7987
+ /**
7988
+ * Parse the given body `str`.
7989
+ *
7990
+ * Used for auto-parsing of bodies. Parsers
7991
+ * are defined on the `superagent.parse` object.
7992
+ *
7993
+ * @param {String} str
7994
+ * @return {Mixed}
7995
+ * @api private
7996
+ */
7997
+
7998
+ Response.prototype.parseBody = function(str){
7999
+ var parse = request.parse[this.type];
8000
+ if (!parse && isJSON(this.type)) {
8001
+ parse = request.parse['application/json'];
8002
+ }
8003
+ return parse && str && (str.length || str instanceof Object)
8004
+ ? parse(str)
8005
+ : null;
8006
+ };
8007
+
8008
+ /**
8009
+ * Set flags such as `.ok` based on `status`.
8010
+ *
8011
+ * For example a 2xx response will give you a `.ok` of __true__
8012
+ * whereas 5xx will be __false__ and `.error` will be __true__. The
8013
+ * `.clientError` and `.serverError` are also available to be more
8014
+ * specific, and `.statusType` is the class of error ranging from 1..5
8015
+ * sometimes useful for mapping respond colors etc.
8016
+ *
8017
+ * "sugar" properties are also defined for common cases. Currently providing:
8018
+ *
8019
+ * - .noContent
8020
+ * - .badRequest
8021
+ * - .unauthorized
8022
+ * - .notAcceptable
8023
+ * - .notFound
8024
+ *
8025
+ * @param {Number} status
8026
+ * @api private
8027
+ */
8028
+
8029
+ Response.prototype.setStatusProperties = function(status){
8030
+ // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
8031
+ if (status === 1223) {
8032
+ status = 204;
8033
+ }
8034
+
8035
+ var type = status / 100 | 0;
8036
+
8037
+ // status / class
8038
+ this.status = this.statusCode = status;
8039
+ this.statusType = type;
8040
+
8041
+ // basics
8042
+ this.info = 1 == type;
8043
+ this.ok = 2 == type;
8044
+ this.clientError = 4 == type;
8045
+ this.serverError = 5 == type;
8046
+ this.error = (4 == type || 5 == type)
8047
+ ? this.toError()
8048
+ : false;
8049
+
8050
+ // sugar
8051
+ this.accepted = 202 == status;
8052
+ this.noContent = 204 == status;
8053
+ this.badRequest = 400 == status;
8054
+ this.unauthorized = 401 == status;
8055
+ this.notAcceptable = 406 == status;
8056
+ this.notFound = 404 == status;
8057
+ this.forbidden = 403 == status;
8058
+ };
8059
+
8060
+ /**
8061
+ * Return an `Error` representative of this response.
8062
+ *
8063
+ * @return {Error}
8064
+ * @api public
8065
+ */
8066
+
8067
+ Response.prototype.toError = function(){
8068
+ var req = this.req;
8069
+ var method = req.method;
8070
+ var url = req.url;
8071
+
8072
+ var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';
8073
+ var err = new Error(msg);
8074
+ err.status = this.status;
8075
+ err.method = method;
8076
+ err.url = url;
8077
+
8078
+ return err;
8079
+ };
8080
+
8081
+ /**
8082
+ * Expose `Response`.
8083
+ */
8084
+
8085
+ request.Response = Response;
8086
+
8087
+ /**
8088
+ * Initialize a new `Request` with the given `method` and `url`.
8089
+ *
8090
+ * @param {String} method
8091
+ * @param {String} url
8092
+ * @api public
8093
+ */
8094
+
8095
+ function Request(method, url) {
8096
+ var self = this;
8097
+ this._query = this._query || [];
8098
+ this.method = method;
8099
+ this.url = url;
8100
+ this.header = {}; // preserves header name case
8101
+ this._header = {}; // coerces header names to lowercase
8102
+ this.on('end', function(){
8103
+ var err = null;
8104
+ var res = null;
8105
+
8106
+ try {
8107
+ res = new Response(self);
8108
+ } catch(e) {
8109
+ err = new Error('Parser is unable to parse the response');
8110
+ err.parse = true;
8111
+ err.original = e;
8112
+ // issue #675: return the raw response if the response parsing fails
8113
+ err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;
8114
+ // issue #876: return the http status code if the response parsing fails
8115
+ err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;
8116
+ return self.callback(err);
8117
+ }
8118
+
8119
+ self.emit('response', res);
8120
+
8121
+ if (err) {
8122
+ return self.callback(err, res);
8123
+ }
8124
+
8125
+ if (res.status >= 200 && res.status < 300) {
8126
+ return self.callback(err, res);
8127
+ }
8128
+
8129
+ var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
8130
+ new_err.original = err;
8131
+ new_err.response = res;
8132
+ new_err.status = res.status;
8133
+
8134
+ self.callback(new_err, res);
8135
+ });
8136
+ }
8137
+
8138
+ /**
8139
+ * Mixin `Emitter` and `requestBase`.
8140
+ */
8141
+
8142
+ Emitter(Request.prototype);
8143
+ for (var key in requestBase) {
8144
+ Request.prototype[key] = requestBase[key];
8145
+ }
8146
+
8147
+ /**
8148
+ * Abort the request, and clear potential timeout.
8149
+ *
8150
+ * @return {Request}
8151
+ * @api public
8152
+ */
8153
+
8154
+ Request.prototype.abort = function(){
8155
+ if (this.aborted) return;
8156
+ this.aborted = true;
8157
+ this.xhr && this.xhr.abort();
8158
+ this.clearTimeout();
8159
+ this.emit('abort');
8160
+ return this;
8161
+ };
8162
+
8163
+ /**
8164
+ * Set Content-Type to `type`, mapping values from `request.types`.
8165
+ *
8166
+ * Examples:
8167
+ *
8168
+ * superagent.types.xml = 'application/xml';
8169
+ *
8170
+ * request.post('/')
8171
+ * .type('xml')
8172
+ * .send(xmlstring)
8173
+ * .end(callback);
8174
+ *
8175
+ * request.post('/')
8176
+ * .type('application/xml')
8177
+ * .send(xmlstring)
8178
+ * .end(callback);
8179
+ *
8180
+ * @param {String} type
8181
+ * @return {Request} for chaining
8182
+ * @api public
8183
+ */
8184
+
8185
+ Request.prototype.type = function(type){
8186
+ this.set('Content-Type', request.types[type] || type);
8187
+ return this;
8188
+ };
8189
+
8190
+ /**
8191
+ * Set responseType to `val`. Presently valid responseTypes are 'blob' and
8192
+ * 'arraybuffer'.
8193
+ *
8194
+ * Examples:
8195
+ *
8196
+ * req.get('/')
8197
+ * .responseType('blob')
8198
+ * .end(callback);
8199
+ *
8200
+ * @param {String} val
8201
+ * @return {Request} for chaining
8202
+ * @api public
8203
+ */
8204
+
8205
+ Request.prototype.responseType = function(val){
8206
+ this._responseType = val;
8207
+ return this;
8208
+ };
8209
+
8210
+ /**
8211
+ * Set Accept to `type`, mapping values from `request.types`.
8212
+ *
8213
+ * Examples:
8214
+ *
8215
+ * superagent.types.json = 'application/json';
8216
+ *
8217
+ * request.get('/agent')
8218
+ * .accept('json')
8219
+ * .end(callback);
8220
+ *
8221
+ * request.get('/agent')
8222
+ * .accept('application/json')
8223
+ * .end(callback);
8224
+ *
8225
+ * @param {String} accept
8226
+ * @return {Request} for chaining
8227
+ * @api public
8228
+ */
8229
+
8230
+ Request.prototype.accept = function(type){
8231
+ this.set('Accept', request.types[type] || type);
8232
+ return this;
8233
+ };
8234
+
8235
+ /**
8236
+ * Set Authorization field value with `user` and `pass`.
8237
+ *
8238
+ * @param {String} user
8239
+ * @param {String} pass
8240
+ * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')
8241
+ * @return {Request} for chaining
8242
+ * @api public
8243
+ */
8244
+
8245
+ Request.prototype.auth = function(user, pass, options){
8246
+ if (!options) {
8247
+ options = {
8248
+ type: 'basic'
8249
+ }
8250
+ }
8251
+
8252
+ switch (options.type) {
8253
+ case 'basic':
8254
+ var str = btoa(user + ':' + pass);
8255
+ this.set('Authorization', 'Basic ' + str);
8256
+ break;
8257
+
8258
+ case 'auto':
8259
+ this.username = user;
8260
+ this.password = pass;
8261
+ break;
8262
+ }
8263
+ return this;
8264
+ };
8265
+
8266
+ /**
8267
+ * Add query-string `val`.
8268
+ *
8269
+ * Examples:
8270
+ *
8271
+ * request.get('/shoes')
8272
+ * .query('size=10')
8273
+ * .query({ color: 'blue' })
8274
+ *
8275
+ * @param {Object|String} val
8276
+ * @return {Request} for chaining
8277
+ * @api public
8278
+ */
8279
+
8280
+ Request.prototype.query = function(val){
8281
+ if ('string' != typeof val) val = serialize(val);
8282
+ if (val) this._query.push(val);
8283
+ return this;
8284
+ };
8285
+
8286
+ /**
8287
+ * Queue the given `file` as an attachment to the specified `field`,
8288
+ * with optional `filename`.
8289
+ *
8290
+ * ``` js
8291
+ * request.post('/upload')
8292
+ * .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
8293
+ * .end(callback);
8294
+ * ```
8295
+ *
8296
+ * @param {String} field
8297
+ * @param {Blob|File} file
8298
+ * @param {String} filename
8299
+ * @return {Request} for chaining
8300
+ * @api public
8301
+ */
8302
+
8303
+ Request.prototype.attach = function(field, file, filename){
8304
+ this._getFormData().append(field, file, filename || file.name);
8305
+ return this;
8306
+ };
8307
+
8308
+ Request.prototype._getFormData = function(){
8309
+ if (!this._formData) {
8310
+ this._formData = new root.FormData();
8311
+ }
8312
+ return this._formData;
8313
+ };
8314
+
8315
+ /**
8316
+ * Send `data` as the request body, defaulting the `.type()` to "json" when
8317
+ * an object is given.
8318
+ *
8319
+ * Examples:
8320
+ *
8321
+ * // manual json
8322
+ * request.post('/user')
8323
+ * .type('json')
8324
+ * .send('{"name":"tj"}')
8325
+ * .end(callback)
8326
+ *
8327
+ * // auto json
8328
+ * request.post('/user')
8329
+ * .send({ name: 'tj' })
8330
+ * .end(callback)
8331
+ *
8332
+ * // manual x-www-form-urlencoded
8333
+ * request.post('/user')
8334
+ * .type('form')
8335
+ * .send('name=tj')
8336
+ * .end(callback)
8337
+ *
8338
+ * // auto x-www-form-urlencoded
8339
+ * request.post('/user')
8340
+ * .type('form')
8341
+ * .send({ name: 'tj' })
8342
+ * .end(callback)
8343
+ *
8344
+ * // defaults to x-www-form-urlencoded
8345
+ * request.post('/user')
8346
+ * .send('name=tobi')
8347
+ * .send('species=ferret')
8348
+ * .end(callback)
8349
+ *
8350
+ * @param {String|Object} data
8351
+ * @return {Request} for chaining
8352
+ * @api public
8353
+ */
8354
+
8355
+ Request.prototype.send = function(data){
8356
+ var obj = isObject(data);
8357
+ var type = this._header['content-type'];
8358
+
8359
+ // merge
8360
+ if (obj && isObject(this._data)) {
8361
+ for (var key in data) {
8362
+ this._data[key] = data[key];
8363
+ }
8364
+ } else if ('string' == typeof data) {
8365
+ if (!type) this.type('form');
8366
+ type = this._header['content-type'];
8367
+ if ('application/x-www-form-urlencoded' == type) {
8368
+ this._data = this._data
8369
+ ? this._data + '&' + data
8370
+ : data;
8371
+ } else {
8372
+ this._data = (this._data || '') + data;
8373
+ }
8374
+ } else {
8375
+ this._data = data;
8376
+ }
8377
+
8378
+ if (!obj || isHost(data)) return this;
8379
+ if (!type) this.type('json');
8380
+ return this;
8381
+ };
8382
+
8383
+ /**
8384
+ * @deprecated
8385
+ */
8386
+ Response.prototype.parse = function serialize(fn){
8387
+ if (root.console) {
8388
+ console.warn("Client-side parse() method has been renamed to serialize(). This method is not compatible with superagent v2.0");
8389
+ }
8390
+ this.serialize(fn);
8391
+ return this;
8392
+ };
8393
+
8394
+ Response.prototype.serialize = function serialize(fn){
8395
+ this._parser = fn;
8396
+ return this;
8397
+ };
8398
+
8399
+ /**
8400
+ * Invoke the callback with `err` and `res`
8401
+ * and handle arity check.
8402
+ *
8403
+ * @param {Error} err
8404
+ * @param {Response} res
8405
+ * @api private
8406
+ */
8407
+
8408
+ Request.prototype.callback = function(err, res){
8409
+ var fn = this._callback;
8410
+ this.clearTimeout();
8411
+ fn(err, res);
8412
+ };
8413
+
8414
+ /**
8415
+ * Invoke callback with x-domain error.
8416
+ *
8417
+ * @api private
8418
+ */
8419
+
8420
+ Request.prototype.crossDomainError = function(){
8421
+ var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
8422
+ err.crossDomain = true;
8423
+
8424
+ err.status = this.status;
8425
+ err.method = this.method;
8426
+ err.url = this.url;
8427
+
8428
+ this.callback(err);
8429
+ };
8430
+
8431
+ /**
8432
+ * Invoke callback with timeout error.
8433
+ *
8434
+ * @api private
8435
+ */
8436
+
8437
+ Request.prototype.timeoutError = function(){
8438
+ var timeout = this._timeout;
8439
+ var err = new Error('timeout of ' + timeout + 'ms exceeded');
8440
+ err.timeout = timeout;
8441
+ this.callback(err);
8442
+ };
8443
+
8444
+ /**
8445
+ * Enable transmission of cookies with x-domain requests.
8446
+ *
8447
+ * Note that for this to work the origin must not be
8448
+ * using "Access-Control-Allow-Origin" with a wildcard,
8449
+ * and also must set "Access-Control-Allow-Credentials"
8450
+ * to "true".
8451
+ *
8452
+ * @api public
8453
+ */
8454
+
8455
+ Request.prototype.withCredentials = function(){
8456
+ this._withCredentials = true;
8457
+ return this;
8458
+ };
8459
+
8460
+ /**
8461
+ * Initiate request, invoking callback `fn(res)`
8462
+ * with an instanceof `Response`.
8463
+ *
8464
+ * @param {Function} fn
8465
+ * @return {Request} for chaining
8466
+ * @api public
8467
+ */
8468
+
8469
+ Request.prototype.end = function(fn){
8470
+ var self = this;
8471
+ var xhr = this.xhr = request.getXHR();
8472
+ var query = this._query.join('&');
8473
+ var timeout = this._timeout;
8474
+ var data = this._formData || this._data;
8475
+
8476
+ // store callback
8477
+ this._callback = fn || noop;
8478
+
8479
+ // state change
8480
+ xhr.onreadystatechange = function(){
8481
+ if (4 != xhr.readyState) return;
8482
+
8483
+ // In IE9, reads to any property (e.g. status) off of an aborted XHR will
8484
+ // result in the error "Could not complete the operation due to error c00c023f"
8485
+ var status;
8486
+ try { status = xhr.status } catch(e) { status = 0; }
8487
+
8488
+ if (0 == status) {
8489
+ if (self.timedout) return self.timeoutError();
8490
+ if (self.aborted) return;
8491
+ return self.crossDomainError();
8492
+ }
8493
+ self.emit('end');
8494
+ };
8495
+
8496
+ // progress
8497
+ var handleProgress = function(e){
8498
+ if (e.total > 0) {
8499
+ e.percent = e.loaded / e.total * 100;
8500
+ }
8501
+ e.direction = 'download';
8502
+ self.emit('progress', e);
8503
+ };
8504
+ if (this.hasListeners('progress')) {
8505
+ xhr.onprogress = handleProgress;
8506
+ }
8507
+ try {
8508
+ if (xhr.upload && this.hasListeners('progress')) {
8509
+ xhr.upload.onprogress = handleProgress;
8510
+ }
8511
+ } catch(e) {
8512
+ // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
8513
+ // Reported here:
8514
+ // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
8515
+ }
8516
+
8517
+ // timeout
8518
+ if (timeout && !this._timer) {
8519
+ this._timer = setTimeout(function(){
8520
+ self.timedout = true;
8521
+ self.abort();
8522
+ }, timeout);
8523
+ }
8524
+
8525
+ // querystring
8526
+ if (query) {
8527
+ query = request.serializeObject(query);
8528
+ this.url += ~this.url.indexOf('?')
8529
+ ? '&' + query
8530
+ : '?' + query;
8531
+ }
8532
+
8533
+ // initiate request
8534
+ if (this.username && this.password) {
8535
+ xhr.open(this.method, this.url, true, this.username, this.password);
8536
+ } else {
8537
+ xhr.open(this.method, this.url, true);
8538
+ }
8539
+
8540
+ // CORS
8541
+ if (this._withCredentials) xhr.withCredentials = true;
8542
+
8543
+ // body
8544
+ if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
8545
+ // serialize stuff
8546
+ var contentType = this._header['content-type'];
8547
+ var serialize = this._parser || request.serialize[contentType ? contentType.split(';')[0] : ''];
8548
+ if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];
8549
+ if (serialize) data = serialize(data);
8550
+ }
8551
+
8552
+ // set header fields
8553
+ for (var field in this.header) {
8554
+ if (null == this.header[field]) continue;
8555
+ xhr.setRequestHeader(field, this.header[field]);
8556
+ }
8557
+
8558
+ if (this._responseType) {
8559
+ xhr.responseType = this._responseType;
8560
+ }
8561
+
8562
+ // send stuff
8563
+ this.emit('request', this);
8564
+
8565
+ // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
8566
+ // We need null here if data is undefined
8567
+ xhr.send(typeof data !== 'undefined' ? data : null);
8568
+ return this;
8569
+ };
8570
+
8571
+
8572
+ /**
8573
+ * Expose `Request`.
8574
+ */
8575
+
8576
+ request.Request = Request;
8577
+
8578
+ /**
8579
+ * GET `url` with optional callback `fn(res)`.
8580
+ *
8581
+ * @param {String} url
8582
+ * @param {Mixed|Function} data or fn
8583
+ * @param {Function} fn
8584
+ * @return {Request}
8585
+ * @api public
8586
+ */
8587
+
8588
+ request.get = function(url, data, fn){
8589
+ var req = request('GET', url);
8590
+ if ('function' == typeof data) fn = data, data = null;
8591
+ if (data) req.query(data);
8592
+ if (fn) req.end(fn);
8593
+ return req;
8594
+ };
8595
+
8596
+ /**
8597
+ * HEAD `url` with optional callback `fn(res)`.
8598
+ *
8599
+ * @param {String} url
8600
+ * @param {Mixed|Function} data or fn
8601
+ * @param {Function} fn
8602
+ * @return {Request}
8603
+ * @api public
8604
+ */
8605
+
8606
+ request.head = function(url, data, fn){
8607
+ var req = request('HEAD', url);
8608
+ if ('function' == typeof data) fn = data, data = null;
8609
+ if (data) req.send(data);
8610
+ if (fn) req.end(fn);
8611
+ return req;
8612
+ };
8613
+
8614
+ /**
8615
+ * DELETE `url` with optional callback `fn(res)`.
8616
+ *
8617
+ * @param {String} url
8618
+ * @param {Function} fn
8619
+ * @return {Request}
8620
+ * @api public
8621
+ */
8622
+
8623
+ function del(url, fn){
8624
+ var req = request('DELETE', url);
8625
+ if (fn) req.end(fn);
8626
+ return req;
8627
+ };
8628
+
8629
+ request['del'] = del;
8630
+ request['delete'] = del;
8631
+
8632
+ /**
8633
+ * PATCH `url` with optional `data` and callback `fn(res)`.
8634
+ *
8635
+ * @param {String} url
8636
+ * @param {Mixed} data
8637
+ * @param {Function} fn
8638
+ * @return {Request}
8639
+ * @api public
8640
+ */
8641
+
8642
+ request.patch = function(url, data, fn){
8643
+ var req = request('PATCH', url);
8644
+ if ('function' == typeof data) fn = data, data = null;
8645
+ if (data) req.send(data);
8646
+ if (fn) req.end(fn);
8647
+ return req;
8648
+ };
8649
+
8650
+ /**
8651
+ * POST `url` with optional `data` and callback `fn(res)`.
8652
+ *
8653
+ * @param {String} url
8654
+ * @param {Mixed} data
8655
+ * @param {Function} fn
8656
+ * @return {Request}
8657
+ * @api public
8658
+ */
8659
+
8660
+ request.post = function(url, data, fn){
8661
+ var req = request('POST', url);
8662
+ if ('function' == typeof data) fn = data, data = null;
8663
+ if (data) req.send(data);
8664
+ if (fn) req.end(fn);
8665
+ return req;
8666
+ };
8667
+
8668
+ /**
8669
+ * PUT `url` with optional `data` and callback `fn(res)`.
8670
+ *
8671
+ * @param {String} url
8672
+ * @param {Mixed|Function} data or fn
8673
+ * @param {Function} fn
8674
+ * @return {Request}
8675
+ * @api public
8676
+ */
8677
+
8678
+ request.put = function(url, data, fn){
8679
+ var req = request('PUT', url);
8680
+ if ('function' == typeof data) fn = data, data = null;
8681
+ if (data) req.send(data);
8682
+ if (fn) req.end(fn);
8683
+ return req;
8684
+ };
8685
+
8686
+ },{"./is-object":158,"./request":160,"./request-base":159,"emitter":161,"reduce":162}],158:[function(_dereq_,module,exports){
8687
+ /**
8688
+ * Check if `obj` is an object.
8689
+ *
8690
+ * @param {Object} obj
8691
+ * @return {Boolean}
8692
+ * @api private
8693
+ */
8694
+
8695
+ function isObject(obj) {
8696
+ return null != obj && 'object' == typeof obj;
8697
+ }
8698
+
8699
+ module.exports = isObject;
8700
+
8701
+ },{}],159:[function(_dereq_,module,exports){
8702
+ /**
8703
+ * Module of mixed-in functions shared between node and client code
8704
+ */
8705
+ var isObject = _dereq_('./is-object');
8706
+
8707
+ /**
8708
+ * Clear previous timeout.
8709
+ *
8710
+ * @return {Request} for chaining
8711
+ * @api public
8712
+ */
8713
+
8714
+ exports.clearTimeout = function _clearTimeout(){
8715
+ this._timeout = 0;
8716
+ clearTimeout(this._timer);
8717
+ return this;
8718
+ };
8719
+
8720
+ /**
8721
+ * Force given parser
8722
+ *
8723
+ * Sets the body parser no matter type.
8724
+ *
8725
+ * @param {Function}
8726
+ * @api public
8727
+ */
8728
+
8729
+ exports.parse = function parse(fn){
8730
+ this._parser = fn;
8731
+ return this;
8732
+ };
8733
+
8734
+ /**
8735
+ * Set timeout to `ms`.
8736
+ *
8737
+ * @param {Number} ms
8738
+ * @return {Request} for chaining
8739
+ * @api public
8740
+ */
8741
+
8742
+ exports.timeout = function timeout(ms){
8743
+ this._timeout = ms;
8744
+ return this;
8745
+ };
8746
+
8747
+ /**
8748
+ * Faux promise support
8749
+ *
8750
+ * @param {Function} fulfill
8751
+ * @param {Function} reject
8752
+ * @return {Request}
8753
+ */
8754
+
8755
+ exports.then = function then(fulfill, reject) {
8756
+ return this.end(function(err, res) {
8757
+ err ? reject(err) : fulfill(res);
8758
+ });
8759
+ }
8760
+
8761
+ /**
8762
+ * Allow for extension
8763
+ */
8764
+
8765
+ exports.use = function use(fn) {
8766
+ fn(this);
8767
+ return this;
8768
+ }
8769
+
8770
+
8771
+ /**
8772
+ * Get request header `field`.
8773
+ * Case-insensitive.
8774
+ *
8775
+ * @param {String} field
8776
+ * @return {String}
8777
+ * @api public
8778
+ */
8779
+
8780
+ exports.get = function(field){
8781
+ return this._header[field.toLowerCase()];
8782
+ };
8783
+
8784
+ /**
8785
+ * Get case-insensitive header `field` value.
8786
+ * This is a deprecated internal API. Use `.get(field)` instead.
8787
+ *
8788
+ * (getHeader is no longer used internally by the superagent code base)
8789
+ *
8790
+ * @param {String} field
8791
+ * @return {String}
8792
+ * @api private
8793
+ * @deprecated
8794
+ */
8795
+
8796
+ exports.getHeader = exports.get;
8797
+
8798
+ /**
8799
+ * Set header `field` to `val`, or multiple fields with one object.
8800
+ * Case-insensitive.
8801
+ *
8802
+ * Examples:
8803
+ *
8804
+ * req.get('/')
8805
+ * .set('Accept', 'application/json')
8806
+ * .set('X-API-Key', 'foobar')
8807
+ * .end(callback);
8808
+ *
8809
+ * req.get('/')
8810
+ * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
8811
+ * .end(callback);
8812
+ *
8813
+ * @param {String|Object} field
8814
+ * @param {String} val
8815
+ * @return {Request} for chaining
8816
+ * @api public
8817
+ */
8818
+
8819
+ exports.set = function(field, val){
8820
+ if (isObject(field)) {
8821
+ for (var key in field) {
8822
+ this.set(key, field[key]);
8823
+ }
8824
+ return this;
8825
+ }
8826
+ this._header[field.toLowerCase()] = val;
8827
+ this.header[field] = val;
8828
+ return this;
8829
+ };
8830
+
8831
+ /**
8832
+ * Remove header `field`.
8833
+ * Case-insensitive.
8834
+ *
8835
+ * Example:
8836
+ *
8837
+ * req.get('/')
8838
+ * .unset('User-Agent')
8839
+ * .end(callback);
8840
+ *
8841
+ * @param {String} field
8842
+ */
8843
+ exports.unset = function(field){
8844
+ delete this._header[field.toLowerCase()];
8845
+ delete this.header[field];
8846
+ return this;
8847
+ };
8848
+
8849
+ /**
8850
+ * Write the field `name` and `val` for "multipart/form-data"
8851
+ * request bodies.
8852
+ *
8853
+ * ``` js
8854
+ * request.post('/upload')
8855
+ * .field('foo', 'bar')
8856
+ * .end(callback);
8857
+ * ```
8858
+ *
8859
+ * @param {String} name
8860
+ * @param {String|Blob|File|Buffer|fs.ReadStream} val
8861
+ * @return {Request} for chaining
8862
+ * @api public
8863
+ */
8864
+ exports.field = function(name, val) {
8865
+ this._getFormData().append(name, val);
8866
+ return this;
8867
+ };
8868
+
8869
+ },{"./is-object":158}],160:[function(_dereq_,module,exports){
8870
+ // The node and browser modules expose versions of this with the
8871
+ // appropriate constructor function bound as first argument
8872
+ /**
8873
+ * Issue a request:
8874
+ *
8875
+ * Examples:
8876
+ *
8877
+ * request('GET', '/users').end(callback)
8878
+ * request('/users').end(callback)
8879
+ * request('/users', callback)
8880
+ *
8881
+ * @param {String} method
8882
+ * @param {String|Function} url or callback
8883
+ * @return {Request}
8884
+ * @api public
8885
+ */
8886
+
8887
+ function request(RequestConstructor, method, url) {
8888
+ // callback
8889
+ if ('function' == typeof url) {
8890
+ return new RequestConstructor('GET', method).end(url);
8891
+ }
8892
+
8893
+ // url first
8894
+ if (2 == arguments.length) {
8895
+ return new RequestConstructor('GET', method);
8896
+ }
8897
+
8898
+ return new RequestConstructor(method, url);
8899
+ }
8900
+
8901
+ module.exports = request;
8902
+
8903
+ },{}],161:[function(_dereq_,module,exports){
8904
+
8905
+ /**
8906
+ * Expose `Emitter`.
8907
+ */
8908
+
8909
+ if (typeof module !== 'undefined') {
8910
+ module.exports = Emitter;
8911
+ }
8912
+
8913
+ /**
8914
+ * Initialize a new `Emitter`.
8915
+ *
8916
+ * @api public
8917
+ */
8918
+
8919
+ function Emitter(obj) {
8920
+ if (obj) return mixin(obj);
8921
+ };
8922
+
8923
+ /**
8924
+ * Mixin the emitter properties.
8925
+ *
8926
+ * @param {Object} obj
8927
+ * @return {Object}
8928
+ * @api private
8929
+ */
8930
+
8931
+ function mixin(obj) {
8932
+ for (var key in Emitter.prototype) {
8933
+ obj[key] = Emitter.prototype[key];
8934
+ }
8935
+ return obj;
8936
+ }
8937
+
8938
+ /**
8939
+ * Listen on the given `event` with `fn`.
8940
+ *
8941
+ * @param {String} event
8942
+ * @param {Function} fn
8943
+ * @return {Emitter}
8944
+ * @api public
8945
+ */
8946
+
8947
+ Emitter.prototype.on =
8948
+ Emitter.prototype.addEventListener = function(event, fn){
8949
+ this._callbacks = this._callbacks || {};
8950
+ (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
8951
+ .push(fn);
8952
+ return this;
8953
+ };
8954
+
8955
+ /**
8956
+ * Adds an `event` listener that will be invoked a single
8957
+ * time then automatically removed.
8958
+ *
8959
+ * @param {String} event
8960
+ * @param {Function} fn
8961
+ * @return {Emitter}
8962
+ * @api public
8963
+ */
8964
+
8965
+ Emitter.prototype.once = function(event, fn){
8966
+ function on() {
8967
+ this.off(event, on);
8968
+ fn.apply(this, arguments);
8969
+ }
8970
+
8971
+ on.fn = fn;
8972
+ this.on(event, on);
8973
+ return this;
8974
+ };
8975
+
8976
+ /**
8977
+ * Remove the given callback for `event` or all
8978
+ * registered callbacks.
8979
+ *
8980
+ * @param {String} event
8981
+ * @param {Function} fn
8982
+ * @return {Emitter}
8983
+ * @api public
8984
+ */
8985
+
8986
+ Emitter.prototype.off =
8987
+ Emitter.prototype.removeListener =
8988
+ Emitter.prototype.removeAllListeners =
8989
+ Emitter.prototype.removeEventListener = function(event, fn){
8990
+ this._callbacks = this._callbacks || {};
8991
+
8992
+ // all
8993
+ if (0 == arguments.length) {
8994
+ this._callbacks = {};
8995
+ return this;
8996
+ }
8997
+
8998
+ // specific event
8999
+ var callbacks = this._callbacks['$' + event];
9000
+ if (!callbacks) return this;
9001
+
9002
+ // remove all handlers
9003
+ if (1 == arguments.length) {
9004
+ delete this._callbacks['$' + event];
9005
+ return this;
9006
+ }
9007
+
9008
+ // remove specific handler
9009
+ var cb;
9010
+ for (var i = 0; i < callbacks.length; i++) {
9011
+ cb = callbacks[i];
9012
+ if (cb === fn || cb.fn === fn) {
9013
+ callbacks.splice(i, 1);
9014
+ break;
9015
+ }
9016
+ }
9017
+ return this;
9018
+ };
9019
+
9020
+ /**
9021
+ * Emit `event` with the given args.
9022
+ *
9023
+ * @param {String} event
9024
+ * @param {Mixed} ...
9025
+ * @return {Emitter}
9026
+ */
9027
+
9028
+ Emitter.prototype.emit = function(event){
9029
+ this._callbacks = this._callbacks || {};
9030
+ var args = [].slice.call(arguments, 1)
9031
+ , callbacks = this._callbacks['$' + event];
9032
+
9033
+ if (callbacks) {
9034
+ callbacks = callbacks.slice(0);
9035
+ for (var i = 0, len = callbacks.length; i < len; ++i) {
9036
+ callbacks[i].apply(this, args);
9037
+ }
9038
+ }
9039
+
9040
+ return this;
9041
+ };
9042
+
9043
+ /**
9044
+ * Return array of callbacks for `event`.
9045
+ *
9046
+ * @param {String} event
9047
+ * @return {Array}
9048
+ * @api public
9049
+ */
9050
+
9051
+ Emitter.prototype.listeners = function(event){
9052
+ this._callbacks = this._callbacks || {};
9053
+ return this._callbacks['$' + event] || [];
9054
+ };
9055
+
9056
+ /**
9057
+ * Check if this emitter has `event` handlers.
9058
+ *
9059
+ * @param {String} event
9060
+ * @return {Boolean}
9061
+ * @api public
9062
+ */
9063
+
9064
+ Emitter.prototype.hasListeners = function(event){
9065
+ return !! this.listeners(event).length;
9066
+ };
9067
+
9068
+ },{}],162:[function(_dereq_,module,exports){
9069
+
9070
+ /**
9071
+ * Reduce `arr` with `fn`.
9072
+ *
9073
+ * @param {Array} arr
9074
+ * @param {Function} fn
9075
+ * @param {Mixed} initial
9076
+ *
9077
+ * TODO: combatible error handling?
9078
+ */
9079
+
9080
+ module.exports = function(arr, fn, initial){
9081
+ var idx = 0;
9082
+ var len = arr.length;
9083
+ var curr = arguments.length == 3
9084
+ ? initial
9085
+ : arr[idx++];
9086
+
9087
+ while (idx < len) {
9088
+ curr = fn.call(null, curr, arr[idx], ++idx, arr);
9089
+ }
9090
+
9091
+ return curr;
9092
+ };
9093
+ },{}],163:[function(_dereq_,module,exports){
9094
+ /**
9095
+ * Indicates that navigation was caused by a call to history.push.
9096
+ */
9097
+ 'use strict';
9098
+
9099
+ exports.__esModule = true;
9100
+ var PUSH = 'PUSH';
9101
+
9102
+ exports.PUSH = PUSH;
9103
+ /**
9104
+ * Indicates that navigation was caused by a call to history.replace.
9105
+ */
9106
+ var REPLACE = 'REPLACE';
9107
+
9108
+ exports.REPLACE = REPLACE;
9109
+ /**
9110
+ * Indicates that navigation was caused by some other action such
9111
+ * as using a browser's back/forward buttons and/or manually manipulating
9112
+ * the URL in a browser's location bar. This is the default.
9113
+ *
9114
+ * See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
9115
+ * for more information.
9116
+ */
9117
+ var POP = 'POP';
9118
+
9119
+ exports.POP = POP;
9120
+ exports['default'] = {
9121
+ PUSH: PUSH,
9122
+ REPLACE: REPLACE,
9123
+ POP: POP
9124
+ };
9125
+ },{}],164:[function(_dereq_,module,exports){
9126
+ "use strict";
9127
+
9128
+ exports.__esModule = true;
9129
+ exports.loopAsync = loopAsync;
9130
+
9131
+ function loopAsync(turns, work, callback) {
9132
+ var currentTurn = 0;
9133
+ var isDone = false;
9134
+
9135
+ function done() {
9136
+ isDone = true;
9137
+ callback.apply(this, arguments);
9138
+ }
9139
+
9140
+ function next() {
9141
+ if (isDone) return;
9142
+
9143
+ if (currentTurn < turns) {
9144
+ work.call(this, currentTurn++, next, done);
9145
+ } else {
9146
+ done.apply(this, arguments);
9147
+ }
9148
+ }
9149
+
9150
+ next();
9151
+ }
9152
+ },{}],165:[function(_dereq_,module,exports){
9153
+ (function (process){
9154
+ /*eslint-disable no-empty */
9155
+ 'use strict';
9156
+
9157
+ exports.__esModule = true;
9158
+ exports.saveState = saveState;
9159
+ exports.readState = readState;
9160
+
9161
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9162
+
9163
+ var _warning = _dereq_('warning');
9164
+
9165
+ var _warning2 = _interopRequireDefault(_warning);
9166
+
9167
+ var KeyPrefix = '@@History/';
9168
+ var QuotaExceededError = 'QuotaExceededError';
9169
+ var SecurityError = 'SecurityError';
9170
+
9171
+ function createKey(key) {
9172
+ return KeyPrefix + key;
9173
+ }
9174
+
9175
+ function saveState(key, state) {
9176
+ try {
9177
+ window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
9178
+ } catch (error) {
9179
+ if (error.name === SecurityError) {
9180
+ // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
9181
+ // attempt to access window.sessionStorage.
9182
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;
9183
+
9184
+ return;
9185
+ }
9186
+
9187
+ if (error.name === QuotaExceededError && window.sessionStorage.length === 0) {
9188
+ // Safari "private mode" throws QuotaExceededError.
9189
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;
9190
+
9191
+ return;
9192
+ }
9193
+
9194
+ throw error;
9195
+ }
9196
+ }
9197
+
9198
+ function readState(key) {
9199
+ var json = undefined;
9200
+ try {
9201
+ json = window.sessionStorage.getItem(createKey(key));
9202
+ } catch (error) {
9203
+ if (error.name === SecurityError) {
9204
+ // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
9205
+ // attempt to access window.sessionStorage.
9206
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;
9207
+
9208
+ return null;
9209
+ }
9210
+ }
9211
+
9212
+ if (json) {
9213
+ try {
9214
+ return JSON.parse(json);
9215
+ } catch (error) {
9216
+ // Ignore invalid JSON.
9217
+ }
9218
+ }
9219
+
9220
+ return null;
9221
+ }
9222
+ }).call(this,_dereq_('_process'))
9223
+
9224
+ },{"_process":2,"warning":185}],166:[function(_dereq_,module,exports){
9225
+ 'use strict';
9226
+
9227
+ exports.__esModule = true;
9228
+ exports.addEventListener = addEventListener;
9229
+ exports.removeEventListener = removeEventListener;
9230
+ exports.getHashPath = getHashPath;
9231
+ exports.replaceHashPath = replaceHashPath;
9232
+ exports.getWindowPath = getWindowPath;
9233
+ exports.go = go;
9234
+ exports.getUserConfirmation = getUserConfirmation;
9235
+ exports.supportsHistory = supportsHistory;
9236
+ exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash;
9237
+
9238
+ function addEventListener(node, event, listener) {
9239
+ if (node.addEventListener) {
9240
+ node.addEventListener(event, listener, false);
9241
+ } else {
9242
+ node.attachEvent('on' + event, listener);
9243
+ }
9244
+ }
9245
+
9246
+ function removeEventListener(node, event, listener) {
9247
+ if (node.removeEventListener) {
9248
+ node.removeEventListener(event, listener, false);
9249
+ } else {
9250
+ node.detachEvent('on' + event, listener);
9251
+ }
9252
+ }
9253
+
9254
+ function getHashPath() {
9255
+ // We can't use window.location.hash here because it's not
9256
+ // consistent across browsers - Firefox will pre-decode it!
9257
+ return window.location.href.split('#')[1] || '';
9258
+ }
9259
+
9260
+ function replaceHashPath(path) {
9261
+ window.location.replace(window.location.pathname + window.location.search + '#' + path);
9262
+ }
9263
+
9264
+ function getWindowPath() {
9265
+ return window.location.pathname + window.location.search + window.location.hash;
9266
+ }
9267
+
9268
+ function go(n) {
9269
+ if (n) window.history.go(n);
9270
+ }
9271
+
9272
+ function getUserConfirmation(message, callback) {
9273
+ callback(window.confirm(message));
9274
+ }
9275
+
9276
+ /**
9277
+ * Returns true if the HTML5 history API is supported. Taken from Modernizr.
9278
+ *
9279
+ * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
9280
+ * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
9281
+ * changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
9282
+ */
9283
+
9284
+ function supportsHistory() {
9285
+ var ua = navigator.userAgent;
9286
+ if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
9287
+ return false;
9288
+ }
9289
+ // FIXME: Work around our browser history not working correctly on Chrome
9290
+ // iOS: https://github.com/rackt/react-router/issues/2565
9291
+ if (ua.indexOf('CriOS') !== -1) {
9292
+ return false;
9293
+ }
9294
+ return window.history && 'pushState' in window.history;
9295
+ }
9296
+
9297
+ /**
9298
+ * Returns false if using go(n) with hash history causes a full page reload.
9299
+ */
9300
+
9301
+ function supportsGoWithoutReloadUsingHash() {
9302
+ var ua = navigator.userAgent;
9303
+ return ua.indexOf('Firefox') === -1;
9304
+ }
9305
+ },{}],167:[function(_dereq_,module,exports){
9306
+ 'use strict';
9307
+
9308
+ exports.__esModule = true;
9309
+ var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
9310
+ exports.canUseDOM = canUseDOM;
9311
+ },{}],168:[function(_dereq_,module,exports){
9312
+ (function (process){
9313
+ 'use strict';
9314
+
9315
+ exports.__esModule = true;
9316
+
9317
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9318
+
9319
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9320
+
9321
+ var _invariant = _dereq_('invariant');
9322
+
9323
+ var _invariant2 = _interopRequireDefault(_invariant);
9324
+
9325
+ var _ExecutionEnvironment = _dereq_('./ExecutionEnvironment');
9326
+
9327
+ var _DOMUtils = _dereq_('./DOMUtils');
9328
+
9329
+ var _createHistory = _dereq_('./createHistory');
9330
+
9331
+ var _createHistory2 = _interopRequireDefault(_createHistory);
9332
+
9333
+ function createDOMHistory(options) {
9334
+ var history = _createHistory2['default'](_extends({
9335
+ getUserConfirmation: _DOMUtils.getUserConfirmation
9336
+ }, options, {
9337
+ go: _DOMUtils.go
9338
+ }));
9339
+
9340
+ function listen(listener) {
9341
+ !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined;
9342
+
9343
+ return history.listen(listener);
9344
+ }
9345
+
9346
+ return _extends({}, history, {
9347
+ listen: listen
9348
+ });
9349
+ }
9350
+
9351
+ exports['default'] = createDOMHistory;
9352
+ module.exports = exports['default'];
9353
+ }).call(this,_dereq_('_process'))
9354
+
9355
+ },{"./DOMUtils":166,"./ExecutionEnvironment":167,"./createHistory":170,"_process":2,"invariant":182}],169:[function(_dereq_,module,exports){
9356
+ (function (process){
9357
+ 'use strict';
9358
+
9359
+ exports.__esModule = true;
9360
+
9361
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9362
+
9363
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9364
+
9365
+ var _warning = _dereq_('warning');
9366
+
9367
+ var _warning2 = _interopRequireDefault(_warning);
9368
+
9369
+ var _invariant = _dereq_('invariant');
9370
+
9371
+ var _invariant2 = _interopRequireDefault(_invariant);
9372
+
9373
+ var _Actions = _dereq_('./Actions');
9374
+
9375
+ var _ExecutionEnvironment = _dereq_('./ExecutionEnvironment');
9376
+
9377
+ var _DOMUtils = _dereq_('./DOMUtils');
9378
+
9379
+ var _DOMStateStorage = _dereq_('./DOMStateStorage');
9380
+
9381
+ var _createDOMHistory = _dereq_('./createDOMHistory');
9382
+
9383
+ var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
9384
+
9385
+ var _parsePath = _dereq_('./parsePath');
9386
+
9387
+ var _parsePath2 = _interopRequireDefault(_parsePath);
9388
+
9389
+ function isAbsolutePath(path) {
9390
+ return typeof path === 'string' && path.charAt(0) === '/';
9391
+ }
9392
+
9393
+ function ensureSlash() {
9394
+ var path = _DOMUtils.getHashPath();
9395
+
9396
+ if (isAbsolutePath(path)) return true;
9397
+
9398
+ _DOMUtils.replaceHashPath('/' + path);
9399
+
9400
+ return false;
9401
+ }
9402
+
9403
+ function addQueryStringValueToPath(path, key, value) {
9404
+ return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value);
9405
+ }
9406
+
9407
+ function stripQueryStringValueFromPath(path, key) {
9408
+ return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), '');
9409
+ }
9410
+
9411
+ function getQueryStringValueFromPath(path, key) {
9412
+ var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b'));
9413
+ return match && match[1];
9414
+ }
9415
+
9416
+ var DefaultQueryKey = '_k';
9417
+
9418
+ function createHashHistory() {
9419
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
9420
+
9421
+ !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined;
9422
+
9423
+ var queryKey = options.queryKey;
9424
+
9425
+ if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey;
9426
+
9427
+ function getCurrentLocation() {
9428
+ var path = _DOMUtils.getHashPath();
9429
+
9430
+ var key = undefined,
9431
+ state = undefined;
9432
+ if (queryKey) {
9433
+ key = getQueryStringValueFromPath(path, queryKey);
9434
+ path = stripQueryStringValueFromPath(path, queryKey);
9435
+
9436
+ if (key) {
9437
+ state = _DOMStateStorage.readState(key);
9438
+ } else {
9439
+ state = null;
9440
+ key = history.createKey();
9441
+ _DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key));
9442
+ }
9443
+ } else {
9444
+ key = state = null;
9445
+ }
9446
+
9447
+ var location = _parsePath2['default'](path);
9448
+
9449
+ return history.createLocation(_extends({}, location, { state: state }), undefined, key);
9450
+ }
9451
+
9452
+ function startHashChangeListener(_ref) {
9453
+ var transitionTo = _ref.transitionTo;
9454
+
9455
+ function hashChangeListener() {
9456
+ if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /.
9457
+
9458
+ transitionTo(getCurrentLocation());
9459
+ }
9460
+
9461
+ ensureSlash();
9462
+ _DOMUtils.addEventListener(window, 'hashchange', hashChangeListener);
9463
+
9464
+ return function () {
9465
+ _DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener);
9466
+ };
9467
+ }
9468
+
9469
+ function finishTransition(location) {
9470
+ var basename = location.basename;
9471
+ var pathname = location.pathname;
9472
+ var search = location.search;
9473
+ var state = location.state;
9474
+ var action = location.action;
9475
+ var key = location.key;
9476
+
9477
+ if (action === _Actions.POP) return; // Nothing to do.
9478
+
9479
+ var path = (basename || '') + pathname + search;
9480
+
9481
+ if (queryKey) {
9482
+ path = addQueryStringValueToPath(path, queryKey, key);
9483
+ _DOMStateStorage.saveState(key, state);
9484
+ } else {
9485
+ // Drop key and state.
9486
+ location.key = location.state = null;
9487
+ }
9488
+
9489
+ var currentHash = _DOMUtils.getHashPath();
9490
+
9491
+ if (action === _Actions.PUSH) {
9492
+ if (currentHash !== path) {
9493
+ window.location.hash = path;
9494
+ } else {
9495
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined;
9496
+ }
9497
+ } else if (currentHash !== path) {
9498
+ // REPLACE
9499
+ _DOMUtils.replaceHashPath(path);
9500
+ }
9501
+ }
9502
+
9503
+ var history = _createDOMHistory2['default'](_extends({}, options, {
9504
+ getCurrentLocation: getCurrentLocation,
9505
+ finishTransition: finishTransition,
9506
+ saveState: _DOMStateStorage.saveState
9507
+ }));
9508
+
9509
+ var listenerCount = 0,
9510
+ stopHashChangeListener = undefined;
9511
+
9512
+ function listenBefore(listener) {
9513
+ if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
9514
+
9515
+ var unlisten = history.listenBefore(listener);
9516
+
9517
+ return function () {
9518
+ unlisten();
9519
+
9520
+ if (--listenerCount === 0) stopHashChangeListener();
9521
+ };
9522
+ }
9523
+
9524
+ function listen(listener) {
9525
+ if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
9526
+
9527
+ var unlisten = history.listen(listener);
9528
+
9529
+ return function () {
9530
+ unlisten();
9531
+
9532
+ if (--listenerCount === 0) stopHashChangeListener();
9533
+ };
9534
+ }
9535
+
9536
+ function push(location) {
9537
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
9538
+
9539
+ history.push(location);
9540
+ }
9541
+
9542
+ function replace(location) {
9543
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
9544
+
9545
+ history.replace(location);
9546
+ }
9547
+
9548
+ var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash();
9549
+
9550
+ function go(n) {
9551
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined;
9552
+
9553
+ history.go(n);
9554
+ }
9555
+
9556
+ function createHref(path) {
9557
+ return '#' + history.createHref(path);
9558
+ }
9559
+
9560
+ // deprecated
9561
+ function registerTransitionHook(hook) {
9562
+ if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
9563
+
9564
+ history.registerTransitionHook(hook);
9565
+ }
9566
+
9567
+ // deprecated
9568
+ function unregisterTransitionHook(hook) {
9569
+ history.unregisterTransitionHook(hook);
9570
+
9571
+ if (--listenerCount === 0) stopHashChangeListener();
9572
+ }
9573
+
9574
+ // deprecated
9575
+ function pushState(state, path) {
9576
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
9577
+
9578
+ history.pushState(state, path);
9579
+ }
9580
+
9581
+ // deprecated
9582
+ function replaceState(state, path) {
9583
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
9584
+
9585
+ history.replaceState(state, path);
9586
+ }
9587
+
9588
+ return _extends({}, history, {
9589
+ listenBefore: listenBefore,
9590
+ listen: listen,
9591
+ push: push,
9592
+ replace: replace,
9593
+ go: go,
9594
+ createHref: createHref,
9595
+
9596
+ registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory
9597
+ unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory
9598
+ pushState: pushState, // deprecated - warning is in createHistory
9599
+ replaceState: replaceState // deprecated - warning is in createHistory
9600
+ });
9601
+ }
9602
+
9603
+ exports['default'] = createHashHistory;
9604
+ module.exports = exports['default'];
9605
+ }).call(this,_dereq_('_process'))
9606
+
9607
+ },{"./Actions":163,"./DOMStateStorage":165,"./DOMUtils":166,"./ExecutionEnvironment":167,"./createDOMHistory":168,"./parsePath":175,"_process":2,"invariant":182,"warning":185}],170:[function(_dereq_,module,exports){
9608
+ //import warning from 'warning'
9609
+ 'use strict';
9610
+
9611
+ exports.__esModule = true;
9612
+
9613
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9614
+
9615
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9616
+
9617
+ var _deepEqual = _dereq_('deep-equal');
9618
+
9619
+ var _deepEqual2 = _interopRequireDefault(_deepEqual);
9620
+
9621
+ var _AsyncUtils = _dereq_('./AsyncUtils');
9622
+
9623
+ var _Actions = _dereq_('./Actions');
9624
+
9625
+ var _createLocation2 = _dereq_('./createLocation');
9626
+
9627
+ var _createLocation3 = _interopRequireDefault(_createLocation2);
9628
+
9629
+ var _runTransitionHook = _dereq_('./runTransitionHook');
9630
+
9631
+ var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
9632
+
9633
+ var _parsePath = _dereq_('./parsePath');
9634
+
9635
+ var _parsePath2 = _interopRequireDefault(_parsePath);
9636
+
9637
+ var _deprecate = _dereq_('./deprecate');
9638
+
9639
+ var _deprecate2 = _interopRequireDefault(_deprecate);
9640
+
9641
+ function createRandomKey(length) {
9642
+ return Math.random().toString(36).substr(2, length);
9643
+ }
9644
+
9645
+ function locationsAreEqual(a, b) {
9646
+ return a.pathname === b.pathname && a.search === b.search &&
9647
+ //a.action === b.action && // Different action !== location change.
9648
+ a.key === b.key && _deepEqual2['default'](a.state, b.state);
9649
+ }
9650
+
9651
+ var DefaultKeyLength = 6;
9652
+
9653
+ function createHistory() {
9654
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
9655
+ var getCurrentLocation = options.getCurrentLocation;
9656
+ var finishTransition = options.finishTransition;
9657
+ var saveState = options.saveState;
9658
+ var go = options.go;
9659
+ var keyLength = options.keyLength;
9660
+ var getUserConfirmation = options.getUserConfirmation;
9661
+
9662
+ if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
9663
+
9664
+ var transitionHooks = [];
9665
+
9666
+ function listenBefore(hook) {
9667
+ transitionHooks.push(hook);
9668
+
9669
+ return function () {
9670
+ transitionHooks = transitionHooks.filter(function (item) {
9671
+ return item !== hook;
9672
+ });
9673
+ };
9674
+ }
9675
+
9676
+ var allKeys = [];
9677
+ var changeListeners = [];
9678
+ var location = undefined;
9679
+
9680
+ function getCurrent() {
9681
+ if (pendingLocation && pendingLocation.action === _Actions.POP) {
9682
+ return allKeys.indexOf(pendingLocation.key);
9683
+ } else if (location) {
9684
+ return allKeys.indexOf(location.key);
9685
+ } else {
9686
+ return -1;
9687
+ }
9688
+ }
9689
+
9690
+ function updateLocation(newLocation) {
9691
+ var current = getCurrent();
9692
+
9693
+ location = newLocation;
9694
+
9695
+ if (location.action === _Actions.PUSH) {
9696
+ allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]);
9697
+ } else if (location.action === _Actions.REPLACE) {
9698
+ allKeys[current] = location.key;
9699
+ }
9700
+
9701
+ changeListeners.forEach(function (listener) {
9702
+ listener(location);
9703
+ });
9704
+ }
9705
+
9706
+ function listen(listener) {
9707
+ changeListeners.push(listener);
9708
+
9709
+ if (location) {
9710
+ listener(location);
9711
+ } else {
9712
+ var _location = getCurrentLocation();
9713
+ allKeys = [_location.key];
9714
+ updateLocation(_location);
9715
+ }
9716
+
9717
+ return function () {
9718
+ changeListeners = changeListeners.filter(function (item) {
9719
+ return item !== listener;
9720
+ });
9721
+ };
9722
+ }
9723
+
9724
+ function confirmTransitionTo(location, callback) {
9725
+ _AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) {
9726
+ _runTransitionHook2['default'](transitionHooks[index], location, function (result) {
9727
+ if (result != null) {
9728
+ done(result);
9729
+ } else {
9730
+ next();
9731
+ }
9732
+ });
9733
+ }, function (message) {
9734
+ if (getUserConfirmation && typeof message === 'string') {
9735
+ getUserConfirmation(message, function (ok) {
9736
+ callback(ok !== false);
9737
+ });
9738
+ } else {
9739
+ callback(message !== false);
9740
+ }
9741
+ });
9742
+ }
9743
+
9744
+ var pendingLocation = undefined;
9745
+
9746
+ function transitionTo(nextLocation) {
9747
+ if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do.
9748
+
9749
+ pendingLocation = nextLocation;
9750
+
9751
+ confirmTransitionTo(nextLocation, function (ok) {
9752
+ if (pendingLocation !== nextLocation) return; // Transition was interrupted.
9753
+
9754
+ if (ok) {
9755
+ // treat PUSH to current path like REPLACE to be consistent with browsers
9756
+ if (nextLocation.action === _Actions.PUSH) {
9757
+ var prevPath = createPath(location);
9758
+ var nextPath = createPath(nextLocation);
9759
+
9760
+ if (nextPath === prevPath) nextLocation.action = _Actions.REPLACE;
9761
+ }
9762
+
9763
+ if (finishTransition(nextLocation) !== false) updateLocation(nextLocation);
9764
+ } else if (location && nextLocation.action === _Actions.POP) {
9765
+ var prevIndex = allKeys.indexOf(location.key);
9766
+ var nextIndex = allKeys.indexOf(nextLocation.key);
9767
+
9768
+ if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL.
9769
+ }
9770
+ });
9771
+ }
9772
+
9773
+ function push(location) {
9774
+ transitionTo(createLocation(location, _Actions.PUSH, createKey()));
9775
+ }
9776
+
9777
+ function replace(location) {
9778
+ transitionTo(createLocation(location, _Actions.REPLACE, createKey()));
9779
+ }
9780
+
9781
+ function goBack() {
9782
+ go(-1);
9783
+ }
9784
+
9785
+ function goForward() {
9786
+ go(1);
9787
+ }
9788
+
9789
+ function createKey() {
9790
+ return createRandomKey(keyLength);
9791
+ }
9792
+
9793
+ function createPath(location) {
9794
+ if (location == null || typeof location === 'string') return location;
9795
+
9796
+ var pathname = location.pathname;
9797
+ var search = location.search;
9798
+ var hash = location.hash;
9799
+
9800
+ var result = pathname;
9801
+
9802
+ if (search) result += search;
9803
+
9804
+ if (hash) result += hash;
9805
+
9806
+ return result;
9807
+ }
9808
+
9809
+ function createHref(location) {
9810
+ return createPath(location);
9811
+ }
9812
+
9813
+ function createLocation(location, action) {
9814
+ var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
9815
+
9816
+ if (typeof action === 'object') {
9817
+ //warning(
9818
+ // false,
9819
+ // 'The state (2nd) argument to history.createLocation is deprecated; use a ' +
9820
+ // 'location descriptor instead'
9821
+ //)
9822
+
9823
+ if (typeof location === 'string') location = _parsePath2['default'](location);
9824
+
9825
+ location = _extends({}, location, { state: action });
9826
+
9827
+ action = key;
9828
+ key = arguments[3] || createKey();
9829
+ }
9830
+
9831
+ return _createLocation3['default'](location, action, key);
9832
+ }
9833
+
9834
+ // deprecated
9835
+ function setState(state) {
9836
+ if (location) {
9837
+ updateLocationState(location, state);
9838
+ updateLocation(location);
9839
+ } else {
9840
+ updateLocationState(getCurrentLocation(), state);
9841
+ }
9842
+ }
9843
+
9844
+ function updateLocationState(location, state) {
9845
+ location.state = _extends({}, location.state, state);
9846
+ saveState(location.key, location.state);
9847
+ }
9848
+
9849
+ // deprecated
9850
+ function registerTransitionHook(hook) {
9851
+ if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook);
9852
+ }
9853
+
9854
+ // deprecated
9855
+ function unregisterTransitionHook(hook) {
9856
+ transitionHooks = transitionHooks.filter(function (item) {
9857
+ return item !== hook;
9858
+ });
9859
+ }
9860
+
9861
+ // deprecated
9862
+ function pushState(state, path) {
9863
+ if (typeof path === 'string') path = _parsePath2['default'](path);
9864
+
9865
+ push(_extends({ state: state }, path));
9866
+ }
9867
+
9868
+ // deprecated
9869
+ function replaceState(state, path) {
9870
+ if (typeof path === 'string') path = _parsePath2['default'](path);
9871
+
9872
+ replace(_extends({ state: state }, path));
9873
+ }
9874
+
9875
+ return {
9876
+ listenBefore: listenBefore,
9877
+ listen: listen,
9878
+ transitionTo: transitionTo,
9879
+ push: push,
9880
+ replace: replace,
9881
+ go: go,
9882
+ goBack: goBack,
9883
+ goForward: goForward,
9884
+ createKey: createKey,
9885
+ createPath: createPath,
9886
+ createHref: createHref,
9887
+ createLocation: createLocation,
9888
+
9889
+ setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'),
9890
+ registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'),
9891
+ unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'),
9892
+ pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
9893
+ replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
9894
+ };
9895
+ }
9896
+
9897
+ exports['default'] = createHistory;
9898
+ module.exports = exports['default'];
9899
+ },{"./Actions":163,"./AsyncUtils":164,"./createLocation":171,"./deprecate":173,"./parsePath":175,"./runTransitionHook":176,"deep-equal":179}],171:[function(_dereq_,module,exports){
9900
+ //import warning from 'warning'
9901
+ 'use strict';
9902
+
9903
+ exports.__esModule = true;
9904
+
9905
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9906
+
9907
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9908
+
9909
+ var _Actions = _dereq_('./Actions');
9910
+
9911
+ var _parsePath = _dereq_('./parsePath');
9912
+
9913
+ var _parsePath2 = _interopRequireDefault(_parsePath);
9914
+
9915
+ function createLocation() {
9916
+ var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
9917
+ var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
9918
+ var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
9919
+
9920
+ var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
9921
+
9922
+ if (typeof location === 'string') location = _parsePath2['default'](location);
9923
+
9924
+ if (typeof action === 'object') {
9925
+ //warning(
9926
+ // false,
9927
+ // 'The state (2nd) argument to createLocation is deprecated; use a ' +
9928
+ // 'location descriptor instead'
9929
+ //)
9930
+
9931
+ location = _extends({}, location, { state: action });
9932
+
9933
+ action = key || _Actions.POP;
9934
+ key = _fourthArg;
9935
+ }
9936
+
9937
+ var pathname = location.pathname || '/';
9938
+ var search = location.search || '';
9939
+ var hash = location.hash || '';
9940
+ var state = location.state || null;
9941
+
9942
+ return {
9943
+ pathname: pathname,
9944
+ search: search,
9945
+ hash: hash,
9946
+ state: state,
9947
+ action: action,
9948
+ key: key
9949
+ };
9950
+ }
9951
+
9952
+ exports['default'] = createLocation;
9953
+ module.exports = exports['default'];
9954
+ },{"./Actions":163,"./parsePath":175}],172:[function(_dereq_,module,exports){
9955
+ (function (process){
9956
+ 'use strict';
9957
+
9958
+ exports.__esModule = true;
9959
+
9960
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9961
+
9962
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9963
+
9964
+ var _warning = _dereq_('warning');
9965
+
9966
+ var _warning2 = _interopRequireDefault(_warning);
9967
+
9968
+ var _invariant = _dereq_('invariant');
9969
+
9970
+ var _invariant2 = _interopRequireDefault(_invariant);
9971
+
9972
+ var _Actions = _dereq_('./Actions');
9973
+
9974
+ var _createHistory = _dereq_('./createHistory');
9975
+
9976
+ var _createHistory2 = _interopRequireDefault(_createHistory);
9977
+
9978
+ var _parsePath = _dereq_('./parsePath');
9979
+
9980
+ var _parsePath2 = _interopRequireDefault(_parsePath);
9981
+
9982
+ function createStateStorage(entries) {
9983
+ return entries.filter(function (entry) {
9984
+ return entry.state;
9985
+ }).reduce(function (memo, entry) {
9986
+ memo[entry.key] = entry.state;
9987
+ return memo;
9988
+ }, {});
9989
+ }
9990
+
9991
+ function createMemoryHistory() {
9992
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
9993
+
9994
+ if (Array.isArray(options)) {
9995
+ options = { entries: options };
9996
+ } else if (typeof options === 'string') {
9997
+ options = { entries: [options] };
9998
+ }
9999
+
10000
+ var history = _createHistory2['default'](_extends({}, options, {
10001
+ getCurrentLocation: getCurrentLocation,
10002
+ finishTransition: finishTransition,
10003
+ saveState: saveState,
10004
+ go: go
10005
+ }));
10006
+
10007
+ var _options = options;
10008
+ var entries = _options.entries;
10009
+ var current = _options.current;
10010
+
10011
+ if (typeof entries === 'string') {
10012
+ entries = [entries];
10013
+ } else if (!Array.isArray(entries)) {
10014
+ entries = ['/'];
10015
+ }
10016
+
10017
+ entries = entries.map(function (entry) {
10018
+ var key = history.createKey();
10019
+
10020
+ if (typeof entry === 'string') return { pathname: entry, key: key };
10021
+
10022
+ if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key });
10023
+
10024
+ !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined;
10025
+ });
10026
+
10027
+ if (current == null) {
10028
+ current = entries.length - 1;
10029
+ } else {
10030
+ !(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined;
10031
+ }
10032
+
10033
+ var storage = createStateStorage(entries);
10034
+
10035
+ function saveState(key, state) {
10036
+ storage[key] = state;
10037
+ }
10038
+
10039
+ function readState(key) {
10040
+ return storage[key];
10041
+ }
10042
+
10043
+ function getCurrentLocation() {
10044
+ var entry = entries[current];
10045
+ var key = entry.key;
10046
+ var basename = entry.basename;
10047
+ var pathname = entry.pathname;
10048
+ var search = entry.search;
10049
+
10050
+ var path = (basename || '') + pathname + (search || '');
10051
+
10052
+ var state = undefined;
10053
+ if (key) {
10054
+ state = readState(key);
10055
+ } else {
10056
+ state = null;
10057
+ key = history.createKey();
10058
+ entry.key = key;
10059
+ }
10060
+
10061
+ var location = _parsePath2['default'](path);
10062
+
10063
+ return history.createLocation(_extends({}, location, { state: state }), undefined, key);
10064
+ }
10065
+
10066
+ function canGo(n) {
10067
+ var index = current + n;
10068
+ return index >= 0 && index < entries.length;
10069
+ }
10070
+
10071
+ function go(n) {
10072
+ if (n) {
10073
+ if (!canGo(n)) {
10074
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined;
10075
+ return;
10076
+ }
10077
+
10078
+ current += n;
10079
+
10080
+ var currentLocation = getCurrentLocation();
10081
+
10082
+ // change action to POP
10083
+ history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
10084
+ }
10085
+ }
10086
+
10087
+ function finishTransition(location) {
10088
+ switch (location.action) {
10089
+ case _Actions.PUSH:
10090
+ current += 1;
10091
+
10092
+ // if we are not on the top of stack
10093
+ // remove rest and push new
10094
+ if (current < entries.length) entries.splice(current);
10095
+
10096
+ entries.push(location);
10097
+ saveState(location.key, location.state);
10098
+ break;
10099
+ case _Actions.REPLACE:
10100
+ entries[current] = location;
10101
+ saveState(location.key, location.state);
10102
+ break;
10103
+ }
10104
+ }
10105
+
10106
+ return history;
10107
+ }
10108
+
10109
+ exports['default'] = createMemoryHistory;
10110
+ module.exports = exports['default'];
10111
+ }).call(this,_dereq_('_process'))
10112
+
10113
+ },{"./Actions":163,"./createHistory":170,"./parsePath":175,"_process":2,"invariant":182,"warning":185}],173:[function(_dereq_,module,exports){
10114
+ //import warning from 'warning'
10115
+
10116
+ "use strict";
10117
+
10118
+ exports.__esModule = true;
10119
+ function deprecate(fn) {
10120
+ return fn;
10121
+ //return function () {
10122
+ // warning(false, '[history] ' + message)
10123
+ // return fn.apply(this, arguments)
10124
+ //}
10125
+ }
10126
+
10127
+ exports["default"] = deprecate;
10128
+ module.exports = exports["default"];
10129
+ },{}],174:[function(_dereq_,module,exports){
10130
+ "use strict";
10131
+
10132
+ exports.__esModule = true;
10133
+ function extractPath(string) {
10134
+ var match = string.match(/^https?:\/\/[^\/]*/);
10135
+
10136
+ if (match == null) return string;
10137
+
10138
+ return string.substring(match[0].length);
10139
+ }
10140
+
10141
+ exports["default"] = extractPath;
10142
+ module.exports = exports["default"];
10143
+ },{}],175:[function(_dereq_,module,exports){
10144
+ (function (process){
10145
+ 'use strict';
10146
+
10147
+ exports.__esModule = true;
10148
+
10149
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10150
+
10151
+ var _warning = _dereq_('warning');
10152
+
10153
+ var _warning2 = _interopRequireDefault(_warning);
10154
+
10155
+ var _extractPath = _dereq_('./extractPath');
10156
+
10157
+ var _extractPath2 = _interopRequireDefault(_extractPath);
10158
+
10159
+ function parsePath(path) {
10160
+ var pathname = _extractPath2['default'](path);
10161
+ var search = '';
10162
+ var hash = '';
10163
+
10164
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
10165
+
10166
+ var hashIndex = pathname.indexOf('#');
10167
+ if (hashIndex !== -1) {
10168
+ hash = pathname.substring(hashIndex);
10169
+ pathname = pathname.substring(0, hashIndex);
10170
+ }
10171
+
10172
+ var searchIndex = pathname.indexOf('?');
10173
+ if (searchIndex !== -1) {
10174
+ search = pathname.substring(searchIndex);
10175
+ pathname = pathname.substring(0, searchIndex);
10176
+ }
10177
+
10178
+ if (pathname === '') pathname = '/';
10179
+
10180
+ return {
10181
+ pathname: pathname,
10182
+ search: search,
10183
+ hash: hash
10184
+ };
10185
+ }
10186
+
10187
+ exports['default'] = parsePath;
10188
+ module.exports = exports['default'];
10189
+ }).call(this,_dereq_('_process'))
10190
+
10191
+ },{"./extractPath":174,"_process":2,"warning":185}],176:[function(_dereq_,module,exports){
10192
+ (function (process){
10193
+ 'use strict';
10194
+
10195
+ exports.__esModule = true;
10196
+
10197
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10198
+
10199
+ var _warning = _dereq_('warning');
10200
+
10201
+ var _warning2 = _interopRequireDefault(_warning);
10202
+
10203
+ function runTransitionHook(hook, location, callback) {
10204
+ var result = hook(location, callback);
10205
+
10206
+ if (hook.length < 2) {
10207
+ // Assume the hook runs synchronously and automatically
10208
+ // call the callback with the return value.
10209
+ callback(result);
10210
+ } else {
10211
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined;
10212
+ }
10213
+ }
10214
+
10215
+ exports['default'] = runTransitionHook;
10216
+ module.exports = exports['default'];
10217
+ }).call(this,_dereq_('_process'))
10218
+
10219
+ },{"_process":2,"warning":185}],177:[function(_dereq_,module,exports){
10220
+ 'use strict';
10221
+
10222
+ exports.__esModule = true;
10223
+
10224
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
10225
+
10226
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10227
+
10228
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
10229
+
10230
+ var _ExecutionEnvironment = _dereq_('./ExecutionEnvironment');
10231
+
10232
+ var _runTransitionHook = _dereq_('./runTransitionHook');
10233
+
10234
+ var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
10235
+
10236
+ var _extractPath = _dereq_('./extractPath');
10237
+
10238
+ var _extractPath2 = _interopRequireDefault(_extractPath);
10239
+
10240
+ var _parsePath = _dereq_('./parsePath');
10241
+
10242
+ var _parsePath2 = _interopRequireDefault(_parsePath);
10243
+
10244
+ var _deprecate = _dereq_('./deprecate');
10245
+
10246
+ var _deprecate2 = _interopRequireDefault(_deprecate);
10247
+
10248
+ function useBasename(createHistory) {
10249
+ return function () {
10250
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
10251
+ var basename = options.basename;
10252
+
10253
+ var historyOptions = _objectWithoutProperties(options, ['basename']);
10254
+
10255
+ var history = createHistory(historyOptions);
10256
+
10257
+ // Automatically use the value of <base href> in HTML
10258
+ // documents as basename if it's not explicitly given.
10259
+ if (basename == null && _ExecutionEnvironment.canUseDOM) {
10260
+ var base = document.getElementsByTagName('base')[0];
10261
+
10262
+ if (base) basename = _extractPath2['default'](base.href);
10263
+ }
10264
+
10265
+ function addBasename(location) {
10266
+ if (basename && location.basename == null) {
10267
+ if (location.pathname.indexOf(basename) === 0) {
10268
+ location.pathname = location.pathname.substring(basename.length);
10269
+ location.basename = basename;
10270
+
10271
+ if (location.pathname === '') location.pathname = '/';
10272
+ } else {
10273
+ location.basename = '';
10274
+ }
10275
+ }
10276
+
10277
+ return location;
10278
+ }
10279
+
10280
+ function prependBasename(location) {
10281
+ if (!basename) return location;
10282
+
10283
+ if (typeof location === 'string') location = _parsePath2['default'](location);
10284
+
10285
+ var pname = location.pathname;
10286
+ var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
10287
+ var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
10288
+ var pathname = normalizedBasename + normalizedPathname;
10289
+
10290
+ return _extends({}, location, {
10291
+ pathname: pathname
10292
+ });
10293
+ }
10294
+
10295
+ // Override all read methods with basename-aware versions.
10296
+ function listenBefore(hook) {
10297
+ return history.listenBefore(function (location, callback) {
10298
+ _runTransitionHook2['default'](hook, addBasename(location), callback);
10299
+ });
10300
+ }
10301
+
10302
+ function listen(listener) {
10303
+ return history.listen(function (location) {
10304
+ listener(addBasename(location));
10305
+ });
10306
+ }
10307
+
10308
+ // Override all write methods with basename-aware versions.
10309
+ function push(location) {
10310
+ history.push(prependBasename(location));
10311
+ }
10312
+
10313
+ function replace(location) {
10314
+ history.replace(prependBasename(location));
10315
+ }
10316
+
10317
+ function createPath(location) {
10318
+ return history.createPath(prependBasename(location));
10319
+ }
10320
+
10321
+ function createHref(location) {
10322
+ return history.createHref(prependBasename(location));
10323
+ }
10324
+
10325
+ function createLocation() {
10326
+ return addBasename(history.createLocation.apply(history, arguments));
10327
+ }
10328
+
10329
+ // deprecated
10330
+ function pushState(state, path) {
10331
+ if (typeof path === 'string') path = _parsePath2['default'](path);
10332
+
10333
+ push(_extends({ state: state }, path));
10334
+ }
10335
+
10336
+ // deprecated
10337
+ function replaceState(state, path) {
10338
+ if (typeof path === 'string') path = _parsePath2['default'](path);
10339
+
10340
+ replace(_extends({ state: state }, path));
10341
+ }
10342
+
10343
+ return _extends({}, history, {
10344
+ listenBefore: listenBefore,
10345
+ listen: listen,
10346
+ push: push,
10347
+ replace: replace,
10348
+ createPath: createPath,
10349
+ createHref: createHref,
10350
+ createLocation: createLocation,
10351
+
10352
+ pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
10353
+ replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
10354
+ });
10355
+ };
10356
+ }
10357
+
10358
+ exports['default'] = useBasename;
10359
+ module.exports = exports['default'];
10360
+ },{"./ExecutionEnvironment":167,"./deprecate":173,"./extractPath":174,"./parsePath":175,"./runTransitionHook":176}],178:[function(_dereq_,module,exports){
10361
+ (function (process){
10362
+ 'use strict';
10363
+
10364
+ exports.__esModule = true;
10365
+
10366
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
10367
+
10368
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10369
+
10370
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
10371
+
10372
+ var _warning = _dereq_('warning');
10373
+
10374
+ var _warning2 = _interopRequireDefault(_warning);
10375
+
10376
+ var _queryString = _dereq_('query-string');
10377
+
10378
+ var _runTransitionHook = _dereq_('./runTransitionHook');
10379
+
10380
+ var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
10381
+
10382
+ var _parsePath = _dereq_('./parsePath');
10383
+
10384
+ var _parsePath2 = _interopRequireDefault(_parsePath);
10385
+
10386
+ var _deprecate = _dereq_('./deprecate');
10387
+
10388
+ var _deprecate2 = _interopRequireDefault(_deprecate);
10389
+
10390
+ var SEARCH_BASE_KEY = '$searchBase';
10391
+
10392
+ function defaultStringifyQuery(query) {
10393
+ return _queryString.stringify(query).replace(/%20/g, '+');
10394
+ }
10395
+
10396
+ var defaultParseQueryString = _queryString.parse;
10397
+
10398
+ function isNestedObject(object) {
10399
+ for (var p in object) {
10400
+ if (object.hasOwnProperty(p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
10401
+ }return false;
10402
+ }
10403
+
10404
+ /**
10405
+ * Returns a new createHistory function that may be used to create
10406
+ * history objects that know how to handle URL queries.
10407
+ */
10408
+ function useQueries(createHistory) {
10409
+ return function () {
10410
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
10411
+ var stringifyQuery = options.stringifyQuery;
10412
+ var parseQueryString = options.parseQueryString;
10413
+
10414
+ var historyOptions = _objectWithoutProperties(options, ['stringifyQuery', 'parseQueryString']);
10415
+
10416
+ var history = createHistory(historyOptions);
10417
+
10418
+ if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
10419
+
10420
+ if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
10421
+
10422
+ function addQuery(location) {
10423
+ if (location.query == null) {
10424
+ var search = location.search;
10425
+
10426
+ location.query = parseQueryString(search.substring(1));
10427
+ location[SEARCH_BASE_KEY] = { search: search, searchBase: '' };
10428
+ }
10429
+
10430
+ // TODO: Instead of all the book-keeping here, this should just strip the
10431
+ // stringified query from the search.
10432
+
10433
+ return location;
10434
+ }
10435
+
10436
+ function appendQuery(location, query) {
10437
+ var _extends2;
10438
+
10439
+ var queryString = undefined;
10440
+ if (!query || (queryString = stringifyQuery(query)) === '') return location;
10441
+
10442
+ process.env.NODE_ENV !== 'production' ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined;
10443
+
10444
+ if (typeof location === 'string') location = _parsePath2['default'](location);
10445
+
10446
+ var searchBaseSpec = location[SEARCH_BASE_KEY];
10447
+ var searchBase = undefined;
10448
+ if (searchBaseSpec && location.search === searchBaseSpec.search) {
10449
+ searchBase = searchBaseSpec.searchBase;
10450
+ } else {
10451
+ searchBase = location.search || '';
10452
+ }
10453
+
10454
+ var search = searchBase + (searchBase ? '&' : '?') + queryString;
10455
+
10456
+ return _extends({}, location, (_extends2 = {
10457
+ search: search
10458
+ }, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2));
10459
+ }
10460
+
10461
+ // Override all read methods with query-aware versions.
10462
+ function listenBefore(hook) {
10463
+ return history.listenBefore(function (location, callback) {
10464
+ _runTransitionHook2['default'](hook, addQuery(location), callback);
10465
+ });
10466
+ }
10467
+
10468
+ function listen(listener) {
10469
+ return history.listen(function (location) {
10470
+ listener(addQuery(location));
10471
+ });
10472
+ }
10473
+
10474
+ // Override all write methods with query-aware versions.
10475
+ function push(location) {
10476
+ history.push(appendQuery(location, location.query));
10477
+ }
10478
+
10479
+ function replace(location) {
10480
+ history.replace(appendQuery(location, location.query));
10481
+ }
10482
+
10483
+ function createPath(location, query) {
10484
+ //warning(
10485
+ // !query,
10486
+ // 'the query argument to createPath is deprecated; use a location descriptor instead'
10487
+ //)
10488
+ return history.createPath(appendQuery(location, query || location.query));
10489
+ }
10490
+
10491
+ function createHref(location, query) {
10492
+ //warning(
10493
+ // !query,
10494
+ // 'the query argument to createHref is deprecated; use a location descriptor instead'
10495
+ //)
10496
+ return history.createHref(appendQuery(location, query || location.query));
10497
+ }
10498
+
10499
+ function createLocation() {
10500
+ return addQuery(history.createLocation.apply(history, arguments));
10501
+ }
10502
+
10503
+ // deprecated
10504
+ function pushState(state, path, query) {
10505
+ if (typeof path === 'string') path = _parsePath2['default'](path);
10506
+
10507
+ push(_extends({ state: state }, path, { query: query }));
10508
+ }
10509
+
10510
+ // deprecated
10511
+ function replaceState(state, path, query) {
10512
+ if (typeof path === 'string') path = _parsePath2['default'](path);
10513
+
10514
+ replace(_extends({ state: state }, path, { query: query }));
10515
+ }
10516
+
10517
+ return _extends({}, history, {
10518
+ listenBefore: listenBefore,
10519
+ listen: listen,
10520
+ push: push,
10521
+ replace: replace,
10522
+ createPath: createPath,
10523
+ createHref: createHref,
10524
+ createLocation: createLocation,
10525
+
10526
+ pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
10527
+ replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
10528
+ });
10529
+ };
10530
+ }
10531
+
10532
+ exports['default'] = useQueries;
10533
+ module.exports = exports['default'];
10534
+ }).call(this,_dereq_('_process'))
10535
+
10536
+ },{"./deprecate":173,"./parsePath":175,"./runTransitionHook":176,"_process":2,"query-string":183,"warning":185}],179:[function(_dereq_,module,exports){
10537
+ var pSlice = Array.prototype.slice;
10538
+ var objectKeys = _dereq_('./lib/keys.js');
10539
+ var isArguments = _dereq_('./lib/is_arguments.js');
10540
+
10541
+ var deepEqual = module.exports = function (actual, expected, opts) {
10542
+ if (!opts) opts = {};
10543
+ // 7.1. All identical values are equivalent, as determined by ===.
10544
+ if (actual === expected) {
10545
+ return true;
10546
+
10547
+ } else if (actual instanceof Date && expected instanceof Date) {
10548
+ return actual.getTime() === expected.getTime();
10549
+
10550
+ // 7.3. Other pairs that do not both pass typeof value == 'object',
10551
+ // equivalence is determined by ==.
10552
+ } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
10553
+ return opts.strict ? actual === expected : actual == expected;
10554
+
10555
+ // 7.4. For all other Object pairs, including Array objects, equivalence is
10556
+ // determined by having the same number of owned properties (as verified
10557
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
10558
+ // (although not necessarily the same order), equivalent values for every
10559
+ // corresponding key, and an identical 'prototype' property. Note: this
10560
+ // accounts for both named and indexed properties on Arrays.
10561
+ } else {
10562
+ return objEquiv(actual, expected, opts);
10563
+ }
10564
+ }
10565
+
10566
+ function isUndefinedOrNull(value) {
10567
+ return value === null || value === undefined;
10568
+ }
10569
+
10570
+ function isBuffer (x) {
10571
+ if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
10572
+ if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
10573
+ return false;
10574
+ }
10575
+ if (x.length > 0 && typeof x[0] !== 'number') return false;
10576
+ return true;
10577
+ }
10578
+
10579
+ function objEquiv(a, b, opts) {
10580
+ var i, key;
10581
+ if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
10582
+ return false;
10583
+ // an identical 'prototype' property.
10584
+ if (a.prototype !== b.prototype) return false;
10585
+ //~~~I've managed to break Object.keys through screwy arguments passing.
10586
+ // Converting to array solves the problem.
10587
+ if (isArguments(a)) {
10588
+ if (!isArguments(b)) {
10589
+ return false;
10590
+ }
10591
+ a = pSlice.call(a);
10592
+ b = pSlice.call(b);
10593
+ return deepEqual(a, b, opts);
10594
+ }
10595
+ if (isBuffer(a)) {
10596
+ if (!isBuffer(b)) {
10597
+ return false;
10598
+ }
10599
+ if (a.length !== b.length) return false;
10600
+ for (i = 0; i < a.length; i++) {
10601
+ if (a[i] !== b[i]) return false;
10602
+ }
10603
+ return true;
10604
+ }
10605
+ try {
10606
+ var ka = objectKeys(a),
10607
+ kb = objectKeys(b);
10608
+ } catch (e) {//happens when one is a string literal and the other isn't
10609
+ return false;
10610
+ }
10611
+ // having the same number of owned properties (keys incorporates
10612
+ // hasOwnProperty)
10613
+ if (ka.length != kb.length)
10614
+ return false;
10615
+ //the same set of keys (although not necessarily the same order),
10616
+ ka.sort();
10617
+ kb.sort();
10618
+ //~~~cheap key test
10619
+ for (i = ka.length - 1; i >= 0; i--) {
10620
+ if (ka[i] != kb[i])
10621
+ return false;
10622
+ }
10623
+ //equivalent values for every corresponding key, and
10624
+ //~~~possibly expensive deep test
10625
+ for (i = ka.length - 1; i >= 0; i--) {
10626
+ key = ka[i];
10627
+ if (!deepEqual(a[key], b[key], opts)) return false;
10628
+ }
10629
+ return typeof a === typeof b;
10630
+ }
10631
+
10632
+ },{"./lib/is_arguments.js":180,"./lib/keys.js":181}],180:[function(_dereq_,module,exports){
10633
+ var supportsArgumentsClass = (function(){
10634
+ return Object.prototype.toString.call(arguments)
10635
+ })() == '[object Arguments]';
10636
+
10637
+ exports = module.exports = supportsArgumentsClass ? supported : unsupported;
10638
+
10639
+ exports.supported = supported;
10640
+ function supported(object) {
10641
+ return Object.prototype.toString.call(object) == '[object Arguments]';
10642
+ };
10643
+
10644
+ exports.unsupported = unsupported;
10645
+ function unsupported(object){
10646
+ return object &&
10647
+ typeof object == 'object' &&
10648
+ typeof object.length == 'number' &&
10649
+ Object.prototype.hasOwnProperty.call(object, 'callee') &&
10650
+ !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
10651
+ false;
10652
+ };
10653
+
10654
+ },{}],181:[function(_dereq_,module,exports){
10655
+ exports = module.exports = typeof Object.keys === 'function'
10656
+ ? Object.keys : shim;
10657
+
10658
+ exports.shim = shim;
10659
+ function shim (obj) {
10660
+ var keys = [];
10661
+ for (var key in obj) keys.push(key);
10662
+ return keys;
10663
+ }
10664
+
10665
+ },{}],182:[function(_dereq_,module,exports){
10666
+ (function (process){
10667
+ /**
10668
+ * Copyright 2013-2015, Facebook, Inc.
10669
+ * All rights reserved.
10670
+ *
10671
+ * This source code is licensed under the BSD-style license found in the
10672
+ * LICENSE file in the root directory of this source tree. An additional grant
10673
+ * of patent rights can be found in the PATENTS file in the same directory.
10674
+ */
10675
+
10676
+ 'use strict';
10677
+
10678
+ /**
10679
+ * Use invariant() to assert state which your program assumes to be true.
10680
+ *
10681
+ * Provide sprintf-style format (only %s is supported) and arguments
10682
+ * to provide information about what broke and what you were
10683
+ * expecting.
10684
+ *
10685
+ * The invariant message will be stripped in production, but the invariant
10686
+ * will remain to ensure logic does not differ in production.
10687
+ */
10688
+
10689
+ var invariant = function(condition, format, a, b, c, d, e, f) {
10690
+ if (process.env.NODE_ENV !== 'production') {
10691
+ if (format === undefined) {
10692
+ throw new Error('invariant requires an error message argument');
10693
+ }
10694
+ }
10695
+
10696
+ if (!condition) {
10697
+ var error;
10698
+ if (format === undefined) {
10699
+ error = new Error(
10700
+ 'Minified exception occurred; use the non-minified dev environment ' +
10701
+ 'for the full error message and additional helpful warnings.'
10702
+ );
10703
+ } else {
10704
+ var args = [a, b, c, d, e, f];
10705
+ var argIndex = 0;
10706
+ error = new Error(
10707
+ format.replace(/%s/g, function() { return args[argIndex++]; })
10708
+ );
10709
+ error.name = 'Invariant Violation';
10710
+ }
10711
+
10712
+ error.framesToPop = 1; // we don't care about invariant's own frame
10713
+ throw error;
10714
+ }
10715
+ };
10716
+
10717
+ module.exports = invariant;
10718
+
10719
+ }).call(this,_dereq_('_process'))
10720
+
10721
+ },{"_process":2}],183:[function(_dereq_,module,exports){
10722
+ 'use strict';
10723
+ var strictUriEncode = _dereq_('strict-uri-encode');
10724
+
10725
+ exports.extract = function (str) {
10726
+ return str.split('?')[1] || '';
10727
+ };
10728
+
10729
+ exports.parse = function (str) {
10730
+ if (typeof str !== 'string') {
10731
+ return {};
10732
+ }
10733
+
10734
+ str = str.trim().replace(/^(\?|#|&)/, '');
10735
+
10736
+ if (!str) {
10737
+ return {};
10738
+ }
10739
+
10740
+ return str.split('&').reduce(function (ret, param) {
10741
+ var parts = param.replace(/\+/g, ' ').split('=');
10742
+ // Firefox (pre 40) decodes `%3D` to `=`
10743
+ // https://github.com/sindresorhus/query-string/pull/37
10744
+ var key = parts.shift();
10745
+ var val = parts.length > 0 ? parts.join('=') : undefined;
10746
+
10747
+ key = decodeURIComponent(key);
10748
+
10749
+ // missing `=` should be `null`:
10750
+ // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
10751
+ val = val === undefined ? null : decodeURIComponent(val);
10752
+
10753
+ if (!ret.hasOwnProperty(key)) {
10754
+ ret[key] = val;
10755
+ } else if (Array.isArray(ret[key])) {
10756
+ ret[key].push(val);
10757
+ } else {
10758
+ ret[key] = [ret[key], val];
10759
+ }
10760
+
10761
+ return ret;
10762
+ }, {});
10763
+ };
10764
+
10765
+ exports.stringify = function (obj) {
10766
+ return obj ? Object.keys(obj).sort().map(function (key) {
10767
+ var val = obj[key];
10768
+
10769
+ if (val === undefined) {
10770
+ return '';
10771
+ }
10772
+
10773
+ if (val === null) {
10774
+ return key;
10775
+ }
10776
+
10777
+ if (Array.isArray(val)) {
10778
+ return val.slice().sort().map(function (val2) {
10779
+ return strictUriEncode(key) + '=' + strictUriEncode(val2);
10780
+ }).join('&');
10781
+ }
10782
+
10783
+ return strictUriEncode(key) + '=' + strictUriEncode(val);
10784
+ }).filter(function (x) {
10785
+ return x.length > 0;
10786
+ }).join('&') : '';
10787
+ };
10788
+
10789
+ },{"strict-uri-encode":184}],184:[function(_dereq_,module,exports){
10790
+ 'use strict';
10791
+ module.exports = function (str) {
10792
+ return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
10793
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase();
10794
+ });
10795
+ };
10796
+
10797
+ },{}],185:[function(_dereq_,module,exports){
10798
+ (function (process){
10799
+ /**
10800
+ * Copyright 2014-2015, Facebook, Inc.
10801
+ * All rights reserved.
10802
+ *
10803
+ * This source code is licensed under the BSD-style license found in the
10804
+ * LICENSE file in the root directory of this source tree. An additional grant
10805
+ * of patent rights can be found in the PATENTS file in the same directory.
10806
+ */
10807
+
10808
+ 'use strict';
10809
+
10810
+ /**
10811
+ * Similar to invariant but only logs a warning if the condition is not met.
10812
+ * This can be used to log issues in development environments in critical
10813
+ * paths. Removing the logging code for production environments will keep the
10814
+ * same logic and follow the same code paths.
10815
+ */
10816
+
10817
+ var warning = function() {};
10818
+
10819
+ if (process.env.NODE_ENV !== 'production') {
10820
+ warning = function(condition, format, args) {
10821
+ var len = arguments.length;
10822
+ args = new Array(len > 2 ? len - 2 : 0);
10823
+ for (var key = 2; key < len; key++) {
10824
+ args[key - 2] = arguments[key];
10825
+ }
10826
+ if (format === undefined) {
10827
+ throw new Error(
10828
+ '`warning(condition, format, ...args)` requires a warning ' +
10829
+ 'message argument'
10830
+ );
10831
+ }
10832
+
10833
+ if (format.length < 10 || (/^[s\W]*$/).test(format)) {
10834
+ throw new Error(
10835
+ 'The warning format should be able to uniquely identify this ' +
10836
+ 'warning. Please, use a more descriptive format than: ' + format
10837
+ );
10838
+ }
10839
+
10840
+ if (!condition) {
10841
+ var argIndex = 0;
10842
+ var message = 'Warning: ' +
10843
+ format.replace(/%s/g, function() {
10844
+ return args[argIndex++];
10845
+ });
10846
+ if (typeof console !== 'undefined') {
10847
+ console.error(message);
10848
+ }
10849
+ try {
10850
+ // This error was thrown as a convenience so that you can use this stack
10851
+ // to find the callsite that caused this warning to fire.
10852
+ throw new Error(message);
10853
+ } catch(x) {}
10854
+ }
10855
+ };
10856
+ }
10857
+
10858
+ module.exports = warning;
10859
+
10860
+ }).call(this,_dereq_('_process'))
10861
+
10862
+ },{"_process":2}],186:[function(_dereq_,module,exports){
10863
+ (function (global){
10864
+ // Expose `IntlPolyfill` as global to add locale data into runtime later on.
10865
+ global.IntlPolyfill = _dereq_('./lib/core.js');
10866
+
10867
+ // Require all locale data for `Intl`. This module will be
10868
+ // ignored when bundling for the browser with Browserify/Webpack.
10869
+ _dereq_('./locale-data/complete.js');
10870
+
10871
+ // hack to export the polyfill as global Intl if needed
10872
+ if (!global.Intl) {
10873
+ global.Intl = global.IntlPolyfill;
10874
+ global.IntlPolyfill.__applyLocaleSensitivePrototypes();
10875
+ }
10876
+
10877
+ // providing an idiomatic api for the nodejs version of this module
10878
+ module.exports = global.IntlPolyfill;
10879
+
10880
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
10881
+
10882
+ },{"./lib/core.js":187,"./locale-data/complete.js":1}],187:[function(_dereq_,module,exports){
10883
+ 'use strict';
10884
+
10885
+ var babelHelpers = {};
10886
+ babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
10887
+ return typeof obj;
10888
+ } : function (obj) {
10889
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
10890
+ };
10891
+ babelHelpers;
10892
+
10893
+ var realDefineProp = function () {
10894
+ var sentinel = {};
10895
+ try {
10896
+ Object.defineProperty(sentinel, 'a', {});
10897
+ return 'a' in sentinel;
10898
+ } catch (e) {
10899
+ return false;
10900
+ }
10901
+ }();
10902
+
10903
+ // Need a workaround for getters in ES3
10904
+ var es3 = !realDefineProp && !Object.prototype.__defineGetter__;
10905
+
10906
+ // We use this a lot (and need it for proto-less objects)
10907
+ var hop = Object.prototype.hasOwnProperty;
10908
+
10909
+ // Naive defineProperty for compatibility
10910
+ var defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) {
10911
+ if ('get' in desc && obj.__defineGetter__) obj.__defineGetter__(name, desc.get);else if (!hop.call(obj, name) || 'value' in desc) obj[name] = desc.value;
10912
+ };
10913
+
10914
+ // Array.prototype.indexOf, as good as we need it to be
10915
+ var arrIndexOf = Array.prototype.indexOf || function (search) {
10916
+ /*jshint validthis:true */
10917
+ var t = this;
10918
+ if (!t.length) return -1;
10919
+
10920
+ for (var i = arguments[1] || 0, max = t.length; i < max; i++) {
10921
+ if (t[i] === search) return i;
10922
+ }
10923
+
10924
+ return -1;
10925
+ };
10926
+
10927
+ // Create an object with the specified prototype (2nd arg required for Record)
10928
+ var objCreate = Object.create || function (proto, props) {
10929
+ var obj = void 0;
10930
+
10931
+ function F() {}
10932
+ F.prototype = proto;
10933
+ obj = new F();
10934
+
10935
+ for (var k in props) {
10936
+ if (hop.call(props, k)) defineProperty(obj, k, props[k]);
10937
+ }
10938
+
10939
+ return obj;
10940
+ };
10941
+
10942
+ // Snapshot some (hopefully still) native built-ins
10943
+ var arrSlice = Array.prototype.slice;
10944
+ var arrConcat = Array.prototype.concat;
10945
+ var arrPush = Array.prototype.push;
10946
+ var arrJoin = Array.prototype.join;
10947
+ var arrShift = Array.prototype.shift;
10948
+
10949
+ // Naive Function.prototype.bind for compatibility
10950
+ var fnBind = Function.prototype.bind || function (thisObj) {
10951
+ var fn = this,
10952
+ args = arrSlice.call(arguments, 1);
10953
+
10954
+ // All our (presently) bound functions have either 1 or 0 arguments. By returning
10955
+ // different function signatures, we can pass some tests in ES3 environments
10956
+ if (fn.length === 1) {
10957
+ return function () {
10958
+ return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));
10959
+ };
10960
+ }
10961
+ return function () {
10962
+ return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));
10963
+ };
10964
+ };
10965
+
10966
+ // Object housing internal properties for constructors
10967
+ var internals = objCreate(null);
10968
+
10969
+ // Keep internal properties internal
10970
+ var secret = Math.random();
10971
+
10972
+ // Helper functions
10973
+ // ================
10974
+
10975
+ /**
10976
+ * A function to deal with the inaccuracy of calculating log10 in pre-ES6
10977
+ * JavaScript environments. Math.log(num) / Math.LN10 was responsible for
10978
+ * causing issue #62.
10979
+ */
10980
+ function log10Floor(n) {
10981
+ // ES6 provides the more accurate Math.log10
10982
+ if (typeof Math.log10 === 'function') return Math.floor(Math.log10(n));
10983
+
10984
+ var x = Math.round(Math.log(n) * Math.LOG10E);
10985
+ return x - (Number('1e' + x) > n);
10986
+ }
10987
+
10988
+ /**
10989
+ * A map that doesn't contain Object in its prototype chain
10990
+ */
10991
+ function Record(obj) {
10992
+ // Copy only own properties over unless this object is already a Record instance
10993
+ for (var k in obj) {
10994
+ if (obj instanceof Record || hop.call(obj, k)) defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });
10995
+ }
10996
+ }
10997
+ Record.prototype = objCreate(null);
10998
+
10999
+ /**
11000
+ * An ordered list
11001
+ */
11002
+ function List() {
11003
+ defineProperty(this, 'length', { writable: true, value: 0 });
11004
+
11005
+ if (arguments.length) arrPush.apply(this, arrSlice.call(arguments));
11006
+ }
11007
+ List.prototype = objCreate(null);
11008
+
11009
+ /**
11010
+ * Constructs a regular expression to restore tainted RegExp properties
11011
+ */
11012
+ function createRegExpRestore() {
11013
+ var esc = /[.?*+^$[\]\\(){}|-]/g,
11014
+ lm = RegExp.lastMatch || '',
11015
+ ml = RegExp.multiline ? 'm' : '',
11016
+ ret = { input: RegExp.input },
11017
+ reg = new List(),
11018
+ has = false,
11019
+ cap = {};
11020
+
11021
+ // Create a snapshot of all the 'captured' properties
11022
+ for (var i = 1; i <= 9; i++) {
11023
+ has = (cap['$' + i] = RegExp['$' + i]) || has;
11024
+ } // Now we've snapshotted some properties, escape the lastMatch string
11025
+ lm = lm.replace(esc, '\\$&');
11026
+
11027
+ // If any of the captured strings were non-empty, iterate over them all
11028
+ if (has) {
11029
+ for (var _i = 1; _i <= 9; _i++) {
11030
+ var m = cap['$' + _i];
11031
+
11032
+ // If it's empty, add an empty capturing group
11033
+ if (!m) lm = '()' + lm;
11034
+
11035
+ // Else find the string in lm and escape & wrap it to capture it
11036
+ else {
11037
+ m = m.replace(esc, '\\$&');
11038
+ lm = lm.replace(m, '(' + m + ')');
11039
+ }
11040
+
11041
+ // Push it to the reg and chop lm to make sure further groups come after
11042
+ arrPush.call(reg, lm.slice(0, lm.indexOf('(') + 1));
11043
+ lm = lm.slice(lm.indexOf('(') + 1);
11044
+ }
11045
+ }
11046
+
11047
+ // Create the regular expression that will reconstruct the RegExp properties
11048
+ ret.exp = new RegExp(arrJoin.call(reg, '') + lm, ml);
11049
+
11050
+ return ret;
11051
+ }
11052
+
11053
+ /**
11054
+ * Mimics ES5's abstract ToObject() function
11055
+ */
11056
+ function toObject(arg) {
11057
+ if (arg === null) throw new TypeError('Cannot convert null or undefined to object');
11058
+
11059
+ return Object(arg);
11060
+ }
11061
+
11062
+ /**
11063
+ * Returns "internal" properties for an object
11064
+ */
11065
+ function getInternalProperties(obj) {
11066
+ if (hop.call(obj, '__getInternalProperties')) return obj.__getInternalProperties(secret);
11067
+
11068
+ return objCreate(null);
11069
+ }
11070
+
11071
+ /**
11072
+ * Defines regular expressions for various operations related to the BCP 47 syntax,
11073
+ * as defined at http://tools.ietf.org/html/bcp47#section-2.1
11074
+ */
11075
+
11076
+ // extlang = 3ALPHA ; selected ISO 639 codes
11077
+ // *2("-" 3ALPHA) ; permanently reserved
11078
+ var extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';
11079
+
11080
+ // language = 2*3ALPHA ; shortest ISO 639 code
11081
+ // ["-" extlang] ; sometimes followed by
11082
+ // ; extended language subtags
11083
+ // / 4ALPHA ; or reserved for future use
11084
+ // / 5*8ALPHA ; or registered language subtag
11085
+ var language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';
11086
+
11087
+ // script = 4ALPHA ; ISO 15924 code
11088
+ var script = '[a-z]{4}';
11089
+
11090
+ // region = 2ALPHA ; ISO 3166-1 code
11091
+ // / 3DIGIT ; UN M.49 code
11092
+ var region = '(?:[a-z]{2}|\\d{3})';
11093
+
11094
+ // variant = 5*8alphanum ; registered variants
11095
+ // / (DIGIT 3alphanum)
11096
+ var variant = '(?:[a-z0-9]{5,8}|\\d[a-z0-9]{3})';
11097
+
11098
+ // ; Single alphanumerics
11099
+ // ; "x" reserved for private use
11100
+ // singleton = DIGIT ; 0 - 9
11101
+ // / %x41-57 ; A - W
11102
+ // / %x59-5A ; Y - Z
11103
+ // / %x61-77 ; a - w
11104
+ // / %x79-7A ; y - z
11105
+ var singleton = '[0-9a-wy-z]';
11106
+
11107
+ // extension = singleton 1*("-" (2*8alphanum))
11108
+ var extension = singleton + '(?:-[a-z0-9]{2,8})+';
11109
+
11110
+ // privateuse = "x" 1*("-" (1*8alphanum))
11111
+ var privateuse = 'x(?:-[a-z0-9]{1,8})+';
11112
+
11113
+ // irregular = "en-GB-oed" ; irregular tags do not match
11114
+ // / "i-ami" ; the 'langtag' production and
11115
+ // / "i-bnn" ; would not otherwise be
11116
+ // / "i-default" ; considered 'well-formed'
11117
+ // / "i-enochian" ; These tags are all valid,
11118
+ // / "i-hak" ; but most are deprecated
11119
+ // / "i-klingon" ; in favor of more modern
11120
+ // / "i-lux" ; subtags or subtag
11121
+ // / "i-mingo" ; combination
11122
+ // / "i-navajo"
11123
+ // / "i-pwn"
11124
+ // / "i-tao"
11125
+ // / "i-tay"
11126
+ // / "i-tsu"
11127
+ // / "sgn-BE-FR"
11128
+ // / "sgn-BE-NL"
11129
+ // / "sgn-CH-DE"
11130
+ var irregular = '(?:en-GB-oed' + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)' + '|sgn-(?:BE-FR|BE-NL|CH-DE))';
11131
+
11132
+ // regular = "art-lojban" ; these tags match the 'langtag'
11133
+ // / "cel-gaulish" ; production, but their subtags
11134
+ // / "no-bok" ; are not extended language
11135
+ // / "no-nyn" ; or variant subtags: their meaning
11136
+ // / "zh-guoyu" ; is defined by their registration
11137
+ // / "zh-hakka" ; and all of these are deprecated
11138
+ // / "zh-min" ; in favor of a more modern
11139
+ // / "zh-min-nan" ; subtag or sequence of subtags
11140
+ // / "zh-xiang"
11141
+ var regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn' + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';
11142
+
11143
+ // grandfathered = irregular ; non-redundant tags registered
11144
+ // / regular ; during the RFC 3066 era
11145
+ var grandfathered = '(?:' + irregular + '|' + regular + ')';
11146
+
11147
+ // langtag = language
11148
+ // ["-" script]
11149
+ // ["-" region]
11150
+ // *("-" variant)
11151
+ // *("-" extension)
11152
+ // ["-" privateuse]
11153
+ var langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-' + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';
11154
+
11155
+ // Language-Tag = langtag ; normal language tags
11156
+ // / privateuse ; private use tag
11157
+ // / grandfathered ; grandfathered tags
11158
+ var expBCP47Syntax = RegExp('^(?:' + langtag + '|' + privateuse + '|' + grandfathered + ')$', 'i');
11159
+
11160
+ // Match duplicate variants in a language tag
11161
+ var expVariantDupes = RegExp('^(?!x).*?-(' + variant + ')-(?:\\w{4,8}-(?!x-))*\\1\\b', 'i');
11162
+
11163
+ // Match duplicate singletons in a language tag (except in private use)
11164
+ var expSingletonDupes = RegExp('^(?!x).*?-(' + singleton + ')-(?:\\w+-(?!x-))*\\1\\b', 'i');
11165
+
11166
+ // Match all extension sequences
11167
+ var expExtSequences = RegExp('-' + extension, 'ig');
11168
+
11169
+ // Default locale is the first-added locale data for us
11170
+ var defaultLocale = void 0;
11171
+ function setDefaultLocale(locale) {
11172
+ defaultLocale = locale;
11173
+ }
11174
+
11175
+ // IANA Subtag Registry redundant tag and subtag maps
11176
+ var redundantTags = {
11177
+ tags: {
11178
+ "art-lojban": "jbo",
11179
+ "i-ami": "ami",
11180
+ "i-bnn": "bnn",
11181
+ "i-hak": "hak",
11182
+ "i-klingon": "tlh",
11183
+ "i-lux": "lb",
11184
+ "i-navajo": "nv",
11185
+ "i-pwn": "pwn",
11186
+ "i-tao": "tao",
11187
+ "i-tay": "tay",
11188
+ "i-tsu": "tsu",
11189
+ "no-bok": "nb",
11190
+ "no-nyn": "nn",
11191
+ "sgn-BE-FR": "sfb",
11192
+ "sgn-BE-NL": "vgt",
11193
+ "sgn-CH-DE": "sgg",
11194
+ "zh-guoyu": "cmn",
11195
+ "zh-hakka": "hak",
11196
+ "zh-min-nan": "nan",
11197
+ "zh-xiang": "hsn",
11198
+ "sgn-BR": "bzs",
11199
+ "sgn-CO": "csn",
11200
+ "sgn-DE": "gsg",
11201
+ "sgn-DK": "dsl",
11202
+ "sgn-ES": "ssp",
11203
+ "sgn-FR": "fsl",
11204
+ "sgn-GB": "bfi",
11205
+ "sgn-GR": "gss",
11206
+ "sgn-IE": "isg",
11207
+ "sgn-IT": "ise",
11208
+ "sgn-JP": "jsl",
11209
+ "sgn-MX": "mfs",
11210
+ "sgn-NI": "ncs",
11211
+ "sgn-NL": "dse",
11212
+ "sgn-NO": "nsl",
11213
+ "sgn-PT": "psr",
11214
+ "sgn-SE": "swl",
11215
+ "sgn-US": "ase",
11216
+ "sgn-ZA": "sfs",
11217
+ "zh-cmn": "cmn",
11218
+ "zh-cmn-Hans": "cmn-Hans",
11219
+ "zh-cmn-Hant": "cmn-Hant",
11220
+ "zh-gan": "gan",
11221
+ "zh-wuu": "wuu",
11222
+ "zh-yue": "yue"
11223
+ },
11224
+ subtags: {
11225
+ BU: "MM",
11226
+ DD: "DE",
11227
+ FX: "FR",
11228
+ TP: "TL",
11229
+ YD: "YE",
11230
+ ZR: "CD",
11231
+ heploc: "alalc97",
11232
+ 'in': "id",
11233
+ iw: "he",
11234
+ ji: "yi",
11235
+ jw: "jv",
11236
+ mo: "ro",
11237
+ ayx: "nun",
11238
+ bjd: "drl",
11239
+ ccq: "rki",
11240
+ cjr: "mom",
11241
+ cka: "cmr",
11242
+ cmk: "xch",
11243
+ drh: "khk",
11244
+ drw: "prs",
11245
+ gav: "dev",
11246
+ hrr: "jal",
11247
+ ibi: "opa",
11248
+ kgh: "kml",
11249
+ lcq: "ppr",
11250
+ mst: "mry",
11251
+ myt: "mry",
11252
+ sca: "hle",
11253
+ tie: "ras",
11254
+ tkk: "twm",
11255
+ tlw: "weo",
11256
+ tnf: "prs",
11257
+ ybd: "rki",
11258
+ yma: "lrr"
11259
+ },
11260
+ extLang: {
11261
+ aao: ["aao", "ar"],
11262
+ abh: ["abh", "ar"],
11263
+ abv: ["abv", "ar"],
11264
+ acm: ["acm", "ar"],
11265
+ acq: ["acq", "ar"],
11266
+ acw: ["acw", "ar"],
11267
+ acx: ["acx", "ar"],
11268
+ acy: ["acy", "ar"],
11269
+ adf: ["adf", "ar"],
11270
+ ads: ["ads", "sgn"],
11271
+ aeb: ["aeb", "ar"],
11272
+ aec: ["aec", "ar"],
11273
+ aed: ["aed", "sgn"],
11274
+ aen: ["aen", "sgn"],
11275
+ afb: ["afb", "ar"],
11276
+ afg: ["afg", "sgn"],
11277
+ ajp: ["ajp", "ar"],
11278
+ apc: ["apc", "ar"],
11279
+ apd: ["apd", "ar"],
11280
+ arb: ["arb", "ar"],
11281
+ arq: ["arq", "ar"],
11282
+ ars: ["ars", "ar"],
11283
+ ary: ["ary", "ar"],
11284
+ arz: ["arz", "ar"],
11285
+ ase: ["ase", "sgn"],
11286
+ asf: ["asf", "sgn"],
11287
+ asp: ["asp", "sgn"],
11288
+ asq: ["asq", "sgn"],
11289
+ asw: ["asw", "sgn"],
11290
+ auz: ["auz", "ar"],
11291
+ avl: ["avl", "ar"],
11292
+ ayh: ["ayh", "ar"],
11293
+ ayl: ["ayl", "ar"],
11294
+ ayn: ["ayn", "ar"],
11295
+ ayp: ["ayp", "ar"],
11296
+ bbz: ["bbz", "ar"],
11297
+ bfi: ["bfi", "sgn"],
11298
+ bfk: ["bfk", "sgn"],
11299
+ bjn: ["bjn", "ms"],
11300
+ bog: ["bog", "sgn"],
11301
+ bqn: ["bqn", "sgn"],
11302
+ bqy: ["bqy", "sgn"],
11303
+ btj: ["btj", "ms"],
11304
+ bve: ["bve", "ms"],
11305
+ bvl: ["bvl", "sgn"],
11306
+ bvu: ["bvu", "ms"],
11307
+ bzs: ["bzs", "sgn"],
11308
+ cdo: ["cdo", "zh"],
11309
+ cds: ["cds", "sgn"],
11310
+ cjy: ["cjy", "zh"],
11311
+ cmn: ["cmn", "zh"],
11312
+ coa: ["coa", "ms"],
11313
+ cpx: ["cpx", "zh"],
11314
+ csc: ["csc", "sgn"],
11315
+ csd: ["csd", "sgn"],
11316
+ cse: ["cse", "sgn"],
11317
+ csf: ["csf", "sgn"],
11318
+ csg: ["csg", "sgn"],
11319
+ csl: ["csl", "sgn"],
11320
+ csn: ["csn", "sgn"],
11321
+ csq: ["csq", "sgn"],
11322
+ csr: ["csr", "sgn"],
11323
+ czh: ["czh", "zh"],
11324
+ czo: ["czo", "zh"],
11325
+ doq: ["doq", "sgn"],
11326
+ dse: ["dse", "sgn"],
11327
+ dsl: ["dsl", "sgn"],
11328
+ dup: ["dup", "ms"],
11329
+ ecs: ["ecs", "sgn"],
11330
+ esl: ["esl", "sgn"],
11331
+ esn: ["esn", "sgn"],
11332
+ eso: ["eso", "sgn"],
11333
+ eth: ["eth", "sgn"],
11334
+ fcs: ["fcs", "sgn"],
11335
+ fse: ["fse", "sgn"],
11336
+ fsl: ["fsl", "sgn"],
11337
+ fss: ["fss", "sgn"],
11338
+ gan: ["gan", "zh"],
11339
+ gds: ["gds", "sgn"],
11340
+ gom: ["gom", "kok"],
11341
+ gse: ["gse", "sgn"],
11342
+ gsg: ["gsg", "sgn"],
11343
+ gsm: ["gsm", "sgn"],
11344
+ gss: ["gss", "sgn"],
11345
+ gus: ["gus", "sgn"],
11346
+ hab: ["hab", "sgn"],
11347
+ haf: ["haf", "sgn"],
11348
+ hak: ["hak", "zh"],
11349
+ hds: ["hds", "sgn"],
11350
+ hji: ["hji", "ms"],
11351
+ hks: ["hks", "sgn"],
11352
+ hos: ["hos", "sgn"],
11353
+ hps: ["hps", "sgn"],
11354
+ hsh: ["hsh", "sgn"],
11355
+ hsl: ["hsl", "sgn"],
11356
+ hsn: ["hsn", "zh"],
11357
+ icl: ["icl", "sgn"],
11358
+ ils: ["ils", "sgn"],
11359
+ inl: ["inl", "sgn"],
11360
+ ins: ["ins", "sgn"],
11361
+ ise: ["ise", "sgn"],
11362
+ isg: ["isg", "sgn"],
11363
+ isr: ["isr", "sgn"],
11364
+ jak: ["jak", "ms"],
11365
+ jax: ["jax", "ms"],
11366
+ jcs: ["jcs", "sgn"],
11367
+ jhs: ["jhs", "sgn"],
11368
+ jls: ["jls", "sgn"],
11369
+ jos: ["jos", "sgn"],
11370
+ jsl: ["jsl", "sgn"],
11371
+ jus: ["jus", "sgn"],
11372
+ kgi: ["kgi", "sgn"],
11373
+ knn: ["knn", "kok"],
11374
+ kvb: ["kvb", "ms"],
11375
+ kvk: ["kvk", "sgn"],
11376
+ kvr: ["kvr", "ms"],
11377
+ kxd: ["kxd", "ms"],
11378
+ lbs: ["lbs", "sgn"],
11379
+ lce: ["lce", "ms"],
11380
+ lcf: ["lcf", "ms"],
11381
+ liw: ["liw", "ms"],
11382
+ lls: ["lls", "sgn"],
11383
+ lsg: ["lsg", "sgn"],
11384
+ lsl: ["lsl", "sgn"],
11385
+ lso: ["lso", "sgn"],
11386
+ lsp: ["lsp", "sgn"],
11387
+ lst: ["lst", "sgn"],
11388
+ lsy: ["lsy", "sgn"],
11389
+ ltg: ["ltg", "lv"],
11390
+ lvs: ["lvs", "lv"],
11391
+ lzh: ["lzh", "zh"],
11392
+ max: ["max", "ms"],
11393
+ mdl: ["mdl", "sgn"],
11394
+ meo: ["meo", "ms"],
11395
+ mfa: ["mfa", "ms"],
11396
+ mfb: ["mfb", "ms"],
11397
+ mfs: ["mfs", "sgn"],
11398
+ min: ["min", "ms"],
11399
+ mnp: ["mnp", "zh"],
11400
+ mqg: ["mqg", "ms"],
11401
+ mre: ["mre", "sgn"],
11402
+ msd: ["msd", "sgn"],
11403
+ msi: ["msi", "ms"],
11404
+ msr: ["msr", "sgn"],
11405
+ mui: ["mui", "ms"],
11406
+ mzc: ["mzc", "sgn"],
11407
+ mzg: ["mzg", "sgn"],
11408
+ mzy: ["mzy", "sgn"],
11409
+ nan: ["nan", "zh"],
11410
+ nbs: ["nbs", "sgn"],
11411
+ ncs: ["ncs", "sgn"],
11412
+ nsi: ["nsi", "sgn"],
11413
+ nsl: ["nsl", "sgn"],
11414
+ nsp: ["nsp", "sgn"],
11415
+ nsr: ["nsr", "sgn"],
11416
+ nzs: ["nzs", "sgn"],
11417
+ okl: ["okl", "sgn"],
11418
+ orn: ["orn", "ms"],
11419
+ ors: ["ors", "ms"],
11420
+ pel: ["pel", "ms"],
11421
+ pga: ["pga", "ar"],
11422
+ pks: ["pks", "sgn"],
11423
+ prl: ["prl", "sgn"],
11424
+ prz: ["prz", "sgn"],
11425
+ psc: ["psc", "sgn"],
11426
+ psd: ["psd", "sgn"],
11427
+ pse: ["pse", "ms"],
11428
+ psg: ["psg", "sgn"],
11429
+ psl: ["psl", "sgn"],
11430
+ pso: ["pso", "sgn"],
11431
+ psp: ["psp", "sgn"],
11432
+ psr: ["psr", "sgn"],
11433
+ pys: ["pys", "sgn"],
11434
+ rms: ["rms", "sgn"],
11435
+ rsi: ["rsi", "sgn"],
11436
+ rsl: ["rsl", "sgn"],
11437
+ sdl: ["sdl", "sgn"],
11438
+ sfb: ["sfb", "sgn"],
11439
+ sfs: ["sfs", "sgn"],
11440
+ sgg: ["sgg", "sgn"],
11441
+ sgx: ["sgx", "sgn"],
11442
+ shu: ["shu", "ar"],
11443
+ slf: ["slf", "sgn"],
11444
+ sls: ["sls", "sgn"],
11445
+ sqk: ["sqk", "sgn"],
11446
+ sqs: ["sqs", "sgn"],
11447
+ ssh: ["ssh", "ar"],
11448
+ ssp: ["ssp", "sgn"],
11449
+ ssr: ["ssr", "sgn"],
11450
+ svk: ["svk", "sgn"],
11451
+ swc: ["swc", "sw"],
11452
+ swh: ["swh", "sw"],
11453
+ swl: ["swl", "sgn"],
11454
+ syy: ["syy", "sgn"],
11455
+ tmw: ["tmw", "ms"],
11456
+ tse: ["tse", "sgn"],
11457
+ tsm: ["tsm", "sgn"],
11458
+ tsq: ["tsq", "sgn"],
11459
+ tss: ["tss", "sgn"],
11460
+ tsy: ["tsy", "sgn"],
11461
+ tza: ["tza", "sgn"],
11462
+ ugn: ["ugn", "sgn"],
11463
+ ugy: ["ugy", "sgn"],
11464
+ ukl: ["ukl", "sgn"],
11465
+ uks: ["uks", "sgn"],
11466
+ urk: ["urk", "ms"],
11467
+ uzn: ["uzn", "uz"],
11468
+ uzs: ["uzs", "uz"],
11469
+ vgt: ["vgt", "sgn"],
11470
+ vkk: ["vkk", "ms"],
11471
+ vkt: ["vkt", "ms"],
11472
+ vsi: ["vsi", "sgn"],
11473
+ vsl: ["vsl", "sgn"],
11474
+ vsv: ["vsv", "sgn"],
11475
+ wuu: ["wuu", "zh"],
11476
+ xki: ["xki", "sgn"],
11477
+ xml: ["xml", "sgn"],
11478
+ xmm: ["xmm", "ms"],
11479
+ xms: ["xms", "sgn"],
11480
+ yds: ["yds", "sgn"],
11481
+ ysl: ["ysl", "sgn"],
11482
+ yue: ["yue", "zh"],
11483
+ zib: ["zib", "sgn"],
11484
+ zlm: ["zlm", "ms"],
11485
+ zmi: ["zmi", "ms"],
11486
+ zsl: ["zsl", "sgn"],
11487
+ zsm: ["zsm", "ms"]
11488
+ }
11489
+ };
11490
+
11491
+ /**
11492
+ * Convert only a-z to uppercase as per section 6.1 of the spec
11493
+ */
11494
+ function toLatinUpperCase(str) {
11495
+ var i = str.length;
11496
+
11497
+ while (i--) {
11498
+ var ch = str.charAt(i);
11499
+
11500
+ if (ch >= "a" && ch <= "z") str = str.slice(0, i) + ch.toUpperCase() + str.slice(i + 1);
11501
+ }
11502
+
11503
+ return str;
11504
+ }
11505
+
11506
+ /**
11507
+ * The IsStructurallyValidLanguageTag abstract operation verifies that the locale
11508
+ * argument (which must be a String value)
11509
+ *
11510
+ * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section
11511
+ * 2.1, or successor,
11512
+ * - does not include duplicate variant subtags, and
11513
+ * - does not include duplicate singleton subtags.
11514
+ *
11515
+ * The abstract operation returns true if locale can be generated from the ABNF
11516
+ * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not
11517
+ * contain duplicate variant or singleton subtags (other than as a private use
11518
+ * subtag). It returns false otherwise. Terminal value characters in the grammar are
11519
+ * interpreted as the Unicode equivalents of the ASCII octet values given.
11520
+ */
11521
+ function /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {
11522
+ // represents a well-formed BCP 47 language tag as specified in RFC 5646
11523
+ if (!expBCP47Syntax.test(locale)) return false;
11524
+
11525
+ // does not include duplicate variant subtags, and
11526
+ if (expVariantDupes.test(locale)) return false;
11527
+
11528
+ // does not include duplicate singleton subtags.
11529
+ if (expSingletonDupes.test(locale)) return false;
11530
+
11531
+ return true;
11532
+ }
11533
+
11534
+ /**
11535
+ * The CanonicalizeLanguageTag abstract operation returns the canonical and case-
11536
+ * regularized form of the locale argument (which must be a String value that is
11537
+ * a structurally valid BCP 47 language tag as verified by the
11538
+ * IsStructurallyValidLanguageTag abstract operation). It takes the steps
11539
+ * specified in RFC 5646 section 4.5, or successor, to bring the language tag
11540
+ * into canonical form, and to regularize the case of the subtags, but does not
11541
+ * take the steps to bring a language tag into “extlang form” and to reorder
11542
+ * variant subtags.
11543
+
11544
+ * The specifications for extensions to BCP 47 language tags, such as RFC 6067,
11545
+ * may include canonicalization rules for the extension subtag sequences they
11546
+ * define that go beyond the canonicalization rules of RFC 5646 section 4.5.
11547
+ * Implementations are allowed, but not required, to apply these additional rules.
11548
+ */
11549
+ function /* 6.2.3 */CanonicalizeLanguageTag(locale) {
11550
+ var match = void 0,
11551
+ parts = void 0;
11552
+
11553
+ // A language tag is in 'canonical form' when the tag is well-formed
11554
+ // according to the rules in Sections 2.1 and 2.2
11555
+
11556
+ // Section 2.1 says all subtags use lowercase...
11557
+ locale = locale.toLowerCase();
11558
+
11559
+ // ...with 2 exceptions: 'two-letter and four-letter subtags that neither
11560
+ // appear at the start of the tag nor occur after singletons. Such two-letter
11561
+ // subtags are all uppercase (as in the tags "en-CA-x-ca" or "sgn-BE-FR") and
11562
+ // four-letter subtags are titlecase (as in the tag "az-Latn-x-latn").
11563
+ parts = locale.split('-');
11564
+ for (var i = 1, max = parts.length; i < max; i++) {
11565
+ // Two-letter subtags are all uppercase
11566
+ if (parts[i].length === 2) parts[i] = parts[i].toUpperCase();
11567
+
11568
+ // Four-letter subtags are titlecase
11569
+ else if (parts[i].length === 4) parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);
11570
+
11571
+ // Is it a singleton?
11572
+ else if (parts[i].length === 1 && parts[i] !== 'x') break;
11573
+ }
11574
+ locale = arrJoin.call(parts, '-');
11575
+
11576
+ // The steps laid out in RFC 5646 section 4.5 are as follows:
11577
+
11578
+ // 1. Extension sequences are ordered into case-insensitive ASCII order
11579
+ // by singleton subtag.
11580
+ if ((match = locale.match(expExtSequences)) && match.length > 1) {
11581
+ // The built-in sort() sorts by ASCII order, so use that
11582
+ match.sort();
11583
+
11584
+ // Replace all extensions with the joined, sorted array
11585
+ locale = locale.replace(RegExp('(?:' + expExtSequences.source + ')+', 'i'), arrJoin.call(match, ''));
11586
+ }
11587
+
11588
+ // 2. Redundant or grandfathered tags are replaced by their 'Preferred-
11589
+ // Value', if there is one.
11590
+ if (hop.call(redundantTags.tags, locale)) locale = redundantTags.tags[locale];
11591
+
11592
+ // 3. Subtags are replaced by their 'Preferred-Value', if there is one.
11593
+ // For extlangs, the original primary language subtag is also
11594
+ // replaced if there is a primary language subtag in the 'Preferred-
11595
+ // Value'.
11596
+ parts = locale.split('-');
11597
+
11598
+ for (var _i = 1, _max = parts.length; _i < _max; _i++) {
11599
+ if (hop.call(redundantTags.subtags, parts[_i])) parts[_i] = redundantTags.subtags[parts[_i]];else if (hop.call(redundantTags.extLang, parts[_i])) {
11600
+ parts[_i] = redundantTags.extLang[parts[_i]][0];
11601
+
11602
+ // For extlang tags, the prefix needs to be removed if it is redundant
11603
+ if (_i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {
11604
+ parts = arrSlice.call(parts, _i++);
11605
+ _max -= 1;
11606
+ }
11607
+ }
11608
+ }
11609
+
11610
+ return arrJoin.call(parts, '-');
11611
+ }
11612
+
11613
+ /**
11614
+ * The DefaultLocale abstract operation returns a String value representing the
11615
+ * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the
11616
+ * host environment’s current locale.
11617
+ */
11618
+ function /* 6.2.4 */DefaultLocale() {
11619
+ return defaultLocale;
11620
+ }
11621
+
11622
+ // Sect 6.3 Currency Codes
11623
+ // =======================
11624
+
11625
+ var expCurrencyCode = /^[A-Z]{3}$/;
11626
+
11627
+ /**
11628
+ * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument
11629
+ * (after conversion to a String value) represents a well-formed 3-letter ISO currency
11630
+ * code. The following steps are taken:
11631
+ */
11632
+ function /* 6.3.1 */IsWellFormedCurrencyCode(currency) {
11633
+ // 1. Let `c` be ToString(currency)
11634
+ var c = String(currency);
11635
+
11636
+ // 2. Let `normalized` be the result of mapping c to upper case as described
11637
+ // in 6.1.
11638
+ var normalized = toLatinUpperCase(c);
11639
+
11640
+ // 3. If the string length of normalized is not 3, return false.
11641
+ // 4. If normalized contains any character that is not in the range "A" to "Z"
11642
+ // (U+0041 to U+005A), return false.
11643
+ if (expCurrencyCode.test(normalized) === false) return false;
11644
+
11645
+ // 5. Return true
11646
+ return true;
11647
+ }
11648
+
11649
+ var expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below
11650
+
11651
+ function /* 9.2.1 */CanonicalizeLocaleList(locales) {
11652
+ // The abstract operation CanonicalizeLocaleList takes the following steps:
11653
+
11654
+ // 1. If locales is undefined, then a. Return a new empty List
11655
+ if (locales === undefined) return new List();
11656
+
11657
+ // 2. Let seen be a new empty List.
11658
+ var seen = new List();
11659
+
11660
+ // 3. If locales is a String value, then
11661
+ // a. Let locales be a new array created as if by the expression new
11662
+ // Array(locales) where Array is the standard built-in constructor with
11663
+ // that name and locales is the value of locales.
11664
+ locales = typeof locales === 'string' ? [locales] : locales;
11665
+
11666
+ // 4. Let O be ToObject(locales).
11667
+ var O = toObject(locales);
11668
+
11669
+ // 5. Let lenValue be the result of calling the [[Get]] internal method of
11670
+ // O with the argument "length".
11671
+ // 6. Let len be ToUint32(lenValue).
11672
+ var len = O.length;
11673
+
11674
+ // 7. Let k be 0.
11675
+ var k = 0;
11676
+
11677
+ // 8. Repeat, while k < len
11678
+ while (k < len) {
11679
+ // a. Let Pk be ToString(k).
11680
+ var Pk = String(k);
11681
+
11682
+ // b. Let kPresent be the result of calling the [[HasProperty]] internal
11683
+ // method of O with argument Pk.
11684
+ var kPresent = Pk in O;
11685
+
11686
+ // c. If kPresent is true, then
11687
+ if (kPresent) {
11688
+ // i. Let kValue be the result of calling the [[Get]] internal
11689
+ // method of O with argument Pk.
11690
+ var kValue = O[Pk];
11691
+
11692
+ // ii. If the type of kValue is not String or Object, then throw a
11693
+ // TypeError exception.
11694
+ if (kValue === null || typeof kValue !== 'string' && (typeof kValue === "undefined" ? "undefined" : babelHelpers["typeof"](kValue)) !== 'object') throw new TypeError('String or Object type expected');
11695
+
11696
+ // iii. Let tag be ToString(kValue).
11697
+ var tag = String(kValue);
11698
+
11699
+ // iv. If the result of calling the abstract operation
11700
+ // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as
11701
+ // the argument, is false, then throw a RangeError exception.
11702
+ if (!IsStructurallyValidLanguageTag(tag)) throw new RangeError("'" + tag + "' is not a structurally valid language tag");
11703
+
11704
+ // v. Let tag be the result of calling the abstract operation
11705
+ // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the
11706
+ // argument.
11707
+ tag = CanonicalizeLanguageTag(tag);
11708
+
11709
+ // vi. If tag is not an element of seen, then append tag as the last
11710
+ // element of seen.
11711
+ if (arrIndexOf.call(seen, tag) === -1) arrPush.call(seen, tag);
11712
+ }
11713
+
11714
+ // d. Increase k by 1.
11715
+ k++;
11716
+ }
11717
+
11718
+ // 9. Return seen.
11719
+ return seen;
11720
+ }
11721
+
11722
+ /**
11723
+ * The BestAvailableLocale abstract operation compares the provided argument
11724
+ * locale, which must be a String value with a structurally valid and
11725
+ * canonicalized BCP 47 language tag, against the locales in availableLocales and
11726
+ * returns either the longest non-empty prefix of locale that is an element of
11727
+ * availableLocales, or undefined if there is no such element. It uses the
11728
+ * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:
11729
+ */
11730
+ function /* 9.2.2 */BestAvailableLocale(availableLocales, locale) {
11731
+ // 1. Let candidate be locale
11732
+ var candidate = locale;
11733
+
11734
+ // 2. Repeat
11735
+ while (candidate) {
11736
+ // a. If availableLocales contains an element equal to candidate, then return
11737
+ // candidate.
11738
+ if (arrIndexOf.call(availableLocales, candidate) > -1) return candidate;
11739
+
11740
+ // b. Let pos be the character index of the last occurrence of "-"
11741
+ // (U+002D) within candidate. If that character does not occur, return
11742
+ // undefined.
11743
+ var pos = candidate.lastIndexOf('-');
11744
+
11745
+ if (pos < 0) return;
11746
+
11747
+ // c. If pos ≥ 2 and the character "-" occurs at index pos-2 of candidate,
11748
+ // then decrease pos by 2.
11749
+ if (pos >= 2 && candidate.charAt(pos - 2) === '-') pos -= 2;
11750
+
11751
+ // d. Let candidate be the substring of candidate from position 0, inclusive,
11752
+ // to position pos, exclusive.
11753
+ candidate = candidate.substring(0, pos);
11754
+ }
11755
+ }
11756
+
11757
+ /**
11758
+ * The LookupMatcher abstract operation compares requestedLocales, which must be
11759
+ * a List as returned by CanonicalizeLocaleList, against the locales in
11760
+ * availableLocales and determines the best available language to meet the
11761
+ * request. The following steps are taken:
11762
+ */
11763
+ function /* 9.2.3 */LookupMatcher(availableLocales, requestedLocales) {
11764
+ // 1. Let i be 0.
11765
+ var i = 0;
11766
+
11767
+ // 2. Let len be the number of elements in requestedLocales.
11768
+ var len = requestedLocales.length;
11769
+
11770
+ // 3. Let availableLocale be undefined.
11771
+ var availableLocale = void 0;
11772
+
11773
+ var locale = void 0,
11774
+ noExtensionsLocale = void 0;
11775
+
11776
+ // 4. Repeat while i < len and availableLocale is undefined:
11777
+ while (i < len && !availableLocale) {
11778
+ // a. Let locale be the element of requestedLocales at 0-origined list
11779
+ // position i.
11780
+ locale = requestedLocales[i];
11781
+
11782
+ // b. Let noExtensionsLocale be the String value that is locale with all
11783
+ // Unicode locale extension sequences removed.
11784
+ noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');
11785
+
11786
+ // c. Let availableLocale be the result of calling the
11787
+ // BestAvailableLocale abstract operation (defined in 9.2.2) with
11788
+ // arguments availableLocales and noExtensionsLocale.
11789
+ availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);
11790
+
11791
+ // d. Increase i by 1.
11792
+ i++;
11793
+ }
11794
+
11795
+ // 5. Let result be a new Record.
11796
+ var result = new Record();
11797
+
11798
+ // 6. If availableLocale is not undefined, then
11799
+ if (availableLocale !== undefined) {
11800
+ // a. Set result.[[locale]] to availableLocale.
11801
+ result['[[locale]]'] = availableLocale;
11802
+
11803
+ // b. If locale and noExtensionsLocale are not the same String value, then
11804
+ if (String(locale) !== String(noExtensionsLocale)) {
11805
+ // i. Let extension be the String value consisting of the first
11806
+ // substring of locale that is a Unicode locale extension sequence.
11807
+ var extension = locale.match(expUnicodeExSeq)[0];
11808
+
11809
+ // ii. Let extensionIndex be the character position of the initial
11810
+ // "-" of the first Unicode locale extension sequence within locale.
11811
+ var extensionIndex = locale.indexOf('-u-');
11812
+
11813
+ // iii. Set result.[[extension]] to extension.
11814
+ result['[[extension]]'] = extension;
11815
+
11816
+ // iv. Set result.[[extensionIndex]] to extensionIndex.
11817
+ result['[[extensionIndex]]'] = extensionIndex;
11818
+ }
11819
+ }
11820
+ // 7. Else
11821
+ else
11822
+ // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract
11823
+ // operation (defined in 6.2.4).
11824
+ result['[[locale]]'] = DefaultLocale();
11825
+
11826
+ // 8. Return result
11827
+ return result;
11828
+ }
11829
+
11830
+ /**
11831
+ * The BestFitMatcher abstract operation compares requestedLocales, which must be
11832
+ * a List as returned by CanonicalizeLocaleList, against the locales in
11833
+ * availableLocales and determines the best available language to meet the
11834
+ * request. The algorithm is implementation dependent, but should produce results
11835
+ * that a typical user of the requested locales would perceive as at least as
11836
+ * good as those produced by the LookupMatcher abstract operation. Options
11837
+ * specified through Unicode locale extension sequences must be ignored by the
11838
+ * algorithm. Information about such subsequences is returned separately.
11839
+ * The abstract operation returns a record with a [[locale]] field, whose value
11840
+ * is the language tag of the selected locale, which must be an element of
11841
+ * availableLocales. If the language tag of the request locale that led to the
11842
+ * selected locale contained a Unicode locale extension sequence, then the
11843
+ * returned record also contains an [[extension]] field whose value is the first
11844
+ * Unicode locale extension sequence, and an [[extensionIndex]] field whose value
11845
+ * is the index of the first Unicode locale extension sequence within the request
11846
+ * locale language tag.
11847
+ */
11848
+ function /* 9.2.4 */BestFitMatcher(availableLocales, requestedLocales) {
11849
+ return LookupMatcher(availableLocales, requestedLocales);
11850
+ }
11851
+
11852
+ /**
11853
+ * The ResolveLocale abstract operation compares a BCP 47 language priority list
11854
+ * requestedLocales against the locales in availableLocales and determines the
11855
+ * best available language to meet the request. availableLocales and
11856
+ * requestedLocales must be provided as List values, options as a Record.
11857
+ */
11858
+ function /* 9.2.5 */ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {
11859
+ if (availableLocales.length === 0) {
11860
+ throw new ReferenceError('No locale data has been provided for this object yet.');
11861
+ }
11862
+
11863
+ // The following steps are taken:
11864
+ // 1. Let matcher be the value of options.[[localeMatcher]].
11865
+ var matcher = options['[[localeMatcher]]'];
11866
+
11867
+ var r = void 0;
11868
+
11869
+ // 2. If matcher is "lookup", then
11870
+ if (matcher === 'lookup')
11871
+ // a. Let r be the result of calling the LookupMatcher abstract operation
11872
+ // (defined in 9.2.3) with arguments availableLocales and
11873
+ // requestedLocales.
11874
+ r = LookupMatcher(availableLocales, requestedLocales);
11875
+
11876
+ // 3. Else
11877
+ else
11878
+ // a. Let r be the result of calling the BestFitMatcher abstract
11879
+ // operation (defined in 9.2.4) with arguments availableLocales and
11880
+ // requestedLocales.
11881
+ r = BestFitMatcher(availableLocales, requestedLocales);
11882
+
11883
+ // 4. Let foundLocale be the value of r.[[locale]].
11884
+ var foundLocale = r['[[locale]]'];
11885
+
11886
+ var extensionSubtags = void 0,
11887
+ extensionSubtagsLength = void 0;
11888
+
11889
+ // 5. If r has an [[extension]] field, then
11890
+ if (hop.call(r, '[[extension]]')) {
11891
+ // a. Let extension be the value of r.[[extension]].
11892
+ var extension = r['[[extension]]'];
11893
+ // b. Let split be the standard built-in function object defined in ES5,
11894
+ // 15.5.4.14.
11895
+ var split = String.prototype.split;
11896
+ // c. Let extensionSubtags be the result of calling the [[Call]] internal
11897
+ // method of split with extension as the this value and an argument
11898
+ // list containing the single item "-".
11899
+ extensionSubtags = split.call(extension, '-');
11900
+ // d. Let extensionSubtagsLength be the result of calling the [[Get]]
11901
+ // internal method of extensionSubtags with argument "length".
11902
+ extensionSubtagsLength = extensionSubtags.length;
11903
+ }
11904
+
11905
+ // 6. Let result be a new Record.
11906
+ var result = new Record();
11907
+
11908
+ // 7. Set result.[[dataLocale]] to foundLocale.
11909
+ result['[[dataLocale]]'] = foundLocale;
11910
+
11911
+ // 8. Let supportedExtension be "-u".
11912
+ var supportedExtension = '-u';
11913
+ // 9. Let i be 0.
11914
+ var i = 0;
11915
+ // 10. Let len be the result of calling the [[Get]] internal method of
11916
+ // relevantExtensionKeys with argument "length".
11917
+ var len = relevantExtensionKeys.length;
11918
+
11919
+ // 11 Repeat while i < len:
11920
+ while (i < len) {
11921
+ // a. Let key be the result of calling the [[Get]] internal method of
11922
+ // relevantExtensionKeys with argument ToString(i).
11923
+ var key = relevantExtensionKeys[i];
11924
+ // b. Let foundLocaleData be the result of calling the [[Get]] internal
11925
+ // method of localeData with the argument foundLocale.
11926
+ var foundLocaleData = localeData[foundLocale];
11927
+ // c. Let keyLocaleData be the result of calling the [[Get]] internal
11928
+ // method of foundLocaleData with the argument key.
11929
+ var keyLocaleData = foundLocaleData[key];
11930
+ // d. Let value be the result of calling the [[Get]] internal method of
11931
+ // keyLocaleData with argument "0".
11932
+ var value = keyLocaleData['0'];
11933
+ // e. Let supportedExtensionAddition be "".
11934
+ var supportedExtensionAddition = '';
11935
+ // f. Let indexOf be the standard built-in function object defined in
11936
+ // ES5, 15.4.4.14.
11937
+ var indexOf = arrIndexOf;
11938
+
11939
+ // g. If extensionSubtags is not undefined, then
11940
+ if (extensionSubtags !== undefined) {
11941
+ // i. Let keyPos be the result of calling the [[Call]] internal
11942
+ // method of indexOf with extensionSubtags as the this value and
11943
+ // an argument list containing the single item key.
11944
+ var keyPos = indexOf.call(extensionSubtags, key);
11945
+
11946
+ // ii. If keyPos ≠ -1, then
11947
+ if (keyPos !== -1) {
11948
+ // 1. If keyPos + 1 < extensionSubtagsLength and the length of the
11949
+ // result of calling the [[Get]] internal method of
11950
+ // extensionSubtags with argument ToString(keyPos +1) is greater
11951
+ // than 2, then
11952
+ if (keyPos + 1 < extensionSubtagsLength && extensionSubtags[keyPos + 1].length > 2) {
11953
+ // a. Let requestedValue be the result of calling the [[Get]]
11954
+ // internal method of extensionSubtags with argument
11955
+ // ToString(keyPos + 1).
11956
+ var requestedValue = extensionSubtags[keyPos + 1];
11957
+ // b. Let valuePos be the result of calling the [[Call]]
11958
+ // internal method of indexOf with keyLocaleData as the
11959
+ // this value and an argument list containing the single
11960
+ // item requestedValue.
11961
+ var valuePos = indexOf.call(keyLocaleData, requestedValue);
11962
+
11963
+ // c. If valuePos ≠ -1, then
11964
+ if (valuePos !== -1) {
11965
+ // i. Let value be requestedValue.
11966
+ value = requestedValue,
11967
+ // ii. Let supportedExtensionAddition be the
11968
+ // concatenation of "-", key, "-", and value.
11969
+ supportedExtensionAddition = '-' + key + '-' + value;
11970
+ }
11971
+ }
11972
+ // 2. Else
11973
+ else {
11974
+ // a. Let valuePos be the result of calling the [[Call]]
11975
+ // internal method of indexOf with keyLocaleData as the this
11976
+ // value and an argument list containing the single item
11977
+ // "true".
11978
+ var _valuePos = indexOf(keyLocaleData, 'true');
11979
+
11980
+ // b. If valuePos ≠ -1, then
11981
+ if (_valuePos !== -1)
11982
+ // i. Let value be "true".
11983
+ value = 'true';
11984
+ }
11985
+ }
11986
+ }
11987
+ // h. If options has a field [[<key>]], then
11988
+ if (hop.call(options, '[[' + key + ']]')) {
11989
+ // i. Let optionsValue be the value of options.[[<key>]].
11990
+ var optionsValue = options['[[' + key + ']]'];
11991
+
11992
+ // ii. If the result of calling the [[Call]] internal method of indexOf
11993
+ // with keyLocaleData as the this value and an argument list
11994
+ // containing the single item optionsValue is not -1, then
11995
+ if (indexOf.call(keyLocaleData, optionsValue) !== -1) {
11996
+ // 1. If optionsValue is not equal to value, then
11997
+ if (optionsValue !== value) {
11998
+ // a. Let value be optionsValue.
11999
+ value = optionsValue;
12000
+ // b. Let supportedExtensionAddition be "".
12001
+ supportedExtensionAddition = '';
12002
+ }
12003
+ }
12004
+ }
12005
+ // i. Set result.[[<key>]] to value.
12006
+ result['[[' + key + ']]'] = value;
12007
+
12008
+ // j. Append supportedExtensionAddition to supportedExtension.
12009
+ supportedExtension += supportedExtensionAddition;
12010
+
12011
+ // k. Increase i by 1.
12012
+ i++;
12013
+ }
12014
+ // 12. If the length of supportedExtension is greater than 2, then
12015
+ if (supportedExtension.length > 2) {
12016
+ // a.
12017
+ var privateIndex = foundLocale.indexOf("-x-");
12018
+ // b.
12019
+ if (privateIndex === -1) {
12020
+ // i.
12021
+ foundLocale = foundLocale + supportedExtension;
12022
+ }
12023
+ // c.
12024
+ else {
12025
+ // i.
12026
+ var preExtension = foundLocale.substring(0, privateIndex);
12027
+ // ii.
12028
+ var postExtension = foundLocale.substring(privateIndex);
12029
+ // iii.
12030
+ foundLocale = preExtension + supportedExtension + postExtension;
12031
+ }
12032
+ // d. asserting - skipping
12033
+ // e.
12034
+ foundLocale = CanonicalizeLanguageTag(foundLocale);
12035
+ }
12036
+ // 13. Set result.[[locale]] to foundLocale.
12037
+ result['[[locale]]'] = foundLocale;
12038
+
12039
+ // 14. Return result.
12040
+ return result;
12041
+ }
12042
+
12043
+ /**
12044
+ * The LookupSupportedLocales abstract operation returns the subset of the
12045
+ * provided BCP 47 language priority list requestedLocales for which
12046
+ * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.
12047
+ * Locales appear in the same order in the returned list as in requestedLocales.
12048
+ * The following steps are taken:
12049
+ */
12050
+ function /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) {
12051
+ // 1. Let len be the number of elements in requestedLocales.
12052
+ var len = requestedLocales.length;
12053
+ // 2. Let subset be a new empty List.
12054
+ var subset = new List();
12055
+ // 3. Let k be 0.
12056
+ var k = 0;
12057
+
12058
+ // 4. Repeat while k < len
12059
+ while (k < len) {
12060
+ // a. Let locale be the element of requestedLocales at 0-origined list
12061
+ // position k.
12062
+ var locale = requestedLocales[k];
12063
+ // b. Let noExtensionsLocale be the String value that is locale with all
12064
+ // Unicode locale extension sequences removed.
12065
+ var noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');
12066
+ // c. Let availableLocale be the result of calling the
12067
+ // BestAvailableLocale abstract operation (defined in 9.2.2) with
12068
+ // arguments availableLocales and noExtensionsLocale.
12069
+ var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);
12070
+
12071
+ // d. If availableLocale is not undefined, then append locale to the end of
12072
+ // subset.
12073
+ if (availableLocale !== undefined) arrPush.call(subset, locale);
12074
+
12075
+ // e. Increment k by 1.
12076
+ k++;
12077
+ }
12078
+
12079
+ // 5. Let subsetArray be a new Array object whose elements are the same
12080
+ // values in the same order as the elements of subset.
12081
+ var subsetArray = arrSlice.call(subset);
12082
+
12083
+ // 6. Return subsetArray.
12084
+ return subsetArray;
12085
+ }
12086
+
12087
+ /**
12088
+ * The BestFitSupportedLocales abstract operation returns the subset of the
12089
+ * provided BCP 47 language priority list requestedLocales for which
12090
+ * availableLocales has a matching locale when using the Best Fit Matcher
12091
+ * algorithm. Locales appear in the same order in the returned list as in
12092
+ * requestedLocales. The steps taken are implementation dependent.
12093
+ */
12094
+ function /*9.2.7 */BestFitSupportedLocales(availableLocales, requestedLocales) {
12095
+ // ###TODO: implement this function as described by the specification###
12096
+ return LookupSupportedLocales(availableLocales, requestedLocales);
12097
+ }
12098
+
12099
+ /**
12100
+ * The SupportedLocales abstract operation returns the subset of the provided BCP
12101
+ * 47 language priority list requestedLocales for which availableLocales has a
12102
+ * matching locale. Two algorithms are available to match the locales: the Lookup
12103
+ * algorithm described in RFC 4647 section 3.4, and an implementation dependent
12104
+ * best-fit algorithm. Locales appear in the same order in the returned list as
12105
+ * in requestedLocales. The following steps are taken:
12106
+ */
12107
+ function /*9.2.8 */SupportedLocales(availableLocales, requestedLocales, options) {
12108
+ var matcher = void 0,
12109
+ subset = void 0;
12110
+
12111
+ // 1. If options is not undefined, then
12112
+ if (options !== undefined) {
12113
+ // a. Let options be ToObject(options).
12114
+ options = new Record(toObject(options));
12115
+ // b. Let matcher be the result of calling the [[Get]] internal method of
12116
+ // options with argument "localeMatcher".
12117
+ matcher = options.localeMatcher;
12118
+
12119
+ // c. If matcher is not undefined, then
12120
+ if (matcher !== undefined) {
12121
+ // i. Let matcher be ToString(matcher).
12122
+ matcher = String(matcher);
12123
+
12124
+ // ii. If matcher is not "lookup" or "best fit", then throw a RangeError
12125
+ // exception.
12126
+ if (matcher !== 'lookup' && matcher !== 'best fit') throw new RangeError('matcher should be "lookup" or "best fit"');
12127
+ }
12128
+ }
12129
+ // 2. If matcher is undefined or "best fit", then
12130
+ if (matcher === undefined || matcher === 'best fit')
12131
+ // a. Let subset be the result of calling the BestFitSupportedLocales
12132
+ // abstract operation (defined in 9.2.7) with arguments
12133
+ // availableLocales and requestedLocales.
12134
+ subset = BestFitSupportedLocales(availableLocales, requestedLocales);
12135
+ // 3. Else
12136
+ else
12137
+ // a. Let subset be the result of calling the LookupSupportedLocales
12138
+ // abstract operation (defined in 9.2.6) with arguments
12139
+ // availableLocales and requestedLocales.
12140
+ subset = LookupSupportedLocales(availableLocales, requestedLocales);
12141
+
12142
+ // 4. For each named own property name P of subset,
12143
+ for (var P in subset) {
12144
+ if (!hop.call(subset, P)) continue;
12145
+
12146
+ // a. Let desc be the result of calling the [[GetOwnProperty]] internal
12147
+ // method of subset with P.
12148
+ // b. Set desc.[[Writable]] to false.
12149
+ // c. Set desc.[[Configurable]] to false.
12150
+ // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,
12151
+ // and true as arguments.
12152
+ defineProperty(subset, P, {
12153
+ writable: false, configurable: false, value: subset[P]
12154
+ });
12155
+ }
12156
+ // "Freeze" the array so no new elements can be added
12157
+ defineProperty(subset, 'length', { writable: false });
12158
+
12159
+ // 5. Return subset
12160
+ return subset;
12161
+ }
12162
+
12163
+ /**
12164
+ * The GetOption abstract operation extracts the value of the property named
12165
+ * property from the provided options object, converts it to the required type,
12166
+ * checks whether it is one of a List of allowed values, and fills in a fallback
12167
+ * value if necessary.
12168
+ */
12169
+ function /*9.2.9 */GetOption(options, property, type, values, fallback) {
12170
+ // 1. Let value be the result of calling the [[Get]] internal method of
12171
+ // options with argument property.
12172
+ var value = options[property];
12173
+
12174
+ // 2. If value is not undefined, then
12175
+ if (value !== undefined) {
12176
+ // a. Assert: type is "boolean" or "string".
12177
+ // b. If type is "boolean", then let value be ToBoolean(value).
12178
+ // c. If type is "string", then let value be ToString(value).
12179
+ value = type === 'boolean' ? Boolean(value) : type === 'string' ? String(value) : value;
12180
+
12181
+ // d. If values is not undefined, then
12182
+ if (values !== undefined) {
12183
+ // i. If values does not contain an element equal to value, then throw a
12184
+ // RangeError exception.
12185
+ if (arrIndexOf.call(values, value) === -1) throw new RangeError("'" + value + "' is not an allowed value for `" + property + '`');
12186
+ }
12187
+
12188
+ // e. Return value.
12189
+ return value;
12190
+ }
12191
+ // Else return fallback.
12192
+ return fallback;
12193
+ }
12194
+
12195
+ /**
12196
+ * The GetNumberOption abstract operation extracts a property value from the
12197
+ * provided options object, converts it to a Number value, checks whether it is
12198
+ * in the allowed range, and fills in a fallback value if necessary.
12199
+ */
12200
+ function /* 9.2.10 */GetNumberOption(options, property, minimum, maximum, fallback) {
12201
+ // 1. Let value be the result of calling the [[Get]] internal method of
12202
+ // options with argument property.
12203
+ var value = options[property];
12204
+
12205
+ // 2. If value is not undefined, then
12206
+ if (value !== undefined) {
12207
+ // a. Let value be ToNumber(value).
12208
+ value = Number(value);
12209
+
12210
+ // b. If value is NaN or less than minimum or greater than maximum, throw a
12211
+ // RangeError exception.
12212
+ if (isNaN(value) || value < minimum || value > maximum) throw new RangeError('Value is not a number or outside accepted range');
12213
+
12214
+ // c. Return floor(value).
12215
+ return Math.floor(value);
12216
+ }
12217
+ // 3. Else return fallback.
12218
+ return fallback;
12219
+ }
12220
+
12221
+ // 8 The Intl Object
12222
+ var Intl = {};
12223
+
12224
+ // 8.2 Function Properties of the Intl Object
12225
+
12226
+ // 8.2.1
12227
+ // @spec[tc39/ecma402/master/spec/intl.html]
12228
+ // @clause[sec-intl.getcanonicallocales]
12229
+ Intl.getCanonicalLocales = function (locales) {
12230
+ // 1. Let ll be ? CanonicalizeLocaleList(locales).
12231
+ var ll = CanonicalizeLocaleList(locales);
12232
+ // 2. Return CreateArrayFromList(ll).
12233
+ {
12234
+ var result = [];
12235
+ for (var code in ll) {
12236
+ result.push(ll[code]);
12237
+ }
12238
+ return result;
12239
+ }
12240
+ };
12241
+
12242
+ // Currency minor units output from get-4217 grunt task, formatted
12243
+ var currencyMinorUnits = {
12244
+ BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,
12245
+ XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,
12246
+ OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0
12247
+ };
12248
+
12249
+ // Define the NumberFormat constructor internally so it cannot be tainted
12250
+ function NumberFormatConstructor() {
12251
+ var locales = arguments[0];
12252
+ var options = arguments[1];
12253
+
12254
+ if (!this || this === Intl) {
12255
+ return new Intl.NumberFormat(locales, options);
12256
+ }
12257
+
12258
+ return InitializeNumberFormat(toObject(this), locales, options);
12259
+ }
12260
+
12261
+ defineProperty(Intl, 'NumberFormat', {
12262
+ configurable: true,
12263
+ writable: true,
12264
+ value: NumberFormatConstructor
12265
+ });
12266
+
12267
+ // Must explicitly set prototypes as unwritable
12268
+ defineProperty(Intl.NumberFormat, 'prototype', {
12269
+ writable: false
12270
+ });
12271
+
12272
+ /**
12273
+ * The abstract operation InitializeNumberFormat accepts the arguments
12274
+ * numberFormat (which must be an object), locales, and options. It initializes
12275
+ * numberFormat as a NumberFormat object.
12276
+ */
12277
+ function /*11.1.1.1 */InitializeNumberFormat(numberFormat, locales, options) {
12278
+ // This will be a internal properties object if we're not already initialized
12279
+ var internal = getInternalProperties(numberFormat);
12280
+
12281
+ // Create an object whose props can be used to restore the values of RegExp props
12282
+ var regexpState = createRegExpRestore();
12283
+
12284
+ // 1. If numberFormat has an [[initializedIntlObject]] internal property with
12285
+ // value true, throw a TypeError exception.
12286
+ if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');
12287
+
12288
+ // Need this to access the `internal` object
12289
+ defineProperty(numberFormat, '__getInternalProperties', {
12290
+ value: function value() {
12291
+ // NOTE: Non-standard, for internal use only
12292
+ if (arguments[0] === secret) return internal;
12293
+ }
12294
+ });
12295
+
12296
+ // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
12297
+ internal['[[initializedIntlObject]]'] = true;
12298
+
12299
+ // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
12300
+ // abstract operation (defined in 9.2.1) with argument locales.
12301
+ var requestedLocales = CanonicalizeLocaleList(locales);
12302
+
12303
+ // 4. If options is undefined, then
12304
+ if (options === undefined)
12305
+ // a. Let options be the result of creating a new object as if by the
12306
+ // expression new Object() where Object is the standard built-in constructor
12307
+ // with that name.
12308
+ options = {};
12309
+
12310
+ // 5. Else
12311
+ else
12312
+ // a. Let options be ToObject(options).
12313
+ options = toObject(options);
12314
+
12315
+ // 6. Let opt be a new Record.
12316
+ var opt = new Record(),
12317
+
12318
+
12319
+ // 7. Let matcher be the result of calling the GetOption abstract operation
12320
+ // (defined in 9.2.9) with the arguments options, "localeMatcher", "string",
12321
+ // a List containing the two String values "lookup" and "best fit", and
12322
+ // "best fit".
12323
+ matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');
12324
+
12325
+ // 8. Set opt.[[localeMatcher]] to matcher.
12326
+ opt['[[localeMatcher]]'] = matcher;
12327
+
12328
+ // 9. Let NumberFormat be the standard built-in object that is the initial value
12329
+ // of Intl.NumberFormat.
12330
+ // 10. Let localeData be the value of the [[localeData]] internal property of
12331
+ // NumberFormat.
12332
+ var localeData = internals.NumberFormat['[[localeData]]'];
12333
+
12334
+ // 11. Let r be the result of calling the ResolveLocale abstract operation
12335
+ // (defined in 9.2.5) with the [[availableLocales]] internal property of
12336
+ // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]
12337
+ // internal property of NumberFormat, and localeData.
12338
+ var r = ResolveLocale(internals.NumberFormat['[[availableLocales]]'], requestedLocales, opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData);
12339
+
12340
+ // 12. Set the [[locale]] internal property of numberFormat to the value of
12341
+ // r.[[locale]].
12342
+ internal['[[locale]]'] = r['[[locale]]'];
12343
+
12344
+ // 13. Set the [[numberingSystem]] internal property of numberFormat to the value
12345
+ // of r.[[nu]].
12346
+ internal['[[numberingSystem]]'] = r['[[nu]]'];
12347
+
12348
+ // The specification doesn't tell us to do this, but it's helpful later on
12349
+ internal['[[dataLocale]]'] = r['[[dataLocale]]'];
12350
+
12351
+ // 14. Let dataLocale be the value of r.[[dataLocale]].
12352
+ var dataLocale = r['[[dataLocale]]'];
12353
+
12354
+ // 15. Let s be the result of calling the GetOption abstract operation with the
12355
+ // arguments options, "style", "string", a List containing the three String
12356
+ // values "decimal", "percent", and "currency", and "decimal".
12357
+ var s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');
12358
+
12359
+ // 16. Set the [[style]] internal property of numberFormat to s.
12360
+ internal['[[style]]'] = s;
12361
+
12362
+ // 17. Let c be the result of calling the GetOption abstract operation with the
12363
+ // arguments options, "currency", "string", undefined, and undefined.
12364
+ var c = GetOption(options, 'currency', 'string');
12365
+
12366
+ // 18. If c is not undefined and the result of calling the
12367
+ // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with
12368
+ // argument c is false, then throw a RangeError exception.
12369
+ if (c !== undefined && !IsWellFormedCurrencyCode(c)) throw new RangeError("'" + c + "' is not a valid currency code");
12370
+
12371
+ // 19. If s is "currency" and c is undefined, throw a TypeError exception.
12372
+ if (s === 'currency' && c === undefined) throw new TypeError('Currency code is required when style is currency');
12373
+
12374
+ var cDigits = void 0;
12375
+
12376
+ // 20. If s is "currency", then
12377
+ if (s === 'currency') {
12378
+ // a. Let c be the result of converting c to upper case as specified in 6.1.
12379
+ c = c.toUpperCase();
12380
+
12381
+ // b. Set the [[currency]] internal property of numberFormat to c.
12382
+ internal['[[currency]]'] = c;
12383
+
12384
+ // c. Let cDigits be the result of calling the CurrencyDigits abstract
12385
+ // operation (defined below) with argument c.
12386
+ cDigits = CurrencyDigits(c);
12387
+ }
12388
+
12389
+ // 21. Let cd be the result of calling the GetOption abstract operation with the
12390
+ // arguments options, "currencyDisplay", "string", a List containing the
12391
+ // three String values "code", "symbol", and "name", and "symbol".
12392
+ var cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');
12393
+
12394
+ // 22. If s is "currency", then set the [[currencyDisplay]] internal property of
12395
+ // numberFormat to cd.
12396
+ if (s === 'currency') internal['[[currencyDisplay]]'] = cd;
12397
+
12398
+ // 23. Let mnid be the result of calling the GetNumberOption abstract operation
12399
+ // (defined in 9.2.10) with arguments options, "minimumIntegerDigits", 1, 21,
12400
+ // and 1.
12401
+ var mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);
12402
+
12403
+ // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.
12404
+ internal['[[minimumIntegerDigits]]'] = mnid;
12405
+
12406
+ // 25. If s is "currency", then let mnfdDefault be cDigits; else let mnfdDefault
12407
+ // be 0.
12408
+ var mnfdDefault = s === 'currency' ? cDigits : 0;
12409
+
12410
+ // 26. Let mnfd be the result of calling the GetNumberOption abstract operation
12411
+ // with arguments options, "minimumFractionDigits", 0, 20, and mnfdDefault.
12412
+ var mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);
12413
+
12414
+ // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.
12415
+ internal['[[minimumFractionDigits]]'] = mnfd;
12416
+
12417
+ // 28. If s is "currency", then let mxfdDefault be max(mnfd, cDigits); else if s
12418
+ // is "percent", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault
12419
+ // be max(mnfd, 3).
12420
+ var mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits) : s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3);
12421
+
12422
+ // 29. Let mxfd be the result of calling the GetNumberOption abstract operation
12423
+ // with arguments options, "maximumFractionDigits", mnfd, 20, and mxfdDefault.
12424
+ var mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);
12425
+
12426
+ // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.
12427
+ internal['[[maximumFractionDigits]]'] = mxfd;
12428
+
12429
+ // 31. Let mnsd be the result of calling the [[Get]] internal method of options
12430
+ // with argument "minimumSignificantDigits".
12431
+ var mnsd = options.minimumSignificantDigits;
12432
+
12433
+ // 32. Let mxsd be the result of calling the [[Get]] internal method of options
12434
+ // with argument "maximumSignificantDigits".
12435
+ var mxsd = options.maximumSignificantDigits;
12436
+
12437
+ // 33. If mnsd is not undefined or mxsd is not undefined, then:
12438
+ if (mnsd !== undefined || mxsd !== undefined) {
12439
+ // a. Let mnsd be the result of calling the GetNumberOption abstract
12440
+ // operation with arguments options, "minimumSignificantDigits", 1, 21,
12441
+ // and 1.
12442
+ mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);
12443
+
12444
+ // b. Let mxsd be the result of calling the GetNumberOption abstract
12445
+ // operation with arguments options, "maximumSignificantDigits", mnsd,
12446
+ // 21, and 21.
12447
+ mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);
12448
+
12449
+ // c. Set the [[minimumSignificantDigits]] internal property of numberFormat
12450
+ // to mnsd, and the [[maximumSignificantDigits]] internal property of
12451
+ // numberFormat to mxsd.
12452
+ internal['[[minimumSignificantDigits]]'] = mnsd;
12453
+ internal['[[maximumSignificantDigits]]'] = mxsd;
12454
+ }
12455
+ // 34. Let g be the result of calling the GetOption abstract operation with the
12456
+ // arguments options, "useGrouping", "boolean", undefined, and true.
12457
+ var g = GetOption(options, 'useGrouping', 'boolean', undefined, true);
12458
+
12459
+ // 35. Set the [[useGrouping]] internal property of numberFormat to g.
12460
+ internal['[[useGrouping]]'] = g;
12461
+
12462
+ // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of
12463
+ // localeData with argument dataLocale.
12464
+ var dataLocaleData = localeData[dataLocale];
12465
+
12466
+ // 37. Let patterns be the result of calling the [[Get]] internal method of
12467
+ // dataLocaleData with argument "patterns".
12468
+ var patterns = dataLocaleData.patterns;
12469
+
12470
+ // 38. Assert: patterns is an object (see 11.2.3)
12471
+
12472
+ // 39. Let stylePatterns be the result of calling the [[Get]] internal method of
12473
+ // patterns with argument s.
12474
+ var stylePatterns = patterns[s];
12475
+
12476
+ // 40. Set the [[positivePattern]] internal property of numberFormat to the
12477
+ // result of calling the [[Get]] internal method of stylePatterns with the
12478
+ // argument "positivePattern".
12479
+ internal['[[positivePattern]]'] = stylePatterns.positivePattern;
12480
+
12481
+ // 41. Set the [[negativePattern]] internal property of numberFormat to the
12482
+ // result of calling the [[Get]] internal method of stylePatterns with the
12483
+ // argument "negativePattern".
12484
+ internal['[[negativePattern]]'] = stylePatterns.negativePattern;
12485
+
12486
+ // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.
12487
+ internal['[[boundFormat]]'] = undefined;
12488
+
12489
+ // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to
12490
+ // true.
12491
+ internal['[[initializedNumberFormat]]'] = true;
12492
+
12493
+ // In ES3, we need to pre-bind the format() function
12494
+ if (es3) numberFormat.format = GetFormatNumber.call(numberFormat);
12495
+
12496
+ // Restore the RegExp properties
12497
+ regexpState.exp.test(regexpState.input);
12498
+
12499
+ // Return the newly initialised object
12500
+ return numberFormat;
12501
+ }
12502
+
12503
+ function CurrencyDigits(currency) {
12504
+ // When the CurrencyDigits abstract operation is called with an argument currency
12505
+ // (which must be an upper case String value), the following steps are taken:
12506
+
12507
+ // 1. If the ISO 4217 currency and funds code list contains currency as an
12508
+ // alphabetic code, then return the minor unit value corresponding to the
12509
+ // currency from the list; else return 2.
12510
+ return currencyMinorUnits[currency] !== undefined ? currencyMinorUnits[currency] : 2;
12511
+ }
12512
+
12513
+ /* 11.2.3 */internals.NumberFormat = {
12514
+ '[[availableLocales]]': [],
12515
+ '[[relevantExtensionKeys]]': ['nu'],
12516
+ '[[localeData]]': {}
12517
+ };
12518
+
12519
+ /**
12520
+ * When the supportedLocalesOf method of Intl.NumberFormat is called, the
12521
+ * following steps are taken:
12522
+ */
12523
+ /* 11.2.2 */
12524
+ defineProperty(Intl.NumberFormat, 'supportedLocalesOf', {
12525
+ configurable: true,
12526
+ writable: true,
12527
+ value: fnBind.call(function (locales) {
12528
+ // Bound functions only have the `this` value altered if being used as a constructor,
12529
+ // this lets us imitate a native function that has no constructor
12530
+ if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');
12531
+
12532
+ // Create an object whose props can be used to restore the values of RegExp props
12533
+ var regexpState = createRegExpRestore(),
12534
+
12535
+
12536
+ // 1. If options is not provided, then let options be undefined.
12537
+ options = arguments[1],
12538
+
12539
+
12540
+ // 2. Let availableLocales be the value of the [[availableLocales]] internal
12541
+ // property of the standard built-in object that is the initial value of
12542
+ // Intl.NumberFormat.
12543
+
12544
+ availableLocales = this['[[availableLocales]]'],
12545
+
12546
+
12547
+ // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
12548
+ // abstract operation (defined in 9.2.1) with argument locales.
12549
+ requestedLocales = CanonicalizeLocaleList(locales);
12550
+
12551
+ // Restore the RegExp properties
12552
+ regexpState.exp.test(regexpState.input);
12553
+
12554
+ // 4. Return the result of calling the SupportedLocales abstract operation
12555
+ // (defined in 9.2.8) with arguments availableLocales, requestedLocales,
12556
+ // and options.
12557
+ return SupportedLocales(availableLocales, requestedLocales, options);
12558
+ }, internals.NumberFormat)
12559
+ });
12560
+
12561
+ /**
12562
+ * This named accessor property returns a function that formats a number
12563
+ * according to the effective locale and the formatting options of this
12564
+ * NumberFormat object.
12565
+ */
12566
+ /* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {
12567
+ configurable: true,
12568
+ get: GetFormatNumber
12569
+ });
12570
+
12571
+ function GetFormatNumber() {
12572
+ var internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
12573
+
12574
+ // Satisfy test 11.3_b
12575
+ if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');
12576
+
12577
+ // The value of the [[Get]] attribute is a function that takes the following
12578
+ // steps:
12579
+
12580
+ // 1. If the [[boundFormat]] internal property of this NumberFormat object
12581
+ // is undefined, then:
12582
+ if (internal['[[boundFormat]]'] === undefined) {
12583
+ // a. Let F be a Function object, with internal properties set as
12584
+ // specified for built-in functions in ES5, 15, or successor, and the
12585
+ // length property set to 1, that takes the argument value and
12586
+ // performs the following steps:
12587
+ var F = function F(value) {
12588
+ // i. If value is not provided, then let value be undefined.
12589
+ // ii. Let x be ToNumber(value).
12590
+ // iii. Return the result of calling the FormatNumber abstract
12591
+ // operation (defined below) with arguments this and x.
12592
+ return FormatNumber(this, /* x = */Number(value));
12593
+ };
12594
+
12595
+ // b. Let bind be the standard built-in function object defined in ES5,
12596
+ // 15.3.4.5.
12597
+ // c. Let bf be the result of calling the [[Call]] internal method of
12598
+ // bind with F as the this value and an argument list containing
12599
+ // the single item this.
12600
+ var bf = fnBind.call(F, this);
12601
+
12602
+ // d. Set the [[boundFormat]] internal property of this NumberFormat
12603
+ // object to bf.
12604
+ internal['[[boundFormat]]'] = bf;
12605
+ }
12606
+ // Return the value of the [[boundFormat]] internal property of this
12607
+ // NumberFormat object.
12608
+ return internal['[[boundFormat]]'];
12609
+ }
12610
+
12611
+ Intl.NumberFormat.prototype.formatToParts = function (value) {
12612
+ var internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
12613
+ if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');
12614
+
12615
+ var x = Number(value);
12616
+ return FormatNumberToParts(this, x);
12617
+ };
12618
+
12619
+ /*
12620
+ * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]
12621
+ * @clause[sec-formatnumbertoparts]
12622
+ */
12623
+ function FormatNumberToParts(numberFormat, x) {
12624
+ // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).
12625
+ var parts = PartitionNumberPattern(numberFormat, x);
12626
+ // 2. Let result be ArrayCreate(0).
12627
+ var result = [];
12628
+ // 3. Let n be 0.
12629
+ var n = 0;
12630
+ // 4. For each part in parts, do:
12631
+ for (var i = 0; parts.length > i; i++) {
12632
+ var part = parts[i];
12633
+ // a. Let O be ObjectCreate(%ObjectPrototype%).
12634
+ var O = {};
12635
+ // a. Perform ? CreateDataPropertyOrThrow(O, "type", part.[[type]]).
12636
+ O.type = part['[[type]]'];
12637
+ // a. Perform ? CreateDataPropertyOrThrow(O, "value", part.[[value]]).
12638
+ O.value = part['[[value]]'];
12639
+ // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).
12640
+ result[n] = O;
12641
+ // a. Increment n by 1.
12642
+ n += 1;
12643
+ }
12644
+ // 5. Return result.
12645
+ return result;
12646
+ }
12647
+
12648
+ /*
12649
+ * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]
12650
+ * @clause[sec-partitionnumberpattern]
12651
+ */
12652
+ function PartitionNumberPattern(numberFormat, x) {
12653
+
12654
+ var internal = getInternalProperties(numberFormat),
12655
+ locale = internal['[[dataLocale]]'],
12656
+ nums = internal['[[numberingSystem]]'],
12657
+ data = internals.NumberFormat['[[localeData]]'][locale],
12658
+ ild = data.symbols[nums] || data.symbols.latn,
12659
+ pattern = void 0;
12660
+
12661
+ // 1. If x is not NaN and x < 0, then:
12662
+ if (!isNaN(x) && x < 0) {
12663
+ // a. Let x be -x.
12664
+ x = -x;
12665
+ // a. Let pattern be the value of numberFormat.[[negativePattern]].
12666
+ pattern = internal['[[negativePattern]]'];
12667
+ }
12668
+ // 2. Else,
12669
+ else {
12670
+ // a. Let pattern be the value of numberFormat.[[positivePattern]].
12671
+ pattern = internal['[[positivePattern]]'];
12672
+ }
12673
+ // 3. Let result be a new empty List.
12674
+ var result = new List();
12675
+ // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, "{", 0).
12676
+ var beginIndex = pattern.indexOf('{', 0);
12677
+ // 5. Let endIndex be 0.
12678
+ var endIndex = 0;
12679
+ // 6. Let nextIndex be 0.
12680
+ var nextIndex = 0;
12681
+ // 7. Let length be the number of code units in pattern.
12682
+ var length = pattern.length;
12683
+ // 8. Repeat while beginIndex is an integer index into pattern:
12684
+ while (beginIndex > -1 && beginIndex < length) {
12685
+ // a. Set endIndex to Call(%StringProto_indexOf%, pattern, "}", beginIndex)
12686
+ endIndex = pattern.indexOf('}', beginIndex);
12687
+ // a. If endIndex = -1, throw new Error exception.
12688
+ if (endIndex === -1) throw new Error();
12689
+ // a. If beginIndex is greater than nextIndex, then:
12690
+ if (beginIndex > nextIndex) {
12691
+ // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.
12692
+ var literal = pattern.substring(nextIndex, beginIndex);
12693
+ // ii. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result.
12694
+ arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });
12695
+ }
12696
+ // a. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.
12697
+ var p = pattern.substring(beginIndex + 1, endIndex);
12698
+ // a. If p is equal "number", then:
12699
+ if (p === "number") {
12700
+ // i. If x is NaN,
12701
+ if (isNaN(x)) {
12702
+ // 1. Let n be an ILD String value indicating the NaN value.
12703
+ var n = ild.nan;
12704
+ // 2. Add new part record { [[type]]: "nan", [[value]]: n } as a new element of the list result.
12705
+ arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });
12706
+ }
12707
+ // ii. Else if isFinite(x) is false,
12708
+ else if (!isFinite(x)) {
12709
+ // 1. Let n be an ILD String value indicating infinity.
12710
+ var _n = ild.infinity;
12711
+ // 2. Add new part record { [[type]]: "infinity", [[value]]: n } as a new element of the list result.
12712
+ arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': _n });
12713
+ }
12714
+ // iii. Else,
12715
+ else {
12716
+ // 1. If the value of numberFormat.[[style]] is "percent" and isFinite(x), let x be 100 × x.
12717
+ if (internal['[[style]]'] === 'percent' && isFinite(x)) x *= 100;
12718
+
12719
+ var _n2 = void 0;
12720
+ // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then
12721
+ if (hop.call(internal, '[[minimumSignificantDigits]]') && hop.call(internal, '[[maximumSignificantDigits]]')) {
12722
+ // a. Let n be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).
12723
+ _n2 = ToRawPrecision(x, internal['[[minimumSignificantDigits]]'], internal['[[maximumSignificantDigits]]']);
12724
+ }
12725
+ // 3. Else,
12726
+ else {
12727
+ // a. Let n be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).
12728
+ _n2 = ToRawFixed(x, internal['[[minimumIntegerDigits]]'], internal['[[minimumFractionDigits]]'], internal['[[maximumFractionDigits]]']);
12729
+ }
12730
+ // 4. If the value of the numberFormat.[[numberingSystem]] matches one of the values in the "Numbering System" column of Table 2 below, then
12731
+ if (numSys[nums]) {
12732
+ (function () {
12733
+ // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the "Digits" column of the matching row in Table 2.
12734
+ var digits = numSys[nums];
12735
+ // a. Replace each digit in n with the value of digits[digit].
12736
+ _n2 = String(_n2).replace(/\d/g, function (digit) {
12737
+ return digits[digit];
12738
+ });
12739
+ })();
12740
+ }
12741
+ // 5. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.
12742
+ else _n2 = String(_n2); // ###TODO###
12743
+
12744
+ var integer = void 0;
12745
+ var fraction = void 0;
12746
+ // 6. Let decimalSepIndex be Call(%StringProto_indexOf%, n, ".", 0).
12747
+ var decimalSepIndex = _n2.indexOf('.', 0);
12748
+ // 7. If decimalSepIndex > 0, then:
12749
+ if (decimalSepIndex > 0) {
12750
+ // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.
12751
+ integer = _n2.substring(0, decimalSepIndex);
12752
+ // a. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.
12753
+ fraction = _n2.substring(decimalSepIndex + 1, decimalSepIndex.length);
12754
+ }
12755
+ // 8. Else:
12756
+ else {
12757
+ // a. Let integer be n.
12758
+ integer = _n2;
12759
+ // a. Let fraction be undefined.
12760
+ fraction = undefined;
12761
+ }
12762
+ // 9. If the value of the numberFormat.[[useGrouping]] is true,
12763
+ if (internal['[[useGrouping]]'] === true) {
12764
+ // a. Let groupSepSymbol be the ILND String representing the grouping separator.
12765
+ var groupSepSymbol = ild.group;
12766
+ // a. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.
12767
+ var groups = [];
12768
+ // ----> implementation:
12769
+ // Primary group represents the group closest to the decimal
12770
+ var pgSize = data.patterns.primaryGroupSize || 3;
12771
+ // Secondary group is every other group
12772
+ var sgSize = data.patterns.secondaryGroupSize || pgSize;
12773
+ // Group only if necessary
12774
+ if (integer.length > pgSize) {
12775
+ // Index of the primary grouping separator
12776
+ var end = integer.length - pgSize;
12777
+ // Starting index for our loop
12778
+ var idx = end % sgSize;
12779
+ var start = integer.slice(0, idx);
12780
+ if (start.length) arrPush.call(groups, start);
12781
+ // Loop to separate into secondary grouping digits
12782
+ while (idx < end) {
12783
+ arrPush.call(groups, integer.slice(idx, idx + sgSize));
12784
+ idx += sgSize;
12785
+ }
12786
+ // Add the primary grouping digits
12787
+ arrPush.call(groups, integer.slice(end));
12788
+ } else {
12789
+ arrPush.call(groups, integer);
12790
+ }
12791
+ // a. Assert: The number of elements in groups List is greater than 0.
12792
+ if (groups.length === 0) throw new Error();
12793
+ // a. Repeat, while groups List is not empty:
12794
+ while (groups.length) {
12795
+ // i. Remove the first element from groups and let integerGroup be the value of that element.
12796
+ var integerGroup = arrShift.call(groups);
12797
+ // ii. Add new part record { [[type]]: "integer", [[value]]: integerGroup } as a new element of the list result.
12798
+ arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });
12799
+ // iii. If groups List is not empty, then:
12800
+ if (groups.length) {
12801
+ // 1. Add new part record { [[type]]: "group", [[value]]: groupSepSymbol } as a new element of the list result.
12802
+ arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });
12803
+ }
12804
+ }
12805
+ }
12806
+ // 10. Else,
12807
+ else {
12808
+ // a. Add new part record { [[type]]: "integer", [[value]]: integer } as a new element of the list result.
12809
+ arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });
12810
+ }
12811
+ // 11. If fraction is not undefined, then:
12812
+ if (fraction !== undefined) {
12813
+ // a. Let decimalSepSymbol be the ILND String representing the decimal separator.
12814
+ var decimalSepSymbol = ild.decimal;
12815
+ // a. Add new part record { [[type]]: "decimal", [[value]]: decimalSepSymbol } as a new element of the list result.
12816
+ arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });
12817
+ // a. Add new part record { [[type]]: "fraction", [[value]]: fraction } as a new element of the list result.
12818
+ arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });
12819
+ }
12820
+ }
12821
+ }
12822
+ // a. Else if p is equal "plusSign", then:
12823
+ else if (p === "plusSign") {
12824
+ // i. Let plusSignSymbol be the ILND String representing the plus sign.
12825
+ var plusSignSymbol = ild.plusSign;
12826
+ // ii. Add new part record { [[type]]: "plusSign", [[value]]: plusSignSymbol } as a new element of the list result.
12827
+ arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });
12828
+ }
12829
+ // a. Else if p is equal "minusSign", then:
12830
+ else if (p === "minusSign") {
12831
+ // i. Let minusSignSymbol be the ILND String representing the minus sign.
12832
+ var minusSignSymbol = ild.minusSign;
12833
+ // ii. Add new part record { [[type]]: "minusSign", [[value]]: minusSignSymbol } as a new element of the list result.
12834
+ arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });
12835
+ }
12836
+ // a. Else if p is equal "percentSign" and numberFormat.[[style]] is "percent", then:
12837
+ else if (p === "percentSign" && internal['[[style]]'] === "percent") {
12838
+ // i. Let percentSignSymbol be the ILND String representing the percent sign.
12839
+ var percentSignSymbol = ild.percentSign;
12840
+ // ii. Add new part record { [[type]]: "percentSign", [[value]]: percentSignSymbol } as a new element of the list result.
12841
+ arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });
12842
+ }
12843
+ // a. Else if p is equal "currency" and numberFormat.[[style]] is "currency", then:
12844
+ else if (p === "currency" && internal['[[style]]'] === "currency") {
12845
+ // i. Let currency be the value of numberFormat.[[currency]].
12846
+ var currency = internal['[[currency]]'];
12847
+
12848
+ var cd = void 0;
12849
+
12850
+ // ii. If numberFormat.[[currencyDisplay]] is "code", then
12851
+ if (internal['[[currencyDisplay]]'] === "code") {
12852
+ // 1. Let cd be currency.
12853
+ cd = currency;
12854
+ }
12855
+ // iii. Else if numberFormat.[[currencyDisplay]] is "symbol", then
12856
+ else if (internal['[[currencyDisplay]]'] === "symbol") {
12857
+ // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.
12858
+ cd = data.currencies[currency] || currency;
12859
+ }
12860
+ // iv. Else if numberFormat.[[currencyDisplay]] is "name", then
12861
+ else if (internal['[[currencyDisplay]]'] === "name") {
12862
+ // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.
12863
+ cd = currency;
12864
+ }
12865
+ // v. Add new part record { [[type]]: "currency", [[value]]: cd } as a new element of the list result.
12866
+ arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });
12867
+ }
12868
+ // a. Else,
12869
+ else {
12870
+ // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.
12871
+ var _literal = pattern.substring(beginIndex, endIndex);
12872
+ // ii. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result.
12873
+ arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal });
12874
+ }
12875
+ // a. Set nextIndex to endIndex + 1.
12876
+ nextIndex = endIndex + 1;
12877
+ // a. Set beginIndex to Call(%StringProto_indexOf%, pattern, "{", nextIndex)
12878
+ beginIndex = pattern.indexOf('{', nextIndex);
12879
+ }
12880
+ // 9. If nextIndex is less than length, then:
12881
+ if (nextIndex < length) {
12882
+ // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.
12883
+ var _literal2 = pattern.substring(nextIndex, length);
12884
+ // a. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result.
12885
+ arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal2 });
12886
+ }
12887
+ // 10. Return result.
12888
+ return result;
12889
+ }
12890
+
12891
+ /*
12892
+ * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]
12893
+ * @clause[sec-formatnumber]
12894
+ */
12895
+ function FormatNumber(numberFormat, x) {
12896
+ // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).
12897
+ var parts = PartitionNumberPattern(numberFormat, x);
12898
+ // 2. Let result be an empty String.
12899
+ var result = '';
12900
+ // 3. For each part in parts, do:
12901
+ for (var i = 0; parts.length > i; i++) {
12902
+ var part = parts[i];
12903
+ // a. Set result to a String value produced by concatenating result and part.[[value]].
12904
+ result += part['[[value]]'];
12905
+ }
12906
+ // 4. Return result.
12907
+ return result;
12908
+ }
12909
+
12910
+ /**
12911
+ * When the ToRawPrecision abstract operation is called with arguments x (which
12912
+ * must be a finite non-negative number), minPrecision, and maxPrecision (both
12913
+ * must be integers between 1 and 21) the following steps are taken:
12914
+ */
12915
+ function ToRawPrecision(x, minPrecision, maxPrecision) {
12916
+ // 1. Let p be maxPrecision.
12917
+ var p = maxPrecision;
12918
+
12919
+ var m = void 0,
12920
+ e = void 0;
12921
+
12922
+ // 2. If x = 0, then
12923
+ if (x === 0) {
12924
+ // a. Let m be the String consisting of p occurrences of the character "0".
12925
+ m = arrJoin.call(Array(p + 1), '0');
12926
+ // b. Let e be 0.
12927
+ e = 0;
12928
+ }
12929
+ // 3. Else
12930
+ else {
12931
+ // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the
12932
+ // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as
12933
+ // possible. If there are two such sets of e and n, pick the e and n for
12934
+ // which n × 10ᵉ⁻ᵖ⁺¹ is larger.
12935
+ e = log10Floor(Math.abs(x));
12936
+
12937
+ // Easier to get to m from here
12938
+ var f = Math.round(Math.exp(Math.abs(e - p + 1) * Math.LN10));
12939
+
12940
+ // b. Let m be the String consisting of the digits of the decimal
12941
+ // representation of n (in order, with no leading zeroes)
12942
+ m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));
12943
+ }
12944
+
12945
+ // 4. If e ≥ p, then
12946
+ if (e >= p)
12947
+ // a. Return the concatenation of m and e-p+1 occurrences of the character "0".
12948
+ return m + arrJoin.call(Array(e - p + 1 + 1), '0');
12949
+
12950
+ // 5. If e = p-1, then
12951
+ else if (e === p - 1)
12952
+ // a. Return m.
12953
+ return m;
12954
+
12955
+ // 6. If e ≥ 0, then
12956
+ else if (e >= 0)
12957
+ // a. Let m be the concatenation of the first e+1 characters of m, the character
12958
+ // ".", and the remaining p–(e+1) characters of m.
12959
+ m = m.slice(0, e + 1) + '.' + m.slice(e + 1);
12960
+
12961
+ // 7. If e < 0, then
12962
+ else if (e < 0)
12963
+ // a. Let m be the concatenation of the String "0.", –(e+1) occurrences of the
12964
+ // character "0", and the string m.
12965
+ m = '0.' + arrJoin.call(Array(-(e + 1) + 1), '0') + m;
12966
+
12967
+ // 8. If m contains the character ".", and maxPrecision > minPrecision, then
12968
+ if (m.indexOf(".") >= 0 && maxPrecision > minPrecision) {
12969
+ // a. Let cut be maxPrecision – minPrecision.
12970
+ var cut = maxPrecision - minPrecision;
12971
+
12972
+ // b. Repeat while cut > 0 and the last character of m is "0":
12973
+ while (cut > 0 && m.charAt(m.length - 1) === '0') {
12974
+ // i. Remove the last character from m.
12975
+ m = m.slice(0, -1);
12976
+
12977
+ // ii. Decrease cut by 1.
12978
+ cut--;
12979
+ }
12980
+
12981
+ // c. If the last character of m is ".", then
12982
+ if (m.charAt(m.length - 1) === '.')
12983
+ // i. Remove the last character from m.
12984
+ m = m.slice(0, -1);
12985
+ }
12986
+ // 9. Return m.
12987
+ return m;
12988
+ }
12989
+
12990
+ /**
12991
+ * @spec[tc39/ecma402/master/spec/numberformat.html]
12992
+ * @clause[sec-torawfixed]
12993
+ * When the ToRawFixed abstract operation is called with arguments x (which must
12994
+ * be a finite non-negative number), minInteger (which must be an integer between
12995
+ * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and
12996
+ * 20) the following steps are taken:
12997
+ */
12998
+ function ToRawFixed(x, minInteger, minFraction, maxFraction) {
12999
+ // 1. Let f be maxFraction.
13000
+ var f = maxFraction;
13001
+ // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.
13002
+ var n = Math.pow(10, f) * x; // diverging...
13003
+ // 3. If n = 0, let m be the String "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
13004
+ var m = n === 0 ? "0" : n.toFixed(0); // divering...
13005
+
13006
+ {
13007
+ // this diversion is needed to take into consideration big numbers, e.g.:
13008
+ // 1.2344501e+37 -> 12344501000000000000000000000000000000
13009
+ var idx = void 0;
13010
+ var exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;
13011
+ if (exp) {
13012
+ m = m.slice(0, idx).replace('.', '');
13013
+ m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');
13014
+ }
13015
+ }
13016
+
13017
+ var int = void 0;
13018
+ // 4. If f ≠ 0, then
13019
+ if (f !== 0) {
13020
+ // a. Let k be the number of characters in m.
13021
+ var k = m.length;
13022
+ // a. If k ≤ f, then
13023
+ if (k <= f) {
13024
+ // i. Let z be the String consisting of f+1–k occurrences of the character "0".
13025
+ var z = arrJoin.call(Array(f + 1 - k + 1), '0');
13026
+ // ii. Let m be the concatenation of Strings z and m.
13027
+ m = z + m;
13028
+ // iii. Let k be f+1.
13029
+ k = f + 1;
13030
+ }
13031
+ // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.
13032
+ var a = m.substring(0, k - f),
13033
+ b = m.substring(k - f, m.length);
13034
+ // a. Let m be the concatenation of the three Strings a, ".", and b.
13035
+ m = a + "." + b;
13036
+ // a. Let int be the number of characters in a.
13037
+ int = a.length;
13038
+ }
13039
+ // 5. Else, let int be the number of characters in m.
13040
+ else int = m.length;
13041
+ // 6. Let cut be maxFraction – minFraction.
13042
+ var cut = maxFraction - minFraction;
13043
+ // 7. Repeat while cut > 0 and the last character of m is "0":
13044
+ while (cut > 0 && m.slice(-1) === "0") {
13045
+ // a. Remove the last character from m.
13046
+ m = m.slice(0, -1);
13047
+ // a. Decrease cut by 1.
13048
+ cut--;
13049
+ }
13050
+ // 8. If the last character of m is ".", then
13051
+ if (m.slice(-1) === ".") {
13052
+ // a. Remove the last character from m.
13053
+ m = m.slice(0, -1);
13054
+ }
13055
+ // 9. If int < minInteger, then
13056
+ if (int < minInteger) {
13057
+ // a. Let z be the String consisting of minInteger–int occurrences of the character "0".
13058
+ var _z = arrJoin.call(Array(minInteger - int + 1), '0');
13059
+ // a. Let m be the concatenation of Strings z and m.
13060
+ m = _z + m;
13061
+ }
13062
+ // 10. Return m.
13063
+ return m;
13064
+ }
13065
+
13066
+ // Sect 11.3.2 Table 2, Numbering systems
13067
+ // ======================================
13068
+ var numSys = {
13069
+ arab: ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"],
13070
+ arabext: ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"],
13071
+ bali: ["᭐", "᭑", "᭒", "᭓", "᭔", "᭕", "᭖", "᭗", "᭘", "᭙"],
13072
+ beng: ["০", "১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯"],
13073
+ deva: ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"],
13074
+ fullwide: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
13075
+ gujr: ["૦", "૧", "૨", "૩", "૪", "૫", "૬", "૭", "૮", "૯"],
13076
+ guru: ["੦", "੧", "੨", "੩", "੪", "੫", "੬", "੭", "੮", "੯"],
13077
+ hanidec: ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
13078
+ khmr: ["០", "១", "២", "៣", "៤", "៥", "៦", "៧", "៨", "៩"],
13079
+ knda: ["೦", "೧", "೨", "೩", "೪", "೫", "೬", "೭", "೮", "೯"],
13080
+ laoo: ["໐", "໑", "໒", "໓", "໔", "໕", "໖", "໗", "໘", "໙"],
13081
+ latn: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
13082
+ limb: ["᥆", "᥇", "᥈", "᥉", "᥊", "᥋", "᥌", "᥍", "᥎", "᥏"],
13083
+ mlym: ["൦", "൧", "൨", "൩", "൪", "൫", "൬", "൭", "൮", "൯"],
13084
+ mong: ["᠐", "᠑", "᠒", "᠓", "᠔", "᠕", "᠖", "᠗", "᠘", "᠙"],
13085
+ mymr: ["၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"],
13086
+ orya: ["୦", "୧", "୨", "୩", "୪", "୫", "୬", "୭", "୮", "୯"],
13087
+ tamldec: ["௦", "௧", "௨", "௩", "௪", "௫", "௬", "௭", "௮", "௯"],
13088
+ telu: ["౦", "౧", "౨", "౩", "౪", "౫", "౬", "౭", "౮", "౯"],
13089
+ thai: ["๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙"],
13090
+ tibt: ["༠", "༡", "༢", "༣", "༤", "༥", "༦", "༧", "༨", "༩"]
13091
+ };
13092
+
13093
+ /**
13094
+ * This function provides access to the locale and formatting options computed
13095
+ * during initialization of the object.
13096
+ *
13097
+ * The function returns a new object whose properties and attributes are set as
13098
+ * if constructed by an object literal assigning to each of the following
13099
+ * properties the value of the corresponding internal property of this
13100
+ * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,
13101
+ * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,
13102
+ * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and
13103
+ * useGrouping. Properties whose corresponding internal properties are not present
13104
+ * are not assigned.
13105
+ */
13106
+ /* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {
13107
+ configurable: true,
13108
+ writable: true,
13109
+ value: function value() {
13110
+ var prop = void 0,
13111
+ descs = new Record(),
13112
+ props = ['locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'],
13113
+ internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
13114
+
13115
+ // Satisfy test 11.3_b
13116
+ if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');
13117
+
13118
+ for (var i = 0, max = props.length; i < max; i++) {
13119
+ if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };
13120
+ }
13121
+
13122
+ return objCreate({}, descs);
13123
+ }
13124
+ });
13125
+
13126
+ /* jslint esnext: true */
13127
+
13128
+ // Match these datetime components in a CLDR pattern, except those in single quotes
13129
+ var expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
13130
+ // trim patterns after transformations
13131
+ var expPatternTrimmer = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
13132
+ // Skip over patterns with these datetime components because we don't have data
13133
+ // to back them up:
13134
+ // timezone, weekday, amoung others
13135
+ var unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string
13136
+
13137
+ var dtKeys = ["weekday", "era", "year", "month", "day", "weekday", "quarter"];
13138
+ var tmKeys = ["hour", "minute", "second", "hour12", "timeZoneName"];
13139
+
13140
+ function isDateFormatOnly(obj) {
13141
+ for (var i = 0; i < tmKeys.length; i += 1) {
13142
+ if (obj.hasOwnProperty(tmKeys[i])) {
13143
+ return false;
13144
+ }
13145
+ }
13146
+ return true;
13147
+ }
13148
+
13149
+ function isTimeFormatOnly(obj) {
13150
+ for (var i = 0; i < dtKeys.length; i += 1) {
13151
+ if (obj.hasOwnProperty(dtKeys[i])) {
13152
+ return false;
13153
+ }
13154
+ }
13155
+ return true;
13156
+ }
13157
+
13158
+ function joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {
13159
+ var o = { _: {} };
13160
+ for (var i = 0; i < dtKeys.length; i += 1) {
13161
+ if (dateFormatObj[dtKeys[i]]) {
13162
+ o[dtKeys[i]] = dateFormatObj[dtKeys[i]];
13163
+ }
13164
+ if (dateFormatObj._[dtKeys[i]]) {
13165
+ o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];
13166
+ }
13167
+ }
13168
+ for (var j = 0; j < tmKeys.length; j += 1) {
13169
+ if (timeFormatObj[tmKeys[j]]) {
13170
+ o[tmKeys[j]] = timeFormatObj[tmKeys[j]];
13171
+ }
13172
+ if (timeFormatObj._[tmKeys[j]]) {
13173
+ o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];
13174
+ }
13175
+ }
13176
+ return o;
13177
+ }
13178
+
13179
+ function computeFinalPatterns(formatObj) {
13180
+ // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:
13181
+ // 'In patterns, two single quotes represents a literal single quote, either
13182
+ // inside or outside single quotes. Text within single quotes is not
13183
+ // interpreted in any way (except for two adjacent single quotes).'
13184
+ formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, function ($0, literal) {
13185
+ return literal ? literal : "'";
13186
+ });
13187
+
13188
+ // pattern 12 is always the default. we can produce the 24 by removing {ampm}
13189
+ formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');
13190
+ return formatObj;
13191
+ }
13192
+
13193
+ function expDTComponentsMeta($0, formatObj) {
13194
+ switch ($0.charAt(0)) {
13195
+ // --- Era
13196
+ case 'G':
13197
+ formatObj.era = ['short', 'short', 'short', 'long', 'narrow'][$0.length - 1];
13198
+ return '{era}';
13199
+
13200
+ // --- Year
13201
+ case 'y':
13202
+ case 'Y':
13203
+ case 'u':
13204
+ case 'U':
13205
+ case 'r':
13206
+ formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';
13207
+ return '{year}';
13208
+
13209
+ // --- Quarter (not supported in this polyfill)
13210
+ case 'Q':
13211
+ case 'q':
13212
+ formatObj.quarter = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];
13213
+ return '{quarter}';
13214
+
13215
+ // --- Month
13216
+ case 'M':
13217
+ case 'L':
13218
+ formatObj.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];
13219
+ return '{month}';
13220
+
13221
+ // --- Week (not supported in this polyfill)
13222
+ case 'w':
13223
+ // week of the year
13224
+ formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';
13225
+ return '{weekday}';
13226
+ case 'W':
13227
+ // week of the month
13228
+ formatObj.week = 'numeric';
13229
+ return '{weekday}';
13230
+
13231
+ // --- Day
13232
+ case 'd':
13233
+ // day of the month
13234
+ formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';
13235
+ return '{day}';
13236
+ case 'D': // day of the year
13237
+ case 'F': // day of the week
13238
+ case 'g':
13239
+ // 1..n: Modified Julian day
13240
+ formatObj.day = 'numeric';
13241
+ return '{day}';
13242
+
13243
+ // --- Week Day
13244
+ case 'E':
13245
+ // day of the week
13246
+ formatObj.weekday = ['short', 'short', 'short', 'long', 'narrow', 'short'][$0.length - 1];
13247
+ return '{weekday}';
13248
+ case 'e':
13249
+ // local day of the week
13250
+ formatObj.weekday = ['numeric', '2-digit', 'short', 'long', 'narrow', 'short'][$0.length - 1];
13251
+ return '{weekday}';
13252
+ case 'c':
13253
+ // stand alone local day of the week
13254
+ formatObj.weekday = ['numeric', undefined, 'short', 'long', 'narrow', 'short'][$0.length - 1];
13255
+ return '{weekday}';
13256
+
13257
+ // --- Period
13258
+ case 'a': // AM, PM
13259
+ case 'b': // am, pm, noon, midnight
13260
+ case 'B':
13261
+ // flexible day periods
13262
+ formatObj.hour12 = true;
13263
+ return '{ampm}';
13264
+
13265
+ // --- Hour
13266
+ case 'h':
13267
+ case 'H':
13268
+ formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';
13269
+ return '{hour}';
13270
+ case 'k':
13271
+ case 'K':
13272
+ formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)
13273
+ formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';
13274
+ return '{hour}';
13275
+
13276
+ // --- Minute
13277
+ case 'm':
13278
+ formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';
13279
+ return '{minute}';
13280
+
13281
+ // --- Second
13282
+ case 's':
13283
+ formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';
13284
+ return '{second}';
13285
+ case 'S':
13286
+ case 'A':
13287
+ formatObj.second = 'numeric';
13288
+ return '{second}';
13289
+
13290
+ // --- Timezone
13291
+ case 'z': // 1..3, 4: specific non-location format
13292
+ case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
13293
+ case 'O': // 1, 4: miliseconds in day short, long
13294
+ case 'v': // 1, 4: generic non-location format
13295
+ case 'V': // 1, 2, 3, 4: time zone ID or city
13296
+ case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
13297
+ case 'x':
13298
+ // 1, 2, 3, 4: The ISO8601 varios formats
13299
+ // this polyfill only supports much, for now, we are just doing something dummy
13300
+ formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';
13301
+ return '{timeZoneName}';
13302
+ }
13303
+ }
13304
+
13305
+ /**
13306
+ * Converts the CLDR availableFormats into the objects and patterns required by
13307
+ * the ECMAScript Internationalization API specification.
13308
+ */
13309
+ function createDateTimeFormat(skeleton, pattern) {
13310
+ // we ignore certain patterns that are unsupported to avoid this expensive op.
13311
+ if (unwantedDTCs.test(pattern)) return undefined;
13312
+
13313
+ var formatObj = {
13314
+ originalPattern: pattern,
13315
+ _: {}
13316
+ };
13317
+
13318
+ // Replace the pattern string with the one required by the specification, whilst
13319
+ // at the same time evaluating it for the subsets and formats
13320
+ formatObj.extendedPattern = pattern.replace(expDTComponents, function ($0) {
13321
+ // See which symbol we're dealing with
13322
+ return expDTComponentsMeta($0, formatObj._);
13323
+ });
13324
+
13325
+ // Match the skeleton string with the one required by the specification
13326
+ // this implementation is based on the Date Field Symbol Table:
13327
+ // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
13328
+ // Note: we are adding extra data to the formatObject even though this polyfill
13329
+ // might not support it.
13330
+ skeleton.replace(expDTComponents, function ($0) {
13331
+ // See which symbol we're dealing with
13332
+ return expDTComponentsMeta($0, formatObj);
13333
+ });
13334
+
13335
+ return computeFinalPatterns(formatObj);
13336
+ }
13337
+
13338
+ /**
13339
+ * Processes DateTime formats from CLDR to an easier-to-parse format.
13340
+ * the result of this operation should be cached the first time a particular
13341
+ * calendar is analyzed.
13342
+ *
13343
+ * The specification requires we support at least the following subsets of
13344
+ * date/time components:
13345
+ *
13346
+ * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'
13347
+ * - 'weekday', 'year', 'month', 'day'
13348
+ * - 'year', 'month', 'day'
13349
+ * - 'year', 'month'
13350
+ * - 'month', 'day'
13351
+ * - 'hour', 'minute', 'second'
13352
+ * - 'hour', 'minute'
13353
+ *
13354
+ * We need to cherry pick at least these subsets from the CLDR data and convert
13355
+ * them into the pattern objects used in the ECMA-402 API.
13356
+ */
13357
+ function createDateTimeFormats(formats) {
13358
+ var availableFormats = formats.availableFormats;
13359
+ var timeFormats = formats.timeFormats;
13360
+ var dateFormats = formats.dateFormats;
13361
+ var result = [];
13362
+ var skeleton = void 0,
13363
+ pattern = void 0,
13364
+ computed = void 0,
13365
+ i = void 0,
13366
+ j = void 0;
13367
+ var timeRelatedFormats = [];
13368
+ var dateRelatedFormats = [];
13369
+
13370
+ // Map available (custom) formats into a pattern for createDateTimeFormats
13371
+ for (skeleton in availableFormats) {
13372
+ if (availableFormats.hasOwnProperty(skeleton)) {
13373
+ pattern = availableFormats[skeleton];
13374
+ computed = createDateTimeFormat(skeleton, pattern);
13375
+ if (computed) {
13376
+ result.push(computed);
13377
+ // in some cases, the format is only displaying date specific props
13378
+ // or time specific props, in which case we need to also produce the
13379
+ // combined formats.
13380
+ if (isDateFormatOnly(computed)) {
13381
+ dateRelatedFormats.push(computed);
13382
+ } else if (isTimeFormatOnly(computed)) {
13383
+ timeRelatedFormats.push(computed);
13384
+ }
13385
+ }
13386
+ }
13387
+ }
13388
+
13389
+ // Map time formats into a pattern for createDateTimeFormats
13390
+ for (skeleton in timeFormats) {
13391
+ if (timeFormats.hasOwnProperty(skeleton)) {
13392
+ pattern = timeFormats[skeleton];
13393
+ computed = createDateTimeFormat(skeleton, pattern);
13394
+ if (computed) {
13395
+ result.push(computed);
13396
+ timeRelatedFormats.push(computed);
13397
+ }
13398
+ }
13399
+ }
13400
+
13401
+ // Map date formats into a pattern for createDateTimeFormats
13402
+ for (skeleton in dateFormats) {
13403
+ if (dateFormats.hasOwnProperty(skeleton)) {
13404
+ pattern = dateFormats[skeleton];
13405
+ computed = createDateTimeFormat(skeleton, pattern);
13406
+ if (computed) {
13407
+ result.push(computed);
13408
+ dateRelatedFormats.push(computed);
13409
+ }
13410
+ }
13411
+ }
13412
+
13413
+ // combine custom time and custom date formats when they are orthogonals to complete the
13414
+ // formats supported by CLDR.
13415
+ // This Algo is based on section "Missing Skeleton Fields" from:
13416
+ // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems
13417
+ for (i = 0; i < timeRelatedFormats.length; i += 1) {
13418
+ for (j = 0; j < dateRelatedFormats.length; j += 1) {
13419
+ if (dateRelatedFormats[j].month === 'long') {
13420
+ pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;
13421
+ } else if (dateRelatedFormats[j].month === 'short') {
13422
+ pattern = formats.medium;
13423
+ } else {
13424
+ pattern = formats.short;
13425
+ }
13426
+ computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);
13427
+ computed.originalPattern = pattern;
13428
+ computed.extendedPattern = pattern.replace('{0}', timeRelatedFormats[i].extendedPattern).replace('{1}', dateRelatedFormats[j].extendedPattern).replace(/^[,\s]+|[,\s]+$/gi, '');
13429
+ result.push(computeFinalPatterns(computed));
13430
+ }
13431
+ }
13432
+
13433
+ return result;
13434
+ }
13435
+
13436
+ // An object map of date component keys, saves using a regex later
13437
+ var dateWidths = objCreate(null, { narrow: {}, short: {}, long: {} });
13438
+
13439
+ /**
13440
+ * Returns a string for a date component, resolved using multiple inheritance as specified
13441
+ * as specified in the Unicode Technical Standard 35.
13442
+ */
13443
+ function resolveDateString(data, ca, component, width, key) {
13444
+ // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:
13445
+ // 'In clearly specified instances, resources may inherit from within the same locale.
13446
+ // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'
13447
+ var obj = data[ca] && data[ca][component] ? data[ca][component] : data.gregory[component],
13448
+
13449
+
13450
+ // "sideways" inheritance resolves strings when a key doesn't exist
13451
+ alts = {
13452
+ narrow: ['short', 'long'],
13453
+ short: ['long', 'narrow'],
13454
+ long: ['short', 'narrow']
13455
+ },
13456
+
13457
+
13458
+ //
13459
+ resolved = hop.call(obj, width) ? obj[width] : hop.call(obj, alts[width][0]) ? obj[alts[width][0]] : obj[alts[width][1]];
13460
+
13461
+ // `key` wouldn't be specified for components 'dayPeriods'
13462
+ return key !== null ? resolved[key] : resolved;
13463
+ }
13464
+
13465
+ // Define the DateTimeFormat constructor internally so it cannot be tainted
13466
+ function DateTimeFormatConstructor() {
13467
+ var locales = arguments[0];
13468
+ var options = arguments[1];
13469
+
13470
+ if (!this || this === Intl) {
13471
+ return new Intl.DateTimeFormat(locales, options);
13472
+ }
13473
+ return InitializeDateTimeFormat(toObject(this), locales, options);
13474
+ }
13475
+
13476
+ defineProperty(Intl, 'DateTimeFormat', {
13477
+ configurable: true,
13478
+ writable: true,
13479
+ value: DateTimeFormatConstructor
13480
+ });
13481
+
13482
+ // Must explicitly set prototypes as unwritable
13483
+ defineProperty(DateTimeFormatConstructor, 'prototype', {
13484
+ writable: false
13485
+ });
13486
+
13487
+ /**
13488
+ * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat
13489
+ * (which must be an object), locales, and options. It initializes dateTimeFormat as a
13490
+ * DateTimeFormat object.
13491
+ */
13492
+ function /* 12.1.1.1 */InitializeDateTimeFormat(dateTimeFormat, locales, options) {
13493
+ // This will be a internal properties object if we're not already initialized
13494
+ var internal = getInternalProperties(dateTimeFormat);
13495
+
13496
+ // Create an object whose props can be used to restore the values of RegExp props
13497
+ var regexpState = createRegExpRestore();
13498
+
13499
+ // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with
13500
+ // value true, throw a TypeError exception.
13501
+ if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');
13502
+
13503
+ // Need this to access the `internal` object
13504
+ defineProperty(dateTimeFormat, '__getInternalProperties', {
13505
+ value: function value() {
13506
+ // NOTE: Non-standard, for internal use only
13507
+ if (arguments[0] === secret) return internal;
13508
+ }
13509
+ });
13510
+
13511
+ // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
13512
+ internal['[[initializedIntlObject]]'] = true;
13513
+
13514
+ // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
13515
+ // abstract operation (defined in 9.2.1) with argument locales.
13516
+ var requestedLocales = CanonicalizeLocaleList(locales);
13517
+
13518
+ // 4. Let options be the result of calling the ToDateTimeOptions abstract
13519
+ // operation (defined below) with arguments options, "any", and "date".
13520
+ options = ToDateTimeOptions(options, 'any', 'date');
13521
+
13522
+ // 5. Let opt be a new Record.
13523
+ var opt = new Record();
13524
+
13525
+ // 6. Let matcher be the result of calling the GetOption abstract operation
13526
+ // (defined in 9.2.9) with arguments options, "localeMatcher", "string", a List
13527
+ // containing the two String values "lookup" and "best fit", and "best fit".
13528
+ var matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');
13529
+
13530
+ // 7. Set opt.[[localeMatcher]] to matcher.
13531
+ opt['[[localeMatcher]]'] = matcher;
13532
+
13533
+ // 8. Let DateTimeFormat be the standard built-in object that is the initial
13534
+ // value of Intl.DateTimeFormat.
13535
+ var DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need
13536
+
13537
+ // 9. Let localeData be the value of the [[localeData]] internal property of
13538
+ // DateTimeFormat.
13539
+ var localeData = DateTimeFormat['[[localeData]]'];
13540
+
13541
+ // 10. Let r be the result of calling the ResolveLocale abstract operation
13542
+ // (defined in 9.2.5) with the [[availableLocales]] internal property of
13543
+ // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]
13544
+ // internal property of DateTimeFormat, and localeData.
13545
+ var r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales, opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);
13546
+
13547
+ // 11. Set the [[locale]] internal property of dateTimeFormat to the value of
13548
+ // r.[[locale]].
13549
+ internal['[[locale]]'] = r['[[locale]]'];
13550
+
13551
+ // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of
13552
+ // r.[[ca]].
13553
+ internal['[[calendar]]'] = r['[[ca]]'];
13554
+
13555
+ // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of
13556
+ // r.[[nu]].
13557
+ internal['[[numberingSystem]]'] = r['[[nu]]'];
13558
+
13559
+ // The specification doesn't tell us to do this, but it's helpful later on
13560
+ internal['[[dataLocale]]'] = r['[[dataLocale]]'];
13561
+
13562
+ // 14. Let dataLocale be the value of r.[[dataLocale]].
13563
+ var dataLocale = r['[[dataLocale]]'];
13564
+
13565
+ // 15. Let tz be the result of calling the [[Get]] internal method of options with
13566
+ // argument "timeZone".
13567
+ var tz = options.timeZone;
13568
+
13569
+ // 16. If tz is not undefined, then
13570
+ if (tz !== undefined) {
13571
+ // a. Let tz be ToString(tz).
13572
+ // b. Convert tz to upper case as described in 6.1.
13573
+ // NOTE: If an implementation accepts additional time zone values, as permitted
13574
+ // under certain conditions by the Conformance clause, different casing
13575
+ // rules apply.
13576
+ tz = toLatinUpperCase(tz);
13577
+
13578
+ // c. If tz is not "UTC", then throw a RangeError exception.
13579
+ // ###TODO: accept more time zones###
13580
+ if (tz !== 'UTC') throw new RangeError('timeZone is not supported.');
13581
+ }
13582
+
13583
+ // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.
13584
+ internal['[[timeZone]]'] = tz;
13585
+
13586
+ // 18. Let opt be a new Record.
13587
+ opt = new Record();
13588
+
13589
+ // 19. For each row of Table 3, except the header row, do:
13590
+ for (var prop in dateTimeComponents) {
13591
+ if (!hop.call(dateTimeComponents, prop)) continue;
13592
+
13593
+ // 20. Let prop be the name given in the Property column of the row.
13594
+ // 21. Let value be the result of calling the GetOption abstract operation,
13595
+ // passing as argument options, the name given in the Property column of the
13596
+ // row, "string", a List containing the strings given in the Values column of
13597
+ // the row, and undefined.
13598
+ var value = GetOption(options, prop, 'string', dateTimeComponents[prop]);
13599
+
13600
+ // 22. Set opt.[[<prop>]] to value.
13601
+ opt['[[' + prop + ']]'] = value;
13602
+ }
13603
+
13604
+ // Assigned a value below
13605
+ var bestFormat = void 0;
13606
+
13607
+ // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of
13608
+ // localeData with argument dataLocale.
13609
+ var dataLocaleData = localeData[dataLocale];
13610
+
13611
+ // 24. Let formats be the result of calling the [[Get]] internal method of
13612
+ // dataLocaleData with argument "formats".
13613
+ // Note: we process the CLDR formats into the spec'd structure
13614
+ var formats = ToDateTimeFormats(dataLocaleData.formats);
13615
+
13616
+ // 25. Let matcher be the result of calling the GetOption abstract operation with
13617
+ // arguments options, "formatMatcher", "string", a List containing the two String
13618
+ // values "basic" and "best fit", and "best fit".
13619
+ matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');
13620
+
13621
+ // Optimization: caching the processed formats as a one time operation by
13622
+ // replacing the initial structure from localeData
13623
+ dataLocaleData.formats = formats;
13624
+
13625
+ // 26. If matcher is "basic", then
13626
+ if (matcher === 'basic') {
13627
+ // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract
13628
+ // operation (defined below) with opt and formats.
13629
+ bestFormat = BasicFormatMatcher(opt, formats);
13630
+
13631
+ // 28. Else
13632
+ } else {
13633
+ {
13634
+ // diverging
13635
+ var _hr = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);
13636
+ opt.hour12 = _hr === undefined ? dataLocaleData.hour12 : _hr;
13637
+ }
13638
+ // 29. Let bestFormat be the result of calling the BestFitFormatMatcher
13639
+ // abstract operation (defined below) with opt and formats.
13640
+ bestFormat = BestFitFormatMatcher(opt, formats);
13641
+ }
13642
+
13643
+ // 30. For each row in Table 3, except the header row, do
13644
+ for (var _prop in dateTimeComponents) {
13645
+ if (!hop.call(dateTimeComponents, _prop)) continue;
13646
+
13647
+ // a. Let prop be the name given in the Property column of the row.
13648
+ // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of
13649
+ // bestFormat with argument prop.
13650
+ // c. If pDesc is not undefined, then
13651
+ if (hop.call(bestFormat, _prop)) {
13652
+ // i. Let p be the result of calling the [[Get]] internal method of bestFormat
13653
+ // with argument prop.
13654
+ var p = bestFormat[_prop];
13655
+ {
13656
+ // diverging
13657
+ p = bestFormat._ && hop.call(bestFormat._, _prop) ? bestFormat._[_prop] : p;
13658
+ }
13659
+
13660
+ // ii. Set the [[<prop>]] internal property of dateTimeFormat to p.
13661
+ internal['[[' + _prop + ']]'] = p;
13662
+ }
13663
+ }
13664
+
13665
+ var pattern = void 0; // Assigned a value below
13666
+
13667
+ // 31. Let hr12 be the result of calling the GetOption abstract operation with
13668
+ // arguments options, "hour12", "boolean", undefined, and undefined.
13669
+ var hr12 = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);
13670
+
13671
+ // 32. If dateTimeFormat has an internal property [[hour]], then
13672
+ if (internal['[[hour]]']) {
13673
+ // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]
13674
+ // internal method of dataLocaleData with argument "hour12".
13675
+ hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;
13676
+
13677
+ // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.
13678
+ internal['[[hour12]]'] = hr12;
13679
+
13680
+ // c. If hr12 is true, then
13681
+ if (hr12 === true) {
13682
+ // i. Let hourNo0 be the result of calling the [[Get]] internal method of
13683
+ // dataLocaleData with argument "hourNo0".
13684
+ var hourNo0 = dataLocaleData.hourNo0;
13685
+
13686
+ // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.
13687
+ internal['[[hourNo0]]'] = hourNo0;
13688
+
13689
+ // iii. Let pattern be the result of calling the [[Get]] internal method of
13690
+ // bestFormat with argument "pattern12".
13691
+ pattern = bestFormat.pattern12;
13692
+ }
13693
+
13694
+ // d. Else
13695
+ else
13696
+ // i. Let pattern be the result of calling the [[Get]] internal method of
13697
+ // bestFormat with argument "pattern".
13698
+ pattern = bestFormat.pattern;
13699
+ }
13700
+
13701
+ // 33. Else
13702
+ else
13703
+ // a. Let pattern be the result of calling the [[Get]] internal method of
13704
+ // bestFormat with argument "pattern".
13705
+ pattern = bestFormat.pattern;
13706
+
13707
+ // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.
13708
+ internal['[[pattern]]'] = pattern;
13709
+
13710
+ // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.
13711
+ internal['[[boundFormat]]'] = undefined;
13712
+
13713
+ // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to
13714
+ // true.
13715
+ internal['[[initializedDateTimeFormat]]'] = true;
13716
+
13717
+ // In ES3, we need to pre-bind the format() function
13718
+ if (es3) dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);
13719
+
13720
+ // Restore the RegExp properties
13721
+ regexpState.exp.test(regexpState.input);
13722
+
13723
+ // Return the newly initialised object
13724
+ return dateTimeFormat;
13725
+ }
13726
+
13727
+ /**
13728
+ * Several DateTimeFormat algorithms use values from the following table, which provides
13729
+ * property names and allowable values for the components of date and time formats:
13730
+ */
13731
+ var dateTimeComponents = {
13732
+ weekday: ["narrow", "short", "long"],
13733
+ era: ["narrow", "short", "long"],
13734
+ year: ["2-digit", "numeric"],
13735
+ month: ["2-digit", "numeric", "narrow", "short", "long"],
13736
+ day: ["2-digit", "numeric"],
13737
+ hour: ["2-digit", "numeric"],
13738
+ minute: ["2-digit", "numeric"],
13739
+ second: ["2-digit", "numeric"],
13740
+ timeZoneName: ["short", "long"]
13741
+ };
13742
+
13743
+ /**
13744
+ * When the ToDateTimeOptions abstract operation is called with arguments options,
13745
+ * required, and defaults, the following steps are taken:
13746
+ */
13747
+ function ToDateTimeFormats(formats) {
13748
+ if (Object.prototype.toString.call(formats) === '[object Array]') {
13749
+ return formats;
13750
+ }
13751
+ return createDateTimeFormats(formats);
13752
+ }
13753
+
13754
+ /**
13755
+ * When the ToDateTimeOptions abstract operation is called with arguments options,
13756
+ * required, and defaults, the following steps are taken:
13757
+ */
13758
+ function ToDateTimeOptions(options, required, defaults) {
13759
+ // 1. If options is undefined, then let options be null, else let options be
13760
+ // ToObject(options).
13761
+ if (options === undefined) options = null;else {
13762
+ // (#12) options needs to be a Record, but it also needs to inherit properties
13763
+ var opt2 = toObject(options);
13764
+ options = new Record();
13765
+
13766
+ for (var k in opt2) {
13767
+ options[k] = opt2[k];
13768
+ }
13769
+ }
13770
+
13771
+ // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.
13772
+ var create = objCreate;
13773
+
13774
+ // 3. Let options be the result of calling the [[Call]] internal method of create with
13775
+ // undefined as the this value and an argument list containing the single item
13776
+ // options.
13777
+ options = create(options);
13778
+
13779
+ // 4. Let needDefaults be true.
13780
+ var needDefaults = true;
13781
+
13782
+ // 5. If required is "date" or "any", then
13783
+ if (required === 'date' || required === 'any') {
13784
+ // a. For each of the property names "weekday", "year", "month", "day":
13785
+ // i. If the result of calling the [[Get]] internal method of options with the
13786
+ // property name is not undefined, then let needDefaults be false.
13787
+ if (options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined) needDefaults = false;
13788
+ }
13789
+
13790
+ // 6. If required is "time" or "any", then
13791
+ if (required === 'time' || required === 'any') {
13792
+ // a. For each of the property names "hour", "minute", "second":
13793
+ // i. If the result of calling the [[Get]] internal method of options with the
13794
+ // property name is not undefined, then let needDefaults be false.
13795
+ if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined) needDefaults = false;
13796
+ }
13797
+
13798
+ // 7. If needDefaults is true and defaults is either "date" or "all", then
13799
+ if (needDefaults && (defaults === 'date' || defaults === 'all'))
13800
+ // a. For each of the property names "year", "month", "day":
13801
+ // i. Call the [[DefineOwnProperty]] internal method of options with the
13802
+ // property name, Property Descriptor {[[Value]]: "numeric", [[Writable]]:
13803
+ // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.
13804
+ options.year = options.month = options.day = 'numeric';
13805
+
13806
+ // 8. If needDefaults is true and defaults is either "time" or "all", then
13807
+ if (needDefaults && (defaults === 'time' || defaults === 'all'))
13808
+ // a. For each of the property names "hour", "minute", "second":
13809
+ // i. Call the [[DefineOwnProperty]] internal method of options with the
13810
+ // property name, Property Descriptor {[[Value]]: "numeric", [[Writable]]:
13811
+ // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.
13812
+ options.hour = options.minute = options.second = 'numeric';
13813
+
13814
+ // 9. Return options.
13815
+ return options;
13816
+ }
13817
+
13818
+ /**
13819
+ * When the BasicFormatMatcher abstract operation is called with two arguments options and
13820
+ * formats, the following steps are taken:
13821
+ */
13822
+ function BasicFormatMatcher(options, formats) {
13823
+ // 1. Let removalPenalty be 120.
13824
+ var removalPenalty = 120;
13825
+
13826
+ // 2. Let additionPenalty be 20.
13827
+ var additionPenalty = 20;
13828
+
13829
+ // 3. Let longLessPenalty be 8.
13830
+ var longLessPenalty = 8;
13831
+
13832
+ // 4. Let longMorePenalty be 6.
13833
+ var longMorePenalty = 6;
13834
+
13835
+ // 5. Let shortLessPenalty be 6.
13836
+ var shortLessPenalty = 6;
13837
+
13838
+ // 6. Let shortMorePenalty be 3.
13839
+ var shortMorePenalty = 3;
13840
+
13841
+ // 7. Let bestScore be -Infinity.
13842
+ var bestScore = -Infinity;
13843
+
13844
+ // 8. Let bestFormat be undefined.
13845
+ var bestFormat = void 0;
13846
+
13847
+ // 9. Let i be 0.
13848
+ var i = 0;
13849
+
13850
+ // 10. Assert: formats is an Array object.
13851
+
13852
+ // 11. Let len be the result of calling the [[Get]] internal method of formats with argument "length".
13853
+ var len = formats.length;
13854
+
13855
+ // 12. Repeat while i < len:
13856
+ while (i < len) {
13857
+ // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).
13858
+ var format = formats[i];
13859
+
13860
+ // b. Let score be 0.
13861
+ var score = 0;
13862
+
13863
+ // c. For each property shown in Table 3:
13864
+ for (var property in dateTimeComponents) {
13865
+ if (!hop.call(dateTimeComponents, property)) continue;
13866
+
13867
+ // i. Let optionsProp be options.[[<property>]].
13868
+ var optionsProp = options['[[' + property + ']]'];
13869
+
13870
+ // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format
13871
+ // with argument property.
13872
+ // iii. If formatPropDesc is not undefined, then
13873
+ // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.
13874
+ var formatProp = hop.call(format, property) ? format[property] : undefined;
13875
+
13876
+ // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by
13877
+ // additionPenalty.
13878
+ if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;
13879
+
13880
+ // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by
13881
+ // removalPenalty.
13882
+ else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;
13883
+
13884
+ // vi. Else
13885
+ else {
13886
+ // 1. Let values be the array ["2-digit", "numeric", "narrow", "short",
13887
+ // "long"].
13888
+ var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];
13889
+
13890
+ // 2. Let optionsPropIndex be the index of optionsProp within values.
13891
+ var optionsPropIndex = arrIndexOf.call(values, optionsProp);
13892
+
13893
+ // 3. Let formatPropIndex be the index of formatProp within values.
13894
+ var formatPropIndex = arrIndexOf.call(values, formatProp);
13895
+
13896
+ // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).
13897
+ var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);
13898
+
13899
+ // 5. If delta = 2, decrease score by longMorePenalty.
13900
+ if (delta === 2) score -= longMorePenalty;
13901
+
13902
+ // 6. Else if delta = 1, decrease score by shortMorePenalty.
13903
+ else if (delta === 1) score -= shortMorePenalty;
13904
+
13905
+ // 7. Else if delta = -1, decrease score by shortLessPenalty.
13906
+ else if (delta === -1) score -= shortLessPenalty;
13907
+
13908
+ // 8. Else if delta = -2, decrease score by longLessPenalty.
13909
+ else if (delta === -2) score -= longLessPenalty;
13910
+ }
13911
+ }
13912
+
13913
+ // d. If score > bestScore, then
13914
+ if (score > bestScore) {
13915
+ // i. Let bestScore be score.
13916
+ bestScore = score;
13917
+
13918
+ // ii. Let bestFormat be format.
13919
+ bestFormat = format;
13920
+ }
13921
+
13922
+ // e. Increase i by 1.
13923
+ i++;
13924
+ }
13925
+
13926
+ // 13. Return bestFormat.
13927
+ return bestFormat;
13928
+ }
13929
+
13930
+ /**
13931
+ * When the BestFitFormatMatcher abstract operation is called with two arguments options
13932
+ * and formats, it performs implementation dependent steps, which should return a set of
13933
+ * component representations that a typical user of the selected locale would perceive as
13934
+ * at least as good as the one returned by BasicFormatMatcher.
13935
+ *
13936
+ * This polyfill defines the algorithm to be the same as BasicFormatMatcher,
13937
+ * with the addition of bonus points awarded where the requested format is of
13938
+ * the same data type as the potentially matching format.
13939
+ *
13940
+ * This algo relies on the concept of closest distance matching described here:
13941
+ * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons
13942
+ * Typically a “best match” is found using a closest distance match, such as:
13943
+ *
13944
+ * Symbols requesting a best choice for the locale are replaced.
13945
+ * j → one of {H, k, h, K}; C → one of {a, b, B}
13946
+ * -> Covered by cldr.js matching process
13947
+ *
13948
+ * For fields with symbols representing the same type (year, month, day, etc):
13949
+ * Most symbols have a small distance from each other.
13950
+ * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...
13951
+ * -> Covered by cldr.js matching process
13952
+ *
13953
+ * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.
13954
+ * MMM ≅ MMMM
13955
+ * MM ≅ M
13956
+ * Numeric and text fields are given a larger distance from each other.
13957
+ * MMM ≈ MM
13958
+ * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.
13959
+ * d ≋ D; ...
13960
+ * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).
13961
+ *
13962
+ *
13963
+ * For example,
13964
+ *
13965
+ * { month: 'numeric', day: 'numeric' }
13966
+ *
13967
+ * should match
13968
+ *
13969
+ * { month: '2-digit', day: '2-digit' }
13970
+ *
13971
+ * rather than
13972
+ *
13973
+ * { month: 'short', day: 'numeric' }
13974
+ *
13975
+ * This makes sense because a user requesting a formatted date with numeric parts would
13976
+ * not expect to see the returned format containing narrow, short or long part names
13977
+ */
13978
+ function BestFitFormatMatcher(options, formats) {
13979
+
13980
+ // 1. Let removalPenalty be 120.
13981
+ var removalPenalty = 120;
13982
+
13983
+ // 2. Let additionPenalty be 20.
13984
+ var additionPenalty = 20;
13985
+
13986
+ // 3. Let longLessPenalty be 8.
13987
+ var longLessPenalty = 8;
13988
+
13989
+ // 4. Let longMorePenalty be 6.
13990
+ var longMorePenalty = 6;
13991
+
13992
+ // 5. Let shortLessPenalty be 6.
13993
+ var shortLessPenalty = 6;
13994
+
13995
+ // 6. Let shortMorePenalty be 3.
13996
+ var shortMorePenalty = 3;
13997
+
13998
+ var hour12Penalty = 1;
13999
+
14000
+ // 7. Let bestScore be -Infinity.
14001
+ var bestScore = -Infinity;
14002
+
14003
+ // 8. Let bestFormat be undefined.
14004
+ var bestFormat = void 0;
14005
+
14006
+ // 9. Let i be 0.
14007
+ var i = 0;
14008
+
14009
+ // 10. Assert: formats is an Array object.
14010
+
14011
+ // 11. Let len be the result of calling the [[Get]] internal method of formats with argument "length".
14012
+ var len = formats.length;
14013
+
14014
+ // 12. Repeat while i < len:
14015
+ while (i < len) {
14016
+ // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).
14017
+ var format = formats[i];
14018
+
14019
+ // b. Let score be 0.
14020
+ var score = 0;
14021
+
14022
+ // c. For each property shown in Table 3:
14023
+ for (var property in dateTimeComponents) {
14024
+ if (!hop.call(dateTimeComponents, property)) continue;
14025
+
14026
+ // i. Let optionsProp be options.[[<property>]].
14027
+ var optionsProp = options['[[' + property + ']]'];
14028
+
14029
+ // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format
14030
+ // with argument property.
14031
+ // iii. If formatPropDesc is not undefined, then
14032
+ // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.
14033
+ var formatProp = hop.call(format, property) ? format[property] : undefined;
14034
+
14035
+ // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by
14036
+ // additionPenalty.
14037
+ if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;
14038
+
14039
+ // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by
14040
+ // removalPenalty.
14041
+ else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;
14042
+
14043
+ // vi. Else
14044
+ else {
14045
+ // 1. Let values be the array ["2-digit", "numeric", "narrow", "short",
14046
+ // "long"].
14047
+ var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];
14048
+
14049
+ // 2. Let optionsPropIndex be the index of optionsProp within values.
14050
+ var optionsPropIndex = arrIndexOf.call(values, optionsProp);
14051
+
14052
+ // 3. Let formatPropIndex be the index of formatProp within values.
14053
+ var formatPropIndex = arrIndexOf.call(values, formatProp);
14054
+
14055
+ // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).
14056
+ var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);
14057
+
14058
+ {
14059
+ // diverging from spec
14060
+ // When the bestFit argument is true, subtract additional penalty where data types are not the same
14061
+ if (formatPropIndex <= 1 && optionsPropIndex >= 2 || formatPropIndex >= 2 && optionsPropIndex <= 1) {
14062
+ // 5. If delta = 2, decrease score by longMorePenalty.
14063
+ if (delta > 0) score -= longMorePenalty;else if (delta < 0) score -= longLessPenalty;
14064
+ } else {
14065
+ // 5. If delta = 2, decrease score by longMorePenalty.
14066
+ if (delta > 1) score -= shortMorePenalty;else if (delta < -1) score -= shortLessPenalty;
14067
+ }
14068
+ }
14069
+ }
14070
+ }
14071
+
14072
+ {
14073
+ // diverging to also take into consideration differences between 12 or 24 hours
14074
+ // which is special for the best fit only.
14075
+ if (format._.hour12 !== options.hour12) {
14076
+ score -= hour12Penalty;
14077
+ }
14078
+ }
14079
+
14080
+ // d. If score > bestScore, then
14081
+ if (score > bestScore) {
14082
+ // i. Let bestScore be score.
14083
+ bestScore = score;
14084
+ // ii. Let bestFormat be format.
14085
+ bestFormat = format;
14086
+ }
14087
+
14088
+ // e. Increase i by 1.
14089
+ i++;
14090
+ }
14091
+
14092
+ // 13. Return bestFormat.
14093
+ return bestFormat;
14094
+ }
14095
+
14096
+ /* 12.2.3 */internals.DateTimeFormat = {
14097
+ '[[availableLocales]]': [],
14098
+ '[[relevantExtensionKeys]]': ['ca', 'nu'],
14099
+ '[[localeData]]': {}
14100
+ };
14101
+
14102
+ /**
14103
+ * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the
14104
+ * following steps are taken:
14105
+ */
14106
+ /* 12.2.2 */
14107
+ defineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {
14108
+ configurable: true,
14109
+ writable: true,
14110
+ value: fnBind.call(function (locales) {
14111
+ // Bound functions only have the `this` value altered if being used as a constructor,
14112
+ // this lets us imitate a native function that has no constructor
14113
+ if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');
14114
+
14115
+ // Create an object whose props can be used to restore the values of RegExp props
14116
+ var regexpState = createRegExpRestore(),
14117
+
14118
+
14119
+ // 1. If options is not provided, then let options be undefined.
14120
+ options = arguments[1],
14121
+
14122
+
14123
+ // 2. Let availableLocales be the value of the [[availableLocales]] internal
14124
+ // property of the standard built-in object that is the initial value of
14125
+ // Intl.NumberFormat.
14126
+
14127
+ availableLocales = this['[[availableLocales]]'],
14128
+
14129
+
14130
+ // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
14131
+ // abstract operation (defined in 9.2.1) with argument locales.
14132
+ requestedLocales = CanonicalizeLocaleList(locales);
14133
+
14134
+ // Restore the RegExp properties
14135
+ regexpState.exp.test(regexpState.input);
14136
+
14137
+ // 4. Return the result of calling the SupportedLocales abstract operation
14138
+ // (defined in 9.2.8) with arguments availableLocales, requestedLocales,
14139
+ // and options.
14140
+ return SupportedLocales(availableLocales, requestedLocales, options);
14141
+ }, internals.NumberFormat)
14142
+ });
14143
+
14144
+ /**
14145
+ * This named accessor property returns a function that formats a number
14146
+ * according to the effective locale and the formatting options of this
14147
+ * DateTimeFormat object.
14148
+ */
14149
+ /* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {
14150
+ configurable: true,
14151
+ get: GetFormatDateTime
14152
+ });
14153
+
14154
+ defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {
14155
+ configurable: true,
14156
+ get: GetFormatToPartsDateTime
14157
+ });
14158
+
14159
+ function GetFormatDateTime() {
14160
+ var internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
14161
+
14162
+ // Satisfy test 12.3_b
14163
+ if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');
14164
+
14165
+ // The value of the [[Get]] attribute is a function that takes the following
14166
+ // steps:
14167
+
14168
+ // 1. If the [[boundFormat]] internal property of this DateTimeFormat object
14169
+ // is undefined, then:
14170
+ if (internal['[[boundFormat]]'] === undefined) {
14171
+ // a. Let F be a Function object, with internal properties set as
14172
+ // specified for built-in functions in ES5, 15, or successor, and the
14173
+ // length property set to 0, that takes the argument date and
14174
+ // performs the following steps:
14175
+ var F = function F() {
14176
+ // i. If date is not provided or is undefined, then let x be the
14177
+ // result as if by the expression Date.now() where Date.now is
14178
+ // the standard built-in function defined in ES5, 15.9.4.4.
14179
+ // ii. Else let x be ToNumber(date).
14180
+ // iii. Return the result of calling the FormatDateTime abstract
14181
+ // operation (defined below) with arguments this and x.
14182
+ var x = Number(arguments.length === 0 ? Date.now() : arguments[0]);
14183
+ return FormatDateTime(this, x);
14184
+ };
14185
+ // b. Let bind be the standard built-in function object defined in ES5,
14186
+ // 15.3.4.5.
14187
+ // c. Let bf be the result of calling the [[Call]] internal method of
14188
+ // bind with F as the this value and an argument list containing
14189
+ // the single item this.
14190
+ var bf = fnBind.call(F, this);
14191
+ // d. Set the [[boundFormat]] internal property of this NumberFormat
14192
+ // object to bf.
14193
+ internal['[[boundFormat]]'] = bf;
14194
+ }
14195
+ // Return the value of the [[boundFormat]] internal property of this
14196
+ // NumberFormat object.
14197
+ return internal['[[boundFormat]]'];
14198
+ }
14199
+
14200
+ function GetFormatToPartsDateTime() {
14201
+ var internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
14202
+
14203
+ if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');
14204
+
14205
+ if (internal['[[boundFormatToParts]]'] === undefined) {
14206
+ var F = function F() {
14207
+ var x = Number(arguments.length === 0 ? Date.now() : arguments[0]);
14208
+ return FormatToPartsDateTime(this, x);
14209
+ };
14210
+ var bf = fnBind.call(F, this);
14211
+ internal['[[boundFormatToParts]]'] = bf;
14212
+ }
14213
+ return internal['[[boundFormatToParts]]'];
14214
+ }
14215
+
14216
+ function CreateDateTimeParts(dateTimeFormat, x) {
14217
+ // 1. If x is not a finite Number, then throw a RangeError exception.
14218
+ if (!isFinite(x)) throw new RangeError('Invalid valid date passed to format');
14219
+
14220
+ var internal = dateTimeFormat.__getInternalProperties(secret);
14221
+
14222
+ // Creating restore point for properties on the RegExp object... please wait
14223
+ /* let regexpState = */createRegExpRestore(); // ###TODO: review this
14224
+
14225
+ // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.
14226
+ var locale = internal['[[locale]]'];
14227
+
14228
+ // 3. Let nf be the result of creating a new NumberFormat object as if by the
14229
+ // expression new Intl.NumberFormat([locale], {useGrouping: false}) where
14230
+ // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.
14231
+ var nf = new Intl.NumberFormat([locale], { useGrouping: false });
14232
+
14233
+ // 4. Let nf2 be the result of creating a new NumberFormat object as if by the
14234
+ // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:
14235
+ // false}) where Intl.NumberFormat is the standard built-in constructor defined in
14236
+ // 11.1.3.
14237
+ var nf2 = new Intl.NumberFormat([locale], { minimumIntegerDigits: 2, useGrouping: false });
14238
+
14239
+ // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined
14240
+ // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,
14241
+ // and the value of the [[timeZone]] internal property of dateTimeFormat.
14242
+ var tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);
14243
+
14244
+ // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.
14245
+ var pattern = internal['[[pattern]]'];
14246
+
14247
+ // 7.
14248
+ var result = new List();
14249
+
14250
+ // 8.
14251
+ var index = 0;
14252
+
14253
+ // 9.
14254
+ var beginIndex = pattern.indexOf('{');
14255
+
14256
+ // 10.
14257
+ var endIndex = 0;
14258
+
14259
+ // Need the locale minus any extensions
14260
+ var dataLocale = internal['[[dataLocale]]'];
14261
+
14262
+ // Need the calendar data from CLDR
14263
+ var localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;
14264
+ var ca = internal['[[calendar]]'];
14265
+
14266
+ // 11.
14267
+ while (beginIndex !== -1) {
14268
+ var fv = void 0;
14269
+ // a.
14270
+ endIndex = pattern.indexOf('}', beginIndex);
14271
+ // b.
14272
+ if (endIndex === -1) {
14273
+ throw new Error('Unclosed pattern');
14274
+ }
14275
+ // c.
14276
+ if (beginIndex > index) {
14277
+ arrPush.call(result, {
14278
+ type: 'literal',
14279
+ value: pattern.substring(index, beginIndex)
14280
+ });
14281
+ }
14282
+ // d.
14283
+ var p = pattern.substring(beginIndex + 1, endIndex);
14284
+ // e.
14285
+ if (dateTimeComponents.hasOwnProperty(p)) {
14286
+ // i. Let f be the value of the [[<p>]] internal property of dateTimeFormat.
14287
+ var f = internal['[[' + p + ']]'];
14288
+ // ii. Let v be the value of tm.[[<p>]].
14289
+ var v = tm['[[' + p + ']]'];
14290
+ // iii. If p is "year" and v ≤ 0, then let v be 1 - v.
14291
+ if (p === 'year' && v <= 0) {
14292
+ v = 1 - v;
14293
+ }
14294
+ // iv. If p is "month", then increase v by 1.
14295
+ else if (p === 'month') {
14296
+ v++;
14297
+ }
14298
+ // v. If p is "hour" and the value of the [[hour12]] internal property of
14299
+ // dateTimeFormat is true, then
14300
+ else if (p === 'hour' && internal['[[hour12]]'] === true) {
14301
+ // 1. Let v be v modulo 12.
14302
+ v = v % 12;
14303
+ // 2. If v is 0 and the value of the [[hourNo0]] internal property of
14304
+ // dateTimeFormat is true, then let v be 12.
14305
+ if (v === 0 && internal['[[hourNo0]]'] === true) {
14306
+ v = 12;
14307
+ }
14308
+ }
14309
+
14310
+ // vi. If f is "numeric", then
14311
+ if (f === 'numeric') {
14312
+ // 1. Let fv be the result of calling the FormatNumber abstract operation
14313
+ // (defined in 11.3.2) with arguments nf and v.
14314
+ fv = FormatNumber(nf, v);
14315
+ }
14316
+ // vii. Else if f is "2-digit", then
14317
+ else if (f === '2-digit') {
14318
+ // 1. Let fv be the result of calling the FormatNumber abstract operation
14319
+ // with arguments nf2 and v.
14320
+ fv = FormatNumber(nf2, v);
14321
+ // 2. If the length of fv is greater than 2, let fv be the substring of fv
14322
+ // containing the last two characters.
14323
+ if (fv.length > 2) {
14324
+ fv = fv.slice(-2);
14325
+ }
14326
+ }
14327
+ // viii. Else if f is "narrow", "short", or "long", then let fv be a String
14328
+ // value representing f in the desired form; the String value depends upon
14329
+ // the implementation and the effective locale and calendar of
14330
+ // dateTimeFormat. If p is "month", then the String value may also depend
14331
+ // on whether dateTimeFormat has a [[day]] internal property. If p is
14332
+ // "timeZoneName", then the String value may also depend on the value of
14333
+ // the [[inDST]] field of tm.
14334
+ else if (f in dateWidths) {
14335
+ switch (p) {
14336
+ case 'month':
14337
+ fv = resolveDateString(localeData, ca, 'months', f, tm['[[' + p + ']]']);
14338
+ break;
14339
+
14340
+ case 'weekday':
14341
+ try {
14342
+ fv = resolveDateString(localeData, ca, 'days', f, tm['[[' + p + ']]']);
14343
+ // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];
14344
+ } catch (e) {
14345
+ throw new Error('Could not find weekday data for locale ' + locale);
14346
+ }
14347
+ break;
14348
+
14349
+ case 'timeZoneName':
14350
+ fv = ''; // ###TODO
14351
+ break;
14352
+
14353
+ case 'era':
14354
+ try {
14355
+ fv = resolveDateString(localeData, ca, 'eras', f, tm['[[' + p + ']]']);
14356
+ } catch (e) {
14357
+ throw new Error('Could not find era data for locale ' + locale);
14358
+ }
14359
+ break;
14360
+
14361
+ default:
14362
+ fv = tm['[[' + p + ']]'];
14363
+ }
14364
+ }
14365
+ // ix
14366
+ arrPush.call(result, {
14367
+ type: p,
14368
+ value: fv
14369
+ });
14370
+ // f.
14371
+ } else if (p === 'ampm') {
14372
+ // i.
14373
+ var _v = tm['[[hour]]'];
14374
+ // ii./iii.
14375
+ fv = resolveDateString(localeData, ca, 'dayPeriods', _v > 11 ? 'pm' : 'am', null);
14376
+ // iv.
14377
+ arrPush.call(result, {
14378
+ type: 'dayPeriod',
14379
+ value: fv
14380
+ });
14381
+ // g.
14382
+ } else {
14383
+ arrPush.call(result, {
14384
+ type: 'literal',
14385
+ value: pattern.substring(beginIndex, endIndex + 1)
14386
+ });
14387
+ }
14388
+ // h.
14389
+ index = endIndex + 1;
14390
+ // i.
14391
+ beginIndex = pattern.indexOf('{', index);
14392
+ }
14393
+ // 12.
14394
+ if (endIndex < pattern.length - 1) {
14395
+ arrPush.call(result, {
14396
+ type: 'literal',
14397
+ value: pattern.substr(endIndex + 1)
14398
+ });
14399
+ }
14400
+ // 13.
14401
+ return result;
14402
+ }
14403
+
14404
+ /**
14405
+ * When the FormatDateTime abstract operation is called with arguments dateTimeFormat
14406
+ * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number
14407
+ * value), it returns a String value representing x (interpreted as a time value as
14408
+ * specified in ES5, 15.9.1.1) according to the effective locale and the formatting
14409
+ * options of dateTimeFormat.
14410
+ */
14411
+ function FormatDateTime(dateTimeFormat, x) {
14412
+ var parts = CreateDateTimeParts(dateTimeFormat, x);
14413
+ var result = '';
14414
+
14415
+ for (var i = 0; parts.length > i; i++) {
14416
+ var part = parts[i];
14417
+ result += part.value;
14418
+ }
14419
+ return result;
14420
+ }
14421
+
14422
+ function FormatToPartsDateTime(dateTimeFormat, x) {
14423
+ var parts = CreateDateTimeParts(dateTimeFormat, x);
14424
+ var result = [];
14425
+ for (var i = 0; parts.length > i; i++) {
14426
+ var part = parts[i];
14427
+ result.push({
14428
+ type: part.type,
14429
+ value: part.value
14430
+ });
14431
+ }
14432
+ return result;
14433
+ }
14434
+
14435
+ /**
14436
+ * When the ToLocalTime abstract operation is called with arguments date, calendar, and
14437
+ * timeZone, the following steps are taken:
14438
+ */
14439
+ function ToLocalTime(date, calendar, timeZone) {
14440
+ // 1. Apply calendrical calculations on date for the given calendar and time zone to
14441
+ // produce weekday, era, year, month, day, hour, minute, second, and inDST values.
14442
+ // The calculations should use best available information about the specified
14443
+ // calendar and time zone. If the calendar is "gregory", then the calculations must
14444
+ // match the algorithms specified in ES5, 15.9.1, except that calculations are not
14445
+ // bound by the restrictions on the use of best available information on time zones
14446
+ // for local time zone adjustment and daylight saving time adjustment imposed by
14447
+ // ES5, 15.9.1.7 and 15.9.1.8.
14448
+ // ###TODO###
14449
+ var d = new Date(date),
14450
+ m = 'get' + (timeZone || '');
14451
+
14452
+ // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],
14453
+ // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding
14454
+ // calculated value.
14455
+ return new Record({
14456
+ '[[weekday]]': d[m + 'Day'](),
14457
+ '[[era]]': +(d[m + 'FullYear']() >= 0),
14458
+ '[[year]]': d[m + 'FullYear'](),
14459
+ '[[month]]': d[m + 'Month'](),
14460
+ '[[day]]': d[m + 'Date'](),
14461
+ '[[hour]]': d[m + 'Hours'](),
14462
+ '[[minute]]': d[m + 'Minutes'](),
14463
+ '[[second]]': d[m + 'Seconds'](),
14464
+ '[[inDST]]': false });
14465
+ }
14466
+
14467
+ /**
14468
+ * The function returns a new object whose properties and attributes are set as if
14469
+ * constructed by an object literal assigning to each of the following properties the
14470
+ * value of the corresponding internal property of this DateTimeFormat object (see 12.4):
14471
+ * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,
14472
+ * hour, minute, second, and timeZoneName. Properties whose corresponding internal
14473
+ * properties are not present are not assigned.
14474
+ */
14475
+ /* 12.3.3 */ // ###TODO###
14476
+ defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {
14477
+ writable: true,
14478
+ configurable: true,
14479
+ value: function value() {
14480
+ var prop = void 0,
14481
+ descs = new Record(),
14482
+ props = ['locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'],
14483
+ internal = this !== null && babelHelpers["typeof"](this) === 'object' && getInternalProperties(this);
14484
+
14485
+ // Satisfy test 12.3_b
14486
+ if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');
14487
+
14488
+ for (var i = 0, max = props.length; i < max; i++) {
14489
+ if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };
14490
+ }
14491
+
14492
+ return objCreate({}, descs);
14493
+ }
14494
+ });
14495
+
14496
+ var ls = Intl.__localeSensitiveProtos = {
14497
+ Number: {},
14498
+ Date: {}
14499
+ };
14500
+
14501
+ /**
14502
+ * When the toLocaleString method is called with optional arguments locales and options,
14503
+ * the following steps are taken:
14504
+ */
14505
+ /* 13.2.1 */ls.Number.toLocaleString = function () {
14506
+ // Satisfy test 13.2.1_1
14507
+ if (Object.prototype.toString.call(this) !== '[object Number]') throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');
14508
+
14509
+ // 1. Let x be this Number value (as defined in ES5, 15.7.4).
14510
+ // 2. If locales is not provided, then let locales be undefined.
14511
+ // 3. If options is not provided, then let options be undefined.
14512
+ // 4. Let numberFormat be the result of creating a new object as if by the
14513
+ // expression new Intl.NumberFormat(locales, options) where
14514
+ // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.
14515
+ // 5. Return the result of calling the FormatNumber abstract operation
14516
+ // (defined in 11.3.2) with arguments numberFormat and x.
14517
+ return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);
14518
+ };
14519
+
14520
+ /**
14521
+ * When the toLocaleString method is called with optional arguments locales and options,
14522
+ * the following steps are taken:
14523
+ */
14524
+ /* 13.3.1 */ls.Date.toLocaleString = function () {
14525
+ // Satisfy test 13.3.0_1
14526
+ if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');
14527
+
14528
+ // 1. Let x be this time value (as defined in ES5, 15.9.5).
14529
+ var x = +this;
14530
+
14531
+ // 2. If x is NaN, then return "Invalid Date".
14532
+ if (isNaN(x)) return 'Invalid Date';
14533
+
14534
+ // 3. If locales is not provided, then let locales be undefined.
14535
+ var locales = arguments[0];
14536
+
14537
+ // 4. If options is not provided, then let options be undefined.
14538
+ var options = arguments[1];
14539
+
14540
+ // 5. Let options be the result of calling the ToDateTimeOptions abstract
14541
+ // operation (defined in 12.1.1) with arguments options, "any", and "all".
14542
+ options = ToDateTimeOptions(options, 'any', 'all');
14543
+
14544
+ // 6. Let dateTimeFormat be the result of creating a new object as if by the
14545
+ // expression new Intl.DateTimeFormat(locales, options) where
14546
+ // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.
14547
+ var dateTimeFormat = new DateTimeFormatConstructor(locales, options);
14548
+
14549
+ // 7. Return the result of calling the FormatDateTime abstract operation (defined
14550
+ // in 12.3.2) with arguments dateTimeFormat and x.
14551
+ return FormatDateTime(dateTimeFormat, x);
14552
+ };
14553
+
14554
+ /**
14555
+ * When the toLocaleDateString method is called with optional arguments locales and
14556
+ * options, the following steps are taken:
14557
+ */
14558
+ /* 13.3.2 */ls.Date.toLocaleDateString = function () {
14559
+ // Satisfy test 13.3.0_1
14560
+ if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');
14561
+
14562
+ // 1. Let x be this time value (as defined in ES5, 15.9.5).
14563
+ var x = +this;
14564
+
14565
+ // 2. If x is NaN, then return "Invalid Date".
14566
+ if (isNaN(x)) return 'Invalid Date';
14567
+
14568
+ // 3. If locales is not provided, then let locales be undefined.
14569
+ var locales = arguments[0],
14570
+
14571
+
14572
+ // 4. If options is not provided, then let options be undefined.
14573
+ options = arguments[1];
14574
+
14575
+ // 5. Let options be the result of calling the ToDateTimeOptions abstract
14576
+ // operation (defined in 12.1.1) with arguments options, "date", and "date".
14577
+ options = ToDateTimeOptions(options, 'date', 'date');
14578
+
14579
+ // 6. Let dateTimeFormat be the result of creating a new object as if by the
14580
+ // expression new Intl.DateTimeFormat(locales, options) where
14581
+ // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.
14582
+ var dateTimeFormat = new DateTimeFormatConstructor(locales, options);
14583
+
14584
+ // 7. Return the result of calling the FormatDateTime abstract operation (defined
14585
+ // in 12.3.2) with arguments dateTimeFormat and x.
14586
+ return FormatDateTime(dateTimeFormat, x);
14587
+ };
14588
+
14589
+ /**
14590
+ * When the toLocaleTimeString method is called with optional arguments locales and
14591
+ * options, the following steps are taken:
14592
+ */
14593
+ /* 13.3.3 */ls.Date.toLocaleTimeString = function () {
14594
+ // Satisfy test 13.3.0_1
14595
+ if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');
14596
+
14597
+ // 1. Let x be this time value (as defined in ES5, 15.9.5).
14598
+ var x = +this;
14599
+
14600
+ // 2. If x is NaN, then return "Invalid Date".
14601
+ if (isNaN(x)) return 'Invalid Date';
14602
+
14603
+ // 3. If locales is not provided, then let locales be undefined.
14604
+ var locales = arguments[0];
14605
+
14606
+ // 4. If options is not provided, then let options be undefined.
14607
+ var options = arguments[1];
14608
+
14609
+ // 5. Let options be the result of calling the ToDateTimeOptions abstract
14610
+ // operation (defined in 12.1.1) with arguments options, "time", and "time".
14611
+ options = ToDateTimeOptions(options, 'time', 'time');
14612
+
14613
+ // 6. Let dateTimeFormat be the result of creating a new object as if by the
14614
+ // expression new Intl.DateTimeFormat(locales, options) where
14615
+ // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.
14616
+ var dateTimeFormat = new DateTimeFormatConstructor(locales, options);
14617
+
14618
+ // 7. Return the result of calling the FormatDateTime abstract operation (defined
14619
+ // in 12.3.2) with arguments dateTimeFormat and x.
14620
+ return FormatDateTime(dateTimeFormat, x);
14621
+ };
14622
+
14623
+ defineProperty(Intl, '__applyLocaleSensitivePrototypes', {
14624
+ writable: true,
14625
+ configurable: true,
14626
+ value: function value() {
14627
+ defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });
14628
+ // Need this here for IE 8, to avoid the _DontEnum_ bug
14629
+ defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });
14630
+
14631
+ for (var k in ls.Date) {
14632
+ if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });
14633
+ }
14634
+ }
14635
+ });
14636
+
14637
+ /**
14638
+ * Can't really ship a single script with data for hundreds of locales, so we provide
14639
+ * this __addLocaleData method as a means for the developer to add the data on an
14640
+ * as-needed basis
14641
+ */
14642
+ defineProperty(Intl, '__addLocaleData', {
14643
+ value: function value(data) {
14644
+ if (!IsStructurallyValidLanguageTag(data.locale)) throw new Error("Object passed doesn't identify itself with a valid language tag");
14645
+
14646
+ addLocaleData(data, data.locale);
14647
+ }
14648
+ });
14649
+
14650
+ function addLocaleData(data, tag) {
14651
+ // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present
14652
+ if (!data.number) throw new Error("Object passed doesn't contain locale data for Intl.NumberFormat");
14653
+
14654
+ var locale = void 0,
14655
+ locales = [tag],
14656
+ parts = tag.split('-');
14657
+
14658
+ // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc
14659
+ if (parts.length > 2 && parts[1].length === 4) arrPush.call(locales, parts[0] + '-' + parts[2]);
14660
+
14661
+ while (locale = arrShift.call(locales)) {
14662
+ // Add to NumberFormat internal properties as per 11.2.3
14663
+ arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);
14664
+ internals.NumberFormat['[[localeData]]'][locale] = data.number;
14665
+
14666
+ // ...and DateTimeFormat internal properties as per 12.2.3
14667
+ if (data.date) {
14668
+ data.date.nu = data.number.nu;
14669
+ arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);
14670
+ internals.DateTimeFormat['[[localeData]]'][locale] = data.date;
14671
+ }
14672
+ }
14673
+
14674
+ // If this is the first set of locale data added, make it the default
14675
+ if (defaultLocale === undefined) setDefaultLocale(tag);
14676
+ }
14677
+
14678
+ module.exports = Intl;
14679
+ },{}],188:[function(_dereq_,module,exports){
14680
+ (function (global){
14681
+ /**
14682
+ * @license
14683
+ * lodash 3.10.1 (Custom Build) <https://lodash.com/>
14684
+ * Build: `lodash modern -d -o ./index.js`
14685
+ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
14686
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
14687
+ * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
14688
+ * Available under MIT license <https://lodash.com/license>
14689
+ */
14690
+ ;(function() {
14691
+
14692
+ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
14693
+ var undefined;
14694
+
14695
+ /** Used as the semantic version number. */
14696
+ var VERSION = '3.10.1';
14697
+
14698
+ /** Used to compose bitmasks for wrapper metadata. */
14699
+ var BIND_FLAG = 1,
14700
+ BIND_KEY_FLAG = 2,
14701
+ CURRY_BOUND_FLAG = 4,
14702
+ CURRY_FLAG = 8,
14703
+ CURRY_RIGHT_FLAG = 16,
14704
+ PARTIAL_FLAG = 32,
14705
+ PARTIAL_RIGHT_FLAG = 64,
14706
+ ARY_FLAG = 128,
14707
+ REARG_FLAG = 256;
14708
+
14709
+ /** Used as default options for `_.trunc`. */
14710
+ var DEFAULT_TRUNC_LENGTH = 30,
14711
+ DEFAULT_TRUNC_OMISSION = '...';
14712
+
14713
+ /** Used to detect when a function becomes hot. */
14714
+ var HOT_COUNT = 150,
14715
+ HOT_SPAN = 16;
14716
+
14717
+ /** Used as the size to enable large array optimizations. */
14718
+ var LARGE_ARRAY_SIZE = 200;
14719
+
14720
+ /** Used to indicate the type of lazy iteratees. */
14721
+ var LAZY_FILTER_FLAG = 1,
14722
+ LAZY_MAP_FLAG = 2;
14723
+
14724
+ /** Used as the `TypeError` message for "Functions" methods. */
14725
+ var FUNC_ERROR_TEXT = 'Expected a function';
14726
+
14727
+ /** Used as the internal argument placeholder. */
14728
+ var PLACEHOLDER = '__lodash_placeholder__';
14729
+
14730
+ /** `Object#toString` result references. */
14731
+ var argsTag = '[object Arguments]',
14732
+ arrayTag = '[object Array]',
14733
+ boolTag = '[object Boolean]',
14734
+ dateTag = '[object Date]',
14735
+ errorTag = '[object Error]',
14736
+ funcTag = '[object Function]',
14737
+ mapTag = '[object Map]',
14738
+ numberTag = '[object Number]',
14739
+ objectTag = '[object Object]',
14740
+ regexpTag = '[object RegExp]',
14741
+ setTag = '[object Set]',
14742
+ stringTag = '[object String]',
14743
+ weakMapTag = '[object WeakMap]';
14744
+
14745
+ var arrayBufferTag = '[object ArrayBuffer]',
14746
+ float32Tag = '[object Float32Array]',
14747
+ float64Tag = '[object Float64Array]',
14748
+ int8Tag = '[object Int8Array]',
14749
+ int16Tag = '[object Int16Array]',
14750
+ int32Tag = '[object Int32Array]',
14751
+ uint8Tag = '[object Uint8Array]',
14752
+ uint8ClampedTag = '[object Uint8ClampedArray]',
14753
+ uint16Tag = '[object Uint16Array]',
14754
+ uint32Tag = '[object Uint32Array]';
14755
+
14756
+ /** Used to match empty string literals in compiled template source. */
14757
+ var reEmptyStringLeading = /\b__p \+= '';/g,
14758
+ reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
14759
+ reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
14760
+
14761
+ /** Used to match HTML entities and HTML characters. */
14762
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
14763
+ reUnescapedHtml = /[&<>"'`]/g,
14764
+ reHasEscapedHtml = RegExp(reEscapedHtml.source),
14765
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
14766
+
14767
+ /** Used to match template delimiters. */
14768
+ var reEscape = /<%-([\s\S]+?)%>/g,
14769
+ reEvaluate = /<%([\s\S]+?)%>/g,
14770
+ reInterpolate = /<%=([\s\S]+?)%>/g;
14771
+
14772
+ /** Used to match property names within property paths. */
14773
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
14774
+ reIsPlainProp = /^\w*$/,
14775
+ rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
14776
+
14777
+ /**
14778
+ * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
14779
+ * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
14780
+ */
14781
+ var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
14782
+ reHasRegExpChars = RegExp(reRegExpChars.source);
14783
+
14784
+ /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
14785
+ var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
14786
+
14787
+ /** Used to match backslashes in property paths. */
14788
+ var reEscapeChar = /\\(\\)?/g;
14789
+
14790
+ /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
14791
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
14792
+
14793
+ /** Used to match `RegExp` flags from their coerced string values. */
14794
+ var reFlags = /\w*$/;
14795
+
14796
+ /** Used to detect hexadecimal string values. */
14797
+ var reHasHexPrefix = /^0[xX]/;
14798
+
14799
+ /** Used to detect host constructors (Safari > 5). */
14800
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
14801
+
14802
+ /** Used to detect unsigned integer values. */
14803
+ var reIsUint = /^\d+$/;
14804
+
14805
+ /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
14806
+ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
14807
+
14808
+ /** Used to ensure capturing order of template delimiters. */
14809
+ var reNoMatch = /($^)/;
14810
+
14811
+ /** Used to match unescaped characters in compiled string literals. */
14812
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
14813
+
14814
+ /** Used to match words to create compound words. */
14815
+ var reWords = (function() {
14816
+ var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
14817
+ lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
14818
+
14819
+ return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
14820
+ }());
14821
+
14822
+ /** Used to assign default `context` object properties. */
14823
+ var contextProps = [
14824
+ 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
14825
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
14826
+ 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
14827
+ 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
14828
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
14829
+ ];
14830
+
14831
+ /** Used to make template sourceURLs easier to identify. */
14832
+ var templateCounter = -1;
14833
+
14834
+ /** Used to identify `toStringTag` values of typed arrays. */
14835
+ var typedArrayTags = {};
14836
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
14837
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
14838
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
14839
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
14840
+ typedArrayTags[uint32Tag] = true;
14841
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
14842
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
14843
+ typedArrayTags[dateTag] = typedArrayTags[errorTag] =
14844
+ typedArrayTags[funcTag] = typedArrayTags[mapTag] =
14845
+ typedArrayTags[numberTag] = typedArrayTags[objectTag] =
14846
+ typedArrayTags[regexpTag] = typedArrayTags[setTag] =
14847
+ typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
14848
+
14849
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
14850
+ var cloneableTags = {};
14851
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
14852
+ cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
14853
+ cloneableTags[dateTag] = cloneableTags[float32Tag] =
14854
+ cloneableTags[float64Tag] = cloneableTags[int8Tag] =
14855
+ cloneableTags[int16Tag] = cloneableTags[int32Tag] =
14856
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
14857
+ cloneableTags[regexpTag] = cloneableTags[stringTag] =
14858
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
14859
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
14860
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
14861
+ cloneableTags[mapTag] = cloneableTags[setTag] =
14862
+ cloneableTags[weakMapTag] = false;
14863
+
14864
+ /** Used to map latin-1 supplementary letters to basic latin letters. */
14865
+ var deburredLetters = {
14866
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
14867
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
14868
+ '\xc7': 'C', '\xe7': 'c',
14869
+ '\xd0': 'D', '\xf0': 'd',
14870
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
14871
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
14872
+ '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
14873
+ '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
14874
+ '\xd1': 'N', '\xf1': 'n',
14875
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
14876
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
14877
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
14878
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
14879
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
14880
+ '\xc6': 'Ae', '\xe6': 'ae',
14881
+ '\xde': 'Th', '\xfe': 'th',
14882
+ '\xdf': 'ss'
14883
+ };
14884
+
14885
+ /** Used to map characters to HTML entities. */
14886
+ var htmlEscapes = {
14887
+ '&': '&amp;',
14888
+ '<': '&lt;',
14889
+ '>': '&gt;',
14890
+ '"': '&quot;',
14891
+ "'": '&#39;',
14892
+ '`': '&#96;'
14893
+ };
14894
+
14895
+ /** Used to map HTML entities to characters. */
14896
+ var htmlUnescapes = {
14897
+ '&amp;': '&',
14898
+ '&lt;': '<',
14899
+ '&gt;': '>',
14900
+ '&quot;': '"',
14901
+ '&#39;': "'",
14902
+ '&#96;': '`'
14903
+ };
14904
+
14905
+ /** Used to determine if values are of the language type `Object`. */
14906
+ var objectTypes = {
14907
+ 'function': true,
14908
+ 'object': true
14909
+ };
14910
+
14911
+ /** Used to escape characters for inclusion in compiled regexes. */
14912
+ var regexpEscapes = {
14913
+ '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
14914
+ '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
14915
+ 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
14916
+ 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
14917
+ 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
14918
+ };
14919
+
14920
+ /** Used to escape characters for inclusion in compiled string literals. */
14921
+ var stringEscapes = {
14922
+ '\\': '\\',
14923
+ "'": "'",
14924
+ '\n': 'n',
14925
+ '\r': 'r',
14926
+ '\u2028': 'u2028',
14927
+ '\u2029': 'u2029'
14928
+ };
14929
+
14930
+ /** Detect free variable `exports`. */
14931
+ var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
14932
+
14933
+ /** Detect free variable `module`. */
14934
+ var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
14935
+
14936
+ /** Detect free variable `global` from Node.js. */
14937
+ var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
14938
+
14939
+ /** Detect free variable `self`. */
14940
+ var freeSelf = objectTypes[typeof self] && self && self.Object && self;
14941
+
14942
+ /** Detect free variable `window`. */
14943
+ var freeWindow = objectTypes[typeof window] && window && window.Object && window;
14944
+
14945
+ /** Detect the popular CommonJS extension `module.exports`. */
14946
+ var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
14947
+
14948
+ /**
14949
+ * Used as a reference to the global object.
14950
+ *
14951
+ * The `this` value is used if it's the global object to avoid Greasemonkey's
14952
+ * restricted `window` object, otherwise the `window` object is used.
14953
+ */
14954
+ var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
14955
+
14956
+ /*--------------------------------------------------------------------------*/
14957
+
14958
+ /**
14959
+ * The base implementation of `compareAscending` which compares values and
14960
+ * sorts them in ascending order without guaranteeing a stable sort.
14961
+ *
14962
+ * @private
14963
+ * @param {*} value The value to compare.
14964
+ * @param {*} other The other value to compare.
14965
+ * @returns {number} Returns the sort order indicator for `value`.
14966
+ */
14967
+ function baseCompareAscending(value, other) {
14968
+ if (value !== other) {
14969
+ var valIsNull = value === null,
14970
+ valIsUndef = value === undefined,
14971
+ valIsReflexive = value === value;
14972
+
14973
+ var othIsNull = other === null,
14974
+ othIsUndef = other === undefined,
14975
+ othIsReflexive = other === other;
14976
+
14977
+ if ((value > other && !othIsNull) || !valIsReflexive ||
14978
+ (valIsNull && !othIsUndef && othIsReflexive) ||
14979
+ (valIsUndef && othIsReflexive)) {
14980
+ return 1;
14981
+ }
14982
+ if ((value < other && !valIsNull) || !othIsReflexive ||
14983
+ (othIsNull && !valIsUndef && valIsReflexive) ||
14984
+ (othIsUndef && valIsReflexive)) {
14985
+ return -1;
14986
+ }
14987
+ }
14988
+ return 0;
14989
+ }
14990
+
14991
+ /**
14992
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
14993
+ * support for callback shorthands and `this` binding.
14994
+ *
14995
+ * @private
14996
+ * @param {Array} array The array to search.
14997
+ * @param {Function} predicate The function invoked per iteration.
14998
+ * @param {boolean} [fromRight] Specify iterating from right to left.
14999
+ * @returns {number} Returns the index of the matched value, else `-1`.
15000
+ */
15001
+ function baseFindIndex(array, predicate, fromRight) {
15002
+ var length = array.length,
15003
+ index = fromRight ? length : -1;
15004
+
15005
+ while ((fromRight ? index-- : ++index < length)) {
15006
+ if (predicate(array[index], index, array)) {
15007
+ return index;
15008
+ }
15009
+ }
15010
+ return -1;
15011
+ }
15012
+
15013
+ /**
15014
+ * The base implementation of `_.indexOf` without support for binary searches.
15015
+ *
15016
+ * @private
15017
+ * @param {Array} array The array to search.
15018
+ * @param {*} value The value to search for.
15019
+ * @param {number} fromIndex The index to search from.
15020
+ * @returns {number} Returns the index of the matched value, else `-1`.
15021
+ */
15022
+ function baseIndexOf(array, value, fromIndex) {
15023
+ if (value !== value) {
15024
+ return indexOfNaN(array, fromIndex);
15025
+ }
15026
+ var index = fromIndex - 1,
15027
+ length = array.length;
15028
+
15029
+ while (++index < length) {
15030
+ if (array[index] === value) {
15031
+ return index;
15032
+ }
15033
+ }
15034
+ return -1;
15035
+ }
15036
+
15037
+ /**
15038
+ * The base implementation of `_.isFunction` without support for environments
15039
+ * with incorrect `typeof` results.
15040
+ *
15041
+ * @private
15042
+ * @param {*} value The value to check.
15043
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
15044
+ */
15045
+ function baseIsFunction(value) {
15046
+ // Avoid a Chakra JIT bug in compatibility modes of IE 11.
15047
+ // See https://github.com/jashkenas/underscore/issues/1621 for more details.
15048
+ return typeof value == 'function' || false;
15049
+ }
15050
+
15051
+ /**
15052
+ * Converts `value` to a string if it's not one. An empty string is returned
15053
+ * for `null` or `undefined` values.
15054
+ *
15055
+ * @private
15056
+ * @param {*} value The value to process.
15057
+ * @returns {string} Returns the string.
15058
+ */
15059
+ function baseToString(value) {
15060
+ return value == null ? '' : (value + '');
15061
+ }
15062
+
15063
+ /**
15064
+ * Used by `_.trim` and `_.trimLeft` to get the index of the first character
15065
+ * of `string` that is not found in `chars`.
15066
+ *
15067
+ * @private
15068
+ * @param {string} string The string to inspect.
15069
+ * @param {string} chars The characters to find.
15070
+ * @returns {number} Returns the index of the first character not found in `chars`.
15071
+ */
15072
+ function charsLeftIndex(string, chars) {
15073
+ var index = -1,
15074
+ length = string.length;
15075
+
15076
+ while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
15077
+ return index;
15078
+ }
15079
+
15080
+ /**
15081
+ * Used by `_.trim` and `_.trimRight` to get the index of the last character
15082
+ * of `string` that is not found in `chars`.
15083
+ *
15084
+ * @private
15085
+ * @param {string} string The string to inspect.
15086
+ * @param {string} chars The characters to find.
15087
+ * @returns {number} Returns the index of the last character not found in `chars`.
15088
+ */
15089
+ function charsRightIndex(string, chars) {
15090
+ var index = string.length;
15091
+
15092
+ while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
15093
+ return index;
15094
+ }
15095
+
15096
+ /**
15097
+ * Used by `_.sortBy` to compare transformed elements of a collection and stable
15098
+ * sort them in ascending order.
15099
+ *
15100
+ * @private
15101
+ * @param {Object} object The object to compare.
15102
+ * @param {Object} other The other object to compare.
15103
+ * @returns {number} Returns the sort order indicator for `object`.
15104
+ */
15105
+ function compareAscending(object, other) {
15106
+ return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
15107
+ }
15108
+
15109
+ /**
15110
+ * Used by `_.sortByOrder` to compare multiple properties of a value to another
15111
+ * and stable sort them.
15112
+ *
15113
+ * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,
15114
+ * a value is sorted in ascending order if its corresponding order is "asc", and
15115
+ * descending if "desc".
15116
+ *
15117
+ * @private
15118
+ * @param {Object} object The object to compare.
15119
+ * @param {Object} other The other object to compare.
15120
+ * @param {boolean[]} orders The order to sort by for each property.
15121
+ * @returns {number} Returns the sort order indicator for `object`.
15122
+ */
15123
+ function compareMultiple(object, other, orders) {
15124
+ var index = -1,
15125
+ objCriteria = object.criteria,
15126
+ othCriteria = other.criteria,
15127
+ length = objCriteria.length,
15128
+ ordersLength = orders.length;
15129
+
15130
+ while (++index < length) {
15131
+ var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
15132
+ if (result) {
15133
+ if (index >= ordersLength) {
15134
+ return result;
15135
+ }
15136
+ var order = orders[index];
15137
+ return result * ((order === 'asc' || order === true) ? 1 : -1);
15138
+ }
15139
+ }
15140
+ // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
15141
+ // that causes it, under certain circumstances, to provide the same value for
15142
+ // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
15143
+ // for more details.
15144
+ //
15145
+ // This also ensures a stable sort in V8 and other engines.
15146
+ // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
15147
+ return object.index - other.index;
15148
+ }
15149
+
15150
+ /**
15151
+ * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
15152
+ *
15153
+ * @private
15154
+ * @param {string} letter The matched letter to deburr.
15155
+ * @returns {string} Returns the deburred letter.
15156
+ */
15157
+ function deburrLetter(letter) {
15158
+ return deburredLetters[letter];
15159
+ }
15160
+
15161
+ /**
15162
+ * Used by `_.escape` to convert characters to HTML entities.
15163
+ *
15164
+ * @private
15165
+ * @param {string} chr The matched character to escape.
15166
+ * @returns {string} Returns the escaped character.
15167
+ */
15168
+ function escapeHtmlChar(chr) {
15169
+ return htmlEscapes[chr];
15170
+ }
15171
+
15172
+ /**
15173
+ * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
15174
+ *
15175
+ * @private
15176
+ * @param {string} chr The matched character to escape.
15177
+ * @param {string} leadingChar The capture group for a leading character.
15178
+ * @param {string} whitespaceChar The capture group for a whitespace character.
15179
+ * @returns {string} Returns the escaped character.
15180
+ */
15181
+ function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
15182
+ if (leadingChar) {
15183
+ chr = regexpEscapes[chr];
15184
+ } else if (whitespaceChar) {
15185
+ chr = stringEscapes[chr];
15186
+ }
15187
+ return '\\' + chr;
15188
+ }
15189
+
15190
+ /**
15191
+ * Used by `_.template` to escape characters for inclusion in compiled string literals.
15192
+ *
15193
+ * @private
15194
+ * @param {string} chr The matched character to escape.
15195
+ * @returns {string} Returns the escaped character.
15196
+ */
15197
+ function escapeStringChar(chr) {
15198
+ return '\\' + stringEscapes[chr];
15199
+ }
15200
+
15201
+ /**
15202
+ * Gets the index at which the first occurrence of `NaN` is found in `array`.
15203
+ *
15204
+ * @private
15205
+ * @param {Array} array The array to search.
15206
+ * @param {number} fromIndex The index to search from.
15207
+ * @param {boolean} [fromRight] Specify iterating from right to left.
15208
+ * @returns {number} Returns the index of the matched `NaN`, else `-1`.
15209
+ */
15210
+ function indexOfNaN(array, fromIndex, fromRight) {
15211
+ var length = array.length,
15212
+ index = fromIndex + (fromRight ? 0 : -1);
15213
+
15214
+ while ((fromRight ? index-- : ++index < length)) {
15215
+ var other = array[index];
15216
+ if (other !== other) {
15217
+ return index;
15218
+ }
15219
+ }
15220
+ return -1;
15221
+ }
15222
+
15223
+ /**
15224
+ * Checks if `value` is object-like.
15225
+ *
15226
+ * @private
15227
+ * @param {*} value The value to check.
15228
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
15229
+ */
15230
+ function isObjectLike(value) {
15231
+ return !!value && typeof value == 'object';
15232
+ }
15233
+
15234
+ /**
15235
+ * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
15236
+ * character code is whitespace.
15237
+ *
15238
+ * @private
15239
+ * @param {number} charCode The character code to inspect.
15240
+ * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
15241
+ */
15242
+ function isSpace(charCode) {
15243
+ return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
15244
+ (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
15245
+ }
15246
+
15247
+ /**
15248
+ * Replaces all `placeholder` elements in `array` with an internal placeholder
15249
+ * and returns an array of their indexes.
15250
+ *
15251
+ * @private
15252
+ * @param {Array} array The array to modify.
15253
+ * @param {*} placeholder The placeholder to replace.
15254
+ * @returns {Array} Returns the new array of placeholder indexes.
15255
+ */
15256
+ function replaceHolders(array, placeholder) {
15257
+ var index = -1,
15258
+ length = array.length,
15259
+ resIndex = -1,
15260
+ result = [];
15261
+
15262
+ while (++index < length) {
15263
+ if (array[index] === placeholder) {
15264
+ array[index] = PLACEHOLDER;
15265
+ result[++resIndex] = index;
15266
+ }
15267
+ }
15268
+ return result;
15269
+ }
15270
+
15271
+ /**
15272
+ * An implementation of `_.uniq` optimized for sorted arrays without support
15273
+ * for callback shorthands and `this` binding.
15274
+ *
15275
+ * @private
15276
+ * @param {Array} array The array to inspect.
15277
+ * @param {Function} [iteratee] The function invoked per iteration.
15278
+ * @returns {Array} Returns the new duplicate-value-free array.
15279
+ */
15280
+ function sortedUniq(array, iteratee) {
15281
+ var seen,
15282
+ index = -1,
15283
+ length = array.length,
15284
+ resIndex = -1,
15285
+ result = [];
15286
+
15287
+ while (++index < length) {
15288
+ var value = array[index],
15289
+ computed = iteratee ? iteratee(value, index, array) : value;
15290
+
15291
+ if (!index || seen !== computed) {
15292
+ seen = computed;
15293
+ result[++resIndex] = value;
15294
+ }
15295
+ }
15296
+ return result;
15297
+ }
15298
+
15299
+ /**
15300
+ * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
15301
+ * character of `string`.
15302
+ *
15303
+ * @private
15304
+ * @param {string} string The string to inspect.
15305
+ * @returns {number} Returns the index of the first non-whitespace character.
15306
+ */
15307
+ function trimmedLeftIndex(string) {
15308
+ var index = -1,
15309
+ length = string.length;
15310
+
15311
+ while (++index < length && isSpace(string.charCodeAt(index))) {}
15312
+ return index;
15313
+ }
15314
+
15315
+ /**
15316
+ * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
15317
+ * character of `string`.
15318
+ *
15319
+ * @private
15320
+ * @param {string} string The string to inspect.
15321
+ * @returns {number} Returns the index of the last non-whitespace character.
15322
+ */
15323
+ function trimmedRightIndex(string) {
15324
+ var index = string.length;
15325
+
15326
+ while (index-- && isSpace(string.charCodeAt(index))) {}
15327
+ return index;
15328
+ }
15329
+
15330
+ /**
15331
+ * Used by `_.unescape` to convert HTML entities to characters.
15332
+ *
15333
+ * @private
15334
+ * @param {string} chr The matched character to unescape.
15335
+ * @returns {string} Returns the unescaped character.
15336
+ */
15337
+ function unescapeHtmlChar(chr) {
15338
+ return htmlUnescapes[chr];
15339
+ }
15340
+
15341
+ /*--------------------------------------------------------------------------*/
15342
+
15343
+ /**
15344
+ * Create a new pristine `lodash` function using the given `context` object.
15345
+ *
15346
+ * @static
15347
+ * @memberOf _
15348
+ * @category Utility
15349
+ * @param {Object} [context=root] The context object.
15350
+ * @returns {Function} Returns a new `lodash` function.
15351
+ * @example
15352
+ *
15353
+ * _.mixin({ 'foo': _.constant('foo') });
15354
+ *
15355
+ * var lodash = _.runInContext();
15356
+ * lodash.mixin({ 'bar': lodash.constant('bar') });
15357
+ *
15358
+ * _.isFunction(_.foo);
15359
+ * // => true
15360
+ * _.isFunction(_.bar);
15361
+ * // => false
15362
+ *
15363
+ * lodash.isFunction(lodash.foo);
15364
+ * // => false
15365
+ * lodash.isFunction(lodash.bar);
15366
+ * // => true
15367
+ *
15368
+ * // using `context` to mock `Date#getTime` use in `_.now`
15369
+ * var mock = _.runInContext({
15370
+ * 'Date': function() {
15371
+ * return { 'getTime': getTimeMock };
15372
+ * }
15373
+ * });
15374
+ *
15375
+ * // or creating a suped-up `defer` in Node.js
15376
+ * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
15377
+ */
15378
+ function runInContext(context) {
15379
+ // Avoid issues with some ES3 environments that attempt to use values, named
15380
+ // after built-in constructors like `Object`, for the creation of literals.
15381
+ // ES5 clears this up by stating that literals must use built-in constructors.
15382
+ // See https://es5.github.io/#x11.1.5 for more details.
15383
+ context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
15384
+
15385
+ /** Native constructor references. */
15386
+ var Array = context.Array,
15387
+ Date = context.Date,
15388
+ Error = context.Error,
15389
+ Function = context.Function,
15390
+ Math = context.Math,
15391
+ Number = context.Number,
15392
+ Object = context.Object,
15393
+ RegExp = context.RegExp,
15394
+ String = context.String,
15395
+ TypeError = context.TypeError;
15396
+
15397
+ /** Used for native method references. */
15398
+ var arrayProto = Array.prototype,
15399
+ objectProto = Object.prototype,
15400
+ stringProto = String.prototype;
15401
+
15402
+ /** Used to resolve the decompiled source of functions. */
15403
+ var fnToString = Function.prototype.toString;
15404
+
15405
+ /** Used to check objects for own properties. */
15406
+ var hasOwnProperty = objectProto.hasOwnProperty;
15407
+
15408
+ /** Used to generate unique IDs. */
15409
+ var idCounter = 0;
15410
+
15411
+ /**
15412
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
15413
+ * of values.
15414
+ */
15415
+ var objToString = objectProto.toString;
15416
+
15417
+ /** Used to restore the original `_` reference in `_.noConflict`. */
15418
+ var oldDash = root._;
15419
+
15420
+ /** Used to detect if a method is native. */
15421
+ var reIsNative = RegExp('^' +
15422
+ fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
15423
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
15424
+ );
15425
+
15426
+ /** Native method references. */
15427
+ var ArrayBuffer = context.ArrayBuffer,
15428
+ clearTimeout = context.clearTimeout,
15429
+ parseFloat = context.parseFloat,
15430
+ pow = Math.pow,
15431
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
15432
+ Set = getNative(context, 'Set'),
15433
+ setTimeout = context.setTimeout,
15434
+ splice = arrayProto.splice,
15435
+ Uint8Array = context.Uint8Array,
15436
+ WeakMap = getNative(context, 'WeakMap');
15437
+
15438
+ /* Native method references for those with the same name as other `lodash` methods. */
15439
+ var nativeCeil = Math.ceil,
15440
+ nativeCreate = getNative(Object, 'create'),
15441
+ nativeFloor = Math.floor,
15442
+ nativeIsArray = getNative(Array, 'isArray'),
15443
+ nativeIsFinite = context.isFinite,
15444
+ nativeKeys = getNative(Object, 'keys'),
15445
+ nativeMax = Math.max,
15446
+ nativeMin = Math.min,
15447
+ nativeNow = getNative(Date, 'now'),
15448
+ nativeParseInt = context.parseInt,
15449
+ nativeRandom = Math.random;
15450
+
15451
+ /** Used as references for `-Infinity` and `Infinity`. */
15452
+ var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
15453
+ POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
15454
+
15455
+ /** Used as references for the maximum length and index of an array. */
15456
+ var MAX_ARRAY_LENGTH = 4294967295,
15457
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
15458
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
15459
+
15460
+ /**
15461
+ * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
15462
+ * of an array-like value.
15463
+ */
15464
+ var MAX_SAFE_INTEGER = 9007199254740991;
15465
+
15466
+ /** Used to store function metadata. */
15467
+ var metaMap = WeakMap && new WeakMap;
15468
+
15469
+ /** Used to lookup unminified function names. */
15470
+ var realNames = {};
15471
+
15472
+ /*------------------------------------------------------------------------*/
15473
+
15474
+ /**
15475
+ * Creates a `lodash` object which wraps `value` to enable implicit chaining.
15476
+ * Methods that operate on and return arrays, collections, and functions can
15477
+ * be chained together. Methods that retrieve a single value or may return a
15478
+ * primitive value will automatically end the chain returning the unwrapped
15479
+ * value. Explicit chaining may be enabled using `_.chain`. The execution of
15480
+ * chained methods is lazy, that is, execution is deferred until `_#value`
15481
+ * is implicitly or explicitly called.
15482
+ *
15483
+ * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
15484
+ * fusion is an optimization strategy which merge iteratee calls; this can help
15485
+ * to avoid the creation of intermediate data structures and greatly reduce the
15486
+ * number of iteratee executions.
15487
+ *
15488
+ * Chaining is supported in custom builds as long as the `_#value` method is
15489
+ * directly or indirectly included in the build.
15490
+ *
15491
+ * In addition to lodash methods, wrappers have `Array` and `String` methods.
15492
+ *
15493
+ * The wrapper `Array` methods are:
15494
+ * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
15495
+ * `splice`, and `unshift`
15496
+ *
15497
+ * The wrapper `String` methods are:
15498
+ * `replace` and `split`
15499
+ *
15500
+ * The wrapper methods that support shortcut fusion are:
15501
+ * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
15502
+ * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
15503
+ * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
15504
+ * and `where`
15505
+ *
15506
+ * The chainable wrapper methods are:
15507
+ * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
15508
+ * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
15509
+ * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
15510
+ * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
15511
+ * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
15512
+ * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
15513
+ * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
15514
+ * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
15515
+ * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
15516
+ * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
15517
+ * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
15518
+ * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
15519
+ * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
15520
+ * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
15521
+ * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
15522
+ * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
15523
+ * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
15524
+ *
15525
+ * The wrapper methods that are **not** chainable by default are:
15526
+ * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
15527
+ * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
15528
+ * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
15529
+ * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
15530
+ * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
15531
+ * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
15532
+ * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
15533
+ * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
15534
+ * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
15535
+ * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
15536
+ * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
15537
+ * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
15538
+ * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
15539
+ * `unescape`, `uniqueId`, `value`, and `words`
15540
+ *
15541
+ * The wrapper method `sample` will return a wrapped value when `n` is provided,
15542
+ * otherwise an unwrapped value is returned.
15543
+ *
15544
+ * @name _
15545
+ * @constructor
15546
+ * @category Chain
15547
+ * @param {*} value The value to wrap in a `lodash` instance.
15548
+ * @returns {Object} Returns the new `lodash` wrapper instance.
15549
+ * @example
15550
+ *
15551
+ * var wrapped = _([1, 2, 3]);
15552
+ *
15553
+ * // returns an unwrapped value
15554
+ * wrapped.reduce(function(total, n) {
15555
+ * return total + n;
15556
+ * });
15557
+ * // => 6
15558
+ *
15559
+ * // returns a wrapped value
15560
+ * var squares = wrapped.map(function(n) {
15561
+ * return n * n;
15562
+ * });
15563
+ *
15564
+ * _.isArray(squares);
15565
+ * // => false
15566
+ *
15567
+ * _.isArray(squares.value());
15568
+ * // => true
15569
+ */
15570
+ function lodash(value) {
15571
+ if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
15572
+ if (value instanceof LodashWrapper) {
15573
+ return value;
15574
+ }
15575
+ if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
15576
+ return wrapperClone(value);
15577
+ }
15578
+ }
15579
+ return new LodashWrapper(value);
15580
+ }
15581
+
15582
+ /**
15583
+ * The function whose prototype all chaining wrappers inherit from.
15584
+ *
15585
+ * @private
15586
+ */
15587
+ function baseLodash() {
15588
+ // No operation performed.
15589
+ }
15590
+
15591
+ /**
15592
+ * The base constructor for creating `lodash` wrapper objects.
15593
+ *
15594
+ * @private
15595
+ * @param {*} value The value to wrap.
15596
+ * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
15597
+ * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
15598
+ */
15599
+ function LodashWrapper(value, chainAll, actions) {
15600
+ this.__wrapped__ = value;
15601
+ this.__actions__ = actions || [];
15602
+ this.__chain__ = !!chainAll;
15603
+ }
15604
+
15605
+ /**
15606
+ * An object environment feature flags.
15607
+ *
15608
+ * @static
15609
+ * @memberOf _
15610
+ * @type Object
15611
+ */
15612
+ var support = lodash.support = {};
15613
+
15614
+ /**
15615
+ * By default, the template delimiters used by lodash are like those in
15616
+ * embedded Ruby (ERB). Change the following template settings to use
15617
+ * alternative delimiters.
15618
+ *
15619
+ * @static
15620
+ * @memberOf _
15621
+ * @type Object
15622
+ */
15623
+ lodash.templateSettings = {
15624
+
15625
+ /**
15626
+ * Used to detect `data` property values to be HTML-escaped.
15627
+ *
15628
+ * @memberOf _.templateSettings
15629
+ * @type RegExp
15630
+ */
15631
+ 'escape': reEscape,
15632
+
15633
+ /**
15634
+ * Used to detect code to be evaluated.
15635
+ *
15636
+ * @memberOf _.templateSettings
15637
+ * @type RegExp
15638
+ */
15639
+ 'evaluate': reEvaluate,
15640
+
15641
+ /**
15642
+ * Used to detect `data` property values to inject.
15643
+ *
15644
+ * @memberOf _.templateSettings
15645
+ * @type RegExp
15646
+ */
15647
+ 'interpolate': reInterpolate,
15648
+
15649
+ /**
15650
+ * Used to reference the data object in the template text.
15651
+ *
15652
+ * @memberOf _.templateSettings
15653
+ * @type string
15654
+ */
15655
+ 'variable': '',
15656
+
15657
+ /**
15658
+ * Used to import variables into the compiled template.
15659
+ *
15660
+ * @memberOf _.templateSettings
15661
+ * @type Object
15662
+ */
15663
+ 'imports': {
15664
+
15665
+ /**
15666
+ * A reference to the `lodash` function.
15667
+ *
15668
+ * @memberOf _.templateSettings.imports
15669
+ * @type Function
15670
+ */
15671
+ '_': lodash
15672
+ }
15673
+ };
15674
+
15675
+ /*------------------------------------------------------------------------*/
15676
+
15677
+ /**
15678
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
15679
+ *
15680
+ * @private
15681
+ * @param {*} value The value to wrap.
15682
+ */
15683
+ function LazyWrapper(value) {
15684
+ this.__wrapped__ = value;
15685
+ this.__actions__ = [];
15686
+ this.__dir__ = 1;
15687
+ this.__filtered__ = false;
15688
+ this.__iteratees__ = [];
15689
+ this.__takeCount__ = POSITIVE_INFINITY;
15690
+ this.__views__ = [];
15691
+ }
15692
+
15693
+ /**
15694
+ * Creates a clone of the lazy wrapper object.
15695
+ *
15696
+ * @private
15697
+ * @name clone
15698
+ * @memberOf LazyWrapper
15699
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
15700
+ */
15701
+ function lazyClone() {
15702
+ var result = new LazyWrapper(this.__wrapped__);
15703
+ result.__actions__ = arrayCopy(this.__actions__);
15704
+ result.__dir__ = this.__dir__;
15705
+ result.__filtered__ = this.__filtered__;
15706
+ result.__iteratees__ = arrayCopy(this.__iteratees__);
15707
+ result.__takeCount__ = this.__takeCount__;
15708
+ result.__views__ = arrayCopy(this.__views__);
15709
+ return result;
15710
+ }
15711
+
15712
+ /**
15713
+ * Reverses the direction of lazy iteration.
15714
+ *
15715
+ * @private
15716
+ * @name reverse
15717
+ * @memberOf LazyWrapper
15718
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
15719
+ */
15720
+ function lazyReverse() {
15721
+ if (this.__filtered__) {
15722
+ var result = new LazyWrapper(this);
15723
+ result.__dir__ = -1;
15724
+ result.__filtered__ = true;
15725
+ } else {
15726
+ result = this.clone();
15727
+ result.__dir__ *= -1;
15728
+ }
15729
+ return result;
15730
+ }
15731
+
15732
+ /**
15733
+ * Extracts the unwrapped value from its lazy wrapper.
15734
+ *
15735
+ * @private
15736
+ * @name value
15737
+ * @memberOf LazyWrapper
15738
+ * @returns {*} Returns the unwrapped value.
15739
+ */
15740
+ function lazyValue() {
15741
+ var array = this.__wrapped__.value(),
15742
+ dir = this.__dir__,
15743
+ isArr = isArray(array),
15744
+ isRight = dir < 0,
15745
+ arrLength = isArr ? array.length : 0,
15746
+ view = getView(0, arrLength, this.__views__),
15747
+ start = view.start,
15748
+ end = view.end,
15749
+ length = end - start,
15750
+ index = isRight ? end : (start - 1),
15751
+ iteratees = this.__iteratees__,
15752
+ iterLength = iteratees.length,
15753
+ resIndex = 0,
15754
+ takeCount = nativeMin(length, this.__takeCount__);
15755
+
15756
+ if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
15757
+ return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
15758
+ }
15759
+ var result = [];
15760
+
15761
+ outer:
15762
+ while (length-- && resIndex < takeCount) {
15763
+ index += dir;
15764
+
15765
+ var iterIndex = -1,
15766
+ value = array[index];
15767
+
15768
+ while (++iterIndex < iterLength) {
15769
+ var data = iteratees[iterIndex],
15770
+ iteratee = data.iteratee,
15771
+ type = data.type,
15772
+ computed = iteratee(value);
15773
+
15774
+ if (type == LAZY_MAP_FLAG) {
15775
+ value = computed;
15776
+ } else if (!computed) {
15777
+ if (type == LAZY_FILTER_FLAG) {
15778
+ continue outer;
15779
+ } else {
15780
+ break outer;
15781
+ }
15782
+ }
15783
+ }
15784
+ result[resIndex++] = value;
15785
+ }
15786
+ return result;
15787
+ }
15788
+
15789
+ /*------------------------------------------------------------------------*/
15790
+
15791
+ /**
15792
+ * Creates a cache object to store key/value pairs.
15793
+ *
15794
+ * @private
15795
+ * @static
15796
+ * @name Cache
15797
+ * @memberOf _.memoize
15798
+ */
15799
+ function MapCache() {
15800
+ this.__data__ = {};
15801
+ }
15802
+
15803
+ /**
15804
+ * Removes `key` and its value from the cache.
15805
+ *
15806
+ * @private
15807
+ * @name delete
15808
+ * @memberOf _.memoize.Cache
15809
+ * @param {string} key The key of the value to remove.
15810
+ * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
15811
+ */
15812
+ function mapDelete(key) {
15813
+ return this.has(key) && delete this.__data__[key];
15814
+ }
15815
+
15816
+ /**
15817
+ * Gets the cached value for `key`.
15818
+ *
15819
+ * @private
15820
+ * @name get
15821
+ * @memberOf _.memoize.Cache
15822
+ * @param {string} key The key of the value to get.
15823
+ * @returns {*} Returns the cached value.
15824
+ */
15825
+ function mapGet(key) {
15826
+ return key == '__proto__' ? undefined : this.__data__[key];
15827
+ }
15828
+
15829
+ /**
15830
+ * Checks if a cached value for `key` exists.
15831
+ *
15832
+ * @private
15833
+ * @name has
15834
+ * @memberOf _.memoize.Cache
15835
+ * @param {string} key The key of the entry to check.
15836
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
15837
+ */
15838
+ function mapHas(key) {
15839
+ return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
15840
+ }
15841
+
15842
+ /**
15843
+ * Sets `value` to `key` of the cache.
15844
+ *
15845
+ * @private
15846
+ * @name set
15847
+ * @memberOf _.memoize.Cache
15848
+ * @param {string} key The key of the value to cache.
15849
+ * @param {*} value The value to cache.
15850
+ * @returns {Object} Returns the cache object.
15851
+ */
15852
+ function mapSet(key, value) {
15853
+ if (key != '__proto__') {
15854
+ this.__data__[key] = value;
15855
+ }
15856
+ return this;
15857
+ }
15858
+
15859
+ /*------------------------------------------------------------------------*/
15860
+
15861
+ /**
15862
+ *
15863
+ * Creates a cache object to store unique values.
15864
+ *
15865
+ * @private
15866
+ * @param {Array} [values] The values to cache.
15867
+ */
15868
+ function SetCache(values) {
15869
+ var length = values ? values.length : 0;
15870
+
15871
+ this.data = { 'hash': nativeCreate(null), 'set': new Set };
15872
+ while (length--) {
15873
+ this.push(values[length]);
15874
+ }
15875
+ }
15876
+
15877
+ /**
15878
+ * Checks if `value` is in `cache` mimicking the return signature of
15879
+ * `_.indexOf` by returning `0` if the value is found, else `-1`.
15880
+ *
15881
+ * @private
15882
+ * @param {Object} cache The cache to search.
15883
+ * @param {*} value The value to search for.
15884
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
15885
+ */
15886
+ function cacheIndexOf(cache, value) {
15887
+ var data = cache.data,
15888
+ result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
15889
+
15890
+ return result ? 0 : -1;
15891
+ }
15892
+
15893
+ /**
15894
+ * Adds `value` to the cache.
15895
+ *
15896
+ * @private
15897
+ * @name push
15898
+ * @memberOf SetCache
15899
+ * @param {*} value The value to cache.
15900
+ */
15901
+ function cachePush(value) {
15902
+ var data = this.data;
15903
+ if (typeof value == 'string' || isObject(value)) {
15904
+ data.set.add(value);
15905
+ } else {
15906
+ data.hash[value] = true;
15907
+ }
15908
+ }
15909
+
15910
+ /*------------------------------------------------------------------------*/
15911
+
15912
+ /**
15913
+ * Creates a new array joining `array` with `other`.
15914
+ *
15915
+ * @private
15916
+ * @param {Array} array The array to join.
15917
+ * @param {Array} other The other array to join.
15918
+ * @returns {Array} Returns the new concatenated array.
15919
+ */
15920
+ function arrayConcat(array, other) {
15921
+ var index = -1,
15922
+ length = array.length,
15923
+ othIndex = -1,
15924
+ othLength = other.length,
15925
+ result = Array(length + othLength);
15926
+
15927
+ while (++index < length) {
15928
+ result[index] = array[index];
15929
+ }
15930
+ while (++othIndex < othLength) {
15931
+ result[index++] = other[othIndex];
15932
+ }
15933
+ return result;
15934
+ }
15935
+
15936
+ /**
15937
+ * Copies the values of `source` to `array`.
15938
+ *
15939
+ * @private
15940
+ * @param {Array} source The array to copy values from.
15941
+ * @param {Array} [array=[]] The array to copy values to.
15942
+ * @returns {Array} Returns `array`.
15943
+ */
15944
+ function arrayCopy(source, array) {
15945
+ var index = -1,
15946
+ length = source.length;
15947
+
15948
+ array || (array = Array(length));
15949
+ while (++index < length) {
15950
+ array[index] = source[index];
15951
+ }
15952
+ return array;
15953
+ }
15954
+
15955
+ /**
15956
+ * A specialized version of `_.forEach` for arrays without support for callback
15957
+ * shorthands and `this` binding.
15958
+ *
15959
+ * @private
15960
+ * @param {Array} array The array to iterate over.
15961
+ * @param {Function} iteratee The function invoked per iteration.
15962
+ * @returns {Array} Returns `array`.
15963
+ */
15964
+ function arrayEach(array, iteratee) {
15965
+ var index = -1,
15966
+ length = array.length;
15967
+
15968
+ while (++index < length) {
15969
+ if (iteratee(array[index], index, array) === false) {
15970
+ break;
15971
+ }
15972
+ }
15973
+ return array;
15974
+ }
15975
+
15976
+ /**
15977
+ * A specialized version of `_.forEachRight` for arrays without support for
15978
+ * callback shorthands and `this` binding.
15979
+ *
15980
+ * @private
15981
+ * @param {Array} array The array to iterate over.
15982
+ * @param {Function} iteratee The function invoked per iteration.
15983
+ * @returns {Array} Returns `array`.
15984
+ */
15985
+ function arrayEachRight(array, iteratee) {
15986
+ var length = array.length;
15987
+
15988
+ while (length--) {
15989
+ if (iteratee(array[length], length, array) === false) {
15990
+ break;
15991
+ }
15992
+ }
15993
+ return array;
15994
+ }
15995
+
15996
+ /**
15997
+ * A specialized version of `_.every` for arrays without support for callback
15998
+ * shorthands and `this` binding.
15999
+ *
16000
+ * @private
16001
+ * @param {Array} array The array to iterate over.
16002
+ * @param {Function} predicate The function invoked per iteration.
16003
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
16004
+ * else `false`.
16005
+ */
16006
+ function arrayEvery(array, predicate) {
16007
+ var index = -1,
16008
+ length = array.length;
16009
+
16010
+ while (++index < length) {
16011
+ if (!predicate(array[index], index, array)) {
16012
+ return false;
16013
+ }
16014
+ }
16015
+ return true;
16016
+ }
16017
+
16018
+ /**
16019
+ * A specialized version of `baseExtremum` for arrays which invokes `iteratee`
16020
+ * with one argument: (value).
16021
+ *
16022
+ * @private
16023
+ * @param {Array} array The array to iterate over.
16024
+ * @param {Function} iteratee The function invoked per iteration.
16025
+ * @param {Function} comparator The function used to compare values.
16026
+ * @param {*} exValue The initial extremum value.
16027
+ * @returns {*} Returns the extremum value.
16028
+ */
16029
+ function arrayExtremum(array, iteratee, comparator, exValue) {
16030
+ var index = -1,
16031
+ length = array.length,
16032
+ computed = exValue,
16033
+ result = computed;
16034
+
16035
+ while (++index < length) {
16036
+ var value = array[index],
16037
+ current = +iteratee(value);
16038
+
16039
+ if (comparator(current, computed)) {
16040
+ computed = current;
16041
+ result = value;
16042
+ }
16043
+ }
16044
+ return result;
16045
+ }
16046
+
16047
+ /**
16048
+ * A specialized version of `_.filter` for arrays without support for callback
16049
+ * shorthands and `this` binding.
16050
+ *
16051
+ * @private
16052
+ * @param {Array} array The array to iterate over.
16053
+ * @param {Function} predicate The function invoked per iteration.
16054
+ * @returns {Array} Returns the new filtered array.
16055
+ */
16056
+ function arrayFilter(array, predicate) {
16057
+ var index = -1,
16058
+ length = array.length,
16059
+ resIndex = -1,
16060
+ result = [];
16061
+
16062
+ while (++index < length) {
16063
+ var value = array[index];
16064
+ if (predicate(value, index, array)) {
16065
+ result[++resIndex] = value;
16066
+ }
16067
+ }
16068
+ return result;
16069
+ }
16070
+
16071
+ /**
16072
+ * A specialized version of `_.map` for arrays without support for callback
16073
+ * shorthands and `this` binding.
16074
+ *
16075
+ * @private
16076
+ * @param {Array} array The array to iterate over.
16077
+ * @param {Function} iteratee The function invoked per iteration.
16078
+ * @returns {Array} Returns the new mapped array.
16079
+ */
16080
+ function arrayMap(array, iteratee) {
16081
+ var index = -1,
16082
+ length = array.length,
16083
+ result = Array(length);
16084
+
16085
+ while (++index < length) {
16086
+ result[index] = iteratee(array[index], index, array);
16087
+ }
16088
+ return result;
16089
+ }
16090
+
16091
+ /**
16092
+ * Appends the elements of `values` to `array`.
16093
+ *
16094
+ * @private
16095
+ * @param {Array} array The array to modify.
16096
+ * @param {Array} values The values to append.
16097
+ * @returns {Array} Returns `array`.
16098
+ */
16099
+ function arrayPush(array, values) {
16100
+ var index = -1,
16101
+ length = values.length,
16102
+ offset = array.length;
16103
+
16104
+ while (++index < length) {
16105
+ array[offset + index] = values[index];
16106
+ }
16107
+ return array;
16108
+ }
16109
+
16110
+ /**
16111
+ * A specialized version of `_.reduce` for arrays without support for callback
16112
+ * shorthands and `this` binding.
16113
+ *
16114
+ * @private
16115
+ * @param {Array} array The array to iterate over.
16116
+ * @param {Function} iteratee The function invoked per iteration.
16117
+ * @param {*} [accumulator] The initial value.
16118
+ * @param {boolean} [initFromArray] Specify using the first element of `array`
16119
+ * as the initial value.
16120
+ * @returns {*} Returns the accumulated value.
16121
+ */
16122
+ function arrayReduce(array, iteratee, accumulator, initFromArray) {
16123
+ var index = -1,
16124
+ length = array.length;
16125
+
16126
+ if (initFromArray && length) {
16127
+ accumulator = array[++index];
16128
+ }
16129
+ while (++index < length) {
16130
+ accumulator = iteratee(accumulator, array[index], index, array);
16131
+ }
16132
+ return accumulator;
16133
+ }
16134
+
16135
+ /**
16136
+ * A specialized version of `_.reduceRight` for arrays without support for
16137
+ * callback shorthands and `this` binding.
16138
+ *
16139
+ * @private
16140
+ * @param {Array} array The array to iterate over.
16141
+ * @param {Function} iteratee The function invoked per iteration.
16142
+ * @param {*} [accumulator] The initial value.
16143
+ * @param {boolean} [initFromArray] Specify using the last element of `array`
16144
+ * as the initial value.
16145
+ * @returns {*} Returns the accumulated value.
16146
+ */
16147
+ function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
16148
+ var length = array.length;
16149
+ if (initFromArray && length) {
16150
+ accumulator = array[--length];
16151
+ }
16152
+ while (length--) {
16153
+ accumulator = iteratee(accumulator, array[length], length, array);
16154
+ }
16155
+ return accumulator;
16156
+ }
16157
+
16158
+ /**
16159
+ * A specialized version of `_.some` for arrays without support for callback
16160
+ * shorthands and `this` binding.
16161
+ *
16162
+ * @private
16163
+ * @param {Array} array The array to iterate over.
16164
+ * @param {Function} predicate The function invoked per iteration.
16165
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
16166
+ * else `false`.
16167
+ */
16168
+ function arraySome(array, predicate) {
16169
+ var index = -1,
16170
+ length = array.length;
16171
+
16172
+ while (++index < length) {
16173
+ if (predicate(array[index], index, array)) {
16174
+ return true;
16175
+ }
16176
+ }
16177
+ return false;
16178
+ }
16179
+
16180
+ /**
16181
+ * A specialized version of `_.sum` for arrays without support for callback
16182
+ * shorthands and `this` binding..
16183
+ *
16184
+ * @private
16185
+ * @param {Array} array The array to iterate over.
16186
+ * @param {Function} iteratee The function invoked per iteration.
16187
+ * @returns {number} Returns the sum.
16188
+ */
16189
+ function arraySum(array, iteratee) {
16190
+ var length = array.length,
16191
+ result = 0;
16192
+
16193
+ while (length--) {
16194
+ result += +iteratee(array[length]) || 0;
16195
+ }
16196
+ return result;
16197
+ }
16198
+
16199
+ /**
16200
+ * Used by `_.defaults` to customize its `_.assign` use.
16201
+ *
16202
+ * @private
16203
+ * @param {*} objectValue The destination object property value.
16204
+ * @param {*} sourceValue The source object property value.
16205
+ * @returns {*} Returns the value to assign to the destination object.
16206
+ */
16207
+ function assignDefaults(objectValue, sourceValue) {
16208
+ return objectValue === undefined ? sourceValue : objectValue;
16209
+ }
16210
+
16211
+ /**
16212
+ * Used by `_.template` to customize its `_.assign` use.
16213
+ *
16214
+ * **Note:** This function is like `assignDefaults` except that it ignores
16215
+ * inherited property values when checking if a property is `undefined`.
16216
+ *
16217
+ * @private
16218
+ * @param {*} objectValue The destination object property value.
16219
+ * @param {*} sourceValue The source object property value.
16220
+ * @param {string} key The key associated with the object and source values.
16221
+ * @param {Object} object The destination object.
16222
+ * @returns {*} Returns the value to assign to the destination object.
16223
+ */
16224
+ function assignOwnDefaults(objectValue, sourceValue, key, object) {
16225
+ return (objectValue === undefined || !hasOwnProperty.call(object, key))
16226
+ ? sourceValue
16227
+ : objectValue;
16228
+ }
16229
+
16230
+ /**
16231
+ * A specialized version of `_.assign` for customizing assigned values without
16232
+ * support for argument juggling, multiple sources, and `this` binding `customizer`
16233
+ * functions.
16234
+ *
16235
+ * @private
16236
+ * @param {Object} object The destination object.
16237
+ * @param {Object} source The source object.
16238
+ * @param {Function} customizer The function to customize assigned values.
16239
+ * @returns {Object} Returns `object`.
16240
+ */
16241
+ function assignWith(object, source, customizer) {
16242
+ var index = -1,
16243
+ props = keys(source),
16244
+ length = props.length;
16245
+
16246
+ while (++index < length) {
16247
+ var key = props[index],
16248
+ value = object[key],
16249
+ result = customizer(value, source[key], key, object, source);
16250
+
16251
+ if ((result === result ? (result !== value) : (value === value)) ||
16252
+ (value === undefined && !(key in object))) {
16253
+ object[key] = result;
16254
+ }
16255
+ }
16256
+ return object;
16257
+ }
16258
+
16259
+ /**
16260
+ * The base implementation of `_.assign` without support for argument juggling,
16261
+ * multiple sources, and `customizer` functions.
16262
+ *
16263
+ * @private
16264
+ * @param {Object} object The destination object.
16265
+ * @param {Object} source The source object.
16266
+ * @returns {Object} Returns `object`.
16267
+ */
16268
+ function baseAssign(object, source) {
16269
+ return source == null
16270
+ ? object
16271
+ : baseCopy(source, keys(source), object);
16272
+ }
16273
+
16274
+ /**
16275
+ * The base implementation of `_.at` without support for string collections
16276
+ * and individual key arguments.
16277
+ *
16278
+ * @private
16279
+ * @param {Array|Object} collection The collection to iterate over.
16280
+ * @param {number[]|string[]} props The property names or indexes of elements to pick.
16281
+ * @returns {Array} Returns the new array of picked elements.
16282
+ */
16283
+ function baseAt(collection, props) {
16284
+ var index = -1,
16285
+ isNil = collection == null,
16286
+ isArr = !isNil && isArrayLike(collection),
16287
+ length = isArr ? collection.length : 0,
16288
+ propsLength = props.length,
16289
+ result = Array(propsLength);
16290
+
16291
+ while(++index < propsLength) {
16292
+ var key = props[index];
16293
+ if (isArr) {
16294
+ result[index] = isIndex(key, length) ? collection[key] : undefined;
16295
+ } else {
16296
+ result[index] = isNil ? undefined : collection[key];
16297
+ }
16298
+ }
16299
+ return result;
16300
+ }
16301
+
16302
+ /**
16303
+ * Copies properties of `source` to `object`.
16304
+ *
16305
+ * @private
16306
+ * @param {Object} source The object to copy properties from.
16307
+ * @param {Array} props The property names to copy.
16308
+ * @param {Object} [object={}] The object to copy properties to.
16309
+ * @returns {Object} Returns `object`.
16310
+ */
16311
+ function baseCopy(source, props, object) {
16312
+ object || (object = {});
16313
+
16314
+ var index = -1,
16315
+ length = props.length;
16316
+
16317
+ while (++index < length) {
16318
+ var key = props[index];
16319
+ object[key] = source[key];
16320
+ }
16321
+ return object;
16322
+ }
16323
+
16324
+ /**
16325
+ * The base implementation of `_.callback` which supports specifying the
16326
+ * number of arguments to provide to `func`.
16327
+ *
16328
+ * @private
16329
+ * @param {*} [func=_.identity] The value to convert to a callback.
16330
+ * @param {*} [thisArg] The `this` binding of `func`.
16331
+ * @param {number} [argCount] The number of arguments to provide to `func`.
16332
+ * @returns {Function} Returns the callback.
16333
+ */
16334
+ function baseCallback(func, thisArg, argCount) {
16335
+ var type = typeof func;
16336
+ if (type == 'function') {
16337
+ return thisArg === undefined
16338
+ ? func
16339
+ : bindCallback(func, thisArg, argCount);
16340
+ }
16341
+ if (func == null) {
16342
+ return identity;
16343
+ }
16344
+ if (type == 'object') {
16345
+ return baseMatches(func);
16346
+ }
16347
+ return thisArg === undefined
16348
+ ? property(func)
16349
+ : baseMatchesProperty(func, thisArg);
16350
+ }
16351
+
16352
+ /**
16353
+ * The base implementation of `_.clone` without support for argument juggling
16354
+ * and `this` binding `customizer` functions.
16355
+ *
16356
+ * @private
16357
+ * @param {*} value The value to clone.
16358
+ * @param {boolean} [isDeep] Specify a deep clone.
16359
+ * @param {Function} [customizer] The function to customize cloning values.
16360
+ * @param {string} [key] The key of `value`.
16361
+ * @param {Object} [object] The object `value` belongs to.
16362
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
16363
+ * @param {Array} [stackB=[]] Associates clones with source counterparts.
16364
+ * @returns {*} Returns the cloned value.
16365
+ */
16366
+ function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
16367
+ var result;
16368
+ if (customizer) {
16369
+ result = object ? customizer(value, key, object) : customizer(value);
16370
+ }
16371
+ if (result !== undefined) {
16372
+ return result;
16373
+ }
16374
+ if (!isObject(value)) {
16375
+ return value;
16376
+ }
16377
+ var isArr = isArray(value);
16378
+ if (isArr) {
16379
+ result = initCloneArray(value);
16380
+ if (!isDeep) {
16381
+ return arrayCopy(value, result);
16382
+ }
16383
+ } else {
16384
+ var tag = objToString.call(value),
16385
+ isFunc = tag == funcTag;
16386
+
16387
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
16388
+ result = initCloneObject(isFunc ? {} : value);
16389
+ if (!isDeep) {
16390
+ return baseAssign(result, value);
16391
+ }
16392
+ } else {
16393
+ return cloneableTags[tag]
16394
+ ? initCloneByTag(value, tag, isDeep)
16395
+ : (object ? value : {});
16396
+ }
16397
+ }
16398
+ // Check for circular references and return its corresponding clone.
16399
+ stackA || (stackA = []);
16400
+ stackB || (stackB = []);
16401
+
16402
+ var length = stackA.length;
16403
+ while (length--) {
16404
+ if (stackA[length] == value) {
16405
+ return stackB[length];
16406
+ }
16407
+ }
16408
+ // Add the source value to the stack of traversed objects and associate it with its clone.
16409
+ stackA.push(value);
16410
+ stackB.push(result);
16411
+
16412
+ // Recursively populate clone (susceptible to call stack limits).
16413
+ (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
16414
+ result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
16415
+ });
16416
+ return result;
16417
+ }
16418
+
16419
+ /**
16420
+ * The base implementation of `_.create` without support for assigning
16421
+ * properties to the created object.
16422
+ *
16423
+ * @private
16424
+ * @param {Object} prototype The object to inherit from.
16425
+ * @returns {Object} Returns the new object.
16426
+ */
16427
+ var baseCreate = (function() {
16428
+ function object() {}
16429
+ return function(prototype) {
16430
+ if (isObject(prototype)) {
16431
+ object.prototype = prototype;
16432
+ var result = new object;
16433
+ object.prototype = undefined;
16434
+ }
16435
+ return result || {};
16436
+ };
16437
+ }());
16438
+
16439
+ /**
16440
+ * The base implementation of `_.delay` and `_.defer` which accepts an index
16441
+ * of where to slice the arguments to provide to `func`.
16442
+ *
16443
+ * @private
16444
+ * @param {Function} func The function to delay.
16445
+ * @param {number} wait The number of milliseconds to delay invocation.
16446
+ * @param {Object} args The arguments provide to `func`.
16447
+ * @returns {number} Returns the timer id.
16448
+ */
16449
+ function baseDelay(func, wait, args) {
16450
+ if (typeof func != 'function') {
16451
+ throw new TypeError(FUNC_ERROR_TEXT);
16452
+ }
16453
+ return setTimeout(function() { func.apply(undefined, args); }, wait);
16454
+ }
16455
+
16456
+ /**
16457
+ * The base implementation of `_.difference` which accepts a single array
16458
+ * of values to exclude.
16459
+ *
16460
+ * @private
16461
+ * @param {Array} array The array to inspect.
16462
+ * @param {Array} values The values to exclude.
16463
+ * @returns {Array} Returns the new array of filtered values.
16464
+ */
16465
+ function baseDifference(array, values) {
16466
+ var length = array ? array.length : 0,
16467
+ result = [];
16468
+
16469
+ if (!length) {
16470
+ return result;
16471
+ }
16472
+ var index = -1,
16473
+ indexOf = getIndexOf(),
16474
+ isCommon = indexOf == baseIndexOf,
16475
+ cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
16476
+ valuesLength = values.length;
16477
+
16478
+ if (cache) {
16479
+ indexOf = cacheIndexOf;
16480
+ isCommon = false;
16481
+ values = cache;
16482
+ }
16483
+ outer:
16484
+ while (++index < length) {
16485
+ var value = array[index];
16486
+
16487
+ if (isCommon && value === value) {
16488
+ var valuesIndex = valuesLength;
16489
+ while (valuesIndex--) {
16490
+ if (values[valuesIndex] === value) {
16491
+ continue outer;
16492
+ }
16493
+ }
16494
+ result.push(value);
16495
+ }
16496
+ else if (indexOf(values, value, 0) < 0) {
16497
+ result.push(value);
16498
+ }
16499
+ }
16500
+ return result;
16501
+ }
16502
+
16503
+ /**
16504
+ * The base implementation of `_.forEach` without support for callback
16505
+ * shorthands and `this` binding.
16506
+ *
16507
+ * @private
16508
+ * @param {Array|Object|string} collection The collection to iterate over.
16509
+ * @param {Function} iteratee The function invoked per iteration.
16510
+ * @returns {Array|Object|string} Returns `collection`.
16511
+ */
16512
+ var baseEach = createBaseEach(baseForOwn);
16513
+
16514
+ /**
16515
+ * The base implementation of `_.forEachRight` without support for callback
16516
+ * shorthands and `this` binding.
16517
+ *
16518
+ * @private
16519
+ * @param {Array|Object|string} collection The collection to iterate over.
16520
+ * @param {Function} iteratee The function invoked per iteration.
16521
+ * @returns {Array|Object|string} Returns `collection`.
16522
+ */
16523
+ var baseEachRight = createBaseEach(baseForOwnRight, true);
16524
+
16525
+ /**
16526
+ * The base implementation of `_.every` without support for callback
16527
+ * shorthands and `this` binding.
16528
+ *
16529
+ * @private
16530
+ * @param {Array|Object|string} collection The collection to iterate over.
16531
+ * @param {Function} predicate The function invoked per iteration.
16532
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
16533
+ * else `false`
16534
+ */
16535
+ function baseEvery(collection, predicate) {
16536
+ var result = true;
16537
+ baseEach(collection, function(value, index, collection) {
16538
+ result = !!predicate(value, index, collection);
16539
+ return result;
16540
+ });
16541
+ return result;
16542
+ }
16543
+
16544
+ /**
16545
+ * Gets the extremum value of `collection` invoking `iteratee` for each value
16546
+ * in `collection` to generate the criterion by which the value is ranked.
16547
+ * The `iteratee` is invoked with three arguments: (value, index|key, collection).
16548
+ *
16549
+ * @private
16550
+ * @param {Array|Object|string} collection The collection to iterate over.
16551
+ * @param {Function} iteratee The function invoked per iteration.
16552
+ * @param {Function} comparator The function used to compare values.
16553
+ * @param {*} exValue The initial extremum value.
16554
+ * @returns {*} Returns the extremum value.
16555
+ */
16556
+ function baseExtremum(collection, iteratee, comparator, exValue) {
16557
+ var computed = exValue,
16558
+ result = computed;
16559
+
16560
+ baseEach(collection, function(value, index, collection) {
16561
+ var current = +iteratee(value, index, collection);
16562
+ if (comparator(current, computed) || (current === exValue && current === result)) {
16563
+ computed = current;
16564
+ result = value;
16565
+ }
16566
+ });
16567
+ return result;
16568
+ }
16569
+
16570
+ /**
16571
+ * The base implementation of `_.fill` without an iteratee call guard.
16572
+ *
16573
+ * @private
16574
+ * @param {Array} array The array to fill.
16575
+ * @param {*} value The value to fill `array` with.
16576
+ * @param {number} [start=0] The start position.
16577
+ * @param {number} [end=array.length] The end position.
16578
+ * @returns {Array} Returns `array`.
16579
+ */
16580
+ function baseFill(array, value, start, end) {
16581
+ var length = array.length;
16582
+
16583
+ start = start == null ? 0 : (+start || 0);
16584
+ if (start < 0) {
16585
+ start = -start > length ? 0 : (length + start);
16586
+ }
16587
+ end = (end === undefined || end > length) ? length : (+end || 0);
16588
+ if (end < 0) {
16589
+ end += length;
16590
+ }
16591
+ length = start > end ? 0 : (end >>> 0);
16592
+ start >>>= 0;
16593
+
16594
+ while (start < length) {
16595
+ array[start++] = value;
16596
+ }
16597
+ return array;
16598
+ }
16599
+
16600
+ /**
16601
+ * The base implementation of `_.filter` without support for callback
16602
+ * shorthands and `this` binding.
16603
+ *
16604
+ * @private
16605
+ * @param {Array|Object|string} collection The collection to iterate over.
16606
+ * @param {Function} predicate The function invoked per iteration.
16607
+ * @returns {Array} Returns the new filtered array.
16608
+ */
16609
+ function baseFilter(collection, predicate) {
16610
+ var result = [];
16611
+ baseEach(collection, function(value, index, collection) {
16612
+ if (predicate(value, index, collection)) {
16613
+ result.push(value);
16614
+ }
16615
+ });
16616
+ return result;
16617
+ }
16618
+
16619
+ /**
16620
+ * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
16621
+ * without support for callback shorthands and `this` binding, which iterates
16622
+ * over `collection` using the provided `eachFunc`.
16623
+ *
16624
+ * @private
16625
+ * @param {Array|Object|string} collection The collection to search.
16626
+ * @param {Function} predicate The function invoked per iteration.
16627
+ * @param {Function} eachFunc The function to iterate over `collection`.
16628
+ * @param {boolean} [retKey] Specify returning the key of the found element
16629
+ * instead of the element itself.
16630
+ * @returns {*} Returns the found element or its key, else `undefined`.
16631
+ */
16632
+ function baseFind(collection, predicate, eachFunc, retKey) {
16633
+ var result;
16634
+ eachFunc(collection, function(value, key, collection) {
16635
+ if (predicate(value, key, collection)) {
16636
+ result = retKey ? key : value;
16637
+ return false;
16638
+ }
16639
+ });
16640
+ return result;
16641
+ }
16642
+
16643
+ /**
16644
+ * The base implementation of `_.flatten` with added support for restricting
16645
+ * flattening and specifying the start index.
16646
+ *
16647
+ * @private
16648
+ * @param {Array} array The array to flatten.
16649
+ * @param {boolean} [isDeep] Specify a deep flatten.
16650
+ * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
16651
+ * @param {Array} [result=[]] The initial result value.
16652
+ * @returns {Array} Returns the new flattened array.
16653
+ */
16654
+ function baseFlatten(array, isDeep, isStrict, result) {
16655
+ result || (result = []);
16656
+
16657
+ var index = -1,
16658
+ length = array.length;
16659
+
16660
+ while (++index < length) {
16661
+ var value = array[index];
16662
+ if (isObjectLike(value) && isArrayLike(value) &&
16663
+ (isStrict || isArray(value) || isArguments(value))) {
16664
+ if (isDeep) {
16665
+ // Recursively flatten arrays (susceptible to call stack limits).
16666
+ baseFlatten(value, isDeep, isStrict, result);
16667
+ } else {
16668
+ arrayPush(result, value);
16669
+ }
16670
+ } else if (!isStrict) {
16671
+ result[result.length] = value;
16672
+ }
16673
+ }
16674
+ return result;
16675
+ }
16676
+
16677
+ /**
16678
+ * The base implementation of `baseForIn` and `baseForOwn` which iterates
16679
+ * over `object` properties returned by `keysFunc` invoking `iteratee` for
16680
+ * each property. Iteratee functions may exit iteration early by explicitly
16681
+ * returning `false`.
16682
+ *
16683
+ * @private
16684
+ * @param {Object} object The object to iterate over.
16685
+ * @param {Function} iteratee The function invoked per iteration.
16686
+ * @param {Function} keysFunc The function to get the keys of `object`.
16687
+ * @returns {Object} Returns `object`.
16688
+ */
16689
+ var baseFor = createBaseFor();
16690
+
16691
+ /**
16692
+ * This function is like `baseFor` except that it iterates over properties
16693
+ * in the opposite order.
16694
+ *
16695
+ * @private
16696
+ * @param {Object} object The object to iterate over.
16697
+ * @param {Function} iteratee The function invoked per iteration.
16698
+ * @param {Function} keysFunc The function to get the keys of `object`.
16699
+ * @returns {Object} Returns `object`.
16700
+ */
16701
+ var baseForRight = createBaseFor(true);
16702
+
16703
+ /**
16704
+ * The base implementation of `_.forIn` without support for callback
16705
+ * shorthands and `this` binding.
16706
+ *
16707
+ * @private
16708
+ * @param {Object} object The object to iterate over.
16709
+ * @param {Function} iteratee The function invoked per iteration.
16710
+ * @returns {Object} Returns `object`.
16711
+ */
16712
+ function baseForIn(object, iteratee) {
16713
+ return baseFor(object, iteratee, keysIn);
16714
+ }
16715
+
16716
+ /**
16717
+ * The base implementation of `_.forOwn` without support for callback
16718
+ * shorthands and `this` binding.
16719
+ *
16720
+ * @private
16721
+ * @param {Object} object The object to iterate over.
16722
+ * @param {Function} iteratee The function invoked per iteration.
16723
+ * @returns {Object} Returns `object`.
16724
+ */
16725
+ function baseForOwn(object, iteratee) {
16726
+ return baseFor(object, iteratee, keys);
16727
+ }
16728
+
16729
+ /**
16730
+ * The base implementation of `_.forOwnRight` without support for callback
16731
+ * shorthands and `this` binding.
16732
+ *
16733
+ * @private
16734
+ * @param {Object} object The object to iterate over.
16735
+ * @param {Function} iteratee The function invoked per iteration.
16736
+ * @returns {Object} Returns `object`.
16737
+ */
16738
+ function baseForOwnRight(object, iteratee) {
16739
+ return baseForRight(object, iteratee, keys);
16740
+ }
16741
+
16742
+ /**
16743
+ * The base implementation of `_.functions` which creates an array of
16744
+ * `object` function property names filtered from those provided.
16745
+ *
16746
+ * @private
16747
+ * @param {Object} object The object to inspect.
16748
+ * @param {Array} props The property names to filter.
16749
+ * @returns {Array} Returns the new array of filtered property names.
16750
+ */
16751
+ function baseFunctions(object, props) {
16752
+ var index = -1,
16753
+ length = props.length,
16754
+ resIndex = -1,
16755
+ result = [];
16756
+
16757
+ while (++index < length) {
16758
+ var key = props[index];
16759
+ if (isFunction(object[key])) {
16760
+ result[++resIndex] = key;
16761
+ }
16762
+ }
16763
+ return result;
16764
+ }
16765
+
16766
+ /**
16767
+ * The base implementation of `get` without support for string paths
16768
+ * and default values.
16769
+ *
16770
+ * @private
16771
+ * @param {Object} object The object to query.
16772
+ * @param {Array} path The path of the property to get.
16773
+ * @param {string} [pathKey] The key representation of path.
16774
+ * @returns {*} Returns the resolved value.
16775
+ */
16776
+ function baseGet(object, path, pathKey) {
16777
+ if (object == null) {
16778
+ return;
16779
+ }
16780
+ if (pathKey !== undefined && pathKey in toObject(object)) {
16781
+ path = [pathKey];
16782
+ }
16783
+ var index = 0,
16784
+ length = path.length;
16785
+
16786
+ while (object != null && index < length) {
16787
+ object = object[path[index++]];
16788
+ }
16789
+ return (index && index == length) ? object : undefined;
16790
+ }
16791
+
16792
+ /**
16793
+ * The base implementation of `_.isEqual` without support for `this` binding
16794
+ * `customizer` functions.
16795
+ *
16796
+ * @private
16797
+ * @param {*} value The value to compare.
16798
+ * @param {*} other The other value to compare.
16799
+ * @param {Function} [customizer] The function to customize comparing values.
16800
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
16801
+ * @param {Array} [stackA] Tracks traversed `value` objects.
16802
+ * @param {Array} [stackB] Tracks traversed `other` objects.
16803
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
16804
+ */
16805
+ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
16806
+ if (value === other) {
16807
+ return true;
16808
+ }
16809
+ if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
16810
+ return value !== value && other !== other;
16811
+ }
16812
+ return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
16813
+ }
16814
+
16815
+ /**
16816
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
16817
+ * deep comparisons and tracks traversed objects enabling objects with circular
16818
+ * references to be compared.
16819
+ *
16820
+ * @private
16821
+ * @param {Object} object The object to compare.
16822
+ * @param {Object} other The other object to compare.
16823
+ * @param {Function} equalFunc The function to determine equivalents of values.
16824
+ * @param {Function} [customizer] The function to customize comparing objects.
16825
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
16826
+ * @param {Array} [stackA=[]] Tracks traversed `value` objects.
16827
+ * @param {Array} [stackB=[]] Tracks traversed `other` objects.
16828
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
16829
+ */
16830
+ function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
16831
+ var objIsArr = isArray(object),
16832
+ othIsArr = isArray(other),
16833
+ objTag = arrayTag,
16834
+ othTag = arrayTag;
16835
+
16836
+ if (!objIsArr) {
16837
+ objTag = objToString.call(object);
16838
+ if (objTag == argsTag) {
16839
+ objTag = objectTag;
16840
+ } else if (objTag != objectTag) {
16841
+ objIsArr = isTypedArray(object);
16842
+ }
16843
+ }
16844
+ if (!othIsArr) {
16845
+ othTag = objToString.call(other);
16846
+ if (othTag == argsTag) {
16847
+ othTag = objectTag;
16848
+ } else if (othTag != objectTag) {
16849
+ othIsArr = isTypedArray(other);
16850
+ }
16851
+ }
16852
+ var objIsObj = objTag == objectTag,
16853
+ othIsObj = othTag == objectTag,
16854
+ isSameTag = objTag == othTag;
16855
+
16856
+ if (isSameTag && !(objIsArr || objIsObj)) {
16857
+ return equalByTag(object, other, objTag);
16858
+ }
16859
+ if (!isLoose) {
16860
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
16861
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
16862
+
16863
+ if (objIsWrapped || othIsWrapped) {
16864
+ return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
16865
+ }
16866
+ }
16867
+ if (!isSameTag) {
16868
+ return false;
16869
+ }
16870
+ // Assume cyclic values are equal.
16871
+ // For more information on detecting circular references see https://es5.github.io/#JO.
16872
+ stackA || (stackA = []);
16873
+ stackB || (stackB = []);
16874
+
16875
+ var length = stackA.length;
16876
+ while (length--) {
16877
+ if (stackA[length] == object) {
16878
+ return stackB[length] == other;
16879
+ }
16880
+ }
16881
+ // Add `object` and `other` to the stack of traversed objects.
16882
+ stackA.push(object);
16883
+ stackB.push(other);
16884
+
16885
+ var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
16886
+
16887
+ stackA.pop();
16888
+ stackB.pop();
16889
+
16890
+ return result;
16891
+ }
16892
+
16893
+ /**
16894
+ * The base implementation of `_.isMatch` without support for callback
16895
+ * shorthands and `this` binding.
16896
+ *
16897
+ * @private
16898
+ * @param {Object} object The object to inspect.
16899
+ * @param {Array} matchData The propery names, values, and compare flags to match.
16900
+ * @param {Function} [customizer] The function to customize comparing objects.
16901
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
16902
+ */
16903
+ function baseIsMatch(object, matchData, customizer) {
16904
+ var index = matchData.length,
16905
+ length = index,
16906
+ noCustomizer = !customizer;
16907
+
16908
+ if (object == null) {
16909
+ return !length;
16910
+ }
16911
+ object = toObject(object);
16912
+ while (index--) {
16913
+ var data = matchData[index];
16914
+ if ((noCustomizer && data[2])
16915
+ ? data[1] !== object[data[0]]
16916
+ : !(data[0] in object)
16917
+ ) {
16918
+ return false;
16919
+ }
16920
+ }
16921
+ while (++index < length) {
16922
+ data = matchData[index];
16923
+ var key = data[0],
16924
+ objValue = object[key],
16925
+ srcValue = data[1];
16926
+
16927
+ if (noCustomizer && data[2]) {
16928
+ if (objValue === undefined && !(key in object)) {
16929
+ return false;
16930
+ }
16931
+ } else {
16932
+ var result = customizer ? customizer(objValue, srcValue, key) : undefined;
16933
+ if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
16934
+ return false;
16935
+ }
16936
+ }
16937
+ }
16938
+ return true;
16939
+ }
16940
+
16941
+ /**
16942
+ * The base implementation of `_.map` without support for callback shorthands
16943
+ * and `this` binding.
16944
+ *
16945
+ * @private
16946
+ * @param {Array|Object|string} collection The collection to iterate over.
16947
+ * @param {Function} iteratee The function invoked per iteration.
16948
+ * @returns {Array} Returns the new mapped array.
16949
+ */
16950
+ function baseMap(collection, iteratee) {
16951
+ var index = -1,
16952
+ result = isArrayLike(collection) ? Array(collection.length) : [];
16953
+
16954
+ baseEach(collection, function(value, key, collection) {
16955
+ result[++index] = iteratee(value, key, collection);
16956
+ });
16957
+ return result;
16958
+ }
16959
+
16960
+ /**
16961
+ * The base implementation of `_.matches` which does not clone `source`.
16962
+ *
16963
+ * @private
16964
+ * @param {Object} source The object of property values to match.
16965
+ * @returns {Function} Returns the new function.
16966
+ */
16967
+ function baseMatches(source) {
16968
+ var matchData = getMatchData(source);
16969
+ if (matchData.length == 1 && matchData[0][2]) {
16970
+ var key = matchData[0][0],
16971
+ value = matchData[0][1];
16972
+
16973
+ return function(object) {
16974
+ if (object == null) {
16975
+ return false;
16976
+ }
16977
+ return object[key] === value && (value !== undefined || (key in toObject(object)));
16978
+ };
16979
+ }
16980
+ return function(object) {
16981
+ return baseIsMatch(object, matchData);
16982
+ };
16983
+ }
16984
+
16985
+ /**
16986
+ * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
16987
+ *
16988
+ * @private
16989
+ * @param {string} path The path of the property to get.
16990
+ * @param {*} srcValue The value to compare.
16991
+ * @returns {Function} Returns the new function.
16992
+ */
16993
+ function baseMatchesProperty(path, srcValue) {
16994
+ var isArr = isArray(path),
16995
+ isCommon = isKey(path) && isStrictComparable(srcValue),
16996
+ pathKey = (path + '');
16997
+
16998
+ path = toPath(path);
16999
+ return function(object) {
17000
+ if (object == null) {
17001
+ return false;
17002
+ }
17003
+ var key = pathKey;
17004
+ object = toObject(object);
17005
+ if ((isArr || !isCommon) && !(key in object)) {
17006
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
17007
+ if (object == null) {
17008
+ return false;
17009
+ }
17010
+ key = last(path);
17011
+ object = toObject(object);
17012
+ }
17013
+ return object[key] === srcValue
17014
+ ? (srcValue !== undefined || (key in object))
17015
+ : baseIsEqual(srcValue, object[key], undefined, true);
17016
+ };
17017
+ }
17018
+
17019
+ /**
17020
+ * The base implementation of `_.merge` without support for argument juggling,
17021
+ * multiple sources, and `this` binding `customizer` functions.
17022
+ *
17023
+ * @private
17024
+ * @param {Object} object The destination object.
17025
+ * @param {Object} source The source object.
17026
+ * @param {Function} [customizer] The function to customize merged values.
17027
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
17028
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
17029
+ * @returns {Object} Returns `object`.
17030
+ */
17031
+ function baseMerge(object, source, customizer, stackA, stackB) {
17032
+ if (!isObject(object)) {
17033
+ return object;
17034
+ }
17035
+ var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
17036
+ props = isSrcArr ? undefined : keys(source);
17037
+
17038
+ arrayEach(props || source, function(srcValue, key) {
17039
+ if (props) {
17040
+ key = srcValue;
17041
+ srcValue = source[key];
17042
+ }
17043
+ if (isObjectLike(srcValue)) {
17044
+ stackA || (stackA = []);
17045
+ stackB || (stackB = []);
17046
+ baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
17047
+ }
17048
+ else {
17049
+ var value = object[key],
17050
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
17051
+ isCommon = result === undefined;
17052
+
17053
+ if (isCommon) {
17054
+ result = srcValue;
17055
+ }
17056
+ if ((result !== undefined || (isSrcArr && !(key in object))) &&
17057
+ (isCommon || (result === result ? (result !== value) : (value === value)))) {
17058
+ object[key] = result;
17059
+ }
17060
+ }
17061
+ });
17062
+ return object;
17063
+ }
17064
+
17065
+ /**
17066
+ * A specialized version of `baseMerge` for arrays and objects which performs
17067
+ * deep merges and tracks traversed objects enabling objects with circular
17068
+ * references to be merged.
17069
+ *
17070
+ * @private
17071
+ * @param {Object} object The destination object.
17072
+ * @param {Object} source The source object.
17073
+ * @param {string} key The key of the value to merge.
17074
+ * @param {Function} mergeFunc The function to merge values.
17075
+ * @param {Function} [customizer] The function to customize merged values.
17076
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
17077
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
17078
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
17079
+ */
17080
+ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
17081
+ var length = stackA.length,
17082
+ srcValue = source[key];
17083
+
17084
+ while (length--) {
17085
+ if (stackA[length] == srcValue) {
17086
+ object[key] = stackB[length];
17087
+ return;
17088
+ }
17089
+ }
17090
+ var value = object[key],
17091
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
17092
+ isCommon = result === undefined;
17093
+
17094
+ if (isCommon) {
17095
+ result = srcValue;
17096
+ if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
17097
+ result = isArray(value)
17098
+ ? value
17099
+ : (isArrayLike(value) ? arrayCopy(value) : []);
17100
+ }
17101
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
17102
+ result = isArguments(value)
17103
+ ? toPlainObject(value)
17104
+ : (isPlainObject(value) ? value : {});
17105
+ }
17106
+ else {
17107
+ isCommon = false;
17108
+ }
17109
+ }
17110
+ // Add the source value to the stack of traversed objects and associate
17111
+ // it with its merged value.
17112
+ stackA.push(srcValue);
17113
+ stackB.push(result);
17114
+
17115
+ if (isCommon) {
17116
+ // Recursively merge objects and arrays (susceptible to call stack limits).
17117
+ object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
17118
+ } else if (result === result ? (result !== value) : (value === value)) {
17119
+ object[key] = result;
17120
+ }
17121
+ }
17122
+
17123
+ /**
17124
+ * The base implementation of `_.property` without support for deep paths.
17125
+ *
17126
+ * @private
17127
+ * @param {string} key The key of the property to get.
17128
+ * @returns {Function} Returns the new function.
17129
+ */
17130
+ function baseProperty(key) {
17131
+ return function(object) {
17132
+ return object == null ? undefined : object[key];
17133
+ };
17134
+ }
17135
+
17136
+ /**
17137
+ * A specialized version of `baseProperty` which supports deep paths.
17138
+ *
17139
+ * @private
17140
+ * @param {Array|string} path The path of the property to get.
17141
+ * @returns {Function} Returns the new function.
17142
+ */
17143
+ function basePropertyDeep(path) {
17144
+ var pathKey = (path + '');
17145
+ path = toPath(path);
17146
+ return function(object) {
17147
+ return baseGet(object, path, pathKey);
17148
+ };
17149
+ }
17150
+
17151
+ /**
17152
+ * The base implementation of `_.pullAt` without support for individual
17153
+ * index arguments and capturing the removed elements.
17154
+ *
17155
+ * @private
17156
+ * @param {Array} array The array to modify.
17157
+ * @param {number[]} indexes The indexes of elements to remove.
17158
+ * @returns {Array} Returns `array`.
17159
+ */
17160
+ function basePullAt(array, indexes) {
17161
+ var length = array ? indexes.length : 0;
17162
+ while (length--) {
17163
+ var index = indexes[length];
17164
+ if (index != previous && isIndex(index)) {
17165
+ var previous = index;
17166
+ splice.call(array, index, 1);
17167
+ }
17168
+ }
17169
+ return array;
17170
+ }
17171
+
17172
+ /**
17173
+ * The base implementation of `_.random` without support for argument juggling
17174
+ * and returning floating-point numbers.
17175
+ *
17176
+ * @private
17177
+ * @param {number} min The minimum possible value.
17178
+ * @param {number} max The maximum possible value.
17179
+ * @returns {number} Returns the random number.
17180
+ */
17181
+ function baseRandom(min, max) {
17182
+ return min + nativeFloor(nativeRandom() * (max - min + 1));
17183
+ }
17184
+
17185
+ /**
17186
+ * The base implementation of `_.reduce` and `_.reduceRight` without support
17187
+ * for callback shorthands and `this` binding, which iterates over `collection`
17188
+ * using the provided `eachFunc`.
17189
+ *
17190
+ * @private
17191
+ * @param {Array|Object|string} collection The collection to iterate over.
17192
+ * @param {Function} iteratee The function invoked per iteration.
17193
+ * @param {*} accumulator The initial value.
17194
+ * @param {boolean} initFromCollection Specify using the first or last element
17195
+ * of `collection` as the initial value.
17196
+ * @param {Function} eachFunc The function to iterate over `collection`.
17197
+ * @returns {*} Returns the accumulated value.
17198
+ */
17199
+ function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
17200
+ eachFunc(collection, function(value, index, collection) {
17201
+ accumulator = initFromCollection
17202
+ ? (initFromCollection = false, value)
17203
+ : iteratee(accumulator, value, index, collection);
17204
+ });
17205
+ return accumulator;
17206
+ }
17207
+
17208
+ /**
17209
+ * The base implementation of `setData` without support for hot loop detection.
17210
+ *
17211
+ * @private
17212
+ * @param {Function} func The function to associate metadata with.
17213
+ * @param {*} data The metadata.
17214
+ * @returns {Function} Returns `func`.
17215
+ */
17216
+ var baseSetData = !metaMap ? identity : function(func, data) {
17217
+ metaMap.set(func, data);
17218
+ return func;
17219
+ };
17220
+
17221
+ /**
17222
+ * The base implementation of `_.slice` without an iteratee call guard.
17223
+ *
17224
+ * @private
17225
+ * @param {Array} array The array to slice.
17226
+ * @param {number} [start=0] The start position.
17227
+ * @param {number} [end=array.length] The end position.
17228
+ * @returns {Array} Returns the slice of `array`.
17229
+ */
17230
+ function baseSlice(array, start, end) {
17231
+ var index = -1,
17232
+ length = array.length;
17233
+
17234
+ start = start == null ? 0 : (+start || 0);
17235
+ if (start < 0) {
17236
+ start = -start > length ? 0 : (length + start);
17237
+ }
17238
+ end = (end === undefined || end > length) ? length : (+end || 0);
17239
+ if (end < 0) {
17240
+ end += length;
17241
+ }
17242
+ length = start > end ? 0 : ((end - start) >>> 0);
17243
+ start >>>= 0;
17244
+
17245
+ var result = Array(length);
17246
+ while (++index < length) {
17247
+ result[index] = array[index + start];
17248
+ }
17249
+ return result;
17250
+ }
17251
+
17252
+ /**
17253
+ * The base implementation of `_.some` without support for callback shorthands
17254
+ * and `this` binding.
17255
+ *
17256
+ * @private
17257
+ * @param {Array|Object|string} collection The collection to iterate over.
17258
+ * @param {Function} predicate The function invoked per iteration.
17259
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
17260
+ * else `false`.
17261
+ */
17262
+ function baseSome(collection, predicate) {
17263
+ var result;
17264
+
17265
+ baseEach(collection, function(value, index, collection) {
17266
+ result = predicate(value, index, collection);
17267
+ return !result;
17268
+ });
17269
+ return !!result;
17270
+ }
17271
+
17272
+ /**
17273
+ * The base implementation of `_.sortBy` which uses `comparer` to define
17274
+ * the sort order of `array` and replaces criteria objects with their
17275
+ * corresponding values.
17276
+ *
17277
+ * @private
17278
+ * @param {Array} array The array to sort.
17279
+ * @param {Function} comparer The function to define sort order.
17280
+ * @returns {Array} Returns `array`.
17281
+ */
17282
+ function baseSortBy(array, comparer) {
17283
+ var length = array.length;
17284
+
17285
+ array.sort(comparer);
17286
+ while (length--) {
17287
+ array[length] = array[length].value;
17288
+ }
17289
+ return array;
17290
+ }
17291
+
17292
+ /**
17293
+ * The base implementation of `_.sortByOrder` without param guards.
17294
+ *
17295
+ * @private
17296
+ * @param {Array|Object|string} collection The collection to iterate over.
17297
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
17298
+ * @param {boolean[]} orders The sort orders of `iteratees`.
17299
+ * @returns {Array} Returns the new sorted array.
17300
+ */
17301
+ function baseSortByOrder(collection, iteratees, orders) {
17302
+ var callback = getCallback(),
17303
+ index = -1;
17304
+
17305
+ iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
17306
+
17307
+ var result = baseMap(collection, function(value) {
17308
+ var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
17309
+ return { 'criteria': criteria, 'index': ++index, 'value': value };
17310
+ });
17311
+
17312
+ return baseSortBy(result, function(object, other) {
17313
+ return compareMultiple(object, other, orders);
17314
+ });
17315
+ }
17316
+
17317
+ /**
17318
+ * The base implementation of `_.sum` without support for callback shorthands
17319
+ * and `this` binding.
17320
+ *
17321
+ * @private
17322
+ * @param {Array|Object|string} collection The collection to iterate over.
17323
+ * @param {Function} iteratee The function invoked per iteration.
17324
+ * @returns {number} Returns the sum.
17325
+ */
17326
+ function baseSum(collection, iteratee) {
17327
+ var result = 0;
17328
+ baseEach(collection, function(value, index, collection) {
17329
+ result += +iteratee(value, index, collection) || 0;
17330
+ });
17331
+ return result;
17332
+ }
17333
+
17334
+ /**
17335
+ * The base implementation of `_.uniq` without support for callback shorthands
17336
+ * and `this` binding.
17337
+ *
17338
+ * @private
17339
+ * @param {Array} array The array to inspect.
17340
+ * @param {Function} [iteratee] The function invoked per iteration.
17341
+ * @returns {Array} Returns the new duplicate-value-free array.
17342
+ */
17343
+ function baseUniq(array, iteratee) {
17344
+ var index = -1,
17345
+ indexOf = getIndexOf(),
17346
+ length = array.length,
17347
+ isCommon = indexOf == baseIndexOf,
17348
+ isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
17349
+ seen = isLarge ? createCache() : null,
17350
+ result = [];
17351
+
17352
+ if (seen) {
17353
+ indexOf = cacheIndexOf;
17354
+ isCommon = false;
17355
+ } else {
17356
+ isLarge = false;
17357
+ seen = iteratee ? [] : result;
17358
+ }
17359
+ outer:
17360
+ while (++index < length) {
17361
+ var value = array[index],
17362
+ computed = iteratee ? iteratee(value, index, array) : value;
17363
+
17364
+ if (isCommon && value === value) {
17365
+ var seenIndex = seen.length;
17366
+ while (seenIndex--) {
17367
+ if (seen[seenIndex] === computed) {
17368
+ continue outer;
17369
+ }
17370
+ }
17371
+ if (iteratee) {
17372
+ seen.push(computed);
17373
+ }
17374
+ result.push(value);
17375
+ }
17376
+ else if (indexOf(seen, computed, 0) < 0) {
17377
+ if (iteratee || isLarge) {
17378
+ seen.push(computed);
17379
+ }
17380
+ result.push(value);
17381
+ }
17382
+ }
17383
+ return result;
17384
+ }
17385
+
17386
+ /**
17387
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
17388
+ * array of `object` property values corresponding to the property names
17389
+ * of `props`.
17390
+ *
17391
+ * @private
17392
+ * @param {Object} object The object to query.
17393
+ * @param {Array} props The property names to get values for.
17394
+ * @returns {Object} Returns the array of property values.
17395
+ */
17396
+ function baseValues(object, props) {
17397
+ var index = -1,
17398
+ length = props.length,
17399
+ result = Array(length);
17400
+
17401
+ while (++index < length) {
17402
+ result[index] = object[props[index]];
17403
+ }
17404
+ return result;
17405
+ }
17406
+
17407
+ /**
17408
+ * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
17409
+ * and `_.takeWhile` without support for callback shorthands and `this` binding.
17410
+ *
17411
+ * @private
17412
+ * @param {Array} array The array to query.
17413
+ * @param {Function} predicate The function invoked per iteration.
17414
+ * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
17415
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17416
+ * @returns {Array} Returns the slice of `array`.
17417
+ */
17418
+ function baseWhile(array, predicate, isDrop, fromRight) {
17419
+ var length = array.length,
17420
+ index = fromRight ? length : -1;
17421
+
17422
+ while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
17423
+ return isDrop
17424
+ ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
17425
+ : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
17426
+ }
17427
+
17428
+ /**
17429
+ * The base implementation of `wrapperValue` which returns the result of
17430
+ * performing a sequence of actions on the unwrapped `value`, where each
17431
+ * successive action is supplied the return value of the previous.
17432
+ *
17433
+ * @private
17434
+ * @param {*} value The unwrapped value.
17435
+ * @param {Array} actions Actions to peform to resolve the unwrapped value.
17436
+ * @returns {*} Returns the resolved value.
17437
+ */
17438
+ function baseWrapperValue(value, actions) {
17439
+ var result = value;
17440
+ if (result instanceof LazyWrapper) {
17441
+ result = result.value();
17442
+ }
17443
+ var index = -1,
17444
+ length = actions.length;
17445
+
17446
+ while (++index < length) {
17447
+ var action = actions[index];
17448
+ result = action.func.apply(action.thisArg, arrayPush([result], action.args));
17449
+ }
17450
+ return result;
17451
+ }
17452
+
17453
+ /**
17454
+ * Performs a binary search of `array` to determine the index at which `value`
17455
+ * should be inserted into `array` in order to maintain its sort order.
17456
+ *
17457
+ * @private
17458
+ * @param {Array} array The sorted array to inspect.
17459
+ * @param {*} value The value to evaluate.
17460
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
17461
+ * @returns {number} Returns the index at which `value` should be inserted
17462
+ * into `array`.
17463
+ */
17464
+ function binaryIndex(array, value, retHighest) {
17465
+ var low = 0,
17466
+ high = array ? array.length : low;
17467
+
17468
+ if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
17469
+ while (low < high) {
17470
+ var mid = (low + high) >>> 1,
17471
+ computed = array[mid];
17472
+
17473
+ if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
17474
+ low = mid + 1;
17475
+ } else {
17476
+ high = mid;
17477
+ }
17478
+ }
17479
+ return high;
17480
+ }
17481
+ return binaryIndexBy(array, value, identity, retHighest);
17482
+ }
17483
+
17484
+ /**
17485
+ * This function is like `binaryIndex` except that it invokes `iteratee` for
17486
+ * `value` and each element of `array` to compute their sort ranking. The
17487
+ * iteratee is invoked with one argument; (value).
17488
+ *
17489
+ * @private
17490
+ * @param {Array} array The sorted array to inspect.
17491
+ * @param {*} value The value to evaluate.
17492
+ * @param {Function} iteratee The function invoked per iteration.
17493
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
17494
+ * @returns {number} Returns the index at which `value` should be inserted
17495
+ * into `array`.
17496
+ */
17497
+ function binaryIndexBy(array, value, iteratee, retHighest) {
17498
+ value = iteratee(value);
17499
+
17500
+ var low = 0,
17501
+ high = array ? array.length : 0,
17502
+ valIsNaN = value !== value,
17503
+ valIsNull = value === null,
17504
+ valIsUndef = value === undefined;
17505
+
17506
+ while (low < high) {
17507
+ var mid = nativeFloor((low + high) / 2),
17508
+ computed = iteratee(array[mid]),
17509
+ isDef = computed !== undefined,
17510
+ isReflexive = computed === computed;
17511
+
17512
+ if (valIsNaN) {
17513
+ var setLow = isReflexive || retHighest;
17514
+ } else if (valIsNull) {
17515
+ setLow = isReflexive && isDef && (retHighest || computed != null);
17516
+ } else if (valIsUndef) {
17517
+ setLow = isReflexive && (retHighest || isDef);
17518
+ } else if (computed == null) {
17519
+ setLow = false;
17520
+ } else {
17521
+ setLow = retHighest ? (computed <= value) : (computed < value);
17522
+ }
17523
+ if (setLow) {
17524
+ low = mid + 1;
17525
+ } else {
17526
+ high = mid;
17527
+ }
17528
+ }
17529
+ return nativeMin(high, MAX_ARRAY_INDEX);
17530
+ }
17531
+
17532
+ /**
17533
+ * A specialized version of `baseCallback` which only supports `this` binding
17534
+ * and specifying the number of arguments to provide to `func`.
17535
+ *
17536
+ * @private
17537
+ * @param {Function} func The function to bind.
17538
+ * @param {*} thisArg The `this` binding of `func`.
17539
+ * @param {number} [argCount] The number of arguments to provide to `func`.
17540
+ * @returns {Function} Returns the callback.
17541
+ */
17542
+ function bindCallback(func, thisArg, argCount) {
17543
+ if (typeof func != 'function') {
17544
+ return identity;
17545
+ }
17546
+ if (thisArg === undefined) {
17547
+ return func;
17548
+ }
17549
+ switch (argCount) {
17550
+ case 1: return function(value) {
17551
+ return func.call(thisArg, value);
17552
+ };
17553
+ case 3: return function(value, index, collection) {
17554
+ return func.call(thisArg, value, index, collection);
17555
+ };
17556
+ case 4: return function(accumulator, value, index, collection) {
17557
+ return func.call(thisArg, accumulator, value, index, collection);
17558
+ };
17559
+ case 5: return function(value, other, key, object, source) {
17560
+ return func.call(thisArg, value, other, key, object, source);
17561
+ };
17562
+ }
17563
+ return function() {
17564
+ return func.apply(thisArg, arguments);
17565
+ };
17566
+ }
17567
+
17568
+ /**
17569
+ * Creates a clone of the given array buffer.
17570
+ *
17571
+ * @private
17572
+ * @param {ArrayBuffer} buffer The array buffer to clone.
17573
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
17574
+ */
17575
+ function bufferClone(buffer) {
17576
+ var result = new ArrayBuffer(buffer.byteLength),
17577
+ view = new Uint8Array(result);
17578
+
17579
+ view.set(new Uint8Array(buffer));
17580
+ return result;
17581
+ }
17582
+
17583
+ /**
17584
+ * Creates an array that is the composition of partially applied arguments,
17585
+ * placeholders, and provided arguments into a single array of arguments.
17586
+ *
17587
+ * @private
17588
+ * @param {Array|Object} args The provided arguments.
17589
+ * @param {Array} partials The arguments to prepend to those provided.
17590
+ * @param {Array} holders The `partials` placeholder indexes.
17591
+ * @returns {Array} Returns the new array of composed arguments.
17592
+ */
17593
+ function composeArgs(args, partials, holders) {
17594
+ var holdersLength = holders.length,
17595
+ argsIndex = -1,
17596
+ argsLength = nativeMax(args.length - holdersLength, 0),
17597
+ leftIndex = -1,
17598
+ leftLength = partials.length,
17599
+ result = Array(leftLength + argsLength);
17600
+
17601
+ while (++leftIndex < leftLength) {
17602
+ result[leftIndex] = partials[leftIndex];
17603
+ }
17604
+ while (++argsIndex < holdersLength) {
17605
+ result[holders[argsIndex]] = args[argsIndex];
17606
+ }
17607
+ while (argsLength--) {
17608
+ result[leftIndex++] = args[argsIndex++];
17609
+ }
17610
+ return result;
17611
+ }
17612
+
17613
+ /**
17614
+ * This function is like `composeArgs` except that the arguments composition
17615
+ * is tailored for `_.partialRight`.
17616
+ *
17617
+ * @private
17618
+ * @param {Array|Object} args The provided arguments.
17619
+ * @param {Array} partials The arguments to append to those provided.
17620
+ * @param {Array} holders The `partials` placeholder indexes.
17621
+ * @returns {Array} Returns the new array of composed arguments.
17622
+ */
17623
+ function composeArgsRight(args, partials, holders) {
17624
+ var holdersIndex = -1,
17625
+ holdersLength = holders.length,
17626
+ argsIndex = -1,
17627
+ argsLength = nativeMax(args.length - holdersLength, 0),
17628
+ rightIndex = -1,
17629
+ rightLength = partials.length,
17630
+ result = Array(argsLength + rightLength);
17631
+
17632
+ while (++argsIndex < argsLength) {
17633
+ result[argsIndex] = args[argsIndex];
17634
+ }
17635
+ var offset = argsIndex;
17636
+ while (++rightIndex < rightLength) {
17637
+ result[offset + rightIndex] = partials[rightIndex];
17638
+ }
17639
+ while (++holdersIndex < holdersLength) {
17640
+ result[offset + holders[holdersIndex]] = args[argsIndex++];
17641
+ }
17642
+ return result;
17643
+ }
17644
+
17645
+ /**
17646
+ * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
17647
+ *
17648
+ * @private
17649
+ * @param {Function} setter The function to set keys and values of the accumulator object.
17650
+ * @param {Function} [initializer] The function to initialize the accumulator object.
17651
+ * @returns {Function} Returns the new aggregator function.
17652
+ */
17653
+ function createAggregator(setter, initializer) {
17654
+ return function(collection, iteratee, thisArg) {
17655
+ var result = initializer ? initializer() : {};
17656
+ iteratee = getCallback(iteratee, thisArg, 3);
17657
+
17658
+ if (isArray(collection)) {
17659
+ var index = -1,
17660
+ length = collection.length;
17661
+
17662
+ while (++index < length) {
17663
+ var value = collection[index];
17664
+ setter(result, value, iteratee(value, index, collection), collection);
17665
+ }
17666
+ } else {
17667
+ baseEach(collection, function(value, key, collection) {
17668
+ setter(result, value, iteratee(value, key, collection), collection);
17669
+ });
17670
+ }
17671
+ return result;
17672
+ };
17673
+ }
17674
+
17675
+ /**
17676
+ * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
17677
+ *
17678
+ * @private
17679
+ * @param {Function} assigner The function to assign values.
17680
+ * @returns {Function} Returns the new assigner function.
17681
+ */
17682
+ function createAssigner(assigner) {
17683
+ return restParam(function(object, sources) {
17684
+ var index = -1,
17685
+ length = object == null ? 0 : sources.length,
17686
+ customizer = length > 2 ? sources[length - 2] : undefined,
17687
+ guard = length > 2 ? sources[2] : undefined,
17688
+ thisArg = length > 1 ? sources[length - 1] : undefined;
17689
+
17690
+ if (typeof customizer == 'function') {
17691
+ customizer = bindCallback(customizer, thisArg, 5);
17692
+ length -= 2;
17693
+ } else {
17694
+ customizer = typeof thisArg == 'function' ? thisArg : undefined;
17695
+ length -= (customizer ? 1 : 0);
17696
+ }
17697
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
17698
+ customizer = length < 3 ? undefined : customizer;
17699
+ length = 1;
17700
+ }
17701
+ while (++index < length) {
17702
+ var source = sources[index];
17703
+ if (source) {
17704
+ assigner(object, source, customizer);
17705
+ }
17706
+ }
17707
+ return object;
17708
+ });
17709
+ }
17710
+
17711
+ /**
17712
+ * Creates a `baseEach` or `baseEachRight` function.
17713
+ *
17714
+ * @private
17715
+ * @param {Function} eachFunc The function to iterate over a collection.
17716
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17717
+ * @returns {Function} Returns the new base function.
17718
+ */
17719
+ function createBaseEach(eachFunc, fromRight) {
17720
+ return function(collection, iteratee) {
17721
+ var length = collection ? getLength(collection) : 0;
17722
+ if (!isLength(length)) {
17723
+ return eachFunc(collection, iteratee);
17724
+ }
17725
+ var index = fromRight ? length : -1,
17726
+ iterable = toObject(collection);
17727
+
17728
+ while ((fromRight ? index-- : ++index < length)) {
17729
+ if (iteratee(iterable[index], index, iterable) === false) {
17730
+ break;
17731
+ }
17732
+ }
17733
+ return collection;
17734
+ };
17735
+ }
17736
+
17737
+ /**
17738
+ * Creates a base function for `_.forIn` or `_.forInRight`.
17739
+ *
17740
+ * @private
17741
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17742
+ * @returns {Function} Returns the new base function.
17743
+ */
17744
+ function createBaseFor(fromRight) {
17745
+ return function(object, iteratee, keysFunc) {
17746
+ var iterable = toObject(object),
17747
+ props = keysFunc(object),
17748
+ length = props.length,
17749
+ index = fromRight ? length : -1;
17750
+
17751
+ while ((fromRight ? index-- : ++index < length)) {
17752
+ var key = props[index];
17753
+ if (iteratee(iterable[key], key, iterable) === false) {
17754
+ break;
17755
+ }
17756
+ }
17757
+ return object;
17758
+ };
17759
+ }
17760
+
17761
+ /**
17762
+ * Creates a function that wraps `func` and invokes it with the `this`
17763
+ * binding of `thisArg`.
17764
+ *
17765
+ * @private
17766
+ * @param {Function} func The function to bind.
17767
+ * @param {*} [thisArg] The `this` binding of `func`.
17768
+ * @returns {Function} Returns the new bound function.
17769
+ */
17770
+ function createBindWrapper(func, thisArg) {
17771
+ var Ctor = createCtorWrapper(func);
17772
+
17773
+ function wrapper() {
17774
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
17775
+ return fn.apply(thisArg, arguments);
17776
+ }
17777
+ return wrapper;
17778
+ }
17779
+
17780
+ /**
17781
+ * Creates a `Set` cache object to optimize linear searches of large arrays.
17782
+ *
17783
+ * @private
17784
+ * @param {Array} [values] The values to cache.
17785
+ * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
17786
+ */
17787
+ function createCache(values) {
17788
+ return (nativeCreate && Set) ? new SetCache(values) : null;
17789
+ }
17790
+
17791
+ /**
17792
+ * Creates a function that produces compound words out of the words in a
17793
+ * given string.
17794
+ *
17795
+ * @private
17796
+ * @param {Function} callback The function to combine each word.
17797
+ * @returns {Function} Returns the new compounder function.
17798
+ */
17799
+ function createCompounder(callback) {
17800
+ return function(string) {
17801
+ var index = -1,
17802
+ array = words(deburr(string)),
17803
+ length = array.length,
17804
+ result = '';
17805
+
17806
+ while (++index < length) {
17807
+ result = callback(result, array[index], index);
17808
+ }
17809
+ return result;
17810
+ };
17811
+ }
17812
+
17813
+ /**
17814
+ * Creates a function that produces an instance of `Ctor` regardless of
17815
+ * whether it was invoked as part of a `new` expression or by `call` or `apply`.
17816
+ *
17817
+ * @private
17818
+ * @param {Function} Ctor The constructor to wrap.
17819
+ * @returns {Function} Returns the new wrapped function.
17820
+ */
17821
+ function createCtorWrapper(Ctor) {
17822
+ return function() {
17823
+ // Use a `switch` statement to work with class constructors.
17824
+ // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
17825
+ // for more details.
17826
+ var args = arguments;
17827
+ switch (args.length) {
17828
+ case 0: return new Ctor;
17829
+ case 1: return new Ctor(args[0]);
17830
+ case 2: return new Ctor(args[0], args[1]);
17831
+ case 3: return new Ctor(args[0], args[1], args[2]);
17832
+ case 4: return new Ctor(args[0], args[1], args[2], args[3]);
17833
+ case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
17834
+ case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
17835
+ case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
17836
+ }
17837
+ var thisBinding = baseCreate(Ctor.prototype),
17838
+ result = Ctor.apply(thisBinding, args);
17839
+
17840
+ // Mimic the constructor's `return` behavior.
17841
+ // See https://es5.github.io/#x13.2.2 for more details.
17842
+ return isObject(result) ? result : thisBinding;
17843
+ };
17844
+ }
17845
+
17846
+ /**
17847
+ * Creates a `_.curry` or `_.curryRight` function.
17848
+ *
17849
+ * @private
17850
+ * @param {boolean} flag The curry bit flag.
17851
+ * @returns {Function} Returns the new curry function.
17852
+ */
17853
+ function createCurry(flag) {
17854
+ function curryFunc(func, arity, guard) {
17855
+ if (guard && isIterateeCall(func, arity, guard)) {
17856
+ arity = undefined;
17857
+ }
17858
+ var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
17859
+ result.placeholder = curryFunc.placeholder;
17860
+ return result;
17861
+ }
17862
+ return curryFunc;
17863
+ }
17864
+
17865
+ /**
17866
+ * Creates a `_.defaults` or `_.defaultsDeep` function.
17867
+ *
17868
+ * @private
17869
+ * @param {Function} assigner The function to assign values.
17870
+ * @param {Function} customizer The function to customize assigned values.
17871
+ * @returns {Function} Returns the new defaults function.
17872
+ */
17873
+ function createDefaults(assigner, customizer) {
17874
+ return restParam(function(args) {
17875
+ var object = args[0];
17876
+ if (object == null) {
17877
+ return object;
17878
+ }
17879
+ args.push(customizer);
17880
+ return assigner.apply(undefined, args);
17881
+ });
17882
+ }
17883
+
17884
+ /**
17885
+ * Creates a `_.max` or `_.min` function.
17886
+ *
17887
+ * @private
17888
+ * @param {Function} comparator The function used to compare values.
17889
+ * @param {*} exValue The initial extremum value.
17890
+ * @returns {Function} Returns the new extremum function.
17891
+ */
17892
+ function createExtremum(comparator, exValue) {
17893
+ return function(collection, iteratee, thisArg) {
17894
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
17895
+ iteratee = undefined;
17896
+ }
17897
+ iteratee = getCallback(iteratee, thisArg, 3);
17898
+ if (iteratee.length == 1) {
17899
+ collection = isArray(collection) ? collection : toIterable(collection);
17900
+ var result = arrayExtremum(collection, iteratee, comparator, exValue);
17901
+ if (!(collection.length && result === exValue)) {
17902
+ return result;
17903
+ }
17904
+ }
17905
+ return baseExtremum(collection, iteratee, comparator, exValue);
17906
+ };
17907
+ }
17908
+
17909
+ /**
17910
+ * Creates a `_.find` or `_.findLast` function.
17911
+ *
17912
+ * @private
17913
+ * @param {Function} eachFunc The function to iterate over a collection.
17914
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17915
+ * @returns {Function} Returns the new find function.
17916
+ */
17917
+ function createFind(eachFunc, fromRight) {
17918
+ return function(collection, predicate, thisArg) {
17919
+ predicate = getCallback(predicate, thisArg, 3);
17920
+ if (isArray(collection)) {
17921
+ var index = baseFindIndex(collection, predicate, fromRight);
17922
+ return index > -1 ? collection[index] : undefined;
17923
+ }
17924
+ return baseFind(collection, predicate, eachFunc);
17925
+ };
17926
+ }
17927
+
17928
+ /**
17929
+ * Creates a `_.findIndex` or `_.findLastIndex` function.
17930
+ *
17931
+ * @private
17932
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17933
+ * @returns {Function} Returns the new find function.
17934
+ */
17935
+ function createFindIndex(fromRight) {
17936
+ return function(array, predicate, thisArg) {
17937
+ if (!(array && array.length)) {
17938
+ return -1;
17939
+ }
17940
+ predicate = getCallback(predicate, thisArg, 3);
17941
+ return baseFindIndex(array, predicate, fromRight);
17942
+ };
17943
+ }
17944
+
17945
+ /**
17946
+ * Creates a `_.findKey` or `_.findLastKey` function.
17947
+ *
17948
+ * @private
17949
+ * @param {Function} objectFunc The function to iterate over an object.
17950
+ * @returns {Function} Returns the new find function.
17951
+ */
17952
+ function createFindKey(objectFunc) {
17953
+ return function(object, predicate, thisArg) {
17954
+ predicate = getCallback(predicate, thisArg, 3);
17955
+ return baseFind(object, predicate, objectFunc, true);
17956
+ };
17957
+ }
17958
+
17959
+ /**
17960
+ * Creates a `_.flow` or `_.flowRight` function.
17961
+ *
17962
+ * @private
17963
+ * @param {boolean} [fromRight] Specify iterating from right to left.
17964
+ * @returns {Function} Returns the new flow function.
17965
+ */
17966
+ function createFlow(fromRight) {
17967
+ return function() {
17968
+ var wrapper,
17969
+ length = arguments.length,
17970
+ index = fromRight ? length : -1,
17971
+ leftIndex = 0,
17972
+ funcs = Array(length);
17973
+
17974
+ while ((fromRight ? index-- : ++index < length)) {
17975
+ var func = funcs[leftIndex++] = arguments[index];
17976
+ if (typeof func != 'function') {
17977
+ throw new TypeError(FUNC_ERROR_TEXT);
17978
+ }
17979
+ if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
17980
+ wrapper = new LodashWrapper([], true);
17981
+ }
17982
+ }
17983
+ index = wrapper ? -1 : length;
17984
+ while (++index < length) {
17985
+ func = funcs[index];
17986
+
17987
+ var funcName = getFuncName(func),
17988
+ data = funcName == 'wrapper' ? getData(func) : undefined;
17989
+
17990
+ if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
17991
+ wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
17992
+ } else {
17993
+ wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
17994
+ }
17995
+ }
17996
+ return function() {
17997
+ var args = arguments,
17998
+ value = args[0];
17999
+
18000
+ if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
18001
+ return wrapper.plant(value).value();
18002
+ }
18003
+ var index = 0,
18004
+ result = length ? funcs[index].apply(this, args) : value;
18005
+
18006
+ while (++index < length) {
18007
+ result = funcs[index].call(this, result);
18008
+ }
18009
+ return result;
18010
+ };
18011
+ };
18012
+ }
18013
+
18014
+ /**
18015
+ * Creates a function for `_.forEach` or `_.forEachRight`.
18016
+ *
18017
+ * @private
18018
+ * @param {Function} arrayFunc The function to iterate over an array.
18019
+ * @param {Function} eachFunc The function to iterate over a collection.
18020
+ * @returns {Function} Returns the new each function.
18021
+ */
18022
+ function createForEach(arrayFunc, eachFunc) {
18023
+ return function(collection, iteratee, thisArg) {
18024
+ return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
18025
+ ? arrayFunc(collection, iteratee)
18026
+ : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
18027
+ };
18028
+ }
18029
+
18030
+ /**
18031
+ * Creates a function for `_.forIn` or `_.forInRight`.
18032
+ *
18033
+ * @private
18034
+ * @param {Function} objectFunc The function to iterate over an object.
18035
+ * @returns {Function} Returns the new each function.
18036
+ */
18037
+ function createForIn(objectFunc) {
18038
+ return function(object, iteratee, thisArg) {
18039
+ if (typeof iteratee != 'function' || thisArg !== undefined) {
18040
+ iteratee = bindCallback(iteratee, thisArg, 3);
18041
+ }
18042
+ return objectFunc(object, iteratee, keysIn);
18043
+ };
18044
+ }
18045
+
18046
+ /**
18047
+ * Creates a function for `_.forOwn` or `_.forOwnRight`.
18048
+ *
18049
+ * @private
18050
+ * @param {Function} objectFunc The function to iterate over an object.
18051
+ * @returns {Function} Returns the new each function.
18052
+ */
18053
+ function createForOwn(objectFunc) {
18054
+ return function(object, iteratee, thisArg) {
18055
+ if (typeof iteratee != 'function' || thisArg !== undefined) {
18056
+ iteratee = bindCallback(iteratee, thisArg, 3);
18057
+ }
18058
+ return objectFunc(object, iteratee);
18059
+ };
18060
+ }
18061
+
18062
+ /**
18063
+ * Creates a function for `_.mapKeys` or `_.mapValues`.
18064
+ *
18065
+ * @private
18066
+ * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
18067
+ * @returns {Function} Returns the new map function.
18068
+ */
18069
+ function createObjectMapper(isMapKeys) {
18070
+ return function(object, iteratee, thisArg) {
18071
+ var result = {};
18072
+ iteratee = getCallback(iteratee, thisArg, 3);
18073
+
18074
+ baseForOwn(object, function(value, key, object) {
18075
+ var mapped = iteratee(value, key, object);
18076
+ key = isMapKeys ? mapped : key;
18077
+ value = isMapKeys ? value : mapped;
18078
+ result[key] = value;
18079
+ });
18080
+ return result;
18081
+ };
18082
+ }
18083
+
18084
+ /**
18085
+ * Creates a function for `_.padLeft` or `_.padRight`.
18086
+ *
18087
+ * @private
18088
+ * @param {boolean} [fromRight] Specify padding from the right.
18089
+ * @returns {Function} Returns the new pad function.
18090
+ */
18091
+ function createPadDir(fromRight) {
18092
+ return function(string, length, chars) {
18093
+ string = baseToString(string);
18094
+ return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
18095
+ };
18096
+ }
18097
+
18098
+ /**
18099
+ * Creates a `_.partial` or `_.partialRight` function.
18100
+ *
18101
+ * @private
18102
+ * @param {boolean} flag The partial bit flag.
18103
+ * @returns {Function} Returns the new partial function.
18104
+ */
18105
+ function createPartial(flag) {
18106
+ var partialFunc = restParam(function(func, partials) {
18107
+ var holders = replaceHolders(partials, partialFunc.placeholder);
18108
+ return createWrapper(func, flag, undefined, partials, holders);
18109
+ });
18110
+ return partialFunc;
18111
+ }
18112
+
18113
+ /**
18114
+ * Creates a function for `_.reduce` or `_.reduceRight`.
18115
+ *
18116
+ * @private
18117
+ * @param {Function} arrayFunc The function to iterate over an array.
18118
+ * @param {Function} eachFunc The function to iterate over a collection.
18119
+ * @returns {Function} Returns the new each function.
18120
+ */
18121
+ function createReduce(arrayFunc, eachFunc) {
18122
+ return function(collection, iteratee, accumulator, thisArg) {
18123
+ var initFromArray = arguments.length < 3;
18124
+ return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
18125
+ ? arrayFunc(collection, iteratee, accumulator, initFromArray)
18126
+ : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
18127
+ };
18128
+ }
18129
+
18130
+ /**
18131
+ * Creates a function that wraps `func` and invokes it with optional `this`
18132
+ * binding of, partial application, and currying.
18133
+ *
18134
+ * @private
18135
+ * @param {Function|string} func The function or method name to reference.
18136
+ * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
18137
+ * @param {*} [thisArg] The `this` binding of `func`.
18138
+ * @param {Array} [partials] The arguments to prepend to those provided to the new function.
18139
+ * @param {Array} [holders] The `partials` placeholder indexes.
18140
+ * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
18141
+ * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
18142
+ * @param {Array} [argPos] The argument positions of the new function.
18143
+ * @param {number} [ary] The arity cap of `func`.
18144
+ * @param {number} [arity] The arity of `func`.
18145
+ * @returns {Function} Returns the new wrapped function.
18146
+ */
18147
+ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
18148
+ var isAry = bitmask & ARY_FLAG,
18149
+ isBind = bitmask & BIND_FLAG,
18150
+ isBindKey = bitmask & BIND_KEY_FLAG,
18151
+ isCurry = bitmask & CURRY_FLAG,
18152
+ isCurryBound = bitmask & CURRY_BOUND_FLAG,
18153
+ isCurryRight = bitmask & CURRY_RIGHT_FLAG,
18154
+ Ctor = isBindKey ? undefined : createCtorWrapper(func);
18155
+
18156
+ function wrapper() {
18157
+ // Avoid `arguments` object use disqualifying optimizations by
18158
+ // converting it to an array before providing it to other functions.
18159
+ var length = arguments.length,
18160
+ index = length,
18161
+ args = Array(length);
18162
+
18163
+ while (index--) {
18164
+ args[index] = arguments[index];
18165
+ }
18166
+ if (partials) {
18167
+ args = composeArgs(args, partials, holders);
18168
+ }
18169
+ if (partialsRight) {
18170
+ args = composeArgsRight(args, partialsRight, holdersRight);
18171
+ }
18172
+ if (isCurry || isCurryRight) {
18173
+ var placeholder = wrapper.placeholder,
18174
+ argsHolders = replaceHolders(args, placeholder);
18175
+
18176
+ length -= argsHolders.length;
18177
+ if (length < arity) {
18178
+ var newArgPos = argPos ? arrayCopy(argPos) : undefined,
18179
+ newArity = nativeMax(arity - length, 0),
18180
+ newsHolders = isCurry ? argsHolders : undefined,
18181
+ newHoldersRight = isCurry ? undefined : argsHolders,
18182
+ newPartials = isCurry ? args : undefined,
18183
+ newPartialsRight = isCurry ? undefined : args;
18184
+
18185
+ bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
18186
+ bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
18187
+
18188
+ if (!isCurryBound) {
18189
+ bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
18190
+ }
18191
+ var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
18192
+ result = createHybridWrapper.apply(undefined, newData);
18193
+
18194
+ if (isLaziable(func)) {
18195
+ setData(result, newData);
18196
+ }
18197
+ result.placeholder = placeholder;
18198
+ return result;
18199
+ }
18200
+ }
18201
+ var thisBinding = isBind ? thisArg : this,
18202
+ fn = isBindKey ? thisBinding[func] : func;
18203
+
18204
+ if (argPos) {
18205
+ args = reorder(args, argPos);
18206
+ }
18207
+ if (isAry && ary < args.length) {
18208
+ args.length = ary;
18209
+ }
18210
+ if (this && this !== root && this instanceof wrapper) {
18211
+ fn = Ctor || createCtorWrapper(func);
18212
+ }
18213
+ return fn.apply(thisBinding, args);
18214
+ }
18215
+ return wrapper;
18216
+ }
18217
+
18218
+ /**
18219
+ * Creates the padding required for `string` based on the given `length`.
18220
+ * The `chars` string is truncated if the number of characters exceeds `length`.
18221
+ *
18222
+ * @private
18223
+ * @param {string} string The string to create padding for.
18224
+ * @param {number} [length=0] The padding length.
18225
+ * @param {string} [chars=' '] The string used as padding.
18226
+ * @returns {string} Returns the pad for `string`.
18227
+ */
18228
+ function createPadding(string, length, chars) {
18229
+ var strLength = string.length;
18230
+ length = +length;
18231
+
18232
+ if (strLength >= length || !nativeIsFinite(length)) {
18233
+ return '';
18234
+ }
18235
+ var padLength = length - strLength;
18236
+ chars = chars == null ? ' ' : (chars + '');
18237
+ return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
18238
+ }
18239
+
18240
+ /**
18241
+ * Creates a function that wraps `func` and invokes it with the optional `this`
18242
+ * binding of `thisArg` and the `partials` prepended to those provided to
18243
+ * the wrapper.
18244
+ *
18245
+ * @private
18246
+ * @param {Function} func The function to partially apply arguments to.
18247
+ * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
18248
+ * @param {*} thisArg The `this` binding of `func`.
18249
+ * @param {Array} partials The arguments to prepend to those provided to the new function.
18250
+ * @returns {Function} Returns the new bound function.
18251
+ */
18252
+ function createPartialWrapper(func, bitmask, thisArg, partials) {
18253
+ var isBind = bitmask & BIND_FLAG,
18254
+ Ctor = createCtorWrapper(func);
18255
+
18256
+ function wrapper() {
18257
+ // Avoid `arguments` object use disqualifying optimizations by
18258
+ // converting it to an array before providing it `func`.
18259
+ var argsIndex = -1,
18260
+ argsLength = arguments.length,
18261
+ leftIndex = -1,
18262
+ leftLength = partials.length,
18263
+ args = Array(leftLength + argsLength);
18264
+
18265
+ while (++leftIndex < leftLength) {
18266
+ args[leftIndex] = partials[leftIndex];
18267
+ }
18268
+ while (argsLength--) {
18269
+ args[leftIndex++] = arguments[++argsIndex];
18270
+ }
18271
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
18272
+ return fn.apply(isBind ? thisArg : this, args);
18273
+ }
18274
+ return wrapper;
18275
+ }
18276
+
18277
+ /**
18278
+ * Creates a `_.ceil`, `_.floor`, or `_.round` function.
18279
+ *
18280
+ * @private
18281
+ * @param {string} methodName The name of the `Math` method to use when rounding.
18282
+ * @returns {Function} Returns the new round function.
18283
+ */
18284
+ function createRound(methodName) {
18285
+ var func = Math[methodName];
18286
+ return function(number, precision) {
18287
+ precision = precision === undefined ? 0 : (+precision || 0);
18288
+ if (precision) {
18289
+ precision = pow(10, precision);
18290
+ return func(number * precision) / precision;
18291
+ }
18292
+ return func(number);
18293
+ };
18294
+ }
18295
+
18296
+ /**
18297
+ * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
18298
+ *
18299
+ * @private
18300
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
18301
+ * @returns {Function} Returns the new index function.
18302
+ */
18303
+ function createSortedIndex(retHighest) {
18304
+ return function(array, value, iteratee, thisArg) {
18305
+ var callback = getCallback(iteratee);
18306
+ return (iteratee == null && callback === baseCallback)
18307
+ ? binaryIndex(array, value, retHighest)
18308
+ : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
18309
+ };
18310
+ }
18311
+
18312
+ /**
18313
+ * Creates a function that either curries or invokes `func` with optional
18314
+ * `this` binding and partially applied arguments.
18315
+ *
18316
+ * @private
18317
+ * @param {Function|string} func The function or method name to reference.
18318
+ * @param {number} bitmask The bitmask of flags.
18319
+ * The bitmask may be composed of the following flags:
18320
+ * 1 - `_.bind`
18321
+ * 2 - `_.bindKey`
18322
+ * 4 - `_.curry` or `_.curryRight` of a bound function
18323
+ * 8 - `_.curry`
18324
+ * 16 - `_.curryRight`
18325
+ * 32 - `_.partial`
18326
+ * 64 - `_.partialRight`
18327
+ * 128 - `_.rearg`
18328
+ * 256 - `_.ary`
18329
+ * @param {*} [thisArg] The `this` binding of `func`.
18330
+ * @param {Array} [partials] The arguments to be partially applied.
18331
+ * @param {Array} [holders] The `partials` placeholder indexes.
18332
+ * @param {Array} [argPos] The argument positions of the new function.
18333
+ * @param {number} [ary] The arity cap of `func`.
18334
+ * @param {number} [arity] The arity of `func`.
18335
+ * @returns {Function} Returns the new wrapped function.
18336
+ */
18337
+ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
18338
+ var isBindKey = bitmask & BIND_KEY_FLAG;
18339
+ if (!isBindKey && typeof func != 'function') {
18340
+ throw new TypeError(FUNC_ERROR_TEXT);
18341
+ }
18342
+ var length = partials ? partials.length : 0;
18343
+ if (!length) {
18344
+ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
18345
+ partials = holders = undefined;
18346
+ }
18347
+ length -= (holders ? holders.length : 0);
18348
+ if (bitmask & PARTIAL_RIGHT_FLAG) {
18349
+ var partialsRight = partials,
18350
+ holdersRight = holders;
18351
+
18352
+ partials = holders = undefined;
18353
+ }
18354
+ var data = isBindKey ? undefined : getData(func),
18355
+ newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
18356
+
18357
+ if (data) {
18358
+ mergeData(newData, data);
18359
+ bitmask = newData[1];
18360
+ arity = newData[9];
18361
+ }
18362
+ newData[9] = arity == null
18363
+ ? (isBindKey ? 0 : func.length)
18364
+ : (nativeMax(arity - length, 0) || 0);
18365
+
18366
+ if (bitmask == BIND_FLAG) {
18367
+ var result = createBindWrapper(newData[0], newData[2]);
18368
+ } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
18369
+ result = createPartialWrapper.apply(undefined, newData);
18370
+ } else {
18371
+ result = createHybridWrapper.apply(undefined, newData);
18372
+ }
18373
+ var setter = data ? baseSetData : setData;
18374
+ return setter(result, newData);
18375
+ }
18376
+
18377
+ /**
18378
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
18379
+ * partial deep comparisons.
18380
+ *
18381
+ * @private
18382
+ * @param {Array} array The array to compare.
18383
+ * @param {Array} other The other array to compare.
18384
+ * @param {Function} equalFunc The function to determine equivalents of values.
18385
+ * @param {Function} [customizer] The function to customize comparing arrays.
18386
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
18387
+ * @param {Array} [stackA] Tracks traversed `value` objects.
18388
+ * @param {Array} [stackB] Tracks traversed `other` objects.
18389
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
18390
+ */
18391
+ function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
18392
+ var index = -1,
18393
+ arrLength = array.length,
18394
+ othLength = other.length;
18395
+
18396
+ if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
18397
+ return false;
18398
+ }
18399
+ // Ignore non-index properties.
18400
+ while (++index < arrLength) {
18401
+ var arrValue = array[index],
18402
+ othValue = other[index],
18403
+ result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
18404
+
18405
+ if (result !== undefined) {
18406
+ if (result) {
18407
+ continue;
18408
+ }
18409
+ return false;
18410
+ }
18411
+ // Recursively compare arrays (susceptible to call stack limits).
18412
+ if (isLoose) {
18413
+ if (!arraySome(other, function(othValue) {
18414
+ return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
18415
+ })) {
18416
+ return false;
18417
+ }
18418
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
18419
+ return false;
18420
+ }
18421
+ }
18422
+ return true;
18423
+ }
18424
+
18425
+ /**
18426
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
18427
+ * the same `toStringTag`.
18428
+ *
18429
+ * **Note:** This function only supports comparing values with tags of
18430
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
18431
+ *
18432
+ * @private
18433
+ * @param {Object} object The object to compare.
18434
+ * @param {Object} other The other object to compare.
18435
+ * @param {string} tag The `toStringTag` of the objects to compare.
18436
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
18437
+ */
18438
+ function equalByTag(object, other, tag) {
18439
+ switch (tag) {
18440
+ case boolTag:
18441
+ case dateTag:
18442
+ // Coerce dates and booleans to numbers, dates to milliseconds and booleans
18443
+ // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
18444
+ return +object == +other;
18445
+
18446
+ case errorTag:
18447
+ return object.name == other.name && object.message == other.message;
18448
+
18449
+ case numberTag:
18450
+ // Treat `NaN` vs. `NaN` as equal.
18451
+ return (object != +object)
18452
+ ? other != +other
18453
+ : object == +other;
18454
+
18455
+ case regexpTag:
18456
+ case stringTag:
18457
+ // Coerce regexes to strings and treat strings primitives and string
18458
+ // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
18459
+ return object == (other + '');
18460
+ }
18461
+ return false;
18462
+ }
18463
+
18464
+ /**
18465
+ * A specialized version of `baseIsEqualDeep` for objects with support for
18466
+ * partial deep comparisons.
18467
+ *
18468
+ * @private
18469
+ * @param {Object} object The object to compare.
18470
+ * @param {Object} other The other object to compare.
18471
+ * @param {Function} equalFunc The function to determine equivalents of values.
18472
+ * @param {Function} [customizer] The function to customize comparing values.
18473
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
18474
+ * @param {Array} [stackA] Tracks traversed `value` objects.
18475
+ * @param {Array} [stackB] Tracks traversed `other` objects.
18476
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
18477
+ */
18478
+ function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
18479
+ var objProps = keys(object),
18480
+ objLength = objProps.length,
18481
+ othProps = keys(other),
18482
+ othLength = othProps.length;
18483
+
18484
+ if (objLength != othLength && !isLoose) {
18485
+ return false;
18486
+ }
18487
+ var index = objLength;
18488
+ while (index--) {
18489
+ var key = objProps[index];
18490
+ if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
18491
+ return false;
18492
+ }
18493
+ }
18494
+ var skipCtor = isLoose;
18495
+ while (++index < objLength) {
18496
+ key = objProps[index];
18497
+ var objValue = object[key],
18498
+ othValue = other[key],
18499
+ result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
18500
+
18501
+ // Recursively compare objects (susceptible to call stack limits).
18502
+ if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
18503
+ return false;
18504
+ }
18505
+ skipCtor || (skipCtor = key == 'constructor');
18506
+ }
18507
+ if (!skipCtor) {
18508
+ var objCtor = object.constructor,
18509
+ othCtor = other.constructor;
18510
+
18511
+ // Non `Object` object instances with different constructors are not equal.
18512
+ if (objCtor != othCtor &&
18513
+ ('constructor' in object && 'constructor' in other) &&
18514
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
18515
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
18516
+ return false;
18517
+ }
18518
+ }
18519
+ return true;
18520
+ }
18521
+
18522
+ /**
18523
+ * Gets the appropriate "callback" function. If the `_.callback` method is
18524
+ * customized this function returns the custom method, otherwise it returns
18525
+ * the `baseCallback` function. If arguments are provided the chosen function
18526
+ * is invoked with them and its result is returned.
18527
+ *
18528
+ * @private
18529
+ * @returns {Function} Returns the chosen function or its result.
18530
+ */
18531
+ function getCallback(func, thisArg, argCount) {
18532
+ var result = lodash.callback || callback;
18533
+ result = result === callback ? baseCallback : result;
18534
+ return argCount ? result(func, thisArg, argCount) : result;
18535
+ }
18536
+
18537
+ /**
18538
+ * Gets metadata for `func`.
18539
+ *
18540
+ * @private
18541
+ * @param {Function} func The function to query.
18542
+ * @returns {*} Returns the metadata for `func`.
18543
+ */
18544
+ var getData = !metaMap ? noop : function(func) {
18545
+ return metaMap.get(func);
18546
+ };
18547
+
18548
+ /**
18549
+ * Gets the name of `func`.
18550
+ *
18551
+ * @private
18552
+ * @param {Function} func The function to query.
18553
+ * @returns {string} Returns the function name.
18554
+ */
18555
+ function getFuncName(func) {
18556
+ var result = func.name,
18557
+ array = realNames[result],
18558
+ length = array ? array.length : 0;
18559
+
18560
+ while (length--) {
18561
+ var data = array[length],
18562
+ otherFunc = data.func;
18563
+ if (otherFunc == null || otherFunc == func) {
18564
+ return data.name;
18565
+ }
18566
+ }
18567
+ return result;
18568
+ }
18569
+
18570
+ /**
18571
+ * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
18572
+ * customized this function returns the custom method, otherwise it returns
18573
+ * the `baseIndexOf` function. If arguments are provided the chosen function
18574
+ * is invoked with them and its result is returned.
18575
+ *
18576
+ * @private
18577
+ * @returns {Function|number} Returns the chosen function or its result.
18578
+ */
18579
+ function getIndexOf(collection, target, fromIndex) {
18580
+ var result = lodash.indexOf || indexOf;
18581
+ result = result === indexOf ? baseIndexOf : result;
18582
+ return collection ? result(collection, target, fromIndex) : result;
18583
+ }
18584
+
18585
+ /**
18586
+ * Gets the "length" property value of `object`.
18587
+ *
18588
+ * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
18589
+ * that affects Safari on at least iOS 8.1-8.3 ARM64.
18590
+ *
18591
+ * @private
18592
+ * @param {Object} object The object to query.
18593
+ * @returns {*} Returns the "length" value.
18594
+ */
18595
+ var getLength = baseProperty('length');
18596
+
18597
+ /**
18598
+ * Gets the propery names, values, and compare flags of `object`.
18599
+ *
18600
+ * @private
18601
+ * @param {Object} object The object to query.
18602
+ * @returns {Array} Returns the match data of `object`.
18603
+ */
18604
+ function getMatchData(object) {
18605
+ var result = pairs(object),
18606
+ length = result.length;
18607
+
18608
+ while (length--) {
18609
+ result[length][2] = isStrictComparable(result[length][1]);
18610
+ }
18611
+ return result;
18612
+ }
18613
+
18614
+ /**
18615
+ * Gets the native function at `key` of `object`.
18616
+ *
18617
+ * @private
18618
+ * @param {Object} object The object to query.
18619
+ * @param {string} key The key of the method to get.
18620
+ * @returns {*} Returns the function if it's native, else `undefined`.
18621
+ */
18622
+ function getNative(object, key) {
18623
+ var value = object == null ? undefined : object[key];
18624
+ return isNative(value) ? value : undefined;
18625
+ }
18626
+
18627
+ /**
18628
+ * Gets the view, applying any `transforms` to the `start` and `end` positions.
18629
+ *
18630
+ * @private
18631
+ * @param {number} start The start of the view.
18632
+ * @param {number} end The end of the view.
18633
+ * @param {Array} transforms The transformations to apply to the view.
18634
+ * @returns {Object} Returns an object containing the `start` and `end`
18635
+ * positions of the view.
18636
+ */
18637
+ function getView(start, end, transforms) {
18638
+ var index = -1,
18639
+ length = transforms.length;
18640
+
18641
+ while (++index < length) {
18642
+ var data = transforms[index],
18643
+ size = data.size;
18644
+
18645
+ switch (data.type) {
18646
+ case 'drop': start += size; break;
18647
+ case 'dropRight': end -= size; break;
18648
+ case 'take': end = nativeMin(end, start + size); break;
18649
+ case 'takeRight': start = nativeMax(start, end - size); break;
18650
+ }
18651
+ }
18652
+ return { 'start': start, 'end': end };
18653
+ }
18654
+
18655
+ /**
18656
+ * Initializes an array clone.
18657
+ *
18658
+ * @private
18659
+ * @param {Array} array The array to clone.
18660
+ * @returns {Array} Returns the initialized clone.
18661
+ */
18662
+ function initCloneArray(array) {
18663
+ var length = array.length,
18664
+ result = new array.constructor(length);
18665
+
18666
+ // Add array properties assigned by `RegExp#exec`.
18667
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
18668
+ result.index = array.index;
18669
+ result.input = array.input;
18670
+ }
18671
+ return result;
18672
+ }
18673
+
18674
+ /**
18675
+ * Initializes an object clone.
18676
+ *
18677
+ * @private
18678
+ * @param {Object} object The object to clone.
18679
+ * @returns {Object} Returns the initialized clone.
18680
+ */
18681
+ function initCloneObject(object) {
18682
+ var Ctor = object.constructor;
18683
+ if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
18684
+ Ctor = Object;
18685
+ }
18686
+ return new Ctor;
18687
+ }
18688
+
18689
+ /**
18690
+ * Initializes an object clone based on its `toStringTag`.
18691
+ *
18692
+ * **Note:** This function only supports cloning values with tags of
18693
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
18694
+ *
18695
+ * @private
18696
+ * @param {Object} object The object to clone.
18697
+ * @param {string} tag The `toStringTag` of the object to clone.
18698
+ * @param {boolean} [isDeep] Specify a deep clone.
18699
+ * @returns {Object} Returns the initialized clone.
18700
+ */
18701
+ function initCloneByTag(object, tag, isDeep) {
18702
+ var Ctor = object.constructor;
18703
+ switch (tag) {
18704
+ case arrayBufferTag:
18705
+ return bufferClone(object);
18706
+
18707
+ case boolTag:
18708
+ case dateTag:
18709
+ return new Ctor(+object);
18710
+
18711
+ case float32Tag: case float64Tag:
18712
+ case int8Tag: case int16Tag: case int32Tag:
18713
+ case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
18714
+ var buffer = object.buffer;
18715
+ return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
18716
+
18717
+ case numberTag:
18718
+ case stringTag:
18719
+ return new Ctor(object);
18720
+
18721
+ case regexpTag:
18722
+ var result = new Ctor(object.source, reFlags.exec(object));
18723
+ result.lastIndex = object.lastIndex;
18724
+ }
18725
+ return result;
18726
+ }
18727
+
18728
+ /**
18729
+ * Invokes the method at `path` on `object`.
18730
+ *
18731
+ * @private
18732
+ * @param {Object} object The object to query.
18733
+ * @param {Array|string} path The path of the method to invoke.
18734
+ * @param {Array} args The arguments to invoke the method with.
18735
+ * @returns {*} Returns the result of the invoked method.
18736
+ */
18737
+ function invokePath(object, path, args) {
18738
+ if (object != null && !isKey(path, object)) {
18739
+ path = toPath(path);
18740
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
18741
+ path = last(path);
18742
+ }
18743
+ var func = object == null ? object : object[path];
18744
+ return func == null ? undefined : func.apply(object, args);
18745
+ }
18746
+
18747
+ /**
18748
+ * Checks if `value` is array-like.
18749
+ *
18750
+ * @private
18751
+ * @param {*} value The value to check.
18752
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
18753
+ */
18754
+ function isArrayLike(value) {
18755
+ return value != null && isLength(getLength(value));
18756
+ }
18757
+
18758
+ /**
18759
+ * Checks if `value` is a valid array-like index.
18760
+ *
18761
+ * @private
18762
+ * @param {*} value The value to check.
18763
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
18764
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
18765
+ */
18766
+ function isIndex(value, length) {
18767
+ value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
18768
+ length = length == null ? MAX_SAFE_INTEGER : length;
18769
+ return value > -1 && value % 1 == 0 && value < length;
18770
+ }
18771
+
18772
+ /**
18773
+ * Checks if the provided arguments are from an iteratee call.
18774
+ *
18775
+ * @private
18776
+ * @param {*} value The potential iteratee value argument.
18777
+ * @param {*} index The potential iteratee index or key argument.
18778
+ * @param {*} object The potential iteratee object argument.
18779
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
18780
+ */
18781
+ function isIterateeCall(value, index, object) {
18782
+ if (!isObject(object)) {
18783
+ return false;
18784
+ }
18785
+ var type = typeof index;
18786
+ if (type == 'number'
18787
+ ? (isArrayLike(object) && isIndex(index, object.length))
18788
+ : (type == 'string' && index in object)) {
18789
+ var other = object[index];
18790
+ return value === value ? (value === other) : (other !== other);
18791
+ }
18792
+ return false;
18793
+ }
18794
+
18795
+ /**
18796
+ * Checks if `value` is a property name and not a property path.
18797
+ *
18798
+ * @private
18799
+ * @param {*} value The value to check.
18800
+ * @param {Object} [object] The object to query keys on.
18801
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
18802
+ */
18803
+ function isKey(value, object) {
18804
+ var type = typeof value;
18805
+ if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
18806
+ return true;
18807
+ }
18808
+ if (isArray(value)) {
18809
+ return false;
18810
+ }
18811
+ var result = !reIsDeepProp.test(value);
18812
+ return result || (object != null && value in toObject(object));
18813
+ }
18814
+
18815
+ /**
18816
+ * Checks if `func` has a lazy counterpart.
18817
+ *
18818
+ * @private
18819
+ * @param {Function} func The function to check.
18820
+ * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
18821
+ */
18822
+ function isLaziable(func) {
18823
+ var funcName = getFuncName(func);
18824
+ if (!(funcName in LazyWrapper.prototype)) {
18825
+ return false;
18826
+ }
18827
+ var other = lodash[funcName];
18828
+ if (func === other) {
18829
+ return true;
18830
+ }
18831
+ var data = getData(other);
18832
+ return !!data && func === data[0];
18833
+ }
18834
+
18835
+ /**
18836
+ * Checks if `value` is a valid array-like length.
18837
+ *
18838
+ * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
18839
+ *
18840
+ * @private
18841
+ * @param {*} value The value to check.
18842
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
18843
+ */
18844
+ function isLength(value) {
18845
+ return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
18846
+ }
18847
+
18848
+ /**
18849
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
18850
+ *
18851
+ * @private
18852
+ * @param {*} value The value to check.
18853
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
18854
+ * equality comparisons, else `false`.
18855
+ */
18856
+ function isStrictComparable(value) {
18857
+ return value === value && !isObject(value);
18858
+ }
18859
+
18860
+ /**
18861
+ * Merges the function metadata of `source` into `data`.
18862
+ *
18863
+ * Merging metadata reduces the number of wrappers required to invoke a function.
18864
+ * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
18865
+ * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
18866
+ * augment function arguments, making the order in which they are executed important,
18867
+ * preventing the merging of metadata. However, we make an exception for a safe
18868
+ * common case where curried functions have `_.ary` and or `_.rearg` applied.
18869
+ *
18870
+ * @private
18871
+ * @param {Array} data The destination metadata.
18872
+ * @param {Array} source The source metadata.
18873
+ * @returns {Array} Returns `data`.
18874
+ */
18875
+ function mergeData(data, source) {
18876
+ var bitmask = data[1],
18877
+ srcBitmask = source[1],
18878
+ newBitmask = bitmask | srcBitmask,
18879
+ isCommon = newBitmask < ARY_FLAG;
18880
+
18881
+ var isCombo =
18882
+ (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
18883
+ (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
18884
+ (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
18885
+
18886
+ // Exit early if metadata can't be merged.
18887
+ if (!(isCommon || isCombo)) {
18888
+ return data;
18889
+ }
18890
+ // Use source `thisArg` if available.
18891
+ if (srcBitmask & BIND_FLAG) {
18892
+ data[2] = source[2];
18893
+ // Set when currying a bound function.
18894
+ newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
18895
+ }
18896
+ // Compose partial arguments.
18897
+ var value = source[3];
18898
+ if (value) {
18899
+ var partials = data[3];
18900
+ data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
18901
+ data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
18902
+ }
18903
+ // Compose partial right arguments.
18904
+ value = source[5];
18905
+ if (value) {
18906
+ partials = data[5];
18907
+ data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
18908
+ data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
18909
+ }
18910
+ // Use source `argPos` if available.
18911
+ value = source[7];
18912
+ if (value) {
18913
+ data[7] = arrayCopy(value);
18914
+ }
18915
+ // Use source `ary` if it's smaller.
18916
+ if (srcBitmask & ARY_FLAG) {
18917
+ data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
18918
+ }
18919
+ // Use source `arity` if one is not provided.
18920
+ if (data[9] == null) {
18921
+ data[9] = source[9];
18922
+ }
18923
+ // Use source `func` and merge bitmasks.
18924
+ data[0] = source[0];
18925
+ data[1] = newBitmask;
18926
+
18927
+ return data;
18928
+ }
18929
+
18930
+ /**
18931
+ * Used by `_.defaultsDeep` to customize its `_.merge` use.
18932
+ *
18933
+ * @private
18934
+ * @param {*} objectValue The destination object property value.
18935
+ * @param {*} sourceValue The source object property value.
18936
+ * @returns {*} Returns the value to assign to the destination object.
18937
+ */
18938
+ function mergeDefaults(objectValue, sourceValue) {
18939
+ return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
18940
+ }
18941
+
18942
+ /**
18943
+ * A specialized version of `_.pick` which picks `object` properties specified
18944
+ * by `props`.
18945
+ *
18946
+ * @private
18947
+ * @param {Object} object The source object.
18948
+ * @param {string[]} props The property names to pick.
18949
+ * @returns {Object} Returns the new object.
18950
+ */
18951
+ function pickByArray(object, props) {
18952
+ object = toObject(object);
18953
+
18954
+ var index = -1,
18955
+ length = props.length,
18956
+ result = {};
18957
+
18958
+ while (++index < length) {
18959
+ var key = props[index];
18960
+ if (key in object) {
18961
+ result[key] = object[key];
18962
+ }
18963
+ }
18964
+ return result;
18965
+ }
18966
+
18967
+ /**
18968
+ * A specialized version of `_.pick` which picks `object` properties `predicate`
18969
+ * returns truthy for.
18970
+ *
18971
+ * @private
18972
+ * @param {Object} object The source object.
18973
+ * @param {Function} predicate The function invoked per iteration.
18974
+ * @returns {Object} Returns the new object.
18975
+ */
18976
+ function pickByCallback(object, predicate) {
18977
+ var result = {};
18978
+ baseForIn(object, function(value, key, object) {
18979
+ if (predicate(value, key, object)) {
18980
+ result[key] = value;
18981
+ }
18982
+ });
18983
+ return result;
18984
+ }
18985
+
18986
+ /**
18987
+ * Reorder `array` according to the specified indexes where the element at
18988
+ * the first index is assigned as the first element, the element at
18989
+ * the second index is assigned as the second element, and so on.
18990
+ *
18991
+ * @private
18992
+ * @param {Array} array The array to reorder.
18993
+ * @param {Array} indexes The arranged array indexes.
18994
+ * @returns {Array} Returns `array`.
18995
+ */
18996
+ function reorder(array, indexes) {
18997
+ var arrLength = array.length,
18998
+ length = nativeMin(indexes.length, arrLength),
18999
+ oldArray = arrayCopy(array);
19000
+
19001
+ while (length--) {
19002
+ var index = indexes[length];
19003
+ array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
19004
+ }
19005
+ return array;
19006
+ }
19007
+
19008
+ /**
19009
+ * Sets metadata for `func`.
19010
+ *
19011
+ * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
19012
+ * period of time, it will trip its breaker and transition to an identity function
19013
+ * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
19014
+ * for more details.
19015
+ *
19016
+ * @private
19017
+ * @param {Function} func The function to associate metadata with.
19018
+ * @param {*} data The metadata.
19019
+ * @returns {Function} Returns `func`.
19020
+ */
19021
+ var setData = (function() {
19022
+ var count = 0,
19023
+ lastCalled = 0;
19024
+
19025
+ return function(key, value) {
19026
+ var stamp = now(),
19027
+ remaining = HOT_SPAN - (stamp - lastCalled);
19028
+
19029
+ lastCalled = stamp;
19030
+ if (remaining > 0) {
19031
+ if (++count >= HOT_COUNT) {
19032
+ return key;
19033
+ }
19034
+ } else {
19035
+ count = 0;
19036
+ }
19037
+ return baseSetData(key, value);
19038
+ };
19039
+ }());
19040
+
19041
+ /**
19042
+ * A fallback implementation of `Object.keys` which creates an array of the
19043
+ * own enumerable property names of `object`.
19044
+ *
19045
+ * @private
19046
+ * @param {Object} object The object to query.
19047
+ * @returns {Array} Returns the array of property names.
19048
+ */
19049
+ function shimKeys(object) {
19050
+ var props = keysIn(object),
19051
+ propsLength = props.length,
19052
+ length = propsLength && object.length;
19053
+
19054
+ var allowIndexes = !!length && isLength(length) &&
19055
+ (isArray(object) || isArguments(object));
19056
+
19057
+ var index = -1,
19058
+ result = [];
19059
+
19060
+ while (++index < propsLength) {
19061
+ var key = props[index];
19062
+ if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
19063
+ result.push(key);
19064
+ }
19065
+ }
19066
+ return result;
19067
+ }
19068
+
19069
+ /**
19070
+ * Converts `value` to an array-like object if it's not one.
19071
+ *
19072
+ * @private
19073
+ * @param {*} value The value to process.
19074
+ * @returns {Array|Object} Returns the array-like object.
19075
+ */
19076
+ function toIterable(value) {
19077
+ if (value == null) {
19078
+ return [];
19079
+ }
19080
+ if (!isArrayLike(value)) {
19081
+ return values(value);
19082
+ }
19083
+ return isObject(value) ? value : Object(value);
19084
+ }
19085
+
19086
+ /**
19087
+ * Converts `value` to an object if it's not one.
19088
+ *
19089
+ * @private
19090
+ * @param {*} value The value to process.
19091
+ * @returns {Object} Returns the object.
19092
+ */
19093
+ function toObject(value) {
19094
+ return isObject(value) ? value : Object(value);
19095
+ }
19096
+
19097
+ /**
19098
+ * Converts `value` to property path array if it's not one.
19099
+ *
19100
+ * @private
19101
+ * @param {*} value The value to process.
19102
+ * @returns {Array} Returns the property path array.
19103
+ */
19104
+ function toPath(value) {
19105
+ if (isArray(value)) {
19106
+ return value;
19107
+ }
19108
+ var result = [];
19109
+ baseToString(value).replace(rePropName, function(match, number, quote, string) {
19110
+ result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
19111
+ });
19112
+ return result;
19113
+ }
19114
+
19115
+ /**
19116
+ * Creates a clone of `wrapper`.
19117
+ *
19118
+ * @private
19119
+ * @param {Object} wrapper The wrapper to clone.
19120
+ * @returns {Object} Returns the cloned wrapper.
19121
+ */
19122
+ function wrapperClone(wrapper) {
19123
+ return wrapper instanceof LazyWrapper
19124
+ ? wrapper.clone()
19125
+ : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
19126
+ }
19127
+
19128
+ /*------------------------------------------------------------------------*/
19129
+
19130
+ /**
19131
+ * Creates an array of elements split into groups the length of `size`.
19132
+ * If `collection` can't be split evenly, the final chunk will be the remaining
19133
+ * elements.
19134
+ *
19135
+ * @static
19136
+ * @memberOf _
19137
+ * @category Array
19138
+ * @param {Array} array The array to process.
19139
+ * @param {number} [size=1] The length of each chunk.
19140
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
19141
+ * @returns {Array} Returns the new array containing chunks.
19142
+ * @example
19143
+ *
19144
+ * _.chunk(['a', 'b', 'c', 'd'], 2);
19145
+ * // => [['a', 'b'], ['c', 'd']]
19146
+ *
19147
+ * _.chunk(['a', 'b', 'c', 'd'], 3);
19148
+ * // => [['a', 'b', 'c'], ['d']]
19149
+ */
19150
+ function chunk(array, size, guard) {
19151
+ if (guard ? isIterateeCall(array, size, guard) : size == null) {
19152
+ size = 1;
19153
+ } else {
19154
+ size = nativeMax(nativeFloor(size) || 1, 1);
19155
+ }
19156
+ var index = 0,
19157
+ length = array ? array.length : 0,
19158
+ resIndex = -1,
19159
+ result = Array(nativeCeil(length / size));
19160
+
19161
+ while (index < length) {
19162
+ result[++resIndex] = baseSlice(array, index, (index += size));
19163
+ }
19164
+ return result;
19165
+ }
19166
+
19167
+ /**
19168
+ * Creates an array with all falsey values removed. The values `false`, `null`,
19169
+ * `0`, `""`, `undefined`, and `NaN` are falsey.
19170
+ *
19171
+ * @static
19172
+ * @memberOf _
19173
+ * @category Array
19174
+ * @param {Array} array The array to compact.
19175
+ * @returns {Array} Returns the new array of filtered values.
19176
+ * @example
19177
+ *
19178
+ * _.compact([0, 1, false, 2, '', 3]);
19179
+ * // => [1, 2, 3]
19180
+ */
19181
+ function compact(array) {
19182
+ var index = -1,
19183
+ length = array ? array.length : 0,
19184
+ resIndex = -1,
19185
+ result = [];
19186
+
19187
+ while (++index < length) {
19188
+ var value = array[index];
19189
+ if (value) {
19190
+ result[++resIndex] = value;
19191
+ }
19192
+ }
19193
+ return result;
19194
+ }
19195
+
19196
+ /**
19197
+ * Creates an array of unique `array` values not included in the other
19198
+ * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
19199
+ * for equality comparisons.
19200
+ *
19201
+ * @static
19202
+ * @memberOf _
19203
+ * @category Array
19204
+ * @param {Array} array The array to inspect.
19205
+ * @param {...Array} [values] The arrays of values to exclude.
19206
+ * @returns {Array} Returns the new array of filtered values.
19207
+ * @example
19208
+ *
19209
+ * _.difference([1, 2, 3], [4, 2]);
19210
+ * // => [1, 3]
19211
+ */
19212
+ var difference = restParam(function(array, values) {
19213
+ return (isObjectLike(array) && isArrayLike(array))
19214
+ ? baseDifference(array, baseFlatten(values, false, true))
19215
+ : [];
19216
+ });
19217
+
19218
+ /**
19219
+ * Creates a slice of `array` with `n` elements dropped from the beginning.
19220
+ *
19221
+ * @static
19222
+ * @memberOf _
19223
+ * @category Array
19224
+ * @param {Array} array The array to query.
19225
+ * @param {number} [n=1] The number of elements to drop.
19226
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
19227
+ * @returns {Array} Returns the slice of `array`.
19228
+ * @example
19229
+ *
19230
+ * _.drop([1, 2, 3]);
19231
+ * // => [2, 3]
19232
+ *
19233
+ * _.drop([1, 2, 3], 2);
19234
+ * // => [3]
19235
+ *
19236
+ * _.drop([1, 2, 3], 5);
19237
+ * // => []
19238
+ *
19239
+ * _.drop([1, 2, 3], 0);
19240
+ * // => [1, 2, 3]
19241
+ */
19242
+ function drop(array, n, guard) {
19243
+ var length = array ? array.length : 0;
19244
+ if (!length) {
19245
+ return [];
19246
+ }
19247
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
19248
+ n = 1;
19249
+ }
19250
+ return baseSlice(array, n < 0 ? 0 : n);
19251
+ }
19252
+
19253
+ /**
19254
+ * Creates a slice of `array` with `n` elements dropped from the end.
19255
+ *
19256
+ * @static
19257
+ * @memberOf _
19258
+ * @category Array
19259
+ * @param {Array} array The array to query.
19260
+ * @param {number} [n=1] The number of elements to drop.
19261
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
19262
+ * @returns {Array} Returns the slice of `array`.
19263
+ * @example
19264
+ *
19265
+ * _.dropRight([1, 2, 3]);
19266
+ * // => [1, 2]
19267
+ *
19268
+ * _.dropRight([1, 2, 3], 2);
19269
+ * // => [1]
19270
+ *
19271
+ * _.dropRight([1, 2, 3], 5);
19272
+ * // => []
19273
+ *
19274
+ * _.dropRight([1, 2, 3], 0);
19275
+ * // => [1, 2, 3]
19276
+ */
19277
+ function dropRight(array, n, guard) {
19278
+ var length = array ? array.length : 0;
19279
+ if (!length) {
19280
+ return [];
19281
+ }
19282
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
19283
+ n = 1;
19284
+ }
19285
+ n = length - (+n || 0);
19286
+ return baseSlice(array, 0, n < 0 ? 0 : n);
19287
+ }
19288
+
19289
+ /**
19290
+ * Creates a slice of `array` excluding elements dropped from the end.
19291
+ * Elements are dropped until `predicate` returns falsey. The predicate is
19292
+ * bound to `thisArg` and invoked with three arguments: (value, index, array).
19293
+ *
19294
+ * If a property name is provided for `predicate` the created `_.property`
19295
+ * style callback returns the property value of the given element.
19296
+ *
19297
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19298
+ * style callback returns `true` for elements that have a matching property
19299
+ * value, else `false`.
19300
+ *
19301
+ * If an object is provided for `predicate` the created `_.matches` style
19302
+ * callback returns `true` for elements that match the properties of the given
19303
+ * object, else `false`.
19304
+ *
19305
+ * @static
19306
+ * @memberOf _
19307
+ * @category Array
19308
+ * @param {Array} array The array to query.
19309
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
19310
+ * per iteration.
19311
+ * @param {*} [thisArg] The `this` binding of `predicate`.
19312
+ * @returns {Array} Returns the slice of `array`.
19313
+ * @example
19314
+ *
19315
+ * _.dropRightWhile([1, 2, 3], function(n) {
19316
+ * return n > 1;
19317
+ * });
19318
+ * // => [1]
19319
+ *
19320
+ * var users = [
19321
+ * { 'user': 'barney', 'active': true },
19322
+ * { 'user': 'fred', 'active': false },
19323
+ * { 'user': 'pebbles', 'active': false }
19324
+ * ];
19325
+ *
19326
+ * // using the `_.matches` callback shorthand
19327
+ * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
19328
+ * // => ['barney', 'fred']
19329
+ *
19330
+ * // using the `_.matchesProperty` callback shorthand
19331
+ * _.pluck(_.dropRightWhile(users, 'active', false), 'user');
19332
+ * // => ['barney']
19333
+ *
19334
+ * // using the `_.property` callback shorthand
19335
+ * _.pluck(_.dropRightWhile(users, 'active'), 'user');
19336
+ * // => ['barney', 'fred', 'pebbles']
19337
+ */
19338
+ function dropRightWhile(array, predicate, thisArg) {
19339
+ return (array && array.length)
19340
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)
19341
+ : [];
19342
+ }
19343
+
19344
+ /**
19345
+ * Creates a slice of `array` excluding elements dropped from the beginning.
19346
+ * Elements are dropped until `predicate` returns falsey. The predicate is
19347
+ * bound to `thisArg` and invoked with three arguments: (value, index, array).
19348
+ *
19349
+ * If a property name is provided for `predicate` the created `_.property`
19350
+ * style callback returns the property value of the given element.
19351
+ *
19352
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19353
+ * style callback returns `true` for elements that have a matching property
19354
+ * value, else `false`.
19355
+ *
19356
+ * If an object is provided for `predicate` the created `_.matches` style
19357
+ * callback returns `true` for elements that have the properties of the given
19358
+ * object, else `false`.
19359
+ *
19360
+ * @static
19361
+ * @memberOf _
19362
+ * @category Array
19363
+ * @param {Array} array The array to query.
19364
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
19365
+ * per iteration.
19366
+ * @param {*} [thisArg] The `this` binding of `predicate`.
19367
+ * @returns {Array} Returns the slice of `array`.
19368
+ * @example
19369
+ *
19370
+ * _.dropWhile([1, 2, 3], function(n) {
19371
+ * return n < 3;
19372
+ * });
19373
+ * // => [3]
19374
+ *
19375
+ * var users = [
19376
+ * { 'user': 'barney', 'active': false },
19377
+ * { 'user': 'fred', 'active': false },
19378
+ * { 'user': 'pebbles', 'active': true }
19379
+ * ];
19380
+ *
19381
+ * // using the `_.matches` callback shorthand
19382
+ * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
19383
+ * // => ['fred', 'pebbles']
19384
+ *
19385
+ * // using the `_.matchesProperty` callback shorthand
19386
+ * _.pluck(_.dropWhile(users, 'active', false), 'user');
19387
+ * // => ['pebbles']
19388
+ *
19389
+ * // using the `_.property` callback shorthand
19390
+ * _.pluck(_.dropWhile(users, 'active'), 'user');
19391
+ * // => ['barney', 'fred', 'pebbles']
19392
+ */
19393
+ function dropWhile(array, predicate, thisArg) {
19394
+ return (array && array.length)
19395
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), true)
19396
+ : [];
19397
+ }
19398
+
19399
+ /**
19400
+ * Fills elements of `array` with `value` from `start` up to, but not
19401
+ * including, `end`.
19402
+ *
19403
+ * **Note:** This method mutates `array`.
19404
+ *
19405
+ * @static
19406
+ * @memberOf _
19407
+ * @category Array
19408
+ * @param {Array} array The array to fill.
19409
+ * @param {*} value The value to fill `array` with.
19410
+ * @param {number} [start=0] The start position.
19411
+ * @param {number} [end=array.length] The end position.
19412
+ * @returns {Array} Returns `array`.
19413
+ * @example
19414
+ *
19415
+ * var array = [1, 2, 3];
19416
+ *
19417
+ * _.fill(array, 'a');
19418
+ * console.log(array);
19419
+ * // => ['a', 'a', 'a']
19420
+ *
19421
+ * _.fill(Array(3), 2);
19422
+ * // => [2, 2, 2]
19423
+ *
19424
+ * _.fill([4, 6, 8], '*', 1, 2);
19425
+ * // => [4, '*', 8]
19426
+ */
19427
+ function fill(array, value, start, end) {
19428
+ var length = array ? array.length : 0;
19429
+ if (!length) {
19430
+ return [];
19431
+ }
19432
+ if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
19433
+ start = 0;
19434
+ end = length;
19435
+ }
19436
+ return baseFill(array, value, start, end);
19437
+ }
19438
+
19439
+ /**
19440
+ * This method is like `_.find` except that it returns the index of the first
19441
+ * element `predicate` returns truthy for instead of the element itself.
19442
+ *
19443
+ * If a property name is provided for `predicate` the created `_.property`
19444
+ * style callback returns the property value of the given element.
19445
+ *
19446
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19447
+ * style callback returns `true` for elements that have a matching property
19448
+ * value, else `false`.
19449
+ *
19450
+ * If an object is provided for `predicate` the created `_.matches` style
19451
+ * callback returns `true` for elements that have the properties of the given
19452
+ * object, else `false`.
19453
+ *
19454
+ * @static
19455
+ * @memberOf _
19456
+ * @category Array
19457
+ * @param {Array} array The array to search.
19458
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
19459
+ * per iteration.
19460
+ * @param {*} [thisArg] The `this` binding of `predicate`.
19461
+ * @returns {number} Returns the index of the found element, else `-1`.
19462
+ * @example
19463
+ *
19464
+ * var users = [
19465
+ * { 'user': 'barney', 'active': false },
19466
+ * { 'user': 'fred', 'active': false },
19467
+ * { 'user': 'pebbles', 'active': true }
19468
+ * ];
19469
+ *
19470
+ * _.findIndex(users, function(chr) {
19471
+ * return chr.user == 'barney';
19472
+ * });
19473
+ * // => 0
19474
+ *
19475
+ * // using the `_.matches` callback shorthand
19476
+ * _.findIndex(users, { 'user': 'fred', 'active': false });
19477
+ * // => 1
19478
+ *
19479
+ * // using the `_.matchesProperty` callback shorthand
19480
+ * _.findIndex(users, 'active', false);
19481
+ * // => 0
19482
+ *
19483
+ * // using the `_.property` callback shorthand
19484
+ * _.findIndex(users, 'active');
19485
+ * // => 2
19486
+ */
19487
+ var findIndex = createFindIndex();
19488
+
19489
+ /**
19490
+ * This method is like `_.findIndex` except that it iterates over elements
19491
+ * of `collection` from right to left.
19492
+ *
19493
+ * If a property name is provided for `predicate` the created `_.property`
19494
+ * style callback returns the property value of the given element.
19495
+ *
19496
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19497
+ * style callback returns `true` for elements that have a matching property
19498
+ * value, else `false`.
19499
+ *
19500
+ * If an object is provided for `predicate` the created `_.matches` style
19501
+ * callback returns `true` for elements that have the properties of the given
19502
+ * object, else `false`.
19503
+ *
19504
+ * @static
19505
+ * @memberOf _
19506
+ * @category Array
19507
+ * @param {Array} array The array to search.
19508
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
19509
+ * per iteration.
19510
+ * @param {*} [thisArg] The `this` binding of `predicate`.
19511
+ * @returns {number} Returns the index of the found element, else `-1`.
19512
+ * @example
19513
+ *
19514
+ * var users = [
19515
+ * { 'user': 'barney', 'active': true },
19516
+ * { 'user': 'fred', 'active': false },
19517
+ * { 'user': 'pebbles', 'active': false }
19518
+ * ];
19519
+ *
19520
+ * _.findLastIndex(users, function(chr) {
19521
+ * return chr.user == 'pebbles';
19522
+ * });
19523
+ * // => 2
19524
+ *
19525
+ * // using the `_.matches` callback shorthand
19526
+ * _.findLastIndex(users, { 'user': 'barney', 'active': true });
19527
+ * // => 0
19528
+ *
19529
+ * // using the `_.matchesProperty` callback shorthand
19530
+ * _.findLastIndex(users, 'active', false);
19531
+ * // => 2
19532
+ *
19533
+ * // using the `_.property` callback shorthand
19534
+ * _.findLastIndex(users, 'active');
19535
+ * // => 0
19536
+ */
19537
+ var findLastIndex = createFindIndex(true);
19538
+
19539
+ /**
19540
+ * Gets the first element of `array`.
19541
+ *
19542
+ * @static
19543
+ * @memberOf _
19544
+ * @alias head
19545
+ * @category Array
19546
+ * @param {Array} array The array to query.
19547
+ * @returns {*} Returns the first element of `array`.
19548
+ * @example
19549
+ *
19550
+ * _.first([1, 2, 3]);
19551
+ * // => 1
19552
+ *
19553
+ * _.first([]);
19554
+ * // => undefined
19555
+ */
19556
+ function first(array) {
19557
+ return array ? array[0] : undefined;
19558
+ }
19559
+
19560
+ /**
19561
+ * Flattens a nested array. If `isDeep` is `true` the array is recursively
19562
+ * flattened, otherwise it is only flattened a single level.
19563
+ *
19564
+ * @static
19565
+ * @memberOf _
19566
+ * @category Array
19567
+ * @param {Array} array The array to flatten.
19568
+ * @param {boolean} [isDeep] Specify a deep flatten.
19569
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
19570
+ * @returns {Array} Returns the new flattened array.
19571
+ * @example
19572
+ *
19573
+ * _.flatten([1, [2, 3, [4]]]);
19574
+ * // => [1, 2, 3, [4]]
19575
+ *
19576
+ * // using `isDeep`
19577
+ * _.flatten([1, [2, 3, [4]]], true);
19578
+ * // => [1, 2, 3, 4]
19579
+ */
19580
+ function flatten(array, isDeep, guard) {
19581
+ var length = array ? array.length : 0;
19582
+ if (guard && isIterateeCall(array, isDeep, guard)) {
19583
+ isDeep = false;
19584
+ }
19585
+ return length ? baseFlatten(array, isDeep) : [];
19586
+ }
19587
+
19588
+ /**
19589
+ * Recursively flattens a nested array.
19590
+ *
19591
+ * @static
19592
+ * @memberOf _
19593
+ * @category Array
19594
+ * @param {Array} array The array to recursively flatten.
19595
+ * @returns {Array} Returns the new flattened array.
19596
+ * @example
19597
+ *
19598
+ * _.flattenDeep([1, [2, 3, [4]]]);
19599
+ * // => [1, 2, 3, 4]
19600
+ */
19601
+ function flattenDeep(array) {
19602
+ var length = array ? array.length : 0;
19603
+ return length ? baseFlatten(array, true) : [];
19604
+ }
19605
+
19606
+ /**
19607
+ * Gets the index at which the first occurrence of `value` is found in `array`
19608
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
19609
+ * for equality comparisons. If `fromIndex` is negative, it is used as the offset
19610
+ * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
19611
+ * performs a faster binary search.
19612
+ *
19613
+ * @static
19614
+ * @memberOf _
19615
+ * @category Array
19616
+ * @param {Array} array The array to search.
19617
+ * @param {*} value The value to search for.
19618
+ * @param {boolean|number} [fromIndex=0] The index to search from or `true`
19619
+ * to perform a binary search on a sorted array.
19620
+ * @returns {number} Returns the index of the matched value, else `-1`.
19621
+ * @example
19622
+ *
19623
+ * _.indexOf([1, 2, 1, 2], 2);
19624
+ * // => 1
19625
+ *
19626
+ * // using `fromIndex`
19627
+ * _.indexOf([1, 2, 1, 2], 2, 2);
19628
+ * // => 3
19629
+ *
19630
+ * // performing a binary search
19631
+ * _.indexOf([1, 1, 2, 2], 2, true);
19632
+ * // => 2
19633
+ */
19634
+ function indexOf(array, value, fromIndex) {
19635
+ var length = array ? array.length : 0;
19636
+ if (!length) {
19637
+ return -1;
19638
+ }
19639
+ if (typeof fromIndex == 'number') {
19640
+ fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
19641
+ } else if (fromIndex) {
19642
+ var index = binaryIndex(array, value);
19643
+ if (index < length &&
19644
+ (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
19645
+ return index;
19646
+ }
19647
+ return -1;
19648
+ }
19649
+ return baseIndexOf(array, value, fromIndex || 0);
19650
+ }
19651
+
19652
+ /**
19653
+ * Gets all but the last element of `array`.
19654
+ *
19655
+ * @static
19656
+ * @memberOf _
19657
+ * @category Array
19658
+ * @param {Array} array The array to query.
19659
+ * @returns {Array} Returns the slice of `array`.
19660
+ * @example
19661
+ *
19662
+ * _.initial([1, 2, 3]);
19663
+ * // => [1, 2]
19664
+ */
19665
+ function initial(array) {
19666
+ return dropRight(array, 1);
19667
+ }
19668
+
19669
+ /**
19670
+ * Creates an array of unique values that are included in all of the provided
19671
+ * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
19672
+ * for equality comparisons.
19673
+ *
19674
+ * @static
19675
+ * @memberOf _
19676
+ * @category Array
19677
+ * @param {...Array} [arrays] The arrays to inspect.
19678
+ * @returns {Array} Returns the new array of shared values.
19679
+ * @example
19680
+ * _.intersection([1, 2], [4, 2], [2, 1]);
19681
+ * // => [2]
19682
+ */
19683
+ var intersection = restParam(function(arrays) {
19684
+ var othLength = arrays.length,
19685
+ othIndex = othLength,
19686
+ caches = Array(length),
19687
+ indexOf = getIndexOf(),
19688
+ isCommon = indexOf == baseIndexOf,
19689
+ result = [];
19690
+
19691
+ while (othIndex--) {
19692
+ var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
19693
+ caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
19694
+ }
19695
+ var array = arrays[0],
19696
+ index = -1,
19697
+ length = array ? array.length : 0,
19698
+ seen = caches[0];
19699
+
19700
+ outer:
19701
+ while (++index < length) {
19702
+ value = array[index];
19703
+ if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
19704
+ var othIndex = othLength;
19705
+ while (--othIndex) {
19706
+ var cache = caches[othIndex];
19707
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
19708
+ continue outer;
19709
+ }
19710
+ }
19711
+ if (seen) {
19712
+ seen.push(value);
19713
+ }
19714
+ result.push(value);
19715
+ }
19716
+ }
19717
+ return result;
19718
+ });
19719
+
19720
+ /**
19721
+ * Gets the last element of `array`.
19722
+ *
19723
+ * @static
19724
+ * @memberOf _
19725
+ * @category Array
19726
+ * @param {Array} array The array to query.
19727
+ * @returns {*} Returns the last element of `array`.
19728
+ * @example
19729
+ *
19730
+ * _.last([1, 2, 3]);
19731
+ * // => 3
19732
+ */
19733
+ function last(array) {
19734
+ var length = array ? array.length : 0;
19735
+ return length ? array[length - 1] : undefined;
19736
+ }
19737
+
19738
+ /**
19739
+ * This method is like `_.indexOf` except that it iterates over elements of
19740
+ * `array` from right to left.
19741
+ *
19742
+ * @static
19743
+ * @memberOf _
19744
+ * @category Array
19745
+ * @param {Array} array The array to search.
19746
+ * @param {*} value The value to search for.
19747
+ * @param {boolean|number} [fromIndex=array.length-1] The index to search from
19748
+ * or `true` to perform a binary search on a sorted array.
19749
+ * @returns {number} Returns the index of the matched value, else `-1`.
19750
+ * @example
19751
+ *
19752
+ * _.lastIndexOf([1, 2, 1, 2], 2);
19753
+ * // => 3
19754
+ *
19755
+ * // using `fromIndex`
19756
+ * _.lastIndexOf([1, 2, 1, 2], 2, 2);
19757
+ * // => 1
19758
+ *
19759
+ * // performing a binary search
19760
+ * _.lastIndexOf([1, 1, 2, 2], 2, true);
19761
+ * // => 3
19762
+ */
19763
+ function lastIndexOf(array, value, fromIndex) {
19764
+ var length = array ? array.length : 0;
19765
+ if (!length) {
19766
+ return -1;
19767
+ }
19768
+ var index = length;
19769
+ if (typeof fromIndex == 'number') {
19770
+ index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
19771
+ } else if (fromIndex) {
19772
+ index = binaryIndex(array, value, true) - 1;
19773
+ var other = array[index];
19774
+ if (value === value ? (value === other) : (other !== other)) {
19775
+ return index;
19776
+ }
19777
+ return -1;
19778
+ }
19779
+ if (value !== value) {
19780
+ return indexOfNaN(array, index, true);
19781
+ }
19782
+ while (index--) {
19783
+ if (array[index] === value) {
19784
+ return index;
19785
+ }
19786
+ }
19787
+ return -1;
19788
+ }
19789
+
19790
+ /**
19791
+ * Removes all provided values from `array` using
19792
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
19793
+ * for equality comparisons.
19794
+ *
19795
+ * **Note:** Unlike `_.without`, this method mutates `array`.
19796
+ *
19797
+ * @static
19798
+ * @memberOf _
19799
+ * @category Array
19800
+ * @param {Array} array The array to modify.
19801
+ * @param {...*} [values] The values to remove.
19802
+ * @returns {Array} Returns `array`.
19803
+ * @example
19804
+ *
19805
+ * var array = [1, 2, 3, 1, 2, 3];
19806
+ *
19807
+ * _.pull(array, 2, 3);
19808
+ * console.log(array);
19809
+ * // => [1, 1]
19810
+ */
19811
+ function pull() {
19812
+ var args = arguments,
19813
+ array = args[0];
19814
+
19815
+ if (!(array && array.length)) {
19816
+ return array;
19817
+ }
19818
+ var index = 0,
19819
+ indexOf = getIndexOf(),
19820
+ length = args.length;
19821
+
19822
+ while (++index < length) {
19823
+ var fromIndex = 0,
19824
+ value = args[index];
19825
+
19826
+ while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
19827
+ splice.call(array, fromIndex, 1);
19828
+ }
19829
+ }
19830
+ return array;
19831
+ }
19832
+
19833
+ /**
19834
+ * Removes elements from `array` corresponding to the given indexes and returns
19835
+ * an array of the removed elements. Indexes may be specified as an array of
19836
+ * indexes or as individual arguments.
19837
+ *
19838
+ * **Note:** Unlike `_.at`, this method mutates `array`.
19839
+ *
19840
+ * @static
19841
+ * @memberOf _
19842
+ * @category Array
19843
+ * @param {Array} array The array to modify.
19844
+ * @param {...(number|number[])} [indexes] The indexes of elements to remove,
19845
+ * specified as individual indexes or arrays of indexes.
19846
+ * @returns {Array} Returns the new array of removed elements.
19847
+ * @example
19848
+ *
19849
+ * var array = [5, 10, 15, 20];
19850
+ * var evens = _.pullAt(array, 1, 3);
19851
+ *
19852
+ * console.log(array);
19853
+ * // => [5, 15]
19854
+ *
19855
+ * console.log(evens);
19856
+ * // => [10, 20]
19857
+ */
19858
+ var pullAt = restParam(function(array, indexes) {
19859
+ indexes = baseFlatten(indexes);
19860
+
19861
+ var result = baseAt(array, indexes);
19862
+ basePullAt(array, indexes.sort(baseCompareAscending));
19863
+ return result;
19864
+ });
19865
+
19866
+ /**
19867
+ * Removes all elements from `array` that `predicate` returns truthy for
19868
+ * and returns an array of the removed elements. The predicate is bound to
19869
+ * `thisArg` and invoked with three arguments: (value, index, array).
19870
+ *
19871
+ * If a property name is provided for `predicate` the created `_.property`
19872
+ * style callback returns the property value of the given element.
19873
+ *
19874
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19875
+ * style callback returns `true` for elements that have a matching property
19876
+ * value, else `false`.
19877
+ *
19878
+ * If an object is provided for `predicate` the created `_.matches` style
19879
+ * callback returns `true` for elements that have the properties of the given
19880
+ * object, else `false`.
19881
+ *
19882
+ * **Note:** Unlike `_.filter`, this method mutates `array`.
19883
+ *
19884
+ * @static
19885
+ * @memberOf _
19886
+ * @category Array
19887
+ * @param {Array} array The array to modify.
19888
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
19889
+ * per iteration.
19890
+ * @param {*} [thisArg] The `this` binding of `predicate`.
19891
+ * @returns {Array} Returns the new array of removed elements.
19892
+ * @example
19893
+ *
19894
+ * var array = [1, 2, 3, 4];
19895
+ * var evens = _.remove(array, function(n) {
19896
+ * return n % 2 == 0;
19897
+ * });
19898
+ *
19899
+ * console.log(array);
19900
+ * // => [1, 3]
19901
+ *
19902
+ * console.log(evens);
19903
+ * // => [2, 4]
19904
+ */
19905
+ function remove(array, predicate, thisArg) {
19906
+ var result = [];
19907
+ if (!(array && array.length)) {
19908
+ return result;
19909
+ }
19910
+ var index = -1,
19911
+ indexes = [],
19912
+ length = array.length;
19913
+
19914
+ predicate = getCallback(predicate, thisArg, 3);
19915
+ while (++index < length) {
19916
+ var value = array[index];
19917
+ if (predicate(value, index, array)) {
19918
+ result.push(value);
19919
+ indexes.push(index);
19920
+ }
19921
+ }
19922
+ basePullAt(array, indexes);
19923
+ return result;
19924
+ }
19925
+
19926
+ /**
19927
+ * Gets all but the first element of `array`.
19928
+ *
19929
+ * @static
19930
+ * @memberOf _
19931
+ * @alias tail
19932
+ * @category Array
19933
+ * @param {Array} array The array to query.
19934
+ * @returns {Array} Returns the slice of `array`.
19935
+ * @example
19936
+ *
19937
+ * _.rest([1, 2, 3]);
19938
+ * // => [2, 3]
19939
+ */
19940
+ function rest(array) {
19941
+ return drop(array, 1);
19942
+ }
19943
+
19944
+ /**
19945
+ * Creates a slice of `array` from `start` up to, but not including, `end`.
19946
+ *
19947
+ * **Note:** This method is used instead of `Array#slice` to support node
19948
+ * lists in IE < 9 and to ensure dense arrays are returned.
19949
+ *
19950
+ * @static
19951
+ * @memberOf _
19952
+ * @category Array
19953
+ * @param {Array} array The array to slice.
19954
+ * @param {number} [start=0] The start position.
19955
+ * @param {number} [end=array.length] The end position.
19956
+ * @returns {Array} Returns the slice of `array`.
19957
+ */
19958
+ function slice(array, start, end) {
19959
+ var length = array ? array.length : 0;
19960
+ if (!length) {
19961
+ return [];
19962
+ }
19963
+ if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
19964
+ start = 0;
19965
+ end = length;
19966
+ }
19967
+ return baseSlice(array, start, end);
19968
+ }
19969
+
19970
+ /**
19971
+ * Uses a binary search to determine the lowest index at which `value` should
19972
+ * be inserted into `array` in order to maintain its sort order. If an iteratee
19973
+ * function is provided it is invoked for `value` and each element of `array`
19974
+ * to compute their sort ranking. The iteratee is bound to `thisArg` and
19975
+ * invoked with one argument; (value).
19976
+ *
19977
+ * If a property name is provided for `iteratee` the created `_.property`
19978
+ * style callback returns the property value of the given element.
19979
+ *
19980
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
19981
+ * style callback returns `true` for elements that have a matching property
19982
+ * value, else `false`.
19983
+ *
19984
+ * If an object is provided for `iteratee` the created `_.matches` style
19985
+ * callback returns `true` for elements that have the properties of the given
19986
+ * object, else `false`.
19987
+ *
19988
+ * @static
19989
+ * @memberOf _
19990
+ * @category Array
19991
+ * @param {Array} array The sorted array to inspect.
19992
+ * @param {*} value The value to evaluate.
19993
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
19994
+ * per iteration.
19995
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
19996
+ * @returns {number} Returns the index at which `value` should be inserted
19997
+ * into `array`.
19998
+ * @example
19999
+ *
20000
+ * _.sortedIndex([30, 50], 40);
20001
+ * // => 1
20002
+ *
20003
+ * _.sortedIndex([4, 4, 5, 5], 5);
20004
+ * // => 2
20005
+ *
20006
+ * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
20007
+ *
20008
+ * // using an iteratee function
20009
+ * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
20010
+ * return this.data[word];
20011
+ * }, dict);
20012
+ * // => 1
20013
+ *
20014
+ * // using the `_.property` callback shorthand
20015
+ * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
20016
+ * // => 1
20017
+ */
20018
+ var sortedIndex = createSortedIndex();
20019
+
20020
+ /**
20021
+ * This method is like `_.sortedIndex` except that it returns the highest
20022
+ * index at which `value` should be inserted into `array` in order to
20023
+ * maintain its sort order.
20024
+ *
20025
+ * @static
20026
+ * @memberOf _
20027
+ * @category Array
20028
+ * @param {Array} array The sorted array to inspect.
20029
+ * @param {*} value The value to evaluate.
20030
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
20031
+ * per iteration.
20032
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
20033
+ * @returns {number} Returns the index at which `value` should be inserted
20034
+ * into `array`.
20035
+ * @example
20036
+ *
20037
+ * _.sortedLastIndex([4, 4, 5, 5], 5);
20038
+ * // => 4
20039
+ */
20040
+ var sortedLastIndex = createSortedIndex(true);
20041
+
20042
+ /**
20043
+ * Creates a slice of `array` with `n` elements taken from the beginning.
20044
+ *
20045
+ * @static
20046
+ * @memberOf _
20047
+ * @category Array
20048
+ * @param {Array} array The array to query.
20049
+ * @param {number} [n=1] The number of elements to take.
20050
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
20051
+ * @returns {Array} Returns the slice of `array`.
20052
+ * @example
20053
+ *
20054
+ * _.take([1, 2, 3]);
20055
+ * // => [1]
20056
+ *
20057
+ * _.take([1, 2, 3], 2);
20058
+ * // => [1, 2]
20059
+ *
20060
+ * _.take([1, 2, 3], 5);
20061
+ * // => [1, 2, 3]
20062
+ *
20063
+ * _.take([1, 2, 3], 0);
20064
+ * // => []
20065
+ */
20066
+ function take(array, n, guard) {
20067
+ var length = array ? array.length : 0;
20068
+ if (!length) {
20069
+ return [];
20070
+ }
20071
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
20072
+ n = 1;
20073
+ }
20074
+ return baseSlice(array, 0, n < 0 ? 0 : n);
20075
+ }
20076
+
20077
+ /**
20078
+ * Creates a slice of `array` with `n` elements taken from the end.
20079
+ *
20080
+ * @static
20081
+ * @memberOf _
20082
+ * @category Array
20083
+ * @param {Array} array The array to query.
20084
+ * @param {number} [n=1] The number of elements to take.
20085
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
20086
+ * @returns {Array} Returns the slice of `array`.
20087
+ * @example
20088
+ *
20089
+ * _.takeRight([1, 2, 3]);
20090
+ * // => [3]
20091
+ *
20092
+ * _.takeRight([1, 2, 3], 2);
20093
+ * // => [2, 3]
20094
+ *
20095
+ * _.takeRight([1, 2, 3], 5);
20096
+ * // => [1, 2, 3]
20097
+ *
20098
+ * _.takeRight([1, 2, 3], 0);
20099
+ * // => []
20100
+ */
20101
+ function takeRight(array, n, guard) {
20102
+ var length = array ? array.length : 0;
20103
+ if (!length) {
20104
+ return [];
20105
+ }
20106
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
20107
+ n = 1;
20108
+ }
20109
+ n = length - (+n || 0);
20110
+ return baseSlice(array, n < 0 ? 0 : n);
20111
+ }
20112
+
20113
+ /**
20114
+ * Creates a slice of `array` with elements taken from the end. Elements are
20115
+ * taken until `predicate` returns falsey. The predicate is bound to `thisArg`
20116
+ * and invoked with three arguments: (value, index, array).
20117
+ *
20118
+ * If a property name is provided for `predicate` the created `_.property`
20119
+ * style callback returns the property value of the given element.
20120
+ *
20121
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20122
+ * style callback returns `true` for elements that have a matching property
20123
+ * value, else `false`.
20124
+ *
20125
+ * If an object is provided for `predicate` the created `_.matches` style
20126
+ * callback returns `true` for elements that have the properties of the given
20127
+ * object, else `false`.
20128
+ *
20129
+ * @static
20130
+ * @memberOf _
20131
+ * @category Array
20132
+ * @param {Array} array The array to query.
20133
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
20134
+ * per iteration.
20135
+ * @param {*} [thisArg] The `this` binding of `predicate`.
20136
+ * @returns {Array} Returns the slice of `array`.
20137
+ * @example
20138
+ *
20139
+ * _.takeRightWhile([1, 2, 3], function(n) {
20140
+ * return n > 1;
20141
+ * });
20142
+ * // => [2, 3]
20143
+ *
20144
+ * var users = [
20145
+ * { 'user': 'barney', 'active': true },
20146
+ * { 'user': 'fred', 'active': false },
20147
+ * { 'user': 'pebbles', 'active': false }
20148
+ * ];
20149
+ *
20150
+ * // using the `_.matches` callback shorthand
20151
+ * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
20152
+ * // => ['pebbles']
20153
+ *
20154
+ * // using the `_.matchesProperty` callback shorthand
20155
+ * _.pluck(_.takeRightWhile(users, 'active', false), 'user');
20156
+ * // => ['fred', 'pebbles']
20157
+ *
20158
+ * // using the `_.property` callback shorthand
20159
+ * _.pluck(_.takeRightWhile(users, 'active'), 'user');
20160
+ * // => []
20161
+ */
20162
+ function takeRightWhile(array, predicate, thisArg) {
20163
+ return (array && array.length)
20164
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)
20165
+ : [];
20166
+ }
20167
+
20168
+ /**
20169
+ * Creates a slice of `array` with elements taken from the beginning. Elements
20170
+ * are taken until `predicate` returns falsey. The predicate is bound to
20171
+ * `thisArg` and invoked with three arguments: (value, index, array).
20172
+ *
20173
+ * If a property name is provided for `predicate` the created `_.property`
20174
+ * style callback returns the property value of the given element.
20175
+ *
20176
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20177
+ * style callback returns `true` for elements that have a matching property
20178
+ * value, else `false`.
20179
+ *
20180
+ * If an object is provided for `predicate` the created `_.matches` style
20181
+ * callback returns `true` for elements that have the properties of the given
20182
+ * object, else `false`.
20183
+ *
20184
+ * @static
20185
+ * @memberOf _
20186
+ * @category Array
20187
+ * @param {Array} array The array to query.
20188
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
20189
+ * per iteration.
20190
+ * @param {*} [thisArg] The `this` binding of `predicate`.
20191
+ * @returns {Array} Returns the slice of `array`.
20192
+ * @example
20193
+ *
20194
+ * _.takeWhile([1, 2, 3], function(n) {
20195
+ * return n < 3;
20196
+ * });
20197
+ * // => [1, 2]
20198
+ *
20199
+ * var users = [
20200
+ * { 'user': 'barney', 'active': false },
20201
+ * { 'user': 'fred', 'active': false},
20202
+ * { 'user': 'pebbles', 'active': true }
20203
+ * ];
20204
+ *
20205
+ * // using the `_.matches` callback shorthand
20206
+ * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
20207
+ * // => ['barney']
20208
+ *
20209
+ * // using the `_.matchesProperty` callback shorthand
20210
+ * _.pluck(_.takeWhile(users, 'active', false), 'user');
20211
+ * // => ['barney', 'fred']
20212
+ *
20213
+ * // using the `_.property` callback shorthand
20214
+ * _.pluck(_.takeWhile(users, 'active'), 'user');
20215
+ * // => []
20216
+ */
20217
+ function takeWhile(array, predicate, thisArg) {
20218
+ return (array && array.length)
20219
+ ? baseWhile(array, getCallback(predicate, thisArg, 3))
20220
+ : [];
20221
+ }
20222
+
20223
+ /**
20224
+ * Creates an array of unique values, in order, from all of the provided arrays
20225
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
20226
+ * for equality comparisons.
20227
+ *
20228
+ * @static
20229
+ * @memberOf _
20230
+ * @category Array
20231
+ * @param {...Array} [arrays] The arrays to inspect.
20232
+ * @returns {Array} Returns the new array of combined values.
20233
+ * @example
20234
+ *
20235
+ * _.union([1, 2], [4, 2], [2, 1]);
20236
+ * // => [1, 2, 4]
20237
+ */
20238
+ var union = restParam(function(arrays) {
20239
+ return baseUniq(baseFlatten(arrays, false, true));
20240
+ });
20241
+
20242
+ /**
20243
+ * Creates a duplicate-free version of an array, using
20244
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
20245
+ * for equality comparisons, in which only the first occurence of each element
20246
+ * is kept. Providing `true` for `isSorted` performs a faster search algorithm
20247
+ * for sorted arrays. If an iteratee function is provided it is invoked for
20248
+ * each element in the array to generate the criterion by which uniqueness
20249
+ * is computed. The `iteratee` is bound to `thisArg` and invoked with three
20250
+ * arguments: (value, index, array).
20251
+ *
20252
+ * If a property name is provided for `iteratee` the created `_.property`
20253
+ * style callback returns the property value of the given element.
20254
+ *
20255
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20256
+ * style callback returns `true` for elements that have a matching property
20257
+ * value, else `false`.
20258
+ *
20259
+ * If an object is provided for `iteratee` the created `_.matches` style
20260
+ * callback returns `true` for elements that have the properties of the given
20261
+ * object, else `false`.
20262
+ *
20263
+ * @static
20264
+ * @memberOf _
20265
+ * @alias unique
20266
+ * @category Array
20267
+ * @param {Array} array The array to inspect.
20268
+ * @param {boolean} [isSorted] Specify the array is sorted.
20269
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
20270
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
20271
+ * @returns {Array} Returns the new duplicate-value-free array.
20272
+ * @example
20273
+ *
20274
+ * _.uniq([2, 1, 2]);
20275
+ * // => [2, 1]
20276
+ *
20277
+ * // using `isSorted`
20278
+ * _.uniq([1, 1, 2], true);
20279
+ * // => [1, 2]
20280
+ *
20281
+ * // using an iteratee function
20282
+ * _.uniq([1, 2.5, 1.5, 2], function(n) {
20283
+ * return this.floor(n);
20284
+ * }, Math);
20285
+ * // => [1, 2.5]
20286
+ *
20287
+ * // using the `_.property` callback shorthand
20288
+ * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
20289
+ * // => [{ 'x': 1 }, { 'x': 2 }]
20290
+ */
20291
+ function uniq(array, isSorted, iteratee, thisArg) {
20292
+ var length = array ? array.length : 0;
20293
+ if (!length) {
20294
+ return [];
20295
+ }
20296
+ if (isSorted != null && typeof isSorted != 'boolean') {
20297
+ thisArg = iteratee;
20298
+ iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
20299
+ isSorted = false;
20300
+ }
20301
+ var callback = getCallback();
20302
+ if (!(iteratee == null && callback === baseCallback)) {
20303
+ iteratee = callback(iteratee, thisArg, 3);
20304
+ }
20305
+ return (isSorted && getIndexOf() == baseIndexOf)
20306
+ ? sortedUniq(array, iteratee)
20307
+ : baseUniq(array, iteratee);
20308
+ }
20309
+
20310
+ /**
20311
+ * This method is like `_.zip` except that it accepts an array of grouped
20312
+ * elements and creates an array regrouping the elements to their pre-zip
20313
+ * configuration.
20314
+ *
20315
+ * @static
20316
+ * @memberOf _
20317
+ * @category Array
20318
+ * @param {Array} array The array of grouped elements to process.
20319
+ * @returns {Array} Returns the new array of regrouped elements.
20320
+ * @example
20321
+ *
20322
+ * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
20323
+ * // => [['fred', 30, true], ['barney', 40, false]]
20324
+ *
20325
+ * _.unzip(zipped);
20326
+ * // => [['fred', 'barney'], [30, 40], [true, false]]
20327
+ */
20328
+ function unzip(array) {
20329
+ if (!(array && array.length)) {
20330
+ return [];
20331
+ }
20332
+ var index = -1,
20333
+ length = 0;
20334
+
20335
+ array = arrayFilter(array, function(group) {
20336
+ if (isArrayLike(group)) {
20337
+ length = nativeMax(group.length, length);
20338
+ return true;
20339
+ }
20340
+ });
20341
+ var result = Array(length);
20342
+ while (++index < length) {
20343
+ result[index] = arrayMap(array, baseProperty(index));
20344
+ }
20345
+ return result;
20346
+ }
20347
+
20348
+ /**
20349
+ * This method is like `_.unzip` except that it accepts an iteratee to specify
20350
+ * how regrouped values should be combined. The `iteratee` is bound to `thisArg`
20351
+ * and invoked with four arguments: (accumulator, value, index, group).
20352
+ *
20353
+ * @static
20354
+ * @memberOf _
20355
+ * @category Array
20356
+ * @param {Array} array The array of grouped elements to process.
20357
+ * @param {Function} [iteratee] The function to combine regrouped values.
20358
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
20359
+ * @returns {Array} Returns the new array of regrouped elements.
20360
+ * @example
20361
+ *
20362
+ * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
20363
+ * // => [[1, 10, 100], [2, 20, 200]]
20364
+ *
20365
+ * _.unzipWith(zipped, _.add);
20366
+ * // => [3, 30, 300]
20367
+ */
20368
+ function unzipWith(array, iteratee, thisArg) {
20369
+ var length = array ? array.length : 0;
20370
+ if (!length) {
20371
+ return [];
20372
+ }
20373
+ var result = unzip(array);
20374
+ if (iteratee == null) {
20375
+ return result;
20376
+ }
20377
+ iteratee = bindCallback(iteratee, thisArg, 4);
20378
+ return arrayMap(result, function(group) {
20379
+ return arrayReduce(group, iteratee, undefined, true);
20380
+ });
20381
+ }
20382
+
20383
+ /**
20384
+ * Creates an array excluding all provided values using
20385
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
20386
+ * for equality comparisons.
20387
+ *
20388
+ * @static
20389
+ * @memberOf _
20390
+ * @category Array
20391
+ * @param {Array} array The array to filter.
20392
+ * @param {...*} [values] The values to exclude.
20393
+ * @returns {Array} Returns the new array of filtered values.
20394
+ * @example
20395
+ *
20396
+ * _.without([1, 2, 1, 3], 1, 2);
20397
+ * // => [3]
20398
+ */
20399
+ var without = restParam(function(array, values) {
20400
+ return isArrayLike(array)
20401
+ ? baseDifference(array, values)
20402
+ : [];
20403
+ });
20404
+
20405
+ /**
20406
+ * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
20407
+ * of the provided arrays.
20408
+ *
20409
+ * @static
20410
+ * @memberOf _
20411
+ * @category Array
20412
+ * @param {...Array} [arrays] The arrays to inspect.
20413
+ * @returns {Array} Returns the new array of values.
20414
+ * @example
20415
+ *
20416
+ * _.xor([1, 2], [4, 2]);
20417
+ * // => [1, 4]
20418
+ */
20419
+ function xor() {
20420
+ var index = -1,
20421
+ length = arguments.length;
20422
+
20423
+ while (++index < length) {
20424
+ var array = arguments[index];
20425
+ if (isArrayLike(array)) {
20426
+ var result = result
20427
+ ? arrayPush(baseDifference(result, array), baseDifference(array, result))
20428
+ : array;
20429
+ }
20430
+ }
20431
+ return result ? baseUniq(result) : [];
20432
+ }
20433
+
20434
+ /**
20435
+ * Creates an array of grouped elements, the first of which contains the first
20436
+ * elements of the given arrays, the second of which contains the second elements
20437
+ * of the given arrays, and so on.
20438
+ *
20439
+ * @static
20440
+ * @memberOf _
20441
+ * @category Array
20442
+ * @param {...Array} [arrays] The arrays to process.
20443
+ * @returns {Array} Returns the new array of grouped elements.
20444
+ * @example
20445
+ *
20446
+ * _.zip(['fred', 'barney'], [30, 40], [true, false]);
20447
+ * // => [['fred', 30, true], ['barney', 40, false]]
20448
+ */
20449
+ var zip = restParam(unzip);
20450
+
20451
+ /**
20452
+ * The inverse of `_.pairs`; this method returns an object composed from arrays
20453
+ * of property names and values. Provide either a single two dimensional array,
20454
+ * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
20455
+ * and one of corresponding values.
20456
+ *
20457
+ * @static
20458
+ * @memberOf _
20459
+ * @alias object
20460
+ * @category Array
20461
+ * @param {Array} props The property names.
20462
+ * @param {Array} [values=[]] The property values.
20463
+ * @returns {Object} Returns the new object.
20464
+ * @example
20465
+ *
20466
+ * _.zipObject([['fred', 30], ['barney', 40]]);
20467
+ * // => { 'fred': 30, 'barney': 40 }
20468
+ *
20469
+ * _.zipObject(['fred', 'barney'], [30, 40]);
20470
+ * // => { 'fred': 30, 'barney': 40 }
20471
+ */
20472
+ function zipObject(props, values) {
20473
+ var index = -1,
20474
+ length = props ? props.length : 0,
20475
+ result = {};
20476
+
20477
+ if (length && !values && !isArray(props[0])) {
20478
+ values = [];
20479
+ }
20480
+ while (++index < length) {
20481
+ var key = props[index];
20482
+ if (values) {
20483
+ result[key] = values[index];
20484
+ } else if (key) {
20485
+ result[key[0]] = key[1];
20486
+ }
20487
+ }
20488
+ return result;
20489
+ }
20490
+
20491
+ /**
20492
+ * This method is like `_.zip` except that it accepts an iteratee to specify
20493
+ * how grouped values should be combined. The `iteratee` is bound to `thisArg`
20494
+ * and invoked with four arguments: (accumulator, value, index, group).
20495
+ *
20496
+ * @static
20497
+ * @memberOf _
20498
+ * @category Array
20499
+ * @param {...Array} [arrays] The arrays to process.
20500
+ * @param {Function} [iteratee] The function to combine grouped values.
20501
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
20502
+ * @returns {Array} Returns the new array of grouped elements.
20503
+ * @example
20504
+ *
20505
+ * _.zipWith([1, 2], [10, 20], [100, 200], _.add);
20506
+ * // => [111, 222]
20507
+ */
20508
+ var zipWith = restParam(function(arrays) {
20509
+ var length = arrays.length,
20510
+ iteratee = length > 2 ? arrays[length - 2] : undefined,
20511
+ thisArg = length > 1 ? arrays[length - 1] : undefined;
20512
+
20513
+ if (length > 2 && typeof iteratee == 'function') {
20514
+ length -= 2;
20515
+ } else {
20516
+ iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
20517
+ thisArg = undefined;
20518
+ }
20519
+ arrays.length = length;
20520
+ return unzipWith(arrays, iteratee, thisArg);
20521
+ });
20522
+
20523
+ /*------------------------------------------------------------------------*/
20524
+
20525
+ /**
20526
+ * Creates a `lodash` object that wraps `value` with explicit method
20527
+ * chaining enabled.
20528
+ *
20529
+ * @static
20530
+ * @memberOf _
20531
+ * @category Chain
20532
+ * @param {*} value The value to wrap.
20533
+ * @returns {Object} Returns the new `lodash` wrapper instance.
20534
+ * @example
20535
+ *
20536
+ * var users = [
20537
+ * { 'user': 'barney', 'age': 36 },
20538
+ * { 'user': 'fred', 'age': 40 },
20539
+ * { 'user': 'pebbles', 'age': 1 }
20540
+ * ];
20541
+ *
20542
+ * var youngest = _.chain(users)
20543
+ * .sortBy('age')
20544
+ * .map(function(chr) {
20545
+ * return chr.user + ' is ' + chr.age;
20546
+ * })
20547
+ * .first()
20548
+ * .value();
20549
+ * // => 'pebbles is 1'
20550
+ */
20551
+ function chain(value) {
20552
+ var result = lodash(value);
20553
+ result.__chain__ = true;
20554
+ return result;
20555
+ }
20556
+
20557
+ /**
20558
+ * This method invokes `interceptor` and returns `value`. The interceptor is
20559
+ * bound to `thisArg` and invoked with one argument; (value). The purpose of
20560
+ * this method is to "tap into" a method chain in order to perform operations
20561
+ * on intermediate results within the chain.
20562
+ *
20563
+ * @static
20564
+ * @memberOf _
20565
+ * @category Chain
20566
+ * @param {*} value The value to provide to `interceptor`.
20567
+ * @param {Function} interceptor The function to invoke.
20568
+ * @param {*} [thisArg] The `this` binding of `interceptor`.
20569
+ * @returns {*} Returns `value`.
20570
+ * @example
20571
+ *
20572
+ * _([1, 2, 3])
20573
+ * .tap(function(array) {
20574
+ * array.pop();
20575
+ * })
20576
+ * .reverse()
20577
+ * .value();
20578
+ * // => [2, 1]
20579
+ */
20580
+ function tap(value, interceptor, thisArg) {
20581
+ interceptor.call(thisArg, value);
20582
+ return value;
20583
+ }
20584
+
20585
+ /**
20586
+ * This method is like `_.tap` except that it returns the result of `interceptor`.
20587
+ *
20588
+ * @static
20589
+ * @memberOf _
20590
+ * @category Chain
20591
+ * @param {*} value The value to provide to `interceptor`.
20592
+ * @param {Function} interceptor The function to invoke.
20593
+ * @param {*} [thisArg] The `this` binding of `interceptor`.
20594
+ * @returns {*} Returns the result of `interceptor`.
20595
+ * @example
20596
+ *
20597
+ * _(' abc ')
20598
+ * .chain()
20599
+ * .trim()
20600
+ * .thru(function(value) {
20601
+ * return [value];
20602
+ * })
20603
+ * .value();
20604
+ * // => ['abc']
20605
+ */
20606
+ function thru(value, interceptor, thisArg) {
20607
+ return interceptor.call(thisArg, value);
20608
+ }
20609
+
20610
+ /**
20611
+ * Enables explicit method chaining on the wrapper object.
20612
+ *
20613
+ * @name chain
20614
+ * @memberOf _
20615
+ * @category Chain
20616
+ * @returns {Object} Returns the new `lodash` wrapper instance.
20617
+ * @example
20618
+ *
20619
+ * var users = [
20620
+ * { 'user': 'barney', 'age': 36 },
20621
+ * { 'user': 'fred', 'age': 40 }
20622
+ * ];
20623
+ *
20624
+ * // without explicit chaining
20625
+ * _(users).first();
20626
+ * // => { 'user': 'barney', 'age': 36 }
20627
+ *
20628
+ * // with explicit chaining
20629
+ * _(users).chain()
20630
+ * .first()
20631
+ * .pick('user')
20632
+ * .value();
20633
+ * // => { 'user': 'barney' }
20634
+ */
20635
+ function wrapperChain() {
20636
+ return chain(this);
20637
+ }
20638
+
20639
+ /**
20640
+ * Executes the chained sequence and returns the wrapped result.
20641
+ *
20642
+ * @name commit
20643
+ * @memberOf _
20644
+ * @category Chain
20645
+ * @returns {Object} Returns the new `lodash` wrapper instance.
20646
+ * @example
20647
+ *
20648
+ * var array = [1, 2];
20649
+ * var wrapped = _(array).push(3);
20650
+ *
20651
+ * console.log(array);
20652
+ * // => [1, 2]
20653
+ *
20654
+ * wrapped = wrapped.commit();
20655
+ * console.log(array);
20656
+ * // => [1, 2, 3]
20657
+ *
20658
+ * wrapped.last();
20659
+ * // => 3
20660
+ *
20661
+ * console.log(array);
20662
+ * // => [1, 2, 3]
20663
+ */
20664
+ function wrapperCommit() {
20665
+ return new LodashWrapper(this.value(), this.__chain__);
20666
+ }
20667
+
20668
+ /**
20669
+ * Creates a new array joining a wrapped array with any additional arrays
20670
+ * and/or values.
20671
+ *
20672
+ * @name concat
20673
+ * @memberOf _
20674
+ * @category Chain
20675
+ * @param {...*} [values] The values to concatenate.
20676
+ * @returns {Array} Returns the new concatenated array.
20677
+ * @example
20678
+ *
20679
+ * var array = [1];
20680
+ * var wrapped = _(array).concat(2, [3], [[4]]);
20681
+ *
20682
+ * console.log(wrapped.value());
20683
+ * // => [1, 2, 3, [4]]
20684
+ *
20685
+ * console.log(array);
20686
+ * // => [1]
20687
+ */
20688
+ var wrapperConcat = restParam(function(values) {
20689
+ values = baseFlatten(values);
20690
+ return this.thru(function(array) {
20691
+ return arrayConcat(isArray(array) ? array : [toObject(array)], values);
20692
+ });
20693
+ });
20694
+
20695
+ /**
20696
+ * Creates a clone of the chained sequence planting `value` as the wrapped value.
20697
+ *
20698
+ * @name plant
20699
+ * @memberOf _
20700
+ * @category Chain
20701
+ * @returns {Object} Returns the new `lodash` wrapper instance.
20702
+ * @example
20703
+ *
20704
+ * var array = [1, 2];
20705
+ * var wrapped = _(array).map(function(value) {
20706
+ * return Math.pow(value, 2);
20707
+ * });
20708
+ *
20709
+ * var other = [3, 4];
20710
+ * var otherWrapped = wrapped.plant(other);
20711
+ *
20712
+ * otherWrapped.value();
20713
+ * // => [9, 16]
20714
+ *
20715
+ * wrapped.value();
20716
+ * // => [1, 4]
20717
+ */
20718
+ function wrapperPlant(value) {
20719
+ var result,
20720
+ parent = this;
20721
+
20722
+ while (parent instanceof baseLodash) {
20723
+ var clone = wrapperClone(parent);
20724
+ if (result) {
20725
+ previous.__wrapped__ = clone;
20726
+ } else {
20727
+ result = clone;
20728
+ }
20729
+ var previous = clone;
20730
+ parent = parent.__wrapped__;
20731
+ }
20732
+ previous.__wrapped__ = value;
20733
+ return result;
20734
+ }
20735
+
20736
+ /**
20737
+ * Reverses the wrapped array so the first element becomes the last, the
20738
+ * second element becomes the second to last, and so on.
20739
+ *
20740
+ * **Note:** This method mutates the wrapped array.
20741
+ *
20742
+ * @name reverse
20743
+ * @memberOf _
20744
+ * @category Chain
20745
+ * @returns {Object} Returns the new reversed `lodash` wrapper instance.
20746
+ * @example
20747
+ *
20748
+ * var array = [1, 2, 3];
20749
+ *
20750
+ * _(array).reverse().value()
20751
+ * // => [3, 2, 1]
20752
+ *
20753
+ * console.log(array);
20754
+ * // => [3, 2, 1]
20755
+ */
20756
+ function wrapperReverse() {
20757
+ var value = this.__wrapped__;
20758
+
20759
+ var interceptor = function(value) {
20760
+ return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
20761
+ };
20762
+ if (value instanceof LazyWrapper) {
20763
+ var wrapped = value;
20764
+ if (this.__actions__.length) {
20765
+ wrapped = new LazyWrapper(this);
20766
+ }
20767
+ wrapped = wrapped.reverse();
20768
+ wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
20769
+ return new LodashWrapper(wrapped, this.__chain__);
20770
+ }
20771
+ return this.thru(interceptor);
20772
+ }
20773
+
20774
+ /**
20775
+ * Produces the result of coercing the unwrapped value to a string.
20776
+ *
20777
+ * @name toString
20778
+ * @memberOf _
20779
+ * @category Chain
20780
+ * @returns {string} Returns the coerced string value.
20781
+ * @example
20782
+ *
20783
+ * _([1, 2, 3]).toString();
20784
+ * // => '1,2,3'
20785
+ */
20786
+ function wrapperToString() {
20787
+ return (this.value() + '');
20788
+ }
20789
+
20790
+ /**
20791
+ * Executes the chained sequence to extract the unwrapped value.
20792
+ *
20793
+ * @name value
20794
+ * @memberOf _
20795
+ * @alias run, toJSON, valueOf
20796
+ * @category Chain
20797
+ * @returns {*} Returns the resolved unwrapped value.
20798
+ * @example
20799
+ *
20800
+ * _([1, 2, 3]).value();
20801
+ * // => [1, 2, 3]
20802
+ */
20803
+ function wrapperValue() {
20804
+ return baseWrapperValue(this.__wrapped__, this.__actions__);
20805
+ }
20806
+
20807
+ /*------------------------------------------------------------------------*/
20808
+
20809
+ /**
20810
+ * Creates an array of elements corresponding to the given keys, or indexes,
20811
+ * of `collection`. Keys may be specified as individual arguments or as arrays
20812
+ * of keys.
20813
+ *
20814
+ * @static
20815
+ * @memberOf _
20816
+ * @category Collection
20817
+ * @param {Array|Object|string} collection The collection to iterate over.
20818
+ * @param {...(number|number[]|string|string[])} [props] The property names
20819
+ * or indexes of elements to pick, specified individually or in arrays.
20820
+ * @returns {Array} Returns the new array of picked elements.
20821
+ * @example
20822
+ *
20823
+ * _.at(['a', 'b', 'c'], [0, 2]);
20824
+ * // => ['a', 'c']
20825
+ *
20826
+ * _.at(['barney', 'fred', 'pebbles'], 0, 2);
20827
+ * // => ['barney', 'pebbles']
20828
+ */
20829
+ var at = restParam(function(collection, props) {
20830
+ return baseAt(collection, baseFlatten(props));
20831
+ });
20832
+
20833
+ /**
20834
+ * Creates an object composed of keys generated from the results of running
20835
+ * each element of `collection` through `iteratee`. The corresponding value
20836
+ * of each key is the number of times the key was returned by `iteratee`.
20837
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
20838
+ * (value, index|key, collection).
20839
+ *
20840
+ * If a property name is provided for `iteratee` the created `_.property`
20841
+ * style callback returns the property value of the given element.
20842
+ *
20843
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20844
+ * style callback returns `true` for elements that have a matching property
20845
+ * value, else `false`.
20846
+ *
20847
+ * If an object is provided for `iteratee` the created `_.matches` style
20848
+ * callback returns `true` for elements that have the properties of the given
20849
+ * object, else `false`.
20850
+ *
20851
+ * @static
20852
+ * @memberOf _
20853
+ * @category Collection
20854
+ * @param {Array|Object|string} collection The collection to iterate over.
20855
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
20856
+ * per iteration.
20857
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
20858
+ * @returns {Object} Returns the composed aggregate object.
20859
+ * @example
20860
+ *
20861
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
20862
+ * return Math.floor(n);
20863
+ * });
20864
+ * // => { '4': 1, '6': 2 }
20865
+ *
20866
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
20867
+ * return this.floor(n);
20868
+ * }, Math);
20869
+ * // => { '4': 1, '6': 2 }
20870
+ *
20871
+ * _.countBy(['one', 'two', 'three'], 'length');
20872
+ * // => { '3': 2, '5': 1 }
20873
+ */
20874
+ var countBy = createAggregator(function(result, value, key) {
20875
+ hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
20876
+ });
20877
+
20878
+ /**
20879
+ * Checks if `predicate` returns truthy for **all** elements of `collection`.
20880
+ * The predicate is bound to `thisArg` and invoked with three arguments:
20881
+ * (value, index|key, collection).
20882
+ *
20883
+ * If a property name is provided for `predicate` the created `_.property`
20884
+ * style callback returns the property value of the given element.
20885
+ *
20886
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20887
+ * style callback returns `true` for elements that have a matching property
20888
+ * value, else `false`.
20889
+ *
20890
+ * If an object is provided for `predicate` the created `_.matches` style
20891
+ * callback returns `true` for elements that have the properties of the given
20892
+ * object, else `false`.
20893
+ *
20894
+ * @static
20895
+ * @memberOf _
20896
+ * @alias all
20897
+ * @category Collection
20898
+ * @param {Array|Object|string} collection The collection to iterate over.
20899
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
20900
+ * per iteration.
20901
+ * @param {*} [thisArg] The `this` binding of `predicate`.
20902
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
20903
+ * else `false`.
20904
+ * @example
20905
+ *
20906
+ * _.every([true, 1, null, 'yes'], Boolean);
20907
+ * // => false
20908
+ *
20909
+ * var users = [
20910
+ * { 'user': 'barney', 'active': false },
20911
+ * { 'user': 'fred', 'active': false }
20912
+ * ];
20913
+ *
20914
+ * // using the `_.matches` callback shorthand
20915
+ * _.every(users, { 'user': 'barney', 'active': false });
20916
+ * // => false
20917
+ *
20918
+ * // using the `_.matchesProperty` callback shorthand
20919
+ * _.every(users, 'active', false);
20920
+ * // => true
20921
+ *
20922
+ * // using the `_.property` callback shorthand
20923
+ * _.every(users, 'active');
20924
+ * // => false
20925
+ */
20926
+ function every(collection, predicate, thisArg) {
20927
+ var func = isArray(collection) ? arrayEvery : baseEvery;
20928
+ if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
20929
+ predicate = undefined;
20930
+ }
20931
+ if (typeof predicate != 'function' || thisArg !== undefined) {
20932
+ predicate = getCallback(predicate, thisArg, 3);
20933
+ }
20934
+ return func(collection, predicate);
20935
+ }
20936
+
20937
+ /**
20938
+ * Iterates over elements of `collection`, returning an array of all elements
20939
+ * `predicate` returns truthy for. The predicate is bound to `thisArg` and
20940
+ * invoked with three arguments: (value, index|key, collection).
20941
+ *
20942
+ * If a property name is provided for `predicate` the created `_.property`
20943
+ * style callback returns the property value of the given element.
20944
+ *
20945
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
20946
+ * style callback returns `true` for elements that have a matching property
20947
+ * value, else `false`.
20948
+ *
20949
+ * If an object is provided for `predicate` the created `_.matches` style
20950
+ * callback returns `true` for elements that have the properties of the given
20951
+ * object, else `false`.
20952
+ *
20953
+ * @static
20954
+ * @memberOf _
20955
+ * @alias select
20956
+ * @category Collection
20957
+ * @param {Array|Object|string} collection The collection to iterate over.
20958
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
20959
+ * per iteration.
20960
+ * @param {*} [thisArg] The `this` binding of `predicate`.
20961
+ * @returns {Array} Returns the new filtered array.
20962
+ * @example
20963
+ *
20964
+ * _.filter([4, 5, 6], function(n) {
20965
+ * return n % 2 == 0;
20966
+ * });
20967
+ * // => [4, 6]
20968
+ *
20969
+ * var users = [
20970
+ * { 'user': 'barney', 'age': 36, 'active': true },
20971
+ * { 'user': 'fred', 'age': 40, 'active': false }
20972
+ * ];
20973
+ *
20974
+ * // using the `_.matches` callback shorthand
20975
+ * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
20976
+ * // => ['barney']
20977
+ *
20978
+ * // using the `_.matchesProperty` callback shorthand
20979
+ * _.pluck(_.filter(users, 'active', false), 'user');
20980
+ * // => ['fred']
20981
+ *
20982
+ * // using the `_.property` callback shorthand
20983
+ * _.pluck(_.filter(users, 'active'), 'user');
20984
+ * // => ['barney']
20985
+ */
20986
+ function filter(collection, predicate, thisArg) {
20987
+ var func = isArray(collection) ? arrayFilter : baseFilter;
20988
+ predicate = getCallback(predicate, thisArg, 3);
20989
+ return func(collection, predicate);
20990
+ }
20991
+
20992
+ /**
20993
+ * Iterates over elements of `collection`, returning the first element
20994
+ * `predicate` returns truthy for. The predicate is bound to `thisArg` and
20995
+ * invoked with three arguments: (value, index|key, collection).
20996
+ *
20997
+ * If a property name is provided for `predicate` the created `_.property`
20998
+ * style callback returns the property value of the given element.
20999
+ *
21000
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21001
+ * style callback returns `true` for elements that have a matching property
21002
+ * value, else `false`.
21003
+ *
21004
+ * If an object is provided for `predicate` the created `_.matches` style
21005
+ * callback returns `true` for elements that have the properties of the given
21006
+ * object, else `false`.
21007
+ *
21008
+ * @static
21009
+ * @memberOf _
21010
+ * @alias detect
21011
+ * @category Collection
21012
+ * @param {Array|Object|string} collection The collection to search.
21013
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
21014
+ * per iteration.
21015
+ * @param {*} [thisArg] The `this` binding of `predicate`.
21016
+ * @returns {*} Returns the matched element, else `undefined`.
21017
+ * @example
21018
+ *
21019
+ * var users = [
21020
+ * { 'user': 'barney', 'age': 36, 'active': true },
21021
+ * { 'user': 'fred', 'age': 40, 'active': false },
21022
+ * { 'user': 'pebbles', 'age': 1, 'active': true }
21023
+ * ];
21024
+ *
21025
+ * _.result(_.find(users, function(chr) {
21026
+ * return chr.age < 40;
21027
+ * }), 'user');
21028
+ * // => 'barney'
21029
+ *
21030
+ * // using the `_.matches` callback shorthand
21031
+ * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
21032
+ * // => 'pebbles'
21033
+ *
21034
+ * // using the `_.matchesProperty` callback shorthand
21035
+ * _.result(_.find(users, 'active', false), 'user');
21036
+ * // => 'fred'
21037
+ *
21038
+ * // using the `_.property` callback shorthand
21039
+ * _.result(_.find(users, 'active'), 'user');
21040
+ * // => 'barney'
21041
+ */
21042
+ var find = createFind(baseEach);
21043
+
21044
+ /**
21045
+ * This method is like `_.find` except that it iterates over elements of
21046
+ * `collection` from right to left.
21047
+ *
21048
+ * @static
21049
+ * @memberOf _
21050
+ * @category Collection
21051
+ * @param {Array|Object|string} collection The collection to search.
21052
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
21053
+ * per iteration.
21054
+ * @param {*} [thisArg] The `this` binding of `predicate`.
21055
+ * @returns {*} Returns the matched element, else `undefined`.
21056
+ * @example
21057
+ *
21058
+ * _.findLast([1, 2, 3, 4], function(n) {
21059
+ * return n % 2 == 1;
21060
+ * });
21061
+ * // => 3
21062
+ */
21063
+ var findLast = createFind(baseEachRight, true);
21064
+
21065
+ /**
21066
+ * Performs a deep comparison between each element in `collection` and the
21067
+ * source object, returning the first element that has equivalent property
21068
+ * values.
21069
+ *
21070
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
21071
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
21072
+ * their own, not inherited, enumerable properties. For comparing a single
21073
+ * own or inherited property value see `_.matchesProperty`.
21074
+ *
21075
+ * @static
21076
+ * @memberOf _
21077
+ * @category Collection
21078
+ * @param {Array|Object|string} collection The collection to search.
21079
+ * @param {Object} source The object of property values to match.
21080
+ * @returns {*} Returns the matched element, else `undefined`.
21081
+ * @example
21082
+ *
21083
+ * var users = [
21084
+ * { 'user': 'barney', 'age': 36, 'active': true },
21085
+ * { 'user': 'fred', 'age': 40, 'active': false }
21086
+ * ];
21087
+ *
21088
+ * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
21089
+ * // => 'barney'
21090
+ *
21091
+ * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
21092
+ * // => 'fred'
21093
+ */
21094
+ function findWhere(collection, source) {
21095
+ return find(collection, baseMatches(source));
21096
+ }
21097
+
21098
+ /**
21099
+ * Iterates over elements of `collection` invoking `iteratee` for each element.
21100
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
21101
+ * (value, index|key, collection). Iteratee functions may exit iteration early
21102
+ * by explicitly returning `false`.
21103
+ *
21104
+ * **Note:** As with other "Collections" methods, objects with a "length" property
21105
+ * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
21106
+ * may be used for object iteration.
21107
+ *
21108
+ * @static
21109
+ * @memberOf _
21110
+ * @alias each
21111
+ * @category Collection
21112
+ * @param {Array|Object|string} collection The collection to iterate over.
21113
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
21114
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21115
+ * @returns {Array|Object|string} Returns `collection`.
21116
+ * @example
21117
+ *
21118
+ * _([1, 2]).forEach(function(n) {
21119
+ * console.log(n);
21120
+ * }).value();
21121
+ * // => logs each value from left to right and returns the array
21122
+ *
21123
+ * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
21124
+ * console.log(n, key);
21125
+ * });
21126
+ * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
21127
+ */
21128
+ var forEach = createForEach(arrayEach, baseEach);
21129
+
21130
+ /**
21131
+ * This method is like `_.forEach` except that it iterates over elements of
21132
+ * `collection` from right to left.
21133
+ *
21134
+ * @static
21135
+ * @memberOf _
21136
+ * @alias eachRight
21137
+ * @category Collection
21138
+ * @param {Array|Object|string} collection The collection to iterate over.
21139
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
21140
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21141
+ * @returns {Array|Object|string} Returns `collection`.
21142
+ * @example
21143
+ *
21144
+ * _([1, 2]).forEachRight(function(n) {
21145
+ * console.log(n);
21146
+ * }).value();
21147
+ * // => logs each value from right to left and returns the array
21148
+ */
21149
+ var forEachRight = createForEach(arrayEachRight, baseEachRight);
21150
+
21151
+ /**
21152
+ * Creates an object composed of keys generated from the results of running
21153
+ * each element of `collection` through `iteratee`. The corresponding value
21154
+ * of each key is an array of the elements responsible for generating the key.
21155
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
21156
+ * (value, index|key, collection).
21157
+ *
21158
+ * If a property name is provided for `iteratee` the created `_.property`
21159
+ * style callback returns the property value of the given element.
21160
+ *
21161
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21162
+ * style callback returns `true` for elements that have a matching property
21163
+ * value, else `false`.
21164
+ *
21165
+ * If an object is provided for `iteratee` the created `_.matches` style
21166
+ * callback returns `true` for elements that have the properties of the given
21167
+ * object, else `false`.
21168
+ *
21169
+ * @static
21170
+ * @memberOf _
21171
+ * @category Collection
21172
+ * @param {Array|Object|string} collection The collection to iterate over.
21173
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
21174
+ * per iteration.
21175
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21176
+ * @returns {Object} Returns the composed aggregate object.
21177
+ * @example
21178
+ *
21179
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
21180
+ * return Math.floor(n);
21181
+ * });
21182
+ * // => { '4': [4.2], '6': [6.1, 6.4] }
21183
+ *
21184
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
21185
+ * return this.floor(n);
21186
+ * }, Math);
21187
+ * // => { '4': [4.2], '6': [6.1, 6.4] }
21188
+ *
21189
+ * // using the `_.property` callback shorthand
21190
+ * _.groupBy(['one', 'two', 'three'], 'length');
21191
+ * // => { '3': ['one', 'two'], '5': ['three'] }
21192
+ */
21193
+ var groupBy = createAggregator(function(result, value, key) {
21194
+ if (hasOwnProperty.call(result, key)) {
21195
+ result[key].push(value);
21196
+ } else {
21197
+ result[key] = [value];
21198
+ }
21199
+ });
21200
+
21201
+ /**
21202
+ * Checks if `value` is in `collection` using
21203
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
21204
+ * for equality comparisons. If `fromIndex` is negative, it is used as the offset
21205
+ * from the end of `collection`.
21206
+ *
21207
+ * @static
21208
+ * @memberOf _
21209
+ * @alias contains, include
21210
+ * @category Collection
21211
+ * @param {Array|Object|string} collection The collection to search.
21212
+ * @param {*} target The value to search for.
21213
+ * @param {number} [fromIndex=0] The index to search from.
21214
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
21215
+ * @returns {boolean} Returns `true` if a matching element is found, else `false`.
21216
+ * @example
21217
+ *
21218
+ * _.includes([1, 2, 3], 1);
21219
+ * // => true
21220
+ *
21221
+ * _.includes([1, 2, 3], 1, 2);
21222
+ * // => false
21223
+ *
21224
+ * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
21225
+ * // => true
21226
+ *
21227
+ * _.includes('pebbles', 'eb');
21228
+ * // => true
21229
+ */
21230
+ function includes(collection, target, fromIndex, guard) {
21231
+ var length = collection ? getLength(collection) : 0;
21232
+ if (!isLength(length)) {
21233
+ collection = values(collection);
21234
+ length = collection.length;
21235
+ }
21236
+ if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
21237
+ fromIndex = 0;
21238
+ } else {
21239
+ fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
21240
+ }
21241
+ return (typeof collection == 'string' || !isArray(collection) && isString(collection))
21242
+ ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
21243
+ : (!!length && getIndexOf(collection, target, fromIndex) > -1);
21244
+ }
21245
+
21246
+ /**
21247
+ * Creates an object composed of keys generated from the results of running
21248
+ * each element of `collection` through `iteratee`. The corresponding value
21249
+ * of each key is the last element responsible for generating the key. The
21250
+ * iteratee function is bound to `thisArg` and invoked with three arguments:
21251
+ * (value, index|key, collection).
21252
+ *
21253
+ * If a property name is provided for `iteratee` the created `_.property`
21254
+ * style callback returns the property value of the given element.
21255
+ *
21256
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21257
+ * style callback returns `true` for elements that have a matching property
21258
+ * value, else `false`.
21259
+ *
21260
+ * If an object is provided for `iteratee` the created `_.matches` style
21261
+ * callback returns `true` for elements that have the properties of the given
21262
+ * object, else `false`.
21263
+ *
21264
+ * @static
21265
+ * @memberOf _
21266
+ * @category Collection
21267
+ * @param {Array|Object|string} collection The collection to iterate over.
21268
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
21269
+ * per iteration.
21270
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21271
+ * @returns {Object} Returns the composed aggregate object.
21272
+ * @example
21273
+ *
21274
+ * var keyData = [
21275
+ * { 'dir': 'left', 'code': 97 },
21276
+ * { 'dir': 'right', 'code': 100 }
21277
+ * ];
21278
+ *
21279
+ * _.indexBy(keyData, 'dir');
21280
+ * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
21281
+ *
21282
+ * _.indexBy(keyData, function(object) {
21283
+ * return String.fromCharCode(object.code);
21284
+ * });
21285
+ * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
21286
+ *
21287
+ * _.indexBy(keyData, function(object) {
21288
+ * return this.fromCharCode(object.code);
21289
+ * }, String);
21290
+ * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
21291
+ */
21292
+ var indexBy = createAggregator(function(result, value, key) {
21293
+ result[key] = value;
21294
+ });
21295
+
21296
+ /**
21297
+ * Invokes the method at `path` of each element in `collection`, returning
21298
+ * an array of the results of each invoked method. Any additional arguments
21299
+ * are provided to each invoked method. If `methodName` is a function it is
21300
+ * invoked for, and `this` bound to, each element in `collection`.
21301
+ *
21302
+ * @static
21303
+ * @memberOf _
21304
+ * @category Collection
21305
+ * @param {Array|Object|string} collection The collection to iterate over.
21306
+ * @param {Array|Function|string} path The path of the method to invoke or
21307
+ * the function invoked per iteration.
21308
+ * @param {...*} [args] The arguments to invoke the method with.
21309
+ * @returns {Array} Returns the array of results.
21310
+ * @example
21311
+ *
21312
+ * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
21313
+ * // => [[1, 5, 7], [1, 2, 3]]
21314
+ *
21315
+ * _.invoke([123, 456], String.prototype.split, '');
21316
+ * // => [['1', '2', '3'], ['4', '5', '6']]
21317
+ */
21318
+ var invoke = restParam(function(collection, path, args) {
21319
+ var index = -1,
21320
+ isFunc = typeof path == 'function',
21321
+ isProp = isKey(path),
21322
+ result = isArrayLike(collection) ? Array(collection.length) : [];
21323
+
21324
+ baseEach(collection, function(value) {
21325
+ var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
21326
+ result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
21327
+ });
21328
+ return result;
21329
+ });
21330
+
21331
+ /**
21332
+ * Creates an array of values by running each element in `collection` through
21333
+ * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
21334
+ * arguments: (value, index|key, collection).
21335
+ *
21336
+ * If a property name is provided for `iteratee` the created `_.property`
21337
+ * style callback returns the property value of the given element.
21338
+ *
21339
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21340
+ * style callback returns `true` for elements that have a matching property
21341
+ * value, else `false`.
21342
+ *
21343
+ * If an object is provided for `iteratee` the created `_.matches` style
21344
+ * callback returns `true` for elements that have the properties of the given
21345
+ * object, else `false`.
21346
+ *
21347
+ * Many lodash methods are guarded to work as iteratees for methods like
21348
+ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
21349
+ *
21350
+ * The guarded methods are:
21351
+ * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
21352
+ * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
21353
+ * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
21354
+ * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
21355
+ * `sum`, `uniq`, and `words`
21356
+ *
21357
+ * @static
21358
+ * @memberOf _
21359
+ * @alias collect
21360
+ * @category Collection
21361
+ * @param {Array|Object|string} collection The collection to iterate over.
21362
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
21363
+ * per iteration.
21364
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21365
+ * @returns {Array} Returns the new mapped array.
21366
+ * @example
21367
+ *
21368
+ * function timesThree(n) {
21369
+ * return n * 3;
21370
+ * }
21371
+ *
21372
+ * _.map([1, 2], timesThree);
21373
+ * // => [3, 6]
21374
+ *
21375
+ * _.map({ 'a': 1, 'b': 2 }, timesThree);
21376
+ * // => [3, 6] (iteration order is not guaranteed)
21377
+ *
21378
+ * var users = [
21379
+ * { 'user': 'barney' },
21380
+ * { 'user': 'fred' }
21381
+ * ];
21382
+ *
21383
+ * // using the `_.property` callback shorthand
21384
+ * _.map(users, 'user');
21385
+ * // => ['barney', 'fred']
21386
+ */
21387
+ function map(collection, iteratee, thisArg) {
21388
+ var func = isArray(collection) ? arrayMap : baseMap;
21389
+ iteratee = getCallback(iteratee, thisArg, 3);
21390
+ return func(collection, iteratee);
21391
+ }
21392
+
21393
+ /**
21394
+ * Creates an array of elements split into two groups, the first of which
21395
+ * contains elements `predicate` returns truthy for, while the second of which
21396
+ * contains elements `predicate` returns falsey for. The predicate is bound
21397
+ * to `thisArg` and invoked with three arguments: (value, index|key, collection).
21398
+ *
21399
+ * If a property name is provided for `predicate` the created `_.property`
21400
+ * style callback returns the property value of the given element.
21401
+ *
21402
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21403
+ * style callback returns `true` for elements that have a matching property
21404
+ * value, else `false`.
21405
+ *
21406
+ * If an object is provided for `predicate` the created `_.matches` style
21407
+ * callback returns `true` for elements that have the properties of the given
21408
+ * object, else `false`.
21409
+ *
21410
+ * @static
21411
+ * @memberOf _
21412
+ * @category Collection
21413
+ * @param {Array|Object|string} collection The collection to iterate over.
21414
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
21415
+ * per iteration.
21416
+ * @param {*} [thisArg] The `this` binding of `predicate`.
21417
+ * @returns {Array} Returns the array of grouped elements.
21418
+ * @example
21419
+ *
21420
+ * _.partition([1, 2, 3], function(n) {
21421
+ * return n % 2;
21422
+ * });
21423
+ * // => [[1, 3], [2]]
21424
+ *
21425
+ * _.partition([1.2, 2.3, 3.4], function(n) {
21426
+ * return this.floor(n) % 2;
21427
+ * }, Math);
21428
+ * // => [[1.2, 3.4], [2.3]]
21429
+ *
21430
+ * var users = [
21431
+ * { 'user': 'barney', 'age': 36, 'active': false },
21432
+ * { 'user': 'fred', 'age': 40, 'active': true },
21433
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
21434
+ * ];
21435
+ *
21436
+ * var mapper = function(array) {
21437
+ * return _.pluck(array, 'user');
21438
+ * };
21439
+ *
21440
+ * // using the `_.matches` callback shorthand
21441
+ * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
21442
+ * // => [['pebbles'], ['barney', 'fred']]
21443
+ *
21444
+ * // using the `_.matchesProperty` callback shorthand
21445
+ * _.map(_.partition(users, 'active', false), mapper);
21446
+ * // => [['barney', 'pebbles'], ['fred']]
21447
+ *
21448
+ * // using the `_.property` callback shorthand
21449
+ * _.map(_.partition(users, 'active'), mapper);
21450
+ * // => [['fred'], ['barney', 'pebbles']]
21451
+ */
21452
+ var partition = createAggregator(function(result, value, key) {
21453
+ result[key ? 0 : 1].push(value);
21454
+ }, function() { return [[], []]; });
21455
+
21456
+ /**
21457
+ * Gets the property value of `path` from all elements in `collection`.
21458
+ *
21459
+ * @static
21460
+ * @memberOf _
21461
+ * @category Collection
21462
+ * @param {Array|Object|string} collection The collection to iterate over.
21463
+ * @param {Array|string} path The path of the property to pluck.
21464
+ * @returns {Array} Returns the property values.
21465
+ * @example
21466
+ *
21467
+ * var users = [
21468
+ * { 'user': 'barney', 'age': 36 },
21469
+ * { 'user': 'fred', 'age': 40 }
21470
+ * ];
21471
+ *
21472
+ * _.pluck(users, 'user');
21473
+ * // => ['barney', 'fred']
21474
+ *
21475
+ * var userIndex = _.indexBy(users, 'user');
21476
+ * _.pluck(userIndex, 'age');
21477
+ * // => [36, 40] (iteration order is not guaranteed)
21478
+ */
21479
+ function pluck(collection, path) {
21480
+ return map(collection, property(path));
21481
+ }
21482
+
21483
+ /**
21484
+ * Reduces `collection` to a value which is the accumulated result of running
21485
+ * each element in `collection` through `iteratee`, where each successive
21486
+ * invocation is supplied the return value of the previous. If `accumulator`
21487
+ * is not provided the first element of `collection` is used as the initial
21488
+ * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
21489
+ * (accumulator, value, index|key, collection).
21490
+ *
21491
+ * Many lodash methods are guarded to work as iteratees for methods like
21492
+ * `_.reduce`, `_.reduceRight`, and `_.transform`.
21493
+ *
21494
+ * The guarded methods are:
21495
+ * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,
21496
+ * and `sortByOrder`
21497
+ *
21498
+ * @static
21499
+ * @memberOf _
21500
+ * @alias foldl, inject
21501
+ * @category Collection
21502
+ * @param {Array|Object|string} collection The collection to iterate over.
21503
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
21504
+ * @param {*} [accumulator] The initial value.
21505
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21506
+ * @returns {*} Returns the accumulated value.
21507
+ * @example
21508
+ *
21509
+ * _.reduce([1, 2], function(total, n) {
21510
+ * return total + n;
21511
+ * });
21512
+ * // => 3
21513
+ *
21514
+ * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
21515
+ * result[key] = n * 3;
21516
+ * return result;
21517
+ * }, {});
21518
+ * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
21519
+ */
21520
+ var reduce = createReduce(arrayReduce, baseEach);
21521
+
21522
+ /**
21523
+ * This method is like `_.reduce` except that it iterates over elements of
21524
+ * `collection` from right to left.
21525
+ *
21526
+ * @static
21527
+ * @memberOf _
21528
+ * @alias foldr
21529
+ * @category Collection
21530
+ * @param {Array|Object|string} collection The collection to iterate over.
21531
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
21532
+ * @param {*} [accumulator] The initial value.
21533
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21534
+ * @returns {*} Returns the accumulated value.
21535
+ * @example
21536
+ *
21537
+ * var array = [[0, 1], [2, 3], [4, 5]];
21538
+ *
21539
+ * _.reduceRight(array, function(flattened, other) {
21540
+ * return flattened.concat(other);
21541
+ * }, []);
21542
+ * // => [4, 5, 2, 3, 0, 1]
21543
+ */
21544
+ var reduceRight = createReduce(arrayReduceRight, baseEachRight);
21545
+
21546
+ /**
21547
+ * The opposite of `_.filter`; this method returns the elements of `collection`
21548
+ * that `predicate` does **not** return truthy for.
21549
+ *
21550
+ * @static
21551
+ * @memberOf _
21552
+ * @category Collection
21553
+ * @param {Array|Object|string} collection The collection to iterate over.
21554
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
21555
+ * per iteration.
21556
+ * @param {*} [thisArg] The `this` binding of `predicate`.
21557
+ * @returns {Array} Returns the new filtered array.
21558
+ * @example
21559
+ *
21560
+ * _.reject([1, 2, 3, 4], function(n) {
21561
+ * return n % 2 == 0;
21562
+ * });
21563
+ * // => [1, 3]
21564
+ *
21565
+ * var users = [
21566
+ * { 'user': 'barney', 'age': 36, 'active': false },
21567
+ * { 'user': 'fred', 'age': 40, 'active': true }
21568
+ * ];
21569
+ *
21570
+ * // using the `_.matches` callback shorthand
21571
+ * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
21572
+ * // => ['barney']
21573
+ *
21574
+ * // using the `_.matchesProperty` callback shorthand
21575
+ * _.pluck(_.reject(users, 'active', false), 'user');
21576
+ * // => ['fred']
21577
+ *
21578
+ * // using the `_.property` callback shorthand
21579
+ * _.pluck(_.reject(users, 'active'), 'user');
21580
+ * // => ['barney']
21581
+ */
21582
+ function reject(collection, predicate, thisArg) {
21583
+ var func = isArray(collection) ? arrayFilter : baseFilter;
21584
+ predicate = getCallback(predicate, thisArg, 3);
21585
+ return func(collection, function(value, index, collection) {
21586
+ return !predicate(value, index, collection);
21587
+ });
21588
+ }
21589
+
21590
+ /**
21591
+ * Gets a random element or `n` random elements from a collection.
21592
+ *
21593
+ * @static
21594
+ * @memberOf _
21595
+ * @category Collection
21596
+ * @param {Array|Object|string} collection The collection to sample.
21597
+ * @param {number} [n] The number of elements to sample.
21598
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
21599
+ * @returns {*} Returns the random sample(s).
21600
+ * @example
21601
+ *
21602
+ * _.sample([1, 2, 3, 4]);
21603
+ * // => 2
21604
+ *
21605
+ * _.sample([1, 2, 3, 4], 2);
21606
+ * // => [3, 1]
21607
+ */
21608
+ function sample(collection, n, guard) {
21609
+ if (guard ? isIterateeCall(collection, n, guard) : n == null) {
21610
+ collection = toIterable(collection);
21611
+ var length = collection.length;
21612
+ return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
21613
+ }
21614
+ var index = -1,
21615
+ result = toArray(collection),
21616
+ length = result.length,
21617
+ lastIndex = length - 1;
21618
+
21619
+ n = nativeMin(n < 0 ? 0 : (+n || 0), length);
21620
+ while (++index < n) {
21621
+ var rand = baseRandom(index, lastIndex),
21622
+ value = result[rand];
21623
+
21624
+ result[rand] = result[index];
21625
+ result[index] = value;
21626
+ }
21627
+ result.length = n;
21628
+ return result;
21629
+ }
21630
+
21631
+ /**
21632
+ * Creates an array of shuffled values, using a version of the
21633
+ * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
21634
+ *
21635
+ * @static
21636
+ * @memberOf _
21637
+ * @category Collection
21638
+ * @param {Array|Object|string} collection The collection to shuffle.
21639
+ * @returns {Array} Returns the new shuffled array.
21640
+ * @example
21641
+ *
21642
+ * _.shuffle([1, 2, 3, 4]);
21643
+ * // => [4, 1, 3, 2]
21644
+ */
21645
+ function shuffle(collection) {
21646
+ return sample(collection, POSITIVE_INFINITY);
21647
+ }
21648
+
21649
+ /**
21650
+ * Gets the size of `collection` by returning its length for array-like
21651
+ * values or the number of own enumerable properties for objects.
21652
+ *
21653
+ * @static
21654
+ * @memberOf _
21655
+ * @category Collection
21656
+ * @param {Array|Object|string} collection The collection to inspect.
21657
+ * @returns {number} Returns the size of `collection`.
21658
+ * @example
21659
+ *
21660
+ * _.size([1, 2, 3]);
21661
+ * // => 3
21662
+ *
21663
+ * _.size({ 'a': 1, 'b': 2 });
21664
+ * // => 2
21665
+ *
21666
+ * _.size('pebbles');
21667
+ * // => 7
21668
+ */
21669
+ function size(collection) {
21670
+ var length = collection ? getLength(collection) : 0;
21671
+ return isLength(length) ? length : keys(collection).length;
21672
+ }
21673
+
21674
+ /**
21675
+ * Checks if `predicate` returns truthy for **any** element of `collection`.
21676
+ * The function returns as soon as it finds a passing value and does not iterate
21677
+ * over the entire collection. The predicate is bound to `thisArg` and invoked
21678
+ * with three arguments: (value, index|key, collection).
21679
+ *
21680
+ * If a property name is provided for `predicate` the created `_.property`
21681
+ * style callback returns the property value of the given element.
21682
+ *
21683
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21684
+ * style callback returns `true` for elements that have a matching property
21685
+ * value, else `false`.
21686
+ *
21687
+ * If an object is provided for `predicate` the created `_.matches` style
21688
+ * callback returns `true` for elements that have the properties of the given
21689
+ * object, else `false`.
21690
+ *
21691
+ * @static
21692
+ * @memberOf _
21693
+ * @alias any
21694
+ * @category Collection
21695
+ * @param {Array|Object|string} collection The collection to iterate over.
21696
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
21697
+ * per iteration.
21698
+ * @param {*} [thisArg] The `this` binding of `predicate`.
21699
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
21700
+ * else `false`.
21701
+ * @example
21702
+ *
21703
+ * _.some([null, 0, 'yes', false], Boolean);
21704
+ * // => true
21705
+ *
21706
+ * var users = [
21707
+ * { 'user': 'barney', 'active': true },
21708
+ * { 'user': 'fred', 'active': false }
21709
+ * ];
21710
+ *
21711
+ * // using the `_.matches` callback shorthand
21712
+ * _.some(users, { 'user': 'barney', 'active': false });
21713
+ * // => false
21714
+ *
21715
+ * // using the `_.matchesProperty` callback shorthand
21716
+ * _.some(users, 'active', false);
21717
+ * // => true
21718
+ *
21719
+ * // using the `_.property` callback shorthand
21720
+ * _.some(users, 'active');
21721
+ * // => true
21722
+ */
21723
+ function some(collection, predicate, thisArg) {
21724
+ var func = isArray(collection) ? arraySome : baseSome;
21725
+ if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
21726
+ predicate = undefined;
21727
+ }
21728
+ if (typeof predicate != 'function' || thisArg !== undefined) {
21729
+ predicate = getCallback(predicate, thisArg, 3);
21730
+ }
21731
+ return func(collection, predicate);
21732
+ }
21733
+
21734
+ /**
21735
+ * Creates an array of elements, sorted in ascending order by the results of
21736
+ * running each element in a collection through `iteratee`. This method performs
21737
+ * a stable sort, that is, it preserves the original sort order of equal elements.
21738
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
21739
+ * (value, index|key, collection).
21740
+ *
21741
+ * If a property name is provided for `iteratee` the created `_.property`
21742
+ * style callback returns the property value of the given element.
21743
+ *
21744
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
21745
+ * style callback returns `true` for elements that have a matching property
21746
+ * value, else `false`.
21747
+ *
21748
+ * If an object is provided for `iteratee` the created `_.matches` style
21749
+ * callback returns `true` for elements that have the properties of the given
21750
+ * object, else `false`.
21751
+ *
21752
+ * @static
21753
+ * @memberOf _
21754
+ * @category Collection
21755
+ * @param {Array|Object|string} collection The collection to iterate over.
21756
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
21757
+ * per iteration.
21758
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
21759
+ * @returns {Array} Returns the new sorted array.
21760
+ * @example
21761
+ *
21762
+ * _.sortBy([1, 2, 3], function(n) {
21763
+ * return Math.sin(n);
21764
+ * });
21765
+ * // => [3, 1, 2]
21766
+ *
21767
+ * _.sortBy([1, 2, 3], function(n) {
21768
+ * return this.sin(n);
21769
+ * }, Math);
21770
+ * // => [3, 1, 2]
21771
+ *
21772
+ * var users = [
21773
+ * { 'user': 'fred' },
21774
+ * { 'user': 'pebbles' },
21775
+ * { 'user': 'barney' }
21776
+ * ];
21777
+ *
21778
+ * // using the `_.property` callback shorthand
21779
+ * _.pluck(_.sortBy(users, 'user'), 'user');
21780
+ * // => ['barney', 'fred', 'pebbles']
21781
+ */
21782
+ function sortBy(collection, iteratee, thisArg) {
21783
+ if (collection == null) {
21784
+ return [];
21785
+ }
21786
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
21787
+ iteratee = undefined;
21788
+ }
21789
+ var index = -1;
21790
+ iteratee = getCallback(iteratee, thisArg, 3);
21791
+
21792
+ var result = baseMap(collection, function(value, key, collection) {
21793
+ return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
21794
+ });
21795
+ return baseSortBy(result, compareAscending);
21796
+ }
21797
+
21798
+ /**
21799
+ * This method is like `_.sortBy` except that it can sort by multiple iteratees
21800
+ * or property names.
21801
+ *
21802
+ * If a property name is provided for an iteratee the created `_.property`
21803
+ * style callback returns the property value of the given element.
21804
+ *
21805
+ * If an object is provided for an iteratee the created `_.matches` style
21806
+ * callback returns `true` for elements that have the properties of the given
21807
+ * object, else `false`.
21808
+ *
21809
+ * @static
21810
+ * @memberOf _
21811
+ * @category Collection
21812
+ * @param {Array|Object|string} collection The collection to iterate over.
21813
+ * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees
21814
+ * The iteratees to sort by, specified as individual values or arrays of values.
21815
+ * @returns {Array} Returns the new sorted array.
21816
+ * @example
21817
+ *
21818
+ * var users = [
21819
+ * { 'user': 'fred', 'age': 48 },
21820
+ * { 'user': 'barney', 'age': 36 },
21821
+ * { 'user': 'fred', 'age': 42 },
21822
+ * { 'user': 'barney', 'age': 34 }
21823
+ * ];
21824
+ *
21825
+ * _.map(_.sortByAll(users, ['user', 'age']), _.values);
21826
+ * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
21827
+ *
21828
+ * _.map(_.sortByAll(users, 'user', function(chr) {
21829
+ * return Math.floor(chr.age / 10);
21830
+ * }), _.values);
21831
+ * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
21832
+ */
21833
+ var sortByAll = restParam(function(collection, iteratees) {
21834
+ if (collection == null) {
21835
+ return [];
21836
+ }
21837
+ var guard = iteratees[2];
21838
+ if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
21839
+ iteratees.length = 1;
21840
+ }
21841
+ return baseSortByOrder(collection, baseFlatten(iteratees), []);
21842
+ });
21843
+
21844
+ /**
21845
+ * This method is like `_.sortByAll` except that it allows specifying the
21846
+ * sort orders of the iteratees to sort by. If `orders` is unspecified, all
21847
+ * values are sorted in ascending order. Otherwise, a value is sorted in
21848
+ * ascending order if its corresponding order is "asc", and descending if "desc".
21849
+ *
21850
+ * If a property name is provided for an iteratee the created `_.property`
21851
+ * style callback returns the property value of the given element.
21852
+ *
21853
+ * If an object is provided for an iteratee the created `_.matches` style
21854
+ * callback returns `true` for elements that have the properties of the given
21855
+ * object, else `false`.
21856
+ *
21857
+ * @static
21858
+ * @memberOf _
21859
+ * @category Collection
21860
+ * @param {Array|Object|string} collection The collection to iterate over.
21861
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
21862
+ * @param {boolean[]} [orders] The sort orders of `iteratees`.
21863
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
21864
+ * @returns {Array} Returns the new sorted array.
21865
+ * @example
21866
+ *
21867
+ * var users = [
21868
+ * { 'user': 'fred', 'age': 48 },
21869
+ * { 'user': 'barney', 'age': 34 },
21870
+ * { 'user': 'fred', 'age': 42 },
21871
+ * { 'user': 'barney', 'age': 36 }
21872
+ * ];
21873
+ *
21874
+ * // sort by `user` in ascending order and by `age` in descending order
21875
+ * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);
21876
+ * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
21877
+ */
21878
+ function sortByOrder(collection, iteratees, orders, guard) {
21879
+ if (collection == null) {
21880
+ return [];
21881
+ }
21882
+ if (guard && isIterateeCall(iteratees, orders, guard)) {
21883
+ orders = undefined;
21884
+ }
21885
+ if (!isArray(iteratees)) {
21886
+ iteratees = iteratees == null ? [] : [iteratees];
21887
+ }
21888
+ if (!isArray(orders)) {
21889
+ orders = orders == null ? [] : [orders];
21890
+ }
21891
+ return baseSortByOrder(collection, iteratees, orders);
21892
+ }
21893
+
21894
+ /**
21895
+ * Performs a deep comparison between each element in `collection` and the
21896
+ * source object, returning an array of all elements that have equivalent
21897
+ * property values.
21898
+ *
21899
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
21900
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
21901
+ * their own, not inherited, enumerable properties. For comparing a single
21902
+ * own or inherited property value see `_.matchesProperty`.
21903
+ *
21904
+ * @static
21905
+ * @memberOf _
21906
+ * @category Collection
21907
+ * @param {Array|Object|string} collection The collection to search.
21908
+ * @param {Object} source The object of property values to match.
21909
+ * @returns {Array} Returns the new filtered array.
21910
+ * @example
21911
+ *
21912
+ * var users = [
21913
+ * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
21914
+ * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
21915
+ * ];
21916
+ *
21917
+ * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
21918
+ * // => ['barney']
21919
+ *
21920
+ * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
21921
+ * // => ['fred']
21922
+ */
21923
+ function where(collection, source) {
21924
+ return filter(collection, baseMatches(source));
21925
+ }
21926
+
21927
+ /*------------------------------------------------------------------------*/
21928
+
21929
+ /**
21930
+ * Gets the number of milliseconds that have elapsed since the Unix epoch
21931
+ * (1 January 1970 00:00:00 UTC).
21932
+ *
21933
+ * @static
21934
+ * @memberOf _
21935
+ * @category Date
21936
+ * @example
21937
+ *
21938
+ * _.defer(function(stamp) {
21939
+ * console.log(_.now() - stamp);
21940
+ * }, _.now());
21941
+ * // => logs the number of milliseconds it took for the deferred function to be invoked
21942
+ */
21943
+ var now = nativeNow || function() {
21944
+ return new Date().getTime();
21945
+ };
21946
+
21947
+ /*------------------------------------------------------------------------*/
21948
+
21949
+ /**
21950
+ * The opposite of `_.before`; this method creates a function that invokes
21951
+ * `func` once it is called `n` or more times.
21952
+ *
21953
+ * @static
21954
+ * @memberOf _
21955
+ * @category Function
21956
+ * @param {number} n The number of calls before `func` is invoked.
21957
+ * @param {Function} func The function to restrict.
21958
+ * @returns {Function} Returns the new restricted function.
21959
+ * @example
21960
+ *
21961
+ * var saves = ['profile', 'settings'];
21962
+ *
21963
+ * var done = _.after(saves.length, function() {
21964
+ * console.log('done saving!');
21965
+ * });
21966
+ *
21967
+ * _.forEach(saves, function(type) {
21968
+ * asyncSave({ 'type': type, 'complete': done });
21969
+ * });
21970
+ * // => logs 'done saving!' after the two async saves have completed
21971
+ */
21972
+ function after(n, func) {
21973
+ if (typeof func != 'function') {
21974
+ if (typeof n == 'function') {
21975
+ var temp = n;
21976
+ n = func;
21977
+ func = temp;
21978
+ } else {
21979
+ throw new TypeError(FUNC_ERROR_TEXT);
21980
+ }
21981
+ }
21982
+ n = nativeIsFinite(n = +n) ? n : 0;
21983
+ return function() {
21984
+ if (--n < 1) {
21985
+ return func.apply(this, arguments);
21986
+ }
21987
+ };
21988
+ }
21989
+
21990
+ /**
21991
+ * Creates a function that accepts up to `n` arguments ignoring any
21992
+ * additional arguments.
21993
+ *
21994
+ * @static
21995
+ * @memberOf _
21996
+ * @category Function
21997
+ * @param {Function} func The function to cap arguments for.
21998
+ * @param {number} [n=func.length] The arity cap.
21999
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
22000
+ * @returns {Function} Returns the new function.
22001
+ * @example
22002
+ *
22003
+ * _.map(['6', '8', '10'], _.ary(parseInt, 1));
22004
+ * // => [6, 8, 10]
22005
+ */
22006
+ function ary(func, n, guard) {
22007
+ if (guard && isIterateeCall(func, n, guard)) {
22008
+ n = undefined;
22009
+ }
22010
+ n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
22011
+ return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
22012
+ }
22013
+
22014
+ /**
22015
+ * Creates a function that invokes `func`, with the `this` binding and arguments
22016
+ * of the created function, while it is called less than `n` times. Subsequent
22017
+ * calls to the created function return the result of the last `func` invocation.
22018
+ *
22019
+ * @static
22020
+ * @memberOf _
22021
+ * @category Function
22022
+ * @param {number} n The number of calls at which `func` is no longer invoked.
22023
+ * @param {Function} func The function to restrict.
22024
+ * @returns {Function} Returns the new restricted function.
22025
+ * @example
22026
+ *
22027
+ * jQuery('#add').on('click', _.before(5, addContactToList));
22028
+ * // => allows adding up to 4 contacts to the list
22029
+ */
22030
+ function before(n, func) {
22031
+ var result;
22032
+ if (typeof func != 'function') {
22033
+ if (typeof n == 'function') {
22034
+ var temp = n;
22035
+ n = func;
22036
+ func = temp;
22037
+ } else {
22038
+ throw new TypeError(FUNC_ERROR_TEXT);
22039
+ }
22040
+ }
22041
+ return function() {
22042
+ if (--n > 0) {
22043
+ result = func.apply(this, arguments);
22044
+ }
22045
+ if (n <= 1) {
22046
+ func = undefined;
22047
+ }
22048
+ return result;
22049
+ };
22050
+ }
22051
+
22052
+ /**
22053
+ * Creates a function that invokes `func` with the `this` binding of `thisArg`
22054
+ * and prepends any additional `_.bind` arguments to those provided to the
22055
+ * bound function.
22056
+ *
22057
+ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
22058
+ * may be used as a placeholder for partially applied arguments.
22059
+ *
22060
+ * **Note:** Unlike native `Function#bind` this method does not set the "length"
22061
+ * property of bound functions.
22062
+ *
22063
+ * @static
22064
+ * @memberOf _
22065
+ * @category Function
22066
+ * @param {Function} func The function to bind.
22067
+ * @param {*} thisArg The `this` binding of `func`.
22068
+ * @param {...*} [partials] The arguments to be partially applied.
22069
+ * @returns {Function} Returns the new bound function.
22070
+ * @example
22071
+ *
22072
+ * var greet = function(greeting, punctuation) {
22073
+ * return greeting + ' ' + this.user + punctuation;
22074
+ * };
22075
+ *
22076
+ * var object = { 'user': 'fred' };
22077
+ *
22078
+ * var bound = _.bind(greet, object, 'hi');
22079
+ * bound('!');
22080
+ * // => 'hi fred!'
22081
+ *
22082
+ * // using placeholders
22083
+ * var bound = _.bind(greet, object, _, '!');
22084
+ * bound('hi');
22085
+ * // => 'hi fred!'
22086
+ */
22087
+ var bind = restParam(function(func, thisArg, partials) {
22088
+ var bitmask = BIND_FLAG;
22089
+ if (partials.length) {
22090
+ var holders = replaceHolders(partials, bind.placeholder);
22091
+ bitmask |= PARTIAL_FLAG;
22092
+ }
22093
+ return createWrapper(func, bitmask, thisArg, partials, holders);
22094
+ });
22095
+
22096
+ /**
22097
+ * Binds methods of an object to the object itself, overwriting the existing
22098
+ * method. Method names may be specified as individual arguments or as arrays
22099
+ * of method names. If no method names are provided all enumerable function
22100
+ * properties, own and inherited, of `object` are bound.
22101
+ *
22102
+ * **Note:** This method does not set the "length" property of bound functions.
22103
+ *
22104
+ * @static
22105
+ * @memberOf _
22106
+ * @category Function
22107
+ * @param {Object} object The object to bind and assign the bound methods to.
22108
+ * @param {...(string|string[])} [methodNames] The object method names to bind,
22109
+ * specified as individual method names or arrays of method names.
22110
+ * @returns {Object} Returns `object`.
22111
+ * @example
22112
+ *
22113
+ * var view = {
22114
+ * 'label': 'docs',
22115
+ * 'onClick': function() {
22116
+ * console.log('clicked ' + this.label);
22117
+ * }
22118
+ * };
22119
+ *
22120
+ * _.bindAll(view);
22121
+ * jQuery('#docs').on('click', view.onClick);
22122
+ * // => logs 'clicked docs' when the element is clicked
22123
+ */
22124
+ var bindAll = restParam(function(object, methodNames) {
22125
+ methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
22126
+
22127
+ var index = -1,
22128
+ length = methodNames.length;
22129
+
22130
+ while (++index < length) {
22131
+ var key = methodNames[index];
22132
+ object[key] = createWrapper(object[key], BIND_FLAG, object);
22133
+ }
22134
+ return object;
22135
+ });
22136
+
22137
+ /**
22138
+ * Creates a function that invokes the method at `object[key]` and prepends
22139
+ * any additional `_.bindKey` arguments to those provided to the bound function.
22140
+ *
22141
+ * This method differs from `_.bind` by allowing bound functions to reference
22142
+ * methods that may be redefined or don't yet exist.
22143
+ * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
22144
+ * for more details.
22145
+ *
22146
+ * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
22147
+ * builds, may be used as a placeholder for partially applied arguments.
22148
+ *
22149
+ * @static
22150
+ * @memberOf _
22151
+ * @category Function
22152
+ * @param {Object} object The object the method belongs to.
22153
+ * @param {string} key The key of the method.
22154
+ * @param {...*} [partials] The arguments to be partially applied.
22155
+ * @returns {Function} Returns the new bound function.
22156
+ * @example
22157
+ *
22158
+ * var object = {
22159
+ * 'user': 'fred',
22160
+ * 'greet': function(greeting, punctuation) {
22161
+ * return greeting + ' ' + this.user + punctuation;
22162
+ * }
22163
+ * };
22164
+ *
22165
+ * var bound = _.bindKey(object, 'greet', 'hi');
22166
+ * bound('!');
22167
+ * // => 'hi fred!'
22168
+ *
22169
+ * object.greet = function(greeting, punctuation) {
22170
+ * return greeting + 'ya ' + this.user + punctuation;
22171
+ * };
22172
+ *
22173
+ * bound('!');
22174
+ * // => 'hiya fred!'
22175
+ *
22176
+ * // using placeholders
22177
+ * var bound = _.bindKey(object, 'greet', _, '!');
22178
+ * bound('hi');
22179
+ * // => 'hiya fred!'
22180
+ */
22181
+ var bindKey = restParam(function(object, key, partials) {
22182
+ var bitmask = BIND_FLAG | BIND_KEY_FLAG;
22183
+ if (partials.length) {
22184
+ var holders = replaceHolders(partials, bindKey.placeholder);
22185
+ bitmask |= PARTIAL_FLAG;
22186
+ }
22187
+ return createWrapper(key, bitmask, object, partials, holders);
22188
+ });
22189
+
22190
+ /**
22191
+ * Creates a function that accepts one or more arguments of `func` that when
22192
+ * called either invokes `func` returning its result, if all `func` arguments
22193
+ * have been provided, or returns a function that accepts one or more of the
22194
+ * remaining `func` arguments, and so on. The arity of `func` may be specified
22195
+ * if `func.length` is not sufficient.
22196
+ *
22197
+ * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
22198
+ * may be used as a placeholder for provided arguments.
22199
+ *
22200
+ * **Note:** This method does not set the "length" property of curried functions.
22201
+ *
22202
+ * @static
22203
+ * @memberOf _
22204
+ * @category Function
22205
+ * @param {Function} func The function to curry.
22206
+ * @param {number} [arity=func.length] The arity of `func`.
22207
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
22208
+ * @returns {Function} Returns the new curried function.
22209
+ * @example
22210
+ *
22211
+ * var abc = function(a, b, c) {
22212
+ * return [a, b, c];
22213
+ * };
22214
+ *
22215
+ * var curried = _.curry(abc);
22216
+ *
22217
+ * curried(1)(2)(3);
22218
+ * // => [1, 2, 3]
22219
+ *
22220
+ * curried(1, 2)(3);
22221
+ * // => [1, 2, 3]
22222
+ *
22223
+ * curried(1, 2, 3);
22224
+ * // => [1, 2, 3]
22225
+ *
22226
+ * // using placeholders
22227
+ * curried(1)(_, 3)(2);
22228
+ * // => [1, 2, 3]
22229
+ */
22230
+ var curry = createCurry(CURRY_FLAG);
22231
+
22232
+ /**
22233
+ * This method is like `_.curry` except that arguments are applied to `func`
22234
+ * in the manner of `_.partialRight` instead of `_.partial`.
22235
+ *
22236
+ * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
22237
+ * builds, may be used as a placeholder for provided arguments.
22238
+ *
22239
+ * **Note:** This method does not set the "length" property of curried functions.
22240
+ *
22241
+ * @static
22242
+ * @memberOf _
22243
+ * @category Function
22244
+ * @param {Function} func The function to curry.
22245
+ * @param {number} [arity=func.length] The arity of `func`.
22246
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
22247
+ * @returns {Function} Returns the new curried function.
22248
+ * @example
22249
+ *
22250
+ * var abc = function(a, b, c) {
22251
+ * return [a, b, c];
22252
+ * };
22253
+ *
22254
+ * var curried = _.curryRight(abc);
22255
+ *
22256
+ * curried(3)(2)(1);
22257
+ * // => [1, 2, 3]
22258
+ *
22259
+ * curried(2, 3)(1);
22260
+ * // => [1, 2, 3]
22261
+ *
22262
+ * curried(1, 2, 3);
22263
+ * // => [1, 2, 3]
22264
+ *
22265
+ * // using placeholders
22266
+ * curried(3)(1, _)(2);
22267
+ * // => [1, 2, 3]
22268
+ */
22269
+ var curryRight = createCurry(CURRY_RIGHT_FLAG);
22270
+
22271
+ /**
22272
+ * Creates a debounced function that delays invoking `func` until after `wait`
22273
+ * milliseconds have elapsed since the last time the debounced function was
22274
+ * invoked. The debounced function comes with a `cancel` method to cancel
22275
+ * delayed invocations. Provide an options object to indicate that `func`
22276
+ * should be invoked on the leading and/or trailing edge of the `wait` timeout.
22277
+ * Subsequent calls to the debounced function return the result of the last
22278
+ * `func` invocation.
22279
+ *
22280
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
22281
+ * on the trailing edge of the timeout only if the the debounced function is
22282
+ * invoked more than once during the `wait` timeout.
22283
+ *
22284
+ * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
22285
+ * for details over the differences between `_.debounce` and `_.throttle`.
22286
+ *
22287
+ * @static
22288
+ * @memberOf _
22289
+ * @category Function
22290
+ * @param {Function} func The function to debounce.
22291
+ * @param {number} [wait=0] The number of milliseconds to delay.
22292
+ * @param {Object} [options] The options object.
22293
+ * @param {boolean} [options.leading=false] Specify invoking on the leading
22294
+ * edge of the timeout.
22295
+ * @param {number} [options.maxWait] The maximum time `func` is allowed to be
22296
+ * delayed before it is invoked.
22297
+ * @param {boolean} [options.trailing=true] Specify invoking on the trailing
22298
+ * edge of the timeout.
22299
+ * @returns {Function} Returns the new debounced function.
22300
+ * @example
22301
+ *
22302
+ * // avoid costly calculations while the window size is in flux
22303
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
22304
+ *
22305
+ * // invoke `sendMail` when the click event is fired, debouncing subsequent calls
22306
+ * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
22307
+ * 'leading': true,
22308
+ * 'trailing': false
22309
+ * }));
22310
+ *
22311
+ * // ensure `batchLog` is invoked once after 1 second of debounced calls
22312
+ * var source = new EventSource('/stream');
22313
+ * jQuery(source).on('message', _.debounce(batchLog, 250, {
22314
+ * 'maxWait': 1000
22315
+ * }));
22316
+ *
22317
+ * // cancel a debounced call
22318
+ * var todoChanges = _.debounce(batchLog, 1000);
22319
+ * Object.observe(models.todo, todoChanges);
22320
+ *
22321
+ * Object.observe(models, function(changes) {
22322
+ * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
22323
+ * todoChanges.cancel();
22324
+ * }
22325
+ * }, ['delete']);
22326
+ *
22327
+ * // ...at some point `models.todo` is changed
22328
+ * models.todo.completed = true;
22329
+ *
22330
+ * // ...before 1 second has passed `models.todo` is deleted
22331
+ * // which cancels the debounced `todoChanges` call
22332
+ * delete models.todo;
22333
+ */
22334
+ function debounce(func, wait, options) {
22335
+ var args,
22336
+ maxTimeoutId,
22337
+ result,
22338
+ stamp,
22339
+ thisArg,
22340
+ timeoutId,
22341
+ trailingCall,
22342
+ lastCalled = 0,
22343
+ maxWait = false,
22344
+ trailing = true;
22345
+
22346
+ if (typeof func != 'function') {
22347
+ throw new TypeError(FUNC_ERROR_TEXT);
22348
+ }
22349
+ wait = wait < 0 ? 0 : (+wait || 0);
22350
+ if (options === true) {
22351
+ var leading = true;
22352
+ trailing = false;
22353
+ } else if (isObject(options)) {
22354
+ leading = !!options.leading;
22355
+ maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
22356
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
22357
+ }
22358
+
22359
+ function cancel() {
22360
+ if (timeoutId) {
22361
+ clearTimeout(timeoutId);
22362
+ }
22363
+ if (maxTimeoutId) {
22364
+ clearTimeout(maxTimeoutId);
22365
+ }
22366
+ lastCalled = 0;
22367
+ maxTimeoutId = timeoutId = trailingCall = undefined;
22368
+ }
22369
+
22370
+ function complete(isCalled, id) {
22371
+ if (id) {
22372
+ clearTimeout(id);
22373
+ }
22374
+ maxTimeoutId = timeoutId = trailingCall = undefined;
22375
+ if (isCalled) {
22376
+ lastCalled = now();
22377
+ result = func.apply(thisArg, args);
22378
+ if (!timeoutId && !maxTimeoutId) {
22379
+ args = thisArg = undefined;
22380
+ }
22381
+ }
22382
+ }
22383
+
22384
+ function delayed() {
22385
+ var remaining = wait - (now() - stamp);
22386
+ if (remaining <= 0 || remaining > wait) {
22387
+ complete(trailingCall, maxTimeoutId);
22388
+ } else {
22389
+ timeoutId = setTimeout(delayed, remaining);
22390
+ }
22391
+ }
22392
+
22393
+ function maxDelayed() {
22394
+ complete(trailing, timeoutId);
22395
+ }
22396
+
22397
+ function debounced() {
22398
+ args = arguments;
22399
+ stamp = now();
22400
+ thisArg = this;
22401
+ trailingCall = trailing && (timeoutId || !leading);
22402
+
22403
+ if (maxWait === false) {
22404
+ var leadingCall = leading && !timeoutId;
22405
+ } else {
22406
+ if (!maxTimeoutId && !leading) {
22407
+ lastCalled = stamp;
22408
+ }
22409
+ var remaining = maxWait - (stamp - lastCalled),
22410
+ isCalled = remaining <= 0 || remaining > maxWait;
22411
+
22412
+ if (isCalled) {
22413
+ if (maxTimeoutId) {
22414
+ maxTimeoutId = clearTimeout(maxTimeoutId);
22415
+ }
22416
+ lastCalled = stamp;
22417
+ result = func.apply(thisArg, args);
22418
+ }
22419
+ else if (!maxTimeoutId) {
22420
+ maxTimeoutId = setTimeout(maxDelayed, remaining);
22421
+ }
22422
+ }
22423
+ if (isCalled && timeoutId) {
22424
+ timeoutId = clearTimeout(timeoutId);
22425
+ }
22426
+ else if (!timeoutId && wait !== maxWait) {
22427
+ timeoutId = setTimeout(delayed, wait);
22428
+ }
22429
+ if (leadingCall) {
22430
+ isCalled = true;
22431
+ result = func.apply(thisArg, args);
22432
+ }
22433
+ if (isCalled && !timeoutId && !maxTimeoutId) {
22434
+ args = thisArg = undefined;
22435
+ }
22436
+ return result;
22437
+ }
22438
+ debounced.cancel = cancel;
22439
+ return debounced;
22440
+ }
22441
+
22442
+ /**
22443
+ * Defers invoking the `func` until the current call stack has cleared. Any
22444
+ * additional arguments are provided to `func` when it is invoked.
22445
+ *
22446
+ * @static
22447
+ * @memberOf _
22448
+ * @category Function
22449
+ * @param {Function} func The function to defer.
22450
+ * @param {...*} [args] The arguments to invoke the function with.
22451
+ * @returns {number} Returns the timer id.
22452
+ * @example
22453
+ *
22454
+ * _.defer(function(text) {
22455
+ * console.log(text);
22456
+ * }, 'deferred');
22457
+ * // logs 'deferred' after one or more milliseconds
22458
+ */
22459
+ var defer = restParam(function(func, args) {
22460
+ return baseDelay(func, 1, args);
22461
+ });
22462
+
22463
+ /**
22464
+ * Invokes `func` after `wait` milliseconds. Any additional arguments are
22465
+ * provided to `func` when it is invoked.
22466
+ *
22467
+ * @static
22468
+ * @memberOf _
22469
+ * @category Function
22470
+ * @param {Function} func The function to delay.
22471
+ * @param {number} wait The number of milliseconds to delay invocation.
22472
+ * @param {...*} [args] The arguments to invoke the function with.
22473
+ * @returns {number} Returns the timer id.
22474
+ * @example
22475
+ *
22476
+ * _.delay(function(text) {
22477
+ * console.log(text);
22478
+ * }, 1000, 'later');
22479
+ * // => logs 'later' after one second
22480
+ */
22481
+ var delay = restParam(function(func, wait, args) {
22482
+ return baseDelay(func, wait, args);
22483
+ });
22484
+
22485
+ /**
22486
+ * Creates a function that returns the result of invoking the provided
22487
+ * functions with the `this` binding of the created function, where each
22488
+ * successive invocation is supplied the return value of the previous.
22489
+ *
22490
+ * @static
22491
+ * @memberOf _
22492
+ * @category Function
22493
+ * @param {...Function} [funcs] Functions to invoke.
22494
+ * @returns {Function} Returns the new function.
22495
+ * @example
22496
+ *
22497
+ * function square(n) {
22498
+ * return n * n;
22499
+ * }
22500
+ *
22501
+ * var addSquare = _.flow(_.add, square);
22502
+ * addSquare(1, 2);
22503
+ * // => 9
22504
+ */
22505
+ var flow = createFlow();
22506
+
22507
+ /**
22508
+ * This method is like `_.flow` except that it creates a function that
22509
+ * invokes the provided functions from right to left.
22510
+ *
22511
+ * @static
22512
+ * @memberOf _
22513
+ * @alias backflow, compose
22514
+ * @category Function
22515
+ * @param {...Function} [funcs] Functions to invoke.
22516
+ * @returns {Function} Returns the new function.
22517
+ * @example
22518
+ *
22519
+ * function square(n) {
22520
+ * return n * n;
22521
+ * }
22522
+ *
22523
+ * var addSquare = _.flowRight(square, _.add);
22524
+ * addSquare(1, 2);
22525
+ * // => 9
22526
+ */
22527
+ var flowRight = createFlow(true);
22528
+
22529
+ /**
22530
+ * Creates a function that memoizes the result of `func`. If `resolver` is
22531
+ * provided it determines the cache key for storing the result based on the
22532
+ * arguments provided to the memoized function. By default, the first argument
22533
+ * provided to the memoized function is coerced to a string and used as the
22534
+ * cache key. The `func` is invoked with the `this` binding of the memoized
22535
+ * function.
22536
+ *
22537
+ * **Note:** The cache is exposed as the `cache` property on the memoized
22538
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
22539
+ * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
22540
+ * method interface of `get`, `has`, and `set`.
22541
+ *
22542
+ * @static
22543
+ * @memberOf _
22544
+ * @category Function
22545
+ * @param {Function} func The function to have its output memoized.
22546
+ * @param {Function} [resolver] The function to resolve the cache key.
22547
+ * @returns {Function} Returns the new memoizing function.
22548
+ * @example
22549
+ *
22550
+ * var upperCase = _.memoize(function(string) {
22551
+ * return string.toUpperCase();
22552
+ * });
22553
+ *
22554
+ * upperCase('fred');
22555
+ * // => 'FRED'
22556
+ *
22557
+ * // modifying the result cache
22558
+ * upperCase.cache.set('fred', 'BARNEY');
22559
+ * upperCase('fred');
22560
+ * // => 'BARNEY'
22561
+ *
22562
+ * // replacing `_.memoize.Cache`
22563
+ * var object = { 'user': 'fred' };
22564
+ * var other = { 'user': 'barney' };
22565
+ * var identity = _.memoize(_.identity);
22566
+ *
22567
+ * identity(object);
22568
+ * // => { 'user': 'fred' }
22569
+ * identity(other);
22570
+ * // => { 'user': 'fred' }
22571
+ *
22572
+ * _.memoize.Cache = WeakMap;
22573
+ * var identity = _.memoize(_.identity);
22574
+ *
22575
+ * identity(object);
22576
+ * // => { 'user': 'fred' }
22577
+ * identity(other);
22578
+ * // => { 'user': 'barney' }
22579
+ */
22580
+ function memoize(func, resolver) {
22581
+ if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
22582
+ throw new TypeError(FUNC_ERROR_TEXT);
22583
+ }
22584
+ var memoized = function() {
22585
+ var args = arguments,
22586
+ key = resolver ? resolver.apply(this, args) : args[0],
22587
+ cache = memoized.cache;
22588
+
22589
+ if (cache.has(key)) {
22590
+ return cache.get(key);
22591
+ }
22592
+ var result = func.apply(this, args);
22593
+ memoized.cache = cache.set(key, result);
22594
+ return result;
22595
+ };
22596
+ memoized.cache = new memoize.Cache;
22597
+ return memoized;
22598
+ }
22599
+
22600
+ /**
22601
+ * Creates a function that runs each argument through a corresponding
22602
+ * transform function.
22603
+ *
22604
+ * @static
22605
+ * @memberOf _
22606
+ * @category Function
22607
+ * @param {Function} func The function to wrap.
22608
+ * @param {...(Function|Function[])} [transforms] The functions to transform
22609
+ * arguments, specified as individual functions or arrays of functions.
22610
+ * @returns {Function} Returns the new function.
22611
+ * @example
22612
+ *
22613
+ * function doubled(n) {
22614
+ * return n * 2;
22615
+ * }
22616
+ *
22617
+ * function square(n) {
22618
+ * return n * n;
22619
+ * }
22620
+ *
22621
+ * var modded = _.modArgs(function(x, y) {
22622
+ * return [x, y];
22623
+ * }, square, doubled);
22624
+ *
22625
+ * modded(1, 2);
22626
+ * // => [1, 4]
22627
+ *
22628
+ * modded(5, 10);
22629
+ * // => [25, 20]
22630
+ */
22631
+ var modArgs = restParam(function(func, transforms) {
22632
+ transforms = baseFlatten(transforms);
22633
+ if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
22634
+ throw new TypeError(FUNC_ERROR_TEXT);
22635
+ }
22636
+ var length = transforms.length;
22637
+ return restParam(function(args) {
22638
+ var index = nativeMin(args.length, length);
22639
+ while (index--) {
22640
+ args[index] = transforms[index](args[index]);
22641
+ }
22642
+ return func.apply(this, args);
22643
+ });
22644
+ });
22645
+
22646
+ /**
22647
+ * Creates a function that negates the result of the predicate `func`. The
22648
+ * `func` predicate is invoked with the `this` binding and arguments of the
22649
+ * created function.
22650
+ *
22651
+ * @static
22652
+ * @memberOf _
22653
+ * @category Function
22654
+ * @param {Function} predicate The predicate to negate.
22655
+ * @returns {Function} Returns the new function.
22656
+ * @example
22657
+ *
22658
+ * function isEven(n) {
22659
+ * return n % 2 == 0;
22660
+ * }
22661
+ *
22662
+ * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
22663
+ * // => [1, 3, 5]
22664
+ */
22665
+ function negate(predicate) {
22666
+ if (typeof predicate != 'function') {
22667
+ throw new TypeError(FUNC_ERROR_TEXT);
22668
+ }
22669
+ return function() {
22670
+ return !predicate.apply(this, arguments);
22671
+ };
22672
+ }
22673
+
22674
+ /**
22675
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
22676
+ * to the function return the value of the first call. The `func` is invoked
22677
+ * with the `this` binding and arguments of the created function.
22678
+ *
22679
+ * @static
22680
+ * @memberOf _
22681
+ * @category Function
22682
+ * @param {Function} func The function to restrict.
22683
+ * @returns {Function} Returns the new restricted function.
22684
+ * @example
22685
+ *
22686
+ * var initialize = _.once(createApplication);
22687
+ * initialize();
22688
+ * initialize();
22689
+ * // `initialize` invokes `createApplication` once
22690
+ */
22691
+ function once(func) {
22692
+ return before(2, func);
22693
+ }
22694
+
22695
+ /**
22696
+ * Creates a function that invokes `func` with `partial` arguments prepended
22697
+ * to those provided to the new function. This method is like `_.bind` except
22698
+ * it does **not** alter the `this` binding.
22699
+ *
22700
+ * The `_.partial.placeholder` value, which defaults to `_` in monolithic
22701
+ * builds, may be used as a placeholder for partially applied arguments.
22702
+ *
22703
+ * **Note:** This method does not set the "length" property of partially
22704
+ * applied functions.
22705
+ *
22706
+ * @static
22707
+ * @memberOf _
22708
+ * @category Function
22709
+ * @param {Function} func The function to partially apply arguments to.
22710
+ * @param {...*} [partials] The arguments to be partially applied.
22711
+ * @returns {Function} Returns the new partially applied function.
22712
+ * @example
22713
+ *
22714
+ * var greet = function(greeting, name) {
22715
+ * return greeting + ' ' + name;
22716
+ * };
22717
+ *
22718
+ * var sayHelloTo = _.partial(greet, 'hello');
22719
+ * sayHelloTo('fred');
22720
+ * // => 'hello fred'
22721
+ *
22722
+ * // using placeholders
22723
+ * var greetFred = _.partial(greet, _, 'fred');
22724
+ * greetFred('hi');
22725
+ * // => 'hi fred'
22726
+ */
22727
+ var partial = createPartial(PARTIAL_FLAG);
22728
+
22729
+ /**
22730
+ * This method is like `_.partial` except that partially applied arguments
22731
+ * are appended to those provided to the new function.
22732
+ *
22733
+ * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
22734
+ * builds, may be used as a placeholder for partially applied arguments.
22735
+ *
22736
+ * **Note:** This method does not set the "length" property of partially
22737
+ * applied functions.
22738
+ *
22739
+ * @static
22740
+ * @memberOf _
22741
+ * @category Function
22742
+ * @param {Function} func The function to partially apply arguments to.
22743
+ * @param {...*} [partials] The arguments to be partially applied.
22744
+ * @returns {Function} Returns the new partially applied function.
22745
+ * @example
22746
+ *
22747
+ * var greet = function(greeting, name) {
22748
+ * return greeting + ' ' + name;
22749
+ * };
22750
+ *
22751
+ * var greetFred = _.partialRight(greet, 'fred');
22752
+ * greetFred('hi');
22753
+ * // => 'hi fred'
22754
+ *
22755
+ * // using placeholders
22756
+ * var sayHelloTo = _.partialRight(greet, 'hello', _);
22757
+ * sayHelloTo('fred');
22758
+ * // => 'hello fred'
22759
+ */
22760
+ var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
22761
+
22762
+ /**
22763
+ * Creates a function that invokes `func` with arguments arranged according
22764
+ * to the specified indexes where the argument value at the first index is
22765
+ * provided as the first argument, the argument value at the second index is
22766
+ * provided as the second argument, and so on.
22767
+ *
22768
+ * @static
22769
+ * @memberOf _
22770
+ * @category Function
22771
+ * @param {Function} func The function to rearrange arguments for.
22772
+ * @param {...(number|number[])} indexes The arranged argument indexes,
22773
+ * specified as individual indexes or arrays of indexes.
22774
+ * @returns {Function} Returns the new function.
22775
+ * @example
22776
+ *
22777
+ * var rearged = _.rearg(function(a, b, c) {
22778
+ * return [a, b, c];
22779
+ * }, 2, 0, 1);
22780
+ *
22781
+ * rearged('b', 'c', 'a')
22782
+ * // => ['a', 'b', 'c']
22783
+ *
22784
+ * var map = _.rearg(_.map, [1, 0]);
22785
+ * map(function(n) {
22786
+ * return n * 3;
22787
+ * }, [1, 2, 3]);
22788
+ * // => [3, 6, 9]
22789
+ */
22790
+ var rearg = restParam(function(func, indexes) {
22791
+ return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
22792
+ });
22793
+
22794
+ /**
22795
+ * Creates a function that invokes `func` with the `this` binding of the
22796
+ * created function and arguments from `start` and beyond provided as an array.
22797
+ *
22798
+ * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
22799
+ *
22800
+ * @static
22801
+ * @memberOf _
22802
+ * @category Function
22803
+ * @param {Function} func The function to apply a rest parameter to.
22804
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
22805
+ * @returns {Function} Returns the new function.
22806
+ * @example
22807
+ *
22808
+ * var say = _.restParam(function(what, names) {
22809
+ * return what + ' ' + _.initial(names).join(', ') +
22810
+ * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
22811
+ * });
22812
+ *
22813
+ * say('hello', 'fred', 'barney', 'pebbles');
22814
+ * // => 'hello fred, barney, & pebbles'
22815
+ */
22816
+ function restParam(func, start) {
22817
+ if (typeof func != 'function') {
22818
+ throw new TypeError(FUNC_ERROR_TEXT);
22819
+ }
22820
+ start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
22821
+ return function() {
22822
+ var args = arguments,
22823
+ index = -1,
22824
+ length = nativeMax(args.length - start, 0),
22825
+ rest = Array(length);
22826
+
22827
+ while (++index < length) {
22828
+ rest[index] = args[start + index];
22829
+ }
22830
+ switch (start) {
22831
+ case 0: return func.call(this, rest);
22832
+ case 1: return func.call(this, args[0], rest);
22833
+ case 2: return func.call(this, args[0], args[1], rest);
22834
+ }
22835
+ var otherArgs = Array(start + 1);
22836
+ index = -1;
22837
+ while (++index < start) {
22838
+ otherArgs[index] = args[index];
22839
+ }
22840
+ otherArgs[start] = rest;
22841
+ return func.apply(this, otherArgs);
22842
+ };
22843
+ }
22844
+
22845
+ /**
22846
+ * Creates a function that invokes `func` with the `this` binding of the created
22847
+ * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
22848
+ *
22849
+ * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
22850
+ *
22851
+ * @static
22852
+ * @memberOf _
22853
+ * @category Function
22854
+ * @param {Function} func The function to spread arguments over.
22855
+ * @returns {Function} Returns the new function.
22856
+ * @example
22857
+ *
22858
+ * var say = _.spread(function(who, what) {
22859
+ * return who + ' says ' + what;
22860
+ * });
22861
+ *
22862
+ * say(['fred', 'hello']);
22863
+ * // => 'fred says hello'
22864
+ *
22865
+ * // with a Promise
22866
+ * var numbers = Promise.all([
22867
+ * Promise.resolve(40),
22868
+ * Promise.resolve(36)
22869
+ * ]);
22870
+ *
22871
+ * numbers.then(_.spread(function(x, y) {
22872
+ * return x + y;
22873
+ * }));
22874
+ * // => a Promise of 76
22875
+ */
22876
+ function spread(func) {
22877
+ if (typeof func != 'function') {
22878
+ throw new TypeError(FUNC_ERROR_TEXT);
22879
+ }
22880
+ return function(array) {
22881
+ return func.apply(this, array);
22882
+ };
22883
+ }
22884
+
22885
+ /**
22886
+ * Creates a throttled function that only invokes `func` at most once per
22887
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
22888
+ * method to cancel delayed invocations. Provide an options object to indicate
22889
+ * that `func` should be invoked on the leading and/or trailing edge of the
22890
+ * `wait` timeout. Subsequent calls to the throttled function return the
22891
+ * result of the last `func` call.
22892
+ *
22893
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
22894
+ * on the trailing edge of the timeout only if the the throttled function is
22895
+ * invoked more than once during the `wait` timeout.
22896
+ *
22897
+ * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
22898
+ * for details over the differences between `_.throttle` and `_.debounce`.
22899
+ *
22900
+ * @static
22901
+ * @memberOf _
22902
+ * @category Function
22903
+ * @param {Function} func The function to throttle.
22904
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
22905
+ * @param {Object} [options] The options object.
22906
+ * @param {boolean} [options.leading=true] Specify invoking on the leading
22907
+ * edge of the timeout.
22908
+ * @param {boolean} [options.trailing=true] Specify invoking on the trailing
22909
+ * edge of the timeout.
22910
+ * @returns {Function} Returns the new throttled function.
22911
+ * @example
22912
+ *
22913
+ * // avoid excessively updating the position while scrolling
22914
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
22915
+ *
22916
+ * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
22917
+ * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
22918
+ * 'trailing': false
22919
+ * }));
22920
+ *
22921
+ * // cancel a trailing throttled call
22922
+ * jQuery(window).on('popstate', throttled.cancel);
22923
+ */
22924
+ function throttle(func, wait, options) {
22925
+ var leading = true,
22926
+ trailing = true;
22927
+
22928
+ if (typeof func != 'function') {
22929
+ throw new TypeError(FUNC_ERROR_TEXT);
22930
+ }
22931
+ if (options === false) {
22932
+ leading = false;
22933
+ } else if (isObject(options)) {
22934
+ leading = 'leading' in options ? !!options.leading : leading;
22935
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
22936
+ }
22937
+ return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });
22938
+ }
22939
+
22940
+ /**
22941
+ * Creates a function that provides `value` to the wrapper function as its
22942
+ * first argument. Any additional arguments provided to the function are
22943
+ * appended to those provided to the wrapper function. The wrapper is invoked
22944
+ * with the `this` binding of the created function.
22945
+ *
22946
+ * @static
22947
+ * @memberOf _
22948
+ * @category Function
22949
+ * @param {*} value The value to wrap.
22950
+ * @param {Function} wrapper The wrapper function.
22951
+ * @returns {Function} Returns the new function.
22952
+ * @example
22953
+ *
22954
+ * var p = _.wrap(_.escape, function(func, text) {
22955
+ * return '<p>' + func(text) + '</p>';
22956
+ * });
22957
+ *
22958
+ * p('fred, barney, & pebbles');
22959
+ * // => '<p>fred, barney, &amp; pebbles</p>'
22960
+ */
22961
+ function wrap(value, wrapper) {
22962
+ wrapper = wrapper == null ? identity : wrapper;
22963
+ return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
22964
+ }
22965
+
22966
+ /*------------------------------------------------------------------------*/
22967
+
22968
+ /**
22969
+ * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
22970
+ * otherwise they are assigned by reference. If `customizer` is provided it is
22971
+ * invoked to produce the cloned values. If `customizer` returns `undefined`
22972
+ * cloning is handled by the method instead. The `customizer` is bound to
22973
+ * `thisArg` and invoked with two argument; (value [, index|key, object]).
22974
+ *
22975
+ * **Note:** This method is loosely based on the
22976
+ * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
22977
+ * The enumerable properties of `arguments` objects and objects created by
22978
+ * constructors other than `Object` are cloned to plain `Object` objects. An
22979
+ * empty object is returned for uncloneable values such as functions, DOM nodes,
22980
+ * Maps, Sets, and WeakMaps.
22981
+ *
22982
+ * @static
22983
+ * @memberOf _
22984
+ * @category Lang
22985
+ * @param {*} value The value to clone.
22986
+ * @param {boolean} [isDeep] Specify a deep clone.
22987
+ * @param {Function} [customizer] The function to customize cloning values.
22988
+ * @param {*} [thisArg] The `this` binding of `customizer`.
22989
+ * @returns {*} Returns the cloned value.
22990
+ * @example
22991
+ *
22992
+ * var users = [
22993
+ * { 'user': 'barney' },
22994
+ * { 'user': 'fred' }
22995
+ * ];
22996
+ *
22997
+ * var shallow = _.clone(users);
22998
+ * shallow[0] === users[0];
22999
+ * // => true
23000
+ *
23001
+ * var deep = _.clone(users, true);
23002
+ * deep[0] === users[0];
23003
+ * // => false
23004
+ *
23005
+ * // using a customizer callback
23006
+ * var el = _.clone(document.body, function(value) {
23007
+ * if (_.isElement(value)) {
23008
+ * return value.cloneNode(false);
23009
+ * }
23010
+ * });
23011
+ *
23012
+ * el === document.body
23013
+ * // => false
23014
+ * el.nodeName
23015
+ * // => BODY
23016
+ * el.childNodes.length;
23017
+ * // => 0
23018
+ */
23019
+ function clone(value, isDeep, customizer, thisArg) {
23020
+ if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
23021
+ isDeep = false;
23022
+ }
23023
+ else if (typeof isDeep == 'function') {
23024
+ thisArg = customizer;
23025
+ customizer = isDeep;
23026
+ isDeep = false;
23027
+ }
23028
+ return typeof customizer == 'function'
23029
+ ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
23030
+ : baseClone(value, isDeep);
23031
+ }
23032
+
23033
+ /**
23034
+ * Creates a deep clone of `value`. If `customizer` is provided it is invoked
23035
+ * to produce the cloned values. If `customizer` returns `undefined` cloning
23036
+ * is handled by the method instead. The `customizer` is bound to `thisArg`
23037
+ * and invoked with two argument; (value [, index|key, object]).
23038
+ *
23039
+ * **Note:** This method is loosely based on the
23040
+ * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
23041
+ * The enumerable properties of `arguments` objects and objects created by
23042
+ * constructors other than `Object` are cloned to plain `Object` objects. An
23043
+ * empty object is returned for uncloneable values such as functions, DOM nodes,
23044
+ * Maps, Sets, and WeakMaps.
23045
+ *
23046
+ * @static
23047
+ * @memberOf _
23048
+ * @category Lang
23049
+ * @param {*} value The value to deep clone.
23050
+ * @param {Function} [customizer] The function to customize cloning values.
23051
+ * @param {*} [thisArg] The `this` binding of `customizer`.
23052
+ * @returns {*} Returns the deep cloned value.
23053
+ * @example
23054
+ *
23055
+ * var users = [
23056
+ * { 'user': 'barney' },
23057
+ * { 'user': 'fred' }
23058
+ * ];
23059
+ *
23060
+ * var deep = _.cloneDeep(users);
23061
+ * deep[0] === users[0];
23062
+ * // => false
23063
+ *
23064
+ * // using a customizer callback
23065
+ * var el = _.cloneDeep(document.body, function(value) {
23066
+ * if (_.isElement(value)) {
23067
+ * return value.cloneNode(true);
23068
+ * }
23069
+ * });
23070
+ *
23071
+ * el === document.body
23072
+ * // => false
23073
+ * el.nodeName
23074
+ * // => BODY
23075
+ * el.childNodes.length;
23076
+ * // => 20
23077
+ */
23078
+ function cloneDeep(value, customizer, thisArg) {
23079
+ return typeof customizer == 'function'
23080
+ ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
23081
+ : baseClone(value, true);
23082
+ }
23083
+
23084
+ /**
23085
+ * Checks if `value` is greater than `other`.
23086
+ *
23087
+ * @static
23088
+ * @memberOf _
23089
+ * @category Lang
23090
+ * @param {*} value The value to compare.
23091
+ * @param {*} other The other value to compare.
23092
+ * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
23093
+ * @example
23094
+ *
23095
+ * _.gt(3, 1);
23096
+ * // => true
23097
+ *
23098
+ * _.gt(3, 3);
23099
+ * // => false
23100
+ *
23101
+ * _.gt(1, 3);
23102
+ * // => false
23103
+ */
23104
+ function gt(value, other) {
23105
+ return value > other;
23106
+ }
23107
+
23108
+ /**
23109
+ * Checks if `value` is greater than or equal to `other`.
23110
+ *
23111
+ * @static
23112
+ * @memberOf _
23113
+ * @category Lang
23114
+ * @param {*} value The value to compare.
23115
+ * @param {*} other The other value to compare.
23116
+ * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
23117
+ * @example
23118
+ *
23119
+ * _.gte(3, 1);
23120
+ * // => true
23121
+ *
23122
+ * _.gte(3, 3);
23123
+ * // => true
23124
+ *
23125
+ * _.gte(1, 3);
23126
+ * // => false
23127
+ */
23128
+ function gte(value, other) {
23129
+ return value >= other;
23130
+ }
23131
+
23132
+ /**
23133
+ * Checks if `value` is classified as an `arguments` object.
23134
+ *
23135
+ * @static
23136
+ * @memberOf _
23137
+ * @category Lang
23138
+ * @param {*} value The value to check.
23139
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23140
+ * @example
23141
+ *
23142
+ * _.isArguments(function() { return arguments; }());
23143
+ * // => true
23144
+ *
23145
+ * _.isArguments([1, 2, 3]);
23146
+ * // => false
23147
+ */
23148
+ function isArguments(value) {
23149
+ return isObjectLike(value) && isArrayLike(value) &&
23150
+ hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
23151
+ }
23152
+
23153
+ /**
23154
+ * Checks if `value` is classified as an `Array` object.
23155
+ *
23156
+ * @static
23157
+ * @memberOf _
23158
+ * @category Lang
23159
+ * @param {*} value The value to check.
23160
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23161
+ * @example
23162
+ *
23163
+ * _.isArray([1, 2, 3]);
23164
+ * // => true
23165
+ *
23166
+ * _.isArray(function() { return arguments; }());
23167
+ * // => false
23168
+ */
23169
+ var isArray = nativeIsArray || function(value) {
23170
+ return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
23171
+ };
23172
+
23173
+ /**
23174
+ * Checks if `value` is classified as a boolean primitive or object.
23175
+ *
23176
+ * @static
23177
+ * @memberOf _
23178
+ * @category Lang
23179
+ * @param {*} value The value to check.
23180
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23181
+ * @example
23182
+ *
23183
+ * _.isBoolean(false);
23184
+ * // => true
23185
+ *
23186
+ * _.isBoolean(null);
23187
+ * // => false
23188
+ */
23189
+ function isBoolean(value) {
23190
+ return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
23191
+ }
23192
+
23193
+ /**
23194
+ * Checks if `value` is classified as a `Date` object.
23195
+ *
23196
+ * @static
23197
+ * @memberOf _
23198
+ * @category Lang
23199
+ * @param {*} value The value to check.
23200
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23201
+ * @example
23202
+ *
23203
+ * _.isDate(new Date);
23204
+ * // => true
23205
+ *
23206
+ * _.isDate('Mon April 23 2012');
23207
+ * // => false
23208
+ */
23209
+ function isDate(value) {
23210
+ return isObjectLike(value) && objToString.call(value) == dateTag;
23211
+ }
23212
+
23213
+ /**
23214
+ * Checks if `value` is a DOM element.
23215
+ *
23216
+ * @static
23217
+ * @memberOf _
23218
+ * @category Lang
23219
+ * @param {*} value The value to check.
23220
+ * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
23221
+ * @example
23222
+ *
23223
+ * _.isElement(document.body);
23224
+ * // => true
23225
+ *
23226
+ * _.isElement('<body>');
23227
+ * // => false
23228
+ */
23229
+ function isElement(value) {
23230
+ return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
23231
+ }
23232
+
23233
+ /**
23234
+ * Checks if `value` is empty. A value is considered empty unless it is an
23235
+ * `arguments` object, array, string, or jQuery-like collection with a length
23236
+ * greater than `0` or an object with own enumerable properties.
23237
+ *
23238
+ * @static
23239
+ * @memberOf _
23240
+ * @category Lang
23241
+ * @param {Array|Object|string} value The value to inspect.
23242
+ * @returns {boolean} Returns `true` if `value` is empty, else `false`.
23243
+ * @example
23244
+ *
23245
+ * _.isEmpty(null);
23246
+ * // => true
23247
+ *
23248
+ * _.isEmpty(true);
23249
+ * // => true
23250
+ *
23251
+ * _.isEmpty(1);
23252
+ * // => true
23253
+ *
23254
+ * _.isEmpty([1, 2, 3]);
23255
+ * // => false
23256
+ *
23257
+ * _.isEmpty({ 'a': 1 });
23258
+ * // => false
23259
+ */
23260
+ function isEmpty(value) {
23261
+ if (value == null) {
23262
+ return true;
23263
+ }
23264
+ if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
23265
+ (isObjectLike(value) && isFunction(value.splice)))) {
23266
+ return !value.length;
23267
+ }
23268
+ return !keys(value).length;
23269
+ }
23270
+
23271
+ /**
23272
+ * Performs a deep comparison between two values to determine if they are
23273
+ * equivalent. If `customizer` is provided it is invoked to compare values.
23274
+ * If `customizer` returns `undefined` comparisons are handled by the method
23275
+ * instead. The `customizer` is bound to `thisArg` and invoked with three
23276
+ * arguments: (value, other [, index|key]).
23277
+ *
23278
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
23279
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
23280
+ * their own, not inherited, enumerable properties. Functions and DOM nodes
23281
+ * are **not** supported. Provide a customizer function to extend support
23282
+ * for comparing other values.
23283
+ *
23284
+ * @static
23285
+ * @memberOf _
23286
+ * @alias eq
23287
+ * @category Lang
23288
+ * @param {*} value The value to compare.
23289
+ * @param {*} other The other value to compare.
23290
+ * @param {Function} [customizer] The function to customize value comparisons.
23291
+ * @param {*} [thisArg] The `this` binding of `customizer`.
23292
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
23293
+ * @example
23294
+ *
23295
+ * var object = { 'user': 'fred' };
23296
+ * var other = { 'user': 'fred' };
23297
+ *
23298
+ * object == other;
23299
+ * // => false
23300
+ *
23301
+ * _.isEqual(object, other);
23302
+ * // => true
23303
+ *
23304
+ * // using a customizer callback
23305
+ * var array = ['hello', 'goodbye'];
23306
+ * var other = ['hi', 'goodbye'];
23307
+ *
23308
+ * _.isEqual(array, other, function(value, other) {
23309
+ * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
23310
+ * return true;
23311
+ * }
23312
+ * });
23313
+ * // => true
23314
+ */
23315
+ function isEqual(value, other, customizer, thisArg) {
23316
+ customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
23317
+ var result = customizer ? customizer(value, other) : undefined;
23318
+ return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
23319
+ }
23320
+
23321
+ /**
23322
+ * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
23323
+ * `SyntaxError`, `TypeError`, or `URIError` object.
23324
+ *
23325
+ * @static
23326
+ * @memberOf _
23327
+ * @category Lang
23328
+ * @param {*} value The value to check.
23329
+ * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
23330
+ * @example
23331
+ *
23332
+ * _.isError(new Error);
23333
+ * // => true
23334
+ *
23335
+ * _.isError(Error);
23336
+ * // => false
23337
+ */
23338
+ function isError(value) {
23339
+ return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
23340
+ }
23341
+
23342
+ /**
23343
+ * Checks if `value` is a finite primitive number.
23344
+ *
23345
+ * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
23346
+ *
23347
+ * @static
23348
+ * @memberOf _
23349
+ * @category Lang
23350
+ * @param {*} value The value to check.
23351
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
23352
+ * @example
23353
+ *
23354
+ * _.isFinite(10);
23355
+ * // => true
23356
+ *
23357
+ * _.isFinite('10');
23358
+ * // => false
23359
+ *
23360
+ * _.isFinite(true);
23361
+ * // => false
23362
+ *
23363
+ * _.isFinite(Object(10));
23364
+ * // => false
23365
+ *
23366
+ * _.isFinite(Infinity);
23367
+ * // => false
23368
+ */
23369
+ function isFinite(value) {
23370
+ return typeof value == 'number' && nativeIsFinite(value);
23371
+ }
23372
+
23373
+ /**
23374
+ * Checks if `value` is classified as a `Function` object.
23375
+ *
23376
+ * @static
23377
+ * @memberOf _
23378
+ * @category Lang
23379
+ * @param {*} value The value to check.
23380
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23381
+ * @example
23382
+ *
23383
+ * _.isFunction(_);
23384
+ * // => true
23385
+ *
23386
+ * _.isFunction(/abc/);
23387
+ * // => false
23388
+ */
23389
+ function isFunction(value) {
23390
+ // The use of `Object#toString` avoids issues with the `typeof` operator
23391
+ // in older versions of Chrome and Safari which return 'function' for regexes
23392
+ // and Safari 8 equivalents which return 'object' for typed array constructors.
23393
+ return isObject(value) && objToString.call(value) == funcTag;
23394
+ }
23395
+
23396
+ /**
23397
+ * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
23398
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
23399
+ *
23400
+ * @static
23401
+ * @memberOf _
23402
+ * @category Lang
23403
+ * @param {*} value The value to check.
23404
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
23405
+ * @example
23406
+ *
23407
+ * _.isObject({});
23408
+ * // => true
23409
+ *
23410
+ * _.isObject([1, 2, 3]);
23411
+ * // => true
23412
+ *
23413
+ * _.isObject(1);
23414
+ * // => false
23415
+ */
23416
+ function isObject(value) {
23417
+ // Avoid a V8 JIT bug in Chrome 19-20.
23418
+ // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
23419
+ var type = typeof value;
23420
+ return !!value && (type == 'object' || type == 'function');
23421
+ }
23422
+
23423
+ /**
23424
+ * Performs a deep comparison between `object` and `source` to determine if
23425
+ * `object` contains equivalent property values. If `customizer` is provided
23426
+ * it is invoked to compare values. If `customizer` returns `undefined`
23427
+ * comparisons are handled by the method instead. The `customizer` is bound
23428
+ * to `thisArg` and invoked with three arguments: (value, other, index|key).
23429
+ *
23430
+ * **Note:** This method supports comparing properties of arrays, booleans,
23431
+ * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
23432
+ * and DOM nodes are **not** supported. Provide a customizer function to extend
23433
+ * support for comparing other values.
23434
+ *
23435
+ * @static
23436
+ * @memberOf _
23437
+ * @category Lang
23438
+ * @param {Object} object The object to inspect.
23439
+ * @param {Object} source The object of property values to match.
23440
+ * @param {Function} [customizer] The function to customize value comparisons.
23441
+ * @param {*} [thisArg] The `this` binding of `customizer`.
23442
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
23443
+ * @example
23444
+ *
23445
+ * var object = { 'user': 'fred', 'age': 40 };
23446
+ *
23447
+ * _.isMatch(object, { 'age': 40 });
23448
+ * // => true
23449
+ *
23450
+ * _.isMatch(object, { 'age': 36 });
23451
+ * // => false
23452
+ *
23453
+ * // using a customizer callback
23454
+ * var object = { 'greeting': 'hello' };
23455
+ * var source = { 'greeting': 'hi' };
23456
+ *
23457
+ * _.isMatch(object, source, function(value, other) {
23458
+ * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
23459
+ * });
23460
+ * // => true
23461
+ */
23462
+ function isMatch(object, source, customizer, thisArg) {
23463
+ customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
23464
+ return baseIsMatch(object, getMatchData(source), customizer);
23465
+ }
23466
+
23467
+ /**
23468
+ * Checks if `value` is `NaN`.
23469
+ *
23470
+ * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
23471
+ * which returns `true` for `undefined` and other non-numeric values.
23472
+ *
23473
+ * @static
23474
+ * @memberOf _
23475
+ * @category Lang
23476
+ * @param {*} value The value to check.
23477
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
23478
+ * @example
23479
+ *
23480
+ * _.isNaN(NaN);
23481
+ * // => true
23482
+ *
23483
+ * _.isNaN(new Number(NaN));
23484
+ * // => true
23485
+ *
23486
+ * isNaN(undefined);
23487
+ * // => true
23488
+ *
23489
+ * _.isNaN(undefined);
23490
+ * // => false
23491
+ */
23492
+ function isNaN(value) {
23493
+ // An `NaN` primitive is the only value that is not equal to itself.
23494
+ // Perform the `toStringTag` check first to avoid errors with some host objects in IE.
23495
+ return isNumber(value) && value != +value;
23496
+ }
23497
+
23498
+ /**
23499
+ * Checks if `value` is a native function.
23500
+ *
23501
+ * @static
23502
+ * @memberOf _
23503
+ * @category Lang
23504
+ * @param {*} value The value to check.
23505
+ * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
23506
+ * @example
23507
+ *
23508
+ * _.isNative(Array.prototype.push);
23509
+ * // => true
23510
+ *
23511
+ * _.isNative(_);
23512
+ * // => false
23513
+ */
23514
+ function isNative(value) {
23515
+ if (value == null) {
23516
+ return false;
23517
+ }
23518
+ if (isFunction(value)) {
23519
+ return reIsNative.test(fnToString.call(value));
23520
+ }
23521
+ return isObjectLike(value) && reIsHostCtor.test(value);
23522
+ }
23523
+
23524
+ /**
23525
+ * Checks if `value` is `null`.
23526
+ *
23527
+ * @static
23528
+ * @memberOf _
23529
+ * @category Lang
23530
+ * @param {*} value The value to check.
23531
+ * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
23532
+ * @example
23533
+ *
23534
+ * _.isNull(null);
23535
+ * // => true
23536
+ *
23537
+ * _.isNull(void 0);
23538
+ * // => false
23539
+ */
23540
+ function isNull(value) {
23541
+ return value === null;
23542
+ }
23543
+
23544
+ /**
23545
+ * Checks if `value` is classified as a `Number` primitive or object.
23546
+ *
23547
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
23548
+ * as numbers, use the `_.isFinite` method.
23549
+ *
23550
+ * @static
23551
+ * @memberOf _
23552
+ * @category Lang
23553
+ * @param {*} value The value to check.
23554
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23555
+ * @example
23556
+ *
23557
+ * _.isNumber(8.4);
23558
+ * // => true
23559
+ *
23560
+ * _.isNumber(NaN);
23561
+ * // => true
23562
+ *
23563
+ * _.isNumber('8.4');
23564
+ * // => false
23565
+ */
23566
+ function isNumber(value) {
23567
+ return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
23568
+ }
23569
+
23570
+ /**
23571
+ * Checks if `value` is a plain object, that is, an object created by the
23572
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
23573
+ *
23574
+ * **Note:** This method assumes objects created by the `Object` constructor
23575
+ * have no inherited enumerable properties.
23576
+ *
23577
+ * @static
23578
+ * @memberOf _
23579
+ * @category Lang
23580
+ * @param {*} value The value to check.
23581
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
23582
+ * @example
23583
+ *
23584
+ * function Foo() {
23585
+ * this.a = 1;
23586
+ * }
23587
+ *
23588
+ * _.isPlainObject(new Foo);
23589
+ * // => false
23590
+ *
23591
+ * _.isPlainObject([1, 2, 3]);
23592
+ * // => false
23593
+ *
23594
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
23595
+ * // => true
23596
+ *
23597
+ * _.isPlainObject(Object.create(null));
23598
+ * // => true
23599
+ */
23600
+ function isPlainObject(value) {
23601
+ var Ctor;
23602
+
23603
+ // Exit early for non `Object` objects.
23604
+ if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
23605
+ (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
23606
+ return false;
23607
+ }
23608
+ // IE < 9 iterates inherited properties before own properties. If the first
23609
+ // iterated property is an object's own property then there are no inherited
23610
+ // enumerable properties.
23611
+ var result;
23612
+ // In most environments an object's own properties are iterated before
23613
+ // its inherited properties. If the last iterated property is an object's
23614
+ // own property then there are no inherited enumerable properties.
23615
+ baseForIn(value, function(subValue, key) {
23616
+ result = key;
23617
+ });
23618
+ return result === undefined || hasOwnProperty.call(value, result);
23619
+ }
23620
+
23621
+ /**
23622
+ * Checks if `value` is classified as a `RegExp` object.
23623
+ *
23624
+ * @static
23625
+ * @memberOf _
23626
+ * @category Lang
23627
+ * @param {*} value The value to check.
23628
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23629
+ * @example
23630
+ *
23631
+ * _.isRegExp(/abc/);
23632
+ * // => true
23633
+ *
23634
+ * _.isRegExp('/abc/');
23635
+ * // => false
23636
+ */
23637
+ function isRegExp(value) {
23638
+ return isObject(value) && objToString.call(value) == regexpTag;
23639
+ }
23640
+
23641
+ /**
23642
+ * Checks if `value` is classified as a `String` primitive or object.
23643
+ *
23644
+ * @static
23645
+ * @memberOf _
23646
+ * @category Lang
23647
+ * @param {*} value The value to check.
23648
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23649
+ * @example
23650
+ *
23651
+ * _.isString('abc');
23652
+ * // => true
23653
+ *
23654
+ * _.isString(1);
23655
+ * // => false
23656
+ */
23657
+ function isString(value) {
23658
+ return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
23659
+ }
23660
+
23661
+ /**
23662
+ * Checks if `value` is classified as a typed array.
23663
+ *
23664
+ * @static
23665
+ * @memberOf _
23666
+ * @category Lang
23667
+ * @param {*} value The value to check.
23668
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23669
+ * @example
23670
+ *
23671
+ * _.isTypedArray(new Uint8Array);
23672
+ * // => true
23673
+ *
23674
+ * _.isTypedArray([]);
23675
+ * // => false
23676
+ */
23677
+ function isTypedArray(value) {
23678
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
23679
+ }
23680
+
23681
+ /**
23682
+ * Checks if `value` is `undefined`.
23683
+ *
23684
+ * @static
23685
+ * @memberOf _
23686
+ * @category Lang
23687
+ * @param {*} value The value to check.
23688
+ * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
23689
+ * @example
23690
+ *
23691
+ * _.isUndefined(void 0);
23692
+ * // => true
23693
+ *
23694
+ * _.isUndefined(null);
23695
+ * // => false
23696
+ */
23697
+ function isUndefined(value) {
23698
+ return value === undefined;
23699
+ }
23700
+
23701
+ /**
23702
+ * Checks if `value` is less than `other`.
23703
+ *
23704
+ * @static
23705
+ * @memberOf _
23706
+ * @category Lang
23707
+ * @param {*} value The value to compare.
23708
+ * @param {*} other The other value to compare.
23709
+ * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
23710
+ * @example
23711
+ *
23712
+ * _.lt(1, 3);
23713
+ * // => true
23714
+ *
23715
+ * _.lt(3, 3);
23716
+ * // => false
23717
+ *
23718
+ * _.lt(3, 1);
23719
+ * // => false
23720
+ */
23721
+ function lt(value, other) {
23722
+ return value < other;
23723
+ }
23724
+
23725
+ /**
23726
+ * Checks if `value` is less than or equal to `other`.
23727
+ *
23728
+ * @static
23729
+ * @memberOf _
23730
+ * @category Lang
23731
+ * @param {*} value The value to compare.
23732
+ * @param {*} other The other value to compare.
23733
+ * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
23734
+ * @example
23735
+ *
23736
+ * _.lte(1, 3);
23737
+ * // => true
23738
+ *
23739
+ * _.lte(3, 3);
23740
+ * // => true
23741
+ *
23742
+ * _.lte(3, 1);
23743
+ * // => false
23744
+ */
23745
+ function lte(value, other) {
23746
+ return value <= other;
23747
+ }
23748
+
23749
+ /**
23750
+ * Converts `value` to an array.
23751
+ *
23752
+ * @static
23753
+ * @memberOf _
23754
+ * @category Lang
23755
+ * @param {*} value The value to convert.
23756
+ * @returns {Array} Returns the converted array.
23757
+ * @example
23758
+ *
23759
+ * (function() {
23760
+ * return _.toArray(arguments).slice(1);
23761
+ * }(1, 2, 3));
23762
+ * // => [2, 3]
23763
+ */
23764
+ function toArray(value) {
23765
+ var length = value ? getLength(value) : 0;
23766
+ if (!isLength(length)) {
23767
+ return values(value);
23768
+ }
23769
+ if (!length) {
23770
+ return [];
23771
+ }
23772
+ return arrayCopy(value);
23773
+ }
23774
+
23775
+ /**
23776
+ * Converts `value` to a plain object flattening inherited enumerable
23777
+ * properties of `value` to own properties of the plain object.
23778
+ *
23779
+ * @static
23780
+ * @memberOf _
23781
+ * @category Lang
23782
+ * @param {*} value The value to convert.
23783
+ * @returns {Object} Returns the converted plain object.
23784
+ * @example
23785
+ *
23786
+ * function Foo() {
23787
+ * this.b = 2;
23788
+ * }
23789
+ *
23790
+ * Foo.prototype.c = 3;
23791
+ *
23792
+ * _.assign({ 'a': 1 }, new Foo);
23793
+ * // => { 'a': 1, 'b': 2 }
23794
+ *
23795
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
23796
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
23797
+ */
23798
+ function toPlainObject(value) {
23799
+ return baseCopy(value, keysIn(value));
23800
+ }
23801
+
23802
+ /*------------------------------------------------------------------------*/
23803
+
23804
+ /**
23805
+ * Recursively merges own enumerable properties of the source object(s), that
23806
+ * don't resolve to `undefined` into the destination object. Subsequent sources
23807
+ * overwrite property assignments of previous sources. If `customizer` is
23808
+ * provided it is invoked to produce the merged values of the destination and
23809
+ * source properties. If `customizer` returns `undefined` merging is handled
23810
+ * by the method instead. The `customizer` is bound to `thisArg` and invoked
23811
+ * with five arguments: (objectValue, sourceValue, key, object, source).
23812
+ *
23813
+ * @static
23814
+ * @memberOf _
23815
+ * @category Object
23816
+ * @param {Object} object The destination object.
23817
+ * @param {...Object} [sources] The source objects.
23818
+ * @param {Function} [customizer] The function to customize assigned values.
23819
+ * @param {*} [thisArg] The `this` binding of `customizer`.
23820
+ * @returns {Object} Returns `object`.
23821
+ * @example
23822
+ *
23823
+ * var users = {
23824
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
23825
+ * };
23826
+ *
23827
+ * var ages = {
23828
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
23829
+ * };
23830
+ *
23831
+ * _.merge(users, ages);
23832
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
23833
+ *
23834
+ * // using a customizer callback
23835
+ * var object = {
23836
+ * 'fruits': ['apple'],
23837
+ * 'vegetables': ['beet']
23838
+ * };
23839
+ *
23840
+ * var other = {
23841
+ * 'fruits': ['banana'],
23842
+ * 'vegetables': ['carrot']
23843
+ * };
23844
+ *
23845
+ * _.merge(object, other, function(a, b) {
23846
+ * if (_.isArray(a)) {
23847
+ * return a.concat(b);
23848
+ * }
23849
+ * });
23850
+ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
23851
+ */
23852
+ var merge = createAssigner(baseMerge);
23853
+
23854
+ /**
23855
+ * Assigns own enumerable properties of source object(s) to the destination
23856
+ * object. Subsequent sources overwrite property assignments of previous sources.
23857
+ * If `customizer` is provided it is invoked to produce the assigned values.
23858
+ * The `customizer` is bound to `thisArg` and invoked with five arguments:
23859
+ * (objectValue, sourceValue, key, object, source).
23860
+ *
23861
+ * **Note:** This method mutates `object` and is based on
23862
+ * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
23863
+ *
23864
+ * @static
23865
+ * @memberOf _
23866
+ * @alias extend
23867
+ * @category Object
23868
+ * @param {Object} object The destination object.
23869
+ * @param {...Object} [sources] The source objects.
23870
+ * @param {Function} [customizer] The function to customize assigned values.
23871
+ * @param {*} [thisArg] The `this` binding of `customizer`.
23872
+ * @returns {Object} Returns `object`.
23873
+ * @example
23874
+ *
23875
+ * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
23876
+ * // => { 'user': 'fred', 'age': 40 }
23877
+ *
23878
+ * // using a customizer callback
23879
+ * var defaults = _.partialRight(_.assign, function(value, other) {
23880
+ * return _.isUndefined(value) ? other : value;
23881
+ * });
23882
+ *
23883
+ * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
23884
+ * // => { 'user': 'barney', 'age': 36 }
23885
+ */
23886
+ var assign = createAssigner(function(object, source, customizer) {
23887
+ return customizer
23888
+ ? assignWith(object, source, customizer)
23889
+ : baseAssign(object, source);
23890
+ });
23891
+
23892
+ /**
23893
+ * Creates an object that inherits from the given `prototype` object. If a
23894
+ * `properties` object is provided its own enumerable properties are assigned
23895
+ * to the created object.
23896
+ *
23897
+ * @static
23898
+ * @memberOf _
23899
+ * @category Object
23900
+ * @param {Object} prototype The object to inherit from.
23901
+ * @param {Object} [properties] The properties to assign to the object.
23902
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
23903
+ * @returns {Object} Returns the new object.
23904
+ * @example
23905
+ *
23906
+ * function Shape() {
23907
+ * this.x = 0;
23908
+ * this.y = 0;
23909
+ * }
23910
+ *
23911
+ * function Circle() {
23912
+ * Shape.call(this);
23913
+ * }
23914
+ *
23915
+ * Circle.prototype = _.create(Shape.prototype, {
23916
+ * 'constructor': Circle
23917
+ * });
23918
+ *
23919
+ * var circle = new Circle;
23920
+ * circle instanceof Circle;
23921
+ * // => true
23922
+ *
23923
+ * circle instanceof Shape;
23924
+ * // => true
23925
+ */
23926
+ function create(prototype, properties, guard) {
23927
+ var result = baseCreate(prototype);
23928
+ if (guard && isIterateeCall(prototype, properties, guard)) {
23929
+ properties = undefined;
23930
+ }
23931
+ return properties ? baseAssign(result, properties) : result;
23932
+ }
23933
+
23934
+ /**
23935
+ * Assigns own enumerable properties of source object(s) to the destination
23936
+ * object for all destination properties that resolve to `undefined`. Once a
23937
+ * property is set, additional values of the same property are ignored.
23938
+ *
23939
+ * **Note:** This method mutates `object`.
23940
+ *
23941
+ * @static
23942
+ * @memberOf _
23943
+ * @category Object
23944
+ * @param {Object} object The destination object.
23945
+ * @param {...Object} [sources] The source objects.
23946
+ * @returns {Object} Returns `object`.
23947
+ * @example
23948
+ *
23949
+ * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
23950
+ * // => { 'user': 'barney', 'age': 36 }
23951
+ */
23952
+ var defaults = createDefaults(assign, assignDefaults);
23953
+
23954
+ /**
23955
+ * This method is like `_.defaults` except that it recursively assigns
23956
+ * default properties.
23957
+ *
23958
+ * **Note:** This method mutates `object`.
23959
+ *
23960
+ * @static
23961
+ * @memberOf _
23962
+ * @category Object
23963
+ * @param {Object} object The destination object.
23964
+ * @param {...Object} [sources] The source objects.
23965
+ * @returns {Object} Returns `object`.
23966
+ * @example
23967
+ *
23968
+ * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
23969
+ * // => { 'user': { 'name': 'barney', 'age': 36 } }
23970
+ *
23971
+ */
23972
+ var defaultsDeep = createDefaults(merge, mergeDefaults);
23973
+
23974
+ /**
23975
+ * This method is like `_.find` except that it returns the key of the first
23976
+ * element `predicate` returns truthy for instead of the element itself.
23977
+ *
23978
+ * If a property name is provided for `predicate` the created `_.property`
23979
+ * style callback returns the property value of the given element.
23980
+ *
23981
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
23982
+ * style callback returns `true` for elements that have a matching property
23983
+ * value, else `false`.
23984
+ *
23985
+ * If an object is provided for `predicate` the created `_.matches` style
23986
+ * callback returns `true` for elements that have the properties of the given
23987
+ * object, else `false`.
23988
+ *
23989
+ * @static
23990
+ * @memberOf _
23991
+ * @category Object
23992
+ * @param {Object} object The object to search.
23993
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
23994
+ * per iteration.
23995
+ * @param {*} [thisArg] The `this` binding of `predicate`.
23996
+ * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
23997
+ * @example
23998
+ *
23999
+ * var users = {
24000
+ * 'barney': { 'age': 36, 'active': true },
24001
+ * 'fred': { 'age': 40, 'active': false },
24002
+ * 'pebbles': { 'age': 1, 'active': true }
24003
+ * };
24004
+ *
24005
+ * _.findKey(users, function(chr) {
24006
+ * return chr.age < 40;
24007
+ * });
24008
+ * // => 'barney' (iteration order is not guaranteed)
24009
+ *
24010
+ * // using the `_.matches` callback shorthand
24011
+ * _.findKey(users, { 'age': 1, 'active': true });
24012
+ * // => 'pebbles'
24013
+ *
24014
+ * // using the `_.matchesProperty` callback shorthand
24015
+ * _.findKey(users, 'active', false);
24016
+ * // => 'fred'
24017
+ *
24018
+ * // using the `_.property` callback shorthand
24019
+ * _.findKey(users, 'active');
24020
+ * // => 'barney'
24021
+ */
24022
+ var findKey = createFindKey(baseForOwn);
24023
+
24024
+ /**
24025
+ * This method is like `_.findKey` except that it iterates over elements of
24026
+ * a collection in the opposite order.
24027
+ *
24028
+ * If a property name is provided for `predicate` the created `_.property`
24029
+ * style callback returns the property value of the given element.
24030
+ *
24031
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
24032
+ * style callback returns `true` for elements that have a matching property
24033
+ * value, else `false`.
24034
+ *
24035
+ * If an object is provided for `predicate` the created `_.matches` style
24036
+ * callback returns `true` for elements that have the properties of the given
24037
+ * object, else `false`.
24038
+ *
24039
+ * @static
24040
+ * @memberOf _
24041
+ * @category Object
24042
+ * @param {Object} object The object to search.
24043
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
24044
+ * per iteration.
24045
+ * @param {*} [thisArg] The `this` binding of `predicate`.
24046
+ * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
24047
+ * @example
24048
+ *
24049
+ * var users = {
24050
+ * 'barney': { 'age': 36, 'active': true },
24051
+ * 'fred': { 'age': 40, 'active': false },
24052
+ * 'pebbles': { 'age': 1, 'active': true }
24053
+ * };
24054
+ *
24055
+ * _.findLastKey(users, function(chr) {
24056
+ * return chr.age < 40;
24057
+ * });
24058
+ * // => returns `pebbles` assuming `_.findKey` returns `barney`
24059
+ *
24060
+ * // using the `_.matches` callback shorthand
24061
+ * _.findLastKey(users, { 'age': 36, 'active': true });
24062
+ * // => 'barney'
24063
+ *
24064
+ * // using the `_.matchesProperty` callback shorthand
24065
+ * _.findLastKey(users, 'active', false);
24066
+ * // => 'fred'
24067
+ *
24068
+ * // using the `_.property` callback shorthand
24069
+ * _.findLastKey(users, 'active');
24070
+ * // => 'pebbles'
24071
+ */
24072
+ var findLastKey = createFindKey(baseForOwnRight);
24073
+
24074
+ /**
24075
+ * Iterates over own and inherited enumerable properties of an object invoking
24076
+ * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
24077
+ * with three arguments: (value, key, object). Iteratee functions may exit
24078
+ * iteration early by explicitly returning `false`.
24079
+ *
24080
+ * @static
24081
+ * @memberOf _
24082
+ * @category Object
24083
+ * @param {Object} object The object to iterate over.
24084
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
24085
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24086
+ * @returns {Object} Returns `object`.
24087
+ * @example
24088
+ *
24089
+ * function Foo() {
24090
+ * this.a = 1;
24091
+ * this.b = 2;
24092
+ * }
24093
+ *
24094
+ * Foo.prototype.c = 3;
24095
+ *
24096
+ * _.forIn(new Foo, function(value, key) {
24097
+ * console.log(key);
24098
+ * });
24099
+ * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
24100
+ */
24101
+ var forIn = createForIn(baseFor);
24102
+
24103
+ /**
24104
+ * This method is like `_.forIn` except that it iterates over properties of
24105
+ * `object` in the opposite order.
24106
+ *
24107
+ * @static
24108
+ * @memberOf _
24109
+ * @category Object
24110
+ * @param {Object} object The object to iterate over.
24111
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
24112
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24113
+ * @returns {Object} Returns `object`.
24114
+ * @example
24115
+ *
24116
+ * function Foo() {
24117
+ * this.a = 1;
24118
+ * this.b = 2;
24119
+ * }
24120
+ *
24121
+ * Foo.prototype.c = 3;
24122
+ *
24123
+ * _.forInRight(new Foo, function(value, key) {
24124
+ * console.log(key);
24125
+ * });
24126
+ * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
24127
+ */
24128
+ var forInRight = createForIn(baseForRight);
24129
+
24130
+ /**
24131
+ * Iterates over own enumerable properties of an object invoking `iteratee`
24132
+ * for each property. The `iteratee` is bound to `thisArg` and invoked with
24133
+ * three arguments: (value, key, object). Iteratee functions may exit iteration
24134
+ * early by explicitly returning `false`.
24135
+ *
24136
+ * @static
24137
+ * @memberOf _
24138
+ * @category Object
24139
+ * @param {Object} object The object to iterate over.
24140
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
24141
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24142
+ * @returns {Object} Returns `object`.
24143
+ * @example
24144
+ *
24145
+ * function Foo() {
24146
+ * this.a = 1;
24147
+ * this.b = 2;
24148
+ * }
24149
+ *
24150
+ * Foo.prototype.c = 3;
24151
+ *
24152
+ * _.forOwn(new Foo, function(value, key) {
24153
+ * console.log(key);
24154
+ * });
24155
+ * // => logs 'a' and 'b' (iteration order is not guaranteed)
24156
+ */
24157
+ var forOwn = createForOwn(baseForOwn);
24158
+
24159
+ /**
24160
+ * This method is like `_.forOwn` except that it iterates over properties of
24161
+ * `object` in the opposite order.
24162
+ *
24163
+ * @static
24164
+ * @memberOf _
24165
+ * @category Object
24166
+ * @param {Object} object The object to iterate over.
24167
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
24168
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24169
+ * @returns {Object} Returns `object`.
24170
+ * @example
24171
+ *
24172
+ * function Foo() {
24173
+ * this.a = 1;
24174
+ * this.b = 2;
24175
+ * }
24176
+ *
24177
+ * Foo.prototype.c = 3;
24178
+ *
24179
+ * _.forOwnRight(new Foo, function(value, key) {
24180
+ * console.log(key);
24181
+ * });
24182
+ * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
24183
+ */
24184
+ var forOwnRight = createForOwn(baseForOwnRight);
24185
+
24186
+ /**
24187
+ * Creates an array of function property names from all enumerable properties,
24188
+ * own and inherited, of `object`.
24189
+ *
24190
+ * @static
24191
+ * @memberOf _
24192
+ * @alias methods
24193
+ * @category Object
24194
+ * @param {Object} object The object to inspect.
24195
+ * @returns {Array} Returns the new array of property names.
24196
+ * @example
24197
+ *
24198
+ * _.functions(_);
24199
+ * // => ['after', 'ary', 'assign', ...]
24200
+ */
24201
+ function functions(object) {
24202
+ return baseFunctions(object, keysIn(object));
24203
+ }
24204
+
24205
+ /**
24206
+ * Gets the property value at `path` of `object`. If the resolved value is
24207
+ * `undefined` the `defaultValue` is used in its place.
24208
+ *
24209
+ * @static
24210
+ * @memberOf _
24211
+ * @category Object
24212
+ * @param {Object} object The object to query.
24213
+ * @param {Array|string} path The path of the property to get.
24214
+ * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
24215
+ * @returns {*} Returns the resolved value.
24216
+ * @example
24217
+ *
24218
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
24219
+ *
24220
+ * _.get(object, 'a[0].b.c');
24221
+ * // => 3
24222
+ *
24223
+ * _.get(object, ['a', '0', 'b', 'c']);
24224
+ * // => 3
24225
+ *
24226
+ * _.get(object, 'a.b.c', 'default');
24227
+ * // => 'default'
24228
+ */
24229
+ function get(object, path, defaultValue) {
24230
+ var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
24231
+ return result === undefined ? defaultValue : result;
24232
+ }
24233
+
24234
+ /**
24235
+ * Checks if `path` is a direct property.
24236
+ *
24237
+ * @static
24238
+ * @memberOf _
24239
+ * @category Object
24240
+ * @param {Object} object The object to query.
24241
+ * @param {Array|string} path The path to check.
24242
+ * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
24243
+ * @example
24244
+ *
24245
+ * var object = { 'a': { 'b': { 'c': 3 } } };
24246
+ *
24247
+ * _.has(object, 'a');
24248
+ * // => true
24249
+ *
24250
+ * _.has(object, 'a.b.c');
24251
+ * // => true
24252
+ *
24253
+ * _.has(object, ['a', 'b', 'c']);
24254
+ * // => true
24255
+ */
24256
+ function has(object, path) {
24257
+ if (object == null) {
24258
+ return false;
24259
+ }
24260
+ var result = hasOwnProperty.call(object, path);
24261
+ if (!result && !isKey(path)) {
24262
+ path = toPath(path);
24263
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
24264
+ if (object == null) {
24265
+ return false;
24266
+ }
24267
+ path = last(path);
24268
+ result = hasOwnProperty.call(object, path);
24269
+ }
24270
+ return result || (isLength(object.length) && isIndex(path, object.length) &&
24271
+ (isArray(object) || isArguments(object)));
24272
+ }
24273
+
24274
+ /**
24275
+ * Creates an object composed of the inverted keys and values of `object`.
24276
+ * If `object` contains duplicate values, subsequent values overwrite property
24277
+ * assignments of previous values unless `multiValue` is `true`.
24278
+ *
24279
+ * @static
24280
+ * @memberOf _
24281
+ * @category Object
24282
+ * @param {Object} object The object to invert.
24283
+ * @param {boolean} [multiValue] Allow multiple values per key.
24284
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
24285
+ * @returns {Object} Returns the new inverted object.
24286
+ * @example
24287
+ *
24288
+ * var object = { 'a': 1, 'b': 2, 'c': 1 };
24289
+ *
24290
+ * _.invert(object);
24291
+ * // => { '1': 'c', '2': 'b' }
24292
+ *
24293
+ * // with `multiValue`
24294
+ * _.invert(object, true);
24295
+ * // => { '1': ['a', 'c'], '2': ['b'] }
24296
+ */
24297
+ function invert(object, multiValue, guard) {
24298
+ if (guard && isIterateeCall(object, multiValue, guard)) {
24299
+ multiValue = undefined;
24300
+ }
24301
+ var index = -1,
24302
+ props = keys(object),
24303
+ length = props.length,
24304
+ result = {};
24305
+
24306
+ while (++index < length) {
24307
+ var key = props[index],
24308
+ value = object[key];
24309
+
24310
+ if (multiValue) {
24311
+ if (hasOwnProperty.call(result, value)) {
24312
+ result[value].push(key);
24313
+ } else {
24314
+ result[value] = [key];
24315
+ }
24316
+ }
24317
+ else {
24318
+ result[value] = key;
24319
+ }
24320
+ }
24321
+ return result;
24322
+ }
24323
+
24324
+ /**
24325
+ * Creates an array of the own enumerable property names of `object`.
24326
+ *
24327
+ * **Note:** Non-object values are coerced to objects. See the
24328
+ * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
24329
+ * for more details.
24330
+ *
24331
+ * @static
24332
+ * @memberOf _
24333
+ * @category Object
24334
+ * @param {Object} object The object to query.
24335
+ * @returns {Array} Returns the array of property names.
24336
+ * @example
24337
+ *
24338
+ * function Foo() {
24339
+ * this.a = 1;
24340
+ * this.b = 2;
24341
+ * }
24342
+ *
24343
+ * Foo.prototype.c = 3;
24344
+ *
24345
+ * _.keys(new Foo);
24346
+ * // => ['a', 'b'] (iteration order is not guaranteed)
24347
+ *
24348
+ * _.keys('hi');
24349
+ * // => ['0', '1']
24350
+ */
24351
+ var keys = !nativeKeys ? shimKeys : function(object) {
24352
+ var Ctor = object == null ? undefined : object.constructor;
24353
+ if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
24354
+ (typeof object != 'function' && isArrayLike(object))) {
24355
+ return shimKeys(object);
24356
+ }
24357
+ return isObject(object) ? nativeKeys(object) : [];
24358
+ };
24359
+
24360
+ /**
24361
+ * Creates an array of the own and inherited enumerable property names of `object`.
24362
+ *
24363
+ * **Note:** Non-object values are coerced to objects.
24364
+ *
24365
+ * @static
24366
+ * @memberOf _
24367
+ * @category Object
24368
+ * @param {Object} object The object to query.
24369
+ * @returns {Array} Returns the array of property names.
24370
+ * @example
24371
+ *
24372
+ * function Foo() {
24373
+ * this.a = 1;
24374
+ * this.b = 2;
24375
+ * }
24376
+ *
24377
+ * Foo.prototype.c = 3;
24378
+ *
24379
+ * _.keysIn(new Foo);
24380
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
24381
+ */
24382
+ function keysIn(object) {
24383
+ if (object == null) {
24384
+ return [];
24385
+ }
24386
+ if (!isObject(object)) {
24387
+ object = Object(object);
24388
+ }
24389
+ var length = object.length;
24390
+ length = (length && isLength(length) &&
24391
+ (isArray(object) || isArguments(object)) && length) || 0;
24392
+
24393
+ var Ctor = object.constructor,
24394
+ index = -1,
24395
+ isProto = typeof Ctor == 'function' && Ctor.prototype === object,
24396
+ result = Array(length),
24397
+ skipIndexes = length > 0;
24398
+
24399
+ while (++index < length) {
24400
+ result[index] = (index + '');
24401
+ }
24402
+ for (var key in object) {
24403
+ if (!(skipIndexes && isIndex(key, length)) &&
24404
+ !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
24405
+ result.push(key);
24406
+ }
24407
+ }
24408
+ return result;
24409
+ }
24410
+
24411
+ /**
24412
+ * The opposite of `_.mapValues`; this method creates an object with the
24413
+ * same values as `object` and keys generated by running each own enumerable
24414
+ * property of `object` through `iteratee`.
24415
+ *
24416
+ * @static
24417
+ * @memberOf _
24418
+ * @category Object
24419
+ * @param {Object} object The object to iterate over.
24420
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
24421
+ * per iteration.
24422
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24423
+ * @returns {Object} Returns the new mapped object.
24424
+ * @example
24425
+ *
24426
+ * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
24427
+ * return key + value;
24428
+ * });
24429
+ * // => { 'a1': 1, 'b2': 2 }
24430
+ */
24431
+ var mapKeys = createObjectMapper(true);
24432
+
24433
+ /**
24434
+ * Creates an object with the same keys as `object` and values generated by
24435
+ * running each own enumerable property of `object` through `iteratee`. The
24436
+ * iteratee function is bound to `thisArg` and invoked with three arguments:
24437
+ * (value, key, object).
24438
+ *
24439
+ * If a property name is provided for `iteratee` the created `_.property`
24440
+ * style callback returns the property value of the given element.
24441
+ *
24442
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
24443
+ * style callback returns `true` for elements that have a matching property
24444
+ * value, else `false`.
24445
+ *
24446
+ * If an object is provided for `iteratee` the created `_.matches` style
24447
+ * callback returns `true` for elements that have the properties of the given
24448
+ * object, else `false`.
24449
+ *
24450
+ * @static
24451
+ * @memberOf _
24452
+ * @category Object
24453
+ * @param {Object} object The object to iterate over.
24454
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
24455
+ * per iteration.
24456
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24457
+ * @returns {Object} Returns the new mapped object.
24458
+ * @example
24459
+ *
24460
+ * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
24461
+ * return n * 3;
24462
+ * });
24463
+ * // => { 'a': 3, 'b': 6 }
24464
+ *
24465
+ * var users = {
24466
+ * 'fred': { 'user': 'fred', 'age': 40 },
24467
+ * 'pebbles': { 'user': 'pebbles', 'age': 1 }
24468
+ * };
24469
+ *
24470
+ * // using the `_.property` callback shorthand
24471
+ * _.mapValues(users, 'age');
24472
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
24473
+ */
24474
+ var mapValues = createObjectMapper();
24475
+
24476
+ /**
24477
+ * The opposite of `_.pick`; this method creates an object composed of the
24478
+ * own and inherited enumerable properties of `object` that are not omitted.
24479
+ *
24480
+ * @static
24481
+ * @memberOf _
24482
+ * @category Object
24483
+ * @param {Object} object The source object.
24484
+ * @param {Function|...(string|string[])} [predicate] The function invoked per
24485
+ * iteration or property names to omit, specified as individual property
24486
+ * names or arrays of property names.
24487
+ * @param {*} [thisArg] The `this` binding of `predicate`.
24488
+ * @returns {Object} Returns the new object.
24489
+ * @example
24490
+ *
24491
+ * var object = { 'user': 'fred', 'age': 40 };
24492
+ *
24493
+ * _.omit(object, 'age');
24494
+ * // => { 'user': 'fred' }
24495
+ *
24496
+ * _.omit(object, _.isNumber);
24497
+ * // => { 'user': 'fred' }
24498
+ */
24499
+ var omit = restParam(function(object, props) {
24500
+ if (object == null) {
24501
+ return {};
24502
+ }
24503
+ if (typeof props[0] != 'function') {
24504
+ var props = arrayMap(baseFlatten(props), String);
24505
+ return pickByArray(object, baseDifference(keysIn(object), props));
24506
+ }
24507
+ var predicate = bindCallback(props[0], props[1], 3);
24508
+ return pickByCallback(object, function(value, key, object) {
24509
+ return !predicate(value, key, object);
24510
+ });
24511
+ });
24512
+
24513
+ /**
24514
+ * Creates a two dimensional array of the key-value pairs for `object`,
24515
+ * e.g. `[[key1, value1], [key2, value2]]`.
24516
+ *
24517
+ * @static
24518
+ * @memberOf _
24519
+ * @category Object
24520
+ * @param {Object} object The object to query.
24521
+ * @returns {Array} Returns the new array of key-value pairs.
24522
+ * @example
24523
+ *
24524
+ * _.pairs({ 'barney': 36, 'fred': 40 });
24525
+ * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
24526
+ */
24527
+ function pairs(object) {
24528
+ object = toObject(object);
24529
+
24530
+ var index = -1,
24531
+ props = keys(object),
24532
+ length = props.length,
24533
+ result = Array(length);
24534
+
24535
+ while (++index < length) {
24536
+ var key = props[index];
24537
+ result[index] = [key, object[key]];
24538
+ }
24539
+ return result;
24540
+ }
24541
+
24542
+ /**
24543
+ * Creates an object composed of the picked `object` properties. Property
24544
+ * names may be specified as individual arguments or as arrays of property
24545
+ * names. If `predicate` is provided it is invoked for each property of `object`
24546
+ * picking the properties `predicate` returns truthy for. The predicate is
24547
+ * bound to `thisArg` and invoked with three arguments: (value, key, object).
24548
+ *
24549
+ * @static
24550
+ * @memberOf _
24551
+ * @category Object
24552
+ * @param {Object} object The source object.
24553
+ * @param {Function|...(string|string[])} [predicate] The function invoked per
24554
+ * iteration or property names to pick, specified as individual property
24555
+ * names or arrays of property names.
24556
+ * @param {*} [thisArg] The `this` binding of `predicate`.
24557
+ * @returns {Object} Returns the new object.
24558
+ * @example
24559
+ *
24560
+ * var object = { 'user': 'fred', 'age': 40 };
24561
+ *
24562
+ * _.pick(object, 'user');
24563
+ * // => { 'user': 'fred' }
24564
+ *
24565
+ * _.pick(object, _.isString);
24566
+ * // => { 'user': 'fred' }
24567
+ */
24568
+ var pick = restParam(function(object, props) {
24569
+ if (object == null) {
24570
+ return {};
24571
+ }
24572
+ return typeof props[0] == 'function'
24573
+ ? pickByCallback(object, bindCallback(props[0], props[1], 3))
24574
+ : pickByArray(object, baseFlatten(props));
24575
+ });
24576
+
24577
+ /**
24578
+ * This method is like `_.get` except that if the resolved value is a function
24579
+ * it is invoked with the `this` binding of its parent object and its result
24580
+ * is returned.
24581
+ *
24582
+ * @static
24583
+ * @memberOf _
24584
+ * @category Object
24585
+ * @param {Object} object The object to query.
24586
+ * @param {Array|string} path The path of the property to resolve.
24587
+ * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
24588
+ * @returns {*} Returns the resolved value.
24589
+ * @example
24590
+ *
24591
+ * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
24592
+ *
24593
+ * _.result(object, 'a[0].b.c1');
24594
+ * // => 3
24595
+ *
24596
+ * _.result(object, 'a[0].b.c2');
24597
+ * // => 4
24598
+ *
24599
+ * _.result(object, 'a.b.c', 'default');
24600
+ * // => 'default'
24601
+ *
24602
+ * _.result(object, 'a.b.c', _.constant('default'));
24603
+ * // => 'default'
24604
+ */
24605
+ function result(object, path, defaultValue) {
24606
+ var result = object == null ? undefined : object[path];
24607
+ if (result === undefined) {
24608
+ if (object != null && !isKey(path, object)) {
24609
+ path = toPath(path);
24610
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
24611
+ result = object == null ? undefined : object[last(path)];
24612
+ }
24613
+ result = result === undefined ? defaultValue : result;
24614
+ }
24615
+ return isFunction(result) ? result.call(object) : result;
24616
+ }
24617
+
24618
+ /**
24619
+ * Sets the property value of `path` on `object`. If a portion of `path`
24620
+ * does not exist it is created.
24621
+ *
24622
+ * @static
24623
+ * @memberOf _
24624
+ * @category Object
24625
+ * @param {Object} object The object to augment.
24626
+ * @param {Array|string} path The path of the property to set.
24627
+ * @param {*} value The value to set.
24628
+ * @returns {Object} Returns `object`.
24629
+ * @example
24630
+ *
24631
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
24632
+ *
24633
+ * _.set(object, 'a[0].b.c', 4);
24634
+ * console.log(object.a[0].b.c);
24635
+ * // => 4
24636
+ *
24637
+ * _.set(object, 'x[0].y.z', 5);
24638
+ * console.log(object.x[0].y.z);
24639
+ * // => 5
24640
+ */
24641
+ function set(object, path, value) {
24642
+ if (object == null) {
24643
+ return object;
24644
+ }
24645
+ var pathKey = (path + '');
24646
+ path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
24647
+
24648
+ var index = -1,
24649
+ length = path.length,
24650
+ lastIndex = length - 1,
24651
+ nested = object;
24652
+
24653
+ while (nested != null && ++index < length) {
24654
+ var key = path[index];
24655
+ if (isObject(nested)) {
24656
+ if (index == lastIndex) {
24657
+ nested[key] = value;
24658
+ } else if (nested[key] == null) {
24659
+ nested[key] = isIndex(path[index + 1]) ? [] : {};
24660
+ }
24661
+ }
24662
+ nested = nested[key];
24663
+ }
24664
+ return object;
24665
+ }
24666
+
24667
+ /**
24668
+ * An alternative to `_.reduce`; this method transforms `object` to a new
24669
+ * `accumulator` object which is the result of running each of its own enumerable
24670
+ * properties through `iteratee`, with each invocation potentially mutating
24671
+ * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
24672
+ * with four arguments: (accumulator, value, key, object). Iteratee functions
24673
+ * may exit iteration early by explicitly returning `false`.
24674
+ *
24675
+ * @static
24676
+ * @memberOf _
24677
+ * @category Object
24678
+ * @param {Array|Object} object The object to iterate over.
24679
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
24680
+ * @param {*} [accumulator] The custom accumulator value.
24681
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
24682
+ * @returns {*} Returns the accumulated value.
24683
+ * @example
24684
+ *
24685
+ * _.transform([2, 3, 4], function(result, n) {
24686
+ * result.push(n *= n);
24687
+ * return n % 2 == 0;
24688
+ * });
24689
+ * // => [4, 9]
24690
+ *
24691
+ * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
24692
+ * result[key] = n * 3;
24693
+ * });
24694
+ * // => { 'a': 3, 'b': 6 }
24695
+ */
24696
+ function transform(object, iteratee, accumulator, thisArg) {
24697
+ var isArr = isArray(object) || isTypedArray(object);
24698
+ iteratee = getCallback(iteratee, thisArg, 4);
24699
+
24700
+ if (accumulator == null) {
24701
+ if (isArr || isObject(object)) {
24702
+ var Ctor = object.constructor;
24703
+ if (isArr) {
24704
+ accumulator = isArray(object) ? new Ctor : [];
24705
+ } else {
24706
+ accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
24707
+ }
24708
+ } else {
24709
+ accumulator = {};
24710
+ }
24711
+ }
24712
+ (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
24713
+ return iteratee(accumulator, value, index, object);
24714
+ });
24715
+ return accumulator;
24716
+ }
24717
+
24718
+ /**
24719
+ * Creates an array of the own enumerable property values of `object`.
24720
+ *
24721
+ * **Note:** Non-object values are coerced to objects.
24722
+ *
24723
+ * @static
24724
+ * @memberOf _
24725
+ * @category Object
24726
+ * @param {Object} object The object to query.
24727
+ * @returns {Array} Returns the array of property values.
24728
+ * @example
24729
+ *
24730
+ * function Foo() {
24731
+ * this.a = 1;
24732
+ * this.b = 2;
24733
+ * }
24734
+ *
24735
+ * Foo.prototype.c = 3;
24736
+ *
24737
+ * _.values(new Foo);
24738
+ * // => [1, 2] (iteration order is not guaranteed)
24739
+ *
24740
+ * _.values('hi');
24741
+ * // => ['h', 'i']
24742
+ */
24743
+ function values(object) {
24744
+ return baseValues(object, keys(object));
24745
+ }
24746
+
24747
+ /**
24748
+ * Creates an array of the own and inherited enumerable property values
24749
+ * of `object`.
24750
+ *
24751
+ * **Note:** Non-object values are coerced to objects.
24752
+ *
24753
+ * @static
24754
+ * @memberOf _
24755
+ * @category Object
24756
+ * @param {Object} object The object to query.
24757
+ * @returns {Array} Returns the array of property values.
24758
+ * @example
24759
+ *
24760
+ * function Foo() {
24761
+ * this.a = 1;
24762
+ * this.b = 2;
24763
+ * }
24764
+ *
24765
+ * Foo.prototype.c = 3;
24766
+ *
24767
+ * _.valuesIn(new Foo);
24768
+ * // => [1, 2, 3] (iteration order is not guaranteed)
24769
+ */
24770
+ function valuesIn(object) {
24771
+ return baseValues(object, keysIn(object));
24772
+ }
24773
+
24774
+ /*------------------------------------------------------------------------*/
24775
+
24776
+ /**
24777
+ * Checks if `n` is between `start` and up to but not including, `end`. If
24778
+ * `end` is not specified it is set to `start` with `start` then set to `0`.
24779
+ *
24780
+ * @static
24781
+ * @memberOf _
24782
+ * @category Number
24783
+ * @param {number} n The number to check.
24784
+ * @param {number} [start=0] The start of the range.
24785
+ * @param {number} end The end of the range.
24786
+ * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
24787
+ * @example
24788
+ *
24789
+ * _.inRange(3, 2, 4);
24790
+ * // => true
24791
+ *
24792
+ * _.inRange(4, 8);
24793
+ * // => true
24794
+ *
24795
+ * _.inRange(4, 2);
24796
+ * // => false
24797
+ *
24798
+ * _.inRange(2, 2);
24799
+ * // => false
24800
+ *
24801
+ * _.inRange(1.2, 2);
24802
+ * // => true
24803
+ *
24804
+ * _.inRange(5.2, 4);
24805
+ * // => false
24806
+ */
24807
+ function inRange(value, start, end) {
24808
+ start = +start || 0;
24809
+ if (end === undefined) {
24810
+ end = start;
24811
+ start = 0;
24812
+ } else {
24813
+ end = +end || 0;
24814
+ }
24815
+ return value >= nativeMin(start, end) && value < nativeMax(start, end);
24816
+ }
24817
+
24818
+ /**
24819
+ * Produces a random number between `min` and `max` (inclusive). If only one
24820
+ * argument is provided a number between `0` and the given number is returned.
24821
+ * If `floating` is `true`, or either `min` or `max` are floats, a floating-point
24822
+ * number is returned instead of an integer.
24823
+ *
24824
+ * @static
24825
+ * @memberOf _
24826
+ * @category Number
24827
+ * @param {number} [min=0] The minimum possible value.
24828
+ * @param {number} [max=1] The maximum possible value.
24829
+ * @param {boolean} [floating] Specify returning a floating-point number.
24830
+ * @returns {number} Returns the random number.
24831
+ * @example
24832
+ *
24833
+ * _.random(0, 5);
24834
+ * // => an integer between 0 and 5
24835
+ *
24836
+ * _.random(5);
24837
+ * // => also an integer between 0 and 5
24838
+ *
24839
+ * _.random(5, true);
24840
+ * // => a floating-point number between 0 and 5
24841
+ *
24842
+ * _.random(1.2, 5.2);
24843
+ * // => a floating-point number between 1.2 and 5.2
24844
+ */
24845
+ function random(min, max, floating) {
24846
+ if (floating && isIterateeCall(min, max, floating)) {
24847
+ max = floating = undefined;
24848
+ }
24849
+ var noMin = min == null,
24850
+ noMax = max == null;
24851
+
24852
+ if (floating == null) {
24853
+ if (noMax && typeof min == 'boolean') {
24854
+ floating = min;
24855
+ min = 1;
24856
+ }
24857
+ else if (typeof max == 'boolean') {
24858
+ floating = max;
24859
+ noMax = true;
24860
+ }
24861
+ }
24862
+ if (noMin && noMax) {
24863
+ max = 1;
24864
+ noMax = false;
24865
+ }
24866
+ min = +min || 0;
24867
+ if (noMax) {
24868
+ max = min;
24869
+ min = 0;
24870
+ } else {
24871
+ max = +max || 0;
24872
+ }
24873
+ if (floating || min % 1 || max % 1) {
24874
+ var rand = nativeRandom();
24875
+ return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);
24876
+ }
24877
+ return baseRandom(min, max);
24878
+ }
24879
+
24880
+ /*------------------------------------------------------------------------*/
24881
+
24882
+ /**
24883
+ * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
24884
+ *
24885
+ * @static
24886
+ * @memberOf _
24887
+ * @category String
24888
+ * @param {string} [string=''] The string to convert.
24889
+ * @returns {string} Returns the camel cased string.
24890
+ * @example
24891
+ *
24892
+ * _.camelCase('Foo Bar');
24893
+ * // => 'fooBar'
24894
+ *
24895
+ * _.camelCase('--foo-bar');
24896
+ * // => 'fooBar'
24897
+ *
24898
+ * _.camelCase('__foo_bar__');
24899
+ * // => 'fooBar'
24900
+ */
24901
+ var camelCase = createCompounder(function(result, word, index) {
24902
+ word = word.toLowerCase();
24903
+ return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
24904
+ });
24905
+
24906
+ /**
24907
+ * Capitalizes the first character of `string`.
24908
+ *
24909
+ * @static
24910
+ * @memberOf _
24911
+ * @category String
24912
+ * @param {string} [string=''] The string to capitalize.
24913
+ * @returns {string} Returns the capitalized string.
24914
+ * @example
24915
+ *
24916
+ * _.capitalize('fred');
24917
+ * // => 'Fred'
24918
+ */
24919
+ function capitalize(string) {
24920
+ string = baseToString(string);
24921
+ return string && (string.charAt(0).toUpperCase() + string.slice(1));
24922
+ }
24923
+
24924
+ /**
24925
+ * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
24926
+ * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
24927
+ *
24928
+ * @static
24929
+ * @memberOf _
24930
+ * @category String
24931
+ * @param {string} [string=''] The string to deburr.
24932
+ * @returns {string} Returns the deburred string.
24933
+ * @example
24934
+ *
24935
+ * _.deburr('déjà vu');
24936
+ * // => 'deja vu'
24937
+ */
24938
+ function deburr(string) {
24939
+ string = baseToString(string);
24940
+ return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
24941
+ }
24942
+
24943
+ /**
24944
+ * Checks if `string` ends with the given target string.
24945
+ *
24946
+ * @static
24947
+ * @memberOf _
24948
+ * @category String
24949
+ * @param {string} [string=''] The string to search.
24950
+ * @param {string} [target] The string to search for.
24951
+ * @param {number} [position=string.length] The position to search from.
24952
+ * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
24953
+ * @example
24954
+ *
24955
+ * _.endsWith('abc', 'c');
24956
+ * // => true
24957
+ *
24958
+ * _.endsWith('abc', 'b');
24959
+ * // => false
24960
+ *
24961
+ * _.endsWith('abc', 'b', 2);
24962
+ * // => true
24963
+ */
24964
+ function endsWith(string, target, position) {
24965
+ string = baseToString(string);
24966
+ target = (target + '');
24967
+
24968
+ var length = string.length;
24969
+ position = position === undefined
24970
+ ? length
24971
+ : nativeMin(position < 0 ? 0 : (+position || 0), length);
24972
+
24973
+ position -= target.length;
24974
+ return position >= 0 && string.indexOf(target, position) == position;
24975
+ }
24976
+
24977
+ /**
24978
+ * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to
24979
+ * their corresponding HTML entities.
24980
+ *
24981
+ * **Note:** No other characters are escaped. To escape additional characters
24982
+ * use a third-party library like [_he_](https://mths.be/he).
24983
+ *
24984
+ * Though the ">" character is escaped for symmetry, characters like
24985
+ * ">" and "/" don't need escaping in HTML and have no special meaning
24986
+ * unless they're part of a tag or unquoted attribute value.
24987
+ * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
24988
+ * (under "semi-related fun fact") for more details.
24989
+ *
24990
+ * Backticks are escaped because in Internet Explorer < 9, they can break out
24991
+ * of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
24992
+ * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
24993
+ * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
24994
+ * for more details.
24995
+ *
24996
+ * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
24997
+ * to reduce XSS vectors.
24998
+ *
24999
+ * @static
25000
+ * @memberOf _
25001
+ * @category String
25002
+ * @param {string} [string=''] The string to escape.
25003
+ * @returns {string} Returns the escaped string.
25004
+ * @example
25005
+ *
25006
+ * _.escape('fred, barney, & pebbles');
25007
+ * // => 'fred, barney, &amp; pebbles'
25008
+ */
25009
+ function escape(string) {
25010
+ // Reset `lastIndex` because in IE < 9 `String#replace` does not.
25011
+ string = baseToString(string);
25012
+ return (string && reHasUnescapedHtml.test(string))
25013
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
25014
+ : string;
25015
+ }
25016
+
25017
+ /**
25018
+ * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
25019
+ * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
25020
+ *
25021
+ * @static
25022
+ * @memberOf _
25023
+ * @category String
25024
+ * @param {string} [string=''] The string to escape.
25025
+ * @returns {string} Returns the escaped string.
25026
+ * @example
25027
+ *
25028
+ * _.escapeRegExp('[lodash](https://lodash.com/)');
25029
+ * // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
25030
+ */
25031
+ function escapeRegExp(string) {
25032
+ string = baseToString(string);
25033
+ return (string && reHasRegExpChars.test(string))
25034
+ ? string.replace(reRegExpChars, escapeRegExpChar)
25035
+ : (string || '(?:)');
25036
+ }
25037
+
25038
+ /**
25039
+ * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
25040
+ *
25041
+ * @static
25042
+ * @memberOf _
25043
+ * @category String
25044
+ * @param {string} [string=''] The string to convert.
25045
+ * @returns {string} Returns the kebab cased string.
25046
+ * @example
25047
+ *
25048
+ * _.kebabCase('Foo Bar');
25049
+ * // => 'foo-bar'
25050
+ *
25051
+ * _.kebabCase('fooBar');
25052
+ * // => 'foo-bar'
25053
+ *
25054
+ * _.kebabCase('__foo_bar__');
25055
+ * // => 'foo-bar'
25056
+ */
25057
+ var kebabCase = createCompounder(function(result, word, index) {
25058
+ return result + (index ? '-' : '') + word.toLowerCase();
25059
+ });
25060
+
25061
+ /**
25062
+ * Pads `string` on the left and right sides if it's shorter than `length`.
25063
+ * Padding characters are truncated if they can't be evenly divided by `length`.
25064
+ *
25065
+ * @static
25066
+ * @memberOf _
25067
+ * @category String
25068
+ * @param {string} [string=''] The string to pad.
25069
+ * @param {number} [length=0] The padding length.
25070
+ * @param {string} [chars=' '] The string used as padding.
25071
+ * @returns {string} Returns the padded string.
25072
+ * @example
25073
+ *
25074
+ * _.pad('abc', 8);
25075
+ * // => ' abc '
25076
+ *
25077
+ * _.pad('abc', 8, '_-');
25078
+ * // => '_-abc_-_'
25079
+ *
25080
+ * _.pad('abc', 3);
25081
+ * // => 'abc'
25082
+ */
25083
+ function pad(string, length, chars) {
25084
+ string = baseToString(string);
25085
+ length = +length;
25086
+
25087
+ var strLength = string.length;
25088
+ if (strLength >= length || !nativeIsFinite(length)) {
25089
+ return string;
25090
+ }
25091
+ var mid = (length - strLength) / 2,
25092
+ leftLength = nativeFloor(mid),
25093
+ rightLength = nativeCeil(mid);
25094
+
25095
+ chars = createPadding('', rightLength, chars);
25096
+ return chars.slice(0, leftLength) + string + chars;
25097
+ }
25098
+
25099
+ /**
25100
+ * Pads `string` on the left side if it's shorter than `length`. Padding
25101
+ * characters are truncated if they exceed `length`.
25102
+ *
25103
+ * @static
25104
+ * @memberOf _
25105
+ * @category String
25106
+ * @param {string} [string=''] The string to pad.
25107
+ * @param {number} [length=0] The padding length.
25108
+ * @param {string} [chars=' '] The string used as padding.
25109
+ * @returns {string} Returns the padded string.
25110
+ * @example
25111
+ *
25112
+ * _.padLeft('abc', 6);
25113
+ * // => ' abc'
25114
+ *
25115
+ * _.padLeft('abc', 6, '_-');
25116
+ * // => '_-_abc'
25117
+ *
25118
+ * _.padLeft('abc', 3);
25119
+ * // => 'abc'
25120
+ */
25121
+ var padLeft = createPadDir();
25122
+
25123
+ /**
25124
+ * Pads `string` on the right side if it's shorter than `length`. Padding
25125
+ * characters are truncated if they exceed `length`.
25126
+ *
25127
+ * @static
25128
+ * @memberOf _
25129
+ * @category String
25130
+ * @param {string} [string=''] The string to pad.
25131
+ * @param {number} [length=0] The padding length.
25132
+ * @param {string} [chars=' '] The string used as padding.
25133
+ * @returns {string} Returns the padded string.
25134
+ * @example
25135
+ *
25136
+ * _.padRight('abc', 6);
25137
+ * // => 'abc '
25138
+ *
25139
+ * _.padRight('abc', 6, '_-');
25140
+ * // => 'abc_-_'
25141
+ *
25142
+ * _.padRight('abc', 3);
25143
+ * // => 'abc'
25144
+ */
25145
+ var padRight = createPadDir(true);
25146
+
25147
+ /**
25148
+ * Converts `string` to an integer of the specified radix. If `radix` is
25149
+ * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
25150
+ * in which case a `radix` of `16` is used.
25151
+ *
25152
+ * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
25153
+ * of `parseInt`.
25154
+ *
25155
+ * @static
25156
+ * @memberOf _
25157
+ * @category String
25158
+ * @param {string} string The string to convert.
25159
+ * @param {number} [radix] The radix to interpret `value` by.
25160
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25161
+ * @returns {number} Returns the converted integer.
25162
+ * @example
25163
+ *
25164
+ * _.parseInt('08');
25165
+ * // => 8
25166
+ *
25167
+ * _.map(['6', '08', '10'], _.parseInt);
25168
+ * // => [6, 8, 10]
25169
+ */
25170
+ function parseInt(string, radix, guard) {
25171
+ // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
25172
+ // Chrome fails to trim leading <BOM> whitespace characters.
25173
+ // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
25174
+ if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
25175
+ radix = 0;
25176
+ } else if (radix) {
25177
+ radix = +radix;
25178
+ }
25179
+ string = trim(string);
25180
+ return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
25181
+ }
25182
+
25183
+ /**
25184
+ * Repeats the given string `n` times.
25185
+ *
25186
+ * @static
25187
+ * @memberOf _
25188
+ * @category String
25189
+ * @param {string} [string=''] The string to repeat.
25190
+ * @param {number} [n=0] The number of times to repeat the string.
25191
+ * @returns {string} Returns the repeated string.
25192
+ * @example
25193
+ *
25194
+ * _.repeat('*', 3);
25195
+ * // => '***'
25196
+ *
25197
+ * _.repeat('abc', 2);
25198
+ * // => 'abcabc'
25199
+ *
25200
+ * _.repeat('abc', 0);
25201
+ * // => ''
25202
+ */
25203
+ function repeat(string, n) {
25204
+ var result = '';
25205
+ string = baseToString(string);
25206
+ n = +n;
25207
+ if (n < 1 || !string || !nativeIsFinite(n)) {
25208
+ return result;
25209
+ }
25210
+ // Leverage the exponentiation by squaring algorithm for a faster repeat.
25211
+ // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
25212
+ do {
25213
+ if (n % 2) {
25214
+ result += string;
25215
+ }
25216
+ n = nativeFloor(n / 2);
25217
+ string += string;
25218
+ } while (n);
25219
+
25220
+ return result;
25221
+ }
25222
+
25223
+ /**
25224
+ * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
25225
+ *
25226
+ * @static
25227
+ * @memberOf _
25228
+ * @category String
25229
+ * @param {string} [string=''] The string to convert.
25230
+ * @returns {string} Returns the snake cased string.
25231
+ * @example
25232
+ *
25233
+ * _.snakeCase('Foo Bar');
25234
+ * // => 'foo_bar'
25235
+ *
25236
+ * _.snakeCase('fooBar');
25237
+ * // => 'foo_bar'
25238
+ *
25239
+ * _.snakeCase('--foo-bar');
25240
+ * // => 'foo_bar'
25241
+ */
25242
+ var snakeCase = createCompounder(function(result, word, index) {
25243
+ return result + (index ? '_' : '') + word.toLowerCase();
25244
+ });
25245
+
25246
+ /**
25247
+ * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
25248
+ *
25249
+ * @static
25250
+ * @memberOf _
25251
+ * @category String
25252
+ * @param {string} [string=''] The string to convert.
25253
+ * @returns {string} Returns the start cased string.
25254
+ * @example
25255
+ *
25256
+ * _.startCase('--foo-bar');
25257
+ * // => 'Foo Bar'
25258
+ *
25259
+ * _.startCase('fooBar');
25260
+ * // => 'Foo Bar'
25261
+ *
25262
+ * _.startCase('__foo_bar__');
25263
+ * // => 'Foo Bar'
25264
+ */
25265
+ var startCase = createCompounder(function(result, word, index) {
25266
+ return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
25267
+ });
25268
+
25269
+ /**
25270
+ * Checks if `string` starts with the given target string.
25271
+ *
25272
+ * @static
25273
+ * @memberOf _
25274
+ * @category String
25275
+ * @param {string} [string=''] The string to search.
25276
+ * @param {string} [target] The string to search for.
25277
+ * @param {number} [position=0] The position to search from.
25278
+ * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
25279
+ * @example
25280
+ *
25281
+ * _.startsWith('abc', 'a');
25282
+ * // => true
25283
+ *
25284
+ * _.startsWith('abc', 'b');
25285
+ * // => false
25286
+ *
25287
+ * _.startsWith('abc', 'b', 1);
25288
+ * // => true
25289
+ */
25290
+ function startsWith(string, target, position) {
25291
+ string = baseToString(string);
25292
+ position = position == null
25293
+ ? 0
25294
+ : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
25295
+
25296
+ return string.lastIndexOf(target, position) == position;
25297
+ }
25298
+
25299
+ /**
25300
+ * Creates a compiled template function that can interpolate data properties
25301
+ * in "interpolate" delimiters, HTML-escape interpolated data properties in
25302
+ * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
25303
+ * properties may be accessed as free variables in the template. If a setting
25304
+ * object is provided it takes precedence over `_.templateSettings` values.
25305
+ *
25306
+ * **Note:** In the development build `_.template` utilizes
25307
+ * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
25308
+ * for easier debugging.
25309
+ *
25310
+ * For more information on precompiling templates see
25311
+ * [lodash's custom builds documentation](https://lodash.com/custom-builds).
25312
+ *
25313
+ * For more information on Chrome extension sandboxes see
25314
+ * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
25315
+ *
25316
+ * @static
25317
+ * @memberOf _
25318
+ * @category String
25319
+ * @param {string} [string=''] The template string.
25320
+ * @param {Object} [options] The options object.
25321
+ * @param {RegExp} [options.escape] The HTML "escape" delimiter.
25322
+ * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
25323
+ * @param {Object} [options.imports] An object to import into the template as free variables.
25324
+ * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
25325
+ * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
25326
+ * @param {string} [options.variable] The data object variable name.
25327
+ * @param- {Object} [otherOptions] Enables the legacy `options` param signature.
25328
+ * @returns {Function} Returns the compiled template function.
25329
+ * @example
25330
+ *
25331
+ * // using the "interpolate" delimiter to create a compiled template
25332
+ * var compiled = _.template('hello <%= user %>!');
25333
+ * compiled({ 'user': 'fred' });
25334
+ * // => 'hello fred!'
25335
+ *
25336
+ * // using the HTML "escape" delimiter to escape data property values
25337
+ * var compiled = _.template('<b><%- value %></b>');
25338
+ * compiled({ 'value': '<script>' });
25339
+ * // => '<b>&lt;script&gt;</b>'
25340
+ *
25341
+ * // using the "evaluate" delimiter to execute JavaScript and generate HTML
25342
+ * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
25343
+ * compiled({ 'users': ['fred', 'barney'] });
25344
+ * // => '<li>fred</li><li>barney</li>'
25345
+ *
25346
+ * // using the internal `print` function in "evaluate" delimiters
25347
+ * var compiled = _.template('<% print("hello " + user); %>!');
25348
+ * compiled({ 'user': 'barney' });
25349
+ * // => 'hello barney!'
25350
+ *
25351
+ * // using the ES delimiter as an alternative to the default "interpolate" delimiter
25352
+ * var compiled = _.template('hello ${ user }!');
25353
+ * compiled({ 'user': 'pebbles' });
25354
+ * // => 'hello pebbles!'
25355
+ *
25356
+ * // using custom template delimiters
25357
+ * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
25358
+ * var compiled = _.template('hello {{ user }}!');
25359
+ * compiled({ 'user': 'mustache' });
25360
+ * // => 'hello mustache!'
25361
+ *
25362
+ * // using backslashes to treat delimiters as plain text
25363
+ * var compiled = _.template('<%= "\\<%- value %\\>" %>');
25364
+ * compiled({ 'value': 'ignored' });
25365
+ * // => '<%- value %>'
25366
+ *
25367
+ * // using the `imports` option to import `jQuery` as `jq`
25368
+ * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
25369
+ * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
25370
+ * compiled({ 'users': ['fred', 'barney'] });
25371
+ * // => '<li>fred</li><li>barney</li>'
25372
+ *
25373
+ * // using the `sourceURL` option to specify a custom sourceURL for the template
25374
+ * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
25375
+ * compiled(data);
25376
+ * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
25377
+ *
25378
+ * // using the `variable` option to ensure a with-statement isn't used in the compiled template
25379
+ * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
25380
+ * compiled.source;
25381
+ * // => function(data) {
25382
+ * // var __t, __p = '';
25383
+ * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
25384
+ * // return __p;
25385
+ * // }
25386
+ *
25387
+ * // using the `source` property to inline compiled templates for meaningful
25388
+ * // line numbers in error messages and a stack trace
25389
+ * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
25390
+ * var JST = {\
25391
+ * "main": ' + _.template(mainText).source + '\
25392
+ * };\
25393
+ * ');
25394
+ */
25395
+ function template(string, options, otherOptions) {
25396
+ // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
25397
+ // and Laura Doktorova's doT.js (https://github.com/olado/doT).
25398
+ var settings = lodash.templateSettings;
25399
+
25400
+ if (otherOptions && isIterateeCall(string, options, otherOptions)) {
25401
+ options = otherOptions = undefined;
25402
+ }
25403
+ string = baseToString(string);
25404
+ options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
25405
+
25406
+ var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
25407
+ importsKeys = keys(imports),
25408
+ importsValues = baseValues(imports, importsKeys);
25409
+
25410
+ var isEscaping,
25411
+ isEvaluating,
25412
+ index = 0,
25413
+ interpolate = options.interpolate || reNoMatch,
25414
+ source = "__p += '";
25415
+
25416
+ // Compile the regexp to match each delimiter.
25417
+ var reDelimiters = RegExp(
25418
+ (options.escape || reNoMatch).source + '|' +
25419
+ interpolate.source + '|' +
25420
+ (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
25421
+ (options.evaluate || reNoMatch).source + '|$'
25422
+ , 'g');
25423
+
25424
+ // Use a sourceURL for easier debugging.
25425
+ var sourceURL = '//# sourceURL=' +
25426
+ ('sourceURL' in options
25427
+ ? options.sourceURL
25428
+ : ('lodash.templateSources[' + (++templateCounter) + ']')
25429
+ ) + '\n';
25430
+
25431
+ string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
25432
+ interpolateValue || (interpolateValue = esTemplateValue);
25433
+
25434
+ // Escape characters that can't be included in string literals.
25435
+ source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
25436
+
25437
+ // Replace delimiters with snippets.
25438
+ if (escapeValue) {
25439
+ isEscaping = true;
25440
+ source += "' +\n__e(" + escapeValue + ") +\n'";
25441
+ }
25442
+ if (evaluateValue) {
25443
+ isEvaluating = true;
25444
+ source += "';\n" + evaluateValue + ";\n__p += '";
25445
+ }
25446
+ if (interpolateValue) {
25447
+ source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
25448
+ }
25449
+ index = offset + match.length;
25450
+
25451
+ // The JS engine embedded in Adobe products requires returning the `match`
25452
+ // string in order to produce the correct `offset` value.
25453
+ return match;
25454
+ });
25455
+
25456
+ source += "';\n";
25457
+
25458
+ // If `variable` is not specified wrap a with-statement around the generated
25459
+ // code to add the data object to the top of the scope chain.
25460
+ var variable = options.variable;
25461
+ if (!variable) {
25462
+ source = 'with (obj) {\n' + source + '\n}\n';
25463
+ }
25464
+ // Cleanup code by stripping empty strings.
25465
+ source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
25466
+ .replace(reEmptyStringMiddle, '$1')
25467
+ .replace(reEmptyStringTrailing, '$1;');
25468
+
25469
+ // Frame code as the function body.
25470
+ source = 'function(' + (variable || 'obj') + ') {\n' +
25471
+ (variable
25472
+ ? ''
25473
+ : 'obj || (obj = {});\n'
25474
+ ) +
25475
+ "var __t, __p = ''" +
25476
+ (isEscaping
25477
+ ? ', __e = _.escape'
25478
+ : ''
25479
+ ) +
25480
+ (isEvaluating
25481
+ ? ', __j = Array.prototype.join;\n' +
25482
+ "function print() { __p += __j.call(arguments, '') }\n"
25483
+ : ';\n'
25484
+ ) +
25485
+ source +
25486
+ 'return __p\n}';
25487
+
25488
+ var result = attempt(function() {
25489
+ return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues);
25490
+ });
25491
+
25492
+ // Provide the compiled function's source by its `toString` method or
25493
+ // the `source` property as a convenience for inlining compiled templates.
25494
+ result.source = source;
25495
+ if (isError(result)) {
25496
+ throw result;
25497
+ }
25498
+ return result;
25499
+ }
25500
+
25501
+ /**
25502
+ * Removes leading and trailing whitespace or specified characters from `string`.
25503
+ *
25504
+ * @static
25505
+ * @memberOf _
25506
+ * @category String
25507
+ * @param {string} [string=''] The string to trim.
25508
+ * @param {string} [chars=whitespace] The characters to trim.
25509
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25510
+ * @returns {string} Returns the trimmed string.
25511
+ * @example
25512
+ *
25513
+ * _.trim(' abc ');
25514
+ * // => 'abc'
25515
+ *
25516
+ * _.trim('-_-abc-_-', '_-');
25517
+ * // => 'abc'
25518
+ *
25519
+ * _.map([' foo ', ' bar '], _.trim);
25520
+ * // => ['foo', 'bar']
25521
+ */
25522
+ function trim(string, chars, guard) {
25523
+ var value = string;
25524
+ string = baseToString(string);
25525
+ if (!string) {
25526
+ return string;
25527
+ }
25528
+ if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
25529
+ return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
25530
+ }
25531
+ chars = (chars + '');
25532
+ return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
25533
+ }
25534
+
25535
+ /**
25536
+ * Removes leading whitespace or specified characters from `string`.
25537
+ *
25538
+ * @static
25539
+ * @memberOf _
25540
+ * @category String
25541
+ * @param {string} [string=''] The string to trim.
25542
+ * @param {string} [chars=whitespace] The characters to trim.
25543
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25544
+ * @returns {string} Returns the trimmed string.
25545
+ * @example
25546
+ *
25547
+ * _.trimLeft(' abc ');
25548
+ * // => 'abc '
25549
+ *
25550
+ * _.trimLeft('-_-abc-_-', '_-');
25551
+ * // => 'abc-_-'
25552
+ */
25553
+ function trimLeft(string, chars, guard) {
25554
+ var value = string;
25555
+ string = baseToString(string);
25556
+ if (!string) {
25557
+ return string;
25558
+ }
25559
+ if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
25560
+ return string.slice(trimmedLeftIndex(string));
25561
+ }
25562
+ return string.slice(charsLeftIndex(string, (chars + '')));
25563
+ }
25564
+
25565
+ /**
25566
+ * Removes trailing whitespace or specified characters from `string`.
25567
+ *
25568
+ * @static
25569
+ * @memberOf _
25570
+ * @category String
25571
+ * @param {string} [string=''] The string to trim.
25572
+ * @param {string} [chars=whitespace] The characters to trim.
25573
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25574
+ * @returns {string} Returns the trimmed string.
25575
+ * @example
25576
+ *
25577
+ * _.trimRight(' abc ');
25578
+ * // => ' abc'
25579
+ *
25580
+ * _.trimRight('-_-abc-_-', '_-');
25581
+ * // => '-_-abc'
25582
+ */
25583
+ function trimRight(string, chars, guard) {
25584
+ var value = string;
25585
+ string = baseToString(string);
25586
+ if (!string) {
25587
+ return string;
25588
+ }
25589
+ if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
25590
+ return string.slice(0, trimmedRightIndex(string) + 1);
25591
+ }
25592
+ return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
25593
+ }
25594
+
25595
+ /**
25596
+ * Truncates `string` if it's longer than the given maximum string length.
25597
+ * The last characters of the truncated string are replaced with the omission
25598
+ * string which defaults to "...".
25599
+ *
25600
+ * @static
25601
+ * @memberOf _
25602
+ * @category String
25603
+ * @param {string} [string=''] The string to truncate.
25604
+ * @param {Object|number} [options] The options object or maximum string length.
25605
+ * @param {number} [options.length=30] The maximum string length.
25606
+ * @param {string} [options.omission='...'] The string to indicate text is omitted.
25607
+ * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
25608
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25609
+ * @returns {string} Returns the truncated string.
25610
+ * @example
25611
+ *
25612
+ * _.trunc('hi-diddly-ho there, neighborino');
25613
+ * // => 'hi-diddly-ho there, neighbo...'
25614
+ *
25615
+ * _.trunc('hi-diddly-ho there, neighborino', 24);
25616
+ * // => 'hi-diddly-ho there, n...'
25617
+ *
25618
+ * _.trunc('hi-diddly-ho there, neighborino', {
25619
+ * 'length': 24,
25620
+ * 'separator': ' '
25621
+ * });
25622
+ * // => 'hi-diddly-ho there,...'
25623
+ *
25624
+ * _.trunc('hi-diddly-ho there, neighborino', {
25625
+ * 'length': 24,
25626
+ * 'separator': /,? +/
25627
+ * });
25628
+ * // => 'hi-diddly-ho there...'
25629
+ *
25630
+ * _.trunc('hi-diddly-ho there, neighborino', {
25631
+ * 'omission': ' [...]'
25632
+ * });
25633
+ * // => 'hi-diddly-ho there, neig [...]'
25634
+ */
25635
+ function trunc(string, options, guard) {
25636
+ if (guard && isIterateeCall(string, options, guard)) {
25637
+ options = undefined;
25638
+ }
25639
+ var length = DEFAULT_TRUNC_LENGTH,
25640
+ omission = DEFAULT_TRUNC_OMISSION;
25641
+
25642
+ if (options != null) {
25643
+ if (isObject(options)) {
25644
+ var separator = 'separator' in options ? options.separator : separator;
25645
+ length = 'length' in options ? (+options.length || 0) : length;
25646
+ omission = 'omission' in options ? baseToString(options.omission) : omission;
25647
+ } else {
25648
+ length = +options || 0;
25649
+ }
25650
+ }
25651
+ string = baseToString(string);
25652
+ if (length >= string.length) {
25653
+ return string;
25654
+ }
25655
+ var end = length - omission.length;
25656
+ if (end < 1) {
25657
+ return omission;
25658
+ }
25659
+ var result = string.slice(0, end);
25660
+ if (separator == null) {
25661
+ return result + omission;
25662
+ }
25663
+ if (isRegExp(separator)) {
25664
+ if (string.slice(end).search(separator)) {
25665
+ var match,
25666
+ newEnd,
25667
+ substring = string.slice(0, end);
25668
+
25669
+ if (!separator.global) {
25670
+ separator = RegExp(separator.source, (reFlags.exec(separator) || '') + 'g');
25671
+ }
25672
+ separator.lastIndex = 0;
25673
+ while ((match = separator.exec(substring))) {
25674
+ newEnd = match.index;
25675
+ }
25676
+ result = result.slice(0, newEnd == null ? end : newEnd);
25677
+ }
25678
+ } else if (string.indexOf(separator, end) != end) {
25679
+ var index = result.lastIndexOf(separator);
25680
+ if (index > -1) {
25681
+ result = result.slice(0, index);
25682
+ }
25683
+ }
25684
+ return result + omission;
25685
+ }
25686
+
25687
+ /**
25688
+ * The inverse of `_.escape`; this method converts the HTML entities
25689
+ * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their
25690
+ * corresponding characters.
25691
+ *
25692
+ * **Note:** No other HTML entities are unescaped. To unescape additional HTML
25693
+ * entities use a third-party library like [_he_](https://mths.be/he).
25694
+ *
25695
+ * @static
25696
+ * @memberOf _
25697
+ * @category String
25698
+ * @param {string} [string=''] The string to unescape.
25699
+ * @returns {string} Returns the unescaped string.
25700
+ * @example
25701
+ *
25702
+ * _.unescape('fred, barney, &amp; pebbles');
25703
+ * // => 'fred, barney, & pebbles'
25704
+ */
25705
+ function unescape(string) {
25706
+ string = baseToString(string);
25707
+ return (string && reHasEscapedHtml.test(string))
25708
+ ? string.replace(reEscapedHtml, unescapeHtmlChar)
25709
+ : string;
25710
+ }
25711
+
25712
+ /**
25713
+ * Splits `string` into an array of its words.
25714
+ *
25715
+ * @static
25716
+ * @memberOf _
25717
+ * @category String
25718
+ * @param {string} [string=''] The string to inspect.
25719
+ * @param {RegExp|string} [pattern] The pattern to match words.
25720
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25721
+ * @returns {Array} Returns the words of `string`.
25722
+ * @example
25723
+ *
25724
+ * _.words('fred, barney, & pebbles');
25725
+ * // => ['fred', 'barney', 'pebbles']
25726
+ *
25727
+ * _.words('fred, barney, & pebbles', /[^, ]+/g);
25728
+ * // => ['fred', 'barney', '&', 'pebbles']
25729
+ */
25730
+ function words(string, pattern, guard) {
25731
+ if (guard && isIterateeCall(string, pattern, guard)) {
25732
+ pattern = undefined;
25733
+ }
25734
+ string = baseToString(string);
25735
+ return string.match(pattern || reWords) || [];
25736
+ }
25737
+
25738
+ /*------------------------------------------------------------------------*/
25739
+
25740
+ /**
25741
+ * Attempts to invoke `func`, returning either the result or the caught error
25742
+ * object. Any additional arguments are provided to `func` when it is invoked.
25743
+ *
25744
+ * @static
25745
+ * @memberOf _
25746
+ * @category Utility
25747
+ * @param {Function} func The function to attempt.
25748
+ * @returns {*} Returns the `func` result or error object.
25749
+ * @example
25750
+ *
25751
+ * // avoid throwing errors for invalid selectors
25752
+ * var elements = _.attempt(function(selector) {
25753
+ * return document.querySelectorAll(selector);
25754
+ * }, '>_>');
25755
+ *
25756
+ * if (_.isError(elements)) {
25757
+ * elements = [];
25758
+ * }
25759
+ */
25760
+ var attempt = restParam(function(func, args) {
25761
+ try {
25762
+ return func.apply(undefined, args);
25763
+ } catch(e) {
25764
+ return isError(e) ? e : new Error(e);
25765
+ }
25766
+ });
25767
+
25768
+ /**
25769
+ * Creates a function that invokes `func` with the `this` binding of `thisArg`
25770
+ * and arguments of the created function. If `func` is a property name the
25771
+ * created callback returns the property value for a given element. If `func`
25772
+ * is an object the created callback returns `true` for elements that contain
25773
+ * the equivalent object properties, otherwise it returns `false`.
25774
+ *
25775
+ * @static
25776
+ * @memberOf _
25777
+ * @alias iteratee
25778
+ * @category Utility
25779
+ * @param {*} [func=_.identity] The value to convert to a callback.
25780
+ * @param {*} [thisArg] The `this` binding of `func`.
25781
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
25782
+ * @returns {Function} Returns the callback.
25783
+ * @example
25784
+ *
25785
+ * var users = [
25786
+ * { 'user': 'barney', 'age': 36 },
25787
+ * { 'user': 'fred', 'age': 40 }
25788
+ * ];
25789
+ *
25790
+ * // wrap to create custom callback shorthands
25791
+ * _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
25792
+ * var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
25793
+ * if (!match) {
25794
+ * return callback(func, thisArg);
25795
+ * }
25796
+ * return function(object) {
25797
+ * return match[2] == 'gt'
25798
+ * ? object[match[1]] > match[3]
25799
+ * : object[match[1]] < match[3];
25800
+ * };
25801
+ * });
25802
+ *
25803
+ * _.filter(users, 'age__gt36');
25804
+ * // => [{ 'user': 'fred', 'age': 40 }]
25805
+ */
25806
+ function callback(func, thisArg, guard) {
25807
+ if (guard && isIterateeCall(func, thisArg, guard)) {
25808
+ thisArg = undefined;
25809
+ }
25810
+ return isObjectLike(func)
25811
+ ? matches(func)
25812
+ : baseCallback(func, thisArg);
25813
+ }
25814
+
25815
+ /**
25816
+ * Creates a function that returns `value`.
25817
+ *
25818
+ * @static
25819
+ * @memberOf _
25820
+ * @category Utility
25821
+ * @param {*} value The value to return from the new function.
25822
+ * @returns {Function} Returns the new function.
25823
+ * @example
25824
+ *
25825
+ * var object = { 'user': 'fred' };
25826
+ * var getter = _.constant(object);
25827
+ *
25828
+ * getter() === object;
25829
+ * // => true
25830
+ */
25831
+ function constant(value) {
25832
+ return function() {
25833
+ return value;
25834
+ };
25835
+ }
25836
+
25837
+ /**
25838
+ * This method returns the first argument provided to it.
25839
+ *
25840
+ * @static
25841
+ * @memberOf _
25842
+ * @category Utility
25843
+ * @param {*} value Any value.
25844
+ * @returns {*} Returns `value`.
25845
+ * @example
25846
+ *
25847
+ * var object = { 'user': 'fred' };
25848
+ *
25849
+ * _.identity(object) === object;
25850
+ * // => true
25851
+ */
25852
+ function identity(value) {
25853
+ return value;
25854
+ }
25855
+
25856
+ /**
25857
+ * Creates a function that performs a deep comparison between a given object
25858
+ * and `source`, returning `true` if the given object has equivalent property
25859
+ * values, else `false`.
25860
+ *
25861
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
25862
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
25863
+ * their own, not inherited, enumerable properties. For comparing a single
25864
+ * own or inherited property value see `_.matchesProperty`.
25865
+ *
25866
+ * @static
25867
+ * @memberOf _
25868
+ * @category Utility
25869
+ * @param {Object} source The object of property values to match.
25870
+ * @returns {Function} Returns the new function.
25871
+ * @example
25872
+ *
25873
+ * var users = [
25874
+ * { 'user': 'barney', 'age': 36, 'active': true },
25875
+ * { 'user': 'fred', 'age': 40, 'active': false }
25876
+ * ];
25877
+ *
25878
+ * _.filter(users, _.matches({ 'age': 40, 'active': false }));
25879
+ * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
25880
+ */
25881
+ function matches(source) {
25882
+ return baseMatches(baseClone(source, true));
25883
+ }
25884
+
25885
+ /**
25886
+ * Creates a function that compares the property value of `path` on a given
25887
+ * object to `value`.
25888
+ *
25889
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
25890
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
25891
+ * their own, not inherited, enumerable properties.
25892
+ *
25893
+ * @static
25894
+ * @memberOf _
25895
+ * @category Utility
25896
+ * @param {Array|string} path The path of the property to get.
25897
+ * @param {*} srcValue The value to match.
25898
+ * @returns {Function} Returns the new function.
25899
+ * @example
25900
+ *
25901
+ * var users = [
25902
+ * { 'user': 'barney' },
25903
+ * { 'user': 'fred' }
25904
+ * ];
25905
+ *
25906
+ * _.find(users, _.matchesProperty('user', 'fred'));
25907
+ * // => { 'user': 'fred' }
25908
+ */
25909
+ function matchesProperty(path, srcValue) {
25910
+ return baseMatchesProperty(path, baseClone(srcValue, true));
25911
+ }
25912
+
25913
+ /**
25914
+ * Creates a function that invokes the method at `path` on a given object.
25915
+ * Any additional arguments are provided to the invoked method.
25916
+ *
25917
+ * @static
25918
+ * @memberOf _
25919
+ * @category Utility
25920
+ * @param {Array|string} path The path of the method to invoke.
25921
+ * @param {...*} [args] The arguments to invoke the method with.
25922
+ * @returns {Function} Returns the new function.
25923
+ * @example
25924
+ *
25925
+ * var objects = [
25926
+ * { 'a': { 'b': { 'c': _.constant(2) } } },
25927
+ * { 'a': { 'b': { 'c': _.constant(1) } } }
25928
+ * ];
25929
+ *
25930
+ * _.map(objects, _.method('a.b.c'));
25931
+ * // => [2, 1]
25932
+ *
25933
+ * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
25934
+ * // => [1, 2]
25935
+ */
25936
+ var method = restParam(function(path, args) {
25937
+ return function(object) {
25938
+ return invokePath(object, path, args);
25939
+ };
25940
+ });
25941
+
25942
+ /**
25943
+ * The opposite of `_.method`; this method creates a function that invokes
25944
+ * the method at a given path on `object`. Any additional arguments are
25945
+ * provided to the invoked method.
25946
+ *
25947
+ * @static
25948
+ * @memberOf _
25949
+ * @category Utility
25950
+ * @param {Object} object The object to query.
25951
+ * @param {...*} [args] The arguments to invoke the method with.
25952
+ * @returns {Function} Returns the new function.
25953
+ * @example
25954
+ *
25955
+ * var array = _.times(3, _.constant),
25956
+ * object = { 'a': array, 'b': array, 'c': array };
25957
+ *
25958
+ * _.map(['a[2]', 'c[0]'], _.methodOf(object));
25959
+ * // => [2, 0]
25960
+ *
25961
+ * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
25962
+ * // => [2, 0]
25963
+ */
25964
+ var methodOf = restParam(function(object, args) {
25965
+ return function(path) {
25966
+ return invokePath(object, path, args);
25967
+ };
25968
+ });
25969
+
25970
+ /**
25971
+ * Adds all own enumerable function properties of a source object to the
25972
+ * destination object. If `object` is a function then methods are added to
25973
+ * its prototype as well.
25974
+ *
25975
+ * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
25976
+ * avoid conflicts caused by modifying the original.
25977
+ *
25978
+ * @static
25979
+ * @memberOf _
25980
+ * @category Utility
25981
+ * @param {Function|Object} [object=lodash] The destination object.
25982
+ * @param {Object} source The object of functions to add.
25983
+ * @param {Object} [options] The options object.
25984
+ * @param {boolean} [options.chain=true] Specify whether the functions added
25985
+ * are chainable.
25986
+ * @returns {Function|Object} Returns `object`.
25987
+ * @example
25988
+ *
25989
+ * function vowels(string) {
25990
+ * return _.filter(string, function(v) {
25991
+ * return /[aeiou]/i.test(v);
25992
+ * });
25993
+ * }
25994
+ *
25995
+ * _.mixin({ 'vowels': vowels });
25996
+ * _.vowels('fred');
25997
+ * // => ['e']
25998
+ *
25999
+ * _('fred').vowels().value();
26000
+ * // => ['e']
26001
+ *
26002
+ * _.mixin({ 'vowels': vowels }, { 'chain': false });
26003
+ * _('fred').vowels();
26004
+ * // => ['e']
26005
+ */
26006
+ function mixin(object, source, options) {
26007
+ if (options == null) {
26008
+ var isObj = isObject(source),
26009
+ props = isObj ? keys(source) : undefined,
26010
+ methodNames = (props && props.length) ? baseFunctions(source, props) : undefined;
26011
+
26012
+ if (!(methodNames ? methodNames.length : isObj)) {
26013
+ methodNames = false;
26014
+ options = source;
26015
+ source = object;
26016
+ object = this;
26017
+ }
26018
+ }
26019
+ if (!methodNames) {
26020
+ methodNames = baseFunctions(source, keys(source));
26021
+ }
26022
+ var chain = true,
26023
+ index = -1,
26024
+ isFunc = isFunction(object),
26025
+ length = methodNames.length;
26026
+
26027
+ if (options === false) {
26028
+ chain = false;
26029
+ } else if (isObject(options) && 'chain' in options) {
26030
+ chain = options.chain;
26031
+ }
26032
+ while (++index < length) {
26033
+ var methodName = methodNames[index],
26034
+ func = source[methodName];
26035
+
26036
+ object[methodName] = func;
26037
+ if (isFunc) {
26038
+ object.prototype[methodName] = (function(func) {
26039
+ return function() {
26040
+ var chainAll = this.__chain__;
26041
+ if (chain || chainAll) {
26042
+ var result = object(this.__wrapped__),
26043
+ actions = result.__actions__ = arrayCopy(this.__actions__);
26044
+
26045
+ actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
26046
+ result.__chain__ = chainAll;
26047
+ return result;
26048
+ }
26049
+ return func.apply(object, arrayPush([this.value()], arguments));
26050
+ };
26051
+ }(func));
26052
+ }
26053
+ }
26054
+ return object;
26055
+ }
26056
+
26057
+ /**
26058
+ * Reverts the `_` variable to its previous value and returns a reference to
26059
+ * the `lodash` function.
26060
+ *
26061
+ * @static
26062
+ * @memberOf _
26063
+ * @category Utility
26064
+ * @returns {Function} Returns the `lodash` function.
26065
+ * @example
26066
+ *
26067
+ * var lodash = _.noConflict();
26068
+ */
26069
+ function noConflict() {
26070
+ root._ = oldDash;
26071
+ return this;
26072
+ }
26073
+
26074
+ /**
26075
+ * A no-operation function that returns `undefined` regardless of the
26076
+ * arguments it receives.
26077
+ *
26078
+ * @static
26079
+ * @memberOf _
26080
+ * @category Utility
26081
+ * @example
26082
+ *
26083
+ * var object = { 'user': 'fred' };
26084
+ *
26085
+ * _.noop(object) === undefined;
26086
+ * // => true
26087
+ */
26088
+ function noop() {
26089
+ // No operation performed.
26090
+ }
26091
+
26092
+ /**
26093
+ * Creates a function that returns the property value at `path` on a
26094
+ * given object.
26095
+ *
26096
+ * @static
26097
+ * @memberOf _
26098
+ * @category Utility
26099
+ * @param {Array|string} path The path of the property to get.
26100
+ * @returns {Function} Returns the new function.
26101
+ * @example
26102
+ *
26103
+ * var objects = [
26104
+ * { 'a': { 'b': { 'c': 2 } } },
26105
+ * { 'a': { 'b': { 'c': 1 } } }
26106
+ * ];
26107
+ *
26108
+ * _.map(objects, _.property('a.b.c'));
26109
+ * // => [2, 1]
26110
+ *
26111
+ * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
26112
+ * // => [1, 2]
26113
+ */
26114
+ function property(path) {
26115
+ return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
26116
+ }
26117
+
26118
+ /**
26119
+ * The opposite of `_.property`; this method creates a function that returns
26120
+ * the property value at a given path on `object`.
26121
+ *
26122
+ * @static
26123
+ * @memberOf _
26124
+ * @category Utility
26125
+ * @param {Object} object The object to query.
26126
+ * @returns {Function} Returns the new function.
26127
+ * @example
26128
+ *
26129
+ * var array = [0, 1, 2],
26130
+ * object = { 'a': array, 'b': array, 'c': array };
26131
+ *
26132
+ * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
26133
+ * // => [2, 0]
26134
+ *
26135
+ * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
26136
+ * // => [2, 0]
26137
+ */
26138
+ function propertyOf(object) {
26139
+ return function(path) {
26140
+ return baseGet(object, toPath(path), path + '');
26141
+ };
26142
+ }
26143
+
26144
+ /**
26145
+ * Creates an array of numbers (positive and/or negative) progressing from
26146
+ * `start` up to, but not including, `end`. If `end` is not specified it is
26147
+ * set to `start` with `start` then set to `0`. If `end` is less than `start`
26148
+ * a zero-length range is created unless a negative `step` is specified.
26149
+ *
26150
+ * @static
26151
+ * @memberOf _
26152
+ * @category Utility
26153
+ * @param {number} [start=0] The start of the range.
26154
+ * @param {number} end The end of the range.
26155
+ * @param {number} [step=1] The value to increment or decrement by.
26156
+ * @returns {Array} Returns the new array of numbers.
26157
+ * @example
26158
+ *
26159
+ * _.range(4);
26160
+ * // => [0, 1, 2, 3]
26161
+ *
26162
+ * _.range(1, 5);
26163
+ * // => [1, 2, 3, 4]
26164
+ *
26165
+ * _.range(0, 20, 5);
26166
+ * // => [0, 5, 10, 15]
26167
+ *
26168
+ * _.range(0, -4, -1);
26169
+ * // => [0, -1, -2, -3]
26170
+ *
26171
+ * _.range(1, 4, 0);
26172
+ * // => [1, 1, 1]
26173
+ *
26174
+ * _.range(0);
26175
+ * // => []
26176
+ */
26177
+ function range(start, end, step) {
26178
+ if (step && isIterateeCall(start, end, step)) {
26179
+ end = step = undefined;
26180
+ }
26181
+ start = +start || 0;
26182
+ step = step == null ? 1 : (+step || 0);
26183
+
26184
+ if (end == null) {
26185
+ end = start;
26186
+ start = 0;
26187
+ } else {
26188
+ end = +end || 0;
26189
+ }
26190
+ // Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
26191
+ // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
26192
+ var index = -1,
26193
+ length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
26194
+ result = Array(length);
26195
+
26196
+ while (++index < length) {
26197
+ result[index] = start;
26198
+ start += step;
26199
+ }
26200
+ return result;
26201
+ }
26202
+
26203
+ /**
26204
+ * Invokes the iteratee function `n` times, returning an array of the results
26205
+ * of each invocation. The `iteratee` is bound to `thisArg` and invoked with
26206
+ * one argument; (index).
26207
+ *
26208
+ * @static
26209
+ * @memberOf _
26210
+ * @category Utility
26211
+ * @param {number} n The number of times to invoke `iteratee`.
26212
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
26213
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
26214
+ * @returns {Array} Returns the array of results.
26215
+ * @example
26216
+ *
26217
+ * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
26218
+ * // => [3, 6, 4]
26219
+ *
26220
+ * _.times(3, function(n) {
26221
+ * mage.castSpell(n);
26222
+ * });
26223
+ * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
26224
+ *
26225
+ * _.times(3, function(n) {
26226
+ * this.cast(n);
26227
+ * }, mage);
26228
+ * // => also invokes `mage.castSpell(n)` three times
26229
+ */
26230
+ function times(n, iteratee, thisArg) {
26231
+ n = nativeFloor(n);
26232
+
26233
+ // Exit early to avoid a JSC JIT bug in Safari 8
26234
+ // where `Array(0)` is treated as `Array(1)`.
26235
+ if (n < 1 || !nativeIsFinite(n)) {
26236
+ return [];
26237
+ }
26238
+ var index = -1,
26239
+ result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
26240
+
26241
+ iteratee = bindCallback(iteratee, thisArg, 1);
26242
+ while (++index < n) {
26243
+ if (index < MAX_ARRAY_LENGTH) {
26244
+ result[index] = iteratee(index);
26245
+ } else {
26246
+ iteratee(index);
26247
+ }
26248
+ }
26249
+ return result;
26250
+ }
26251
+
26252
+ /**
26253
+ * Generates a unique ID. If `prefix` is provided the ID is appended to it.
26254
+ *
26255
+ * @static
26256
+ * @memberOf _
26257
+ * @category Utility
26258
+ * @param {string} [prefix] The value to prefix the ID with.
26259
+ * @returns {string} Returns the unique ID.
26260
+ * @example
26261
+ *
26262
+ * _.uniqueId('contact_');
26263
+ * // => 'contact_104'
26264
+ *
26265
+ * _.uniqueId();
26266
+ * // => '105'
26267
+ */
26268
+ function uniqueId(prefix) {
26269
+ var id = ++idCounter;
26270
+ return baseToString(prefix) + id;
26271
+ }
26272
+
26273
+ /*------------------------------------------------------------------------*/
26274
+
26275
+ /**
26276
+ * Adds two numbers.
26277
+ *
26278
+ * @static
26279
+ * @memberOf _
26280
+ * @category Math
26281
+ * @param {number} augend The first number to add.
26282
+ * @param {number} addend The second number to add.
26283
+ * @returns {number} Returns the sum.
26284
+ * @example
26285
+ *
26286
+ * _.add(6, 4);
26287
+ * // => 10
26288
+ */
26289
+ function add(augend, addend) {
26290
+ return (+augend || 0) + (+addend || 0);
26291
+ }
26292
+
26293
+ /**
26294
+ * Calculates `n` rounded up to `precision`.
26295
+ *
26296
+ * @static
26297
+ * @memberOf _
26298
+ * @category Math
26299
+ * @param {number} n The number to round up.
26300
+ * @param {number} [precision=0] The precision to round up to.
26301
+ * @returns {number} Returns the rounded up number.
26302
+ * @example
26303
+ *
26304
+ * _.ceil(4.006);
26305
+ * // => 5
26306
+ *
26307
+ * _.ceil(6.004, 2);
26308
+ * // => 6.01
26309
+ *
26310
+ * _.ceil(6040, -2);
26311
+ * // => 6100
26312
+ */
26313
+ var ceil = createRound('ceil');
26314
+
26315
+ /**
26316
+ * Calculates `n` rounded down to `precision`.
26317
+ *
26318
+ * @static
26319
+ * @memberOf _
26320
+ * @category Math
26321
+ * @param {number} n The number to round down.
26322
+ * @param {number} [precision=0] The precision to round down to.
26323
+ * @returns {number} Returns the rounded down number.
26324
+ * @example
26325
+ *
26326
+ * _.floor(4.006);
26327
+ * // => 4
26328
+ *
26329
+ * _.floor(0.046, 2);
26330
+ * // => 0.04
26331
+ *
26332
+ * _.floor(4060, -2);
26333
+ * // => 4000
26334
+ */
26335
+ var floor = createRound('floor');
26336
+
26337
+ /**
26338
+ * Gets the maximum value of `collection`. If `collection` is empty or falsey
26339
+ * `-Infinity` is returned. If an iteratee function is provided it is invoked
26340
+ * for each value in `collection` to generate the criterion by which the value
26341
+ * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
26342
+ * arguments: (value, index, collection).
26343
+ *
26344
+ * If a property name is provided for `iteratee` the created `_.property`
26345
+ * style callback returns the property value of the given element.
26346
+ *
26347
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
26348
+ * style callback returns `true` for elements that have a matching property
26349
+ * value, else `false`.
26350
+ *
26351
+ * If an object is provided for `iteratee` the created `_.matches` style
26352
+ * callback returns `true` for elements that have the properties of the given
26353
+ * object, else `false`.
26354
+ *
26355
+ * @static
26356
+ * @memberOf _
26357
+ * @category Math
26358
+ * @param {Array|Object|string} collection The collection to iterate over.
26359
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
26360
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
26361
+ * @returns {*} Returns the maximum value.
26362
+ * @example
26363
+ *
26364
+ * _.max([4, 2, 8, 6]);
26365
+ * // => 8
26366
+ *
26367
+ * _.max([]);
26368
+ * // => -Infinity
26369
+ *
26370
+ * var users = [
26371
+ * { 'user': 'barney', 'age': 36 },
26372
+ * { 'user': 'fred', 'age': 40 }
26373
+ * ];
26374
+ *
26375
+ * _.max(users, function(chr) {
26376
+ * return chr.age;
26377
+ * });
26378
+ * // => { 'user': 'fred', 'age': 40 }
26379
+ *
26380
+ * // using the `_.property` callback shorthand
26381
+ * _.max(users, 'age');
26382
+ * // => { 'user': 'fred', 'age': 40 }
26383
+ */
26384
+ var max = createExtremum(gt, NEGATIVE_INFINITY);
26385
+
26386
+ /**
26387
+ * Gets the minimum value of `collection`. If `collection` is empty or falsey
26388
+ * `Infinity` is returned. If an iteratee function is provided it is invoked
26389
+ * for each value in `collection` to generate the criterion by which the value
26390
+ * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
26391
+ * arguments: (value, index, collection).
26392
+ *
26393
+ * If a property name is provided for `iteratee` the created `_.property`
26394
+ * style callback returns the property value of the given element.
26395
+ *
26396
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
26397
+ * style callback returns `true` for elements that have a matching property
26398
+ * value, else `false`.
26399
+ *
26400
+ * If an object is provided for `iteratee` the created `_.matches` style
26401
+ * callback returns `true` for elements that have the properties of the given
26402
+ * object, else `false`.
26403
+ *
26404
+ * @static
26405
+ * @memberOf _
26406
+ * @category Math
26407
+ * @param {Array|Object|string} collection The collection to iterate over.
26408
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
26409
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
26410
+ * @returns {*} Returns the minimum value.
26411
+ * @example
26412
+ *
26413
+ * _.min([4, 2, 8, 6]);
26414
+ * // => 2
26415
+ *
26416
+ * _.min([]);
26417
+ * // => Infinity
26418
+ *
26419
+ * var users = [
26420
+ * { 'user': 'barney', 'age': 36 },
26421
+ * { 'user': 'fred', 'age': 40 }
26422
+ * ];
26423
+ *
26424
+ * _.min(users, function(chr) {
26425
+ * return chr.age;
26426
+ * });
26427
+ * // => { 'user': 'barney', 'age': 36 }
26428
+ *
26429
+ * // using the `_.property` callback shorthand
26430
+ * _.min(users, 'age');
26431
+ * // => { 'user': 'barney', 'age': 36 }
26432
+ */
26433
+ var min = createExtremum(lt, POSITIVE_INFINITY);
26434
+
26435
+ /**
26436
+ * Calculates `n` rounded to `precision`.
26437
+ *
26438
+ * @static
26439
+ * @memberOf _
26440
+ * @category Math
26441
+ * @param {number} n The number to round.
26442
+ * @param {number} [precision=0] The precision to round to.
26443
+ * @returns {number} Returns the rounded number.
26444
+ * @example
26445
+ *
26446
+ * _.round(4.006);
26447
+ * // => 4
26448
+ *
26449
+ * _.round(4.006, 2);
26450
+ * // => 4.01
26451
+ *
26452
+ * _.round(4060, -2);
26453
+ * // => 4100
26454
+ */
26455
+ var round = createRound('round');
26456
+
26457
+ /**
26458
+ * Gets the sum of the values in `collection`.
26459
+ *
26460
+ * @static
26461
+ * @memberOf _
26462
+ * @category Math
26463
+ * @param {Array|Object|string} collection The collection to iterate over.
26464
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
26465
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
26466
+ * @returns {number} Returns the sum.
26467
+ * @example
26468
+ *
26469
+ * _.sum([4, 6]);
26470
+ * // => 10
26471
+ *
26472
+ * _.sum({ 'a': 4, 'b': 6 });
26473
+ * // => 10
26474
+ *
26475
+ * var objects = [
26476
+ * { 'n': 4 },
26477
+ * { 'n': 6 }
26478
+ * ];
26479
+ *
26480
+ * _.sum(objects, function(object) {
26481
+ * return object.n;
26482
+ * });
26483
+ * // => 10
26484
+ *
26485
+ * // using the `_.property` callback shorthand
26486
+ * _.sum(objects, 'n');
26487
+ * // => 10
26488
+ */
26489
+ function sum(collection, iteratee, thisArg) {
26490
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
26491
+ iteratee = undefined;
26492
+ }
26493
+ iteratee = getCallback(iteratee, thisArg, 3);
26494
+ return iteratee.length == 1
26495
+ ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee)
26496
+ : baseSum(collection, iteratee);
26497
+ }
26498
+
26499
+ /*------------------------------------------------------------------------*/
26500
+
26501
+ // Ensure wrappers are instances of `baseLodash`.
26502
+ lodash.prototype = baseLodash.prototype;
26503
+
26504
+ LodashWrapper.prototype = baseCreate(baseLodash.prototype);
26505
+ LodashWrapper.prototype.constructor = LodashWrapper;
26506
+
26507
+ LazyWrapper.prototype = baseCreate(baseLodash.prototype);
26508
+ LazyWrapper.prototype.constructor = LazyWrapper;
26509
+
26510
+ // Add functions to the `Map` cache.
26511
+ MapCache.prototype['delete'] = mapDelete;
26512
+ MapCache.prototype.get = mapGet;
26513
+ MapCache.prototype.has = mapHas;
26514
+ MapCache.prototype.set = mapSet;
26515
+
26516
+ // Add functions to the `Set` cache.
26517
+ SetCache.prototype.push = cachePush;
26518
+
26519
+ // Assign cache to `_.memoize`.
26520
+ memoize.Cache = MapCache;
26521
+
26522
+ // Add functions that return wrapped values when chaining.
26523
+ lodash.after = after;
26524
+ lodash.ary = ary;
26525
+ lodash.assign = assign;
26526
+ lodash.at = at;
26527
+ lodash.before = before;
26528
+ lodash.bind = bind;
26529
+ lodash.bindAll = bindAll;
26530
+ lodash.bindKey = bindKey;
26531
+ lodash.callback = callback;
26532
+ lodash.chain = chain;
26533
+ lodash.chunk = chunk;
26534
+ lodash.compact = compact;
26535
+ lodash.constant = constant;
26536
+ lodash.countBy = countBy;
26537
+ lodash.create = create;
26538
+ lodash.curry = curry;
26539
+ lodash.curryRight = curryRight;
26540
+ lodash.debounce = debounce;
26541
+ lodash.defaults = defaults;
26542
+ lodash.defaultsDeep = defaultsDeep;
26543
+ lodash.defer = defer;
26544
+ lodash.delay = delay;
26545
+ lodash.difference = difference;
26546
+ lodash.drop = drop;
26547
+ lodash.dropRight = dropRight;
26548
+ lodash.dropRightWhile = dropRightWhile;
26549
+ lodash.dropWhile = dropWhile;
26550
+ lodash.fill = fill;
26551
+ lodash.filter = filter;
26552
+ lodash.flatten = flatten;
26553
+ lodash.flattenDeep = flattenDeep;
26554
+ lodash.flow = flow;
26555
+ lodash.flowRight = flowRight;
26556
+ lodash.forEach = forEach;
26557
+ lodash.forEachRight = forEachRight;
26558
+ lodash.forIn = forIn;
26559
+ lodash.forInRight = forInRight;
26560
+ lodash.forOwn = forOwn;
26561
+ lodash.forOwnRight = forOwnRight;
26562
+ lodash.functions = functions;
26563
+ lodash.groupBy = groupBy;
26564
+ lodash.indexBy = indexBy;
26565
+ lodash.initial = initial;
26566
+ lodash.intersection = intersection;
26567
+ lodash.invert = invert;
26568
+ lodash.invoke = invoke;
26569
+ lodash.keys = keys;
26570
+ lodash.keysIn = keysIn;
26571
+ lodash.map = map;
26572
+ lodash.mapKeys = mapKeys;
26573
+ lodash.mapValues = mapValues;
26574
+ lodash.matches = matches;
26575
+ lodash.matchesProperty = matchesProperty;
26576
+ lodash.memoize = memoize;
26577
+ lodash.merge = merge;
26578
+ lodash.method = method;
26579
+ lodash.methodOf = methodOf;
26580
+ lodash.mixin = mixin;
26581
+ lodash.modArgs = modArgs;
26582
+ lodash.negate = negate;
26583
+ lodash.omit = omit;
26584
+ lodash.once = once;
26585
+ lodash.pairs = pairs;
26586
+ lodash.partial = partial;
26587
+ lodash.partialRight = partialRight;
26588
+ lodash.partition = partition;
26589
+ lodash.pick = pick;
26590
+ lodash.pluck = pluck;
26591
+ lodash.property = property;
26592
+ lodash.propertyOf = propertyOf;
26593
+ lodash.pull = pull;
26594
+ lodash.pullAt = pullAt;
26595
+ lodash.range = range;
26596
+ lodash.rearg = rearg;
26597
+ lodash.reject = reject;
26598
+ lodash.remove = remove;
26599
+ lodash.rest = rest;
26600
+ lodash.restParam = restParam;
26601
+ lodash.set = set;
26602
+ lodash.shuffle = shuffle;
26603
+ lodash.slice = slice;
26604
+ lodash.sortBy = sortBy;
26605
+ lodash.sortByAll = sortByAll;
26606
+ lodash.sortByOrder = sortByOrder;
26607
+ lodash.spread = spread;
26608
+ lodash.take = take;
26609
+ lodash.takeRight = takeRight;
26610
+ lodash.takeRightWhile = takeRightWhile;
26611
+ lodash.takeWhile = takeWhile;
26612
+ lodash.tap = tap;
26613
+ lodash.throttle = throttle;
26614
+ lodash.thru = thru;
26615
+ lodash.times = times;
26616
+ lodash.toArray = toArray;
26617
+ lodash.toPlainObject = toPlainObject;
26618
+ lodash.transform = transform;
26619
+ lodash.union = union;
26620
+ lodash.uniq = uniq;
26621
+ lodash.unzip = unzip;
26622
+ lodash.unzipWith = unzipWith;
26623
+ lodash.values = values;
26624
+ lodash.valuesIn = valuesIn;
26625
+ lodash.where = where;
26626
+ lodash.without = without;
26627
+ lodash.wrap = wrap;
26628
+ lodash.xor = xor;
26629
+ lodash.zip = zip;
26630
+ lodash.zipObject = zipObject;
26631
+ lodash.zipWith = zipWith;
26632
+
26633
+ // Add aliases.
26634
+ lodash.backflow = flowRight;
26635
+ lodash.collect = map;
26636
+ lodash.compose = flowRight;
26637
+ lodash.each = forEach;
26638
+ lodash.eachRight = forEachRight;
26639
+ lodash.extend = assign;
26640
+ lodash.iteratee = callback;
26641
+ lodash.methods = functions;
26642
+ lodash.object = zipObject;
26643
+ lodash.select = filter;
26644
+ lodash.tail = rest;
26645
+ lodash.unique = uniq;
26646
+
26647
+ // Add functions to `lodash.prototype`.
26648
+ mixin(lodash, lodash);
26649
+
26650
+ /*------------------------------------------------------------------------*/
26651
+
26652
+ // Add functions that return unwrapped values when chaining.
26653
+ lodash.add = add;
26654
+ lodash.attempt = attempt;
26655
+ lodash.camelCase = camelCase;
26656
+ lodash.capitalize = capitalize;
26657
+ lodash.ceil = ceil;
26658
+ lodash.clone = clone;
26659
+ lodash.cloneDeep = cloneDeep;
26660
+ lodash.deburr = deburr;
26661
+ lodash.endsWith = endsWith;
26662
+ lodash.escape = escape;
26663
+ lodash.escapeRegExp = escapeRegExp;
26664
+ lodash.every = every;
26665
+ lodash.find = find;
26666
+ lodash.findIndex = findIndex;
26667
+ lodash.findKey = findKey;
26668
+ lodash.findLast = findLast;
26669
+ lodash.findLastIndex = findLastIndex;
26670
+ lodash.findLastKey = findLastKey;
26671
+ lodash.findWhere = findWhere;
26672
+ lodash.first = first;
26673
+ lodash.floor = floor;
26674
+ lodash.get = get;
26675
+ lodash.gt = gt;
26676
+ lodash.gte = gte;
26677
+ lodash.has = has;
26678
+ lodash.identity = identity;
26679
+ lodash.includes = includes;
26680
+ lodash.indexOf = indexOf;
26681
+ lodash.inRange = inRange;
26682
+ lodash.isArguments = isArguments;
26683
+ lodash.isArray = isArray;
26684
+ lodash.isBoolean = isBoolean;
26685
+ lodash.isDate = isDate;
26686
+ lodash.isElement = isElement;
26687
+ lodash.isEmpty = isEmpty;
26688
+ lodash.isEqual = isEqual;
26689
+ lodash.isError = isError;
26690
+ lodash.isFinite = isFinite;
26691
+ lodash.isFunction = isFunction;
26692
+ lodash.isMatch = isMatch;
26693
+ lodash.isNaN = isNaN;
26694
+ lodash.isNative = isNative;
26695
+ lodash.isNull = isNull;
26696
+ lodash.isNumber = isNumber;
26697
+ lodash.isObject = isObject;
26698
+ lodash.isPlainObject = isPlainObject;
26699
+ lodash.isRegExp = isRegExp;
26700
+ lodash.isString = isString;
26701
+ lodash.isTypedArray = isTypedArray;
26702
+ lodash.isUndefined = isUndefined;
26703
+ lodash.kebabCase = kebabCase;
26704
+ lodash.last = last;
26705
+ lodash.lastIndexOf = lastIndexOf;
26706
+ lodash.lt = lt;
26707
+ lodash.lte = lte;
26708
+ lodash.max = max;
26709
+ lodash.min = min;
26710
+ lodash.noConflict = noConflict;
26711
+ lodash.noop = noop;
26712
+ lodash.now = now;
26713
+ lodash.pad = pad;
26714
+ lodash.padLeft = padLeft;
26715
+ lodash.padRight = padRight;
26716
+ lodash.parseInt = parseInt;
26717
+ lodash.random = random;
26718
+ lodash.reduce = reduce;
26719
+ lodash.reduceRight = reduceRight;
26720
+ lodash.repeat = repeat;
26721
+ lodash.result = result;
26722
+ lodash.round = round;
26723
+ lodash.runInContext = runInContext;
26724
+ lodash.size = size;
26725
+ lodash.snakeCase = snakeCase;
26726
+ lodash.some = some;
26727
+ lodash.sortedIndex = sortedIndex;
26728
+ lodash.sortedLastIndex = sortedLastIndex;
26729
+ lodash.startCase = startCase;
26730
+ lodash.startsWith = startsWith;
26731
+ lodash.sum = sum;
26732
+ lodash.template = template;
26733
+ lodash.trim = trim;
26734
+ lodash.trimLeft = trimLeft;
26735
+ lodash.trimRight = trimRight;
26736
+ lodash.trunc = trunc;
26737
+ lodash.unescape = unescape;
26738
+ lodash.uniqueId = uniqueId;
26739
+ lodash.words = words;
26740
+
26741
+ // Add aliases.
26742
+ lodash.all = every;
26743
+ lodash.any = some;
26744
+ lodash.contains = includes;
26745
+ lodash.eq = isEqual;
26746
+ lodash.detect = find;
26747
+ lodash.foldl = reduce;
26748
+ lodash.foldr = reduceRight;
26749
+ lodash.head = first;
26750
+ lodash.include = includes;
26751
+ lodash.inject = reduce;
26752
+
26753
+ mixin(lodash, (function() {
26754
+ var source = {};
26755
+ baseForOwn(lodash, function(func, methodName) {
26756
+ if (!lodash.prototype[methodName]) {
26757
+ source[methodName] = func;
26758
+ }
26759
+ });
26760
+ return source;
26761
+ }()), false);
26762
+
26763
+ /*------------------------------------------------------------------------*/
26764
+
26765
+ // Add functions capable of returning wrapped and unwrapped values when chaining.
26766
+ lodash.sample = sample;
26767
+
26768
+ lodash.prototype.sample = function(n) {
26769
+ if (!this.__chain__ && n == null) {
26770
+ return sample(this.value());
26771
+ }
26772
+ return this.thru(function(value) {
26773
+ return sample(value, n);
26774
+ });
26775
+ };
26776
+
26777
+ /*------------------------------------------------------------------------*/
26778
+
26779
+ /**
26780
+ * The semantic version number.
26781
+ *
26782
+ * @static
26783
+ * @memberOf _
26784
+ * @type string
26785
+ */
26786
+ lodash.VERSION = VERSION;
26787
+
26788
+ // Assign default placeholders.
26789
+ arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
26790
+ lodash[methodName].placeholder = lodash;
26791
+ });
26792
+
26793
+ // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
26794
+ arrayEach(['drop', 'take'], function(methodName, index) {
26795
+ LazyWrapper.prototype[methodName] = function(n) {
26796
+ var filtered = this.__filtered__;
26797
+ if (filtered && !index) {
26798
+ return new LazyWrapper(this);
26799
+ }
26800
+ n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0);
26801
+
26802
+ var result = this.clone();
26803
+ if (filtered) {
26804
+ result.__takeCount__ = nativeMin(result.__takeCount__, n);
26805
+ } else {
26806
+ result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
26807
+ }
26808
+ return result;
26809
+ };
26810
+
26811
+ LazyWrapper.prototype[methodName + 'Right'] = function(n) {
26812
+ return this.reverse()[methodName](n).reverse();
26813
+ };
26814
+ });
26815
+
26816
+ // Add `LazyWrapper` methods that accept an `iteratee` value.
26817
+ arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
26818
+ var type = index + 1,
26819
+ isFilter = type != LAZY_MAP_FLAG;
26820
+
26821
+ LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
26822
+ var result = this.clone();
26823
+ result.__iteratees__.push({ 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type });
26824
+ result.__filtered__ = result.__filtered__ || isFilter;
26825
+ return result;
26826
+ };
26827
+ });
26828
+
26829
+ // Add `LazyWrapper` methods for `_.first` and `_.last`.
26830
+ arrayEach(['first', 'last'], function(methodName, index) {
26831
+ var takeName = 'take' + (index ? 'Right' : '');
26832
+
26833
+ LazyWrapper.prototype[methodName] = function() {
26834
+ return this[takeName](1).value()[0];
26835
+ };
26836
+ });
26837
+
26838
+ // Add `LazyWrapper` methods for `_.initial` and `_.rest`.
26839
+ arrayEach(['initial', 'rest'], function(methodName, index) {
26840
+ var dropName = 'drop' + (index ? '' : 'Right');
26841
+
26842
+ LazyWrapper.prototype[methodName] = function() {
26843
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
26844
+ };
26845
+ });
26846
+
26847
+ // Add `LazyWrapper` methods for `_.pluck` and `_.where`.
26848
+ arrayEach(['pluck', 'where'], function(methodName, index) {
26849
+ var operationName = index ? 'filter' : 'map',
26850
+ createCallback = index ? baseMatches : property;
26851
+
26852
+ LazyWrapper.prototype[methodName] = function(value) {
26853
+ return this[operationName](createCallback(value));
26854
+ };
26855
+ });
26856
+
26857
+ LazyWrapper.prototype.compact = function() {
26858
+ return this.filter(identity);
26859
+ };
26860
+
26861
+ LazyWrapper.prototype.reject = function(predicate, thisArg) {
26862
+ predicate = getCallback(predicate, thisArg, 1);
26863
+ return this.filter(function(value) {
26864
+ return !predicate(value);
26865
+ });
26866
+ };
26867
+
26868
+ LazyWrapper.prototype.slice = function(start, end) {
26869
+ start = start == null ? 0 : (+start || 0);
26870
+
26871
+ var result = this;
26872
+ if (result.__filtered__ && (start > 0 || end < 0)) {
26873
+ return new LazyWrapper(result);
26874
+ }
26875
+ if (start < 0) {
26876
+ result = result.takeRight(-start);
26877
+ } else if (start) {
26878
+ result = result.drop(start);
26879
+ }
26880
+ if (end !== undefined) {
26881
+ end = (+end || 0);
26882
+ result = end < 0 ? result.dropRight(-end) : result.take(end - start);
26883
+ }
26884
+ return result;
26885
+ };
26886
+
26887
+ LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) {
26888
+ return this.reverse().takeWhile(predicate, thisArg).reverse();
26889
+ };
26890
+
26891
+ LazyWrapper.prototype.toArray = function() {
26892
+ return this.take(POSITIVE_INFINITY);
26893
+ };
26894
+
26895
+ // Add `LazyWrapper` methods to `lodash.prototype`.
26896
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
26897
+ var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
26898
+ retUnwrapped = /^(?:first|last)$/.test(methodName),
26899
+ lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
26900
+
26901
+ if (!lodashFunc) {
26902
+ return;
26903
+ }
26904
+ lodash.prototype[methodName] = function() {
26905
+ var args = retUnwrapped ? [1] : arguments,
26906
+ chainAll = this.__chain__,
26907
+ value = this.__wrapped__,
26908
+ isHybrid = !!this.__actions__.length,
26909
+ isLazy = value instanceof LazyWrapper,
26910
+ iteratee = args[0],
26911
+ useLazy = isLazy || isArray(value);
26912
+
26913
+ if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
26914
+ // Avoid lazy use if the iteratee has a "length" value other than `1`.
26915
+ isLazy = useLazy = false;
26916
+ }
26917
+ var interceptor = function(value) {
26918
+ return (retUnwrapped && chainAll)
26919
+ ? lodashFunc(value, 1)[0]
26920
+ : lodashFunc.apply(undefined, arrayPush([value], args));
26921
+ };
26922
+
26923
+ var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined },
26924
+ onlyLazy = isLazy && !isHybrid;
26925
+
26926
+ if (retUnwrapped && !chainAll) {
26927
+ if (onlyLazy) {
26928
+ value = value.clone();
26929
+ value.__actions__.push(action);
26930
+ return func.call(value);
26931
+ }
26932
+ return lodashFunc.call(undefined, this.value())[0];
26933
+ }
26934
+ if (!retUnwrapped && useLazy) {
26935
+ value = onlyLazy ? value : new LazyWrapper(this);
26936
+ var result = func.apply(value, args);
26937
+ result.__actions__.push(action);
26938
+ return new LodashWrapper(result, chainAll);
26939
+ }
26940
+ return this.thru(interceptor);
26941
+ };
26942
+ });
26943
+
26944
+ // Add `Array` and `String` methods to `lodash.prototype`.
26945
+ arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
26946
+ var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
26947
+ chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
26948
+ retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
26949
+
26950
+ lodash.prototype[methodName] = function() {
26951
+ var args = arguments;
26952
+ if (retUnwrapped && !this.__chain__) {
26953
+ return func.apply(this.value(), args);
26954
+ }
26955
+ return this[chainName](function(value) {
26956
+ return func.apply(value, args);
26957
+ });
26958
+ };
26959
+ });
26960
+
26961
+ // Map minified function names to their real names.
26962
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
26963
+ var lodashFunc = lodash[methodName];
26964
+ if (lodashFunc) {
26965
+ var key = lodashFunc.name,
26966
+ names = realNames[key] || (realNames[key] = []);
26967
+
26968
+ names.push({ 'name': methodName, 'func': lodashFunc });
26969
+ }
26970
+ });
26971
+
26972
+ realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }];
26973
+
26974
+ // Add functions to the lazy wrapper.
26975
+ LazyWrapper.prototype.clone = lazyClone;
26976
+ LazyWrapper.prototype.reverse = lazyReverse;
26977
+ LazyWrapper.prototype.value = lazyValue;
26978
+
26979
+ // Add chaining functions to the `lodash` wrapper.
26980
+ lodash.prototype.chain = wrapperChain;
26981
+ lodash.prototype.commit = wrapperCommit;
26982
+ lodash.prototype.concat = wrapperConcat;
26983
+ lodash.prototype.plant = wrapperPlant;
26984
+ lodash.prototype.reverse = wrapperReverse;
26985
+ lodash.prototype.toString = wrapperToString;
26986
+ lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
26987
+
26988
+ // Add function aliases to the `lodash` wrapper.
26989
+ lodash.prototype.collect = lodash.prototype.map;
26990
+ lodash.prototype.head = lodash.prototype.first;
26991
+ lodash.prototype.select = lodash.prototype.filter;
26992
+ lodash.prototype.tail = lodash.prototype.rest;
26993
+
26994
+ return lodash;
26995
+ }
26996
+
26997
+ /*--------------------------------------------------------------------------*/
26998
+
26999
+ // Export lodash.
27000
+ var _ = runInContext();
27001
+
27002
+ // Some AMD build optimizers like r.js check for condition patterns like the following:
27003
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
27004
+ // Expose lodash to the global object when an AMD loader is present to avoid
27005
+ // errors in cases where lodash is loaded by a script tag and not intended
27006
+ // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for
27007
+ // more details.
27008
+ root._ = _;
27009
+
27010
+ // Define as an anonymous module so, through path mapping, it can be
27011
+ // referenced as the "underscore" module.
27012
+ define(function() {
27013
+ return _;
27014
+ });
27015
+ }
27016
+ // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
27017
+ else if (freeExports && freeModule) {
27018
+ // Export for Node.js or RingoJS.
27019
+ if (moduleExports) {
27020
+ (freeModule.exports = _)._ = _;
27021
+ }
27022
+ // Export for Rhino with CommonJS support.
27023
+ else {
27024
+ freeExports._ = _;
27025
+ }
27026
+ }
27027
+ else {
27028
+ // Export for a browser or Rhino.
27029
+ root._ = _;
27030
+ }
27031
+ }.call(this));
27032
+
27033
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27034
+
27035
+ },{}],189:[function(_dereq_,module,exports){
27036
+ 'use strict';
27037
+
27038
+ Object.defineProperty(exports, "__esModule", {
27039
+ value: true
27040
+ });
27041
+
27042
+ var _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
27043
+
27044
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27045
+
27046
+ var EntitySchema = function () {
27047
+ function EntitySchema(key) {
27048
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
27049
+
27050
+ _classCallCheck(this, EntitySchema);
27051
+
27052
+ if (!key || typeof key !== 'string') {
27053
+ throw new Error('A string non-empty key is required');
27054
+ }
27055
+
27056
+ this._key = key;
27057
+ this._assignEntity = options.assignEntity;
27058
+
27059
+ var idAttribute = options.idAttribute || 'id';
27060
+ this._getId = typeof idAttribute === 'function' ? idAttribute : function (x) {
27061
+ return x[idAttribute];
27062
+ };
27063
+ this._idAttribute = idAttribute;
27064
+ this._meta = options.meta;
27065
+ this._defaults = options.defaults;
27066
+ }
27067
+
27068
+ _createClass(EntitySchema, [{
27069
+ key: 'getAssignEntity',
27070
+ value: function getAssignEntity() {
27071
+ return this._assignEntity;
27072
+ }
27073
+ }, {
27074
+ key: 'getKey',
27075
+ value: function getKey() {
27076
+ return this._key;
27077
+ }
27078
+ }, {
27079
+ key: 'getId',
27080
+ value: function getId(entity) {
27081
+ return this._getId(entity);
27082
+ }
27083
+ }, {
27084
+ key: 'getIdAttribute',
27085
+ value: function getIdAttribute() {
27086
+ return this._idAttribute;
27087
+ }
27088
+ }, {
27089
+ key: 'getMeta',
27090
+ value: function getMeta(prop) {
27091
+ if (!prop || typeof prop !== 'string') {
27092
+ throw new Error('A string non-empty property name is required');
27093
+ }
27094
+ return this._meta && this._meta[prop];
27095
+ }
27096
+ }, {
27097
+ key: 'getDefaults',
27098
+ value: function getDefaults() {
27099
+ return this._defaults;
27100
+ }
27101
+ }, {
27102
+ key: 'define',
27103
+ value: function define(nestedSchema) {
27104
+ for (var key in nestedSchema) {
27105
+ if (nestedSchema.hasOwnProperty(key)) {
27106
+ this[key] = nestedSchema[key];
27107
+ }
27108
+ }
27109
+ }
27110
+ }]);
27111
+
27112
+ return EntitySchema;
27113
+ }();
27114
+
27115
+ exports.default = EntitySchema;
27116
+ },{}],190:[function(_dereq_,module,exports){
27117
+ 'use strict';
27118
+
27119
+ Object.defineProperty(exports, "__esModule", {
27120
+ value: true
27121
+ });
27122
+
27123
+ var _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
27124
+
27125
+ var _isObject = _dereq_('lodash/isObject');
27126
+
27127
+ var _isObject2 = _interopRequireDefault(_isObject);
27128
+
27129
+ var _UnionSchema = _dereq_('./UnionSchema');
27130
+
27131
+ var _UnionSchema2 = _interopRequireDefault(_UnionSchema);
27132
+
27133
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27134
+
27135
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27136
+
27137
+ var ArraySchema = function () {
27138
+ function ArraySchema(itemSchema) {
27139
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
27140
+
27141
+ _classCallCheck(this, ArraySchema);
27142
+
27143
+ if (!(0, _isObject2.default)(itemSchema)) {
27144
+ throw new Error('ArraySchema requires item schema to be an object.');
27145
+ }
27146
+
27147
+ if (options.schemaAttribute) {
27148
+ var schemaAttribute = options.schemaAttribute;
27149
+ this._itemSchema = new _UnionSchema2.default(itemSchema, { schemaAttribute: schemaAttribute });
27150
+ } else {
27151
+ this._itemSchema = itemSchema;
27152
+ }
27153
+ }
27154
+
27155
+ _createClass(ArraySchema, [{
27156
+ key: 'getItemSchema',
27157
+ value: function getItemSchema() {
27158
+ return this._itemSchema;
27159
+ }
27160
+ }]);
27161
+
27162
+ return ArraySchema;
27163
+ }();
27164
+
27165
+ exports.default = ArraySchema;
27166
+ },{"./UnionSchema":191,"lodash/isObject":268}],191:[function(_dereq_,module,exports){
27167
+ 'use strict';
27168
+
27169
+ Object.defineProperty(exports, "__esModule", {
27170
+ value: true
27171
+ });
27172
+
27173
+ var _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
27174
+
27175
+ var _isObject = _dereq_('lodash/isObject');
27176
+
27177
+ var _isObject2 = _interopRequireDefault(_isObject);
27178
+
27179
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27180
+
27181
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27182
+
27183
+ var UnionSchema = function () {
27184
+ function UnionSchema(itemSchema, options) {
27185
+ _classCallCheck(this, UnionSchema);
27186
+
27187
+ if (!(0, _isObject2.default)(itemSchema)) {
27188
+ throw new Error('UnionSchema requires item schema to be an object.');
27189
+ }
27190
+
27191
+ if (!options || !options.schemaAttribute) {
27192
+ throw new Error('UnionSchema requires schemaAttribute option.');
27193
+ }
27194
+
27195
+ this._itemSchema = itemSchema;
27196
+
27197
+ var schemaAttribute = options.schemaAttribute;
27198
+ this._getSchema = typeof schemaAttribute === 'function' ? schemaAttribute : function (x) {
27199
+ return x[schemaAttribute];
27200
+ };
27201
+ }
27202
+
27203
+ _createClass(UnionSchema, [{
27204
+ key: 'getItemSchema',
27205
+ value: function getItemSchema() {
27206
+ return this._itemSchema;
27207
+ }
27208
+ }, {
27209
+ key: 'getSchemaKey',
27210
+ value: function getSchemaKey(item) {
27211
+ return this._getSchema(item);
27212
+ }
27213
+ }]);
27214
+
27215
+ return UnionSchema;
27216
+ }();
27217
+
27218
+ exports.default = UnionSchema;
27219
+ },{"lodash/isObject":268}],192:[function(_dereq_,module,exports){
27220
+ 'use strict';
27221
+
27222
+ Object.defineProperty(exports, "__esModule", {
27223
+ value: true
27224
+ });
27225
+ exports.Schema = undefined;
27226
+
27227
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
27228
+
27229
+ exports.arrayOf = arrayOf;
27230
+ exports.valuesOf = valuesOf;
27231
+ exports.unionOf = unionOf;
27232
+ exports.normalize = normalize;
27233
+
27234
+ var _EntitySchema = _dereq_('./EntitySchema');
27235
+
27236
+ var _EntitySchema2 = _interopRequireDefault(_EntitySchema);
27237
+
27238
+ var _IterableSchema = _dereq_('./IterableSchema');
27239
+
27240
+ var _IterableSchema2 = _interopRequireDefault(_IterableSchema);
27241
+
27242
+ var _UnionSchema = _dereq_('./UnionSchema');
27243
+
27244
+ var _UnionSchema2 = _interopRequireDefault(_UnionSchema);
27245
+
27246
+ var _isEqual = _dereq_('lodash/isEqual');
27247
+
27248
+ var _isEqual2 = _interopRequireDefault(_isEqual);
27249
+
27250
+ var _isObject = _dereq_('lodash/isObject');
27251
+
27252
+ var _isObject2 = _interopRequireDefault(_isObject);
27253
+
27254
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27255
+
27256
+ function defaultAssignEntity(normalized, key, entity) {
27257
+ normalized[key] = entity;
27258
+ }
27259
+
27260
+ function visitObject(obj, schema, bag, options) {
27261
+ var _options$assignEntity = options.assignEntity;
27262
+ var assignEntity = _options$assignEntity === undefined ? defaultAssignEntity : _options$assignEntity;
27263
+
27264
+
27265
+ var defaults = schema && schema.getDefaults && schema.getDefaults();
27266
+ var schemaAssignEntity = schema && schema.getAssignEntity && schema.getAssignEntity();
27267
+ var normalized = (0, _isObject2.default)(defaults) ? _extends({}, defaults) : {};
27268
+ for (var key in obj) {
27269
+ if (obj.hasOwnProperty(key)) {
27270
+ var entity = visit(obj[key], schema[key], bag, options);
27271
+ assignEntity.call(null, normalized, key, entity, obj, schema);
27272
+ if (schemaAssignEntity) {
27273
+ schemaAssignEntity.call(null, normalized, key, entity, obj, schema);
27274
+ }
27275
+ }
27276
+ }
27277
+ return normalized;
27278
+ }
27279
+
27280
+ function defaultMapper(iterableSchema, itemSchema, bag, options) {
27281
+ return function (obj) {
27282
+ return visit(obj, itemSchema, bag, options);
27283
+ };
27284
+ }
27285
+
27286
+ function polymorphicMapper(iterableSchema, itemSchema, bag, options) {
27287
+ return function (obj) {
27288
+ var schemaKey = iterableSchema.getSchemaKey(obj);
27289
+ var result = visit(obj, itemSchema[schemaKey], bag, options);
27290
+ return { id: result, schema: schemaKey };
27291
+ };
27292
+ }
27293
+
27294
+ function visitIterable(obj, iterableSchema, bag, options) {
27295
+ var itemSchema = iterableSchema.getItemSchema();
27296
+ var curriedItemMapper = defaultMapper(iterableSchema, itemSchema, bag, options);
27297
+
27298
+ if (Array.isArray(obj)) {
27299
+ return obj.map(curriedItemMapper);
27300
+ } else {
27301
+ return Object.keys(obj).reduce(function (objMap, key) {
27302
+ objMap[key] = curriedItemMapper(obj[key]);
27303
+ return objMap;
27304
+ }, {});
27305
+ }
27306
+ }
27307
+
27308
+ function visitUnion(obj, unionSchema, bag, options) {
27309
+ var itemSchema = unionSchema.getItemSchema();
27310
+ return polymorphicMapper(unionSchema, itemSchema, bag, options)(obj);
27311
+ }
27312
+
27313
+ function defaultMergeIntoEntity(entityA, entityB, entityKey) {
27314
+ for (var key in entityB) {
27315
+ if (!entityB.hasOwnProperty(key)) {
27316
+ continue;
27317
+ }
27318
+
27319
+ if (!entityA.hasOwnProperty(key) || (0, _isEqual2.default)(entityA[key], entityB[key])) {
27320
+ entityA[key] = entityB[key];
27321
+ continue;
27322
+ }
27323
+
27324
+ console.warn('When merging two ' + entityKey + ', found unequal data in their "' + key + '" values. Using the earlier value.', entityA[key], entityB[key]);
27325
+ }
27326
+ }
27327
+
27328
+ function visitEntity(entity, entitySchema, bag, options) {
27329
+ var _options$mergeIntoEnt = options.mergeIntoEntity;
27330
+ var mergeIntoEntity = _options$mergeIntoEnt === undefined ? defaultMergeIntoEntity : _options$mergeIntoEnt;
27331
+
27332
+
27333
+ var entityKey = entitySchema.getKey();
27334
+ var id = entitySchema.getId(entity);
27335
+
27336
+ if (!bag.hasOwnProperty(entityKey)) {
27337
+ bag[entityKey] = {};
27338
+ }
27339
+
27340
+ if (!bag[entityKey].hasOwnProperty(id)) {
27341
+ bag[entityKey][id] = {};
27342
+ }
27343
+
27344
+ var stored = bag[entityKey][id];
27345
+ var normalized = visitObject(entity, entitySchema, bag, options);
27346
+ mergeIntoEntity(stored, normalized, entityKey);
27347
+
27348
+ return id;
27349
+ }
27350
+
27351
+ function visit(obj, schema, bag, options) {
27352
+ if (!(0, _isObject2.default)(obj) || !(0, _isObject2.default)(schema)) {
27353
+ return obj;
27354
+ }
27355
+
27356
+ if (schema instanceof _EntitySchema2.default) {
27357
+ return visitEntity(obj, schema, bag, options);
27358
+ } else if (schema instanceof _IterableSchema2.default) {
27359
+ return visitIterable(obj, schema, bag, options);
27360
+ } else if (schema instanceof _UnionSchema2.default) {
27361
+ return visitUnion(obj, schema, bag, options);
27362
+ } else {
27363
+ return visitObject(obj, schema, bag, options);
27364
+ }
27365
+ }
27366
+
27367
+ function arrayOf(schema, options) {
27368
+ return new _IterableSchema2.default(schema, options);
27369
+ }
27370
+
27371
+ function valuesOf(schema, options) {
27372
+ return new _IterableSchema2.default(schema, options);
27373
+ }
27374
+
27375
+ function unionOf(schema, options) {
27376
+ return new _UnionSchema2.default(schema, options);
27377
+ }
27378
+
27379
+ exports.Schema = _EntitySchema2.default;
27380
+ function normalize(obj, schema) {
27381
+ var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
27382
+
27383
+ if (!(0, _isObject2.default)(obj)) {
27384
+ throw new Error('Normalize accepts an object or an array as its input.');
27385
+ }
27386
+
27387
+ if (!(0, _isObject2.default)(schema) || Array.isArray(schema)) {
27388
+ throw new Error('Normalize accepts an object for schema.');
27389
+ }
27390
+
27391
+ var bag = {};
27392
+ var result = visit(obj, schema, bag, options);
27393
+
27394
+ return {
27395
+ entities: bag,
27396
+ result: result
27397
+ };
27398
+ }
27399
+ },{"./EntitySchema":189,"./IterableSchema":190,"./UnionSchema":191,"lodash/isEqual":265,"lodash/isObject":268}],193:[function(_dereq_,module,exports){
27400
+ var getNative = _dereq_('./_getNative'),
27401
+ root = _dereq_('./_root');
27402
+
27403
+ /* Built-in method references that are verified to be native. */
27404
+ var DataView = getNative(root, 'DataView');
27405
+
27406
+ module.exports = DataView;
27407
+
27408
+ },{"./_getNative":222,"./_root":250}],194:[function(_dereq_,module,exports){
27409
+ var hashClear = _dereq_('./_hashClear'),
27410
+ hashDelete = _dereq_('./_hashDelete'),
27411
+ hashGet = _dereq_('./_hashGet'),
27412
+ hashHas = _dereq_('./_hashHas'),
27413
+ hashSet = _dereq_('./_hashSet');
27414
+
27415
+ /**
27416
+ * Creates a hash object.
27417
+ *
27418
+ * @private
27419
+ * @constructor
27420
+ * @param {Array} [entries] The key-value pairs to cache.
27421
+ */
27422
+ function Hash(entries) {
27423
+ var index = -1,
27424
+ length = entries ? entries.length : 0;
27425
+
27426
+ this.clear();
27427
+ while (++index < length) {
27428
+ var entry = entries[index];
27429
+ this.set(entry[0], entry[1]);
27430
+ }
27431
+ }
27432
+
27433
+ // Add methods to `Hash`.
27434
+ Hash.prototype.clear = hashClear;
27435
+ Hash.prototype['delete'] = hashDelete;
27436
+ Hash.prototype.get = hashGet;
27437
+ Hash.prototype.has = hashHas;
27438
+ Hash.prototype.set = hashSet;
27439
+
27440
+ module.exports = Hash;
27441
+
27442
+ },{"./_hashClear":225,"./_hashDelete":226,"./_hashGet":227,"./_hashHas":228,"./_hashSet":229}],195:[function(_dereq_,module,exports){
27443
+ var listCacheClear = _dereq_('./_listCacheClear'),
27444
+ listCacheDelete = _dereq_('./_listCacheDelete'),
27445
+ listCacheGet = _dereq_('./_listCacheGet'),
27446
+ listCacheHas = _dereq_('./_listCacheHas'),
27447
+ listCacheSet = _dereq_('./_listCacheSet');
27448
+
27449
+ /**
27450
+ * Creates an list cache object.
27451
+ *
27452
+ * @private
27453
+ * @constructor
27454
+ * @param {Array} [entries] The key-value pairs to cache.
27455
+ */
27456
+ function ListCache(entries) {
27457
+ var index = -1,
27458
+ length = entries ? entries.length : 0;
27459
+
27460
+ this.clear();
27461
+ while (++index < length) {
27462
+ var entry = entries[index];
27463
+ this.set(entry[0], entry[1]);
27464
+ }
27465
+ }
27466
+
27467
+ // Add methods to `ListCache`.
27468
+ ListCache.prototype.clear = listCacheClear;
27469
+ ListCache.prototype['delete'] = listCacheDelete;
27470
+ ListCache.prototype.get = listCacheGet;
27471
+ ListCache.prototype.has = listCacheHas;
27472
+ ListCache.prototype.set = listCacheSet;
27473
+
27474
+ module.exports = ListCache;
27475
+
27476
+ },{"./_listCacheClear":235,"./_listCacheDelete":236,"./_listCacheGet":237,"./_listCacheHas":238,"./_listCacheSet":239}],196:[function(_dereq_,module,exports){
27477
+ var getNative = _dereq_('./_getNative'),
27478
+ root = _dereq_('./_root');
27479
+
27480
+ /* Built-in method references that are verified to be native. */
27481
+ var Map = getNative(root, 'Map');
27482
+
27483
+ module.exports = Map;
27484
+
27485
+ },{"./_getNative":222,"./_root":250}],197:[function(_dereq_,module,exports){
27486
+ var mapCacheClear = _dereq_('./_mapCacheClear'),
27487
+ mapCacheDelete = _dereq_('./_mapCacheDelete'),
27488
+ mapCacheGet = _dereq_('./_mapCacheGet'),
27489
+ mapCacheHas = _dereq_('./_mapCacheHas'),
27490
+ mapCacheSet = _dereq_('./_mapCacheSet');
27491
+
27492
+ /**
27493
+ * Creates a map cache object to store key-value pairs.
27494
+ *
27495
+ * @private
27496
+ * @constructor
27497
+ * @param {Array} [entries] The key-value pairs to cache.
27498
+ */
27499
+ function MapCache(entries) {
27500
+ var index = -1,
27501
+ length = entries ? entries.length : 0;
27502
+
27503
+ this.clear();
27504
+ while (++index < length) {
27505
+ var entry = entries[index];
27506
+ this.set(entry[0], entry[1]);
27507
+ }
27508
+ }
27509
+
27510
+ // Add methods to `MapCache`.
27511
+ MapCache.prototype.clear = mapCacheClear;
27512
+ MapCache.prototype['delete'] = mapCacheDelete;
27513
+ MapCache.prototype.get = mapCacheGet;
27514
+ MapCache.prototype.has = mapCacheHas;
27515
+ MapCache.prototype.set = mapCacheSet;
27516
+
27517
+ module.exports = MapCache;
27518
+
27519
+ },{"./_mapCacheClear":240,"./_mapCacheDelete":241,"./_mapCacheGet":242,"./_mapCacheHas":243,"./_mapCacheSet":244}],198:[function(_dereq_,module,exports){
27520
+ var getNative = _dereq_('./_getNative'),
27521
+ root = _dereq_('./_root');
27522
+
27523
+ /* Built-in method references that are verified to be native. */
27524
+ var Promise = getNative(root, 'Promise');
27525
+
27526
+ module.exports = Promise;
27527
+
27528
+ },{"./_getNative":222,"./_root":250}],199:[function(_dereq_,module,exports){
27529
+ var getNative = _dereq_('./_getNative'),
27530
+ root = _dereq_('./_root');
27531
+
27532
+ /* Built-in method references that are verified to be native. */
27533
+ var Set = getNative(root, 'Set');
27534
+
27535
+ module.exports = Set;
27536
+
27537
+ },{"./_getNative":222,"./_root":250}],200:[function(_dereq_,module,exports){
27538
+ var MapCache = _dereq_('./_MapCache'),
27539
+ setCacheAdd = _dereq_('./_setCacheAdd'),
27540
+ setCacheHas = _dereq_('./_setCacheHas');
27541
+
27542
+ /**
27543
+ *
27544
+ * Creates an array cache object to store unique values.
27545
+ *
27546
+ * @private
27547
+ * @constructor
27548
+ * @param {Array} [values] The values to cache.
27549
+ */
27550
+ function SetCache(values) {
27551
+ var index = -1,
27552
+ length = values ? values.length : 0;
27553
+
27554
+ this.__data__ = new MapCache;
27555
+ while (++index < length) {
27556
+ this.add(values[index]);
27557
+ }
27558
+ }
27559
+
27560
+ // Add methods to `SetCache`.
27561
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
27562
+ SetCache.prototype.has = setCacheHas;
27563
+
27564
+ module.exports = SetCache;
27565
+
27566
+ },{"./_MapCache":197,"./_setCacheAdd":251,"./_setCacheHas":252}],201:[function(_dereq_,module,exports){
27567
+ var ListCache = _dereq_('./_ListCache'),
27568
+ stackClear = _dereq_('./_stackClear'),
27569
+ stackDelete = _dereq_('./_stackDelete'),
27570
+ stackGet = _dereq_('./_stackGet'),
27571
+ stackHas = _dereq_('./_stackHas'),
27572
+ stackSet = _dereq_('./_stackSet');
27573
+
27574
+ /**
27575
+ * Creates a stack cache object to store key-value pairs.
27576
+ *
27577
+ * @private
27578
+ * @constructor
27579
+ * @param {Array} [entries] The key-value pairs to cache.
27580
+ */
27581
+ function Stack(entries) {
27582
+ this.__data__ = new ListCache(entries);
27583
+ }
27584
+
27585
+ // Add methods to `Stack`.
27586
+ Stack.prototype.clear = stackClear;
27587
+ Stack.prototype['delete'] = stackDelete;
27588
+ Stack.prototype.get = stackGet;
27589
+ Stack.prototype.has = stackHas;
27590
+ Stack.prototype.set = stackSet;
27591
+
27592
+ module.exports = Stack;
27593
+
27594
+ },{"./_ListCache":195,"./_stackClear":254,"./_stackDelete":255,"./_stackGet":256,"./_stackHas":257,"./_stackSet":258}],202:[function(_dereq_,module,exports){
27595
+ var root = _dereq_('./_root');
27596
+
27597
+ /** Built-in value references. */
27598
+ var Symbol = root.Symbol;
27599
+
27600
+ module.exports = Symbol;
27601
+
27602
+ },{"./_root":250}],203:[function(_dereq_,module,exports){
27603
+ var root = _dereq_('./_root');
27604
+
27605
+ /** Built-in value references. */
27606
+ var Uint8Array = root.Uint8Array;
27607
+
27608
+ module.exports = Uint8Array;
27609
+
27610
+ },{"./_root":250}],204:[function(_dereq_,module,exports){
27611
+ var getNative = _dereq_('./_getNative'),
27612
+ root = _dereq_('./_root');
27613
+
27614
+ /* Built-in method references that are verified to be native. */
27615
+ var WeakMap = getNative(root, 'WeakMap');
27616
+
27617
+ module.exports = WeakMap;
27618
+
27619
+ },{"./_getNative":222,"./_root":250}],205:[function(_dereq_,module,exports){
27620
+ arguments[4][24][0].apply(exports,arguments)
27621
+ },{"./_baseTimes":214,"./_isIndex":231,"./isArguments":261,"./isArray":262,"dup":24}],206:[function(_dereq_,module,exports){
27622
+ /**
27623
+ * A specialized version of `_.some` for arrays without support for iteratee
27624
+ * shorthands.
27625
+ *
27626
+ * @private
27627
+ * @param {Array} [array] The array to iterate over.
27628
+ * @param {Function} predicate The function invoked per iteration.
27629
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
27630
+ * else `false`.
27631
+ */
27632
+ function arraySome(array, predicate) {
27633
+ var index = -1,
27634
+ length = array ? array.length : 0;
27635
+
27636
+ while (++index < length) {
27637
+ if (predicate(array[index], index, array)) {
27638
+ return true;
27639
+ }
27640
+ }
27641
+ return false;
27642
+ }
27643
+
27644
+ module.exports = arraySome;
27645
+
27646
+ },{}],207:[function(_dereq_,module,exports){
27647
+ var eq = _dereq_('./eq');
27648
+
27649
+ /**
27650
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
27651
+ *
27652
+ * @private
27653
+ * @param {Array} array The array to inspect.
27654
+ * @param {*} key The key to search for.
27655
+ * @returns {number} Returns the index of the matched value, else `-1`.
27656
+ */
27657
+ function assocIndexOf(array, key) {
27658
+ var length = array.length;
27659
+ while (length--) {
27660
+ if (eq(array[length][0], key)) {
27661
+ return length;
27662
+ }
27663
+ }
27664
+ return -1;
27665
+ }
27666
+
27667
+ module.exports = assocIndexOf;
27668
+
27669
+ },{"./eq":260}],208:[function(_dereq_,module,exports){
27670
+ /** Used for built-in method references. */
27671
+ var objectProto = Object.prototype;
27672
+
27673
+ /**
27674
+ * Used to resolve the
27675
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
27676
+ * of values.
27677
+ */
27678
+ var objectToString = objectProto.toString;
27679
+
27680
+ /**
27681
+ * The base implementation of `getTag`.
27682
+ *
27683
+ * @private
27684
+ * @param {*} value The value to query.
27685
+ * @returns {string} Returns the `toStringTag`.
27686
+ */
27687
+ function baseGetTag(value) {
27688
+ return objectToString.call(value);
27689
+ }
27690
+
27691
+ module.exports = baseGetTag;
27692
+
27693
+ },{}],209:[function(_dereq_,module,exports){
27694
+ var baseIsEqualDeep = _dereq_('./_baseIsEqualDeep'),
27695
+ isObject = _dereq_('./isObject'),
27696
+ isObjectLike = _dereq_('./isObjectLike');
27697
+
27698
+ /**
27699
+ * The base implementation of `_.isEqual` which supports partial comparisons
27700
+ * and tracks traversed objects.
27701
+ *
27702
+ * @private
27703
+ * @param {*} value The value to compare.
27704
+ * @param {*} other The other value to compare.
27705
+ * @param {Function} [customizer] The function to customize comparisons.
27706
+ * @param {boolean} [bitmask] The bitmask of comparison flags.
27707
+ * The bitmask may be composed of the following flags:
27708
+ * 1 - Unordered comparison
27709
+ * 2 - Partial comparison
27710
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
27711
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
27712
+ */
27713
+ function baseIsEqual(value, other, customizer, bitmask, stack) {
27714
+ if (value === other) {
27715
+ return true;
27716
+ }
27717
+ if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
27718
+ return value !== value && other !== other;
27719
+ }
27720
+ return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
27721
+ }
27722
+
27723
+ module.exports = baseIsEqual;
27724
+
27725
+ },{"./_baseIsEqualDeep":210,"./isObject":268,"./isObjectLike":269}],210:[function(_dereq_,module,exports){
27726
+ var Stack = _dereq_('./_Stack'),
27727
+ equalArrays = _dereq_('./_equalArrays'),
27728
+ equalByTag = _dereq_('./_equalByTag'),
27729
+ equalObjects = _dereq_('./_equalObjects'),
27730
+ getTag = _dereq_('./_getTag'),
27731
+ isArray = _dereq_('./isArray'),
27732
+ isHostObject = _dereq_('./_isHostObject'),
27733
+ isTypedArray = _dereq_('./isTypedArray');
27734
+
27735
+ /** Used to compose bitmasks for comparison styles. */
27736
+ var PARTIAL_COMPARE_FLAG = 2;
27737
+
27738
+ /** `Object#toString` result references. */
27739
+ var argsTag = '[object Arguments]',
27740
+ arrayTag = '[object Array]',
27741
+ objectTag = '[object Object]';
27742
+
27743
+ /** Used for built-in method references. */
27744
+ var objectProto = Object.prototype;
27745
+
27746
+ /** Used to check objects for own properties. */
27747
+ var hasOwnProperty = objectProto.hasOwnProperty;
27748
+
27749
+ /**
27750
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
27751
+ * deep comparisons and tracks traversed objects enabling objects with circular
27752
+ * references to be compared.
27753
+ *
27754
+ * @private
27755
+ * @param {Object} object The object to compare.
27756
+ * @param {Object} other The other object to compare.
27757
+ * @param {Function} equalFunc The function to determine equivalents of values.
27758
+ * @param {Function} [customizer] The function to customize comparisons.
27759
+ * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
27760
+ * for more details.
27761
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
27762
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27763
+ */
27764
+ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
27765
+ var objIsArr = isArray(object),
27766
+ othIsArr = isArray(other),
27767
+ objTag = arrayTag,
27768
+ othTag = arrayTag;
27769
+
27770
+ if (!objIsArr) {
27771
+ objTag = getTag(object);
27772
+ objTag = objTag == argsTag ? objectTag : objTag;
27773
+ }
27774
+ if (!othIsArr) {
27775
+ othTag = getTag(other);
27776
+ othTag = othTag == argsTag ? objectTag : othTag;
27777
+ }
27778
+ var objIsObj = objTag == objectTag && !isHostObject(object),
27779
+ othIsObj = othTag == objectTag && !isHostObject(other),
27780
+ isSameTag = objTag == othTag;
27781
+
27782
+ if (isSameTag && !objIsObj) {
27783
+ stack || (stack = new Stack);
27784
+ return (objIsArr || isTypedArray(object))
27785
+ ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
27786
+ : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
27787
+ }
27788
+ if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
27789
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
27790
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
27791
+
27792
+ if (objIsWrapped || othIsWrapped) {
27793
+ var objUnwrapped = objIsWrapped ? object.value() : object,
27794
+ othUnwrapped = othIsWrapped ? other.value() : other;
27795
+
27796
+ stack || (stack = new Stack);
27797
+ return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
27798
+ }
27799
+ }
27800
+ if (!isSameTag) {
27801
+ return false;
27802
+ }
27803
+ stack || (stack = new Stack);
27804
+ return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
27805
+ }
27806
+
27807
+ module.exports = baseIsEqualDeep;
27808
+
27809
+ },{"./_Stack":201,"./_equalArrays":217,"./_equalByTag":218,"./_equalObjects":219,"./_getTag":223,"./_isHostObject":230,"./isArray":262,"./isTypedArray":270}],211:[function(_dereq_,module,exports){
27810
+ var isFunction = _dereq_('./isFunction'),
27811
+ isHostObject = _dereq_('./_isHostObject'),
27812
+ isMasked = _dereq_('./_isMasked'),
27813
+ isObject = _dereq_('./isObject'),
27814
+ toSource = _dereq_('./_toSource');
27815
+
27816
+ /**
27817
+ * Used to match `RegExp`
27818
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
27819
+ */
27820
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
27821
+
27822
+ /** Used to detect host constructors (Safari). */
27823
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
27824
+
27825
+ /** Used for built-in method references. */
27826
+ var funcProto = Function.prototype,
27827
+ objectProto = Object.prototype;
27828
+
27829
+ /** Used to resolve the decompiled source of functions. */
27830
+ var funcToString = funcProto.toString;
27831
+
27832
+ /** Used to check objects for own properties. */
27833
+ var hasOwnProperty = objectProto.hasOwnProperty;
27834
+
27835
+ /** Used to detect if a method is native. */
27836
+ var reIsNative = RegExp('^' +
27837
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
27838
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
27839
+ );
27840
+
27841
+ /**
27842
+ * The base implementation of `_.isNative` without bad shim checks.
27843
+ *
27844
+ * @private
27845
+ * @param {*} value The value to check.
27846
+ * @returns {boolean} Returns `true` if `value` is a native function,
27847
+ * else `false`.
27848
+ */
27849
+ function baseIsNative(value) {
27850
+ if (!isObject(value) || isMasked(value)) {
27851
+ return false;
27852
+ }
27853
+ var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
27854
+ return pattern.test(toSource(value));
27855
+ }
27856
+
27857
+ module.exports = baseIsNative;
27858
+
27859
+ },{"./_isHostObject":230,"./_isMasked":233,"./_toSource":259,"./isFunction":266,"./isObject":268}],212:[function(_dereq_,module,exports){
27860
+ var isLength = _dereq_('./isLength'),
27861
+ isObjectLike = _dereq_('./isObjectLike');
27862
+
27863
+ /** `Object#toString` result references. */
27864
+ var argsTag = '[object Arguments]',
27865
+ arrayTag = '[object Array]',
27866
+ boolTag = '[object Boolean]',
27867
+ dateTag = '[object Date]',
27868
+ errorTag = '[object Error]',
27869
+ funcTag = '[object Function]',
27870
+ mapTag = '[object Map]',
27871
+ numberTag = '[object Number]',
27872
+ objectTag = '[object Object]',
27873
+ regexpTag = '[object RegExp]',
27874
+ setTag = '[object Set]',
27875
+ stringTag = '[object String]',
27876
+ weakMapTag = '[object WeakMap]';
27877
+
27878
+ var arrayBufferTag = '[object ArrayBuffer]',
27879
+ dataViewTag = '[object DataView]',
27880
+ float32Tag = '[object Float32Array]',
27881
+ float64Tag = '[object Float64Array]',
27882
+ int8Tag = '[object Int8Array]',
27883
+ int16Tag = '[object Int16Array]',
27884
+ int32Tag = '[object Int32Array]',
27885
+ uint8Tag = '[object Uint8Array]',
27886
+ uint8ClampedTag = '[object Uint8ClampedArray]',
27887
+ uint16Tag = '[object Uint16Array]',
27888
+ uint32Tag = '[object Uint32Array]';
27889
+
27890
+ /** Used to identify `toStringTag` values of typed arrays. */
27891
+ var typedArrayTags = {};
27892
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
27893
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
27894
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
27895
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
27896
+ typedArrayTags[uint32Tag] = true;
27897
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
27898
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
27899
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
27900
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
27901
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
27902
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
27903
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
27904
+ typedArrayTags[weakMapTag] = false;
27905
+
27906
+ /** Used for built-in method references. */
27907
+ var objectProto = Object.prototype;
27908
+
27909
+ /**
27910
+ * Used to resolve the
27911
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
27912
+ * of values.
27913
+ */
27914
+ var objectToString = objectProto.toString;
27915
+
27916
+ /**
27917
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
27918
+ *
27919
+ * @private
27920
+ * @param {*} value The value to check.
27921
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
27922
+ */
27923
+ function baseIsTypedArray(value) {
27924
+ return isObjectLike(value) &&
27925
+ isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
27926
+ }
27927
+
27928
+ module.exports = baseIsTypedArray;
27929
+
27930
+ },{"./isLength":267,"./isObjectLike":269}],213:[function(_dereq_,module,exports){
27931
+ arguments[4][29][0].apply(exports,arguments)
27932
+ },{"./_isPrototype":234,"./_nativeKeys":247,"dup":29}],214:[function(_dereq_,module,exports){
27933
+ arguments[4][30][0].apply(exports,arguments)
27934
+ },{"dup":30}],215:[function(_dereq_,module,exports){
27935
+ /**
27936
+ * The base implementation of `_.unary` without support for storing metadata.
27937
+ *
27938
+ * @private
27939
+ * @param {Function} func The function to cap arguments for.
27940
+ * @returns {Function} Returns the new capped function.
27941
+ */
27942
+ function baseUnary(func) {
27943
+ return function(value) {
27944
+ return func(value);
27945
+ };
27946
+ }
27947
+
27948
+ module.exports = baseUnary;
27949
+
27950
+ },{}],216:[function(_dereq_,module,exports){
27951
+ var root = _dereq_('./_root');
27952
+
27953
+ /** Used to detect overreaching core-js shims. */
27954
+ var coreJsData = root['__core-js_shared__'];
27955
+
27956
+ module.exports = coreJsData;
27957
+
27958
+ },{"./_root":250}],217:[function(_dereq_,module,exports){
27959
+ var SetCache = _dereq_('./_SetCache'),
27960
+ arraySome = _dereq_('./_arraySome');
27961
+
27962
+ /** Used to compose bitmasks for comparison styles. */
27963
+ var UNORDERED_COMPARE_FLAG = 1,
27964
+ PARTIAL_COMPARE_FLAG = 2;
27965
+
27966
+ /**
27967
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
27968
+ * partial deep comparisons.
27969
+ *
27970
+ * @private
27971
+ * @param {Array} array The array to compare.
27972
+ * @param {Array} other The other array to compare.
27973
+ * @param {Function} equalFunc The function to determine equivalents of values.
27974
+ * @param {Function} customizer The function to customize comparisons.
27975
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
27976
+ * for more details.
27977
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
27978
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
27979
+ */
27980
+ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
27981
+ var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
27982
+ arrLength = array.length,
27983
+ othLength = other.length;
27984
+
27985
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
27986
+ return false;
27987
+ }
27988
+ // Assume cyclic values are equal.
27989
+ var stacked = stack.get(array);
27990
+ if (stacked && stack.get(other)) {
27991
+ return stacked == other;
27992
+ }
27993
+ var index = -1,
27994
+ result = true,
27995
+ seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
27996
+
27997
+ stack.set(array, other);
27998
+ stack.set(other, array);
27999
+
28000
+ // Ignore non-index properties.
28001
+ while (++index < arrLength) {
28002
+ var arrValue = array[index],
28003
+ othValue = other[index];
28004
+
28005
+ if (customizer) {
28006
+ var compared = isPartial
28007
+ ? customizer(othValue, arrValue, index, other, array, stack)
28008
+ : customizer(arrValue, othValue, index, array, other, stack);
28009
+ }
28010
+ if (compared !== undefined) {
28011
+ if (compared) {
28012
+ continue;
28013
+ }
28014
+ result = false;
28015
+ break;
28016
+ }
28017
+ // Recursively compare arrays (susceptible to call stack limits).
28018
+ if (seen) {
28019
+ if (!arraySome(other, function(othValue, othIndex) {
28020
+ if (!seen.has(othIndex) &&
28021
+ (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
28022
+ return seen.add(othIndex);
28023
+ }
28024
+ })) {
28025
+ result = false;
28026
+ break;
28027
+ }
28028
+ } else if (!(
28029
+ arrValue === othValue ||
28030
+ equalFunc(arrValue, othValue, customizer, bitmask, stack)
28031
+ )) {
28032
+ result = false;
28033
+ break;
28034
+ }
28035
+ }
28036
+ stack['delete'](array);
28037
+ stack['delete'](other);
28038
+ return result;
28039
+ }
28040
+
28041
+ module.exports = equalArrays;
28042
+
28043
+ },{"./_SetCache":200,"./_arraySome":206}],218:[function(_dereq_,module,exports){
28044
+ var Symbol = _dereq_('./_Symbol'),
28045
+ Uint8Array = _dereq_('./_Uint8Array'),
28046
+ eq = _dereq_('./eq'),
28047
+ equalArrays = _dereq_('./_equalArrays'),
28048
+ mapToArray = _dereq_('./_mapToArray'),
28049
+ setToArray = _dereq_('./_setToArray');
28050
+
28051
+ /** Used to compose bitmasks for comparison styles. */
28052
+ var UNORDERED_COMPARE_FLAG = 1,
28053
+ PARTIAL_COMPARE_FLAG = 2;
28054
+
28055
+ /** `Object#toString` result references. */
28056
+ var boolTag = '[object Boolean]',
28057
+ dateTag = '[object Date]',
28058
+ errorTag = '[object Error]',
28059
+ mapTag = '[object Map]',
28060
+ numberTag = '[object Number]',
28061
+ regexpTag = '[object RegExp]',
28062
+ setTag = '[object Set]',
28063
+ stringTag = '[object String]',
28064
+ symbolTag = '[object Symbol]';
28065
+
28066
+ var arrayBufferTag = '[object ArrayBuffer]',
28067
+ dataViewTag = '[object DataView]';
28068
+
28069
+ /** Used to convert symbols to primitives and strings. */
28070
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
28071
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
28072
+
28073
+ /**
28074
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
28075
+ * the same `toStringTag`.
28076
+ *
28077
+ * **Note:** This function only supports comparing values with tags of
28078
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
28079
+ *
28080
+ * @private
28081
+ * @param {Object} object The object to compare.
28082
+ * @param {Object} other The other object to compare.
28083
+ * @param {string} tag The `toStringTag` of the objects to compare.
28084
+ * @param {Function} equalFunc The function to determine equivalents of values.
28085
+ * @param {Function} customizer The function to customize comparisons.
28086
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
28087
+ * for more details.
28088
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
28089
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
28090
+ */
28091
+ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
28092
+ switch (tag) {
28093
+ case dataViewTag:
28094
+ if ((object.byteLength != other.byteLength) ||
28095
+ (object.byteOffset != other.byteOffset)) {
28096
+ return false;
28097
+ }
28098
+ object = object.buffer;
28099
+ other = other.buffer;
28100
+
28101
+ case arrayBufferTag:
28102
+ if ((object.byteLength != other.byteLength) ||
28103
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
28104
+ return false;
28105
+ }
28106
+ return true;
28107
+
28108
+ case boolTag:
28109
+ case dateTag:
28110
+ case numberTag:
28111
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
28112
+ // Invalid dates are coerced to `NaN`.
28113
+ return eq(+object, +other);
28114
+
28115
+ case errorTag:
28116
+ return object.name == other.name && object.message == other.message;
28117
+
28118
+ case regexpTag:
28119
+ case stringTag:
28120
+ // Coerce regexes to strings and treat strings, primitives and objects,
28121
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
28122
+ // for more details.
28123
+ return object == (other + '');
28124
+
28125
+ case mapTag:
28126
+ var convert = mapToArray;
28127
+
28128
+ case setTag:
28129
+ var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
28130
+ convert || (convert = setToArray);
28131
+
28132
+ if (object.size != other.size && !isPartial) {
28133
+ return false;
28134
+ }
28135
+ // Assume cyclic values are equal.
28136
+ var stacked = stack.get(object);
28137
+ if (stacked) {
28138
+ return stacked == other;
28139
+ }
28140
+ bitmask |= UNORDERED_COMPARE_FLAG;
28141
+
28142
+ // Recursively compare objects (susceptible to call stack limits).
28143
+ stack.set(object, other);
28144
+ var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
28145
+ stack['delete'](object);
28146
+ return result;
28147
+
28148
+ case symbolTag:
28149
+ if (symbolValueOf) {
28150
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
28151
+ }
28152
+ }
28153
+ return false;
28154
+ }
28155
+
28156
+ module.exports = equalByTag;
28157
+
28158
+ },{"./_Symbol":202,"./_Uint8Array":203,"./_equalArrays":217,"./_mapToArray":245,"./_setToArray":253,"./eq":260}],219:[function(_dereq_,module,exports){
28159
+ var keys = _dereq_('./keys');
28160
+
28161
+ /** Used to compose bitmasks for comparison styles. */
28162
+ var PARTIAL_COMPARE_FLAG = 2;
28163
+
28164
+ /** Used for built-in method references. */
28165
+ var objectProto = Object.prototype;
28166
+
28167
+ /** Used to check objects for own properties. */
28168
+ var hasOwnProperty = objectProto.hasOwnProperty;
28169
+
28170
+ /**
28171
+ * A specialized version of `baseIsEqualDeep` for objects with support for
28172
+ * partial deep comparisons.
28173
+ *
28174
+ * @private
28175
+ * @param {Object} object The object to compare.
28176
+ * @param {Object} other The other object to compare.
28177
+ * @param {Function} equalFunc The function to determine equivalents of values.
28178
+ * @param {Function} customizer The function to customize comparisons.
28179
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
28180
+ * for more details.
28181
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
28182
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
28183
+ */
28184
+ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
28185
+ var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
28186
+ objProps = keys(object),
28187
+ objLength = objProps.length,
28188
+ othProps = keys(other),
28189
+ othLength = othProps.length;
28190
+
28191
+ if (objLength != othLength && !isPartial) {
28192
+ return false;
28193
+ }
28194
+ var index = objLength;
28195
+ while (index--) {
28196
+ var key = objProps[index];
28197
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
28198
+ return false;
28199
+ }
28200
+ }
28201
+ // Assume cyclic values are equal.
28202
+ var stacked = stack.get(object);
28203
+ if (stacked && stack.get(other)) {
28204
+ return stacked == other;
28205
+ }
28206
+ var result = true;
28207
+ stack.set(object, other);
28208
+ stack.set(other, object);
28209
+
28210
+ var skipCtor = isPartial;
28211
+ while (++index < objLength) {
28212
+ key = objProps[index];
28213
+ var objValue = object[key],
28214
+ othValue = other[key];
28215
+
28216
+ if (customizer) {
28217
+ var compared = isPartial
28218
+ ? customizer(othValue, objValue, key, other, object, stack)
28219
+ : customizer(objValue, othValue, key, object, other, stack);
28220
+ }
28221
+ // Recursively compare objects (susceptible to call stack limits).
28222
+ if (!(compared === undefined
28223
+ ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
28224
+ : compared
28225
+ )) {
28226
+ result = false;
28227
+ break;
28228
+ }
28229
+ skipCtor || (skipCtor = key == 'constructor');
28230
+ }
28231
+ if (result && !skipCtor) {
28232
+ var objCtor = object.constructor,
28233
+ othCtor = other.constructor;
28234
+
28235
+ // Non `Object` object instances with different constructors are not equal.
28236
+ if (objCtor != othCtor &&
28237
+ ('constructor' in object && 'constructor' in other) &&
28238
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
28239
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
28240
+ result = false;
28241
+ }
28242
+ }
28243
+ stack['delete'](object);
28244
+ stack['delete'](other);
28245
+ return result;
28246
+ }
28247
+
28248
+ module.exports = equalObjects;
28249
+
28250
+ },{"./keys":271}],220:[function(_dereq_,module,exports){
28251
+ (function (global){
28252
+ /** Detect free variable `global` from Node.js. */
28253
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
28254
+
28255
+ module.exports = freeGlobal;
28256
+
28257
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28258
+
28259
+ },{}],221:[function(_dereq_,module,exports){
28260
+ var isKeyable = _dereq_('./_isKeyable');
28261
+
28262
+ /**
28263
+ * Gets the data for `map`.
28264
+ *
28265
+ * @private
28266
+ * @param {Object} map The map to query.
28267
+ * @param {string} key The reference key.
28268
+ * @returns {*} Returns the map data.
28269
+ */
28270
+ function getMapData(map, key) {
28271
+ var data = map.__data__;
28272
+ return isKeyable(key)
28273
+ ? data[typeof key == 'string' ? 'string' : 'hash']
28274
+ : data.map;
28275
+ }
28276
+
28277
+ module.exports = getMapData;
28278
+
28279
+ },{"./_isKeyable":232}],222:[function(_dereq_,module,exports){
28280
+ var baseIsNative = _dereq_('./_baseIsNative'),
28281
+ getValue = _dereq_('./_getValue');
28282
+
28283
+ /**
28284
+ * Gets the native function at `key` of `object`.
28285
+ *
28286
+ * @private
28287
+ * @param {Object} object The object to query.
28288
+ * @param {string} key The key of the method to get.
28289
+ * @returns {*} Returns the function if it's native, else `undefined`.
28290
+ */
28291
+ function getNative(object, key) {
28292
+ var value = getValue(object, key);
28293
+ return baseIsNative(value) ? value : undefined;
28294
+ }
28295
+
28296
+ module.exports = getNative;
28297
+
28298
+ },{"./_baseIsNative":211,"./_getValue":224}],223:[function(_dereq_,module,exports){
28299
+ var DataView = _dereq_('./_DataView'),
28300
+ Map = _dereq_('./_Map'),
28301
+ Promise = _dereq_('./_Promise'),
28302
+ Set = _dereq_('./_Set'),
28303
+ WeakMap = _dereq_('./_WeakMap'),
28304
+ baseGetTag = _dereq_('./_baseGetTag'),
28305
+ toSource = _dereq_('./_toSource');
28306
+
28307
+ /** `Object#toString` result references. */
28308
+ var mapTag = '[object Map]',
28309
+ objectTag = '[object Object]',
28310
+ promiseTag = '[object Promise]',
28311
+ setTag = '[object Set]',
28312
+ weakMapTag = '[object WeakMap]';
28313
+
28314
+ var dataViewTag = '[object DataView]';
28315
+
28316
+ /** Used for built-in method references. */
28317
+ var objectProto = Object.prototype;
28318
+
28319
+ /**
28320
+ * Used to resolve the
28321
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
28322
+ * of values.
28323
+ */
28324
+ var objectToString = objectProto.toString;
28325
+
28326
+ /** Used to detect maps, sets, and weakmaps. */
28327
+ var dataViewCtorString = toSource(DataView),
28328
+ mapCtorString = toSource(Map),
28329
+ promiseCtorString = toSource(Promise),
28330
+ setCtorString = toSource(Set),
28331
+ weakMapCtorString = toSource(WeakMap);
28332
+
28333
+ /**
28334
+ * Gets the `toStringTag` of `value`.
28335
+ *
28336
+ * @private
28337
+ * @param {*} value The value to query.
28338
+ * @returns {string} Returns the `toStringTag`.
28339
+ */
28340
+ var getTag = baseGetTag;
28341
+
28342
+ // Fallback for data views, maps, sets, and weak maps in IE 11,
28343
+ // for data views in Edge < 14, and promises in Node.js.
28344
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
28345
+ (Map && getTag(new Map) != mapTag) ||
28346
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
28347
+ (Set && getTag(new Set) != setTag) ||
28348
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
28349
+ getTag = function(value) {
28350
+ var result = objectToString.call(value),
28351
+ Ctor = result == objectTag ? value.constructor : undefined,
28352
+ ctorString = Ctor ? toSource(Ctor) : undefined;
28353
+
28354
+ if (ctorString) {
28355
+ switch (ctorString) {
28356
+ case dataViewCtorString: return dataViewTag;
28357
+ case mapCtorString: return mapTag;
28358
+ case promiseCtorString: return promiseTag;
28359
+ case setCtorString: return setTag;
28360
+ case weakMapCtorString: return weakMapTag;
28361
+ }
28362
+ }
28363
+ return result;
28364
+ };
28365
+ }
28366
+
28367
+ module.exports = getTag;
28368
+
28369
+ },{"./_DataView":193,"./_Map":196,"./_Promise":198,"./_Set":199,"./_WeakMap":204,"./_baseGetTag":208,"./_toSource":259}],224:[function(_dereq_,module,exports){
28370
+ /**
28371
+ * Gets the value at `key` of `object`.
28372
+ *
28373
+ * @private
28374
+ * @param {Object} [object] The object to query.
28375
+ * @param {string} key The key of the property to get.
28376
+ * @returns {*} Returns the property value.
28377
+ */
28378
+ function getValue(object, key) {
28379
+ return object == null ? undefined : object[key];
28380
+ }
28381
+
28382
+ module.exports = getValue;
28383
+
28384
+ },{}],225:[function(_dereq_,module,exports){
28385
+ var nativeCreate = _dereq_('./_nativeCreate');
28386
+
28387
+ /**
28388
+ * Removes all key-value entries from the hash.
28389
+ *
28390
+ * @private
28391
+ * @name clear
28392
+ * @memberOf Hash
28393
+ */
28394
+ function hashClear() {
28395
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
28396
+ }
28397
+
28398
+ module.exports = hashClear;
28399
+
28400
+ },{"./_nativeCreate":246}],226:[function(_dereq_,module,exports){
28401
+ /**
28402
+ * Removes `key` and its value from the hash.
28403
+ *
28404
+ * @private
28405
+ * @name delete
28406
+ * @memberOf Hash
28407
+ * @param {Object} hash The hash to modify.
28408
+ * @param {string} key The key of the value to remove.
28409
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
28410
+ */
28411
+ function hashDelete(key) {
28412
+ return this.has(key) && delete this.__data__[key];
28413
+ }
28414
+
28415
+ module.exports = hashDelete;
28416
+
28417
+ },{}],227:[function(_dereq_,module,exports){
28418
+ var nativeCreate = _dereq_('./_nativeCreate');
28419
+
28420
+ /** Used to stand-in for `undefined` hash values. */
28421
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
28422
+
28423
+ /** Used for built-in method references. */
28424
+ var objectProto = Object.prototype;
28425
+
28426
+ /** Used to check objects for own properties. */
28427
+ var hasOwnProperty = objectProto.hasOwnProperty;
28428
+
28429
+ /**
28430
+ * Gets the hash value for `key`.
28431
+ *
28432
+ * @private
28433
+ * @name get
28434
+ * @memberOf Hash
28435
+ * @param {string} key The key of the value to get.
28436
+ * @returns {*} Returns the entry value.
28437
+ */
28438
+ function hashGet(key) {
28439
+ var data = this.__data__;
28440
+ if (nativeCreate) {
28441
+ var result = data[key];
28442
+ return result === HASH_UNDEFINED ? undefined : result;
28443
+ }
28444
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
28445
+ }
28446
+
28447
+ module.exports = hashGet;
28448
+
28449
+ },{"./_nativeCreate":246}],228:[function(_dereq_,module,exports){
28450
+ var nativeCreate = _dereq_('./_nativeCreate');
28451
+
28452
+ /** Used for built-in method references. */
28453
+ var objectProto = Object.prototype;
28454
+
28455
+ /** Used to check objects for own properties. */
28456
+ var hasOwnProperty = objectProto.hasOwnProperty;
28457
+
28458
+ /**
28459
+ * Checks if a hash value for `key` exists.
28460
+ *
28461
+ * @private
28462
+ * @name has
28463
+ * @memberOf Hash
28464
+ * @param {string} key The key of the entry to check.
28465
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
28466
+ */
28467
+ function hashHas(key) {
28468
+ var data = this.__data__;
28469
+ return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
28470
+ }
28471
+
28472
+ module.exports = hashHas;
28473
+
28474
+ },{"./_nativeCreate":246}],229:[function(_dereq_,module,exports){
28475
+ var nativeCreate = _dereq_('./_nativeCreate');
28476
+
28477
+ /** Used to stand-in for `undefined` hash values. */
28478
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
28479
+
28480
+ /**
28481
+ * Sets the hash `key` to `value`.
28482
+ *
28483
+ * @private
28484
+ * @name set
28485
+ * @memberOf Hash
28486
+ * @param {string} key The key of the value to set.
28487
+ * @param {*} value The value to set.
28488
+ * @returns {Object} Returns the hash instance.
28489
+ */
28490
+ function hashSet(key, value) {
28491
+ var data = this.__data__;
28492
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
28493
+ return this;
28494
+ }
28495
+
28496
+ module.exports = hashSet;
28497
+
28498
+ },{"./_nativeCreate":246}],230:[function(_dereq_,module,exports){
28499
+ /**
28500
+ * Checks if `value` is a host object in IE < 9.
28501
+ *
28502
+ * @private
28503
+ * @param {*} value The value to check.
28504
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
28505
+ */
28506
+ function isHostObject(value) {
28507
+ // Many host objects are `Object` objects that can coerce to strings
28508
+ // despite having improperly defined `toString` methods.
28509
+ var result = false;
28510
+ if (value != null && typeof value.toString != 'function') {
28511
+ try {
28512
+ result = !!(value + '');
28513
+ } catch (e) {}
28514
+ }
28515
+ return result;
28516
+ }
28517
+
28518
+ module.exports = isHostObject;
28519
+
28520
+ },{}],231:[function(_dereq_,module,exports){
28521
+ arguments[4][32][0].apply(exports,arguments)
28522
+ },{"dup":32}],232:[function(_dereq_,module,exports){
28523
+ /**
28524
+ * Checks if `value` is suitable for use as unique object key.
28525
+ *
28526
+ * @private
28527
+ * @param {*} value The value to check.
28528
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
28529
+ */
28530
+ function isKeyable(value) {
28531
+ var type = typeof value;
28532
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
28533
+ ? (value !== '__proto__')
28534
+ : (value === null);
28535
+ }
28536
+
28537
+ module.exports = isKeyable;
28538
+
28539
+ },{}],233:[function(_dereq_,module,exports){
28540
+ var coreJsData = _dereq_('./_coreJsData');
28541
+
28542
+ /** Used to detect methods masquerading as native. */
28543
+ var maskSrcKey = (function() {
28544
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
28545
+ return uid ? ('Symbol(src)_1.' + uid) : '';
28546
+ }());
28547
+
28548
+ /**
28549
+ * Checks if `func` has its source masked.
28550
+ *
28551
+ * @private
28552
+ * @param {Function} func The function to check.
28553
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
28554
+ */
28555
+ function isMasked(func) {
28556
+ return !!maskSrcKey && (maskSrcKey in func);
28557
+ }
28558
+
28559
+ module.exports = isMasked;
28560
+
28561
+ },{"./_coreJsData":216}],234:[function(_dereq_,module,exports){
28562
+ arguments[4][33][0].apply(exports,arguments)
28563
+ },{"dup":33}],235:[function(_dereq_,module,exports){
28564
+ /**
28565
+ * Removes all key-value entries from the list cache.
28566
+ *
28567
+ * @private
28568
+ * @name clear
28569
+ * @memberOf ListCache
28570
+ */
28571
+ function listCacheClear() {
28572
+ this.__data__ = [];
28573
+ }
28574
+
28575
+ module.exports = listCacheClear;
28576
+
28577
+ },{}],236:[function(_dereq_,module,exports){
28578
+ var assocIndexOf = _dereq_('./_assocIndexOf');
28579
+
28580
+ /** Used for built-in method references. */
28581
+ var arrayProto = Array.prototype;
28582
+
28583
+ /** Built-in value references. */
28584
+ var splice = arrayProto.splice;
28585
+
28586
+ /**
28587
+ * Removes `key` and its value from the list cache.
28588
+ *
28589
+ * @private
28590
+ * @name delete
28591
+ * @memberOf ListCache
28592
+ * @param {string} key The key of the value to remove.
28593
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
28594
+ */
28595
+ function listCacheDelete(key) {
28596
+ var data = this.__data__,
28597
+ index = assocIndexOf(data, key);
28598
+
28599
+ if (index < 0) {
28600
+ return false;
28601
+ }
28602
+ var lastIndex = data.length - 1;
28603
+ if (index == lastIndex) {
28604
+ data.pop();
28605
+ } else {
28606
+ splice.call(data, index, 1);
28607
+ }
28608
+ return true;
28609
+ }
28610
+
28611
+ module.exports = listCacheDelete;
28612
+
28613
+ },{"./_assocIndexOf":207}],237:[function(_dereq_,module,exports){
28614
+ var assocIndexOf = _dereq_('./_assocIndexOf');
28615
+
28616
+ /**
28617
+ * Gets the list cache value for `key`.
28618
+ *
28619
+ * @private
28620
+ * @name get
28621
+ * @memberOf ListCache
28622
+ * @param {string} key The key of the value to get.
28623
+ * @returns {*} Returns the entry value.
28624
+ */
28625
+ function listCacheGet(key) {
28626
+ var data = this.__data__,
28627
+ index = assocIndexOf(data, key);
28628
+
28629
+ return index < 0 ? undefined : data[index][1];
28630
+ }
28631
+
28632
+ module.exports = listCacheGet;
28633
+
28634
+ },{"./_assocIndexOf":207}],238:[function(_dereq_,module,exports){
28635
+ var assocIndexOf = _dereq_('./_assocIndexOf');
28636
+
28637
+ /**
28638
+ * Checks if a list cache value for `key` exists.
28639
+ *
28640
+ * @private
28641
+ * @name has
28642
+ * @memberOf ListCache
28643
+ * @param {string} key The key of the entry to check.
28644
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
28645
+ */
28646
+ function listCacheHas(key) {
28647
+ return assocIndexOf(this.__data__, key) > -1;
28648
+ }
28649
+
28650
+ module.exports = listCacheHas;
28651
+
28652
+ },{"./_assocIndexOf":207}],239:[function(_dereq_,module,exports){
28653
+ var assocIndexOf = _dereq_('./_assocIndexOf');
28654
+
28655
+ /**
28656
+ * Sets the list cache `key` to `value`.
28657
+ *
28658
+ * @private
28659
+ * @name set
28660
+ * @memberOf ListCache
28661
+ * @param {string} key The key of the value to set.
28662
+ * @param {*} value The value to set.
28663
+ * @returns {Object} Returns the list cache instance.
28664
+ */
28665
+ function listCacheSet(key, value) {
28666
+ var data = this.__data__,
28667
+ index = assocIndexOf(data, key);
28668
+
28669
+ if (index < 0) {
28670
+ data.push([key, value]);
28671
+ } else {
28672
+ data[index][1] = value;
28673
+ }
28674
+ return this;
28675
+ }
28676
+
28677
+ module.exports = listCacheSet;
28678
+
28679
+ },{"./_assocIndexOf":207}],240:[function(_dereq_,module,exports){
28680
+ var Hash = _dereq_('./_Hash'),
28681
+ ListCache = _dereq_('./_ListCache'),
28682
+ Map = _dereq_('./_Map');
28683
+
28684
+ /**
28685
+ * Removes all key-value entries from the map.
28686
+ *
28687
+ * @private
28688
+ * @name clear
28689
+ * @memberOf MapCache
28690
+ */
28691
+ function mapCacheClear() {
28692
+ this.__data__ = {
28693
+ 'hash': new Hash,
28694
+ 'map': new (Map || ListCache),
28695
+ 'string': new Hash
28696
+ };
28697
+ }
28698
+
28699
+ module.exports = mapCacheClear;
28700
+
28701
+ },{"./_Hash":194,"./_ListCache":195,"./_Map":196}],241:[function(_dereq_,module,exports){
28702
+ var getMapData = _dereq_('./_getMapData');
28703
+
28704
+ /**
28705
+ * Removes `key` and its value from the map.
28706
+ *
28707
+ * @private
28708
+ * @name delete
28709
+ * @memberOf MapCache
28710
+ * @param {string} key The key of the value to remove.
28711
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
28712
+ */
28713
+ function mapCacheDelete(key) {
28714
+ return getMapData(this, key)['delete'](key);
28715
+ }
28716
+
28717
+ module.exports = mapCacheDelete;
28718
+
28719
+ },{"./_getMapData":221}],242:[function(_dereq_,module,exports){
28720
+ var getMapData = _dereq_('./_getMapData');
28721
+
28722
+ /**
28723
+ * Gets the map value for `key`.
28724
+ *
28725
+ * @private
28726
+ * @name get
28727
+ * @memberOf MapCache
28728
+ * @param {string} key The key of the value to get.
28729
+ * @returns {*} Returns the entry value.
28730
+ */
28731
+ function mapCacheGet(key) {
28732
+ return getMapData(this, key).get(key);
28733
+ }
28734
+
28735
+ module.exports = mapCacheGet;
28736
+
28737
+ },{"./_getMapData":221}],243:[function(_dereq_,module,exports){
28738
+ var getMapData = _dereq_('./_getMapData');
28739
+
28740
+ /**
28741
+ * Checks if a map value for `key` exists.
28742
+ *
28743
+ * @private
28744
+ * @name has
28745
+ * @memberOf MapCache
28746
+ * @param {string} key The key of the entry to check.
28747
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
28748
+ */
28749
+ function mapCacheHas(key) {
28750
+ return getMapData(this, key).has(key);
28751
+ }
28752
+
28753
+ module.exports = mapCacheHas;
28754
+
28755
+ },{"./_getMapData":221}],244:[function(_dereq_,module,exports){
28756
+ var getMapData = _dereq_('./_getMapData');
28757
+
28758
+ /**
28759
+ * Sets the map `key` to `value`.
28760
+ *
28761
+ * @private
28762
+ * @name set
28763
+ * @memberOf MapCache
28764
+ * @param {string} key The key of the value to set.
28765
+ * @param {*} value The value to set.
28766
+ * @returns {Object} Returns the map cache instance.
28767
+ */
28768
+ function mapCacheSet(key, value) {
28769
+ getMapData(this, key).set(key, value);
28770
+ return this;
28771
+ }
28772
+
28773
+ module.exports = mapCacheSet;
28774
+
28775
+ },{"./_getMapData":221}],245:[function(_dereq_,module,exports){
28776
+ /**
28777
+ * Converts `map` to its key-value pairs.
28778
+ *
28779
+ * @private
28780
+ * @param {Object} map The map to convert.
28781
+ * @returns {Array} Returns the key-value pairs.
28782
+ */
28783
+ function mapToArray(map) {
28784
+ var index = -1,
28785
+ result = Array(map.size);
28786
+
28787
+ map.forEach(function(value, key) {
28788
+ result[++index] = [key, value];
28789
+ });
28790
+ return result;
28791
+ }
28792
+
28793
+ module.exports = mapToArray;
28794
+
28795
+ },{}],246:[function(_dereq_,module,exports){
28796
+ var getNative = _dereq_('./_getNative');
28797
+
28798
+ /* Built-in method references that are verified to be native. */
28799
+ var nativeCreate = getNative(Object, 'create');
28800
+
28801
+ module.exports = nativeCreate;
28802
+
28803
+ },{"./_getNative":222}],247:[function(_dereq_,module,exports){
28804
+ arguments[4][34][0].apply(exports,arguments)
28805
+ },{"./_overArg":249,"dup":34}],248:[function(_dereq_,module,exports){
28806
+ var freeGlobal = _dereq_('./_freeGlobal');
28807
+
28808
+ /** Detect free variable `exports`. */
28809
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
28810
+
28811
+ /** Detect free variable `module`. */
28812
+ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
28813
+
28814
+ /** Detect the popular CommonJS extension `module.exports`. */
28815
+ var moduleExports = freeModule && freeModule.exports === freeExports;
28816
+
28817
+ /** Detect free variable `process` from Node.js. */
28818
+ var freeProcess = moduleExports && freeGlobal.process;
28819
+
28820
+ /** Used to access faster Node.js helpers. */
28821
+ var nodeUtil = (function() {
28822
+ try {
28823
+ return freeProcess && freeProcess.binding('util');
28824
+ } catch (e) {}
28825
+ }());
28826
+
28827
+ module.exports = nodeUtil;
28828
+
28829
+ },{"./_freeGlobal":220}],249:[function(_dereq_,module,exports){
28830
+ arguments[4][35][0].apply(exports,arguments)
28831
+ },{"dup":35}],250:[function(_dereq_,module,exports){
28832
+ var freeGlobal = _dereq_('./_freeGlobal');
28833
+
28834
+ /** Detect free variable `self`. */
28835
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
28836
+
28837
+ /** Used as a reference to the global object. */
28838
+ var root = freeGlobal || freeSelf || Function('return this')();
28839
+
28840
+ module.exports = root;
28841
+
28842
+ },{"./_freeGlobal":220}],251:[function(_dereq_,module,exports){
28843
+ /** Used to stand-in for `undefined` hash values. */
28844
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
28845
+
28846
+ /**
28847
+ * Adds `value` to the array cache.
28848
+ *
28849
+ * @private
28850
+ * @name add
28851
+ * @memberOf SetCache
28852
+ * @alias push
28853
+ * @param {*} value The value to cache.
28854
+ * @returns {Object} Returns the cache instance.
28855
+ */
28856
+ function setCacheAdd(value) {
28857
+ this.__data__.set(value, HASH_UNDEFINED);
28858
+ return this;
28859
+ }
28860
+
28861
+ module.exports = setCacheAdd;
28862
+
28863
+ },{}],252:[function(_dereq_,module,exports){
28864
+ /**
28865
+ * Checks if `value` is in the array cache.
28866
+ *
28867
+ * @private
28868
+ * @name has
28869
+ * @memberOf SetCache
28870
+ * @param {*} value The value to search for.
28871
+ * @returns {number} Returns `true` if `value` is found, else `false`.
28872
+ */
28873
+ function setCacheHas(value) {
28874
+ return this.__data__.has(value);
28875
+ }
28876
+
28877
+ module.exports = setCacheHas;
28878
+
28879
+ },{}],253:[function(_dereq_,module,exports){
28880
+ /**
28881
+ * Converts `set` to an array of its values.
28882
+ *
28883
+ * @private
28884
+ * @param {Object} set The set to convert.
28885
+ * @returns {Array} Returns the values.
28886
+ */
28887
+ function setToArray(set) {
28888
+ var index = -1,
28889
+ result = Array(set.size);
28890
+
28891
+ set.forEach(function(value) {
28892
+ result[++index] = value;
28893
+ });
28894
+ return result;
28895
+ }
28896
+
28897
+ module.exports = setToArray;
28898
+
28899
+ },{}],254:[function(_dereq_,module,exports){
28900
+ var ListCache = _dereq_('./_ListCache');
28901
+
28902
+ /**
28903
+ * Removes all key-value entries from the stack.
28904
+ *
28905
+ * @private
28906
+ * @name clear
28907
+ * @memberOf Stack
28908
+ */
28909
+ function stackClear() {
28910
+ this.__data__ = new ListCache;
28911
+ }
28912
+
28913
+ module.exports = stackClear;
28914
+
28915
+ },{"./_ListCache":195}],255:[function(_dereq_,module,exports){
28916
+ /**
28917
+ * Removes `key` and its value from the stack.
28918
+ *
28919
+ * @private
28920
+ * @name delete
28921
+ * @memberOf Stack
28922
+ * @param {string} key The key of the value to remove.
28923
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
28924
+ */
28925
+ function stackDelete(key) {
28926
+ return this.__data__['delete'](key);
28927
+ }
28928
+
28929
+ module.exports = stackDelete;
28930
+
28931
+ },{}],256:[function(_dereq_,module,exports){
28932
+ /**
28933
+ * Gets the stack value for `key`.
28934
+ *
28935
+ * @private
28936
+ * @name get
28937
+ * @memberOf Stack
28938
+ * @param {string} key The key of the value to get.
28939
+ * @returns {*} Returns the entry value.
28940
+ */
28941
+ function stackGet(key) {
28942
+ return this.__data__.get(key);
28943
+ }
28944
+
28945
+ module.exports = stackGet;
28946
+
28947
+ },{}],257:[function(_dereq_,module,exports){
28948
+ /**
28949
+ * Checks if a stack value for `key` exists.
28950
+ *
28951
+ * @private
28952
+ * @name has
28953
+ * @memberOf Stack
28954
+ * @param {string} key The key of the entry to check.
28955
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
28956
+ */
28957
+ function stackHas(key) {
28958
+ return this.__data__.has(key);
28959
+ }
28960
+
28961
+ module.exports = stackHas;
28962
+
28963
+ },{}],258:[function(_dereq_,module,exports){
28964
+ var ListCache = _dereq_('./_ListCache'),
28965
+ Map = _dereq_('./_Map'),
28966
+ MapCache = _dereq_('./_MapCache');
28967
+
28968
+ /** Used as the size to enable large array optimizations. */
28969
+ var LARGE_ARRAY_SIZE = 200;
28970
+
28971
+ /**
28972
+ * Sets the stack `key` to `value`.
28973
+ *
28974
+ * @private
28975
+ * @name set
28976
+ * @memberOf Stack
28977
+ * @param {string} key The key of the value to set.
28978
+ * @param {*} value The value to set.
28979
+ * @returns {Object} Returns the stack cache instance.
28980
+ */
28981
+ function stackSet(key, value) {
28982
+ var cache = this.__data__;
28983
+ if (cache instanceof ListCache) {
28984
+ var pairs = cache.__data__;
28985
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
28986
+ pairs.push([key, value]);
28987
+ return this;
28988
+ }
28989
+ cache = this.__data__ = new MapCache(pairs);
28990
+ }
28991
+ cache.set(key, value);
28992
+ return this;
28993
+ }
28994
+
28995
+ module.exports = stackSet;
28996
+
28997
+ },{"./_ListCache":195,"./_Map":196,"./_MapCache":197}],259:[function(_dereq_,module,exports){
28998
+ /** Used for built-in method references. */
28999
+ var funcProto = Function.prototype;
29000
+
29001
+ /** Used to resolve the decompiled source of functions. */
29002
+ var funcToString = funcProto.toString;
29003
+
29004
+ /**
29005
+ * Converts `func` to its source code.
29006
+ *
29007
+ * @private
29008
+ * @param {Function} func The function to process.
29009
+ * @returns {string} Returns the source code.
29010
+ */
29011
+ function toSource(func) {
29012
+ if (func != null) {
29013
+ try {
29014
+ return funcToString.call(func);
29015
+ } catch (e) {}
29016
+ try {
29017
+ return (func + '');
29018
+ } catch (e) {}
29019
+ }
29020
+ return '';
29021
+ }
29022
+
29023
+ module.exports = toSource;
29024
+
29025
+ },{}],260:[function(_dereq_,module,exports){
29026
+ /**
29027
+ * Performs a
29028
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
29029
+ * comparison between two values to determine if they are equivalent.
29030
+ *
29031
+ * @static
29032
+ * @memberOf _
29033
+ * @since 4.0.0
29034
+ * @category Lang
29035
+ * @param {*} value The value to compare.
29036
+ * @param {*} other The other value to compare.
29037
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
29038
+ * @example
29039
+ *
29040
+ * var object = { 'a': 1 };
29041
+ * var other = { 'a': 1 };
29042
+ *
29043
+ * _.eq(object, object);
29044
+ * // => true
29045
+ *
29046
+ * _.eq(object, other);
29047
+ * // => false
29048
+ *
29049
+ * _.eq('a', 'a');
29050
+ * // => true
29051
+ *
29052
+ * _.eq('a', Object('a'));
29053
+ * // => false
29054
+ *
29055
+ * _.eq(NaN, NaN);
29056
+ * // => true
29057
+ */
29058
+ function eq(value, other) {
29059
+ return value === other || (value !== value && other !== other);
29060
+ }
29061
+
29062
+ module.exports = eq;
29063
+
29064
+ },{}],261:[function(_dereq_,module,exports){
29065
+ arguments[4][37][0].apply(exports,arguments)
29066
+ },{"./isArrayLikeObject":264,"dup":37}],262:[function(_dereq_,module,exports){
29067
+ arguments[4][38][0].apply(exports,arguments)
29068
+ },{"dup":38}],263:[function(_dereq_,module,exports){
29069
+ arguments[4][39][0].apply(exports,arguments)
29070
+ },{"./isFunction":266,"./isLength":267,"dup":39}],264:[function(_dereq_,module,exports){
29071
+ arguments[4][40][0].apply(exports,arguments)
29072
+ },{"./isArrayLike":263,"./isObjectLike":269,"dup":40}],265:[function(_dereq_,module,exports){
29073
+ var baseIsEqual = _dereq_('./_baseIsEqual');
29074
+
29075
+ /**
29076
+ * Performs a deep comparison between two values to determine if they are
29077
+ * equivalent.
29078
+ *
29079
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
29080
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
29081
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
29082
+ * by their own, not inherited, enumerable properties. Functions and DOM
29083
+ * nodes are **not** supported.
29084
+ *
29085
+ * @static
29086
+ * @memberOf _
29087
+ * @since 0.1.0
29088
+ * @category Lang
29089
+ * @param {*} value The value to compare.
29090
+ * @param {*} other The other value to compare.
29091
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
29092
+ * @example
29093
+ *
29094
+ * var object = { 'a': 1 };
29095
+ * var other = { 'a': 1 };
29096
+ *
29097
+ * _.isEqual(object, other);
29098
+ * // => true
29099
+ *
29100
+ * object === other;
29101
+ * // => false
29102
+ */
29103
+ function isEqual(value, other) {
29104
+ return baseIsEqual(value, other);
29105
+ }
29106
+
29107
+ module.exports = isEqual;
29108
+
29109
+ },{"./_baseIsEqual":209}],266:[function(_dereq_,module,exports){
29110
+ arguments[4][41][0].apply(exports,arguments)
29111
+ },{"./isObject":268,"dup":41}],267:[function(_dereq_,module,exports){
29112
+ arguments[4][42][0].apply(exports,arguments)
29113
+ },{"dup":42}],268:[function(_dereq_,module,exports){
29114
+ arguments[4][43][0].apply(exports,arguments)
29115
+ },{"dup":43}],269:[function(