text:
package io.github.mike10004.seleniumcapture.chrome;

import com.github.mike10004.chromecookieimplant.ChromeCookie;
import com.github.mike10004.chromecookieimplant.ChromeCookieImplanter;
import com.github.mike10004.chromecookieimplant.CookieImplantResult;
import com.google.common.io.ByteSource;
import com.google.common.io.ByteStreams;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.github.mike10004.crxtool.CrxMetadata;
import io.github.mike10004.crxtool.CrxParser;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import static com.google.common.base.Preconditions.checkState;

@SuppressWarnings("unused")
public class ChromeDriverExperiments {

    @SuppressWarnings("SameParameterValue")
    private static String produceCookieArrayJson(URI url, String domain, String path, String name, String value) {
        JsonObject cookie = produceCookieObject(url, domain, path, name, value);
        JsonArray array = new JsonArray();
        array.add(cookie);
        return new Gson().toJson(array);
    }

    private static JsonObject produceCookieObject(URI url, String domain, String path, String name, String value) {
        JsonObject obj = new JsonObject();
        obj.addProperty("url", url.toString());
        obj.addProperty("domain", domain);
        obj.addProperty("path", path);
        obj.addProperty("name", name);
        obj.addProperty("value", value);
        obj.addProperty("httpOnly", true);
//        obj.addProperty("hostOnly", !domain.startsWith("."));
        long expiry = DateUtils.addDays(Calendar.getInstance().getTime(), 7).getTime() / 1000; // next week, in millis
        obj.addProperty("expirationDate", expiry);
        obj.addProperty("secure", false);
        return obj;
    }

    private static class EditThisCookieDoer extends Doer<String> {

        @Override
        public String doStuff(ChromeDriver driver) {
            String preCookieGet = null, postCookieGet;
            URI url = URI.create("https://httprequestecho.appspot.com/");
            driver.get("chrome-extension://fngmhnnpilhplaeedifhccceomclgfbg/popup.html?url=" + url + "&incognito=false");
            WebElement pasteButton = new WebDriverWait(driver, 3).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("a#pasteButton")));
            pasteButton.click();
            WebElement textArea = new WebDriverWait(driver, 3).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#pasteCookie textarea")));
            String COOKIE_JSON = produceCookieArrayJson(url, "httprequestecho.appspot.com", "/", "SLIM_COOKIE_NAME", "SLIM_COOKIE_VALUE");
            textArea.sendKeys(COOKIE_JSON);
            WebElement importButton = new WebDriverWait(driver, 3).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#submitDiv #submitButton")));
            importButton.click();
            driver.get("https://httprequestecho.appspot.com/get");
            postCookieGet = driver.getPageSource();
            dumpEchoes(preCookieGet, postCookieGet);
            return postCookieGet;
        }

        @Override
        public void prepare(File tmpDir, ChromeOptions options) throws IOException {
            File extensionCrxFile = File.createTempFile("EditThisCookie", ".crx", tmpDir);
            Resources.asByteSource(ChromeDriverExperiments.class.getResource("/EditThisCookie_v1.4.1.crx")).copyTo(com.google.common.io.Files.asByteSink(extensionCrxFile));
            options.addExtensions(extensionCrxFile);
        }
    }

    static class Doer<T> {
        public void prepare(File tmpDir, ChromeOptions options) throws IOException {
        }

        public T doStuff(ChromeDriver driver) throws IOException {
            return null;
        }

        public boolean shouldRemainOpen(T stuff, WebDriver driver) {
            return true;
        }

        public boolean isRetainUserDataDir() {
            return false;
        }
    }

    private static class CustomExtensionDoer extends Doer<Void> {

        @Override
        public void prepare(File tmpDir, ChromeOptions options) throws IOException {
            File extensionCrxFile = File.createTempFile("my-custom-extension", ".crx", tmpDir);
            File srcFile = new File("/tmp/first-chrome-extension.crx");
            com.google.common.io.Files.copy(srcFile, extensionCrxFile);
            options.addExtensions(extensionCrxFile);
        }

        @Override
        public Void doStuff(ChromeDriver driver) throws IOException {
            driver.get("https://www.example.com/");
            return null;
        }
    }

    private static class CookieImplanter extends Doer<Boolean> {

        private static final String SYSPROP_CRX_FILE = "chromeCookieImplant.crx.file";
        private static final String SYSPROP_CRX_SOURCES = "chromeCookieImplant.crx.sourceDirectory";

        private String extensionId;

        private void checkUpToDate(File fileWithRequiredLastModifiedTime, File directoryOfOtherFiles) throws IOException {
            Collection<File> otherFiles = FileUtils.listFiles(directoryOfOtherFiles, null, true);
            checkState(!otherFiles.isEmpty(), "empty: " + directoryOfOtherFiles);
            long maxLastModifiedInOtherFiles = otherFiles.stream().map(File::lastModified)
                    .max(Long::compareTo).orElse(0L);
            if (maxLastModifiedInOtherFiles > fileWithRequiredLastModifiedTime.lastModified()) {
                throw new IOException("one or more files in " + directoryOfOtherFiles + " has a last modified date greater than " + fileWithRequiredLastModifiedTime);
            }
        }

        protected ByteSource resolveCrxSource() throws IOException {
            Optional<ByteSource> crxSource = resolveCrxSourceFromSystemProperty();
            if (crxSource.isPresent()) {
                return crxSource.get();
            }
            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
            new ChromeCookieImplanter().copyCrxTo(baos);
            baos.flush();
            return ByteSource.wrap(baos.toByteArray());
        }

        protected Optional<ByteSource> resolveCrxSourceFromSystemProperty() throws IOException {
            String crxPathname = System.getProperty(SYSPROP_CRX_FILE);
            if (crxPathname == null) {
                return Optional.empty();
            }
            File srcFile = new File(SYSPROP_CRX_FILE);
            if (!srcFile.isFile()) {
                throw new FileNotFoundException(srcFile.getAbsolutePath());
            }
            String srcPathname = System.getProperty(SYSPROP_CRX_SOURCES);
            if (srcPathname != null) {
                checkUpToDate(srcFile, new File(srcPathname));
            }
            return Optional.of(com.google.common.io.Files.asByteSource(srcFile));
        }

        @Override
        public void prepare(File tmpDir, ChromeOptions options) throws IOException {
            File extensionCrxFile = File.createTempFile("chrome-cookie-implant", ".crx", tmpDir);
            ByteSource crxSource = resolveCrxSource();
            crxSource.copyTo(com.google.common.io.Files.asByteSink(extensionCrxFile));
            try (InputStream in = new FileInputStream(extensionCrxFile)) {
                CrxMetadata metadata = CrxParser.getDefault().parseMetadata(in);
                extensionId = metadata.getId();
            }
            options.addExtensions(extensionCrxFile);
        }

        private void provideExtensionAsBase64(ByteSource crxSource, ChromeOptions options) throws IOException {
            String crxBase64 = Base64.getEncoder().encodeToString(crxSource.read());
            options.addEncodedExtensions(crxBase64);
        }

        private void provideExtensionAsLoadExtensionArg(File extensionCrxFile, File tmpDir, ChromeOptions options) throws IOException {
            Path unpackedCrxDir = java.nio.file.Files.createTempDirectory(tmpDir.toPath(), "chrome-cookie-implant");
            try (ZipFile zf = new ZipFile(extensionCrxFile)) {
                Enumeration<? extends ZipEntry> entries = zf.entries();
                while (entries.hasMoreElements()) {
                    ZipEntry entry = entries.nextElement();
                    Path outputFile = unpackedCrxDir.resolve(entry.getName());
                    if (entry.isDirectory()) {
                        outputFile.toFile().mkdirs();
                    } else {
                        com.google.common.io.Files.createParentDirs(outputFile.toFile());
                        try (InputStream input = zf.getInputStream(entry);
                             OutputStream output = new FileOutputStream(outputFile.toFile())) {
                            ByteStreams.copy(input, output);
                        }
                    }
                }
            }
            options.addArguments("--load-extension=" + unpackedCrxDir.toFile().getAbsolutePath());
        }

        private final Random random = new Random();

        private String newRandomCookieValue() {
            byte[] bytes = new byte[64];
            random.nextBytes(bytes);
            String base64 = java.util.Base64.getEncoder().encodeToString(bytes);
            return base64;
        }

        @Override
        public Boolean doStuff(ChromeDriver driver) throws IOException {
            String[] cookieJsons = {
                new Gson().toJson(produceCookieObject(URI.create("https://httprequestecho.appspot.com/"),
                        "httprequestecho.appspot.com",
                        "/",
                        "IMPLANTED_COOKIE",
                        "0123456789")),
                new Gson().toJson(produceCookieObject(URI.create("http://www.example.com/"), "www.example.com", "/", "ad", newRandomCookieValue())),
            };
            ChromeCookieImplanter implanter = new ChromeCookieImplanter();
            ChromeCookie cookie1 = ChromeCookie.builder("https://httprequestecho.appspot.com/")
                    .domain("httprequestecho.appspot.com")
                    .path("/")
                    .name("IMPLANTED_COOKIE")
                    .value("0123456789")
                    .build();
            try {
                List<CookieImplantResult> results = implanter.implant(Collections.singletonList(cookie1), driver);
                results.forEach(System.out::println);
            } catch (org.openqa.selenium.TimeoutException e) {
                System.err.println(e.toString());
            }
            return Boolean.TRUE;
        }

        @Override
        public boolean shouldRemainOpen(Boolean preference, WebDriver driver) {
            return preference;
        }
    }

    private static void dumpEchoes(String preCookieGet, String postCookieGet) {
        System.out.println("pre-cookie implant:");
        System.out.println(preCookieGet);
        System.out.println();
        System.out.println("post-cookie implant:");
        System.out.println(postCookieGet);
        System.out.println();
    }

    private static <T> void main(Doer<T> doer) throws Exception {
        ChromeUnitTests.setupRecommendedChromeDriver();
        File tmpDir = new File(System.getProperty("user.dir"), "target");
        File userDataDir = Files.createTempDirectory(tmpDir.toPath(), "chrome").toFile();
        System.out.format("user data dir: %s%n", userDataDir);
        try {
            ChromeOptions options = new ChromeOptions();
            options.addArguments("user-data-dir=" + userDataDir);
            doer.prepare(tmpDir, options);
            ChromeDriverService service = new ChromeDriverService.Builder()
                    .usingAnyFreePort()
                    .withVerbose(true)
                    .build();
            ChromeDriver driver = new ChromeDriver(service, options);
            try {
                try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
                    T stuff = doer.doStuff(driver);
                    if (doer.shouldRemainOpen(stuff, driver)) {
                        while (true) {
                            System.out.print("URL: ");
                            String line = reader.readLine();
                            if (line == null) {
                                break;
                            }
                            if (!line.isEmpty()) {
                                if ("exit".equalsIgnoreCase(line.trim())) {
                                    break;
                                }
                                driver.get(line.trim());
                            }
                        }
                    }
                }
            } finally {
                driver.quit();
            }

            if (userDataDir.isDirectory()) {
                Collection<File> tmpFiles = FileUtils.listFiles(userDataDir, null, true);
                tmpFiles.forEach(System.out::println);
            } else {
                System.err.format("not a directory: %s%n", userDataDir);
            }
        } finally {
            if (!doer.isRetainUserDataDir()) {
                FileUtils.deleteDirectory(userDataDir);
            }
        }
    }

    public static void main(String[] args) throws Exception {
//        main(new EditThisCookieDoer());
//        main(new Doer());
//        main(new CustomExtensionDoer());
        main(new CookieImplanter());
    }

}


text:
import _defineProperty from "@babel/runtime/helpers/defineProperty";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

import React, { useState } from 'react';
import chunk from 'lodash/chunk';
import { renderWithTheme } from '@looker/components-test-utils';
import { Delete, Link as LinkIcon } from '@styled-icons/material';
import { fireEvent, screen } from '@testing-library/react';
import { IconButton } from '../Button';
import { InputFilters } from '../Form';
import { Link } from '../Link';
import { getTabStops } from '../utils';
import { DataTable, DataTableAction, DataTableCell, DataTableItem } from '.';
export const defaultFilters = [{
  field: 'name',
  label: 'Name',
  options: ['Cheddar', 'Gouda', 'Swiss', 'Mozzarella']
}, {
  field: 'color',
  label: 'Color',
  multiple: true,
  options: ['blue', 'orange', 'yellow', 'white']
}, {
  field: 'origin',
  label: 'Origin',
  multiple: true,
  options: ['France', 'England', 'Italy', 'Netherlands', 'United States']
}];
const columns = [{
  canSort: true,
  hide: true,
  id: 'calories',
  title: 'Calories',
  type: 'number'
}, {
  canSort: true,
  id: 'id',
  title: 'ID',
  type: 'number'
}, {
  id: 'status',
  title: 'Status',
  titleIcon: React.createElement(LinkIcon, null),
  type: 'string'
}, {
  id: 'name',
  size: 'medium',
  title: 'Name',
  type: 'string'
}, {
  id: 'role',
  size: 100,
  title: 'Role',
  type: 'string'
}];
const data = [{
  calories: 101,
  id: 1,
  name: 'Richard Garfield',
  type: 'Game Designer'
}, {
  calories: 102,
  id: 2,
  name: 'John Carmack',
  type: 'Programmer'
}, {
  calories: 103,
  id: 3,
  name: React.createElement("a", {
    href: "https://components.looker.com/",
    target: "_blank",
    rel: "noopener noreferrer"
  }, "Gouda"),
  type: 'semi-hard, artisan, brined, processed'
}, {
  calories: 104,
  id: 4,
  name: React.createElement(Link, {
    href: "https://components.looker.com/",
    target: "_blank",
    rel: "noopener noreferrer"
  }, "American"),
  type: 'semi-soft, processed'
}];
const bestCheeseDiv = React.createElement("div", null, "Pepper Jack");
const items = data.map(({
  calories,
  id,
  name,
  type
}) => {
  const availableActions = React.createElement(React.Fragment, null, React.createElement(DataTableAction, null, "View Profile"));
  return React.createElement(DataTableItem, {
    key: id,
    id: String(id),
    actions: availableActions
  }, React.createElement(DataTableCell, null, calories), React.createElement(DataTableCell, null, id), React.createElement(DataTableCell, null, "Meh."), React.createElement(DataTableCell, null, name), React.createElement(DataTableCell, null, type));
});
const itemsActionPrimary = data.map(({
  calories,
  id,
  name,
  type
}) => {
  const actionPrimary = React.createElement(IconButton, {
    icon: React.createElement(Delete, null),
    label: "Trash It",
    onClick: () => alert('Trash it')
  });
  return React.createElement(DataTableItem, {
    key: id,
    id: String(id),
    actionPrimary: actionPrimary
  }, React.createElement(DataTableCell, null, calories), React.createElement(DataTableCell, null, id), React.createElement(DataTableCell, null, name), React.createElement(DataTableCell, null, type));
});
const itemsActionsPrimaryAction = data.map(({
  calories,
  id,
  name,
  type
}) => {
  const availableActions = React.createElement(React.Fragment, null, React.createElement(DataTableAction, null, "View Profile"), React.createElement(DataTableAction, null, "edit Profile"), React.createElement(DataTableAction, null, "comment Profile"));
  const ActionPrimary = React.createElement(IconButton, {
    icon: React.createElement(Delete, null),
    label: "Trash It",
    onClick: () => alert('Trash it')
  });
  return React.createElement(DataTableItem, {
    key: id,
    id: String(id),
    actions: availableActions,
    actionPrimary: ActionPrimary
  }, React.createElement(DataTableCell, null, calories), React.createElement(DataTableCell, null, id), React.createElement(DataTableCell, null, name), React.createElement(DataTableCell, null, type));
});
const dataTableWithGeneratedHeader = React.createElement(DataTable, {
  caption: "this is a table's caption",
  columns: columns
}, items);
const handleActionClick = jest.fn();
const handleListItemClick = jest.fn();
const clickableItems = data.map(({
  calories,
  id,
  name,
  type
}) => {
  const availableActions = React.createElement(React.Fragment, null, React.createElement(DataTableAction, {
    onClick: handleActionClick
  }, "View Profile"));
  return React.createElement(DataTableItem, {
    id: String(id),
    key: id,
    actions: availableActions,
    actionsTooltip: "My Actions Button",
    onClick: handleListItemClick
  }, React.createElement(DataTableCell, null, calories), React.createElement(DataTableCell, null, id), React.createElement(DataTableCell, null, name), React.createElement(DataTableCell, null, type));
});
const dataTableWithClickableRows = React.createElement(DataTable, {
  caption: "this is a table's caption",
  columns: columns
}, clickableItems);
const onSelect = jest.fn();
const onSelectAll = jest.fn();
const defaultSelectConfig = {
  onSelect,
  onSelectAll,
  pageItems: ['1', '2'],
  selectedItems: []
};
const dataTableWithSelect = React.createElement(DataTable, {
  caption: "this is a table's caption",
  columns: columns,
  select: defaultSelectConfig
}, items);
const dataTableWithSelectedItems = React.createElement(DataTable, {
  caption: "this is a table's caption",
  columns: columns,
  select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
    selectedItems: ['1']
  })
}, items);
describe('DataTable', () => {
  beforeEach(() => {
    jest.useFakeTimers();
  });
  afterEach(() => {
    jest.runOnlyPendingTimers();
    jest.useRealTimers();
    handleActionClick.mockClear();
    handleListItemClick.mockClear();
    onSelect.mockClear();
    onSelectAll.mockClear();
  });
  describe('General Layout', () => {
    test('Renders a generated header and list item', () => {
      renderWithTheme(dataTableWithGeneratedHeader);
      expect(screen.getByText('ID')).toBeInTheDocument();
      expect(screen.getByText('Name')).toBeInTheDocument();
      expect(screen.getByText('Role')).toBeInTheDocument();
      expect(screen.getByText('1')).toBeInTheDocument();
      expect(screen.getByText('Richard Garfield')).toBeInTheDocument();
      expect(screen.getByText('Game Designer')).toBeInTheDocument();
    });
    test('Renders action menu on button click and handles action click', () => {
      renderWithTheme(dataTableWithClickableRows);
      const listItemId = screen.getByText('1');
      fireEvent(listItemId, new MouseEvent('mouseenter', {
        bubbles: true,
        cancelable: true
      }));
      const listItemButton = screen.getAllByText('My Actions Button')[0];
      expect(screen.queryByText('View Profile')).not.toBeInTheDocument();
      fireEvent.click(listItemButton);
      const viewProfileAction = screen.getByText('View Profile');
      expect(viewProfileAction).toBeInTheDocument();
      expect(handleActionClick.mock.calls.length).toBe(0);
      fireEvent.click(viewProfileAction);
      expect(handleActionClick.mock.calls.length).toBe(1);
      expect(screen.queryByText('View Profile')).not.toBeInTheDocument();
    });
    test('Handles item click', () => {
      renderWithTheme(dataTableWithClickableRows);
      const dataTableDataTableCell = screen.getByText('1');
      expect(handleListItemClick).toHaveBeenCalledTimes(0);
      fireEvent.click(dataTableDataTableCell);
      expect(handleListItemClick).toHaveBeenCalledTimes(1);
    });
    test.skip('Item has pointer cursor and shadow when hovering over DataTableItem', () => {});
  });
  describe('Selecting', () => {
    test('Checkbox click calls onSelect', () => {
      renderWithTheme(dataTableWithSelect);
      fireEvent.click(screen.getAllByRole('checkbox')[1]);
      expect(onSelect).toHaveBeenCalled();
    });
    test('Checkbox keyboard entry calls onSelect', () => {
      renderWithTheme(dataTableWithSelect);
      fireEvent.keyDown(screen.getAllByRole('checkbox')[1], {
        code: 'Enter',
        key: 'Enter'
      });
      expect(onSelect).toHaveBeenCalled();
    });
    test('selectedItems determines if a checkbox is checked', () => {
      renderWithTheme(dataTableWithSelectedItems);
      const checkbox = screen.getAllByRole('checkbox')[1];
      expect(checkbox).toBeChecked();
    });
    test('selectedItems not selected if clicked on a anchor', () => {
      renderWithTheme(dataTableWithSelect);
      const Anchor = screen.getByText('Gouda');
      expect(Anchor).toBeInTheDocument();
      fireEvent.click(Anchor);
      const checkbox = screen.getAllByRole('checkbox')[3];
      expect(checkbox).not.toBeChecked();
    });
    test('selectedItems not selected if clicked on a link', () => {
      renderWithTheme(dataTableWithSelect);
      const link = screen.getByText('American');
      expect(link).toBeInTheDocument();
      fireEvent.click(link);
      const checkbox = screen.getAllByRole('checkbox')[4];
      expect(checkbox).not.toBeChecked();
    });
    test('Selection - no pageItems & no selectedItems', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          pageItems: [],
          selectedItems: []
        })
      }, items));
      const checkbox = screen.getAllByRole('checkbox')[0];
      expect(checkbox).not.toBeChecked();
    });
  });
  describe('Selecting All', () => {
    const dataTableWithNoItemsSelected = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: defaultSelectConfig
    }, items);
    const dataTableWithSomeItemsSelected = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
        selectedItems: ['2']
      })
    }, items);
    const dataTableWithAllItemsSelected = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
        selectedItems: ['1', '2']
      })
    }, items);
    afterEach(() => {
      onSelect.mockClear();
      onSelectAll.mockClear();
    });
    test('Renders header checkbox that triggers onSelectAll on click when select prop receives a valid object', () => {
      renderWithTheme(dataTableWithNoItemsSelected);
      const headerCheckbox = screen.getAllByRole('checkbox')[0];
      fireEvent.click(headerCheckbox);
      expect(onSelectAll).toHaveBeenCalledTimes(1);
    });
    test('Header checkbox is unchecked when selectedItems includes no row ids', () => {
      renderWithTheme(dataTableWithNoItemsSelected);
      const headerCheckbox = screen.getAllByRole('checkbox')[0];
      expect(headerCheckbox).not.toBeChecked();
    });
    test('Header checkbox is mixed when selectedItems includes some row ids', () => {
      renderWithTheme(dataTableWithSomeItemsSelected);
      screen.getByTitle('Check Mark Mixed');
    });
    test('Header checkbox is mixed when selectedItems includes all row ids', () => {
      renderWithTheme(dataTableWithAllItemsSelected);
      const headerCheckbox = screen.getAllByRole('checkbox')[0];
      expect(headerCheckbox).toBeChecked();
    });
  });
  describe('Control Bar', () => {
    const onBulkActionClick = jest.fn();
    const onTotalClearAll = jest.fn();
    const onTotalSelectAll = jest.fn();
    afterEach(() => {
      onBulkActionClick.mockClear();
      onTotalClearAll.mockClear();
      onTotalSelectAll.mockClear();
    });
    const bulk = {
      actions: React.createElement(DataTableAction, {
        onClick: onBulkActionClick
      }, "My Bulk Action"),
      onTotalClearAll,
      onTotalSelectAll,
      pageCount: 2,
      totalCount: 4
    };
    test('Control bar is visible when bulk prop is provided and selectedItems prop has length > 0', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['1']
        })
      }, items));
      screen.getByText('Bulk Actions');
      screen.getByText('1 of 2 displayed items selected');
      screen.getByText('Select all 4 results');
    });
    test('Control bar is not visible when bulk prop is not provided', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['1']
        })
      }, items));
      expect(screen.queryByText('Bulk Actions')).not.toBeInTheDocument();
    });
    test('Control bar is not visible when selectedItems.length < 0', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: []
        })
      }, items));
      expect(screen.queryByText('Bulk Actions')).not.toBeInTheDocument();
    });
    test('Control bar message reflects when all items are selected', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['0', '1']
        })
      }, items));
      expect(screen.getByText('All 2 displayed items selected')).toBeInTheDocument();
    });
    test('Clicking the "Bulk Actions" button reveals elements passed via bulk prop', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['1']
        })
      }, items));
      expect(screen.queryByText('My Bulk Action')).not.toBeInTheDocument();
      fireEvent.click(screen.getByText('Bulk Actions'));
      const bulkAction = screen.getByText('My Bulk Action');
      expect(onBulkActionClick).toHaveBeenCalledTimes(0);
      fireEvent.click(bulkAction);
      expect(onBulkActionClick).toHaveBeenCalledTimes(1);
      expect(screen.queryByText('My Bulk Action')).not.toBeInTheDocument();
    });
    test('Pressing "Select all X Results" button triggers onTotalSelectAll', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['1']
        })
      }, items));
      expect(onTotalSelectAll).toHaveBeenCalledTimes(0);
      fireEvent.click(screen.getByText('Select all 4 results'));
      expect(onTotalSelectAll).toHaveBeenCalledTimes(1);
    });
    test('Pressing "Clear Selection" button triggers onTotalClearAll', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        bulk: bulk,
        select: _objectSpread(_objectSpread({}, defaultSelectConfig), {}, {
          selectedItems: ['1', '2', '3', '4']
        })
      }, items));
      expect(onTotalClearAll).toHaveBeenCalledTimes(0);
      fireEvent.click(screen.getByText('Clear Selection'));
      expect(onTotalClearAll).toHaveBeenCalledTimes(1);
    });
  });
  describe('Actions', () => {
    const dataTableWithActions = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: defaultSelectConfig
    }, items);
    const dataTableWithPrimaryAction = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: defaultSelectConfig
    }, itemsActionPrimary);
    const dataTableWithActionPrimaryAction = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      select: defaultSelectConfig
    }, itemsActionsPrimaryAction);
    test('Displays Icon for Actions and PrimaryAction', () => {
      renderWithTheme(dataTableWithActionPrimaryAction);
      expect(screen.getAllByText('Trash It')[0]).toBeInTheDocument();
      expect(screen.getAllByText('Trash It')[0].closest('button')).toBeInTheDocument();
      expect(screen.getAllByText('Options')[0]).toBeInTheDocument();
      expect(screen.getAllByText('Options')[0].closest('button')).toBeInTheDocument();
    });
    test('Displays Icon for Actions', () => {
      renderWithTheme(dataTableWithActions);
      expect(screen.getAllByText('Options')[0]).toBeInTheDocument();
      expect(screen.getAllByText('Options')[0].closest('button')).toBeInTheDocument();
    });
    test('Displays Icon for PrimaryAction', () => {
      renderWithTheme(dataTableWithPrimaryAction);
      expect(screen.getAllByText('Trash It')[0]).toBeInTheDocument();
      expect(screen.getAllByText('Trash It')[0].closest('button')).toBeInTheDocument();
    });
  });
  describe('Accessibility', () => {
    const columns = [{
      id: 'calories',
      title: 'Calories',
      type: 'number'
    }, {
      canSort: true,
      id: 'id',
      title: 'ID',
      type: 'number'
    }, {
      canSort: true,
      id: 'name',
      sortDirection: 'asc',
      title: 'Name',
      type: 'string'
    }, {
      canSort: true,
      id: 'role',
      sortDirection: 'desc',
      title: 'Role',
      type: 'string'
    }];
    test('Table has aria-label', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        select: defaultSelectConfig
      }, items));
      expect(screen.getByRole('table')).toHaveAttribute('aria-label', "this is a table's caption");
    });
    test('Table has role=rowheader for first column elements', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        select: defaultSelectConfig
      }, items));
      const calories1 = screen.getByText('101');
      const id1 = screen.getByText('1');
      const calories2 = screen.getByText('102');
      const id2 = screen.getByText('2');
      expect(calories1).toHaveAttribute('role', 'rowheader');
      expect(id1).not.toHaveAttribute('role', 'rowheader');
      expect(calories2).toHaveAttribute('role', 'rowheader');
      expect(id2).not.toHaveAttribute('role', 'rowheader');
    });
    test('Table has aria-sort', () => {
      renderWithTheme(React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        select: defaultSelectConfig
      }, items));
      const idTH = screen.getByText('ID').closest('th');
      const nameTH = screen.getByText('Name').closest('th');
      const roleTH = screen.getByText('Role').closest('th');
      expect(idTH).toHaveAttribute('aria-sort', 'none');
      expect(nameTH).toHaveAttribute('aria-sort', 'ascending');
      expect(roleTH).toHaveAttribute('aria-sort', 'descending');
    });
  });
  describe('Sorting', () => {
    const onSort = jest.fn();
    const dataTableWithSort = React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      onSort: onSort
    }, items);
    afterEach(() => {
      onSort.mockClear();
    });
    test('Calls onSort if canSort property is true', () => {
      renderWithTheme(dataTableWithSort);
      const idColumnHeader = screen.getByText('ID');
      fireEvent.click(idColumnHeader);
      expect(onSort.mock.calls.length).toBe(1);
    });
    test('Does not call onSort if canSort property is false', () => {
      renderWithTheme(dataTableWithSort);
      const nameColumnHeader = screen.getByText('Name');
      fireEvent.click(nameColumnHeader);
      expect(onSort.mock.calls.length).toBe(0);
    });
    test('Clicking first column calls onSort with correct columnID', () => {
      renderWithTheme(dataTableWithSort);
      fireEvent.click(screen.getByText('ID'));
      expect(onSort).toBeCalledWith('id', 'asc');
    });
  });
  test('Does not render children if state="loading"', () => {
    renderWithTheme(React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: [],
      state: "loading"
    }, bestCheeseDiv));
    expect(screen.queryByText('Pepper Jack')).not.toBeInTheDocument();
  });
  test('Does not render children if state="noResults"', () => {
    renderWithTheme(React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: [],
      state: "noResults"
    }, bestCheeseDiv));
    expect(screen.queryByText('Pepper Jack')).not.toBeInTheDocument();
  });
  test('Renders custom no results message when noResultsDisplay prop has a value', () => {
    renderWithTheme(React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: [],
      state: "noResults",
      noResultsDisplay: 'Cheddar'
    }, bestCheeseDiv));
    expect(screen.getByText('Cheddar')).toBeInTheDocument();
  });
  test('default columnsVisible', () => {
    renderWithTheme(React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: [{
        hide: false,
        id: 'blah',
        title: 'blah'
      }]
    }, React.createElement("tr", null, React.createElement("td", null, "Hello world"))));
    expect(screen.getByText('blah')).toBeInTheDocument();
  });
  test('Hides column is hide prop is true', () => {
    renderWithTheme(dataTableWithGeneratedHeader);
    expect(screen.queryByText('Calories')).not.toBeInTheDocument();
  });
  test('firstColumnStuck renders', () => {
    renderWithTheme(React.createElement(DataTable, {
      caption: "this is a table's caption",
      columns: columns,
      firstColumnStuck: true
    }, items));
    const secondColumn = screen.getByText('2');
    expect(secondColumn).not.toHaveStyle('position: sticky;');
  });
  test('filters renders', () => {
    const FilterDataTable = () => {
      const [listFilters, setListFilters] = useState(defaultFilters);
      return React.createElement(DataTable, {
        caption: "this is a table's caption",
        columns: columns,
        filters: React.createElement(InputFilters, {
          filters: listFilters,
          onChange: f => setListFilters(f)
        })
      }, items);
    };

    renderWithTheme(React.createElement(FilterDataTable, null));
    expect(screen.getByText('Filter List')).toBeInTheDocument();
  });
  describe('Keyboard Navigation', () => {
    const renderAndSelectCells = () => {
      renderWithTheme(dataTableWithGeneratedHeader);
      const columns = Object.keys(data[0]).length + 1;
      const tableCells = chunk(screen.getAllByRole('cell'), columns);
      const headerCells = screen.getAllByRole('columnheader');
      return {
        headerCells,
        tableCells
      };
    };

    test('Down arrow jumps to the next row', () => {
      const {
        tableCells
      } = renderAndSelectCells();
      const startingCell = tableCells[0][1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowDown',
        key: 'ArrowDown'
      });
      expect(tableCells[1][1]).toHaveFocus();
    });
    test('Right arrow jumps to the next column', () => {
      const {
        tableCells
      } = renderAndSelectCells();
      const startingCell = tableCells[0][1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowRight',
        key: 'ArrowRight'
      });
      expect(tableCells[0][2]).toHaveFocus();
    });
    test('Up arrow jumps to the previous column', () => {
      const {
        tableCells
      } = renderAndSelectCells();
      const startingCell = tableCells[1][1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowUp',
        key: 'ArrowUp'
      });
      expect(tableCells[0][1]).toHaveFocus();
    });
    test('Left arrow jumps to the previous column', () => {
      const {
        tableCells
      } = renderAndSelectCells();
      const startingCell = tableCells[0][2];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowLeft',
        key: 'ArrowLeft'
      });
      expect(tableCells[0][1]).toHaveFocus();
    });
    test('Navigates between checkboxes', () => {
      renderWithTheme(dataTableWithSelect);
      const checkboxes = screen.getAllByRole('checkbox');
      checkboxes[0].focus();
      fireEvent.keyDown(checkboxes[0], {
        code: 'ArrowDown',
        key: 'ArrowDown'
      });
      expect(checkboxes[1]).toHaveFocus();
    });
    test('Navigates from thead to tbody', () => {
      const {
        tableCells,
        headerCells
      } = renderAndSelectCells();
      const startingCell = headerCells[1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowDown',
        key: 'ArrowDown'
      });
      expect(tableCells[0][1]).toHaveFocus();
    });
    test('Navigates from tbody to thead', () => {
      const {
        tableCells,
        headerCells
      } = renderAndSelectCells();
      const startingCell = tableCells[0][1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowUp',
        key: 'ArrowUp'
      });
      expect(headerCells[1]).toHaveFocus();
    });
    test('Will not navigate up from the thead row', () => {
      const {
        headerCells
      } = renderAndSelectCells();
      const startingCell = headerCells[0];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowUp',
        key: 'ArrowUp'
      });
      expect(startingCell).toHaveFocus();
    });
    test('Will not navigate down from the last row', () => {
      const {
        tableCells
      } = renderAndSelectCells();
      const startingCell = tableCells[tableCells.length - 1][1];
      startingCell.focus();
      fireEvent.keyDown(startingCell, {
        code: 'ArrowDown',
        key: 'ArrowDown'
      });
      expect(startingCell).toHaveFocus();
    });
    test('Tabbing from outside selects the first thead cell ', () => {
      const {
        headerCells
      } = renderAndSelectCells();
      const tabStops = getTabStops(document.body);
      tabStops[0].focus();
      fireEvent.keyDown(tabStops[0], {
        code: 'Tab',
        key: 'Tab'
      });
      expect(headerCells[0]).toHaveFocus();
    });
  });
});
//# sourceMappingURL=DataTable.spec.js.map

redpajama_set_name: RedPajamaGithub


text:
'use strict';

const chalk = require('chalk');
const path = require('path');
const Task = require('../models/task');
const Watcher = require('../models/watcher');
const Builder = require('../models/builder');
const pDefer = require('p-defer');

class BuildWatchTask extends Task {
  constructor(options) {
    super(options);

    this._builder = null;
    this._runDeferred = null;
  }

  async run(options) {
    let { ui } = this;

    ui.startProgress(chalk.green('Building'), chalk.green('.'));

    this._runDeferred = pDefer();

    let builder = (this._builder =
      options._builder ||
      new Builder({
        ui,
        outputPath: options.outputPath,
        environment: options.environment,
        project: this.project,
      }));

    ui.writeLine(`Environment: ${options.environment}`);

    let watcher =
      options._watcher ||
      new Watcher({
        ui,
        builder,
        analytics: this.analytics,
        options,
        ignored: [path.resolve(this.project.root, options.outputPath)],
      });

    await watcher;
    // Run until failure or signal to exit
    return this._runDeferred.promise;
  }

  /**
   * Exit silently
   *
   * @private
   * @method onInterrupt
   */
  async onInterrupt() {
    await this._builder.cleanup();
    this._runDeferred.resolve();
  }
}

module.exports = BuildWatchTask;


text:
<?php
/**
 * Auto generated from descriptor.proto at 2019-01-07 11:34:00
 *
 * google.protobuf package
 */

namespace Google\Protobuf {
/**
 * FileOptions message
 */
class FileOptions extends \ProtobufMessage
{
    /* Field index constants */
    const JAVA_PACKAGE = 1;
    const JAVA_OUTER_CLASSNAME = 8;
    const JAVA_MULTIPLE_FILES = 10;
    const JAVA_GENERATE_EQUALS_AND_HASH = 20;
    const JAVA_STRING_CHECK_UTF8 = 27;
    const OPTIMIZE_FOR = 9;
    const GO_PACKAGE = 11;
    const CC_GENERIC_SERVICES = 16;
    const JAVA_GENERIC_SERVICES = 17;
    const PY_GENERIC_SERVICES = 18;
    const PHP_GENERIC_SERVICES = 42;
    const DEPRECATED = 23;
    const CC_ENABLE_ARENAS = 31;
    const OBJC_CLASS_PREFIX = 36;
    const CSHARP_NAMESPACE = 37;
    const SWIFT_PREFIX = 39;
    const PHP_CLASS_PREFIX = 40;
    const PHP_NAMESPACE = 41;
    const PHP_METADATA_NAMESPACE = 44;
    const RUBY_PACKAGE = 45;
    const UNINTERPRETED_OPTION = 999;

    /* @var array Field descriptors */
    protected static $fields = array(
        self::JAVA_PACKAGE => array(
            'name' => 'java_package',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::JAVA_OUTER_CLASSNAME => array(
            'name' => 'java_outer_classname',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::JAVA_MULTIPLE_FILES => array(
            'default' => false,
            'name' => 'java_multiple_files',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::JAVA_GENERATE_EQUALS_AND_HASH => array(
            'name' => 'java_generate_equals_and_hash',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::JAVA_STRING_CHECK_UTF8 => array(
            'default' => false,
            'name' => 'java_string_check_utf8',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::OPTIMIZE_FOR => array(
            'default' => \Google\Protobuf\FileOptions_OptimizeMode::SPEED,
            'name' => 'optimize_for',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_INT,
        ),
        self::GO_PACKAGE => array(
            'name' => 'go_package',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::CC_GENERIC_SERVICES => array(
            'default' => false,
            'name' => 'cc_generic_services',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::JAVA_GENERIC_SERVICES => array(
            'default' => false,
            'name' => 'java_generic_services',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::PY_GENERIC_SERVICES => array(
            'default' => false,
            'name' => 'py_generic_services',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::PHP_GENERIC_SERVICES => array(
            'default' => false,
            'name' => 'php_generic_services',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::DEPRECATED => array(
            'default' => false,
            'name' => 'deprecated',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::CC_ENABLE_ARENAS => array(
            'default' => false,
            'name' => 'cc_enable_arenas',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_BOOL,
        ),
        self::OBJC_CLASS_PREFIX => array(
            'name' => 'objc_class_prefix',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::CSHARP_NAMESPACE => array(
            'name' => 'csharp_namespace',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::SWIFT_PREFIX => array(
            'name' => 'swift_prefix',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::PHP_CLASS_PREFIX => array(
            'name' => 'php_class_prefix',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::PHP_NAMESPACE => array(
            'name' => 'php_namespace',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::PHP_METADATA_NAMESPACE => array(
            'name' => 'php_metadata_namespace',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::RUBY_PACKAGE => array(
            'name' => 'ruby_package',
            'required' => false,
            'type' => \ProtobufMessage::PB_TYPE_STRING,
        ),
        self::UNINTERPRETED_OPTION => array(
            'name' => 'uninterpreted_option',
            'repeated' => true,
            'type' => '\Google\Protobuf\UninterpretedOption'
        ),
    );

    /**
     * Constructs new message container and clears its internal state
     */
    public function __construct()
    {
        $this->reset();
    }

    /**
     * Clears message values and sets default ones
     *
     * @return null
     */
    public function reset()
    {
        $this->values[self::JAVA_PACKAGE] = null;
        $this->values[self::JAVA_OUTER_CLASSNAME] = null;
        $this->values[self::JAVA_MULTIPLE_FILES] = self::$fields[self::JAVA_MULTIPLE_FILES]['default'];
        $this->values[self::JAVA_GENERATE_EQUALS_AND_HASH] = null;
        $this->values[self::JAVA_STRING_CHECK_UTF8] = self::$fields[self::JAVA_STRING_CHECK_UTF8]['default'];
        $this->values[self::OPTIMIZE_FOR] = self::$fields[self::OPTIMIZE_FOR]['default'];
        $this->values[self::GO_PACKAGE] = null;
        $this->values[self::CC_GENERIC_SERVICES] = self::$fields[self::CC_GENERIC_SERVICES]['default'];
        $this->values[self::JAVA_GENERIC_SERVICES] = self::$fields[self::JAVA_GENERIC_SERVICES]['default'];
        $this->values[self::PY_GENERIC_SERVICES] = self::$fields[self::PY_GENERIC_SERVICES]['default'];
        $this->values[self::PHP_GENERIC_SERVICES] = self::$fields[self::PHP_GENERIC_SERVICES]['default'];
        $this->values[self::DEPRECATED] = self::$fields[self::DEPRECATED]['default'];
        $this->values[self::CC_ENABLE_ARENAS] = self::$fields[self::CC_ENABLE_ARENAS]['default'];
        $this->values[self::OBJC_CLASS_PREFIX] = null;
        $this->values[self::CSHARP_NAMESPACE] = null;
        $this->values[self::SWIFT_PREFIX] = null;
        $this->values[self::PHP_CLASS_PREFIX] = null;
        $this->values[self::PHP_NAMESPACE] = null;
        $this->values[self::PHP_METADATA_NAMESPACE] = null;
        $this->values[self::RUBY_PACKAGE] = null;
        $this->values[self::UNINTERPRETED_OPTION] = array();
    }

    /**
     * Returns field descriptors
     *
     * @return array
     */
    public function fields()
    {
        return self::$fields;
    }

    /**
     * Sets value of 'java_package' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setJavaPackage($value)
    {
        return $this->set(self::JAVA_PACKAGE, $value);
    }

    /**
     * Returns value of 'java_package' property
     *
     * @return string
     */
    public function getJavaPackage()
    {
        $value = $this->get(self::JAVA_PACKAGE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'java_package' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaPackage()
    {
        return $this->get(self::JAVA_PACKAGE) !== null;
    }

    /**
     * Sets value of 'java_outer_classname' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setJavaOuterClassname($value)
    {
        return $this->set(self::JAVA_OUTER_CLASSNAME, $value);
    }

    /**
     * Returns value of 'java_outer_classname' property
     *
     * @return string
     */
    public function getJavaOuterClassname()
    {
        $value = $this->get(self::JAVA_OUTER_CLASSNAME);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'java_outer_classname' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaOuterClassname()
    {
        return $this->get(self::JAVA_OUTER_CLASSNAME) !== null;
    }

    /**
     * Sets value of 'java_multiple_files' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setJavaMultipleFiles($value)
    {
        return $this->set(self::JAVA_MULTIPLE_FILES, $value);
    }

    /**
     * Returns value of 'java_multiple_files' property
     *
     * @return boolean
     */
    public function getJavaMultipleFiles()
    {
        $value = $this->get(self::JAVA_MULTIPLE_FILES);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'java_multiple_files' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaMultipleFiles()
    {
        return $this->get(self::JAVA_MULTIPLE_FILES) !== null;
    }

    /**
     * Sets value of 'java_generate_equals_and_hash' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setJavaGenerateEqualsAndHash($value)
    {
        return $this->set(self::JAVA_GENERATE_EQUALS_AND_HASH, $value);
    }

    /**
     * Returns value of 'java_generate_equals_and_hash' property
     *
     * @return boolean
     */
    public function getJavaGenerateEqualsAndHash()
    {
        $value = $this->get(self::JAVA_GENERATE_EQUALS_AND_HASH);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'java_generate_equals_and_hash' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaGenerateEqualsAndHash()
    {
        return $this->get(self::JAVA_GENERATE_EQUALS_AND_HASH) !== null;
    }

    /**
     * Sets value of 'java_string_check_utf8' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setJavaStringCheckUtf8($value)
    {
        return $this->set(self::JAVA_STRING_CHECK_UTF8, $value);
    }

    /**
     * Returns value of 'java_string_check_utf8' property
     *
     * @return boolean
     */
    public function getJavaStringCheckUtf8()
    {
        $value = $this->get(self::JAVA_STRING_CHECK_UTF8);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'java_string_check_utf8' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaStringCheckUtf8()
    {
        return $this->get(self::JAVA_STRING_CHECK_UTF8) !== null;
    }

    /**
     * Sets value of 'optimize_for' property
     *
     * @param integer $value Property value
     *
     * @return null
     */
    public function setOptimizeFor($value)
    {
        return $this->set(self::OPTIMIZE_FOR, $value);
    }

    /**
     * Returns value of 'optimize_for' property
     *
     * @return integer
     */
    public function getOptimizeFor()
    {
        $value = $this->get(self::OPTIMIZE_FOR);
        return $value === null ? (integer)$value : $value;
    }

    /**
     * Returns true if 'optimize_for' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasOptimizeFor()
    {
        return $this->get(self::OPTIMIZE_FOR) !== null;
    }

    /**
     * Sets value of 'go_package' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setGoPackage($value)
    {
        return $this->set(self::GO_PACKAGE, $value);
    }

    /**
     * Returns value of 'go_package' property
     *
     * @return string
     */
    public function getGoPackage()
    {
        $value = $this->get(self::GO_PACKAGE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'go_package' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasGoPackage()
    {
        return $this->get(self::GO_PACKAGE) !== null;
    }

    /**
     * Sets value of 'cc_generic_services' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setCcGenericServices($value)
    {
        return $this->set(self::CC_GENERIC_SERVICES, $value);
    }

    /**
     * Returns value of 'cc_generic_services' property
     *
     * @return boolean
     */
    public function getCcGenericServices()
    {
        $value = $this->get(self::CC_GENERIC_SERVICES);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'cc_generic_services' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasCcGenericServices()
    {
        return $this->get(self::CC_GENERIC_SERVICES) !== null;
    }

    /**
     * Sets value of 'java_generic_services' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setJavaGenericServices($value)
    {
        return $this->set(self::JAVA_GENERIC_SERVICES, $value);
    }

    /**
     * Returns value of 'java_generic_services' property
     *
     * @return boolean
     */
    public function getJavaGenericServices()
    {
        $value = $this->get(self::JAVA_GENERIC_SERVICES);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'java_generic_services' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasJavaGenericServices()
    {
        return $this->get(self::JAVA_GENERIC_SERVICES) !== null;
    }

    /**
     * Sets value of 'py_generic_services' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setPyGenericServices($value)
    {
        return $this->set(self::PY_GENERIC_SERVICES, $value);
    }

    /**
     * Returns value of 'py_generic_services' property
     *
     * @return boolean
     */
    public function getPyGenericServices()
    {
        $value = $this->get(self::PY_GENERIC_SERVICES);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'py_generic_services' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasPyGenericServices()
    {
        return $this->get(self::PY_GENERIC_SERVICES) !== null;
    }

    /**
     * Sets value of 'php_generic_services' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setPhpGenericServices($value)
    {
        return $this->set(self::PHP_GENERIC_SERVICES, $value);
    }

    /**
     * Returns value of 'php_generic_services' property
     *
     * @return boolean
     */
    public function getPhpGenericServices()
    {
        $value = $this->get(self::PHP_GENERIC_SERVICES);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'php_generic_services' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasPhpGenericServices()
    {
        return $this->get(self::PHP_GENERIC_SERVICES) !== null;
    }

    /**
     * Sets value of 'deprecated' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setDeprecated($value)
    {
        return $this->set(self::DEPRECATED, $value);
    }

    /**
     * Returns value of 'deprecated' property
     *
     * @return boolean
     */
    public function getDeprecated()
    {
        $value = $this->get(self::DEPRECATED);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'deprecated' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasDeprecated()
    {
        return $this->get(self::DEPRECATED) !== null;
    }

    /**
     * Sets value of 'cc_enable_arenas' property
     *
     * @param boolean $value Property value
     *
     * @return null
     */
    public function setCcEnableArenas($value)
    {
        return $this->set(self::CC_ENABLE_ARENAS, $value);
    }

    /**
     * Returns value of 'cc_enable_arenas' property
     *
     * @return boolean
     */
    public function getCcEnableArenas()
    {
        $value = $this->get(self::CC_ENABLE_ARENAS);
        return $value === null ? (boolean)$value : $value;
    }

    /**
     * Returns true if 'cc_enable_arenas' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasCcEnableArenas()
    {
        return $this->get(self::CC_ENABLE_ARENAS) !== null;
    }

    /**
     * Sets value of 'objc_class_prefix' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setObjcClassPrefix($value)
    {
        return $this->set(self::OBJC_CLASS_PREFIX, $value);
    }

    /**
     * Returns value of 'objc_class_prefix' property
     *
     * @return string
     */
    public function getObjcClassPrefix()
    {
        $value = $this->get(self::OBJC_CLASS_PREFIX);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'objc_class_prefix' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasObjcClassPrefix()
    {
        return $this->get(self::OBJC_CLASS_PREFIX) !== null;
    }

    /**
     * Sets value of 'csharp_namespace' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setCsharpNamespace($value)
    {
        return $this->set(self::CSHARP_NAMESPACE, $value);
    }

    /**
     * Returns value of 'csharp_namespace' property
     *
     * @return string
     */
    public function getCsharpNamespace()
    {
        $value = $this->get(self::CSHARP_NAMESPACE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'csharp_namespace' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasCsharpNamespace()
    {
        return $this->get(self::CSHARP_NAMESPACE) !== null;
    }

    /**
     * Sets value of 'swift_prefix' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setSwiftPrefix($value)
    {
        return $this->set(self::SWIFT_PREFIX, $value);
    }

    /**
     * Returns value of 'swift_prefix' property
     *
     * @return string
     */
    public function getSwiftPrefix()
    {
        $value = $this->get(self::SWIFT_PREFIX);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'swift_prefix' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasSwiftPrefix()
    {
        return $this->get(self::SWIFT_PREFIX) !== null;
    }

    /**
     * Sets value of 'php_class_prefix' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setPhpClassPrefix($value)
    {
        return $this->set(self::PHP_CLASS_PREFIX, $value);
    }

    /**
     * Returns value of 'php_class_prefix' property
     *
     * @return string
     */
    public function getPhpClassPrefix()
    {
        $value = $this->get(self::PHP_CLASS_PREFIX);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'php_class_prefix' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasPhpClassPrefix()
    {
        return $this->get(self::PHP_CLASS_PREFIX) !== null;
    }

    /**
     * Sets value of 'php_namespace' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setPhpNamespace($value)
    {
        return $this->set(self::PHP_NAMESPACE, $value);
    }

    /**
     * Returns value of 'php_namespace' property
     *
     * @return string
     */
    public function getPhpNamespace()
    {
        $value = $this->get(self::PHP_NAMESPACE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'php_namespace' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasPhpNamespace()
    {
        return $this->get(self::PHP_NAMESPACE) !== null;
    }

    /**
     * Sets value of 'php_metadata_namespace' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setPhpMetadataNamespace($value)
    {
        return $this->set(self::PHP_METADATA_NAMESPACE, $value);
    }

    /**
     * Returns value of 'php_metadata_namespace' property
     *
     * @return string
     */
    public function getPhpMetadataNamespace()
    {
        $value = $this->get(self::PHP_METADATA_NAMESPACE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'php_metadata_namespace' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasPhpMetadataNamespace()
    {
        return $this->get(self::PHP_METADATA_NAMESPACE) !== null;
    }

    /**
     * Sets value of 'ruby_package' property
     *
     * @param string $value Property value
     *
     * @return null
     */
    public function setRubyPackage($value)
    {
        return $this->set(self::RUBY_PACKAGE, $value);
    }

    /**
     * Returns value of 'ruby_package' property
     *
     * @return string
     */
    public function getRubyPackage()
    {
        $value = $this->get(self::RUBY_PACKAGE);
        return $value === null ? (string)$value : $value;
    }

    /**
     * Returns true if 'ruby_package' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasRubyPackage()
    {
        return $this->get(self::RUBY_PACKAGE) !== null;
    }

    /**
     * Appends value to 'uninterpreted_option' list
     *
     * @param \Google\Protobuf\UninterpretedOption $value Value to append
     *
     * @return null
     */
    public function appendUninterpretedOption(\Google\Protobuf\UninterpretedOption $value)
    {
        return $this->append(self::UNINTERPRETED_OPTION, $value);
    }

    /**
     * Clears 'uninterpreted_option' list
     *
     * @return null
     */
    public function clearUninterpretedOption()
    {
        return $this->clear(self::UNINTERPRETED_OPTION);
    }

    /**
     * Returns 'uninterpreted_option' list
     *
     * @return \Google\Protobuf\UninterpretedOption[]
     */
    public function getUninterpretedOption()
    {
        return $this->get(self::UNINTERPRETED_OPTION);
    }

    /**
     * Returns true if 'uninterpreted_option' property is set, false otherwise
     *
     * @return boolean
     */
    public function hasUninterpretedOption()
    {
        return count($this->get(self::UNINTERPRETED_OPTION)) !== 0;
    }

    /**
     * Returns 'uninterpreted_option' iterator
     *
     * @return \ArrayIterator
     */
    public function getUninterpretedOptionIterator()
    {
        return new \ArrayIterator($this->get(self::UNINTERPRETED_OPTION));
    }

    /**
     * Returns element from 'uninterpreted_option' list at given offset
     *
     * @param int $offset Position in list
     *
     * @return \Google\Protobuf\UninterpretedOption
     */
    public function getUninterpretedOptionAt($offset)
    {
        return $this->get(self::UNINTERPRETED_OPTION, $offset);
    }

    /**
     * Returns count of 'uninterpreted_option' list
     *
     * @return int
     */
    public function getUninterpretedOptionCount()
    {
        return $this->count(self::UNINTERPRETED_OPTION);
    }
}
}


text:
import requests
from time import time
from ..config import config

APIKEY=config["API_KEY"]
s = requests.get("https://api.wmata.com/Incidents.svc/json/Incidents?api_key={}".format(APIKEY))
open("rail_incidents/{}".format(time()), "w").write(s.text)

t = requests.get("https://api.wmata.com/Incidents.svc/json/ElevatorIncidents?api_key={}".format(APIKEY))
open("rail_outages/{}".format(time()), "w").write(t.text)

u = requests.get("https://api.wmata.com/Incidents.svc/json/BusIncidents?api_key={}".format(APIKEY))
open("bus_incidents/{}".format(time()), "w").write(u.text)


text:
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db
/* eslint-disable no-console */

const fs = require('fs')
const path = require('path')
const electron_notarize = require('electron-notarize')

module.exports = async function afterSignHook(params) {
  // Only notarize the app on Mac OS only.
  if (process.platform !== 'darwin') {
    return
  }
  console.log('afterSign hook triggered', params)

  // Same appId in electron-builder.
  const appBundleId = 'org.develar.Zap'

  const appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`)
  if (!fs.existsSync(appPath)) {
    throw new Error(`Cannot find application at: ${appPath}`)
  }

  console.log(`Notarizing ${appBundleId} found at ${appPath}`)

  try {
    await electron_notarize.notarize({
      appBundleId,
      appPath,
      appleId: process.env.APPLE_ID,
      appleIdPassword: process.env.APPLE_ID_PASSWORD,
      ascProvider: process.env.APPLE_ID_TEAMID,
    })
  } catch (error) {
    console.error(error)
  }

  console.log(`Done notarizing ${appBundleId}`)
}


text:
package org.kuali.kra.iacuc.procedures;

import org.kuali.kra.bo.KraPersistableBusinessObjectBase;

public class IacucProcedureCategory extends KraPersistableBusinessObjectBase {

    private static final long serialVersionUID = 1L;

    private Integer procedureCategoryCode;
    private String procedureCategory;
    private boolean active;

    public IacucProcedureCategory() {

    }

    public Integer getProcedureCategoryCode() {
        return procedureCategoryCode;
    }

    public void setProcedureCategoryCode(Integer procedureCategoryCode) {
        this.procedureCategoryCode = procedureCategoryCode;
    }

    public String getProcedureCategory() {
        return procedureCategory;
    }

    public void setProcedureCategory(String procedureCategory) {
        this.procedureCategory = procedureCategory;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    /**  {@inheritDoc} */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((this.procedureCategoryCode == null) ? 0 : this.procedureCategoryCode.hashCode());
        result = prime * result + ((this.procedureCategory == null) ? 0 : this.procedureCategory.hashCode());
        return result;
    }

    /**  {@inheritDoc} */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (this.getClass() != obj.getClass()) {
            return false;
        }
        IacucProcedureCategory other = (IacucProcedureCategory) obj;
        if (this.procedureCategoryCode == null) {
            if (other.procedureCategoryCode != null) {
                return false;
            }
        } else if (!this.procedureCategoryCode.equals(other.procedureCategoryCode)) {
            return false;
        }
        if (this.procedureCategory == null) {
            if (other.procedureCategory != null) {
                return false;
            }
        } else if (!this.procedureCategory.equals(other.procedureCategory)) {
            return false;
        }
        return true;
    }

}


text:
package com.lihongjie.spring.security.docs.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class SpringSecurityDocsController {

	@RequestMapping(value = "/docs/spring-security/4.1.2.RELEASE/reference/html/", method = RequestMethod.GET)
	public String doc412RELEASE() {

		return "4.1.2.RELEASE";

	}

}


text: search_result['1750']=["topic_0000000000000442.html","tlece_QuestionVideo.CreatedUtc Property",""];


text:
This repo contains all the examples and slides I used to teach the JS101 class
with Tech Talent South from November 3rd, 2015 to January 12th, 2016. Each week
has its own folder, with more details about what we covered.


text:
Please be sure to read the contribution guidelines before making or requesting a change.

## Filing Issues

Before filing an issue, please be sure to read the guidelines for what you're reporting:

* [Bug Report](http://eslint.org/docs/developer-guide/contributing/reporting-bugs)
* [Propose a New Rule](http://eslint.org/docs/developer-guide/contributing/new-rules)
* [Request a Change](http://eslint.org/docs/developer-guide/contributing/changes)

## Contributing Code

Please sign our [Contributor License Agreement](http://eslint.org/cla) and read over the [Pull Request Guidelines](http://eslint.org/docs/developer-guide/contributing/pull-requests).

## Full Documentation

Our full contribution guidelines can be found at:
http://eslint.org/docs/developer-guide/contributing/


text:
const THREE = require('three');
var Stats = require('fps-component');
var dat = require('dat-gui');
var stats, gui;

var camera, scene, renderer;
var geometry, material, mesh;
var directionalLight;
var pointLight, light;

function init () {
  camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
  camera.position.z = 500;
  camera.position.y = 400;
  camera.lookAt(new THREE.Vector3(0, 0, 0));

  scene = new THREE.Scene();

  geometry = new THREE.BoxGeometry( 200, 200, 200 );
  //material = new THREE.MeshBasicMaterial( { color: 0x333333 } );
  material = new THREE.MeshLambertMaterial({color: 0x999999 });

  mesh = new THREE.Mesh( geometry, material );
  mesh.castShadow = true;

  scene.add( mesh );

  directionalLight = new THREE.DirectionalLight( 0xffffff);
  directionalLight.position.set( 0, 300, 300 );
  directionalLight.lookAt(new THREE.Vector3(0, 0, 0));
  directionalLight.castShadow = true;
  directionalLight.shadowDarkness = 0.5;
  directionalLight.shadowCameraVisible = true;
  scene.add( directionalLight );

  var directionalLightHelper = new THREE.DirectionalLightHelper(directionalLight, 10);
  scene.add(directionalLightHelper);

  pointLight = new THREE.PointLight( 0xffffff, 1, 1000 );
  scene.add( pointLight );

  var sphereSize = 1;
  var pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize );
  scene.add( pointLightHelper );

  renderer = new THREE.WebGLRenderer();

  renderer.setSize( window.innerWidth, window.innerHeight );
  renderer.setClearColor( 0x000000 );

  var size = 1000;
  var step = 100;

  var gridHelper = new THREE.GridHelper( size, step );
  scene.add( gridHelper );

  document.body.appendChild( renderer.domElement );

  stats = new Stats();
  stats.domElement.style.position = 'absolute';
  stats.domElement.style.left = '0px';
  stats.domElement.style.top = '0px';
  document.body.appendChild(stats.domElement);

  gui = new dat.GUI();
}

function loop () {
  requestAnimationFrame( loop );
  stats.begin()

  var time = +new Date() * 0.001;

  //mesh.rotation.x += 0.01;
  //mesh.rotation.y += 0.02;

  pointLight.position.x = Math.sin( time * 1.7 ) * 240;
  pointLight.position.y = Math.cos( time * 1.5 ) * 240;
  pointLight.position.z = Math.cos( time * 1.3 ) * 240;

  renderer.render( scene, camera );

  stats.end();
}

require('domready')(() => {
  init();
  loop();
});


text:
import { makeRefWrapper } from 'src/firebaseUtil';
import _ from 'lodash';
import { EmptyObject, EmptyArray } from 'src/util';

// TODO: Likes + maybe some more responses toward entire concepts
/*
  like: {
    title_en: 'Like!',
    icon: 'heart',
    className: 'color-red',
    bsStyle: 'warning'
  },
*/

const ConceptCheckResponseDetailsRef = makeRefWrapper({
  pathTemplate: '/conceptCheckResponseDetails',

  indices: {
    uid: ['uid'],
    conceptId: ['conceptId'],
    uid_conceptId: {
      keys: ['uid', 'conceptId'],
      autoUpdate: false
    }
  },

  queryString({uid, conceptId}) {
    // get all responses by given uid + conceptId
    return this.indices.where({uid, conceptId});
  },

  methods: {
    updateTextResponse(text) {
      const { uid, conceptId } = this.props;
      if (!uid || !conceptId) {
        console.error("[ERROR] Missing `uid` or `conceptId` props in ConceptCheckResponseDetailsRef.");
        return Promise.resolve(null);
      }

      return this.setByIndex({uid, conceptId}, {
        uid,
        conceptId,
        text
      });
    }
  },

  children: {
    responses: {
      pathTemplate: '$(responseDetailId)',

      children: {
        uid: 'uid',
        conceptId: 'conceptId',
        text: 'text'
      }
    }
  }
});

export default ConceptCheckResponseDetailsRef;


text:
<!DOCTYPE html>

    <title>Lovely.IO</title>
    <link rel="stylesheet" type="text/css" href="/shared.css" />

Lovely.IO

      Greetings my dear friend!

      If you see this page, then it probably means that you have indeed
      successfully created a lovely project and launched a lovely server.
      Congratulations on that!

      But, it seems you didn't have the <tt>/index.html</tt> page in your
      project directory, so I took the liberty and served you one from
      my own stash of shared resources.

      Look into the <tt>~/.lovely/server/</tt> folder when you have a moment.
      You will find this and some other pages over there, which you might
      want to use in your projects.

      --

      Sincerely Yours,

      Lovely Server


text:
package draw2dAnimation

import (
	"math"
)

// An abstract figure type. Represents a composition of figures kept as collection. Updates to this figure affect it as hole including each part.
type ComposedFigure struct {
	*Figure
	figures *figuresCollection
}

// Constructor setting current struct's fields and default values for the base struct
func NewComposedFigure() *ComposedFigure {
	composedFigure := &ComposedFigure{NewFigure(), newFiguresCollection()}
	composedFigure.SetSubClass(composedFigure)

	return composedFigure
}

// Constructor setting both base struct's and current struct's fields.
func NewComposedFigure3(depth int, startPoint Point, rotationDegrees float64) *ComposedFigure {
	composedFigure := &ComposedFigure{NewFigure(), newFiguresCollection()}
	composedFigure.SetDepth(depth)
	composedFigure.SetStartPoint(startPoint)
	composedFigure.SetRotationDegrees(rotationDegrees)
	composedFigure.SetSubClass(composedFigure)

	return composedFigure
}

// Defines the visualization of the figure according to position (0, 0).
func (this *ComposedFigure) Visualize() {
}

// Adds figure with string key to the contained collection.
func (this *ComposedFigure) AddFigure(name string, figure Figurer) {
	this.figures.add(name, figure)
}

// Removes figure by string key from the contained collection.
func (this *ComposedFigure) RemoveFigure(name string) {
	this.figures.remove(name)
}

// Gets the figure corresponding to the given string key in the contained collection or nil if not found.
func (this *ComposedFigure) GetFigureByName(name string) Figurer {
	return this.figures.getByName(name)
}

// Updates the figure as a whole and each of its parts.
func (this *ComposedFigure) Update() {
	this.GetBase().Update()
	this.figures.traverse(func(figure Figurer) {
		figure.Update()
	})
}

// Draw the figure by visualizing all its part taking in to account the scale, translation and rotation of the figure.
func (this *ComposedFigure) Draw() {
	graphicContext := GetTheImageGraphicContext()

	if this.startPoint.X != 0 || this.startPoint.Y != 0 {
		graphicContext.Translate(this.startPoint.X, this.startPoint.Y)
	}

	if this.rotationDegrees != 0.0 {
		graphicContext.Rotate(this.rotationDegrees * (math.Pi / 180.0))
	}

	if this.scale.X != 1.0 || this.scale.Y != 1.0 {
		graphicContext.Scale(this.scale.X, this.scale.Y)
	}

	this.figures.traverse(func(figure Figurer) {
		figure.Draw()
	})

	if this.scale.X != 1.0 || this.scale.Y != 1.0 {
		graphicContext.Scale(1 / this.scale.X, 1 / this.scale.Y)
	}

	if this.startPoint.X != 0 || this.startPoint.Y != 0 {
		graphicContext.Translate(-this.startPoint.X, -this.startPoint.Y)
	}

	if this.rotationDegrees != 0.0 {
		graphicContext.Rotate(-this.rotationDegrees * (math.Pi / 180.0))
	}
}


text:
@extends('layouts.app')

@section('content')

            Category

        @include('flash::message')
        @include('adminlte-templates::common.errors')

                    {!! Form::open(['route' => 'categories.store']) !!}

                        @include('categories.fields')

                    {!! Form::close() !!}

@endsection


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="0dp"
    android:shape="ring"
    android:thickness="4dp"
    android:useLevel="false">
    <solid android:color="?attr/colorOnSurface" />
</shape>


text:
#region Copyright

#endregion

#region

using Autodesk.DesignScript.Runtime;
using Dynamo.Models;
using System.Collections.Generic;
using Dynamo.Nodes;
using Kodestruct.Concrete.ACI.Entities;
using System;
using Kodestruct.Concrete.ACI;

#endregion

namespace Concrete.ACI318.Details
{

/// <summary>
///     Cover to reinforcement centroid
///     Category:   Concrete.ACI318.Details
/// </summary>
///

    public partial class Cover
    {
        /// <summary>
        ///     Cover to reinforcement centroid (in)
        /// </summary>
        /// <param name="c_c">   Clear cover of reinforcement  </param>
        /// <param name="RebarSizeId">  Rebar designation (number) indicating the size of the bar </param>
        /// <param name="s_clear">  Clear spacing between bars (if 0 is specified, then bar diameter is used) </param>
        /// <param name="N_layers">  Number of bars </param>
        /// <param name="Setback">  Setback dimension (additional distance to minimum calculated cover to centroid) </param>
        /// <returns name="c_cntr"> Concrete cover to rebar centroid </returns>

        [MultiReturn(new[] { "c_cntr" })]
        public static Dictionary<string, object> CoverToRebarCentroid(double c_c,string RebarSizeId,double s_clear=0,double N_layers=1,double Setback=0)
        {
            //Default values
            double c_cntr = 0;

            //Calculation logic:
            double d_b = 0;

            RebarDesignation des;
            bool IsValidString = Enum.TryParse(RebarSizeId, true, out des);
            if (IsValidString == false)
            {
                throw new Exception("Rebar size is not recognized. Check input.");
            }
            RebarSection sec = new RebarSection(des);
            d_b = sec.Diameter;

            if (N_layers <=0)
            {
                throw new Exception("Number of layers cannot be equal or less than zero.");
            }

            double sclr = s_clear == 0 ? d_b : s_clear;

            c_cntr = c_c + (N_layers * d_b + (N_layers - 1) * sclr) / 2.0 + Setback;

            return new Dictionary<string, object>
            {
                { "c_cntr", c_cntr }

            };
        }

    }
}


text:
/* Author:  G. Jungman
 */
#ifndef __GSL_DHT_H__
#define __GSL_DHT_H__

#if !defined( GSL_FUN )
#  if !defined( GSL_DLL )
#    define GSL_FUN extern
#  elif defined( BUILD_GSL_DLL )
#    define GSL_FUN extern __declspec(dllexport)
#  else
#    define GSL_FUN extern __declspec(dllimport)
#  endif
#endif

#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif

__BEGIN_DECLS

struct gsl_dht_struct {
  size_t    size;  /* size of the sample arrays to be transformed    */
  double    nu;    /* Bessel function order                          */
  double    xmax;  /* the upper limit to the x-sampling domain       */
  double    kmax;  /* the upper limit to the k-sampling domain       */
  double *  j;     /* array of computed J_nu zeros, j_{nu,s} = j[s]  */
  double *  Jjj;   /* transform numerator, J_nu(j_i j_m / j_N)       */
  double *  J2;    /* transform denominator, J_{nu+1}^2(j_m)         */
};
typedef struct gsl_dht_struct gsl_dht;

/* Create a new transform object for a given size
 * sampling array on the domain [0, xmax].
 */
GSL_FUN gsl_dht * gsl_dht_alloc(size_t size);
GSL_FUN gsl_dht * gsl_dht_new(size_t size, double nu, double xmax);

/* Recalculate a transform object for given values of nu, xmax.
 * You cannot change the size of the object since the internal
 * allocation is reused.
 */
GSL_FUN int gsl_dht_init(gsl_dht * t, double nu, double xmax);

/* The n'th computed x sample point for a given transform.
 * 0 <= n <= size-1
 */
GSL_FUN double gsl_dht_x_sample(const gsl_dht * t, int n);

/* The n'th computed k sample point for a given transform.
 * 0 <= n <= size-1
 */
GSL_FUN double gsl_dht_k_sample(const gsl_dht * t, int n);

/* Free a transform object.
 */
GSL_FUN void gsl_dht_free(gsl_dht * t);

/* Perform a transform on a sampled array.
 * f_in[0] ... f_in[size-1] and similarly for f_out[]
 */
GSL_FUN int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out);

__END_DECLS

#endif /* __GSL_DHT_H__ */


text:
describe('Adding listeners', function(){

  var eventSignal;

  beforeEach(function(){
    eventSignal = new EventSignal();
  });

  it('should add the provided listener', function(){
    eventSignal.addListener(function(){});
    expect(eventSignal.listenerCount()).toBe(1);
  });

  it('should assign an anonymous object to `scope` when `scope` is not provided', function(){
    eventSignal.addListener(function(){});

    var listener = eventSignal.listeners()[0];

    expect(listener.scope).toEqual({});
  });

  it('should set `scope` and `once` when called with addListener(listenerFn, scope)', function(){
    var object = {
      listenerFn: function(){}
    };

    eventSignal.addListener(object.listenerFn, object);

    var listener = eventSignal.listeners()[0];

    expect(listener.callback).toBe(object.listenerFn);
    expect(listener.scope).toBe(object);
    expect(listener.once).toBe(undefined);
  });

  it('should set `scope` and `once` when called with addListener(listenerFn, once)', function(){
    var object = {
      listenerFn: function(){}
    };

    eventSignal.addListener(object.listenerFn, true);

    var listener = eventSignal.listeners()[0];

    expect(listener.callback).toBe(object.listenerFn);
    expect(listener.scope).toEqual({});
    expect(listener.once).toBe(true);
  });

  it('should set `scope` and `once` when called with addListener(listenerFn, scope, once)', function(){
    var object = {
      listenerFn: function(){}
    };

    eventSignal.addListener(object.listenerFn, object, true);

    var listener = eventSignal.listeners()[0];

    expect(listener.callback).toBe(object.listenerFn);
    expect(listener.scope).toBe(object);
    expect(listener.once).toBe(true);
  });

  it('should throw if listener is not a function', function(){
    [{}, [], null, void 0, '', 1, true].forEach(function(listener){
      expect(function(){
        eventSignal.addListener(listener);
      }).toThrow();
    });
  });

  it('should throw if listener is already registered', function(){
    var listenerFn = function(){};

    eventSignal.addListener(listenerFn);

    expect(function(){
      eventSignal.addListener(listenerFn);
    }).toThrow();
  });

});


text:
<?php

namespace Ouzo\View;

use Ouzo\Config;

class ViewPathProviderFactory
{
    public static function create(): ViewPathProvider
    {
        $provider = Config::getValue('view', 'path_provider') ?? DefaultViewPathProvider::class;
        return new $provider();
    }
}


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.ui.appmenu;

import android.os.Bundle;
import android.view.MenuItem;

import androidx.annotation.Nullable;

/** A delegate to handle menu item selection. */
public interface AppMenuDelegate {
    /**
     * Called whenever an item in the app menu is selected.
     * See {@link android.app.Activity#onOptionsItemSelected(MenuItem)}.
     * @param itemId The id of the menu item that was selected.
     * @param menuItemData Extra data associated with the menu item. May be null.
     */
    boolean onOptionsItemSelected(int itemId, @Nullable Bundle menuItemData);

    /**
     * @return {@link AppMenuPropertiesDelegateImpl} instance that the {@link AppMenuHandlerImpl}
     *         should be using.
     */
    AppMenuPropertiesDelegate createAppMenuPropertiesDelegate();
}