Changeset 253 for binary-improvements


Ignore:
Timestamp:
Dec 12, 2015, 4:08:53 PM (4 years ago)
Author:
alloc
Message:

Fixes 6_8_10

Location:
binary-improvements
Files:
4 added
2 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/7dtd-binaries/README.txt

    r251 r253  
    11Put the Assembly-CSharp.dll, Assembly-CSharp-firstpass.dll, LogLibrary.dll, mscorlib.dll,
    2 System.dll, System.Drawing.dll, System.Xml.dll and UnityEngine.dll from your dedicated server in this folder.
     2System.dll, System.Xml.dll and UnityEngine.dll from your dedicated server in this folder.
    33
  • binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj

    r251 r253  
    4646      <Private>False</Private>
    4747    </Reference>
    48     <Reference Include="System.Drawing">
    49       <HintPath>..\7dtd-binaries\System.Drawing.dll</HintPath>
    50       <Private>False</Private>
    51     </Reference>
    5248    <Reference Include="UnityEngine">
    5349      <HintPath>..\7dtd-binaries\UnityEngine.dll</HintPath>
     
    9288    <Compile Include="src\API.cs" />
    9389    <Compile Include="src\ChatHookExample.cs" />
    94     <Compile Include="src\PetesUtils.cs" />
     90    <Compile Include="src\AllocsUtils.cs" />
     91    <Compile Include="src\LandClaimList.cs" />
    9592  </ItemGroup>
    9693  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • binary-improvements/7dtd-server-fixes/ModInfo.xml

    r250 r253  
    55                <Description value="Common functions" />
    66                <Author value="Christian 'Alloc' Illy" />
    7                 <Version value="7" />
     7                <Version value="8" />
    88                <Website value="http://7dtd.illy.bz" />
    99        </ModInfo>
  • binary-improvements/7dtd-server-fixes/src/PersistentData/InvItem.cs

    r251 r253  
    55{
    66        [Serializable]
    7         public class InvItem
    8         {
     7        public class InvItem {
    98                public string itemName;
    109                public int count;
    1110                public int quality;
    1211                public InvItem[] parts;
    13         public string icon = "";
    14         public string iconcolor = "";
     12                public string icon = "";
     13                public string iconcolor = "";
    1514
    16                 public InvItem (string itemName, int count, int quality = -1)
    17                 {
     15                public InvItem (string itemName, int count, int quality = -1) {
    1816                        this.itemName = itemName;
    1917                        this.count = count;
  • binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs

    r251 r253  
    5959                private InvItem CreateInvItem (ItemValue _itemValue, int _count, int _playerId) {
    6060                        if (_count > 0 && _itemValue != null && !_itemValue.Equals (ItemValue.None)) {
    61                                 int maxAllowed = ItemClass.list [_itemValue.type].Stacknumber.Value;
    62                                 string name = ItemClass.list [_itemValue.type].GetItemName ();
     61                                ItemClass itemClass = ItemClass.list [_itemValue.type];
     62                                int maxAllowed = itemClass.Stacknumber.Value;
     63                                string name = itemClass.GetItemName ();
    6364
    6465                                if (_count > maxAllowed) {
     
    7374                                }
    7475
    75                 // Figure out the icon's name
    76                 string icon_name = "";
     76                                item.icon = itemClass.GetIconName ();
    7777
    78                 ItemClass item_class = ItemClass.list [_itemValue.type];
    79 
    80                 if (!PetesUtils.ValidText (icon_name)) {
    81                     try {
    82                         icon_name = item_class.GetIconName ();
    83                     }
    84                     catch { }
    85                 }
    86 
    87                 if (!PetesUtils.ValidText (icon_name)) {
    88                     try {
    89                         icon_name = item_class.MeshFile;
    90                     }
    91                     catch { }
    92                 }
    93 
    94                 if (!PetesUtils.ValidText (icon_name)) {
    95                     try {
    96                         icon_name = item_class.DropMeshFile;
    97                     }
    98                     catch { }
    99                 }
    100 
    101                 if (!PetesUtils.ValidText (icon_name))
    102                     icon_name = item_class.GetItemName ();
    103 
    104                 if (icon_name.Contains ("\\"))
    105                     icon_name = icon_name.Substring (icon_name.LastIndexOf ("\"") + 1);
    106 
    107                 item.icon = icon_name;
    108 
    109                 try {
    110                     item.iconcolor = item_class.CustomIconTint.ToHexStringRGB ();
    111                 }
    112                 catch {
    113                     item.iconcolor = "FFFFFF";
    114                 }
     78                                item.iconcolor = AllocsUtils.ColorToHex (itemClass.GetIconTint ());
    11579                   
    11680                                return item;
  • binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs

    r238 r253  
    9696                }
    9797
     98                public bool LandProtectionActive {
     99                        get {
     100                                return GameManager.Instance.World.IsLandProtectionValidForPlayer (GameManager.Instance.GetPersistentPlayerList ().GetPlayerData (SteamID));
     101                        }
     102                }
     103
     104                public float LandProtectionMultiplier {
     105                        get {
     106                                return GameManager.Instance.World.GetLandProtectionHardnessModifierForPlayer (GameManager.Instance.GetPersistentPlayerList ().GetPlayerData (SteamID));
     107                        }
     108                }
     109
    98110                public uint Experience {
    99111                        get {
  • binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs

    r251 r253  
    66namespace AllocsFixes.PersistentData
    77{
    8     [Serializable]
    9         public class Players
    10         {
     8        [Serializable]
     9        public class Players {
    1110                private Dictionary<string, Player> players = new Dictionary<string, Player> ();
    1211
    1312                public Player this [string steamId, bool create] {
    1413                        get {
    15                                 if (players.ContainsKey (steamId))
     14                                if (players.ContainsKey (steamId)) {
    1615                                        return players [steamId];
    17                                 else {
     16                                } else {
    1817                                        if (create && steamId != null && steamId.Length == 17) {
    1918                                                Log.Out ("Created new player entry for ID: " + steamId);
     
    4443//              }
    4544
    46                 public string GetSteamID (string _nameOrId, bool _ignoreColorCodes)
    47                 {
    48                         if (_nameOrId == null || _nameOrId.Length == 0)
     45                public string GetSteamID (string _nameOrId, bool _ignoreColorCodes) {
     46                        if (_nameOrId == null || _nameOrId.Length == 0) {
    4947                                return null;
     48                        }
    5049
    5150                        long tempLong;
  • binary-improvements/AllocsCommands/AllocsCommands.csproj

    r251 r253  
    5353    <Compile Include="Commands\ListItems.cs" />
    5454    <Compile Include="Commands\ExportItemIcons.cs" />
     55    <Compile Include="Commands\BuffPlayer.cs" />
     56    <Compile Include="Commands\DebuffPlayer.cs" />
    5557  </ItemGroup>
    5658  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • binary-improvements/AllocsCommands/Commands/ListLandProtection.cs

    r238 r253  
    8686                                }
    8787
    88                                 Dictionary<Vector3i, PersistentPlayerData> d = ppl.m_lpBlockMap;
    89                                 if (d != null) {
    90                                         Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> ();
    91                                         foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) {
    92                                                 if (!onlyCloseToPlayer || (Math.Abs (kvp.Key.x - closeTo.x) <= closeToDistance && Math.Abs (kvp.Key.z - closeTo.z) <= closeToDistance)) {
    93                                                         if (!owners.ContainsKey (kvp.Value)) {
    94                                                                 owners.Add (kvp.Value, new List<Vector3i> ());
    95                                                         }
    96                                                         owners [kvp.Value].Add (kvp.Key);
    97                                                 }
    98                                         }
    9988
    100                                         foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) {
    101                                                 if (steamIdFilter.Length == 0 || kvp.Key.PlayerId.Equals (steamIdFilter)) {
    102                                                         PersistentData.Player p = PersistentData.PersistentContainer.Instance.Players [kvp.Key.PlayerId, false];
    103                                                         string name = string.Empty;
    104                                                         if (p != null) {
    105                                                                 name = p.Name;
    106                                                         }
    107                                                         name += " (" + kvp.Key.PlayerId + ")";
     89                                LandClaimList.OwnerFilter[] ownerFilters = null;
     90                                if (!string.IsNullOrEmpty (steamIdFilter)) {
     91                                        ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (steamIdFilter) };
     92                                }
     93                                LandClaimList.PositionFilter[] posFilters = null;
     94                                if (onlyCloseToPlayer) {
     95                                        posFilters = new LandClaimList.PositionFilter[] { LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance) };
     96                                }
    10897
    109                                                         SdtdConsole.Instance.Output (String.Format ("Player \"{0}\" owns {3} keystones (protected: {1}, current hardness multiplier: {2})", name, w.IsLandProtectionValidForPlayer (kvp.Key), w.GetLandProtectionHardnessModifierForPlayer (kvp.Key), kvp.Value.Count));
    110                                                         if (!summaryOnly) {
    111                                                                 foreach (Vector3i v in kvp.Value) {
    112                                                                         SdtdConsole.Instance.Output ("   (" + v.ToString () + ")");
    113                                                                 }
    114                                                         }
     98                                Dictionary<PersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters);
     99
     100                                foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) {
     101                                        SdtdConsole.Instance.Output (String.Format (
     102                                                "Player \"{0} ({1})\" owns {4} keystones (protected: {2}, current hardness multiplier: {3})",
     103                                                kvp.Key.Name,
     104                                                kvp.Key.SteamID,
     105                                                kvp.Key.LandProtectionActive,
     106                                                kvp.Key.LandProtectionMultiplier,
     107                                                kvp.Value.Count));
     108                                        if (!summaryOnly) {
     109                                                foreach (Vector3i v in kvp.Value) {
     110                                                        SdtdConsole.Instance.Output ("   (" + v.ToString () + ")");
    115111                                                }
    116112                                        }
     
    118114
    119115                                if (steamIdFilter.Length == 0)
    120                                         SdtdConsole.Instance.Output ("Total of " + d.Count + " keystones in the game");
     116                                        SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game");
    121117                        } catch (Exception e) {
    122118                                Log.Out ("Error in ListLandProtection.Run: " + e);
  • binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs

    r238 r253  
    4040                                List<BlockChangeInfo> changes = new List<BlockChangeInfo> ();
    4141                                foreach (Vector3i pos in ppl.Players[_id].LPBlocks) {
    42                                         BlockChangeInfo bci = new BlockChangeInfo (pos, 0, true);
     42                                        BlockChangeInfo bci = new BlockChangeInfo (pos, new BlockValue (0), true);
    4343                                        changes.Add (bci);
    4444                                }
     
    7979                                }
    8080
    81                                 BlockChangeInfo bci = new BlockChangeInfo (v, 0, true);
     81                                BlockChangeInfo bci = new BlockChangeInfo (v, new BlockValue (0), true);
    8282
    8383                                List<BlockChangeInfo> changes = new List<BlockChangeInfo> ();
  • binary-improvements/AllocsCommands/Commands/ShowInventory.cs

    r250 r253  
    66{
    77        public class ShowInventory : ConsoleCmdAbstract {
     8
    89                public override string GetDescription () {
    910                        return "list inventory of a given player";
     
    6970
    7071                private void PrintEquipment (InvItem[] _equipment) {
    71                         AddEquipment ("head", _equipment, XMLData.Item.EnumEquipmentSlot.Head, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    72                         AddEquipment ("eyes", _equipment, XMLData.Item.EnumEquipmentSlot.Eyes, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    73                         AddEquipment ("face", _equipment, XMLData.Item.EnumEquipmentSlot.Face, NGuiInvGridEquipment.EnumClothingLayer.Middle);
     72                        AddEquipment ("head", _equipment, EquipmentSlots.Headgear);
     73                        AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear);
     74                        AddEquipment ("face", _equipment, EquipmentSlots.Face);
    7475
    75                         AddEquipment ("armor", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Outer);
    76                         AddEquipment ("jacket", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    77                         AddEquipment ("shirt", _equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Inner);
     76                        AddEquipment ("armor", _equipment, EquipmentSlots.ChestArmor);
     77                        AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket);
     78                        AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt);
    7879
    79                         AddEquipment ("legarmor", _equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Outer);
    80                         AddEquipment ("pants", _equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Inner);
    81                         AddEquipment ("boots", _equipment, XMLData.Item.EnumEquipmentSlot.Feet, NGuiInvGridEquipment.EnumClothingLayer.Inner);
     80                        AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor);
     81                        AddEquipment ("pants", _equipment, EquipmentSlots.Legs);
     82                        AddEquipment ("boots", _equipment, EquipmentSlots.Feet);
    8283
    83                         AddEquipment ("gloves", _equipment, XMLData.Item.EnumEquipmentSlot.Hands, NGuiInvGridEquipment.EnumClothingLayer.Inner);
    84                         AddEquipment ("backpack", _equipment, XMLData.Item.EnumEquipmentSlot.Back, NGuiInvGridEquipment.EnumClothingLayer.Outer);
     84                        AddEquipment ("gloves", _equipment, EquipmentSlots.Hands);
    8585                }
    8686
    87                 private void AddEquipment (string _slotname, InvItem[] _items, XMLData.Item.EnumEquipmentSlot _slot, NGuiInvGridEquipment.EnumClothingLayer _layer) {
    88                         int index = (int)_slot + (int)_layer * (int)XMLData.Item.EnumEquipmentSlot.Count;
    89                         if (_items != null && _items [index] != null) {
    90                                 if (_items [index].quality < 0) {
    91                                         SdtdConsole.Instance.Output (string.Format ("    Slot {0:8}: {1:000}", _slotname, _items [index].itemName));
    92                                 } else {
    93                                         SdtdConsole.Instance.Output (string.Format ("    Slot {0:8}: {1:000} - quality: {2}", _slotname, _items [index].itemName, _items [index].quality));
     87                private void AddEquipment (string _slotname, InvItem[] _items, EquipmentSlots _slot) {
     88                        int[] slotindices = XUiM_PlayerEquipment.GetSlotIndicesByEquipmentSlot (_slot);
     89
     90                        for (int i = 0; i < slotindices.Length; i++) {
     91                                if (_items != null && _items [slotindices [i]] != null) {
     92                                        InvItem item = _items [slotindices [i]];
     93                                        if (item.quality < 0) {
     94                                                SdtdConsole.Instance.Output (string.Format ("    Slot {0:8}: {1:000}", _slotname, item.itemName));
     95                                        } else {
     96                                                SdtdConsole.Instance.Output (string.Format ("    Slot {0:8}: {1:000} - quality: {2}", _slotname, item.itemName, item.quality));
     97                                        }
     98                                        DoParts (_items [slotindices [i]].parts, 1);
     99                                        return;
    94100                                }
    95                                 DoParts (_items [index].parts, 1);
    96101                        }
    97102                }
  • binary-improvements/AllocsCommands/Commands/TeleportPlayer.cs

    r250 r253  
    1616                                "  3. teleportplayer <inc x> <inc y> <inc z>\n" +
    1717                                "1. Teleports the player given by his SteamID, player name or entity id (as given by e.g. \"lpi\")\n" +
    18                                 "   to the specified location\n" +
     18                                "   to the specified location. Use y = -1 to spawn on ground.\n" +
    1919                                "2. As 1, but destination given by another player which has to be online\n" +
    2020                                "3. Teleport the local player to the position calculated by his current position and the given offsets";
     
    3333                                        ClientInfo ci1 = null;
    3434                                        EntityPlayer ep1 = null;
     35                                        UnityEngine.Vector3 destPos;
    3536 
    3637                                        if (_params.Count == 2 || _params.Count == 4) {
     
    5657                                                        }
    5758
    58                                                         ep1.position.x = x;
    59                                                         ep1.position.y = y;
    60                                                         ep1.position.z = z;
     59                                                        destPos.x = x;
     60                                                        destPos.y = y;
     61                                                        destPos.z = z;
    6162                                                } else if (_params.Count == 2) {
    6263                                                        ClientInfo ci2 = ConsoleHelper.ParseParamIdOrName (_params [1]);
     
    6768                                                        EntityPlayer ep2 = GameManager.Instance.World.Players.dict [ci2.entityId];
    6869
    69                                                         ep1.position = ep2.GetPosition ();
    70                                                         ep1.position.y += 1;
    71                                                         ep1.position.z += 1;
     70                                                        destPos = ep2.GetPosition ();
     71                                                        destPos.y += 1;
     72                                                        destPos.z += 1;
    7273                                                }
    7374                                        } else if (_params.Count == 3) {
    7475                                                if (_senderInfo.RemoteClientInfo == null) {
    75                                                         SdtdConsole.Instance.Output ("This command can only be executed on the in-game console.");
     76                                                        SdtdConsole.Instance.Output ("This command can only be executed in variant 3 on the in-game console.");
    7677                                                        return;
    7778                                                }
     
    9394                                                }
    9495
    95                                                 ep1.position.x = ep1.position.x + x;
    96                                                 ep1.position.y = ep1.position.y + y;
    97                                                 ep1.position.z = ep1.position.z + z;
     96                                                destPos.x = ep1.position.x + x;
     97                                                destPos.y = ep1.position.y + y;
     98                                                destPos.z = ep1.position.z + z;
    9899                                        }
    99100
    100                                         NetPackageEntityTeleport pkg = new NetPackageEntityTeleport (ep1);
     101                                        NetPackageTeleportPlayer pkg = new NetPackageTeleportPlayer (destPos);
    101102
    102103                                        ci1.SendPackage (pkg);
  • binary-improvements/AllocsCommands/ModInfo.xml

    r250 r253  
    55                <Description value="Additional commands for server operation" />
    66                <Author value="Christian 'Alloc' Illy" />
    7                 <Version value="5" />
     7                <Version value="6" />
    88                <Website value="http://7dtd.illy.bz" />
    99        </ModInfo>
  • binary-improvements/MapRendering/ModInfo.xml

    r250 r253  
    55                <Description value="Render the game map to image map tiles as it is uncovered" />
    66                <Author value="Christian 'Alloc' Illy" />
    7                 <Version value="9" />
     7                <Version value="10" />
    88                <Website value="http://7dtd.illy.bz" />
    99        </ModInfo>
  • binary-improvements/MapRendering/Web/API/GetLandClaims.cs

    r251 r253  
    77namespace AllocsFixes.NetConnections.Servers.Web.API
    88{
    9         public class GetLandClaims : WebAPI
    10         {
    11                 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
    12                 {
    13                         string ViewersSteamID = string.Empty;
    14             ulong lViewersSteamID = 0L;
     9        public class GetLandClaims : WebAPI {
     10                public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
     11                        string requestedSteamID = string.Empty;
    1512
    1613                        if (req.QueryString ["steamid"] != null) {
    17                                 ViewersSteamID = req.QueryString ["steamid"];
    18                 if (ViewersSteamID.Length != 17 || !ulong.TryParse (ViewersSteamID, out lViewersSteamID)) {
     14                                ulong lViewersSteamID;
     15                                requestedSteamID = req.QueryString ["steamid"];
     16                                if (requestedSteamID.Length != 17 || !ulong.TryParse (requestedSteamID, out lViewersSteamID)) {
    1917                                        resp.StatusCode = (int)HttpStatusCode.BadRequest;
    2018                                        Web.SetResponseTextContent (resp, "Invalid SteamID given");
     
    2321                        }
    2422
    25             // default user, cheap way to avoid 'null reference exception'
    26             try { user = user ?? new WebConnection ("", "", 0L); } catch { }
     23                        // default user, cheap way to avoid 'null reference exception'
     24                        user = user ?? new WebConnection ("", "", 0L);
    2725
    28             bool bViewAll = false; try { bViewAll = user.CanViewAllClaims (permissionLevel); } catch { }
     26                        bool bViewAll = WebConnection.CanViewAllClaims (permissionLevel);
    2927           
    3028                        JSONObject result = new JSONObject ();
     
    3432                        result.Add ("claimowners", claimOwners);
    3533
    36                         Dictionary<Vector3i, PersistentPlayerData> d = GameManager.Instance.GetPersistentPlayerList ().m_lpBlockMap;
    37                         if (d != null) {
    38                                 World w = GameManager.Instance.World;
    39                                 Dictionary<PersistentPlayerData, List<Vector3i>> owners = new Dictionary<PersistentPlayerData, List<Vector3i>> ();
     34                        LandClaimList.OwnerFilter[] ownerFilters = null;
     35                        if (!string.IsNullOrEmpty (requestedSteamID) || !bViewAll) {
     36                                if (!string.IsNullOrEmpty (requestedSteamID) && !bViewAll) {
     37                                        ownerFilters = new LandClaimList.OwnerFilter[] {
     38                                                LandClaimList.SteamIdFilter (user.SteamID.ToString ()),
     39                                                LandClaimList.SteamIdFilter (requestedSteamID)
     40                                        };
     41                                } else if (!bViewAll) {
     42                                        ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (user.SteamID.ToString ()) };
     43                                } else {
     44                                        ownerFilters = new LandClaimList.OwnerFilter[] { LandClaimList.SteamIdFilter (requestedSteamID) };
     45                                }
     46                        }
     47                        LandClaimList.PositionFilter[] posFilters = null;
    4048
    41                 // Add all owners to this temporary list regardless of permissions
    42                                 foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) {
    43                                         if (kvp.Value.PlayerId.Equals (ViewersSteamID)) {
    44                                                 if (!owners.ContainsKey (kvp.Value)) {
    45                                                         owners.Add (kvp.Value, new List<Vector3i> ());
    46                                                 }
    47                                                 owners [kvp.Value].Add (kvp.Key);
     49                        Dictionary<PersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (ownerFilters, posFilters);
     50
     51                        foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) {
     52
     53                                try {
     54                                        JSONObject owner = new JSONObject ();
     55                                        claimOwners.Add (owner);
     56
     57                                        owner.Add ("steamid", new JSONString (kvp.Key.SteamID));
     58                                        owner.Add ("claimactive", new JSONBoolean (kvp.Key.LandProtectionActive));
     59
     60                                        if (kvp.Key.Name.Length > 0) {
     61                                                owner.Add ("playername", new JSONString (kvp.Key.Name));
     62                                        } else {
     63                                                owner.Add ("playername", new JSONNull ());
    4864                                        }
    49                                 }
    5065
    51                 // Loop through all claim owners...
    52                                 foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) {
    53                     try
    54                     {
    55                         // ... but only show us claims that are from the current web user or if the current web user can see all claims regardless of ownership
    56                         if (kvp.Key.PlayerId.Equals (ViewersSteamID) || bViewAll)
    57                         {
    58                             string currentSteamID = kvp.Key.PlayerId;
    59                             bool isActive = w.IsLandProtectionValidForPlayer (kvp.Key);
     66                                        JSONArray claimsJson = new JSONArray ();
     67                                        owner.Add ("claims", claimsJson);
    6068
    61                             JSONObject owner = new JSONObject ();
    62                             claimOwners.Add (owner);
     69                                        foreach (Vector3i v in kvp.Value) {
     70                                                JSONObject claim = new JSONObject ();
     71                                                claim.Add ("x", new JSONNumber (v.x));
     72                                                claim.Add ("y", new JSONNumber (v.y));
     73                                                claim.Add ("z", new JSONNumber (v.z));
    6374
    64                             owner.Add("steamid", new JSONString (currentSteamID));
    65                             owner.Add("claimactive", new JSONBoolean (isActive));
    66 
    67                             if (PersistentContainer.Instance.Players [currentSteamID, false] != null) {
    68                                 owner.Add("playername", new JSONString (PersistentContainer.Instance.Players [currentSteamID, false].Name));
    69                             } else {
    70                                 owner.Add("playername", new JSONNull ());
    71                             }
    72 
    73                             JSONArray claims = new JSONArray ();
    74                             owner.Add ("claims", claims);
    75 
    76                             foreach (Vector3i v in kvp.Value) {
    77                                 JSONObject claim = new JSONObject ();
    78                                 claim.Add ("x", new JSONNumber (v.x));
    79                                 claim.Add ("y", new JSONNumber (v.y));
    80                                 claim.Add ("z", new JSONNumber (v.z));
    81 
    82                                 claims.Add (claim);
    83                             }
    84                         }
    85                     }
    86                     catch { }
     75                                                claimsJson.Add (claim);
     76                                        }
     77                                } catch {
    8778                                }
    8879                        }
  • binary-improvements/MapRendering/Web/API/GetLog.cs

    r250 r253  
    1515                        }
    1616
    17                         if (req.QueryString ["lastLine"] == null || !int.TryParse (req.QueryString ["lastLine"], out lastLine)) {
    18                                 lastLine = -1;
    19                         }
    20 
    2117                        JSONObject result = new JSONObject ();
    2218
    23                         List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, ref lastLine);
     19                        List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, 50, out lastLine);
    2420
    2521                        JSONArray entries = new JSONArray ();
  • binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs

    r251 r253  
    88{
    99        public class GetPlayerInventory : WebAPI {
     10
    1011                public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
    1112                        if (req.QueryString ["steamid"] == null) {
     
    3839                        DoInventory (bag, inv.bag);
    3940
    40                         AddEquipment (equipment, "head", inv.equipment, XMLData.Item.EnumEquipmentSlot.Head, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    41                         AddEquipment (equipment, "eyes", inv.equipment, XMLData.Item.EnumEquipmentSlot.Eyes, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    42                         AddEquipment (equipment, "face", inv.equipment, XMLData.Item.EnumEquipmentSlot.Face, NGuiInvGridEquipment.EnumClothingLayer.Middle);
     41                        AddEquipment (equipment, "head", inv.equipment, EquipmentSlots.Headgear);
     42                        AddEquipment (equipment, "eyes", inv.equipment, EquipmentSlots.Eyewear);
     43                        AddEquipment (equipment, "face", inv.equipment, EquipmentSlots.Face);
    4344
    44                         AddEquipment (equipment, "armor", inv.equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Outer);
    45                         AddEquipment (equipment, "jacket", inv.equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Middle);
    46                         AddEquipment (equipment, "shirt", inv.equipment, XMLData.Item.EnumEquipmentSlot.Chest, NGuiInvGridEquipment.EnumClothingLayer.Inner);
     45                        AddEquipment (equipment, "armor", inv.equipment, EquipmentSlots.ChestArmor);
     46                        AddEquipment (equipment, "jacket", inv.equipment, EquipmentSlots.Jacket);
     47                        AddEquipment (equipment, "shirt", inv.equipment, EquipmentSlots.Shirt);
    4748
    48                         AddEquipment (equipment, "legarmor", inv.equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Outer);
    49                         AddEquipment (equipment, "pants", inv.equipment, XMLData.Item.EnumEquipmentSlot.Legs, NGuiInvGridEquipment.EnumClothingLayer.Inner);
    50                         AddEquipment (equipment, "boots", inv.equipment, XMLData.Item.EnumEquipmentSlot.Feet, NGuiInvGridEquipment.EnumClothingLayer.Inner);
     49                        AddEquipment (equipment, "legarmor", inv.equipment, EquipmentSlots.LegArmor);
     50                        AddEquipment (equipment, "pants", inv.equipment, EquipmentSlots.Legs);
     51                        AddEquipment (equipment, "boots", inv.equipment, EquipmentSlots.Feet);
    5152
    52                         AddEquipment (equipment, "gloves", inv.equipment, XMLData.Item.EnumEquipmentSlot.Hands, NGuiInvGridEquipment.EnumClothingLayer.Inner);
    53                         AddEquipment (equipment, "backpack", inv.equipment, XMLData.Item.EnumEquipmentSlot.Back, NGuiInvGridEquipment.EnumClothingLayer.Outer);
     53                        AddEquipment (equipment, "gloves", inv.equipment, EquipmentSlots.Hands);
    5454
    5555                        WriteJSON (resp, result);
     
    6262                }
    6363
    64                 private void AddEquipment (JSONObject _eq, string _slotname, InvItem[] _items, XMLData.Item.EnumEquipmentSlot _slot, NGuiInvGridEquipment.EnumClothingLayer _layer) {
    65                         int index = (int)_slot + (int)_layer * (int)XMLData.Item.EnumEquipmentSlot.Count;
    66                         if (_items != null) {
    67                                 _eq.Add (_slotname, GetJsonForItem (_items [index]));
    68                         } else {
    69                                 _eq.Add (_slotname, new JSONNull ());
     64                private void AddEquipment (JSONObject _eq, string _slotname, InvItem[] _items, EquipmentSlots _slot) {
     65                        int[] slotindices = XUiM_PlayerEquipment.GetSlotIndicesByEquipmentSlot (_slot);
     66
     67                        for (int i = 0; i < slotindices.Length; i++) {
     68                                if (_items != null && _items [slotindices [i]] != null) {
     69                                        InvItem item = _items [slotindices [i]];
     70                                        _eq.Add (_slotname, GetJsonForItem (item));
     71                                        return;
     72                                }
    7073                        }
     74
     75                        _eq.Add (_slotname, new JSONNull ());
    7176                }
    7277
     
    7580                                JSONObject jsonItem = new JSONObject ();
    7681                                jsonItem.Add ("count", new JSONNumber (_item.count));
    77                 jsonItem.Add ("name", new JSONString (_item.itemName));
    78                 jsonItem.Add ("icon", new JSONString (_item.icon));
    79                 jsonItem.Add ("iconcolor", new JSONString ((string.IsNullOrEmpty (_item.iconcolor) || _item.iconcolor == "FFFFFF" ? "" : _item.iconcolor)));
    80                 jsonItem.Add ("quality", new JSONNumber(_item.quality));
     82                                jsonItem.Add ("name", new JSONString (_item.itemName));
     83                                jsonItem.Add ("icon", new JSONString (_item.icon));
     84                                jsonItem.Add ("iconcolor", new JSONString (_item.iconcolor));
     85                                jsonItem.Add ("quality", new JSONNumber (_item.quality));
    8186                                if (_item.quality >= 0) {
    8287                                        jsonItem.Add ("qualitycolor", new JSONString (QualityInfo.GetQualityColorHex (_item.quality)));
  • binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs

    r251 r253  
    1111                public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
    1212                {
    13             AdminTools admTools = null;
     13            AdminTools admTools = GameManager.Instance.adminTools;
     14            user = user ?? new WebConnection ("", "", 0L);
    1415
    15             try { admTools = GameManager.Instance.adminTools; } catch { }
    16             try { user = user ?? new WebConnection ("", "", 0L); } catch { } // default user, cheap way to avoid 'null reference exception'
    17 
    18             bool bViewAll = false; try { bViewAll = user.CanViewAllPlayers (permissionLevel); } catch { }
     16            bool bViewAll = WebConnection.CanViewAllPlayers (permissionLevel);
    1917
    2018            JSONArray playersJsResult = new JSONArray ();
     
    2321
    2422                        foreach (string sid in playersList.SteamIDs) {
    25                 try {
    26                     if ((admTools != null) && (PetesUtils.ValidText (sid)))
    27                         if (admTools.IsBanned (sid))
    28                             continue;
     23                if (admTools != null)
     24                    if (admTools.IsBanned (sid))
     25                        continue;
     26
     27                Player p = playersList [sid, false];
     28
     29                ulong player_steam_ID = 0L;
     30                if (!ulong.TryParse (sid, out player_steam_ID))
     31                    player_steam_ID = 0L;
     32
     33                if ((player_steam_ID == user.SteamID) || bViewAll) {
     34                    JSONObject pos = new JSONObject ();
     35                    pos.Add("x", new JSONNumber (p.LastPosition.x));
     36                    pos.Add("y", new JSONNumber (p.LastPosition.y));
     37                    pos.Add("z", new JSONNumber (p.LastPosition.z));
     38
     39                    JSONObject pJson = new JSONObject ();
     40                    pJson.Add("steamid", new JSONString (sid));
     41                    pJson.Add("ip", new JSONString (p.IP));
     42                    pJson.Add("name", new JSONString (p.Name));
     43                    pJson.Add("online", new JSONBoolean (p.IsOnline));
     44                    pJson.Add("position", pos);
     45
     46                    playersJsResult.Add (pJson);
    2947                }
    30                 catch { }
    31 
    32                 try
    33                 {
    34                     Player p = playersList [sid, false];
    35 
    36                     ulong player_steam_ID = 0L;
    37                     if (!ulong.TryParse (sid, out player_steam_ID))
    38                         player_steam_ID = 0L;
    39 
    40                     if ((player_steam_ID == user.SteamID) || bViewAll) {
    41                         JSONObject pos = new JSONObject ();
    42                         pos.Add("x", new JSONNumber (p.LastPosition.x));
    43                         pos.Add("y", new JSONNumber (p.LastPosition.y));
    44                         pos.Add("z", new JSONNumber (p.LastPosition.z));
    45 
    46                         JSONObject pJson = new JSONObject ();
    47                         pJson.Add("steamid", new JSONString (sid));
    48                         pJson.Add("ip", new JSONString (p.IP));
    49                         pJson.Add("name", new JSONString (p.Name));
    50                         pJson.Add("online", new JSONBoolean (p.IsOnline));
    51                         pJson.Add("position", pos);
    52 
    53                         playersJsResult.Add (pJson);
    54                     }
    55                 }
    56                 catch { }
    5748            }
    5849
  • binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs

    r251 r253  
    88namespace AllocsFixes.NetConnections.Servers.Web.Handlers
    99{
    10         public class ItemIconHandler : PathHandler
    11         {
     10        public class ItemIconHandler : PathHandler {
    1211                private string staticPart;
    1312                private bool logMissingFiles;
    14         private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
    15         private bool loaded = false;
     13                private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
     14                private bool loaded = false;
    1615
    1716                public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base(moduleName) {
     
    2928                        }
    3029
    31             // BEGIN CHANGED BY PSOUZA4
    3230                        string requestFileName = req.Url.AbsolutePath.Remove (0, staticPart.Length);
    3331                        requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.'));
    3432
    35             string requestColorTintHex = string.Empty;
    36            
    37             // Chose a split instead of using a querystring variable in the URI, but that may arguably be cleaner
    38             if (requestFileName.Contains("@@")) {
    39                 try {
    40                     string[] tempTintingOptions = requestFileName.Split (new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
    41                     requestFileName = tempTintingOptions [0];
    42                     requestColorTintHex = tempTintingOptions [1].Trim ().ToUpper ();
    43                 }
    44                 catch { }
    45             }
    46 
    47             if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.ToLower ().EndsWith(".png")) {
     33                        if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.ToLower ().EndsWith (".png")) {
    4834                                resp.ContentType = MimeType.GetMimeType (".png");
    4935
    50                 byte[] itemIconData = icons [requestFileName];
    51 
    52                 // Note: optionally split this code into a ImageMultiplyBlend method
    53                 if (!string.IsNullOrEmpty (requestColorTintHex) && (requestColorTintHex != "FFFFFF")) {
    54                     try {
    55                         System.Drawing.Color colorTint = System.Drawing.ColorTranslator.FromHtml ("#" + requestColorTintHex);
    56                         System.Drawing.Bitmap image = (System.Drawing.Bitmap)PetesUtils.GetImageFromBytes (itemIconData);
    57 
    58                         for (var x = 0; x < image.Width; x++) {
    59                             for (int y = 0; y < image.Height; y++) {
    60                                 System.Drawing.Color originalColor = image.GetPixel (x, y);
    61                                 System.Drawing.Color changedColor = originalColor;
    62 
    63                                 // Only change the icon tinting if the alpha channel is fully opaque
    64                                 if (originalColor.A == 255) {
    65                                     // based on http://stackoverflow.com/questions/3837757/multiply-two-images-in-c-sharp-as-multiply-two-layers-in-photoshop
    66 
    67                                     double component_R = (((double)originalColor.R) * ((double)colorTint.R)) / 255.0;
    68                                     double component_G = (((double)originalColor.G) * ((double)colorTint.G)) / 255.0;
    69                                     double component_B = (((double)originalColor.B) * ((double)colorTint.B)) / 255.0;
    70 
    71                                     if (component_R > 255.0) component_R = 255.0;
    72                                     if (component_G > 255.0) component_G = 255.0;
    73                                     if (component_B > 255.0) component_B = 255.0;
    74 
    75                                     // multiply blend shouldn't ever calculate below 0, but for completeness let's leave in this logic
    76                                     if (component_R < 0.0) component_R = 0.0;
    77                                     if (component_G < 0.0) component_G = 0.0;
    78                                     if (component_B < 0.0) component_B = 0.0;
    79 
    80                                     changedColor = System.Drawing.Color.FromArgb (originalColor.A, (int)component_R, (int)component_G, (int)component_B);
    81                                 }                               
    82 
    83                                 image.SetPixel (x, y, changedColor);
    84                             }
    85                         }
    86 
    87                         itemIconData = PetesUtils.SaveImage_ToBytes (image, true);
    88                     }
    89                     catch { }
    90                 }
     36                                byte[] itemIconData = icons [requestFileName];
    9137
    9238                                resp.ContentLength64 = itemIconData.Length;
    9339                                resp.OutputStream.Write (itemIconData, 0, itemIconData.Length);
    94                 // END CHANGED BY PSOUZA4
    9540                        } else {
    9641                                resp.StatusCode = (int)HttpStatusCode.NotFound;
    97                                 if (logMissingFiles)
     42                                if (logMissingFiles) {
    9843                                        Log.Out ("Web:IconHandler:FileNotFound: \"" + req.Url.AbsolutePath + "\" ");
     44                                }
    9945                                return;
    10046                        }
     
    10652                                        return true;
    10753                                }
     54
     55                                MicroStopwatch microStopwatch = new MicroStopwatch ();
    10856
    10957                                GameObject atlasObj = GameObject.Find ("/NGUI Root (2D)/ItemIconAtlas");
     
    12068                                }
    12169
     70                                Dictionary<string, List<Color>> tintedIcons = new Dictionary<string, List<Color>> ();
     71                                foreach (ItemClass ic in ItemClass.list) {
     72                                        if (ic != null) {
     73                                                Color tintColor = ic.GetIconTint ();
     74                                                if (tintColor != Color.white) {
     75                                                        string name = ic.GetIconName ();
     76                                                        if (!tintedIcons.ContainsKey (name)) {
     77                                                                tintedIcons.Add (name, new List<Color> ());
     78                                                        }
     79                                                        List<Color> list = tintedIcons [name];
     80                                                        list.Add (tintColor);
     81                                                }
     82                                        }
     83                                }
     84
    12285                                Texture2D atlasTex = atlas.texture as Texture2D;
    12386
     
    12689                                        Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false);
    12790                                        tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width, data.height));
    128                                         byte[] pixData = tex.EncodeToPNG ();
    12991
    130                                         icons.Add (name, pixData);
     92                                        icons.Add (name + "__FFFFFF", tex.EncodeToPNG ());
     93
     94                                        if (tintedIcons.ContainsKey (name)) {
     95                                                foreach (Color c in tintedIcons [name]) {
     96                                                        Texture2D tintedTex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false);
     97
     98                                                        for (int x = 0; x < data.width; x++) {
     99                                                                for (int y = 0; y < data.height; y++) {
     100                                                                        tintedTex.SetPixel (x, y, tex.GetPixel (x, y) * c);
     101                                                                }
     102                                                        }
     103
     104                                                        icons.Add (name + "__" + AllocsUtils.ColorToHex (c), tintedTex.EncodeToPNG ());
     105
     106                                                        UnityEngine.Object.Destroy (tintedTex);
     107                                                }
     108                                        }
     109
    131110                                        UnityEngine.Object.Destroy (tex);
    132111                                }
    133112
    134113                                loaded = true;
    135                                 Log.Out ("Web:IconHandler: Icons loaded");
     114                                Log.Out ("Web:IconHandler: Icons loaded - {0} ms", microStopwatch.ElapsedMilliseconds);
    136115
    137116                                return true;
  • binary-improvements/MapRendering/Web/LogBuffer.cs

    r250 r253  
    88{
    99        public class LogBuffer {
    10                 private const int MAX_ENTRIES = 50000;
     10                private const int MAX_ENTRIES = 30;
    1111                private static LogBuffer instance;
    1212
     
    9292                }
    9393
    94                 public List<LogEntry> GetRange (ref int _start, ref int _end) {
     94                public List<LogEntry> GetRange (ref int _start, int _count, out int _end) {
    9595                        lock (logEntries) {
    96                                 if (_end < 0) {
    97                                         _end = listOffset + logEntries.Count;
     96                                if (_count < 1) {
     97                                        _end = _start;
     98                                        return new List<LogEntry> ();
    9899                                }
    99100
     
    107108                                }
    108109
    109                                 if (_end < _start) {
    110                                         Log.Error ("GetRange: invalid end {0} (listOffset: {1}, count: {2})", _end, listOffset, logEntries.Count);
    111                                         return null;
    112                                 }
    113 
    114                                 if (_end >= listOffset + logEntries.Count) {
    115                                         _end = listOffset + logEntries.Count - 1;
    116                                 }
    117 
    118                                 return logEntries.GetRange (_start - listOffset, _end - _start + 1);
     110                                _end = _start + _count;
     111                                return logEntries.GetRange (_start - listOffset, _count);
    119112                        }
    120113                }
  • binary-improvements/MapRendering/Web/WebConnection.cs

    r251 r253  
    3030                }
    3131
    32         public bool CanViewAllPlayers (int _permissionLevel) {
     32        public static bool CanViewAllPlayers (int _permissionLevel) {
    3333            bool val = false;
    3434
     
    4747        }
    4848
    49         public bool CanViewAllClaims (int _permissionLevel) {
     49        public static bool CanViewAllClaims (int _permissionLevel) {
    5050            bool val = false;
    5151
  • binary-improvements/MapRendering/WebAndMapRendering.csproj

    r251 r253  
    2323    <Reference Include="System">
    2424      <HintPath>..\7dtd-binaries\System.dll</HintPath>
    25       <Private>False</Private>
    26     </Reference>
    27     <Reference Include="System.Drawing">
    28       <HintPath>..\7dtd-binaries\System.Drawing.dll</HintPath>
    2925      <Private>False</Private>
    3026    </Reference>
     
    5955    <Compile Include="API.cs" />
    6056    <Compile Include="Web\API\GetAnimalsLocation.cs" />
    61     <Compile Include="Web\API\GetRawEntitiesList.cs" />
    6257    <Compile Include="Web\API\GetHostileLocation.cs" />
    6358    <Compile Include="Web\API\Null.cs" />
  • binary-improvements/server-fixes.userprefs

    r249 r253  
    11<Properties>
    22  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Version" />
    3   <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/ModInfo.xml">
     3  <MonoDevelop.Ide.Workbench ActiveDocument="MapRendering/Web/API/GetPlayerInventory.cs">
    44    <Files>
    5       <File FileName="MapRendering/MapRendering/Constants.cs" Line="1" Column="1" />
    6       <File FileName="7dtd-server-fixes/ModInfo.xml" Line="7" Column="20" />
     5      <File FileName="7dtd-server-fixes/ModInfo.xml" Line="10" Column="7" />
    76      <File FileName="AllocsCommands/ModInfo.xml" Line="7" Column="20" />
    87      <File FileName="MapRendering/ModInfo.xml" Line="7" Column="20" />
    9       <File FileName="MapRendering/Web/Web.cs" Line="168" Column="13" />
     8      <File FileName="MapRendering/Web/Web.cs" Line="34" Column="29" />
    109      <File FileName="MapRendering/Web/API/ExecuteConsoleCommand.cs" Line="36" Column="114" />
    11       <File FileName="MapRendering/Web/API/GetStats.cs" Line="21" Column="84" />
    12       <File FileName="MapRendering/Web/API/GetLandClaims.cs" Line="59" Column="8" />
     10      <File FileName="MapRendering/Web/LogBuffer.cs" Line="110" Column="28" />
     11      <File FileName="MapRendering/Web/API/GetLog.cs" Line="19" Column="86" />
     12      <File FileName="MapRendering/Web/API/GetWebUIUpdates.cs" Line="26" Column="33" />
     13      <File FileName="MapRendering/Web/Handlers/ItemIconHandler.cs" Line="39" Column="68" />
     14      <File FileName="MapRendering/Web/API/GetLandClaims.cs" Line="1" Column="1" />
     15      <File FileName="AllocsCommands/Commands/ShowInventory.cs" Line="85" Column="1" />
     16      <File FileName="MapRendering/Web/API/GetPlayerInventory.cs" Line="75" Column="16" />
    1317    </Files>
    1418    <Pads>
  • binary-improvements/webserver/js/inventory_dialog.js

    r251 r253  
    1818                qual.removeClass ("visible");
    1919
    20                 if (itemdata !== null) {
    21                         cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.icon + "@@" + itemdata.iconcolor + ".png);");
     20                if (itemdata !== null && itemdata !== undefined) {
     21                        cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.icon + "__" + itemdata.iconcolor + ".png);");
    2222                        if (itemdata.quality >= 0) {
    2323                                cell.attr("title", itemdata.name + " (quality: " + itemdata.quality + ")");
  • binary-improvements/webserver/js/map.js

    r251 r253  
    124124
    125125        var measure = L.control.measure({
    126                 //primaryLengthUnit: "meters",
    127                 //primaryAreaUnit: "sqmeters",
     126                units: {
     127                        sdtdMeters: {
     128                                factor: 0.00001,
     129                                display: 'XMeters',
     130                                decimals: 0
     131                        },
     132                        sdtdSqMeters: {
     133                                factor: 0.000000001,
     134                                display: 'XSqMeters',
     135                                decimals: 0
     136                        }
     137                },
     138                primaryLengthUnit: "sdtdMeters",
     139                primaryAreaUnit: "sdtdSqMeters",
    128140                //activeColor: "#ABE67E",
    129141                //completedColor: "#C8F2BE",
  • binary-improvements/webserver/leaflet/measure/leaflet-measure.js

    r249 r253  
    50105010
    50115011var measure = function (latlngs) {
    5012   var last = _.last(latlngs), feet, meters, miles, kilometers, sqMeters, acres, hectares, sqMiles;
     5012  var last = _.last(latlngs);
    50135013  var path = geocrunch.path(_.map(latlngs, function (latlng) {
    50145014    return [latlng.lng, latlng.lat];
    50155015  }));
    50165016
    5017   feet = path.distance({
    5018     units: 'feet'
     5017  var meters = path.distance({
     5018    units: 'meters'
    50195019  });
    5020   meters = feet / 3.2808;
    5021   miles = feet / 5280;
    5022   kilometers = meters / 1000;
    5023   sqMeters = path.area({
     5020  var sqMeters = path.area({
    50245021    units: 'sqmeters'
    50255022  });
    5026   acres = sqMeters * 0.00024711;
    5027   hectares = sqMeters / 10000;
    5028   sqMiles = acres * 0.0015625;
    50295023
    50305024  return {
     
    50395033      }
    50405034    },
    5041     length: {
    5042       feet: feet,
    5043       meters: meters,
    5044       miles: miles,
    5045       kilometers: kilometers
    5046     },
    5047     area: {
    5048       acres: acres,
    5049       hectares: hectares,
    5050       sqmeters: sqMeters,
    5051       sqmiles: sqMiles
    5052     }
     5035    length: meters,
     5036    area: sqMeters
    50535037  };
    50545038};
     
    51205104  _className: 'leaflet-control-measure',
    51215105  options: {
     5106    units: {},
    51225107    position: 'topright',
    51235108    primaryLengthUnit: 'feet',
     
    51335118  initialize: function (options) {
    51345119    L.setOptions(this, options);
     5120    this.options.units = L.extend({}, units, this.options.units);
    51355121    this._symbols = new Symbology(_.pick(this.options, 'activeColor', 'completedColor'));
    51365122  },
     
    52405226    L.DomEvent.on(this._container, 'mouseenter', this._handleMapMouseOut, this);
    52415227
    5242     if (!this._measureCollector) {
    5243       // polygon to cover all other layers and collection measure move and click events
    5244       this._measureCollector = L.polygon([[90, -180], [90, 180], [-90, 180], [-90, -180]], this._symbols.getSymbol('measureCollector')).addTo(this._layer);
    5245       this._measureCollector.on('mousemove', this._handleMeasureMove, this);
    5246       this._measureCollector.on('dblclick', this._handleMeasureDoubleClick, this);
    5247       this._measureCollector.on('click', this._handleMeasureClick, this);
    5248     }
    5249     this._measureCollector.bringToFront();
     5228    this._map.on('mousemove', this._handleMeasureMove, this);
     5229    this._map.on('dblclick', this._handleMeasureDoubleClick, this);
     5230    this._map.on('click', this._handleMeasureClick, this);
    52505231
    52515232    this._measureVertexes = L.featureGroup().addTo(this._layer);
     
    52645245    this._clearMeasure();
    52655246
    5266     this._measureCollector.off();
    5267     this._layer.removeLayer(this._measureCollector);
    5268     this._measureCollector = null;
     5247    this._map.off('mousemove', this._handleMeasureMove, this);
     5248    this._map.off('dblclick', this._handleMeasureDoubleClick, this);
     5249    this._map.off('click', this._handleMeasureClick, this);
    52695250
    52705251    this._layer.removeLayer(this._measureVertexes);
     
    52935274  // format measurements to nice display string based on units in options. `{ lengthDisplay: '100 Feet (0.02 Miles)', areaDisplay: ... }`
    52945275  _getMeasurementDisplayStrings: function (measurement) {
    5295     var result = {};
    5296     if (this.options.primaryLengthUnit && units[this.options.primaryLengthUnit]) {
    5297       result.lengthDisplay = humanize.numberFormat(measurement.length[this.options.primaryLengthUnit], units[this.options.primaryLengthUnit].decimals) + ' ' + units[this.options.primaryLengthUnit].display;
    5298       if (this.options.secondaryLengthUnit && units[this.options.secondaryLengthUnit]) {
    5299         result.lengthDisplay = result.lengthDisplay + ' (' + humanize.numberFormat(measurement.length[this.options.secondaryLengthUnit], units[this.options.secondaryLengthUnit].decimals) + ' ' + units[this.options.secondaryLengthUnit].display + ')';
    5300       }
    5301     }
    5302     if (this.options.primaryAreaUnit && units[this.options.primaryAreaUnit]) {
    5303       result.areaDisplay = humanize.numberFormat(measurement.area[this.options.primaryAreaUnit], units[this.options.primaryAreaUnit].decimals) + ' ' + units[this.options.primaryAreaUnit].display;
    5304       if (this.options.secondaryAreaUnit && units[this.options.secondaryAreaUnit]) {
    5305         result.areaDisplay = result.areaDisplay + ' (' + humanize.numberFormat(measurement.area[this.options.secondaryAreaUnit], units[this.options.secondaryAreaUnit].decimals) + ' ' + units[this.options.secondaryAreaUnit].display + ')';
    5306       }
    5307     }
    5308     return result;
     5276    var unitDefinitions = this.options.units;
     5277
     5278    return {
     5279      lengthDisplay: buildDisplay(measurement.length, this.options.primaryLengthUnit, this.options.secondaryLengthUnit),
     5280      areaDisplay: buildDisplay(measurement.area, this.options.primaryAreaUnit, this.options.secondaryAreaUnit)
     5281    };
     5282
     5283    function buildDisplay (val, primaryUnit, secondaryUnit) {
     5284      var display;
     5285      if (primaryUnit && unitDefinitions[primaryUnit]) {
     5286        display = formatMeasure(val, unitDefinitions[primaryUnit]);
     5287        if (secondaryUnit && unitDefinitions[secondaryUnit]) {
     5288          display = display + ' (' +  formatMeasure(val, unitDefinitions[secondaryUnit]) + ')';
     5289        }
     5290      } else {
     5291        display = formatMeasure(val);
     5292      }
     5293      return display;
     5294    }
     5295
     5296    function formatMeasure (val, unit) {
     5297      return unit && unit.factor && unit.display ?
     5298        humanize.numberFormat(val * unit.factor, unit.decimals || 0) + ' ' + unit.display :
     5299        humanize.numberFormat(val, 0);
     5300    }
    53095301  },
    53105302  // update results area of dom with calced measure from `this._latlngs`
     
    53985390    var latlng = evt.latlng, lastClick = _.last(this._latlngs), vertexSymbol = this._symbols.getSymbol('measureVertex');
    53995391
    5400     this._map.closePopup(); // open popups aren't closed on click. may be bug. close popup manually just in case.
    5401 
    54025392    if (!lastClick || !latlng.equals(lastClick)) { // skip if same point as last click, happens on `dblclick`
    54035393      this._latlngs.push(latlng);
     
    54795469  return new L.Control.Measure(options);
    54805470};
     5471
    54815472}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
    54825473},{"./calc":17,"./dom":18,"./mapsymbology":20,"./units":21,"humanize":15,"underscore":16}],20:[function(require,module,exports){
     
    55035494  getSymbol: function (name) {
    55045495    var symbols = {
    5505       measureCollector: {
    5506         clickable: true,
    5507         stroke: false,
    5508         fillOpacity: 0.0,
    5509         className: 'layer-measurecollector'
    5510       },
    55115496      measureDrag: {
    55125497        clickable: false,
     
    55905575// units.js
    55915576// Unit configurations
     5577// Factor is with respect to meters/sqmeters
    55925578
    55935579module.exports = {
    55945580  acres: {
     5581    factor: 0.00024711,
    55955582    display: 'Acres',
    55965583    decimals: 2
    55975584  },
    55985585  feet: {
     5586    factor: 3.2808,
    55995587    display: 'Feet',
    56005588    decimals: 0
    56015589  },
    56025590  kilometers: {
     5591    factor: 0.001,
    56035592    display: 'Kilometers',
    56045593    decimals: 2
    56055594  },
    56065595  hectares: {
     5596    factor: 0.0001,
    56075597    display: 'Hectares',
    56085598    decimals: 2
    56095599  },
    56105600  meters: {
     5601    factor: 1,
    56115602    display: 'Meters',
    56125603    decimals: 0
    56135604  },
    56145605  miles: {
     5606    factor: 3.2808 / 5280,
    56155607    display: 'Miles',
    56165608    decimals: 2
    56175609  },
     5610  sqfeet: {
     5611    factor: 10.7639,
     5612    display: 'Sq Feet',
     5613    decimals: 0
     5614  },
    56185615  sqmeters: {
     5616    factor: 1,
    56195617    display: 'Sq Meters',
    56205618    decimals: 0
    56215619  },
    56225620  sqmiles: {
     5621    factor: 0.000000386102,
    56235622    display: 'Sq Miles',
    56245623    decimals: 2
  • binary-improvements/webserver/leaflet/measure/leaflet-measure.min.js

    r249 r253  
    11!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=a("color-convert"),d=a("color-string"),e=function(a){if(a instanceof e)return a;if(!(this instanceof e))return new e(a);if(this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},"string"==typeof a){var b=d.getRgba(a);if(b)this.setValues("rgb",b);else if(b=d.getHsla(a))this.setValues("hsl",b);else{if(!(b=d.getHwb(a)))throw new Error('Unable to parse color from string "'+a+'"');this.setValues("hwb",b)}}else if("object"==typeof a){var b=a;if(void 0!==b.r||void 0!==b.red)this.setValues("rgb",b);else if(void 0!==b.l||void 0!==b.lightness)this.setValues("hsl",b);else if(void 0!==b.v||void 0!==b.value)this.setValues("hsv",b);else if(void 0!==b.w||void 0!==b.whiteness)this.setValues("hwb",b);else{if(void 0===b.c&&void 0===b.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(a));this.setValues("cmyk",b)}}};e.prototype={rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){return 1!==this.values.alpha?this.values.hwb.concat([this.values.alpha]):this.values.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var a=this.values.rgb;return a.concat([this.values.alpha])},hslaArray:function(){var a=this.values.hsl;return a.concat([this.values.alpha])},alpha:function(a){return void 0===a?this.values.alpha:(this.setValues("alpha",a),this)},red:function(a){return this.setChannel("rgb",0,a)},green:function(a){return this.setChannel("rgb",1,a)},blue:function(a){return this.setChannel("rgb",2,a)},hue:function(a){return this.setChannel("hsl",0,a)},saturation:function(a){return this.setChannel("hsl",1,a)},lightness:function(a){return this.setChannel("hsl",2,a)},saturationv:function(a){return this.setChannel("hsv",1,a)},whiteness:function(a){return this.setChannel("hwb",1,a)},blackness:function(a){return this.setChannel("hwb",2,a)},value:function(a){return this.setChannel("hsv",2,a)},cyan:function(a){return this.setChannel("cmyk",0,a)},magenta:function(a){return this.setChannel("cmyk",1,a)},yellow:function(a){return this.setChannel("cmyk",2,a)},black:function(a){return this.setChannel("cmyk",3,a)},hexString:function(){return d.hexString(this.values.rgb)},rgbString:function(){return d.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return d.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return d.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return d.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return d.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return d.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return d.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){return this.values.rgb[0]<<16|this.values.rgb[1]<<8|this.values.rgb[2]},luminosity:function(){for(var a=this.values.rgb,b=[],c=0;c<a.length;c++){var d=a[c]/255;b[c]=.03928>=d?d/12.92:Math.pow((d+.055)/1.055,2.4)}return.2126*b[0]+.7152*b[1]+.0722*b[2]},contrast:function(a){var b=this.luminosity(),c=a.luminosity();return b>c?(b+.05)/(c+.05):(c+.05)/(b+.05)},level:function(a){var b=this.contrast(a);return b>=7.1?"AAA":b>=4.5?"AA":""},dark:function(){var a=this.values.rgb,b=(299*a[0]+587*a[1]+114*a[2])/1e3;return 128>b},light:function(){return!this.dark()},negate:function(){for(var a=[],b=0;3>b;b++)a[b]=255-this.values.rgb[b];return this.setValues("rgb",a),this},lighten:function(a){return this.values.hsl[2]+=this.values.hsl[2]*a,this.setValues("hsl",this.values.hsl),this},darken:function(a){return this.values.hsl[2]-=this.values.hsl[2]*a,this.setValues("hsl",this.values.hsl),this},saturate:function(a){return this.values.hsl[1]+=this.values.hsl[1]*a,this.setValues("hsl",this.values.hsl),this},desaturate:function(a){return this.values.hsl[1]-=this.values.hsl[1]*a,this.setValues("hsl",this.values.hsl),this},whiten:function(a){return this.values.hwb[1]+=this.values.hwb[1]*a,this.setValues("hwb",this.values.hwb),this},blacken:function(a){return this.values.hwb[2]+=this.values.hwb[2]*a,this.setValues("hwb",this.values.hwb),this},greyscale:function(){var a=this.values.rgb,b=.3*a[0]+.59*a[1]+.11*a[2];return this.setValues("rgb",[b,b,b]),this},clearer:function(a){return this.setValues("alpha",this.values.alpha-this.values.alpha*a),this},opaquer:function(a){return this.setValues("alpha",this.values.alpha+this.values.alpha*a),this},rotate:function(a){var b=this.values.hsl[0];return b=(b+a)%360,b=0>b?360+b:b,this.values.hsl[0]=b,this.setValues("hsl",this.values.hsl),this},mix:function(a,b){b=1-(null==b?.5:b);for(var c=2*b-1,d=this.alpha()-a.alpha(),e=((c*d==-1?c:(c+d)/(1+c*d))+1)/2,f=1-e,g=this.rgbArray(),h=a.rgbArray(),i=0;i<g.length;i++)g[i]=g[i]*e+h[i]*f;this.setValues("rgb",g);var j=this.alpha()*b+a.alpha()*(1-b);return this.setValues("alpha",j),this},toJSON:function(){return this.rgb()},clone:function(){return new e(this.rgb())}},e.prototype.getValues=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=this.values[a][c];return 1!=this.values.alpha&&(b.a=this.values.alpha),b},e.prototype.setValues=function(a,b){var d={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},e={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},f=1;if("alpha"==a)f=b;else if(b.length)this.values[a]=b.slice(0,a.length),f=b[a.length];else if(void 0!==b[a.charAt(0)]){for(var g=0;g<a.length;g++)this.values[a][g]=b[a.charAt(g)];f=b.a}else if(void 0!==b[d[a][0]]){for(var h=d[a],g=0;g<a.length;g++)this.values[a][g]=b[h[g]];f=b.alpha}if(this.values.alpha=Math.max(0,Math.min(1,void 0!==f?f:this.values.alpha)),"alpha"!=a){for(var g=0;g<a.length;g++){var i=Math.max(0,Math.min(e[a][g],this.values[a][g]));this.values[a][g]=Math.round(i)}for(var j in d){j!=a&&(this.values[j]=c[a][j](this.values[a]));for(var g=0;g<j.length;g++){var i=Math.max(0,Math.min(e[j][g],this.values[j][g]));this.values[j][g]=Math.round(i)}}return!0}},e.prototype.setSpace=function(a,b){var c=b[0];return void 0===c?this.getValues(a):("number"==typeof c&&(c=Array.prototype.slice.call(b)),this.setValues(a,c),this)},e.prototype.setChannel=function(a,b,c){return void 0===c?this.values[a][b]:(this.values[a][b]=c,this.setValues(a,this.values[a]),this)},b.exports=e},{"color-convert":3,"color-string":4}],2:[function(a,c){function d(a){var b,c,d,e=a[0]/255,f=a[1]/255,g=a[2]/255,h=Math.min(e,f,g),i=Math.max(e,f,g),j=i-h;return i==h?b=0:e==i?b=(f-g)/j:f==i?b=2+(g-e)/j:g==i&&(b=4+(e-f)/j),b=Math.min(60*b,360),0>b&&(b+=360),d=(h+i)/2,c=i==h?0:.5>=d?j/(i+h):j/(2-i-h),[b,100*c,100*d]}function e(a){var b,c,d,e=a[0],f=a[1],g=a[2],h=Math.min(e,f,g),i=Math.max(e,f,g),j=i-h;return c=0==i?0:j/i*1e3/10,i==h?b=0:e==i?b=(f-g)/j:f==i?b=2+(g-e)/j:g==i&&(b=4+(e-f)/j),b=Math.min(60*b,360),0>b&&(b+=360),d=i/255*1e3/10,[b,c,d]}function f(a){var b=a[0],c=a[1],e=a[2],f=d(a)[0],g=1/255*Math.min(b,Math.min(c,e)),e=1-1/255*Math.max(b,Math.max(c,e));return[f,100*g,100*e]}function h(a){var b,c,d,e,f=a[0]/255,g=a[1]/255,h=a[2]/255;return e=Math.min(1-f,1-g,1-h),b=(1-f-e)/(1-e)||0,c=(1-g-e)/(1-e)||0,d=(1-h-e)/(1-e)||0,[100*b,100*c,100*d,100*e]}function i(a){return Y[JSON.stringify(a)]}function j(a){var b=a[0]/255,c=a[1]/255,d=a[2]/255;b=b>.04045?Math.pow((b+.055)/1.055,2.4):b/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92,d=d>.04045?Math.pow((d+.055)/1.055,2.4):d/12.92;var e=.4124*b+.3576*c+.1805*d,f=.2126*b+.7152*c+.0722*d,g=.0193*b+.1192*c+.9505*d;return[100*e,100*f,100*g]}function k(a){var b,c,d,e=j(a),f=e[0],g=e[1],h=e[2];return f/=95.047,g/=100,h/=108.883,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,h=h>.008856?Math.pow(h,1/3):7.787*h+16/116,b=116*g-16,c=500*(f-g),d=200*(g-h),[b,c,d]}function l(a){return L(k(a))}function m(a){var b,c,d,e,f,g=a[0]/360,h=a[1]/100,i=a[2]/100;if(0==h)return f=255*i,[f,f,f];c=.5>i?i*(1+h):i+h-i*h,b=2*i-c,e=[0,0,0];for(var j=0;3>j;j++)d=g+1/3*-(j-1),0>d&&d++,d>1&&d--,f=1>6*d?b+6*(c-b)*d:1>2*d?c:2>3*d?b+(c-b)*(2/3-d)*6:b,e[j]=255*f;return e}function n(a){var b,c,d=a[0],e=a[1]/100,f=a[2]/100;return f*=2,e*=1>=f?f:2-f,c=(f+e)/2,b=2*e/(f+e),[d,100*b,100*c]}function o(a){return f(m(a))}function p(a){return h(m(a))}function q(a){return i(m(a))}function s(a){var b=a[0]/60,c=a[1]/100,d=a[2]/100,e=Math.floor(b)%6,f=b-Math.floor(b),g=255*d*(1-c),h=255*d*(1-c*f),i=255*d*(1-c*(1-f)),d=255*d;switch(e){case 0:return[d,i,g];case 1:return[h,d,g];case 2:return[g,d,i];case 3:return[g,h,d];case 4:return[i,g,d];case 5:return[d,g,h]}}function t(a){var b,c,d=a[0],e=a[1]/100,f=a[2]/100;return c=(2-e)*f,b=e*f,b/=1>=c?c:2-c,b=b||0,c/=2,[d,100*b,100*c]}function u(a){return f(s(a))}function v(a){return h(s(a))}function w(a){return i(s(a))}function x(a){var c,d,e,f,h=a[0]/360,i=a[1]/100,j=a[2]/100,k=i+j;switch(k>1&&(i/=k,j/=k),c=Math.floor(6*h),d=1-j,e=6*h-c,0!=(1&c)&&(e=1-e),f=i+e*(d-i),c){default:case 6:case 0:r=d,g=f,b=i;break;case 1:r=f,g=d,b=i;break;case 2:r=i,g=d,b=f;break;case 3:r=i,g=f,b=d;break;case 4:r=f,g=i,b=d;break;case 5:r=d,g=i,b=f}return[255*r,255*g,255*b]}function y(a){return d(x(a))}function z(a){return e(x(a))}function A(a){return h(x(a))}function B(a){return i(x(a))}function C(a){var b,c,d,e=a[0]/100,f=a[1]/100,g=a[2]/100,h=a[3]/100;return b=1-Math.min(1,e*(1-h)+h),c=1-Math.min(1,f*(1-h)+h),d=1-Math.min(1,g*(1-h)+h),[255*b,255*c,255*d]}function D(a){return d(C(a))}function E(a){return e(C(a))}function F(a){return f(C(a))}function G(a){return i(C(a))}function H(a){var b,c,d,e=a[0]/100,f=a[1]/100,g=a[2]/100;return b=3.2406*e+-1.5372*f+g*-.4986,c=e*-.9689+1.8758*f+.0415*g,d=.0557*e+f*-.204+1.057*g,b=b>.0031308?1.055*Math.pow(b,1/2.4)-.055:b=12.92*b,c=c>.0031308?1.055*Math.pow(c,1/2.4)-.055:c=12.92*c,d=d>.0031308?1.055*Math.pow(d,1/2.4)-.055:d=12.92*d,b=Math.min(Math.max(0,b),1),c=Math.min(Math.max(0,c),1),d=Math.min(Math.max(0,d),1),[255*b,255*c,255*d]}function I(a){var b,c,d,e=a[0],f=a[1],g=a[2];return e/=95.047,f/=100,g/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,b=116*f-16,c=500*(e-f),d=200*(f-g),[b,c,d]}function J(a){return L(I(a))}function K(a){var b,c,d,e,f=a[0],g=a[1],h=a[2];return 8>=f?(c=100*f/903.3,e=7.787*(c/100)+16/116):(c=100*Math.pow((f+16)/116,3),e=Math.pow(c/100,1/3)),b=.008856>=b/95.047?b=95.047*(g/500+e-16/116)/7.787:95.047*Math.pow(g/500+e,3),d=.008859>=d/108.883?d=108.883*(e-h/200-16/116)/7.787:108.883*Math.pow(e-h/200,3),[b,c,d]}function L(a){var b,c,d,e=a[0],f=a[1],g=a[2];return b=Math.atan2(g,f),c=360*b/2/Math.PI,0>c&&(c+=360),d=Math.sqrt(f*f+g*g),[e,d,c]}function M(a){return H(K(a))}function N(a){var b,c,d,e=a[0],f=a[1],g=a[2];return d=g/360*2*Math.PI,b=f*Math.cos(d),c=f*Math.sin(d),[e,b,c]}function O(a){return K(N(a))}function P(a){return M(N(a))}function Q(a){return X[a]}function R(a){return d(Q(a))}function S(a){return e(Q(a))}function T(a){return f(Q(a))}function U(a){return h(Q(a))}function V(a){return k(Q(a))}function W(a){return j(Q(a))}c.exports={rgb2hsl:d,rgb2hsv:e,rgb2hwb:f,rgb2cmyk:h,rgb2keyword:i,rgb2xyz:j,rgb2lab:k,rgb2lch:l,hsl2rgb:m,hsl2hsv:n,hsl2hwb:o,hsl2cmyk:p,hsl2keyword:q,hsv2rgb:s,hsv2hsl:t,hsv2hwb:u,hsv2cmyk:v,hsv2keyword:w,hwb2rgb:x,hwb2hsl:y,hwb2hsv:z,hwb2cmyk:A,hwb2keyword:B,cmyk2rgb:C,cmyk2hsl:D,cmyk2hsv:E,cmyk2hwb:F,cmyk2keyword:G,keyword2rgb:Q,keyword2hsl:R,keyword2hsv:S,keyword2hwb:T,keyword2cmyk:U,keyword2lab:V,keyword2xyz:W,xyz2rgb:H,xyz2lab:I,xyz2lch:J,lab2xyz:K,lab2rgb:M,lab2lch:L,lch2lab:N,lch2xyz:O,lch2rgb:P};var X={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Y={};for(var Z in X)Y[JSON.stringify(X[Z])]=Z},{}],3:[function(a,b){var c=a("./conversions"),d=function(){return new i};for(var e in c){d[e+"Raw"]=function(a){return function(b){return"number"==typeof b&&(b=Array.prototype.slice.call(arguments)),c[a](b)}}(e);var f=/(\w+)2(\w+)/.exec(e),g=f[1],h=f[2];d[g]=d[g]||{},d[g][h]=d[e]=function(a){return function(b){"number"==typeof b&&(b=Array.prototype.slice.call(arguments));var d=c[a](b);if("string"==typeof d||void 0===d)return d;for(var e=0;e<d.length;e++)d[e]=Math.round(d[e]);return d}}(e)}var i=function(){this.convs={}};i.prototype.routeSpace=function(a,b){var c=b[0];return void 0===c?this.getValues(a):("number"==typeof c&&(c=Array.prototype.slice.call(b)),this.setValues(a,c))},i.prototype.setValues=function(a,b){return this.space=a,this.convs={},this.convs[a]=b,this},i.prototype.getValues=function(a){var b=this.convs[a];if(!b){var c=this.space,e=this.convs[c];b=d[c][a](e),this.convs[a]=b}return b},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(a){i.prototype[a]=function(){return this.routeSpace(a,arguments)}}),b.exports=d},{"./conversions":2}],4:[function(a,b){function c(a){if(a){var b=/^#([a-fA-F0-9]{3})$/,c=/^#([a-fA-F0-9]{6})$/,d=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,e=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,f=/(\D+)/,g=[0,0,0],h=1,i=a.match(b);if(i){i=i[1];for(var j=0;j<g.length;j++)g[j]=parseInt(i[j]+i[j],16)}else if(i=a.match(c)){i=i[1];for(var j=0;j<g.length;j++)g[j]=parseInt(i.slice(2*j,2*j+2),16)}else if(i=a.match(d)){for(var j=0;j<g.length;j++)g[j]=parseInt(i[j+1]);h=parseFloat(i[4])}else if(i=a.match(e)){for(var j=0;j<g.length;j++)g[j]=Math.round(2.55*parseFloat(i[j+1]));h=parseFloat(i[4])}else if(i=a.match(f)){if("transparent"==i[1])return[0,0,0,0];if(g=t[i[1]],!g)return}for(var j=0;j<g.length;j++)g[j]=r(g[j],0,255);return h=h||0==h?r(h,0,1):1,g[3]=h,g}}function d(a){if(a){var b=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,c=a.match(b);if(c){var d=parseFloat(c[4]),e=r(parseInt(c[1]),0,360),f=r(parseFloat(c[2]),0,100),g=r(parseFloat(c[3]),0,100),h=r(isNaN(d)?1:d,0,1);return[e,f,g,h]}}}function e(a){if(a){var b=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,c=a.match(b);if(c){var d=parseFloat(c[4]),e=r(parseInt(c[1]),0,360),f=r(parseFloat(c[2]),0,100),g=r(parseFloat(c[3]),0,100),h=r(isNaN(d)?1:d,0,1);return[e,f,g,h]}}}function f(a){var b=c(a);return b&&b.slice(0,3)}function g(a){var b=d(a);return b&&b.slice(0,3)}function h(a){var b=c(a);return b?b[3]:(b=d(a))?b[3]:(b=e(a))?b[3]:void 0}function i(a){return"#"+s(a[0])+s(a[1])+s(a[2])}function j(a,b){return 1>b||a[3]&&a[3]<1?k(a,b):"rgb("+a[0]+", "+a[1]+", "+a[2]+")"}function k(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"rgba("+a[0]+", "+a[1]+", "+a[2]+", "+b+")"}function l(a,b){if(1>b||a[3]&&a[3]<1)return m(a,b);var c=Math.round(a[0]/255*100),d=Math.round(a[1]/255*100),e=Math.round(a[2]/255*100);return"rgb("+c+"%, "+d+"%, "+e+"%)"}function m(a,b){var c=Math.round(a[0]/255*100),d=Math.round(a[1]/255*100),e=Math.round(a[2]/255*100);return"rgba("+c+"%, "+d+"%, "+e+"%, "+(b||a[3]||1)+")"}function n(a,b){return 1>b||a[3]&&a[3]<1?o(a,b):"hsl("+a[0]+", "+a[1]+"%, "+a[2]+"%)"}function o(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+b+")"}function p(a,b){return void 0===b&&(b=void 0!==a[3]?a[3]:1),"hwb("+a[0]+", "+a[1]+"%, "+a[2]+"%"+(void 0!==b&&1!==b?", "+b:"")+")"}function q(a){return u[a.slice(0,3)]}function r(a,b,c){return Math.min(Math.max(b,a),c)}function s(a){var b=a.toString(16).toUpperCase();return b.length<2?"0"+b:b}var t=a("color-name");b.exports={getRgba:c,getHsla:d,getRgb:f,getHsl:g,getHwb:e,getAlpha:h,hexString:i,rgbString:j,rgbaString:k,percentString:l,percentaString:m,hslString:n,hslaString:o,hwbString:p,keyword:q};var u={};for(var v in t)u[t[v]]=v},{"color-name":5}],5:[function(a,b){b.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],6:[function(a,b){b.exports=a("./lib/geocrunch")},{"./lib/geocrunch":11}],7:[function(a,b){var c=a("underscore"),d=a("./constants").EARTHRADIUS,e=a("./units"),f=a("./flipcoords"),g={sqmeters:function(a){return a},sqmiles:function(a){return e.sqMeters.toSqMiles(a)},acres:function(a){return e.sqMeters.toAcres(a)}},h=function(a){var b,c,f,g,h=0;for(b=0,c=a.length;c>b;b+=1)f=a[b],g=a[(b+1)%a.length],h+=e.degrees.toRadians(g[0]-f[0])*(2+Math.sin(e.degrees.toRadians(f[1]))+Math.sin(e.degrees.toRadians(g[1])));return Math.abs(h*d*d/2)},i=function(a){var b,c,d,e,f,g=a[0],h=0,i=0,j=0;if(1===a.length)return a[0];for(b=0,c=a.length;c>b;b+=1)d=a[b],e=a[(b+1)%a.length],f=(d[1]-g[1])*(e[0]-g[0])-(e[1]-g[1])*(d[0]-g[0]),h+=f,i+=(d[0]+e[0]-2*g[0])*f,j+=(d[1]+e[1]-2*g[1])*f;return f=3*h,[i/f+g[0],j/f+g[1]]};b.exports={_internalAreaCalc:function(){this._calcedArea||(this._calcedArea=this._coords.length<3?0:h(this._coords))},_internalCenterCalc:function(){!this._calcedCenter&&this._coords.length&&(this._calcedCenter=i(this._coords))},area:function(a){var b=c.extend({units:"sqmeters"},a);return this._internalAreaCalc(),c.isFunction(g[b.units])?g[b.units](this._calcedArea):void 0},center:function(){return this._internalCenterCalc(),this._options.imBackwards===!0?f(this._calcedCenter):this._calcedCenter}}},{"./constants":8,"./flipcoords":10,"./units":13,underscore:14}],8:[function(a,b){b.exports={EARTHRADIUS:6371e3}},{}],9:[function(a,b){var c=a("underscore"),d=a("./constants").EARTHRADIUS,e=a("./units"),f={meters:function(a){return a},kilometers:function(a){return e.meters.toKilometers(a)},feet:function(a){return e.meters.toFeet(a)},miles:function(a){return e.meters.toMiles(a)}},g=function(a,b){var c=e.degrees.toRadians(a[0]-b[0]),f=e.degrees.toRadians(a[1]-b[1]),g=e.degrees.toRadians(a[1]),h=e.degrees.toRadians(b[1]),i=Math.sin(c/2),j=Math.sin(f/2),k=j*j+i*i*Math.cos(g)*Math.cos(h);return 2*d*Math.atan2(Math.sqrt(k),Math.sqrt(1-k))};b.exports={_internalDistanceCalc:function(){var a,b,c=0;if(!this._calcedDistance){for(a=0,b=this._coords.length;b>a;a+=1)a>0&&(c+=g(this._coords[a-1],this._coords[a]));this._calcedDistance=c}},distance:function(a){var b=c.extend({units:"meters"},a);return this._internalDistanceCalc(),c.isFunction(f[b.units])?f[b.units](this._calcedDistance):void 0}}},{"./constants":8,"./units":13,underscore:14}],10:[function(a,b){var c=a("underscore");b.exports=function(a){return c.map(a,function(a){return[a[1],a[0]]})}},{underscore:14}],11:[function(a,b,c){var d=a("underscore"),e=a("./path"),f=a("./distance"),g=a("./area");d.extend(e.prototype,f,g),c.path=function(a,b){return new e(a,b)}},{"./area":7,"./distance":9,"./path":12,underscore:14}],12:[function(a,b){var c=a("./flipcoords"),d=function(a,b){this._options=b||{},a=a||[],this._coords=this._options.imBackwards===!0?c(a):a};b.exports=d},{"./flipcoords":10}],13:[function(a,b,c){c.meters={toFeet:function(a){return 3.28084*a},toKilometers:function(a){return.001*a},toMiles:function(a){return 621371e-9*a}},c.sqMeters={toSqMiles:function(a){return 3.86102e-7*a},toAcres:function(a){return 247105e-9*a}},c.degrees={toRadians:function(a){return a*Math.PI/180}}},{}],14:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.5.2";var A=z.each=z.forEach=function(a,b,c){if(null!=a)if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,function(a){return a[b]})},z.where=function(a,b,c){return z.isEmpty(b)?c?void 0:[]:z[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},z.findWhere=function(a,b){return z.where(a,b,!0)},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>d.computed&&(d={value:a,computed:g})}),d.value},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return arguments.length<2||c?a[z.random(a.length-1)]:z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return z.isFunction(a)?a:function(b){return b[a]}};z.sortBy=function(a,b,c){var d=D(b);return z.pluck(z.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={},f=null==c?z.identity:D(c);return A(b,function(c,g){var h=f.call(d,c,g,b);a(e,h,c)}),e}};z.groupBy=E(function(a,b,c){(z.has(a,b)?a[b]:a[b]=[]).push(c)}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=null==c?z.identity:D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.indexOf(b,a)>=0})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));
    2 return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){return a.apply(this,b.concat(j.call(arguments)))}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h;return function(){f=this,e=arguments,g=new Date;var i=function(){var j=new Date-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e)))},j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e)),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return function(){var c=[a];return i.apply(c,arguments),b.apply(this,c)}},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=x||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n","      ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],15:[function(a,b,c){(function(){var a=this,d=a.humanize,e={};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=e),c.humanize=e):("function"==typeof define&&define.amd&&define("humanize",function(){return e}),a.humanize=e),e.noConflict=function(){return a.humanize=d,this},e.pad=function(a,b,c,d){if(a+="",c?c.length>1&&(c=c.charAt(0)):c=" ",d=void 0===d?"left":"right","right"===d)for(;a.length<b;)a+=c;else for(;a.length<b;)a=c+a;return a},e.time=function(){return(new Date).getTime()/1e3};var f=[0,0,31,59,90,120,151,181,212,243,273,304,334],g=[0,0,31,60,91,121,152,182,213,244,274,305,335];e.date=function(a,b){var c=void 0===b?new Date:new Date(b instanceof Date?b:1e3*b),d=/\\?([a-z])/gi,h=function(a,b){return k[a]?k[a]():b},i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["January","February","March","April","May","June","July","August","September","October","November","December"],k={d:function(){return e.pad(k.j(),2,"0")},D:function(){return k.l().slice(0,3)},j:function(){return c.getDate()},l:function(){return i[k.w()]},N:function(){return k.w()||7},S:function(){var a=k.j();return a>4&&21>a?"th":{1:"st",2:"nd",3:"rd"}[a%10]||"th"},w:function(){return c.getDay()},z:function(){return(k.L()?g[k.n()]:f[k.n()])+k.j()-1},W:function(){var a=k.z()-k.N()+1.5;return e.pad(1+Math.floor(Math.abs(a)/7)+(a%7>3.5?1:0),2,"0")},F:function(){return j[c.getMonth()]},m:function(){return e.pad(k.n(),2,"0")},M:function(){return k.F().slice(0,3)},n:function(){return c.getMonth()+1},t:function(){return new Date(k.Y(),k.n(),0).getDate()},L:function(){return 1===new Date(k.Y(),1,29).getMonth()?1:0},o:function(){var a=k.n(),b=k.W();return k.Y()+(12===a&&9>b?-1:1===a&&b>9)},Y:function(){return c.getFullYear()},y:function(){return String(k.Y()).slice(-2)},a:function(){return c.getHours()>11?"pm":"am"},A:function(){return k.a().toUpperCase()},B:function(){var a=c.getTime()/1e3,b=a%86400+3600;0>b&&(b+=86400);var d=b/86.4%1e3;return 0>a?Math.ceil(d):Math.floor(d)},g:function(){return k.G()%12||12},G:function(){return c.getHours()},h:function(){return e.pad(k.g(),2,"0")},H:function(){return e.pad(k.G(),2,"0")},i:function(){return e.pad(c.getMinutes(),2,"0")},s:function(){return e.pad(c.getSeconds(),2,"0")},u:function(){return e.pad(1e3*c.getMilliseconds(),6,"0")},O:function(){var a=c.getTimezoneOffset(),b=Math.abs(a);return(a>0?"-":"+")+e.pad(100*Math.floor(b/60)+b%60,4,"0")},P:function(){var a=k.O();return a.substr(0,3)+":"+a.substr(3,2)},Z:function(){return 60*-c.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(d,h)},r:function(){return"D, d M Y H:i:s O".replace(d,h)},U:function(){return c.getTime()/1e3||0}};return a.replace(d,h)},e.numberFormat=function(a,b,c,d){b=isNaN(b)?2:Math.abs(b),c=void 0===c?".":c,d=void 0===d?",":d;var e=0>a?"-":"";a=Math.abs(+a||0);var f=parseInt(a.toFixed(b),10)+"",g=f.length>3?f.length%3:0;return e+(g?f.substr(0,g)+d:"")+f.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(b?c+Math.abs(a-f).toFixed(b).slice(2):"")},e.naturalDay=function(a,b){a=void 0===a?e.time():a,b=void 0===b?"Y-m-d":b;var c=86400,d=new Date,f=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime()/1e3;return f>a&&a>=f-c?"yesterday":a>=f&&f+c>a?"today":a>=f+c&&f+2*c>a?"tomorrow":e.date(b,a)},e.relativeTime=function(a){a=void 0===a?e.time():a;var b=e.time(),c=b-a;if(2>c&&c>-2)return(c>=0?"just ":"")+"now";if(60>c&&c>-60)return c>=0?Math.floor(c)+" seconds ago":"in "+Math.floor(-c)+" seconds";if(120>c&&c>-120)return c>=0?"about a minute ago":"in about a minute";if(3600>c&&c>-3600)return c>=0?Math.floor(c/60)+" minutes ago":"in "+Math.floor(-c/60)+" minutes";if(7200>c&&c>-7200)return c>=0?"about an hour ago":"in about an hour";if(86400>c&&c>-86400)return c>=0?Math.floor(c/3600)+" hours ago":"in "+Math.floor(-c/3600)+" hours";var d=172800;if(d>c&&c>-d)return c>=0?"1 day ago":"in 1 day";var f=2505600;if(f>c&&c>-f)return c>=0?Math.floor(c/86400)+" days ago":"in "+Math.floor(-c/86400)+" days";var g=5184e3;if(g>c&&c>-g)return c>=0?"about a month ago":"in about a month";var h=parseInt(e.date("Y",b),10),i=parseInt(e.date("Y",a),10),j=12*h+parseInt(e.date("n",b),10),k=12*i+parseInt(e.date("n",a),10),l=j-k;if(12>l&&l>-12)return l>=0?l+" months ago":"in "+-l+" months";var m=h-i;return 2>m&&m>-2?m>=0?"a year ago":"in a year":m>=0?m+" years ago":"in "+-m+" years"},e.ordinal=function(a){a=parseInt(a,10),a=isNaN(a)?0:a;var b=0>a?"-":"";a=Math.abs(a);var c=a%100;return b+a+(c>4&&21>c?"th":{1:"st",2:"nd",3:"rd"}[a%10]||"th")},e.filesize=function(a,b,c,d,f,g){return b=void 0===b?1024:b,0>=a?"0 bytes":(b>a&&void 0===c&&(c=0),void 0===g&&(g=" "),e.intword(a,["bytes","KB","MB","GB","TB","PB"],b,c,d,f,g))},e.intword=function(a,b,c,d,f,g,h){var i,j;b=b||["","K","M","B","T"],j=b.length-1,c=c||1e3,d=isNaN(d)?2:Math.abs(d),f=f||".",g=g||",",h=h||"";for(var k=0;k<b.length;k++)if(a<Math.pow(c,k+1)){j=k;break}i=a/Math.pow(c,j);var l=b[j]?h+b[j]:"";return e.numberFormat(i,d,f,g)+l},e.linebreaks=function(a){return a=a.replace(/^([\n|\r]*)/,""),a=a.replace(/([\n|\r]*)$/,""),a=a.replace(/(\r\n|\n|\r)/g,"\n"),a=a.replace(/(\n{2,})/g,"</p><p>"),a=a.replace(/\n/g,"<br />"),"<p>"+a+"</p>"},e.nl2br=function(a){return a.replace(/(\r\n|\n|\r)/g,"<br />")},e.truncatechars=function(a,b){return a.length<=b?a:a.substr(0,b)+"…"},e.truncatewords=function(a,b){var c=a.split(" ");return c.length<b?a:c.slice(0,b).join(" ")+"…"}}).call(this)},{}],16:[function(a,b,c){(function(){var a=this,d=a._,e=Array.prototype,f=Object.prototype,g=Function.prototype,h=e.push,i=e.slice,j=e.concat,k=f.toString,l=f.hasOwnProperty,m=Array.isArray,n=Object.keys,o=g.bind,p=function(a){return a instanceof p?a:this instanceof p?void(this._wrapped=a):new p(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=p),c._=p):a._=p,p.VERSION="1.7.0";var q=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}};p.iteratee=function(a,b,c){return null==a?p.identity:p.isFunction(a)?q(a,b,c):p.isObject(a)?p.matches(a):p.property(a)},p.each=p.forEach=function(a,b,c){if(null==a)return a;b=q(b,c);var d,e=a.length;if(e===+e)for(d=0;e>d;d++)b(a[d],d,a);else{var f=p.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},p.map=p.collect=function(a,b,c){if(null==a)return[];b=p.iteratee(b,c);for(var d,e=a.length!==+a.length&&p.keys(a),f=(e||a).length,g=Array(f),h=0;f>h;h++)d=e?e[h]:h,g[h]=b(a[d],d,a);return g};var r="Reduce of empty array with no initial value";p.reduce=p.foldl=p.inject=function(a,b,c,d){null==a&&(a=[]),b=q(b,d,4);var e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length,h=0;if(arguments.length<3){if(!g)throw new TypeError(r);c=a[f?f[h++]:h++]}for(;g>h;h++)e=f?f[h]:h,c=b(c,a[e],e,a);return c},p.reduceRight=p.foldr=function(a,b,c,d){null==a&&(a=[]),b=q(b,d,4);var e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;if(arguments.length<3){if(!g)throw new TypeError(r);c=a[f?f[--g]:--g]}for(;g--;)e=f?f[g]:g,c=b(c,a[e],e,a);return c},p.find=p.detect=function(a,b,c){var d;return b=p.iteratee(b,c),p.some(a,function(a,c,e){return b(a,c,e)?(d=a,!0):void 0}),d},p.filter=p.select=function(a,b,c){var d=[];return null==a?d:(b=p.iteratee(b,c),p.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d)},p.reject=function(a,b,c){return p.filter(a,p.negate(p.iteratee(b)),c)},p.every=p.all=function(a,b,c){if(null==a)return!0;b=p.iteratee(b,c);var d,e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;for(d=0;g>d;d++)if(e=f?f[d]:d,!b(a[e],e,a))return!1;return!0},p.some=p.any=function(a,b,c){if(null==a)return!1;b=p.iteratee(b,c);var d,e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;for(d=0;g>d;d++)if(e=f?f[d]:d,b(a[e],e,a))return!0;return!1},p.contains=p.include=function(a,b){return null==a?!1:(a.length!==+a.length&&(a=p.values(a)),p.indexOf(a,b)>=0)},p.invoke=function(a,b){var c=i.call(arguments,2),d=p.isFunction(b);return p.map(a,function(a){return(d?b:a[b]).apply(a,c)})},p.pluck=function(a,b){return p.map(a,p.property(b))},p.where=function(a,b){return p.filter(a,p.matches(b))},p.findWhere=function(a,b){return p.find(a,p.matches(b))},p.max=function(a,b,c){var d,e,f=-1/0,g=-1/0;if(null==b&&null!=a){a=a.length===+a.length?a:p.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=p.iteratee(b,c),p.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-1/0&&f===-1/0)&&(f=a,g=e)});return f},p.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=a.length===+a.length?a:p.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=p.iteratee(b,c),p.each(a,function(a,c,d){e=b(a,c,d),(g>e||1/0===e&&1/0===f)&&(f=a,g=e)});return f},p.shuffle=function(a){for(var b,c=a&&a.length===+a.length?a:p.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=p.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},p.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=p.values(a)),a[p.random(a.length-1)]):p.shuffle(a).slice(0,Math.max(0,b))},p.sortBy=function(a,b,c){return b=p.iteratee(b,c),p.pluck(p.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var s=function(a){return function(b,c,d){var e={};return c=p.iteratee(c,d),p.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};p.groupBy=s(function(a,b,c){p.has(a,c)?a[c].push(b):a[c]=[b]}),p.indexBy=s(function(a,b,c){a[c]=b}),p.countBy=s(function(a,b,c){p.has(a,c)?a[c]++:a[c]=1}),p.sortedIndex=function(a,b,c,d){c=p.iteratee(c,d,1);for(var e=c(b),f=0,g=a.length;g>f;){var h=f+g>>>1;c(a[h])<e?f=h+1:g=h}return f},p.toArray=function(a){return a?p.isArray(a)?i.call(a):a.length===+a.length?p.map(a,p.identity):p.values(a):[]},p.size=function(a){return null==a?0:a.length===+a.length?a.length:p.keys(a).length},p.partition=function(a,b,c){b=p.iteratee(b,c);var d=[],e=[];return p.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},p.first=p.head=p.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:i.call(a,0,b)},p.initial=function(a,b,c){return i.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},p.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:i.call(a,Math.max(a.length-b,0))},p.rest=p.tail=p.drop=function(a,b,c){return i.call(a,null==b||c?1:b)},p.compact=function(a){return p.filter(a,p.identity)};var t=function(a,b,c,d){if(b&&p.every(a,p.isArray))return j.apply(d,a);for(var e=0,f=a.length;f>e;e++){var g=a[e];p.isArray(g)||p.isArguments(g)?b?h.apply(d,g):t(g,b,c,d):c||d.push(g)}return d};p.flatten=function(a,b){return t(a,b,!1,[])},p.without=function(a){return p.difference(a,i.call(arguments,1))},p.uniq=p.unique=function(a,b,c,d){if(null==a)return[];p.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=p.iteratee(c,d));for(var e=[],f=[],g=0,h=a.length;h>g;g++){var i=a[g];if(b)g&&f===i||e.push(i),f=i;else if(c){var j=c(i,g,a);p.indexOf(f,j)<0&&(f.push(j),e.push(i))}else p.indexOf(e,i)<0&&e.push(i)}return e},p.union=function(){return p.uniq(t(arguments,!0,!0,[]))},p.intersection=function(a){if(null==a)return[];for(var b=[],c=arguments.length,d=0,e=a.length;e>d;d++){var f=a[d];if(!p.contains(b,f)){for(var g=1;c>g&&p.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},p.difference=function(a){var b=t(i.call(arguments,1),!0,!0,[]);return p.filter(a,function(a){return!p.contains(b,a)})},p.zip=function(a){if(null==a)return[];for(var b=p.max(arguments,"length").length,c=Array(b),d=0;b>d;d++)c[d]=p.pluck(arguments,d);return c},p.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},p.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=p.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}for(;e>d;d++)if(a[d]===b)return d;return-1},p.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=a.length;for("number"==typeof c&&(d=0>c?d+c+1:Math.min(d,c+1));--d>=0;)if(a[d]===b)return d;return-1},p.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=c||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=Array(d),f=0;d>f;f++,a+=c)e[f]=a;return e};var u=function(){};p.bind=function(a,b){var c,d;if(o&&a.bind===o)return o.apply(a,i.call(arguments,1));if(!p.isFunction(a))throw new TypeError("Bind must be called on a function");return c=i.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(i.call(arguments)));u.prototype=a.prototype;var e=new u;u.prototype=null;var f=a.apply(e,c.concat(i.call(arguments)));return p.isObject(f)?f:e}},p.partial=function(a){var b=i.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===p&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},p.bindAll=function(a){var b,c,d=arguments.length;if(1>=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=p.bind(a[c],a);return a},p.memoize=function(a,b){var c=function(d){var e=c.cache,f=b?b.apply(this,arguments):d;return p.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},p.delay=function(a,b){var c=i.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},p.defer=function(a){return p.delay.apply(p,[a,1].concat(i.call(arguments,1)))},p.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:p.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=p.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},p.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=p.now()-g;b>j&&j>0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=p.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},p.wrap=function(a,b){return p.partial(b,a)},p.negate=function(a){return function(){return!a.apply(this,arguments)}},p.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},p.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},p.before=function(a,b){var c;return function(){return--a>0?c=b.apply(this,arguments):b=null,c}},p.once=p.partial(p.before,2),p.keys=function(a){if(!p.isObject(a))return[];if(n)return n(a);var b=[];for(var c in a)p.has(a,c)&&b.push(c);return b},p.values=function(a){for(var b=p.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},p.pairs=function(a){for(var b=p.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},p.invert=function(a){for(var b={},c=p.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},p.functions=p.methods=function(a){var b=[];for(var c in a)p.isFunction(a[c])&&b.push(c);return b.sort()},p.extend=function(a){if(!p.isObject(a))return a;for(var b,c,d=1,e=arguments.length;e>d;d++){b=arguments[d];for(c in b)l.call(b,c)&&(a[c]=b[c])}return a},p.pick=function(a,b,c){var d,e={};if(null==a)return e;if(p.isFunction(b)){b=q(b,c);for(d in a){var f=a[d];b(f,d,a)&&(e[d]=f)}}else{var g=j.apply([],i.call(arguments,1));a=new Object(a);for(var h=0,k=g.length;k>h;h++)d=g[h],d in a&&(e[d]=a[d])}return e},p.omit=function(a,b,c){if(p.isFunction(b))b=p.negate(b);else{var d=p.map(j.apply([],i.call(arguments,1)),String);b=function(a,b){return!p.contains(d,b)}}return p.pick(a,b,c)},p.defaults=function(a){if(!p.isObject(a))return a;for(var b=1,c=arguments.length;c>b;b++){var d=arguments[b];for(var e in d)void 0===a[e]&&(a[e]=d[e])}return a},p.clone=function(a){return p.isObject(a)?p.isArray(a)?a.slice():p.extend({},a):a},p.tap=function(a,b){return b(a),a};var v=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof p&&(a=a._wrapped),b instanceof p&&(b=b._wrapped);var e=k.call(a);if(e!==k.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]===a)return d[f]===b;var g=a.constructor,h=b.constructor;if(g!==h&&"constructor"in a&&"constructor"in b&&!(p.isFunction(g)&&g instanceof g&&p.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i,j;if("[object Array]"===e){if(i=a.length,j=i===b.length)for(;i--&&(j=v(a[i],b[i],c,d)););}else{var l,m=p.keys(a);if(i=m.length,j=p.keys(b).length===i)for(;i--&&(l=m[i],j=p.has(b,l)&&v(a[l],b[l],c,d)););}return c.pop(),d.pop(),j};p.isEqual=function(a,b){return v(a,b,[],[])},p.isEmpty=function(a){if(null==a)return!0;if(p.isArray(a)||p.isString(a)||p.isArguments(a))return 0===a.length;for(var b in a)if(p.has(a,b))return!1;return!0},p.isElement=function(a){return!(!a||1!==a.nodeType)},p.isArray=m||function(a){return"[object Array]"===k.call(a)},p.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},p.each(["Arguments","Function","String","Number","Date","RegExp"],function(a){p["is"+a]=function(b){return k.call(b)==="[object "+a+"]"}}),p.isArguments(arguments)||(p.isArguments=function(a){return p.has(a,"callee")}),"function"!=typeof/./&&(p.isFunction=function(a){return"function"==typeof a||!1}),p.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},p.isNaN=function(a){return p.isNumber(a)&&a!==+a},p.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===k.call(a)},p.isNull=function(a){return null===a},p.isUndefined=function(a){return void 0===a},p.has=function(a,b){return null!=a&&l.call(a,b)},p.noConflict=function(){return a._=d,this},p.identity=function(a){return a},p.constant=function(a){return function(){return a}},p.noop=function(){},p.property=function(a){return function(b){return b[a]}},p.matches=function(a){var b=p.pairs(a),c=b.length;return function(a){if(null==a)return!c;a=new Object(a);for(var d=0;c>d;d++){var e=b[d],f=e[0];if(e[1]!==a[f]||!(f in a))return!1}return!0}},p.times=function(a,b,c){var d=Array(Math.max(0,a));b=q(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},p.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},p.now=Date.now||function(){return(new Date).getTime()};var w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},x=p.invert(w),y=function(a){var b=function(b){return a[b]},c="(?:"+p.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};p.escape=y(w),p.unescape=y(x),p.result=function(a,b){if(null==a)return void 0;var c=a[b];return p.isFunction(c)?a[b]():c};var z=0;p.uniqueId=function(a){var b=++z+"";return a?a+b:b},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},C=/\\|'|\r|\n|\u2028|\u2029/g,D=function(a){return"\\"+B[a]};p.template=function(a,b,c){!b&&c&&(b=c),b=p.defaults({},b,p.templateSettings);var d=RegExp([(b.escape||A).source,(b.interpolate||A).source,(b.evaluate||A).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(C,D),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,p)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},p.chain=function(a){var b=p(a);return b._chain=!0,b};var E=function(a){return this._chain?p(a).chain():a};p.mixin=function(a){p.each(p.functions(a),function(b){var c=p[b]=a[b];p.prototype[b]=function(){var a=[this._wrapped];return h.apply(a,arguments),E.call(this,c.apply(p,a))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=e[a];p.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],E.call(this,c)}}),p.each(["concat","join","slice"],function(a){var b=e[a];p.prototype[a]=function(){return E.call(this,b.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return p})}).call(this)},{}],17:[function(a,b){var c=a("underscore"),d=a("geocrunch"),e=function(a){return 10>a?"0"+a.toString():a.toString()},f=function(a,b,c){var d=Math.abs(a),f=Math.floor(d),g=Math.floor(60*(d-f)),h=Math.round(3600*(d-f-g/60)*100)/100,i=d===a?b:c;return e(f)+"&deg; "+e(g)+"' "+e(h)+'" '+i},g=function(a){var b,e,g,h,i,j,k,l,m=c.last(a),n=d.path(c.map(a,function(a){return[a.lng,a.lat]}));return b=n.distance({units:"feet"}),e=b/3.2808,g=b/5280,h=e/1e3,i=n.area({units:"sqmeters"}),j=24711e-8*i,k=i/1e4,l=.0015625*j,{lastCoord:{dd:{x:m.lng,y:m.lat},dms:{x:f(m.lng,"E","W"),y:f(m.lat,"N","S")}},length:{feet:b,meters:e,miles:g,kilometers:h},area:{acres:j,hectares:k,sqmeters:i,sqmiles:l}}};b.exports={measure:g}},{geocrunch:6,underscore:16}],18:[function(a,b){var c=function(a,b){return b||(b=document),b.querySelector(a)},d=function(a,b){return b||(b=document),Array.prototype.slice.call(b.querySelectorAll(a))},e=function(a){return a?(a.setAttribute("style","display:none;"),a):void 0},f=function(a){return a?(a.removeAttribute("style"),a):void 0};b.exports={$:c,$$:d,hide:e,show:f}},{}],19:[function(a){(function(b){var c=a("underscore"),d="undefined"!=typeof window?window.L:"undefined"!=typeof b?b.L:null,e=a("humanize"),f=a("./units"),g=a("./calc"),h=a("./dom"),i=h.$,j=a("./mapsymbology"),k=c.template('<a class="<%= model.className %>-toggle js-toggle" href="#" title="Measure distances and areas">Measure</a>\n<div class="<%= model.className %>-interaction js-interaction">\n  <div class="js-startprompt startprompt">\n    <h3>Measure Distances and Areas</h3>\n    <ul class="tasks">\n      <a href="#" class="js-start start">Create a new measurement</a>\n    </ul>\n  </div>\n  <div class="js-measuringprompt">\n    <h3>Measure Distances and Areas</h3>\n    <p class="js-starthelp">Start creating a measurement by adding points to the map</h3>\n    <div class="js-results results"></div>\n    <ul class="js-measuretasks tasks">\n      <li><a href="#" class="js-cancel cancel">Cancel</a></li>\n      <li><a href="#" class="js-finish finish">Finish Measurement</a></li>\n    </ul>\n  </div>\n</div>'),l=c.template('<div class="group">\n<p class="lastpoint heading">Last Point</p>\n<p><%= model.lastCoord.dms.y %> <span class="coorddivider">/</span> <%= model.lastCoord.dms.x %></p>\n<p><%= humanize.numberFormat(model.lastCoord.dd.y, 6) %> <span class="coorddivider">/</span> <%= humanize.numberFormat(model.lastCoord.dd.x, 6) %></p>\n</div>\n<% if (model.pointCount > 1) { %>\n<div class="group">\n<p><span class="heading">Path Distance</span> <%= model.lengthDisplay %></p>\n</div>\n<% } %>\n<% if (model.pointCount > 2) { %>\n<div class="group">\n<p><span class="heading">Area</span> <%= model.areaDisplay %></p>\n</div>\n<% } %>'),m=c.template('<h3>Point Location</h3>\n<p><%= model.lastCoord.dms.y %> <span class="coorddivider">/</span> <%= model.lastCoord.dms.x %></p>\n<p><%= humanize.numberFormat(model.lastCoord.dd.y, 6) %> <span class="coorddivider">/</span> <%= humanize.numberFormat(model.lastCoord.dd.x, 6) %></p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Location</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>'),n=c.template('<h3>Linear Measurement</h3>\n<p><%= model.lengthDisplay %></p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Line</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>'),o=c.template('<h3>Area Measurement</h3>\n<p><%= model.areaDisplay %></p>\n<p><%= model.lengthDisplay %> Perimeter</p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Area</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>');
    3 d.Control.Measure=d.Control.extend({_className:"leaflet-control-measure",options:{position:"topright",primaryLengthUnit:"feet",secondaryLengthUnit:"miles",primaryAreaUnit:"acres",activeColor:"#ABE67E",completedColor:"#C8F2BE",popupOptions:{className:"leaflet-measure-resultpopup",autoPanPadding:[10,10]}},initialize:function(a){d.setOptions(this,a),this._symbols=new j(c.pick(this.options,"activeColor","completedColor"))},onAdd:function(a){return this._map=a,this._latlngs=[],this._initLayout(),a.on("click",this._collapse,this),this._layer=d.layerGroup().addTo(a),this._container},onRemove:function(a){a.off("click",this._collapse,this),a.removeLayer(this._layer)},_initLayout:function(){var a,b,c,e,f=this._className,g=this._container=d.DomUtil.create("div",f);g.innerHTML=k({model:{className:f}}),g.setAttribute("aria-haspopup",!0),d.Browser.touch?d.DomEvent.on(g,"click",d.DomEvent.stopPropagation):(d.DomEvent.disableClickPropagation(g),d.DomEvent.disableScrollPropagation(g)),a=this.$toggle=i(".js-toggle",g),this.$interaction=i(".js-interaction",g),b=i(".js-start",g),c=i(".js-cancel",g),e=i(".js-finish",g),this.$startPrompt=i(".js-startprompt",g),this.$measuringPrompt=i(".js-measuringprompt",g),this.$startHelp=i(".js-starthelp",g),this.$results=i(".js-results",g),this.$measureTasks=i(".js-measuretasks",g),this._collapse(),this._updateMeasureNotStarted(),d.Browser.android||(d.DomEvent.on(g,"mouseenter",this._expand,this),d.DomEvent.on(g,"mouseleave",this._collapse,this)),d.DomEvent.on(a,"click",d.DomEvent.stop),d.Browser.touch?d.DomEvent.on(a,"click",this._expand,this):d.DomEvent.on(a,"focus",this._expand,this),d.DomEvent.on(b,"click",d.DomEvent.stop),d.DomEvent.on(b,"click",this._startMeasure,this),d.DomEvent.on(c,"click",d.DomEvent.stop),d.DomEvent.on(c,"click",this._finishMeasure,this),d.DomEvent.on(e,"click",d.DomEvent.stop),d.DomEvent.on(e,"click",this._handleMeasureDoubleClick,this)},_expand:function(){h.hide(this.$toggle),h.show(this.$interaction)},_collapse:function(){this._locked||(h.hide(this.$interaction),h.show(this.$toggle))},_updateMeasureNotStarted:function(){h.hide(this.$startHelp),h.hide(this.$results),h.hide(this.$measureTasks),h.hide(this.$measuringPrompt),h.show(this.$startPrompt)},_updateMeasureStartedNoPoints:function(){h.hide(this.$results),h.show(this.$startHelp),h.show(this.$measureTasks),h.hide(this.$startPrompt),h.show(this.$measuringPrompt)},_updateMeasureStartedWithPoints:function(){h.hide(this.$startHelp),h.show(this.$results),h.show(this.$measureTasks),h.hide(this.$startPrompt),h.show(this.$measuringPrompt)},_startMeasure:function(){this._locked=!0,this._map.doubleClickZoom.disable(),this._map.on("mouseout",this._handleMapMouseOut,this),d.DomEvent.on(this._container,"mouseenter",this._handleMapMouseOut,this),this._measureCollector||(this._measureCollector=d.polygon([[90,-180],[90,180],[-90,180],[-90,-180]],this._symbols.getSymbol("measureCollector")).addTo(this._layer),this._measureCollector.on("mousemove",this._handleMeasureMove,this),this._measureCollector.on("dblclick",this._handleMeasureDoubleClick,this),this._measureCollector.on("click",this._handleMeasureClick,this)),this._measureCollector.bringToFront(),this._measureVertexes=d.featureGroup().addTo(this._layer),this._updateMeasureStartedNoPoints()},_finishMeasure:function(){this._locked=!1,this._map.doubleClickZoom.enable(),this._map.off("mouseout",this._handleMapMouseOut,this),d.DomEvent.off(this._container,"mouseover",this._handleMapMouseOut,this),this._clearMeasure(),this._measureCollector.off(),this._layer.removeLayer(this._measureCollector),this._measureCollector=null,this._layer.removeLayer(this._measureVertexes),this._measureVertexes=null,this._updateMeasureNotStarted(),this._collapse()},_clearMeasure:function(){this._latlngs=[],this._measureVertexes.clearLayers(),this._measureDrag&&this._layer.removeLayer(this._measureDrag),this._measureArea&&this._layer.removeLayer(this._measureArea),this._measureBoundary&&this._layer.removeLayer(this._measureBoundary),this._measureDrag=null,this._measureArea=null,this._measureBoundary=null},_getMeasurementDisplayStrings:function(a){var b={};return this.options.primaryLengthUnit&&f[this.options.primaryLengthUnit]&&(b.lengthDisplay=e.numberFormat(a.length[this.options.primaryLengthUnit],f[this.options.primaryLengthUnit].decimals)+" "+f[this.options.primaryLengthUnit].display,this.options.secondaryLengthUnit&&f[this.options.secondaryLengthUnit]&&(b.lengthDisplay=b.lengthDisplay+" ("+e.numberFormat(a.length[this.options.secondaryLengthUnit],f[this.options.secondaryLengthUnit].decimals)+" "+f[this.options.secondaryLengthUnit].display+")")),this.options.primaryAreaUnit&&f[this.options.primaryAreaUnit]&&(b.areaDisplay=e.numberFormat(a.area[this.options.primaryAreaUnit],f[this.options.primaryAreaUnit].decimals)+" "+f[this.options.primaryAreaUnit].display,this.options.secondaryAreaUnit&&f[this.options.secondaryAreaUnit]&&(b.areaDisplay=b.areaDisplay+" ("+e.numberFormat(a.area[this.options.secondaryAreaUnit],f[this.options.secondaryAreaUnit].decimals)+" "+f[this.options.secondaryAreaUnit].display+")")),b},_updateResults:function(){var a=g.measure(this._latlngs);this.$results.innerHTML=l({model:c.extend({},a,this._getMeasurementDisplayStrings(a),{pointCount:this._latlngs.length}),humanize:e})},_handleMeasureMove:function(a){this._measureDrag?this._measureDrag.setLatLng(a.latlng):this._measureDrag=d.circleMarker(a.latlng,this._symbols.getSymbol("measureDrag")).addTo(this._layer),this._measureDrag.bringToFront()},_handleMeasureDoubleClick:function(){var a,b,f,h,j,k,l=this._latlngs;this._finishMeasure(),l.length&&(l.length>2&&l.push(c.first(l)),a=g.measure(l),1===l.length?(b=d.circleMarker(l[0],this._symbols.getSymbol("resultPoint")),h=m({model:a,humanize:e})):2===l.length?(b=d.polyline(l,this._symbols.getSymbol("resultLine")).addTo(this._map),h=n({model:c.extend({},a,this._getMeasurementDisplayStrings(a)),humanize:e})):(b=d.polygon(l,this._symbols.getSymbol("resultArea")),h=o({model:c.extend({},a,this._getMeasurementDisplayStrings(a)),humanize:e,units:this._units})),f=d.DomUtil.create("div",""),f.innerHTML=h,j=i(".js-zoomto",f),j&&(d.DomEvent.on(j,"click",d.DomEvent.stop),d.DomEvent.on(j,"click",function(){this._map.fitBounds(b.getBounds(),{padding:[20,20],maxZoom:17})},this)),k=i(".js-deletemarkup",f),k&&(d.DomEvent.on(k,"click",d.DomEvent.stop),d.DomEvent.on(k,"click",function(){this._map.removeLayer(b)},this)),b.addTo(this._map),b.bindPopup(f,this.options.popupOptions),b.openPopup(b.getBounds().getCenter()))},_handleMeasureClick:function(a){var b=a.latlng,d=c.last(this._latlngs),e=this._symbols.getSymbol("measureVertex");this._map.closePopup(),d&&b.equals(d)||(this._latlngs.push(b),this._addMeasureArea(this._latlngs),this._addMeasureBoundary(this._latlngs),this._measureVertexes.eachLayer(function(a){a.setStyle(e),a._path.setAttribute("class",e.className)}),this._addNewVertex(b),this._measureBoundary&&this._measureBoundary.bringToFront(),this._measureVertexes.bringToFront()),this._updateResults(),this._updateMeasureStartedWithPoints()},_handleMapMouseOut:function(){this._measureDrag&&(this._layer.removeLayer(this._measureDrag),this._measureDrag=null)},_addNewVertex:function(a){d.circleMarker(a,this._symbols.getSymbol("measureVertexActive")).addTo(this._measureVertexes)},_addMeasureArea:function(a){return a.length<3?void(this._measureArea&&(this._layer.removeLayer(this._measureArea),this._measureArea=null)):void(this._measureArea?this._measureArea.setLatLngs(a):this._measureArea=d.polygon(a,this._symbols.getSymbol("measureArea")).addTo(this._layer))},_addMeasureBoundary:function(a){return a.length<2?void(this._measureBoundary&&(this._layer.removeLayer(this._measureBoundary),this._measureBoundary=null)):void(this._measureBoundary?this._measureBoundary.setLatLngs(a):this._measureBoundary=d.polyline(a,this._symbols.getSymbol("measureBoundary")).addTo(this._layer))}}),d.Map.mergeOptions({measureControl:!1}),d.Map.addInitHook(function(){this.options.measureControl&&(this.measureControl=(new d.Control.Measure).addTo(this))}),d.control.measure=function(a){return new d.Control.Measure(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./calc":17,"./dom":18,"./mapsymbology":20,"./units":21,humanize:15,underscore:16}],20:[function(a,b){var c=a("underscore"),d=a("color"),e=function(a){this.setOptions(a)};e.DEFAULTS={activeColor:"#ABE67E",completedColor:"#C8F2BE"},c.extend(e.prototype,{setOptions:function(a){return this._options=c.extend({},e.DEFAULTS,this._options,a),this},getSymbol:function(a){var b={measureCollector:{clickable:!0,stroke:!1,fillOpacity:0,className:"layer-measurecollector"},measureDrag:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:.7,fillColor:this._options.activeColor,fillOpacity:.5,className:"layer-measuredrag"},measureArea:{clickable:!1,stroke:!1,fillColor:this._options.activeColor,fillOpacity:.2,className:"layer-measurearea"},measureBoundary:{clickable:!1,color:this._options.activeColor,weight:2,opacity:.9,fill:!1,className:"layer-measureboundary"},measureVertex:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:1,fillColor:this._options.activeColor,fillOpacity:.7,className:"layer-measurevertex"},measureVertexActive:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:1,fillColor:d(this._options.activeColor).darken(.15),fillOpacity:.7,className:"layer-measurevertex active"},resultArea:{clickable:!0,color:this._options.completedColor,weight:2,opacity:.9,fillColor:this._options.completedColor,fillOpacity:.2,className:"layer-measure-resultarea"},resultLine:{clickable:!0,color:this._options.completedColor,weight:3,opacity:.9,fill:!1,className:"layer-measure-resultline"},resultPoint:{clickable:!0,radius:4,color:this._options.completedColor,weight:2,opacity:1,fillColor:this._options.completedColor,fillOpacity:.7,className:"layer-measure-resultpoint"}};return b[a]}}),b.exports=e},{color:1,underscore:16}],21:[function(a,b){b.exports={acres:{display:"Acres",decimals:2},feet:{display:"Feet",decimals:0},kilometers:{display:"Kilometers",decimals:2},hectares:{display:"Hectares",decimals:2},meters:{display:"Meters",decimals:0},miles:{display:"Miles",decimals:2},sqmeters:{display:"Sq Meters",decimals:0},sqmiles:{display:"Sq Miles",decimals:2}}},{}]},{},[19]);
     2return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){return a.apply(this,b.concat(j.call(arguments)))}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h;return function(){f=this,e=arguments,g=new Date;var i=function(){var j=new Date-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e)))},j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e)),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return function(){var c=[a];return i.apply(c,arguments),b.apply(this,c)}},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=x||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n","      ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],15:[function(a,b,c){(function(){var a=this,d=a.humanize,e={};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=e),c.humanize=e):("function"==typeof define&&define.amd&&define("humanize",function(){return e}),a.humanize=e),e.noConflict=function(){return a.humanize=d,this},e.pad=function(a,b,c,d){if(a+="",c?c.length>1&&(c=c.charAt(0)):c=" ",d=void 0===d?"left":"right","right"===d)for(;a.length<b;)a+=c;else for(;a.length<b;)a=c+a;return a},e.time=function(){return(new Date).getTime()/1e3};var f=[0,0,31,59,90,120,151,181,212,243,273,304,334],g=[0,0,31,60,91,121,152,182,213,244,274,305,335];e.date=function(a,b){var c=void 0===b?new Date:new Date(b instanceof Date?b:1e3*b),d=/\\?([a-z])/gi,h=function(a,b){return k[a]?k[a]():b},i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["January","February","March","April","May","June","July","August","September","October","November","December"],k={d:function(){return e.pad(k.j(),2,"0")},D:function(){return k.l().slice(0,3)},j:function(){return c.getDate()},l:function(){return i[k.w()]},N:function(){return k.w()||7},S:function(){var a=k.j();return a>4&&21>a?"th":{1:"st",2:"nd",3:"rd"}[a%10]||"th"},w:function(){return c.getDay()},z:function(){return(k.L()?g[k.n()]:f[k.n()])+k.j()-1},W:function(){var a=k.z()-k.N()+1.5;return e.pad(1+Math.floor(Math.abs(a)/7)+(a%7>3.5?1:0),2,"0")},F:function(){return j[c.getMonth()]},m:function(){return e.pad(k.n(),2,"0")},M:function(){return k.F().slice(0,3)},n:function(){return c.getMonth()+1},t:function(){return new Date(k.Y(),k.n(),0).getDate()},L:function(){return 1===new Date(k.Y(),1,29).getMonth()?1:0},o:function(){var a=k.n(),b=k.W();return k.Y()+(12===a&&9>b?-1:1===a&&b>9)},Y:function(){return c.getFullYear()},y:function(){return String(k.Y()).slice(-2)},a:function(){return c.getHours()>11?"pm":"am"},A:function(){return k.a().toUpperCase()},B:function(){var a=c.getTime()/1e3,b=a%86400+3600;0>b&&(b+=86400);var d=b/86.4%1e3;return 0>a?Math.ceil(d):Math.floor(d)},g:function(){return k.G()%12||12},G:function(){return c.getHours()},h:function(){return e.pad(k.g(),2,"0")},H:function(){return e.pad(k.G(),2,"0")},i:function(){return e.pad(c.getMinutes(),2,"0")},s:function(){return e.pad(c.getSeconds(),2,"0")},u:function(){return e.pad(1e3*c.getMilliseconds(),6,"0")},O:function(){var a=c.getTimezoneOffset(),b=Math.abs(a);return(a>0?"-":"+")+e.pad(100*Math.floor(b/60)+b%60,4,"0")},P:function(){var a=k.O();return a.substr(0,3)+":"+a.substr(3,2)},Z:function(){return 60*-c.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(d,h)},r:function(){return"D, d M Y H:i:s O".replace(d,h)},U:function(){return c.getTime()/1e3||0}};return a.replace(d,h)},e.numberFormat=function(a,b,c,d){b=isNaN(b)?2:Math.abs(b),c=void 0===c?".":c,d=void 0===d?",":d;var e=0>a?"-":"";a=Math.abs(+a||0);var f=parseInt(a.toFixed(b),10)+"",g=f.length>3?f.length%3:0;return e+(g?f.substr(0,g)+d:"")+f.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(b?c+Math.abs(a-f).toFixed(b).slice(2):"")},e.naturalDay=function(a,b){a=void 0===a?e.time():a,b=void 0===b?"Y-m-d":b;var c=86400,d=new Date,f=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime()/1e3;return f>a&&a>=f-c?"yesterday":a>=f&&f+c>a?"today":a>=f+c&&f+2*c>a?"tomorrow":e.date(b,a)},e.relativeTime=function(a){a=void 0===a?e.time():a;var b=e.time(),c=b-a;if(2>c&&c>-2)return(c>=0?"just ":"")+"now";if(60>c&&c>-60)return c>=0?Math.floor(c)+" seconds ago":"in "+Math.floor(-c)+" seconds";if(120>c&&c>-120)return c>=0?"about a minute ago":"in about a minute";if(3600>c&&c>-3600)return c>=0?Math.floor(c/60)+" minutes ago":"in "+Math.floor(-c/60)+" minutes";if(7200>c&&c>-7200)return c>=0?"about an hour ago":"in about an hour";if(86400>c&&c>-86400)return c>=0?Math.floor(c/3600)+" hours ago":"in "+Math.floor(-c/3600)+" hours";var d=172800;if(d>c&&c>-d)return c>=0?"1 day ago":"in 1 day";var f=2505600;if(f>c&&c>-f)return c>=0?Math.floor(c/86400)+" days ago":"in "+Math.floor(-c/86400)+" days";var g=5184e3;if(g>c&&c>-g)return c>=0?"about a month ago":"in about a month";var h=parseInt(e.date("Y",b),10),i=parseInt(e.date("Y",a),10),j=12*h+parseInt(e.date("n",b),10),k=12*i+parseInt(e.date("n",a),10),l=j-k;if(12>l&&l>-12)return l>=0?l+" months ago":"in "+-l+" months";var m=h-i;return 2>m&&m>-2?m>=0?"a year ago":"in a year":m>=0?m+" years ago":"in "+-m+" years"},e.ordinal=function(a){a=parseInt(a,10),a=isNaN(a)?0:a;var b=0>a?"-":"";a=Math.abs(a);var c=a%100;return b+a+(c>4&&21>c?"th":{1:"st",2:"nd",3:"rd"}[a%10]||"th")},e.filesize=function(a,b,c,d,f,g){return b=void 0===b?1024:b,0>=a?"0 bytes":(b>a&&void 0===c&&(c=0),void 0===g&&(g=" "),e.intword(a,["bytes","KB","MB","GB","TB","PB"],b,c,d,f,g))},e.intword=function(a,b,c,d,f,g,h){var i,j;b=b||["","K","M","B","T"],j=b.length-1,c=c||1e3,d=isNaN(d)?2:Math.abs(d),f=f||".",g=g||",",h=h||"";for(var k=0;k<b.length;k++)if(a<Math.pow(c,k+1)){j=k;break}i=a/Math.pow(c,j);var l=b[j]?h+b[j]:"";return e.numberFormat(i,d,f,g)+l},e.linebreaks=function(a){return a=a.replace(/^([\n|\r]*)/,""),a=a.replace(/([\n|\r]*)$/,""),a=a.replace(/(\r\n|\n|\r)/g,"\n"),a=a.replace(/(\n{2,})/g,"</p><p>"),a=a.replace(/\n/g,"<br />"),"<p>"+a+"</p>"},e.nl2br=function(a){return a.replace(/(\r\n|\n|\r)/g,"<br />")},e.truncatechars=function(a,b){return a.length<=b?a:a.substr(0,b)+"…"},e.truncatewords=function(a,b){var c=a.split(" ");return c.length<b?a:c.slice(0,b).join(" ")+"…"}}).call(this)},{}],16:[function(a,b,c){(function(){var a=this,d=a._,e=Array.prototype,f=Object.prototype,g=Function.prototype,h=e.push,i=e.slice,j=e.concat,k=f.toString,l=f.hasOwnProperty,m=Array.isArray,n=Object.keys,o=g.bind,p=function(a){return a instanceof p?a:this instanceof p?void(this._wrapped=a):new p(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=p),c._=p):a._=p,p.VERSION="1.7.0";var q=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}};p.iteratee=function(a,b,c){return null==a?p.identity:p.isFunction(a)?q(a,b,c):p.isObject(a)?p.matches(a):p.property(a)},p.each=p.forEach=function(a,b,c){if(null==a)return a;b=q(b,c);var d,e=a.length;if(e===+e)for(d=0;e>d;d++)b(a[d],d,a);else{var f=p.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},p.map=p.collect=function(a,b,c){if(null==a)return[];b=p.iteratee(b,c);for(var d,e=a.length!==+a.length&&p.keys(a),f=(e||a).length,g=Array(f),h=0;f>h;h++)d=e?e[h]:h,g[h]=b(a[d],d,a);return g};var r="Reduce of empty array with no initial value";p.reduce=p.foldl=p.inject=function(a,b,c,d){null==a&&(a=[]),b=q(b,d,4);var e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length,h=0;if(arguments.length<3){if(!g)throw new TypeError(r);c=a[f?f[h++]:h++]}for(;g>h;h++)e=f?f[h]:h,c=b(c,a[e],e,a);return c},p.reduceRight=p.foldr=function(a,b,c,d){null==a&&(a=[]),b=q(b,d,4);var e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;if(arguments.length<3){if(!g)throw new TypeError(r);c=a[f?f[--g]:--g]}for(;g--;)e=f?f[g]:g,c=b(c,a[e],e,a);return c},p.find=p.detect=function(a,b,c){var d;return b=p.iteratee(b,c),p.some(a,function(a,c,e){return b(a,c,e)?(d=a,!0):void 0}),d},p.filter=p.select=function(a,b,c){var d=[];return null==a?d:(b=p.iteratee(b,c),p.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d)},p.reject=function(a,b,c){return p.filter(a,p.negate(p.iteratee(b)),c)},p.every=p.all=function(a,b,c){if(null==a)return!0;b=p.iteratee(b,c);var d,e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;for(d=0;g>d;d++)if(e=f?f[d]:d,!b(a[e],e,a))return!1;return!0},p.some=p.any=function(a,b,c){if(null==a)return!1;b=p.iteratee(b,c);var d,e,f=a.length!==+a.length&&p.keys(a),g=(f||a).length;for(d=0;g>d;d++)if(e=f?f[d]:d,b(a[e],e,a))return!0;return!1},p.contains=p.include=function(a,b){return null==a?!1:(a.length!==+a.length&&(a=p.values(a)),p.indexOf(a,b)>=0)},p.invoke=function(a,b){var c=i.call(arguments,2),d=p.isFunction(b);return p.map(a,function(a){return(d?b:a[b]).apply(a,c)})},p.pluck=function(a,b){return p.map(a,p.property(b))},p.where=function(a,b){return p.filter(a,p.matches(b))},p.findWhere=function(a,b){return p.find(a,p.matches(b))},p.max=function(a,b,c){var d,e,f=-1/0,g=-1/0;if(null==b&&null!=a){a=a.length===+a.length?a:p.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=p.iteratee(b,c),p.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-1/0&&f===-1/0)&&(f=a,g=e)});return f},p.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=a.length===+a.length?a:p.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=p.iteratee(b,c),p.each(a,function(a,c,d){e=b(a,c,d),(g>e||1/0===e&&1/0===f)&&(f=a,g=e)});return f},p.shuffle=function(a){for(var b,c=a&&a.length===+a.length?a:p.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=p.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},p.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=p.values(a)),a[p.random(a.length-1)]):p.shuffle(a).slice(0,Math.max(0,b))},p.sortBy=function(a,b,c){return b=p.iteratee(b,c),p.pluck(p.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var s=function(a){return function(b,c,d){var e={};return c=p.iteratee(c,d),p.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};p.groupBy=s(function(a,b,c){p.has(a,c)?a[c].push(b):a[c]=[b]}),p.indexBy=s(function(a,b,c){a[c]=b}),p.countBy=s(function(a,b,c){p.has(a,c)?a[c]++:a[c]=1}),p.sortedIndex=function(a,b,c,d){c=p.iteratee(c,d,1);for(var e=c(b),f=0,g=a.length;g>f;){var h=f+g>>>1;c(a[h])<e?f=h+1:g=h}return f},p.toArray=function(a){return a?p.isArray(a)?i.call(a):a.length===+a.length?p.map(a,p.identity):p.values(a):[]},p.size=function(a){return null==a?0:a.length===+a.length?a.length:p.keys(a).length},p.partition=function(a,b,c){b=p.iteratee(b,c);var d=[],e=[];return p.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},p.first=p.head=p.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:i.call(a,0,b)},p.initial=function(a,b,c){return i.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},p.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:i.call(a,Math.max(a.length-b,0))},p.rest=p.tail=p.drop=function(a,b,c){return i.call(a,null==b||c?1:b)},p.compact=function(a){return p.filter(a,p.identity)};var t=function(a,b,c,d){if(b&&p.every(a,p.isArray))return j.apply(d,a);for(var e=0,f=a.length;f>e;e++){var g=a[e];p.isArray(g)||p.isArguments(g)?b?h.apply(d,g):t(g,b,c,d):c||d.push(g)}return d};p.flatten=function(a,b){return t(a,b,!1,[])},p.without=function(a){return p.difference(a,i.call(arguments,1))},p.uniq=p.unique=function(a,b,c,d){if(null==a)return[];p.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=p.iteratee(c,d));for(var e=[],f=[],g=0,h=a.length;h>g;g++){var i=a[g];if(b)g&&f===i||e.push(i),f=i;else if(c){var j=c(i,g,a);p.indexOf(f,j)<0&&(f.push(j),e.push(i))}else p.indexOf(e,i)<0&&e.push(i)}return e},p.union=function(){return p.uniq(t(arguments,!0,!0,[]))},p.intersection=function(a){if(null==a)return[];for(var b=[],c=arguments.length,d=0,e=a.length;e>d;d++){var f=a[d];if(!p.contains(b,f)){for(var g=1;c>g&&p.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},p.difference=function(a){var b=t(i.call(arguments,1),!0,!0,[]);return p.filter(a,function(a){return!p.contains(b,a)})},p.zip=function(a){if(null==a)return[];for(var b=p.max(arguments,"length").length,c=Array(b),d=0;b>d;d++)c[d]=p.pluck(arguments,d);return c},p.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},p.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=p.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}for(;e>d;d++)if(a[d]===b)return d;return-1},p.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=a.length;for("number"==typeof c&&(d=0>c?d+c+1:Math.min(d,c+1));--d>=0;)if(a[d]===b)return d;return-1},p.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=c||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=Array(d),f=0;d>f;f++,a+=c)e[f]=a;return e};var u=function(){};p.bind=function(a,b){var c,d;if(o&&a.bind===o)return o.apply(a,i.call(arguments,1));if(!p.isFunction(a))throw new TypeError("Bind must be called on a function");return c=i.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(i.call(arguments)));u.prototype=a.prototype;var e=new u;u.prototype=null;var f=a.apply(e,c.concat(i.call(arguments)));return p.isObject(f)?f:e}},p.partial=function(a){var b=i.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===p&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},p.bindAll=function(a){var b,c,d=arguments.length;if(1>=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=p.bind(a[c],a);return a},p.memoize=function(a,b){var c=function(d){var e=c.cache,f=b?b.apply(this,arguments):d;return p.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},p.delay=function(a,b){var c=i.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},p.defer=function(a){return p.delay.apply(p,[a,1].concat(i.call(arguments,1)))},p.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:p.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=p.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},p.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=p.now()-g;b>j&&j>0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=p.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},p.wrap=function(a,b){return p.partial(b,a)},p.negate=function(a){return function(){return!a.apply(this,arguments)}},p.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},p.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},p.before=function(a,b){var c;return function(){return--a>0?c=b.apply(this,arguments):b=null,c}},p.once=p.partial(p.before,2),p.keys=function(a){if(!p.isObject(a))return[];if(n)return n(a);var b=[];for(var c in a)p.has(a,c)&&b.push(c);return b},p.values=function(a){for(var b=p.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},p.pairs=function(a){for(var b=p.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},p.invert=function(a){for(var b={},c=p.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},p.functions=p.methods=function(a){var b=[];for(var c in a)p.isFunction(a[c])&&b.push(c);return b.sort()},p.extend=function(a){if(!p.isObject(a))return a;for(var b,c,d=1,e=arguments.length;e>d;d++){b=arguments[d];for(c in b)l.call(b,c)&&(a[c]=b[c])}return a},p.pick=function(a,b,c){var d,e={};if(null==a)return e;if(p.isFunction(b)){b=q(b,c);for(d in a){var f=a[d];b(f,d,a)&&(e[d]=f)}}else{var g=j.apply([],i.call(arguments,1));a=new Object(a);for(var h=0,k=g.length;k>h;h++)d=g[h],d in a&&(e[d]=a[d])}return e},p.omit=function(a,b,c){if(p.isFunction(b))b=p.negate(b);else{var d=p.map(j.apply([],i.call(arguments,1)),String);b=function(a,b){return!p.contains(d,b)}}return p.pick(a,b,c)},p.defaults=function(a){if(!p.isObject(a))return a;for(var b=1,c=arguments.length;c>b;b++){var d=arguments[b];for(var e in d)void 0===a[e]&&(a[e]=d[e])}return a},p.clone=function(a){return p.isObject(a)?p.isArray(a)?a.slice():p.extend({},a):a},p.tap=function(a,b){return b(a),a};var v=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof p&&(a=a._wrapped),b instanceof p&&(b=b._wrapped);var e=k.call(a);if(e!==k.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]===a)return d[f]===b;var g=a.constructor,h=b.constructor;if(g!==h&&"constructor"in a&&"constructor"in b&&!(p.isFunction(g)&&g instanceof g&&p.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i,j;if("[object Array]"===e){if(i=a.length,j=i===b.length)for(;i--&&(j=v(a[i],b[i],c,d)););}else{var l,m=p.keys(a);if(i=m.length,j=p.keys(b).length===i)for(;i--&&(l=m[i],j=p.has(b,l)&&v(a[l],b[l],c,d)););}return c.pop(),d.pop(),j};p.isEqual=function(a,b){return v(a,b,[],[])},p.isEmpty=function(a){if(null==a)return!0;if(p.isArray(a)||p.isString(a)||p.isArguments(a))return 0===a.length;for(var b in a)if(p.has(a,b))return!1;return!0},p.isElement=function(a){return!(!a||1!==a.nodeType)},p.isArray=m||function(a){return"[object Array]"===k.call(a)},p.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},p.each(["Arguments","Function","String","Number","Date","RegExp"],function(a){p["is"+a]=function(b){return k.call(b)==="[object "+a+"]"}}),p.isArguments(arguments)||(p.isArguments=function(a){return p.has(a,"callee")}),"function"!=typeof/./&&(p.isFunction=function(a){return"function"==typeof a||!1}),p.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},p.isNaN=function(a){return p.isNumber(a)&&a!==+a},p.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===k.call(a)},p.isNull=function(a){return null===a},p.isUndefined=function(a){return void 0===a},p.has=function(a,b){return null!=a&&l.call(a,b)},p.noConflict=function(){return a._=d,this},p.identity=function(a){return a},p.constant=function(a){return function(){return a}},p.noop=function(){},p.property=function(a){return function(b){return b[a]}},p.matches=function(a){var b=p.pairs(a),c=b.length;return function(a){if(null==a)return!c;a=new Object(a);for(var d=0;c>d;d++){var e=b[d],f=e[0];if(e[1]!==a[f]||!(f in a))return!1}return!0}},p.times=function(a,b,c){var d=Array(Math.max(0,a));b=q(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},p.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},p.now=Date.now||function(){return(new Date).getTime()};var w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},x=p.invert(w),y=function(a){var b=function(b){return a[b]},c="(?:"+p.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};p.escape=y(w),p.unescape=y(x),p.result=function(a,b){if(null==a)return void 0;var c=a[b];return p.isFunction(c)?a[b]():c};var z=0;p.uniqueId=function(a){var b=++z+"";return a?a+b:b},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},C=/\\|'|\r|\n|\u2028|\u2029/g,D=function(a){return"\\"+B[a]};p.template=function(a,b,c){!b&&c&&(b=c),b=p.defaults({},b,p.templateSettings);var d=RegExp([(b.escape||A).source,(b.interpolate||A).source,(b.evaluate||A).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(C,D),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,p)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},p.chain=function(a){var b=p(a);return b._chain=!0,b};var E=function(a){return this._chain?p(a).chain():a};p.mixin=function(a){p.each(p.functions(a),function(b){var c=p[b]=a[b];p.prototype[b]=function(){var a=[this._wrapped];return h.apply(a,arguments),E.call(this,c.apply(p,a))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=e[a];p.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],E.call(this,c)}}),p.each(["concat","join","slice"],function(a){var b=e[a];p.prototype[a]=function(){return E.call(this,b.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return p})}).call(this)},{}],17:[function(a,b){var c=a("underscore"),d=a("geocrunch"),e=function(a){return 10>a?"0"+a.toString():a.toString()},f=function(a,b,c){var d=Math.abs(a),f=Math.floor(d),g=Math.floor(60*(d-f)),h=Math.round(3600*(d-f-g/60)*100)/100,i=d===a?b:c;return e(f)+"&deg; "+e(g)+"' "+e(h)+'" '+i},g=function(a){var b=c.last(a),e=d.path(c.map(a,function(a){return[a.lng,a.lat]})),g=e.distance({units:"meters"}),h=e.area({units:"sqmeters"});return{lastCoord:{dd:{x:b.lng,y:b.lat},dms:{x:f(b.lng,"E","W"),y:f(b.lat,"N","S")}},length:g,area:h}};b.exports={measure:g}},{geocrunch:6,underscore:16}],18:[function(a,b){var c=function(a,b){return b||(b=document),b.querySelector(a)},d=function(a,b){return b||(b=document),Array.prototype.slice.call(b.querySelectorAll(a))},e=function(a){return a?(a.setAttribute("style","display:none;"),a):void 0},f=function(a){return a?(a.removeAttribute("style"),a):void 0};b.exports={$:c,$$:d,hide:e,show:f}},{}],19:[function(a){(function(b){var c=a("underscore"),d="undefined"!=typeof window?window.L:"undefined"!=typeof b?b.L:null,e=a("humanize"),f=a("./units"),g=a("./calc"),h=a("./dom"),i=h.$,j=a("./mapsymbology"),k=c.template('<a class="<%= model.className %>-toggle js-toggle" href="#" title="Measure distances and areas">Measure</a>\n<div class="<%= model.className %>-interaction js-interaction">\n  <div class="js-startprompt startprompt">\n    <h3>Measure Distances and Areas</h3>\n    <ul class="tasks">\n      <a href="#" class="js-start start">Create a new measurement</a>\n    </ul>\n  </div>\n  <div class="js-measuringprompt">\n    <h3>Measure Distances and Areas</h3>\n    <p class="js-starthelp">Start creating a measurement by adding points to the map</h3>\n    <div class="js-results results"></div>\n    <ul class="js-measuretasks tasks">\n      <li><a href="#" class="js-cancel cancel">Cancel</a></li>\n      <li><a href="#" class="js-finish finish">Finish Measurement</a></li>\n    </ul>\n  </div>\n</div>'),l=c.template('<div class="group">\n<p class="lastpoint heading">Last Point</p>\n<p><%= model.lastCoord.dms.y %> <span class="coorddivider">/</span> <%= model.lastCoord.dms.x %></p>\n<p><%= humanize.numberFormat(model.lastCoord.dd.y, 6) %> <span class="coorddivider">/</span> <%= humanize.numberFormat(model.lastCoord.dd.x, 6) %></p>\n</div>\n<% if (model.pointCount > 1) { %>\n<div class="group">\n<p><span class="heading">Path Distance</span> <%= model.lengthDisplay %></p>\n</div>\n<% } %>\n<% if (model.pointCount > 2) { %>\n<div class="group">\n<p><span class="heading">Area</span> <%= model.areaDisplay %></p>\n</div>\n<% } %>'),m=c.template('<h3>Point Location</h3>\n<p><%= model.lastCoord.dms.y %> <span class="coorddivider">/</span> <%= model.lastCoord.dms.x %></p>\n<p><%= humanize.numberFormat(model.lastCoord.dd.y, 6) %> <span class="coorddivider">/</span> <%= humanize.numberFormat(model.lastCoord.dd.x, 6) %></p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Location</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>'),n=c.template('<h3>Linear Measurement</h3>\n<p><%= model.lengthDisplay %></p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Line</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>'),o=c.template('<h3>Area Measurement</h3>\n<p><%= model.areaDisplay %></p>\n<p><%= model.lengthDisplay %> Perimeter</p>\n<ul class="tasks">\n  <li><a href="#" class="js-zoomto zoomto">Center on this Area</a></li>\n  <li><a href="#" class="js-deletemarkup deletemarkup">Delete</a></li>\n</ul>');
     3d.Control.Measure=d.Control.extend({_className:"leaflet-control-measure",options:{units:{},position:"topright",primaryLengthUnit:"feet",secondaryLengthUnit:"miles",primaryAreaUnit:"acres",activeColor:"#ABE67E",completedColor:"#C8F2BE",popupOptions:{className:"leaflet-measure-resultpopup",autoPanPadding:[10,10]}},initialize:function(a){d.setOptions(this,a),this.options.units=d.extend({},f,this.options.units),this._symbols=new j(c.pick(this.options,"activeColor","completedColor"))},onAdd:function(a){return this._map=a,this._latlngs=[],this._initLayout(),a.on("click",this._collapse,this),this._layer=d.layerGroup().addTo(a),this._container},onRemove:function(a){a.off("click",this._collapse,this),a.removeLayer(this._layer)},_initLayout:function(){var a,b,c,e,f=this._className,g=this._container=d.DomUtil.create("div",f);g.innerHTML=k({model:{className:f}}),g.setAttribute("aria-haspopup",!0),d.Browser.touch?d.DomEvent.on(g,"click",d.DomEvent.stopPropagation):(d.DomEvent.disableClickPropagation(g),d.DomEvent.disableScrollPropagation(g)),a=this.$toggle=i(".js-toggle",g),this.$interaction=i(".js-interaction",g),b=i(".js-start",g),c=i(".js-cancel",g),e=i(".js-finish",g),this.$startPrompt=i(".js-startprompt",g),this.$measuringPrompt=i(".js-measuringprompt",g),this.$startHelp=i(".js-starthelp",g),this.$results=i(".js-results",g),this.$measureTasks=i(".js-measuretasks",g),this._collapse(),this._updateMeasureNotStarted(),d.Browser.android||(d.DomEvent.on(g,"mouseenter",this._expand,this),d.DomEvent.on(g,"mouseleave",this._collapse,this)),d.DomEvent.on(a,"click",d.DomEvent.stop),d.Browser.touch?d.DomEvent.on(a,"click",this._expand,this):d.DomEvent.on(a,"focus",this._expand,this),d.DomEvent.on(b,"click",d.DomEvent.stop),d.DomEvent.on(b,"click",this._startMeasure,this),d.DomEvent.on(c,"click",d.DomEvent.stop),d.DomEvent.on(c,"click",this._finishMeasure,this),d.DomEvent.on(e,"click",d.DomEvent.stop),d.DomEvent.on(e,"click",this._handleMeasureDoubleClick,this)},_expand:function(){h.hide(this.$toggle),h.show(this.$interaction)},_collapse:function(){this._locked||(h.hide(this.$interaction),h.show(this.$toggle))},_updateMeasureNotStarted:function(){h.hide(this.$startHelp),h.hide(this.$results),h.hide(this.$measureTasks),h.hide(this.$measuringPrompt),h.show(this.$startPrompt)},_updateMeasureStartedNoPoints:function(){h.hide(this.$results),h.show(this.$startHelp),h.show(this.$measureTasks),h.hide(this.$startPrompt),h.show(this.$measuringPrompt)},_updateMeasureStartedWithPoints:function(){h.hide(this.$startHelp),h.show(this.$results),h.show(this.$measureTasks),h.hide(this.$startPrompt),h.show(this.$measuringPrompt)},_startMeasure:function(){this._locked=!0,this._map.doubleClickZoom.disable(),this._map.on("mouseout",this._handleMapMouseOut,this),d.DomEvent.on(this._container,"mouseenter",this._handleMapMouseOut,this),this._map.on("mousemove",this._handleMeasureMove,this),this._map.on("dblclick",this._handleMeasureDoubleClick,this),this._map.on("click",this._handleMeasureClick,this),this._measureVertexes=d.featureGroup().addTo(this._layer),this._updateMeasureStartedNoPoints()},_finishMeasure:function(){this._locked=!1,this._map.doubleClickZoom.enable(),this._map.off("mouseout",this._handleMapMouseOut,this),d.DomEvent.off(this._container,"mouseover",this._handleMapMouseOut,this),this._clearMeasure(),this._map.off("mousemove",this._handleMeasureMove,this),this._map.off("dblclick",this._handleMeasureDoubleClick,this),this._map.off("click",this._handleMeasureClick,this),this._layer.removeLayer(this._measureVertexes),this._measureVertexes=null,this._updateMeasureNotStarted(),this._collapse()},_clearMeasure:function(){this._latlngs=[],this._measureVertexes.clearLayers(),this._measureDrag&&this._layer.removeLayer(this._measureDrag),this._measureArea&&this._layer.removeLayer(this._measureArea),this._measureBoundary&&this._layer.removeLayer(this._measureBoundary),this._measureDrag=null,this._measureArea=null,this._measureBoundary=null},_getMeasurementDisplayStrings:function(a){function b(a,b,e){var f;return b&&d[b]?(f=c(a,d[b]),e&&d[e]&&(f=f+" ("+c(a,d[e])+")")):f=c(a),f}function c(a,b){return b&&b.factor&&b.display?e.numberFormat(a*b.factor,b.decimals||0)+" "+b.display:e.numberFormat(a,0)}var d=this.options.units;return{lengthDisplay:b(a.length,this.options.primaryLengthUnit,this.options.secondaryLengthUnit),areaDisplay:b(a.area,this.options.primaryAreaUnit,this.options.secondaryAreaUnit)}},_updateResults:function(){var a=g.measure(this._latlngs);this.$results.innerHTML=l({model:c.extend({},a,this._getMeasurementDisplayStrings(a),{pointCount:this._latlngs.length}),humanize:e})},_handleMeasureMove:function(a){this._measureDrag?this._measureDrag.setLatLng(a.latlng):this._measureDrag=d.circleMarker(a.latlng,this._symbols.getSymbol("measureDrag")).addTo(this._layer),this._measureDrag.bringToFront()},_handleMeasureDoubleClick:function(){var a,b,f,h,j,k,l=this._latlngs;this._finishMeasure(),l.length&&(l.length>2&&l.push(c.first(l)),a=g.measure(l),1===l.length?(b=d.circleMarker(l[0],this._symbols.getSymbol("resultPoint")),h=m({model:a,humanize:e})):2===l.length?(b=d.polyline(l,this._symbols.getSymbol("resultLine")).addTo(this._map),h=n({model:c.extend({},a,this._getMeasurementDisplayStrings(a)),humanize:e})):(b=d.polygon(l,this._symbols.getSymbol("resultArea")),h=o({model:c.extend({},a,this._getMeasurementDisplayStrings(a)),humanize:e,units:this._units})),f=d.DomUtil.create("div",""),f.innerHTML=h,j=i(".js-zoomto",f),j&&(d.DomEvent.on(j,"click",d.DomEvent.stop),d.DomEvent.on(j,"click",function(){this._map.fitBounds(b.getBounds(),{padding:[20,20],maxZoom:17})},this)),k=i(".js-deletemarkup",f),k&&(d.DomEvent.on(k,"click",d.DomEvent.stop),d.DomEvent.on(k,"click",function(){this._map.removeLayer(b)},this)),b.addTo(this._map),b.bindPopup(f,this.options.popupOptions),b.openPopup(b.getBounds().getCenter()))},_handleMeasureClick:function(a){var b=a.latlng,d=c.last(this._latlngs),e=this._symbols.getSymbol("measureVertex");d&&b.equals(d)||(this._latlngs.push(b),this._addMeasureArea(this._latlngs),this._addMeasureBoundary(this._latlngs),this._measureVertexes.eachLayer(function(a){a.setStyle(e),a._path.setAttribute("class",e.className)}),this._addNewVertex(b),this._measureBoundary&&this._measureBoundary.bringToFront(),this._measureVertexes.bringToFront()),this._updateResults(),this._updateMeasureStartedWithPoints()},_handleMapMouseOut:function(){this._measureDrag&&(this._layer.removeLayer(this._measureDrag),this._measureDrag=null)},_addNewVertex:function(a){d.circleMarker(a,this._symbols.getSymbol("measureVertexActive")).addTo(this._measureVertexes)},_addMeasureArea:function(a){return a.length<3?void(this._measureArea&&(this._layer.removeLayer(this._measureArea),this._measureArea=null)):void(this._measureArea?this._measureArea.setLatLngs(a):this._measureArea=d.polygon(a,this._symbols.getSymbol("measureArea")).addTo(this._layer))},_addMeasureBoundary:function(a){return a.length<2?void(this._measureBoundary&&(this._layer.removeLayer(this._measureBoundary),this._measureBoundary=null)):void(this._measureBoundary?this._measureBoundary.setLatLngs(a):this._measureBoundary=d.polyline(a,this._symbols.getSymbol("measureBoundary")).addTo(this._layer))}}),d.Map.mergeOptions({measureControl:!1}),d.Map.addInitHook(function(){this.options.measureControl&&(this.measureControl=(new d.Control.Measure).addTo(this))}),d.control.measure=function(a){return new d.Control.Measure(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./calc":17,"./dom":18,"./mapsymbology":20,"./units":21,humanize:15,underscore:16}],20:[function(a,b){var c=a("underscore"),d=a("color"),e=function(a){this.setOptions(a)};e.DEFAULTS={activeColor:"#ABE67E",completedColor:"#C8F2BE"},c.extend(e.prototype,{setOptions:function(a){return this._options=c.extend({},e.DEFAULTS,this._options,a),this},getSymbol:function(a){var b={measureDrag:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:.7,fillColor:this._options.activeColor,fillOpacity:.5,className:"layer-measuredrag"},measureArea:{clickable:!1,stroke:!1,fillColor:this._options.activeColor,fillOpacity:.2,className:"layer-measurearea"},measureBoundary:{clickable:!1,color:this._options.activeColor,weight:2,opacity:.9,fill:!1,className:"layer-measureboundary"},measureVertex:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:1,fillColor:this._options.activeColor,fillOpacity:.7,className:"layer-measurevertex"},measureVertexActive:{clickable:!1,radius:4,color:this._options.activeColor,weight:2,opacity:1,fillColor:d(this._options.activeColor).darken(.15),fillOpacity:.7,className:"layer-measurevertex active"},resultArea:{clickable:!0,color:this._options.completedColor,weight:2,opacity:.9,fillColor:this._options.completedColor,fillOpacity:.2,className:"layer-measure-resultarea"},resultLine:{clickable:!0,color:this._options.completedColor,weight:3,opacity:.9,fill:!1,className:"layer-measure-resultline"},resultPoint:{clickable:!0,radius:4,color:this._options.completedColor,weight:2,opacity:1,fillColor:this._options.completedColor,fillOpacity:.7,className:"layer-measure-resultpoint"}};return b[a]}}),b.exports=e},{color:1,underscore:16}],21:[function(a,b){b.exports={acres:{factor:24711e-8,display:"Acres",decimals:2},feet:{factor:3.2808,display:"Feet",decimals:0},kilometers:{factor:.001,display:"Kilometers",decimals:2},hectares:{factor:1e-4,display:"Hectares",decimals:2},meters:{factor:1,display:"Meters",decimals:0},miles:{factor:3.2808/5280,display:"Miles",decimals:2},sqfeet:{factor:10.7639,display:"Sq Feet",decimals:0},sqmeters:{factor:1,display:"Sq Meters",decimals:0},sqmiles:{factor:3.86102e-7,display:"Sq Miles",decimals:2}}},{}]},{},[19]);
Note: See TracChangeset for help on using the changeset viewer.