text:
package mediabrowser.model.configuration;

public class FanartOptions
{
	/**
	 Gets or sets a value indicating whether [enable automatic updates].

	 <value><c>true</c> if [enable automatic updates]; otherwise, <c>false</c>.</value>
	*/
	private boolean EnableAutomaticUpdates;
	public final boolean getEnableAutomaticUpdates()
	{
		return EnableAutomaticUpdates;
	}
	public final void setEnableAutomaticUpdates(boolean value)
	{
		EnableAutomaticUpdates = value;
	}
	/**
	 Gets or sets the user API key.

	 <value>The user API key.</value>
	*/
	private String UserApiKey;
	public final String getUserApiKey()
	{
		return UserApiKey;
	}
	public final void setUserApiKey(String value)
	{
		UserApiKey = value;
	}
}


text:
+++
title = "Professional freedom of association as a form of resistance"
slug = "professional-resistance"
date = "2017-08-17"
author = "AJ Bowen"
draft = "false"
summary = "About halfway through the interview process for a job at an e-commerce platform, I realized they were hosting an online store for a website I consider reprehensible. Here's the letter I wrote to them."

+++

About halfway through the interview process for a job at an e-commerce platform, in the course of researching the company I realized they were hosting an online store for a website I consider reprehensible. Here's the letter I wrote to them.

*Hello [recruiter/employees of platform currently hosting a thing I consider evil],*

*Please accept my sincere apologies for the late notice, but I need to cancel the interview we have scheduled for today.*

*I read a lot about WWII, and spend a lot of time thinking about one thing in particular: what could ordinary Germans have done to prevent the Holocaust without wielding state oppression?
Nonviolent, extra-governmental pushback against the underlying toxic ideas is the only ethical response I can come up with.*

*This can happen at several different levels:*

- *a lawmaker could refuse to vote for a law that requires businesses display a "No Jews" sign in their window*
- *a police officer could refuse to enforce such a law*
- *a company could refuse to obey such a law*
- *an employee could refuse to work at a store that displays such a sign*
- *a customer could refuse to shop at a store that displays such a sign*

*The opportunity to resist trickles down, becoming less effective at each level.
But enough action at any level can stem or reverse the momentum of the idea at play.*

*Unlike people, some ideas deserve to die before they are realized. In some ways, government oppression--to which I am radically opposed--can give an idea more power. On the other hand, private speech contradicting the idea provides a distributed pressure that lacks a single point of failure.*

*I'm in a position right now to weaken the tide of ideas-I-think-deserve-to-die flowing out of [unethical customer on your platform] by not continuing this interview process. I'm grateful to you for providing me an opportunity to act in a way that embodies my ideals.*

*I really enjoyed speaking with all of you, and I sincerely thank you for your time. I'm disappointed to cut things short and would be happy to stay in touch. I hope you will consider revoking the credibility you are currently lending to [unethical merchant on your platform]; if that ever happens, I'd be thrilled to hear from you!*

*Sincerely,*

*AJ*

redpajama_set_name: RedPajamaGithub


text:
import React, { Component } from "react";
import SelectTab from "components/SelectTab/SelectTab";
import type { Account } from "data/types";
import { getAccountCurrencyUnit, getFiatUnit } from "data/currency";
import BlueSelect from "components/BlueSelect";
import { MenuItem } from "@material-ui/core/Menu";
import DateFormat from "components/DateFormat";
import Quicklook from "./QuickLook";
import Card from "components/Card";
import AccountQuery from "api/queries/AccountQuery";
import TryAgain from "components/TryAgain";
import SpinnerCard from "components/spinners/SpinnerCard";
import connectData from "restlay/connectData";
import { withStyles } from "@material-ui/core/styles";

type State = {
  tabsIndex: number,
  quicklookFilter: { title: string, key: string },
  labelDateRange: React$Element<typeof DateFormat>[]
};

type Filter = { title: string, key: string };

const styles = {
  card: {
    width: "34.5%",
    height: "399px"
  },
  dateLabel: {
    fontSize: " 11px",
    color: "#767676",
    paddingTop: " 30px",
    textAlign: " right"
  },
  loading: {
    background: "white",
    height: "403px",
    width: "380px"
  }
};

type Props = {
  classes: { [_: $Keys<typeof styles>]: string },
  accountId: string,
  account: Account
};

const quicklookFilters: Array<Filter> = [
  { title: "balance", key: "balance" }
  // { title: "countervalue", key: "countervalue" }
];

export class QuicklookCard extends Component<Props, State> {
  constructor(props: Props) {
    super(props);
    this.state = {
      tabsIndex: 0,
      quicklookFilter: quicklookFilters[0],
      labelDateRange: this.getLabelDateRange(this.getDateRange(0))
    };
  }

  getLastWeek = () => {
    var today = new Date();
    today.setHours(0, 0, 0, 0);

    var lastWeek = new Date(
      today.getFullYear(),
      today.getMonth(),
      today.getDate() - 7
    );
    return lastWeek;
  };

  onQuicklookFilterChange = (e: *): void => {
    this.setState({
      quicklookFilter: quicklookFilters.find(
        elem => elem.key === e.target.value
      )
    });
  };
  selectTab = (index: number): void => {
    this.setState({
      tabsIndex: index,
      labelDateRange: this.getLabelDateRange(this.getDateRange(index))
    });
  };

  getDateRange = (tabsIndex: number): number[] => {
    const dayInMs = 86400000;
    const max = new Date().getTime();
    let min = max;
    min = tabsIndex === 0 ? max - dayInMs * 365 : min;
    min = tabsIndex === 1 ? max - dayInMs * 30 : min;
    min = tabsIndex === 2 ? max - dayInMs * 7 : min;
    min = tabsIndex === 3 ? max - dayInMs : min;
    return [min, max];
  };

  getLabelDateRange = (
    domain: number[]
  ): React$Element<typeof DateFormat>[] => {
    const day1 = new Date(domain[0]).getDate();
    const month1 = new Date(domain[0]).getMonth();
    const year1 = new Date(domain[0]).getFullYear();
    const day2 = new Date(domain[1]).getDate();
    const month2 = new Date(domain[1]).getMonth();
    const year2 = new Date(domain[1]).getFullYear();
    const dateRange =
      day1 === day2 && month1 === month2 && year1 === year2
        ? "day"
        : month1 === month2 && year1 === year2
          ? "month"
          : year1 === year2 ? "year" : "hour";

    let res = [
      <DateFormat key="0" date={domain[0]} format="MMMM Do, YYYY h:mm" />,
      <DateFormat key="1" date={domain[1]} format="h:mm" />
    ];
    if (dateRange === "day") {
      //Same day
      res = [
        <DateFormat key="0" date={domain[0]} format="MMMM Do, YYYY h:mm" />,
        <DateFormat key="1" date={domain[1]} format="h:mm" />
      ];
    } else if (dateRange === "month") {
      //Same month
      res = [
        <DateFormat key="0" date={domain[0]} format="MMMM Do" />,
        <DateFormat key="1" date={domain[1]} format="Do, YYYY" />
      ];
    } else if (dateRange === "year") {
      //Same year
      res = [
        <DateFormat key="0" date={domain[0]} format="MMMM Do" />,
        <DateFormat key="1" date={domain[1]} format="MMMM Do, YYYY" />
      ];
    } else
      res = [
        <DateFormat key="0" date={domain[0]} format="MMMM Do, YYYY" />,
        <DateFormat key="1" date={domain[1]} format="MMMM Do, YYYY" />
      ];
    return res;
  };

  tabsList = ["year", "month", "week", "day"];

  render() {
    const { account, accountId, classes } = this.props;
    const { tabsIndex, labelDateRange, quicklookFilter } = this.state;
    let currencyUnit = getAccountCurrencyUnit(account);
    const filter =
      quicklookFilter.key === "balance" ? "balance" : "counterValueBalance";

    const range = this.tabsList[tabsIndex];
    // FIXME PROBABLY NEEDS TO BE FIXED
    if (quicklookFilter.key === "countervalue") {
      currencyUnit = getFiatUnit(account.settings.fiat);
    }
    return (
      <Card
        title="Quicklook"
        className={classes.card}
        titleRight={
          <BlueSelect
            value={quicklookFilter.key}
            onChange={this.onQuicklookFilterChange}
            disableUnderline
            style={{ minWidth: 120, textAlign: "right", fontSize: 11 }}
          >
            {quicklookFilters.map(({ title, key }) => (
              <MenuItem
                disableRipple
                style={{ color: "#27d0e2" }}
                key={key}
                value={key}
              >
                {title.toUpperCase()}
              </MenuItem>
            ))}
          </BlueSelect>
        }
      >

          <SelectTab
            tabs={this.tabsList}
            onChange={this.selectTab}
            selected={tabsIndex}
            theme="header"
          />

          From {labelDateRange[0]} to {labelDateRange[1]}

        <Quicklook
          accountId={accountId}
          filter={filter}
          range={range}
          currencyUnit={currencyUnit}
          currencyColor={account.currency.color}
          key={accountId + range}
        />
      </Card>
    );
  }
}

const RenderError = ({ error, restlay }: *) => (
  <Card title="Quicklook">
    <TryAgain error={error} action={restlay.forceFetch} />
  </Card>
);

const RenderLoading = withStyles(styles)(({ classes }) => (
  <Card className={classes.card} title="Quicklook">
    <SpinnerCard />
  </Card>
));

export default connectData(withStyles(styles)(QuicklookCard), {
  queries: {
    account: AccountQuery
  },
  propsToQueryParams: props => ({
    accountId: props.accountId
  }),
  optimisticRendering: true,
  RenderError,
  RenderLoading
});


text:
  Achy est
       un village
       situé dans le département de l'Oise en Picardie. Elle totalisait 325 habitants en 2008.

À proximité de Achy sont situées les villes de
La Neuville-sur-Oudeuil localisée à 2 km, 300 habitants,
Blicourt à 5 km, 324 habitants,
Roy-Boissy localisée à 4 km, 334 habitants,
Fontaine-Lavaganne à 5 km, 377 habitants,
Prévillers localisée à 5 km, 131 habitants,
Villers-sur-Bonnières localisée à 2 km, 162 habitants,
 entre autres. De plus, Achy est située à seulement 15 km de Beauvais.

Le nombre d'habitations, à Achy, était réparti en 2011 en trois appartements et 153 maisons soit
 un marché relativement équilibré.

Si vous envisagez de venir habiter à Achy, vous pourrez facilement trouver une maison à vendre.


text:
layout: base
---

{{ page.title }}

  {{ content }}

{% include share.html %}
{% include disqus.html %}


text:
<?php
/**
 * One Function (without parameters) with one test function (with single line comments)
 * where the documentation had not been generated.
 */
namespace  {
	/**
	 * @author Axel Ancona Esselmann
	 * @package
	 */
	class DataClassFile {
		/**
		 * In General, this fnctn does pretty much just this pretty
		 * simple thing. This can't be deduced by the test's documentation
		 * though, and must be written by the author.
		 */
		public function functionName1() {
			$say = "say";
			$fu = "fu";
			return $say . " " . $fu;
		}
	}
}


text:
class ChangeCapacityToHashFromPersistentVolume < ActiveRecord::Migration[5.0]
  class ContainerVolume < ActiveRecord::Base
    self.inheritance_column = :_type_disabled # disable STI
  end

  class PersistentVolume < ContainerVolume
    self.inheritance_column = :_type_disabled # disable STI
    serialize :capacity
  end

  def up
    change_column :container_volumes, :capacity, :text
    say_with_time("Changing string to hash") do
      PersistentVolume.find_each do |vol|
        result_hash = {}
        unless vol.capacity.nil?
          vol.capacity.split(',').each do |hash|
            key, val = hash.split('=')
            next if val.nil?
            begin
              result_hash[key.to_sym] = val.iec_60027_2_to_i
            rescue ArgumentError
              _log.warn("Capacity attribute was in bad format - #{val}")
            end
          end
        end
        vol.update_attributes!(:capacity => result_hash)
      end
    end
  end

  def down
    say_with_time("Changing hash to string") do
      PersistentVolume.find_each do |vol|
        next if vol.capacity.nil?
        capacity = vol.capacity.collect { |key, val| "#{key}=#{val}" }.join(",")
        capacity = nil if capacity.blank?
        vol.update_attributes!(:capacity => capacity)
      end
    end
    change_column :container_volumes, :capacity, :string
  end
end


text:
package org.ktaka.api.services.picasa.model;

import com.google.api.client.util.Key;

import java.util.List;

/**
 * @author Yaniv Inbar
 */
public class UserFeed extends Feed {

  @Key("entry")
  public List<AlbumEntry> albums;
}


text:
<?php

namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;

use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AuthenticationServiceException;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Http\EventListener\UserProviderListener;

/**
 * Represents the user in the authentication process.
 *
 * It uses an identifier (e.g. email, or username) and
 * "user loader" to load the related User object.
 *
 * @author Wouter de Jong <wouter@wouterj.nl>
 */
class UserBadge implements BadgeInterface
{
    private string $userIdentifier;
    /** @var callable|null */
    private $userLoader;
    private UserInterface $user;

    /**
     * Initializes the user badge.
     *
     * You must provide a $userIdentifier. This is a unique string representing the
     * user for this authentication (e.g. the email if authentication is done using
     * email + password; or a string combining email+company if authentication is done
     * based on email *and* company name). This string can be used for e.g. login throttling.
     *
     * Optionally, you may pass a user loader. This callable receives the $userIdentifier
     * as argument and must return a UserInterface object (otherwise an AuthenticationServiceException
     * is thrown). If this is not set, the default user provider will be used with
     * $userIdentifier as username.
     */
    public function __construct(string $userIdentifier, callable $userLoader = null)
    {
        $this->userIdentifier = $userIdentifier;
        $this->userLoader = $userLoader;
    }

    public function getUserIdentifier(): string
    {
        return $this->userIdentifier;
    }

    /**
     * @throws AuthenticationException when the user cannot be found
     */
    public function getUser(): UserInterface
    {
        if (isset($this->user)) {
            return $this->user;
        }

        if (null === $this->userLoader) {
            throw new \LogicException(sprintf('No user loader is configured, did you forget to register the "%s" listener?', UserProviderListener::class));
        }

        $user = ($this->userLoader)($this->userIdentifier);

        // No user has been found via the $this->userLoader callback
        if (null === $user) {
            $exception = new UserNotFoundException();
            $exception->setUserIdentifier($this->userIdentifier);

            throw $exception;
        }

        if (!$user instanceof UserInterface) {
            throw new AuthenticationServiceException(sprintf('The user provider must return a UserInterface object, "%s" given.', get_debug_type($user)));
        }

        return $this->user = $user;
    }

    public function getUserLoader(): ?callable
    {
        return $this->userLoader;
    }

    public function setUserLoader(callable $userLoader): void
    {
        $this->userLoader = $userLoader;
    }

    public function isResolved(): bool
    {
        return true;
    }
}


text:
package com.hsqlu.coding.concurrent.resource;

/**
 * Created: 2016/4/26.
 * Author: Qiannan Lu
 */
public class Job implements Runnable {
    private PrintQueue printQueue;

    public Job(PrintQueue printQueue) {
        this.printQueue = printQueue;
    }

    @Override
    public void run() {
        System.out.printf("%s: Going to print a job\n", Thread.currentThread().getName());
        printQueue.printJob(new Object());
        System.out.printf("%s: The document has been printed\n", Thread.currentThread().getName());
    }

    public static void main(String args[]) {
        PrintQueue printQueue = new PrintQueue();
        Thread[] threads = new Thread[10];
        for (int i = 0; i < 10; ++i) {
            threads[i] = new Thread(new Job(printQueue), "Thread" + i);
        }
        for (int i = 0; i < 10; ++i) {
            threads[i].start();
        }
    }
}


text:
title: TODO
module: topic-09
todo:
permalink: /topic-09/todo-anatomy/
categories: uncategorized
---

Duckett
Ch 10: pgs 226-234

 6 minute reading

Explore the multitude of CSS References

 8 minute activity

Explore the "Property Table" with W3C

 4 minute activity


text:
print("Hello World")
print("I have", 3 + 4, "bananas")
print("Goodbye, World")


text:
package png.orp.guice;

import com.google.inject.AbstractModule;

import pnb.orp.cache.CoreCache;
import pnb.orp.cache.ORPCache;

public class ORPModule extends AbstractModule {

	@Override
	protected void configure() {
		//Bind our implementation of the cache to the interface.
		bind(ORPCache.class).to(CoreCache.class);
		//install(new FactoryModuleBuilder().implement(ORPCache.class, CoreCache.class).build(CoreCacheFactory.class));
	}

}


text:
package com.thayer.idsservice.context;

import java.io.Serializable;

import com.thayer.idsservice.task.update.bean.FogMQBean;
import com.thayer.idsservice.task.update.bean.ResultBean;

public class ServiceContext implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = 7796085461275601130L;
	public final static String SECURITY_CONTEXT_KEY = "com.thayer.idsservice.context.ServiceContext";
	private ResultBean resultBean;
	private FogMQBean fogMQBean;
	private String processId;

	/**
	 * @return the resultBean
	 */
	public ResultBean getResultBean() {
		return resultBean;
	}

	/**
	 * @param resultBean
	 *            the resultBean to set
	 */
	public void setResultBean(ResultBean resultBean) {
		this.resultBean = resultBean;
	}

	/**
	 * @return the fogMQBean
	 */
	public FogMQBean getFogMQBean() {
		return fogMQBean;
	}

	/**
	 * @param fogMQBean
	 *            the fogMQBean to set
	 */
	public void setFogMQBean(FogMQBean fogMQBean) {
		this.fogMQBean = fogMQBean;
	}

	/**
	 * @return the processId
	 */
	public String getProcessId() {
		return processId;
	}

	/**
	 * @param processId
	 *            the processId to set
	 */
	public void setProcessId(String processId) {
		this.processId = processId;
	}

}


text:
<?php

use Illuminate\Database\Seeder;
use LaravelAdminPanel\Traits\Seedable;

class AdminDatabaseSeeder extends Seeder
{
    use Seedable;

    protected $seedersPath = __DIR__.'/';

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $this->seed('DataTypesTableSeeder');
        $this->seed('DataRowsTableSeeder');
        $this->seed('MenusTableSeeder');
        $this->seed('MenuItemsTableSeeder');
        $this->seed('RolesTableSeeder');
        $this->seed('PermissionsTableSeeder');
        $this->seed('PermissionRoleTableSeeder');
    }
}


text:
package satori.test.ui;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class SIcons {
	public static Icon moveIcon;
	public static Icon saveIcon;
	public static Icon refreshIcon;
	public static Icon trashIcon;
	public static Icon removeIcon;
	public static Icon addIcon;
	public static Icon runIcon;

	public static void loadResources(ClassLoader loader) {
		moveIcon = new ImageIcon(loader.getResource("icons/move.gif"));
		saveIcon = new ImageIcon(loader.getResource("icons/save.gif"));
		refreshIcon = new ImageIcon(loader.getResource("icons/refresh.gif"));
		trashIcon = new ImageIcon(loader.getResource("icons/trash.gif"));
		removeIcon = new ImageIcon(loader.getResource("icons/remove.gif"));
		addIcon = new ImageIcon(loader.getResource("icons/add.gif"));
		runIcon = new ImageIcon(loader.getResource("icons/run.gif"));
	}
}


text:
import * as React from 'react';
import { IconBaseProps } from 'react-icon-base';
export default class MdKeyboard extends React.Component<IconBaseProps> { }


text:
provides "eucalyptus"

require 'ohai/mixin/ec2_metadata'

require_plugin "hostname"
require_plugin "kernel"
require_plugin "network"

extend Ohai::Mixin::Ec2Metadata

def get_mac_address(addresses)
  detected_addresses = addresses.detect { |address, keypair| keypair == {"family"=>"lladdr"} }
  if detected_addresses
    return detected_addresses.first
  else
    return ""
  end
end

def has_euca_mac?
  network[:interfaces].values.each do |iface|
    has_mac = (get_mac_address(iface[:addresses]) =~ /^[dD]0:0[dD]:/)
    Ohai::Log.debug("has_euca_mac? == #{!!has_mac}")
    return true if has_mac
  end

  Ohai::Log.debug("has_euca_mac? == false")
  false
end

def looks_like_euca?
  # Try non-blocking connect so we don't "block" if
  # the Xen environment is *not* EC2
  hint?('eucalyptus') || has_euca_mac? && can_metadata_connect?(EC2_METADATA_ADDR,80)
end

if looks_like_euca?
  Ohai::Log.debug("looks_like_euca? == true")
  eucalyptus Mash.new
  self.fetch_metadata.each {|k, v| eucalyptus[k] = v }
  eucalyptus[:userdata] = self.fetch_userdata
else
  Ohai::Log.debug("looks_like_euca? == false")
  false
end


text:
/*========================================================================*/
/*                    TrNgGrid version 3.1.7                              */
/*   -------------------------------------------------------------        */
/* THIS FILE WAS GENERATED VIA GULP. DO NOT MODIFY THIS FILE MANUALLY.    */
/*======================================================================= */
(function (factory) {
    if (typeof module === 'object' && typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' && define.amd) {
        define(["require", "exports", 'angular'], factory);
    }
})(function (require, exports) {
    "use strict";
    var angular = require('angular');
    var TrNgGrid;
    (function (TrNgGrid) {
        (function (SelectionMode) {
            SelectionMode[SelectionMode["None"] = 0] = "None";
            SelectionMode[SelectionMode["SingleRow"] = 1] = "SingleRow";
            SelectionMode[SelectionMode["MultiRow"] = 2] = "MultiRow";
            SelectionMode[SelectionMode["MultiRowWithKeyModifiers"] = 3] = "MultiRowWithKeyModifiers";
        })(TrNgGrid.SelectionMode || (TrNgGrid.SelectionMode = {}));
        var SelectionMode = TrNgGrid.SelectionMode;
        if (!window) {
            throw "trNgGrid cannot be used in the current environment";
        }
        window["TrNgGrid"] = TrNgGrid;
        TrNgGrid.defaultColumnOptionsTemplate = {
            cellWidth: null,
            cellHeight: null,
            displayAlign: null,
            displayFormat: null,
            displayName: null,
            filter: null,
            enableFiltering: null,
            enableSorting: null
        };
        TrNgGrid.defaultColumnOptions = {};
        TrNgGrid.translations = {};
        TrNgGrid.debugMode = false;
        var templatesConfigured = false;
        var tableDirective = "trNgGrid";
        TrNgGrid.sortFilter = tableDirective + "SortFilter";
        TrNgGrid.dataPagingFilter = tableDirective + "DataPagingFilter";
        TrNgGrid.translateFilter = tableDirective + "TranslateFilter";
        TrNgGrid.translationDateFormat = tableDirective + "DateFormat";
        TrNgGrid.dataFormattingFilter = tableDirective + "DataFormatFilter";
        var bodyDirective = "trNgGridBody";
        var bodyDirectiveAttribute = "tr-ng-grid-body";
        var fieldNameAttribute = "field-name";
        var altFieldNameAttribute = "data-field-name";
        var isCustomizedAttribute = "is-customized";
        var cellFooterDirective = "trNgGridFooterCell";
        var cellFooterDirectiveAttribute = "tr-ng-grid-footer-cell";
        var cellFooterTemplateDirective = "trNgGridFooterCellTemplate";
        var cellFooterTemplateDirectiveAttribute = "tr-ng-grid-footer-cell-template";
        TrNgGrid.cellFooterTemplateId = cellFooterTemplateDirective + ".html";
        var globalFilterDirective = "trNgGridGlobalFilter";
        TrNgGrid.globalFilterDirectiveAttribute = "tr-ng-grid-global-filter";
        TrNgGrid.footerGlobalFilterTemplateId = globalFilterDirective + ".html";
        var pagerDirective = "trNgGridPager";
        TrNgGrid.pagerDirectiveAttribute = "tr-ng-grid-pager";
        TrNgGrid.footerPagerTemplateId = pagerDirective + ".html";
        var cellHeaderDirective = "trNgGridHeaderCell";
        var cellHeaderDirectiveAttribute = "tr-ng-grid-header-cell";
        var cellHeaderTemplateDirective = "trNgGridHeaderCellTemplate";
        var cellHeaderTemplateDirectiveAttribute = "tr-ng-grid-header-cell-template";
        TrNgGrid.cellHeaderTemplateId = cellHeaderTemplateDirective + ".html";
        var cellBodyDirective = "trNgGridBodyCell";
        var cellBodyDirectiveAttribute = "tr-ng-grid-body-cell";
        var cellBodyTemplateDirective = "trNgGridBodyCellTemplate";
        var cellBodyTemplateDirectiveAttribute = "tr-ng-grid-body-cell-template";
        TrNgGrid.cellBodyTemplateId = cellBodyTemplateDirective + ".html";
        var columnSortDirective = "trNgGridColumnSort";
        TrNgGrid.columnSortDirectiveAttribute = "tr-ng-grid-column-sort";
        TrNgGrid.columnSortTemplateId = columnSortDirective + ".html";
        var columnFilterDirective = "trNgGridColumnFilter";
        TrNgGrid.columnFilterDirectiveAttribute = "tr-ng-grid-column-filter";
        TrNgGrid.columnFilterTemplateId = columnFilterDirective + ".html";
        var findChildByTagName = function (parent, childTag) {
            childTag = childTag.toUpperCase();
            var children = parent.children();
            for (var childIndex = 0; childIndex < children.length; childIndex++) {
                var childElement = children[childIndex];
                if (childElement.tagName == childTag) {
                    return angular.element(childElement);
                }
            }
            return null;
        };
        var findChildrenByTagName = function (parent, childTag) {
            childTag = childTag.toUpperCase();
            var retChildren = [];
            var children = parent.children();
            for (var childIndex = 0; childIndex < children.length; childIndex++) {
                var childElement = children[childIndex];
                if (childElement.tagName === childTag) {
                    retChildren.push(angular.element(childElement));
                }
            }
            return retChildren;
        };
        var combineGridCellInfos = function (firstSet, secondSet, addExtraFieldItemsSecondSet, addExtraNonFieldItemsSecondSet) {
            var combinedSet = [];
            var secondTempSet = secondSet.slice(0);
            angular.forEach(firstSet, function (firstSetColumn) {
                var foundSecondSetColumn = null;
                for (var secondSetColumnIndex = 0; !foundSecondSetColumn && secondSetColumnIndex < secondTempSet.length; secondSetColumnIndex++) {
                    foundSecondSetColumn = secondTempSet[secondSetColumnIndex];
                    if (foundSecondSetColumn.fieldName === firstSetColumn.fieldName) {
                        secondTempSet.splice(secondSetColumnIndex, 1);
                    }
                    else {
                        foundSecondSetColumn = null;
                    }
                }
                if (foundSecondSetColumn) {
                    combinedSet.push(foundSecondSetColumn);
                }
                else {
                    combinedSet.push(firstSetColumn);
                }
            });
            if (addExtraFieldItemsSecondSet || addExtraNonFieldItemsSecondSet) {
                angular.forEach(secondTempSet, function (secondSetColumn) {
                    if ((addExtraFieldItemsSecondSet && secondSetColumn.fieldName) || (addExtraNonFieldItemsSecondSet && !secondSetColumn.fieldName)) {
                        combinedSet.push(secondSetColumn);
                    }
                });
            }
            return combinedSet;
        };
        var wrapTemplatedCell = function (templateElement, tAttrs, isCustomized, cellTemplateDirective) {
            if (isCustomized) {
                var childrenElements = templateElement.children();
                var firstChildElement = angular.element(childrenElements[0]);
                if (childrenElements.length !== 1 || !firstChildElement.attr(cellTemplateDirective)) {
                    templateElement.empty();
                    var templateWrapElement = angular.element("

").attr(cellTemplateDirective, "");
                    templateElement.append(templateWrapElement);
                    angular.forEach(childrenElements, function (childElement) {
                        templateWrapElement.append(angular.element(childElement));
                    });
                }
            }
            else {
                templateElement.empty();
                templateElement.append(angular.element("

").attr(cellTemplateDirective, ""));
            }
        };
        var TemplatedCell = (function () {
            function TemplatedCell(parent, cellElement) {
                this.parent = parent;
                this.cellElement = cellElement;
                this.fieldName = cellElement.attr(fieldNameAttribute) || cellElement.attr(altFieldNameAttribute);
                var customContent = cellElement.children();
                this.isStandardColumn = customContent.length === 0;
            }
            return TemplatedCell;
        }());
        var TemplatedSection = (function () {
            function TemplatedSection(sectionTagName, sectionDirectiveAttribute, rowDirectiveAttribute, cellTagName, cellDirectiveAttribute) {
                this.sectionTagName = sectionTagName;
                this.sectionDirectiveAttribute = sectionDirectiveAttribute;
                this.rowDirectiveAttribute = rowDirectiveAttribute;
                this.cellTagName = cellTagName;
                this.cellDirectiveAttribute = cellDirectiveAttribute;
                this.cellTagName = this.cellTagName.toUpperCase();
                this.cells = null;
            }
            TemplatedSection.prototype.configureSection = function (gridElement, columnDefs) {
                var _this = this;
                var sectionElement = this.getSectionElement(gridElement, true);
                sectionElement.empty();
                sectionElement.removeAttr("ng-non-bindable");
                var rowElementDefinitions = combineGridCellInfos(columnDefs, this.cells, false, false);
                var templatedRowElement = this.getTemplatedRowElement(sectionElement, true);
                angular.forEach(rowElementDefinitions, function (gridCell, index) {
                    var gridCellElement;
                    var templatedCell = gridCell;
                    if (templatedCell.parent === _this && templatedCell.cellElement) {
                        gridCellElement = templatedCell.cellElement.clone(true);
                    }
                    else {
                        gridCellElement = angular.element("
<" + _this.cellTagName + "></" + _this.cellTagName + ">
").find(_this.cellTagName);
                    }
                    if (_this.cellDirectiveAttribute) {
                        gridCellElement.attr(_this.cellDirectiveAttribute, index);
                    }
                    if (!gridCell.isStandardColumn) {
                        gridCellElement.attr(isCustomizedAttribute, "true");
                    }
                    if (gridCell.fieldName) {
                        gridCellElement.attr(fieldNameAttribute, gridCell.fieldName);
                    }
                    gridCellElement.attr("ng-style", "{\'width\':columnOptions.cellWidth,\'height\':columnOptions.cellHeight}");
                    templatedRowElement.append(gridCellElement);
                });
                return sectionElement;
            };
            TemplatedSection.prototype.extractPartialColumnDefinitions = function () {
                return this.cells;
            };
            TemplatedSection.prototype.discoverTemplates = function (gridElement) {
                var _this = this;
                this.cells = [];
                this.cellRow = null;
                var templatedRow = this.getTemplatedRowElement(this.getSectionElement(gridElement, false), false);
                if (templatedRow) {
                    this.cellRow = angular.element(templatedRow.clone());
                    this.cellRow.empty();
                    angular.forEach(templatedRow.children(), function (childElement, childIndex) {
                        childElement = angular.element(childElement);
                        if (childElement[0].tagName === _this.cellTagName.toUpperCase()) {
                            var templateElement = childElement.clone();
                            _this.cells.push(new TemplatedCell(_this, templateElement));
                        }
                    });
                }
            };
            TemplatedSection.prototype.getSectionElement = function (gridElement, ensurePresent) {
                var sectionElement = null;
                if (gridElement) {
                    sectionElement = findChildByTagName(gridElement, this.sectionTagName);
                }
                if (!sectionElement && ensurePresent) {
                    sectionElement = angular.element("
<" + this.sectionTagName + "></" + this.sectionTagName + ">
").find(this.sectionTagName);
                    if (gridElement) {
                        gridElement.append(sectionElement);
                    }
                }
                if (sectionElement && ensurePresent && this.sectionDirectiveAttribute) {
                    sectionElement.attr(this.sectionDirectiveAttribute, "");
                }
                return sectionElement;
            };
            TemplatedSection.prototype.getTemplatedRowElement = function (sectionElement, ensurePresent) {
                var rowElement = null;
                if (sectionElement) {
                    rowElement = findChildByTagName(sectionElement, "tr");
                }
                if (!rowElement && ensurePresent) {
                    rowElement = this.cellRow ? angular.element(this.cellRow.clone()) : angular.element("

").find("tr");
                    if (sectionElement) {
                        sectionElement.append(rowElement);
                    }
                }
                if (rowElement && ensurePresent && this.rowDirectiveAttribute) {
                    rowElement.attr(this.rowDirectiveAttribute, "");
                }
                return rowElement;
            };
            return TemplatedSection;
        }());
        var GridController = (function () {
            function GridController($compile, $parse, $timeout, $templateCache, $interpolate) {
                this.$compile = $compile;
                this.$parse = $parse;
                this.$timeout = $timeout;
                if (!templatesConfigured) {
                    configureTemplates($templateCache, $interpolate);
                    templatesConfigured = true;
                }
            }
            GridController.prototype.setupGrid = function (gridScope, gridOptions, isInServerSideMode) {
                this.gridOptions = gridOptions;
                this.isInServerSideMode = isInServerSideMode;
                gridScope.gridOptions = gridOptions;
                gridScope.TrNgGrid = TrNgGrid;
                gridOptions.gridColumnDefs = [];
                if (gridOptions.locale === undefined) {
                    gridOptions.locale = "en";
                }
                if (gridOptions.selectionMode === undefined) {
                    gridOptions.selectionMode = SelectionMode[SelectionMode.MultiRow];
                }
                if (gridOptions.filterByFields === undefined) {
                    gridOptions.filterByFields = {};
                }
                if (gridOptions.enableFiltering === undefined) {
                    gridOptions.enableFiltering = true;
                }
                if (gridOptions.enableSorting === undefined) {
                    gridOptions.enableSorting = true;
                }
                if (gridOptions.onDataRequiredDelay === undefined) {
                    gridOptions.onDataRequiredDelay = 1000;
                }
                if (gridOptions.selectedItems === undefined) {
                    gridOptions.selectedItems = [];
                }
                if (gridOptions.currentPage === undefined) {
                    gridOptions.currentPage = 0;
                }
                this.setupServerSideModeTriggers(gridScope);
                this.setupDataFilteringTriggers(gridScope);
                this.setupDataFormattingTriggers(gridScope);
                this.setupDataSelectionTriggers(gridScope);
                return gridScope;
            };
            GridController.prototype.setupDataFilteringTriggers = function (gridScope) {
                var _this = this;
                var scheduledForCurrentCycle = false;
                this.scheduleDataFiltering = function () {
                    if (scheduledForCurrentCycle) {
                        return;
                    }
                    gridScope.$evalAsync(function () {
                        scheduledForCurrentCycle = false;
                        _this.computeFilteredItems(gridScope);
                    });
                    scheduledForCurrentCycle = true;
                };
                if (!this.isInServerSideMode) {
                    var initCycle = true;
                    gridScope.$watchCollection("[" +
                        "gridOptions.filterBy," +
                        "gridOptions.filterByFields," +
                        "gridOptions.orderBy," +
                        "gridOptions.orderByReverse," +
                        "gridOptions.pageItems" +
                        "]", function (newValue, oldValue) {
                        if (initCycle) {
                            initCycle = false;
                        }
                        else {
                            _this.gridOptions.currentPage = 0;
                            _this.scheduleDataFiltering();
                        }
                    });
                    gridScope.$watch("gridOptions.currentPage", function (newValue, oldValue) {
                        if (newValue !== oldValue) {
                            {
                                _this.scheduleDataFiltering();
                            }
                        }
                    });
                }
            };
            GridController.prototype.setupDataFormattingTriggers = function (gridScope) {
                var _this = this;
                var scheduledForCurrentCycle = false;
                this.scheduleDataFormatting = function () {
                    if (scheduledForCurrentCycle) {
                        return;
                    }
                    gridScope.$evalAsync(function () {
                        scheduledForCurrentCycle = false;
                        _this.computeFormattedItems(gridScope);
                    });
                    scheduledForCurrentCycle = true;
                };
                var watchExpression = "[gridOptions.items,gridOptions.gridColumnDefs.length";
                angular.forEach(gridScope.gridOptions.gridColumnDefs, function (gridColumnDef) {
                    if (gridColumnDef.displayFormat && gridColumnDef.displayFormat[0] != '.') {
                        var displayfilters = gridColumnDef.displayFormat.split('|');
                        angular.forEach(displayfilters, function (displayFilter) {
                            var displayFilterParams = displayFilter.split(':');
                            if (displayFilterParams.length > 1) {
                                angular.forEach(displayFilterParams.slice(1), function (displayFilterParam) {
                                    displayFilterParam = displayFilterParam.trim();
                                    if (displayFilterParam && displayFilterParam !== "gridItem" && displayFilterParam !== "gridDisplayItem") {
                                        watchExpression += "," + displayFilterParam;
                                    }
                                });
                            }
                        });
                    }
                });
                watchExpression += "]";
                TrNgGrid.debugMode && this.log("re-formatting is set to watch for changes in " + watchExpression);
                gridScope.$watch(watchExpression, function () { return _this.scheduleDataFormatting(); }, true);
            };
            GridController.prototype.setupServerSideModeTriggers = function (gridScope) {
                var _this = this;
                if (this.isInServerSideMode) {
                    var dataRequestPromise = null;
                    var scheduledForCurrentCycle = false;
                    var fastNextSchedule = false;
                    var pageIndexResetRequired = false;
                    var cancelDataRequestPromise = function () {
                        if (dataRequestPromise) {
                            _this.$timeout.cancel(dataRequestPromise);
                            dataRequestPromise = null;
                        }
                    };
                    var retrieveDataCallback = function () {
                        TrNgGrid.debugMode && _this.log("Preparing to request data - server side mode");
                        cancelDataRequestPromise();
                        var requestData = function () {
                            gridScope.$applyAsync(function () {
                                scheduledForCurrentCycle = false;
                                try {
                                    TrNgGrid.debugMode && _this.log("Requesting data - server side mode");
                                    _this.gridOptions.onDataRequired(_this.gridOptions);
                                }
                                catch (ex) {
                                    TrNgGrid.debugMode && _this.log("Data retrieval failed " + ex);
                                    throw ex;
                                }
                            });
                        };
                        if (pageIndexResetRequired) {
                            gridScope.$evalAsync(function () {
                                TrNgGrid.debugMode && _this.log("Resetting the page index - server side mode");
                                gridScope.gridOptions.currentPage = 0;
                                pageIndexResetRequired = false;
                                requestData();
                            });
                        }
                        else {
                            requestData();
                        }
                    };
                    this.scheduleServerSideModeDataRetrieval = function () {
                        if (scheduledForCurrentCycle) {
                            return;
                        }
                        cancelDataRequestPromise();
                        dataRequestPromise = _this.$timeout(function () {
                            dataRequestPromise = null;
                            scheduledForCurrentCycle = true;
                            retrieveDataCallback();
                        }, _this.gridOptions.onDataRequiredDelay, true);
                        if (fastNextSchedule) {
                            _this.speedUpServerSideModeDataRetrieval();
                        }
                    };
                    this.speedUpServerSideModeDataRetrieval = function ($event) {
                        if (!$event || $event["keyCode"] == 13) {
                            if (dataRequestPromise) {
                                fastNextSchedule = false;
                                cancelDataRequestPromise();
                                scheduledForCurrentCycle = true;
                                retrieveDataCallback();
                            }
                            else {
                                fastNextSchedule = true;
                            }
                        }
                    };
                    gridScope.$watch("gridOptions.currentPage", function (newValue, oldValue) {
                        if (newValue !== oldValue) {
                            {
                                TrNgGrid.debugMode && _this.log("Changes detected in the current page index in server-side mode. Scheduling data retrieval...");
                                _this.scheduleServerSideModeDataRetrieval();
                            }
                        }
                    });
                    var initCycle = true;
                    gridScope.$watchCollection("[" +
                        "gridOptions.filterBy, " +
                        "gridOptions.filterByFields, " +
                        "gridOptions.orderBy, " +
                        "gridOptions.orderByReverse, " +
                        "gridOptions.pageItems" +
                        "]", function (newValues, oldValues) {
                        if (initCycle) {
                            initCycle = false;
                        }
                        else {
                            if (_this.gridOptions.currentPage !== 0) {
                                TrNgGrid.debugMode && _this.log("Changes detected in parameters in server-side mode. Requesting a page index reset...");
                                pageIndexResetRequired = true;
                            }
                            TrNgGrid.debugMode && _this.log("Changes detected in parameters in server-side mode. Scheduling data retrieval...");
                            _this.scheduleServerSideModeDataRetrieval();
                        }
                    });
                    this.scheduleServerSideModeDataRetrieval();
                    this.speedUpServerSideModeDataRetrieval();
                }
                else {
                    this.speedUpServerSideModeDataRetrieval = function ($event) { };
                }
                gridScope.speedUpAsyncDataRetrieval = function ($event) { return _this.speedUpServerSideModeDataRetrieval($event); };
            };
            GridController.prototype.setupDataSelectionTriggers = function (gridScope) {
                var _this = this;
                gridScope.$watch("gridOptions.selectionMode", function (newValue, oldValue) {
                    if (newValue !== oldValue) {
                        switch (newValue) {
                            case SelectionMode[SelectionMode.None]:
                                _this.gridOptions.selectedItems.splice(0);
                                break;
                            case SelectionMode[SelectionMode.SingleRow]:
                                if (_this.gridOptions.selectedItems.length > 1) {
                                    _this.gridOptions.selectedItems.splice(1);
                                }
                                break;
                        }
                    }
                });
            };
            GridController.prototype.setColumnOptions = function (columnIndex, columnOptions) {
                var originalOptions = this.gridOptions.gridColumnDefs[columnIndex];
                if (!originalOptions) {
                    throw "Invalid grid column options found for column index " + columnIndex + ". Please report this error.";
                }
                columnOptions = angular.extend(columnOptions, originalOptions);
                this.gridOptions.gridColumnDefs[columnIndex] = columnOptions;
            };
            GridController.prototype.toggleSorting = function (propertyName) {
                if (this.gridOptions.orderBy != propertyName) {
                    this.gridOptions.orderBy = propertyName;
                }
                else {
                    this.gridOptions.orderByReverse = !this.gridOptions.orderByReverse;
                }
                this.speedUpServerSideModeDataRetrieval();
            };
            GridController.prototype.toggleItemSelection = function (filteredItems, item, $event) {
                if (this.gridOptions.selectionMode === SelectionMode[SelectionMode.None])
                    return;
                switch (this.gridOptions.selectionMode) {
                    case SelectionMode[SelectionMode.MultiRowWithKeyModifiers]:
                        if (!$event["ctrlKey"] && !$event["shiftKey"] && !$event["metaKey"]) {
                            var itemIndex = this.gridOptions.selectedItems.indexOf(item);
                            this.gridOptions.selectedItems.splice(0);
                            if (itemIndex < 0) {
                                this.gridOptions.selectedItems.push(item);
                            }
                        }
                        else {
                            if ($event["ctrlKey"] || $event["metaKey"]) {
                                var itemIndex = this.gridOptions.selectedItems.indexOf(item);
                                if (itemIndex >= 0) {
                                    this.gridOptions.selectedItems.splice(itemIndex, 1);
                                }
                                else {
                                    this.gridOptions.selectedItems.push(item);
                                }
                            }
                            else if ($event["shiftKey"]) {
                                if (document["selection"] && document["selection"].empty) {
                                    document["selection"].empty();
                                }
                                else if (window.getSelection) {
                                    var sel = window.getSelection();
                                    sel.removeAllRanges();
                                }
                                var firstItemIndex;
                                var lastSelectedItem = this.gridOptions.selectedItems[this.gridOptions.selectedItems.length - 1];
                                for (firstItemIndex = 0; firstItemIndex < filteredItems.length && filteredItems[firstItemIndex].$$_gridItem !== lastSelectedItem; firstItemIndex++)
                                    ;
                                if (firstItemIndex >= filteredItems.length) {
                                    firstItemIndex = 0;
                                }
                                var lastItemIndex;
                                for (lastItemIndex = 0; lastItemIndex < filteredItems.length && filteredItems[lastItemIndex].$$_gridItem !== item; lastItemIndex++)
                                    ;
                                if (lastItemIndex >= filteredItems.length) {
                                    throw "Invalid selection on a key modifier selection mode";
                                }
                                if (lastItemIndex < firstItemIndex) {
                                    var tempIndex = firstItemIndex;
                                    firstItemIndex = lastItemIndex;
                                    lastItemIndex = tempIndex;
                                }
                                for (var currentItemIndex = firstItemIndex; currentItemIndex <= lastItemIndex; currentItemIndex++) {
                                    var currentItem = filteredItems[currentItemIndex].$$_gridItem;
                                    if (this.gridOptions.selectedItems.indexOf(currentItem) < 0) {
                                        this.gridOptions.selectedItems.push(currentItem);
                                    }
                                }
                            }
                        }
                        break;
                    case SelectionMode[SelectionMode.SingleRow]:
                        var itemIndex = this.gridOptions.selectedItems.indexOf(item);
                        this.gridOptions.selectedItems.splice(0);
                        if (itemIndex < 0) {
                            this.gridOptions.selectedItems.push(item);
                        }
                        break;
                    case SelectionMode[SelectionMode.MultiRow]:
                        var itemIndex = this.gridOptions.selectedItems.indexOf(item);
                        if (itemIndex >= 0) {
                            this.gridOptions.selectedItems.splice(itemIndex, 1);
                        }
                        else {
                            this.gridOptions.selectedItems.push(item);
                        }
                        break;
                }
            };
            GridController.prototype.discoverTemplates = function (gridElement) {
                this.templatedHeader = new TemplatedSection("thead", null, null, "th", cellHeaderDirectiveAttribute);
                this.templatedBody = new TemplatedSection("tbody", bodyDirectiveAttribute, null, "td", cellBodyDirectiveAttribute);
                this.templatedFooter = new TemplatedSection("tfoot", null, null, "td", cellFooterDirectiveAttribute);
                this.templatedHeader.discoverTemplates(gridElement);
                this.templatedFooter.discoverTemplates(gridElement);
                this.templatedBody.discoverTemplates(gridElement);
            };
            GridController.prototype.getSafeFieldName = function (fieldName) {
                return fieldName.replace(/[^a-zA-Z0-9]/g, "_");
            };
            GridController.prototype.configureTableStructure = function (parentScope, gridElement, oldScope) {
                var _this = this;
                try {
                    gridElement.empty();
                    if (oldScope) {
                        var scopeToBeDestroyed = oldScope;
                        this.$timeout(function () {
                            scopeToBeDestroyed.$destroy();
                        });
                        oldScope = null;
                    }
                    var scope = parentScope.$new();
                    if (this.columnDefsItemsWatcherDeregistration) {
                        this.columnDefsItemsWatcherDeregistration();
                        this.columnDefsItemsWatcherDeregistration = null;
                    }
                    if (this.columnDefsFieldsWatcherDeregistration) {
                        this.columnDefsFieldsWatcherDeregistration();
                        this.columnDefsFieldsWatcherDeregistration = null;
                    }
                    this.columnDefsFieldsWatcherDeregistration = scope.$watch("gridOptions.fields", function (newValue, oldValue) {
                        if (!angular.equals(newValue, oldValue)) {
                            _this.configureTableStructure(parentScope, gridElement, scope);
                        }
                    }, true);
                    var templatedHeaderPartialGridColumnDefs = this.templatedHeader.extractPartialColumnDefinitions();
                    var templatedBodyPartialGridColumnDefs = this.templatedBody.extractPartialColumnDefinitions();
                    var templatedFooterPartialGridColumnDefs = this.templatedFooter.extractPartialColumnDefinitions();
                    var finalPartialGridColumnDefs = [];
                    var fieldsEnforced = this.gridOptions.fields;
                    if (fieldsEnforced) {
                        angular.forEach(this.gridOptions.fields, function (fieldName) {
                            if (fieldName) {
                                finalPartialGridColumnDefs.push({
                                    isStandardColumn: true,
                                    fieldName: fieldName
                                });
                            }
                        });
                        finalPartialGridColumnDefs = combineGridCellInfos(finalPartialGridColumnDefs, templatedHeaderPartialGridColumnDefs, false, true);
                        finalPartialGridColumnDefs = combineGridCellInfos(finalPartialGridColumnDefs, templatedBodyPartialGridColumnDefs, false, true);
                    }
                    else {
                        if (templatedHeaderPartialGridColumnDefs.length > 0) {
                            finalPartialGridColumnDefs = combineGridCellInfos(templatedHeaderPartialGridColumnDefs, templatedBodyPartialGridColumnDefs, true, true);
                        }
                        else {
                            if (!this.gridOptions.items || this.gridOptions.items.length == 0) {
                                this.columnDefsItemsWatcherDeregistration = scope.$watch("gridOptions.items.length", function (newValue, oldValue) {
                                    if (newValue) {
                                        _this.configureTableStructure(parentScope, gridElement, scope);
                                    }
                                });
                                return;
                            }
                            for (var propName in this.gridOptions.items[0]) {
                                {
                                    finalPartialGridColumnDefs.push({
                                        isStandardColumn: true,
                                        fieldName: propName
                                    });
                                }
                            }
                            finalPartialGridColumnDefs = combineGridCellInfos(finalPartialGridColumnDefs, templatedBodyPartialGridColumnDefs, true, true);
                        }
                    }
                    if (templatedFooterPartialGridColumnDefs.length == 0) {
                        templatedFooterPartialGridColumnDefs.push({ isStandardColumn: true });
                    }
                    angular.forEach(finalPartialGridColumnDefs, function (columnDefs) {
                        if (columnDefs.fieldName) {
                            var fieldName = columnDefs.fieldName;
                            columnDefs.displayFieldName = _this.getSafeFieldName(fieldName);
                            var fieldExtractionExpression;
                            if (fieldName[0] === "[") {
                                fieldExtractionExpression = fieldName;
                            }
                            else {
                                fieldExtractionExpression = fieldName.replace(/^([^\.]+)/g, "\[\"$1\"]");
                            }
                            columnDefs.fieldExtractionExpression = fieldExtractionExpression;
                        }
                    });
                    this.gridOptions.gridColumnDefs = finalPartialGridColumnDefs;
                    var headerElement = this.templatedHeader.configureSection(gridElement, finalPartialGridColumnDefs);
                    var footerElement = this.templatedFooter.configureSection(gridElement, templatedFooterPartialGridColumnDefs);
                    var bodyElement = this.templatedBody.configureSection(gridElement, finalPartialGridColumnDefs);
                    var templatedBodyRowElement = this.templatedBody.getTemplatedRowElement(bodyElement);
                    var templatedHeaderRowElement = this.templatedHeader.getTemplatedRowElement(headerElement);
                    bodyElement.attr(bodyDirectiveAttribute, "");
                    templatedBodyRowElement.attr("ng-click", "toggleItemSelection(gridItem, $event)");
                    templatedBodyRowElement.attr("ng-repeat", "gridDisplayItem in filteredItems");
                    templatedBodyRowElement.attr("ng-init", "gridItem=gridDisplayItem.$$_gridItem;" + templatedBodyRowElement.attr("ng-init"));
                    var ngClassValue = templatedBodyRowElement.attr("ng-class");
                    ngClassValue = (ngClassValue || "").replace(/^(\s*\{?)(.*?)(\}?\s*)$/, "{'" + TrNgGrid.rowSelectedCssClass + "':gridOptions.selectedItems.indexOf(gridItem) >= 0" + ", $2}");
                    templatedBodyRowElement.attr("ng-class", ngClassValue);
                    this.$compile(headerElement)(scope);
                    this.$compile(footerElement)(scope);
                    this.$compile(bodyElement)(scope);
                }
                catch (ex) {
                    TrNgGrid.debugMode && this.log("Fixing table structure failed with error " + ex);
                    throw ex;
                }
            };
            GridController.prototype.computeFormattedItems = function (scope) {
                var input = scope.gridOptions.items || [];
                TrNgGrid.debugMode && this.log("formatting items of length " + input.length);
                try {
                    var formattedItems = scope.formattedItems = (scope.formattedItems || []);
                    var gridColumnDefs = scope.gridOptions.gridColumnDefs;
                    for (var inputIndex = 0; inputIndex < input.length; inputIndex++) {
                        var gridItem = input[inputIndex];
                        var outputItem;
                        var localEvalVars = { gridItem: gridItem };
                        while (formattedItems.length > input.length && (outputItem = formattedItems[inputIndex]).$$_gridItem !== gridItem) {
                            formattedItems.splice(inputIndex, 1);
                        }
                        if (inputIndex < formattedItems.length) {
                            outputItem = formattedItems[inputIndex];
                            if (outputItem.$$_gridItem !== gridItem) {
                                outputItem = { $$_gridItem: gridItem };
                                formattedItems[inputIndex] = outputItem;
                            }
                        }
                        else {
                            outputItem = { $$_gridItem: gridItem };
                            formattedItems.push(outputItem);
                        }
                        for (var gridColumnDefIndex = 0; gridColumnDefIndex < gridColumnDefs.length; gridColumnDefIndex++) {
                            var fieldName;
                            try {
                                var gridColumnDef = gridColumnDefs[gridColumnDefIndex];
                                if (gridColumnDef.displayFieldName && gridColumnDef.fieldExtractionExpression) {
                                    var displayFormat = gridColumnDef.displayFormat;
                                    if (displayFormat) {
                                        if (displayFormat[0] !== "." && displayFormat[0] !== "|" && displayFormat[0] !== "[") {
                                            displayFormat = " | " + displayFormat;
                                        }
                                    }
                                    outputItem[gridColumnDef.displayFieldName] = scope.$eval("gridItem" + gridColumnDef.fieldExtractionExpression + (displayFormat || ""), localEvalVars);
                                }
                            }
                            catch (ex) {
                                TrNgGrid.debugMode && this.log("Field evaluation failed for <" + (fieldName || "unknown") + "> with error " + ex);
                            }
                        }
                    }
                    if (formattedItems.length > input.length) {
                        formattedItems.splice(input.length, formattedItems.length - input.length);
                    }
                    this.scheduleDataFiltering();
                }
                catch (ex) {
                    TrNgGrid.debugMode && this.log("Failed to format items " + ex);
                    throw ex;
                }
            };
            GridController.prototype.extractDataItems = function (formattedItems) {
                var dataItems;
                if (formattedItems) {
                    dataItems = new Array(formattedItems.length);
                    for (var index = 0; index < formattedItems.length; index++) {
                        dataItems[index] = formattedItems[index].$$_gridItem;
                    }
                }
                else {
                    dataItems = [];
                }
                return dataItems;
            };
            GridController.prototype.computeFilteredItems = function (scope) {
                try {
                    if (this.isInServerSideMode) {
                        scope.filteredItems = scope.formattedItems;
                    }
                    else {
                        scope.filterByDisplayFields = {};
                        if (scope.gridOptions.filterByFields) {
                            for (var fieldName in scope.gridOptions.filterByFields) {
                                scope.filterByDisplayFields[this.getSafeFieldName(fieldName)] = scope.gridOptions.filterByFields[fieldName];
                            }
                        }
                        TrNgGrid.debugMode && this.log("filtering items of length " + (scope.formattedItems ? scope.formattedItems.length : 0));
                        scope.filteredItems = scope.$eval("formattedItems | filter:gridOptions.filterBy | filter:filterByDisplayFields | " + TrNgGrid.sortFilter + ":gridOptions");
                        if (scope.gridOptions.filteredItems) {
                            scope.gridOptions.filteredItems = this.extractDataItems(scope.filteredItems);
                        }
                        scope.filteredItems = scope.$eval("filteredItems | " + TrNgGrid.dataPagingFilter + ":gridOptions");
                    }
                    if (scope.gridOptions.filteredItemsPage) {
                        scope.gridOptions.filteredItemsPage = this.extractDataItems(scope.filteredItems);
                    }
                }
                catch (ex) {
                    TrNgGrid.debugMode && this.log("Failed to filter items " + ex);
                    throw ex;
                }
            };
            GridController.prototype.linkAttrs = function (tAttrs, localStorage) {
                var propSetter = function (propName, propValue) {
                    if (typeof (propValue) === "undefined")
                        return;
                    switch (propValue) {
                        case "true":
                            propValue = true;
                            break;
                        case "false":
                            propValue = false;
                            break;
                    }
                    localStorage[propName] = propValue;
                };
                for (var propName in localStorage) {
                    propSetter(propName, tAttrs[propName]);
                    (function (propName) {
                        tAttrs.$observe(propName, function (value) { return propSetter(propName, value); });
                    })(propName);
                }
            };
            GridController.prototype.log = function (message) {
                console.log(tableDirective + "(" + new Date().getTime() + "): " + message);
            };
            return GridController;
        }());
        angular.module("trNgGrid", [])
            .directive(tableDirective, [
            function () {
                return {
                    restrict: 'A',
                    scope: {
                        items: '=',
                        selectedItems: '=?',
                        filteredItems: '=?',
                        filteredItemsPage: '=?',
                        filterBy: '=?',
                        filterByFields: '=?',
                        orderBy: '=?',
                        orderByReverse: '=?',
                        pageItems: '=?',
                        currentPage: '=?',
                        totalItems: '=?',
                        enableFiltering: '=?',
                        enableSorting: '=?',
                        selectionMode: '@',
                        locale: '@',
                        onDataRequired: '&',
                        onDataRequiredDelay: '=?',
                        fields: '=?'
                    },
                    controller: ["$compile", "$parse", "$timeout", "$templateCache", "$interpolate", GridController],
                    compile: function (templateElement, tAttrs) {
                        angular.forEach(templateElement.children(), function (childElement) {
                            childElement = angular.element(childElement);
                            childElement.attr("ng-non-bindable", "");
                        });
                        return {
                            pre: function (isolatedScope, instanceElement, tAttrs, controller, transcludeFn) {
                                controller.discoverTemplates(instanceElement);
                            },
                            post: function (isolatedScope, instanceElement, tAttrs, controller, transcludeFn) {
                                instanceElement.addClass(TrNgGrid.tableCssClass);
                                var gridScope = isolatedScope.$parent.$new();
                                controller.setupGrid(gridScope, isolatedScope, !!tAttrs.onDataRequired);
                                controller.configureTableStructure(gridScope, instanceElement);
                                isolatedScope.$on("$destroy", function () {
                                    gridScope.$destroy();
                                    TrNgGrid.debugMode && controller.log("grid scope destroyed");
                                });
                            }
                        };
                    }
                };
            }])
            .directive(cellHeaderDirective, [
            function () {
                var setupColumnTitle = function (scope) {
                    if (scope.columnOptions.displayName) {
                        scope.columnTitle = scope.columnOptions.displayName;
                    }
                    else if (scope.columnOptions.fieldName) {
                        var rawTitle = scope.columnOptions.fieldName.replace(/^([^\a-zA-Z]*)([\a-zA-Z0-9]*)(.*)/g, "$2");
                        var splitTitleName = rawTitle.split(/(?=[A-Z])/);
                        if (splitTitleName.length && splitTitleName[0].length) {
                            splitTitleName[0] = splitTitleName[0][0].toLocaleUpperCase() + splitTitleName[0].substr(1);
                        }
                        scope.columnTitle = splitTitleName.join(" ");
                    }
                    else {
                        scope.columnTitle = "";
                    }
                };
                return {
                    restrict: 'A',
                    require: '^' + tableDirective,
                    scope: true,
                    compile: function (templateElement, tAttrs) {
                        var isCustomized = tAttrs['isCustomized'] == 'true';
                        wrapTemplatedCell(templateElement, tAttrs, isCustomized, cellHeaderTemplateDirectiveAttribute);
                        return {
                            pre: function (scope, instanceElement, tAttrs, controller, $transclude) {
                                var columnIndex = parseInt(tAttrs[cellHeaderDirective]);
                                var columnOptions = angular.extend(scope.gridOptions.gridColumnDefs[columnIndex], TrNgGrid.defaultColumnOptionsTemplate, TrNgGrid.defaultColumnOptions);
                                controller.linkAttrs(tAttrs, columnOptions);
                                scope.columnOptions = columnOptions;
                                scope.isCustomized = isCustomized;
                                scope.toggleSorting = function (propertyName) {
                                    controller.toggleSorting(propertyName);
                                };
                                scope.$watch("columnOptions.displayName", function () {
                                    setupColumnTitle(scope);
                                });
                                var isWatchingColumnFilter = false;
                                scope.$watch("gridOptions.filterByFields['" + columnOptions.fieldName + "']", function (newFilterValue, oldFilterValue) {
                                    if (columnOptions.filter !== newFilterValue) {
                                        columnOptions.filter = newFilterValue;
                                    }
                                    if (!isWatchingColumnFilter) {
                                        scope.$watch("columnOptions.filter", function (newFilterValue, oldFilterValue) {
                                            if (scope.gridOptions.filterByFields[columnOptions.fieldName] !== newFilterValue) {
                                                if (!newFilterValue) {
                                                    delete (scope.gridOptions.filterByFields[columnOptions.fieldName]);
                                                }
                                                else {
                                                    scope.gridOptions.filterByFields[columnOptions.fieldName] = newFilterValue;
                                                }
                                                scope.gridOptions.filterByFields = angular.extend({}, scope.gridOptions.filterByFields);
                                            }
                                        });
                                        isWatchingColumnFilter = true;
                                    }
                                });
                            }
                        };
                    }
                };
            }
        ])
            .directive(cellHeaderTemplateDirective, [
            function () {
                return {
                    restrict: 'A',
                    templateUrl: TrNgGrid.cellHeaderTemplateId,
                    transclude: true,
                    replace: true,
                };
            }
        ])
            .directive(bodyDirective, [
            function () {
                return {
                    restrict: 'A',
                    require: '^' + tableDirective,
                    scope: true,
                    compile: function (templateElement, tAttrs) {
                        return {
                            pre: function (scope, compiledInstanceElement, tAttrs, controller) {
                                scope.toggleItemSelection = function (item, $event) {
                                    controller.toggleItemSelection(scope.filteredItems, item, $event);
                                };
                            }
                        };
                    }
                };
            }
        ])
            .directive(cellBodyDirective, [
            function () {
                return {
                    restrict: 'A',
                    require: '^' + tableDirective,
                    scope: true,
                    compile: function (templateElement, tAttrs) {
                        var isCustomized = tAttrs['isCustomized'] == 'true';
                        wrapTemplatedCell(templateElement, tAttrs, isCustomized, cellBodyTemplateDirectiveAttribute);
                        return {
                            pre: function (scope, instanceElement, tAttrs, controller, $transclude) {
                                scope.columnOptions = scope.gridOptions.gridColumnDefs[parseInt(tAttrs[cellBodyDirective])];
                                scope.gridItem = scope.gridDisplayItem.$$_gridItem;
                                scope.isCustomized = isCustomized;
                            }
                        };
                    }
                };
            }
        ])
            .directive(cellBodyTemplateDirective, [
            function () {
                return {
                    restrict: 'A',
                    templateUrl: TrNgGrid.cellBodyTemplateId,
                    transclude: true,
                    replace: true
                };
            }
        ])
            .directive(cellFooterDirective, [
            function () {
                return {
                    restrict: 'A',
                    require: '^' + tableDirective,
                    scope: true,
                    compile: function (templateElement, tAttrs) {
                        var isCustomized = tAttrs['isCustomized'] == 'true';
                        wrapTemplatedCell(templateElement, tAttrs, isCustomized, cellFooterTemplateDirectiveAttribute);
                        return {
                            pre: function (scope, instanceElement, tAttrs, controller, $transclude) {
                                scope.isCustomized = isCustomized;
                                instanceElement.attr("colspan", scope.gridOptions.gridColumnDefs.length);
                            }
                        };
                    }
                };
            }
        ])
            .directive(cellFooterTemplateDirective, [
            function () {
                return {
                    restrict: 'A',
                    templateUrl: TrNgGrid.cellFooterTemplateId,
                    transclude: true,
                    replace: true
                };
            }
        ])
            .directive(columnSortDirective, [
            function () {
                return {
                    restrict: 'A',
                    replace: true,
                    templateUrl: TrNgGrid.columnSortTemplateId
                };
            }
        ])
            .directive(columnFilterDirective, [
            function () {
                return {
                    restrict: 'A',
                    replace: true,
                    templateUrl: TrNgGrid.columnFilterTemplateId
                };
            }
        ])
            .directive(globalFilterDirective, [
            function () {
                return {
                    restrict: 'A',
                    scope: false,
                    templateUrl: TrNgGrid.footerGlobalFilterTemplateId,
                };
            }
        ])
            .directive(pagerDirective, [
            function () {
                var setupScope = function (scope, controller) {
                    scope.totalItemsCount = (typeof (scope.gridOptions.totalItems) != "undefined" && scope.gridOptions.totalItems != null)
                        ? scope.gridOptions.totalItems
                        : (scope.gridOptions.items ? scope.gridOptions.items.length : 0);
                    scope.isPaged = (!!scope.gridOptions.pageItems) && (scope.gridOptions.pageItems < scope.totalItemsCount);
                    scope.extendedControlsActive = false;
                    scope.lastPageIndex = (!scope.totalItemsCount || !scope.isPaged)
                        ? 0
                        : (Math.floor(scope.totalItemsCount / scope.gridOptions.pageItems) + ((scope.totalItemsCount % scope.gridOptions.pageItems) ? 0 : -1));
                    if (scope.gridOptions.currentPage > scope.lastPageIndex) {
                        TrNgGrid.debugMode && controller.log("The current page index falls outside of the range of items. Either the attached parameter has a wrong value or the total items count is not properly set in server side mode.");
                        scope.gridOptions.currentPage = scope.lastPageIndex;
                    }
                    scope.startItemIndex = scope.isPaged ? (scope.gridOptions.pageItems * scope.gridOptions.currentPage) : 0;
                    scope.endItemIndex = scope.isPaged ? (scope.startItemIndex + scope.gridOptions.pageItems - 1) : scope.totalItemsCount - 1;
                    if (scope.endItemIndex >= scope.totalItemsCount) {
                        scope.endItemIndex = scope.totalItemsCount - 1;
                    }
                    if (scope.endItemIndex < scope.startItemIndex) {
                        scope.endItemIndex = scope.startItemIndex;
                    }
                    scope.pageCanGoBack = scope.isPaged && scope.gridOptions.currentPage > 0;
                    scope.pageCanGoForward = scope.isPaged && scope.gridOptions.currentPage < scope.lastPageIndex;
                    scope.pageIndexes = scope.pageIndexes || [];
                    scope.pageIndexes.splice(0);
                    if (scope.isPaged) {
                        if (scope.lastPageIndex + 1 > TrNgGrid.defaultPagerMinifiedPageCountThreshold) {
                            scope.extendedControlsActive = true;
                            var pageIndexHalfRange = Math.floor(TrNgGrid.defaultPagerMinifiedPageCountThreshold / 2);
                            var lowPageIndex = scope.gridOptions.currentPage - pageIndexHalfRange;
                            var highPageIndex = scope.gridOptions.currentPage + pageIndexHalfRange;
                            if (lowPageIndex < 0) {
                                highPageIndex += -lowPageIndex;
                                lowPageIndex = 0;
                            }
                            else if (highPageIndex > scope.lastPageIndex) {
                                lowPageIndex -= highPageIndex - scope.lastPageIndex;
                                highPageIndex = scope.lastPageIndex;
                            }
                            if (lowPageIndex > 0) {
                                scope.pageIndexes.push(null);
                                lowPageIndex++;
                            }
                            var highPageEllipsed = false;
                            if (highPageIndex < scope.lastPageIndex) {
                                highPageEllipsed = true;
                                highPageIndex--;
                            }
                            for (var pageIndex = lowPageIndex; pageIndex <= highPageIndex; pageIndex++) {
                                scope.pageIndexes.push(pageIndex);
                            }
                            if (highPageEllipsed) {
                                scope.pageIndexes.push(null);
                            }
                        }
                        else {
                            scope.extendedControlsActive = false;
                            for (var pageIndex = 0; pageIndex <= scope.lastPageIndex; pageIndex++) {
                                scope.pageIndexes.push(pageIndex);
                            }
                        }
                    }
                    scope.pageSelectionActive = scope.pageIndexes.length > 1;
                    scope.navigateToPage = function (pageIndex) {
                        scope.gridOptions.currentPage = pageIndex;
                        scope.speedUpAsyncDataRetrieval();
                    };
                    scope.switchPageSelection = function ($event, pageSelectionActive) {
                        scope.pageSelectionActive = pageSelectionActive;
                        if ($event) {
                            $event.preventDefault();
                            $event.stopPropagation();
                        }
                    };
                };
                return {
                    restrict: 'A',
                    scope: true,
                    require: '^' + tableDirective,
                    templateUrl: TrNgGrid.footerPagerTemplateId,
                    replace: true,
                    compile: function (templateElement, tAttrs) {
                        return {
                            pre: function (scope, compiledInstanceElement, tAttrs, controller) {
                                setupScope(scope, controller);
                            },
                            post: function (scope, instanceElement, tAttrs, controller) {
                                scope.$watchCollection("[gridOptions.currentPage, gridOptions.items.length, gridOptions.totalItems, gridOptions.pageItems]", function (newValues, oldValues) {
                                    setupScope(scope, controller);
                                });
                            }
                        };
                    }
                };
            }
        ])
            .filter(TrNgGrid.sortFilter, ["$filter", "$parse", function ($filter, $parse) {
                return function (input, gridOptions) {
                    if (!gridOptions.orderBy || !gridOptions.gridColumnDefs) {
                        return input;
                    }
                    var columnOptions = null;
                    for (var columnOptionsIndex = 0; (columnOptionsIndex < gridOptions.gridColumnDefs.length) && ((columnOptions = gridOptions.gridColumnDefs[columnOptionsIndex]).fieldName !== gridOptions.orderBy); columnOptions = null, columnOptionsIndex++)
                        ;
                    if (!columnOptions) {
                        return input;
                    }
                    var sortedInput = $filter("orderBy")(input, function (item) {
                        var fieldValue = undefined;
                        if (columnOptions.fieldExtractionExpression) {
                            try {
                                fieldValue = $parse("item.$$_gridItem" + columnOptions.fieldExtractionExpression)({ item: item });
                            }
                            catch (ex) {
                            }
                        }
                        if (fieldValue === undefined) {
                            try {
                                fieldValue = $parse("item[\"" + columnOptions.displayFieldName + "\"]")({ item: item });
                            }
                            catch (ex) {
                            }
                        }
                        return fieldValue;
                    }, gridOptions.orderByReverse);
                    return sortedInput;
                };
            }])
            .filter(TrNgGrid.dataPagingFilter, function () {
            return function (input, gridOptions) {
                if (input)
                    gridOptions.totalItems = input.length;
                if (!gridOptions.pageItems || !input || input.length == 0)
                    return input;
                if (!gridOptions.currentPage) {
                    gridOptions.currentPage = 0;
                }
                var startIndex = gridOptions.currentPage * gridOptions.pageItems;
                if (startIndex >= input.length) {
                    gridOptions.currentPage = 0;
                    startIndex = 0;
                }
                var endIndex = gridOptions.currentPage * gridOptions.pageItems + gridOptions.pageItems;
                return input.slice(startIndex, endIndex);
            };
        })
            .filter(TrNgGrid.translateFilter, ["$filter", "$injector", function ($filter, $injector) {
                return function (input, languageId) {
                    var translatedText = null;
                    if (!languageId) {
                        throw "Language identifier is not set";
                    }
                    if (input instanceof Date) {
                        var dateFormat = $filter(TrNgGrid.translateFilter)(TrNgGrid.translationDateFormat, languageId);
                        if (dateFormat && dateFormat !== TrNgGrid.translationDateFormat) {
                            translatedText = $filter("date")(input, dateFormat);
                            return translatedText;
                        }
                        return input;
                    }
                    var languageIdParts = languageId.split(/[-_]/);
                    for (var languageIdPartIndex = languageIdParts.length; (languageIdPartIndex > 0) && (!translatedText); languageIdPartIndex--) {
                        var subLanguageId = languageIdParts.slice(0, languageIdPartIndex).join("-");
                        var langTranslations = TrNgGrid.translations[subLanguageId];
                        if (langTranslations) {
                            translatedText = langTranslations[input];
                        }
                    }
                    if (!translatedText && $injector.has("translateFilter")) {
                        try {
                            translatedText = $filter("translate")(input);
                        }
                        catch (ex) {
                        }
                    }
                    if (!translatedText) {
                        translatedText = input;
                    }
                    return translatedText;
                };
            }])
            .run(function () {
            TrNgGrid.tableCssClass = "tr-ng-grid table table-bordered table-hover";
            TrNgGrid.cellCssClass = "tr-ng-cell";
            TrNgGrid.headerCellCssClass = "tr-ng-column-header " + TrNgGrid.cellCssClass;
            TrNgGrid.bodyCellCssClass = TrNgGrid.cellCssClass;
            TrNgGrid.columnTitleCssClass = "tr-ng-title";
            TrNgGrid.columnSortCssClass = "tr-ng-sort";
            TrNgGrid.columnFilterCssClass = "tr-ng-column-filter";
            TrNgGrid.columnFilterInputWrapperCssClass = "";
            TrNgGrid.columnSortActiveCssClass = "tr-ng-sort-active text-info";
            TrNgGrid.columnSortInactiveCssClass = "tr-ng-sort-inactive text-muted glyphicon glyphicon-chevron-down";
            TrNgGrid.columnSortReverseOrderCssClass = "tr-ng-sort-order-reverse glyphicon glyphicon-chevron-down";
            TrNgGrid.columnSortNormalOrderCssClass = "tr-ng-sort-order-normal glyphicon glyphicon-chevron-up";
            TrNgGrid.rowSelectedCssClass = "active";
            TrNgGrid.footerCssClass = "tr-ng-grid-footer form-inline";
        })
            .run(function () {
            TrNgGrid.defaultColumnOptions.displayAlign = 'left';
            TrNgGrid.defaultPagerMinifiedPageCountThreshold = 3;
        });
        function addTemplate($templateCache, $interpolate, id, content) {
            var start = $interpolate.startSymbol(), end = $interpolate.endSymbol();
            if (!$templateCache.get(id)) {
                if (start !== '{{') {
                    content = content.replace(/\{\{/g, start + ' ');
                }
                if (end !== '}}') {
                    content = content.replace(/\}\}/g, ' ' + end);
                }
                $templateCache.put(id, content);
            }
        }
        ;
        function configureTemplates($templateCache, $interpolate) {
            addTemplate($templateCache, $interpolate, TrNgGrid.cellHeaderTemplateId, '
'
                + '
'
                + '

'
                + '
'
                + '
'
                + '
'
                + '      {{columnTitle |' + TrNgGrid.translateFilter + ':gridOptions.locale}}'
                + '

'
                + '
'
                + '

'
                + '
'
                + '
');
            addTemplate($templateCache, $interpolate, TrNgGrid.cellBodyTemplateId, '
'
                + '
'
                + '

'
                + '
'
                + '
{{gridDisplayItem[columnOptions.displayFieldName]}}
'
                + '
');
            addTemplate($templateCache, $interpolate, TrNgGrid.columnFilterTemplateId, '
'
                + '
'
                + '   <input class="form-control input-sm" type="text" ng-model="columnOptions.filter" ng-keypress="speedUpAsyncDataRetrieval($event)"></input>'
                + '
'
                + '
');
            addTemplate($templateCache, $interpolate, TrNgGrid.columnSortTemplateId, '
 '
                + '  <div ng-class="{\''
                + TrNgGrid.columnSortActiveCssClass + '\':gridOptions.orderBy==columnOptions.fieldName,\''
                + TrNgGrid.columnSortInactiveCssClass + '\':gridOptions.orderBy!=columnOptions.fieldName,\''
                + TrNgGrid.columnSortNormalOrderCssClass + '\':gridOptions.orderBy==columnOptions.fieldName&&!gridOptions.orderByReverse,\''
                + TrNgGrid.columnSortReverseOrderCssClass + '\':gridOptions.orderBy==columnOptions.fieldName&&gridOptions.orderByReverse}" >'
                + '
'
                + '
');
            addTemplate($templateCache, $interpolate, TrNgGrid.cellFooterTemplateId, '
'
                + '
'
                + '

'
                + '
'
                + '
'
                + '    '
                + '    '
                + '
'
                + '
');
            addTemplate($templateCache, $interpolate, TrNgGrid.footerGlobalFilterTemplateId, ''
                + '  <input class="form-control" type="text" ng-model="gridOptions.filterBy" ng-keypress="speedUpAsyncDataRetrieval($event)" ng-attr-placeholder="{{\'Search\'|' + TrNgGrid.translateFilter + ':gridOptions.locale}}"></input>'
                + '');
            addTemplate($templateCache, $interpolate, TrNgGrid.footerPagerTemplateId, ''
                + '
'
                + '
'
                + '     '
                + '         «'
                + '     '
                + '
'
                + '
'
                + '     '
                + '         ‹'
                + '     '
                + '
'
                + '
'
                + '      ...'
                + '      {{pageIndex+1}}'
                + '
'
                + '
'
                + '     '
                + '         ›'
                + '     '
                + '
'
                + '
'
                + '     '
                + '         »'
                + '     '
                + '
'
                + '
'
                + '     {{\'No items to display\'|' + TrNgGrid.translateFilter + ':gridOptions.locale}}'
                + '     '
                + '       {{startItemIndex+1}} - {{endItemIndex+1}} {{\'displayed\'|' + TrNgGrid.translateFilter + ':gridOptions.locale}}'
                + '       , {{totalItemsCount}} {{\'in total\'|' + TrNgGrid.translateFilter + ':gridOptions.locale}}'
                + '      '
                + '
'
                + '
'
                + '');
        }
        ;
    })(TrNgGrid = exports.TrNgGrid || (exports.TrNgGrid = {}));
});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">

<TITLE>
All Classes
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

All Classes

AccumulateMonitor

AccumulateMonitorInterface

ActiveStatsMonitor

AppBaseException

AppConstants

AppMap

BaseMonitor

BasicTimingMonitor

Command

CommandIterator

CompositeNode

EnumIterator

FileUtils

LastAccessMonitor

LeafNode

Logger

MinimalMonitor

Misc

Monitor

MonitorComposite

MonitorConverter

MonitorFactory

MonitorFactoryInterface

MonitorLeafFactory

MonitorLeafFactoryInterface

MonitorReportInterface

NodeTree

NullAccumulateMonitor

NullMonitor

ResultSetUtils

TestClass

TestClassPerformance

TimeStatsDistMonitor

TimeStatsMonitor

TimingMonitor


text:
export function debounce(func, delay) {
    let timer
    return function (...args) {
      if (timer) {
        clearTimeout(timer)
      }
      timer = setTimeout(() => {
        // func.apply(this,args)
        func(...args)
      }, delay)
    }
}


text:
CREATE TABLE IDN_AUTH_SESSION_STORE (
  SESSION_ID VARCHAR (100) DEFAULT NULL,
  SESSION_TYPE VARCHAR(100) DEFAULT NULL,
  SESSION_OBJECT BLOB,
  TIME_CREATED TIMESTAMP,
  PRIMARY KEY (SESSION_ID, SESSION_TYPE)
);

UPDATE IDP_AUTHENTICATOR SET NAME='samlsso' WHERE NAME = 'saml2sso' AND TENANT_ID = '-1234';

CREATE ALIAS IF NOT EXISTS DROP_FK AS $$ void executeSql(Connection conn, String sql) throws SQLException { conn.createStatement().executeUpdate(sql); } $$;

call drop_fk('ALTER TABLE IDP_PROVISIONING_ENTITY DROP CONSTRAINT ' || (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE TABLE_NAME = 'IDP_PROVISIONING_ENTITY' AND COLUMN_LIST  = 'ENTITY_TYPE,TENANT_ID,ENTITY_LOCAL_USERSTORE,ENTITY_NAME'));

ALTER TABLE IDP_PROVISIONING_ENTITY ADD UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID);

DROP ALIAS IF EXISTS DROP_FK;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Can. J. Bot. 57(7): 765 (1979)

#### Original name
Gelatinosporium griseolanatum A. Funk

### Remarks
null


text: example of Js Ajax


text:
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<serviceGroup>
    <service name="BAMMessageStoreService" scope="application">
        <schema schemaNamespace="http://org.apache.axis2/xsd"
                elementFormDefaultQualified="true"/>
        <transports>
            <transport>https</transport>
            <transport>http</transport>
        </transports>
        <description>
            BAM message store Service
        </description>
        <parameter name="ServiceClass">
            org.wso2.carbon.bam.messagestore.MessageStoreService
        </parameter>
    </service>

    <parameter name="adminService" locked="true">false</parameter>
    <parameter name="hiddenService" locked="true">false</parameter>
</serviceGroup>


text:
using NetClient.Rest;

namespace Cryptocurrency.Blockchain
{
    /// <summary>
    ///     Represents the REST resource for blockchain blocks.
    /// </summary>
    [BaseUri("https://blockchain.info")]
    [Route("/rawblock/{Index}")]
    [Route("/rawblock/{Hash}")]
    [Route("/block-height/{Height}?format=json", node: "blocks")]
    public class BlockResource : Resource<Block>
    {
    }
}