<|start_filename|>scripts/fixPlotly.js<|end_filename|>
const plotlyFolder = "./node_modules/plotly.js/";
const jsPath = plotlyFolder + "dist/plotly.js";
const packagePath = plotlyFolder + "package.json";
const jsReg = /(define\(d3\).*)\n(\}\.apply\(self\)|\}\(\));/;
const packageReg = /\"main\":\s\"(.\/lib\/index\.js|\.\/dist\/plotly.js)",/;
const fs = require("fs");

function replaceFile(path, reg, to) {
  if (!fs.existsSync(path)) {
    throw new Error(`${path} does not exist.`);
  }
  let content = fs.readFileSync(path, { encoding: "utf-8" });
  if (!reg.test(content)) {
    throw new Error(`${path} has wrong content`);
  }
  content = content.replace(reg, to);
  fs.writeFileSync(path, content, { encoding: "utf-8" });
}

module.exports = function () {
  replaceFile(jsPath, jsReg, "$1\n}.apply(self);");
  replaceFile(packagePath, packageReg, '"main": "./dist/plotly.js",');
};


<|start_filename|>scripts/e2e-widget.js<|end_filename|>
const { spawnSync, spawn } = require("child_process");
const fs = require("fs");
const path = require("path");
const _ = require("lodash");
const commander = require("commander");

const baseDir = path.join(__dirname, "../notebooks/responsibleaidashboard");
const filePrefix = "responsibleaidashboard-";
// Please add notebook name into 'fileNames' array only when you are adding e2e tests to that notebook.
const fileNames = [
  "responsibleaidashboard-census-classification-model-debugging",
  "responsibleaidashboard-diabetes-regression-model-debugging",
  "responsibleaidashboard-housing-classification-model-debugging",
  "responsibleaidashboard-diabetes-decision-making",
  "responsibleaidashboard-housing-decision-making",
  "responsibleaidashboard-multiclass-dnn-model-debugging"
];
const hostReg = /^ResponsibleAI started at (http:\/\/localhost:\d+)$/m;
const timeout = 3600;

/**
 *
 * @param {string} name
 * @returns {Promise<string>}
 */
async function runNotebook(name) {
  console.log(`Running ${name}`);
  const timer = setTimeout(() => {
    throw new Error(`${name} timeout.`);
  }, timeout * 1000);
  const nbProcess = spawn("python", ["-i", path.join(baseDir, name)]);
  nbProcess.on("exit", () => {
    throw new Error(`Failed to run notebook ${name}`);
  });
  return new Promise((resolve) => {
    let stdout = "";
    const handleOutput = (data) => {
      const message = data.toString();
      stdout += message;
      console.log(message);
      if (hostReg.test(stdout)) {
        clearTimeout(timer);
        resolve(hostReg.exec(stdout)[1]);
      }
    };
    nbProcess.stdout.on("data", handleOutput);
    nbProcess.stderr.on("data", handleOutput);
    nbProcess.stdout.on("error", (error) => {
      throw error;
    });
  });
}

function checkIfAllNotebooksHaveTests() {
  console.log(`Checking if all notebooks under ${baseDir} has tests`);
  const files = fs
    .readdirSync(baseDir)
    .filter((f) => f.startsWith(filePrefix) && f.endsWith(".ipynb"))
    .map((f) => f.replace(".ipynb", ""));
  const allNotebooksHaveTests = _.isEqual(_.sortBy(files), _.sortBy(fileNames));
  if (!allNotebooksHaveTests) {
    throw new Error(
      `Some of the notebooks doesn't have tests. If a new notebook is added, Please add tests.`
    );
  }
  console.log(`All notebooks have tests.`);
}

function convertNotebook() {
  console.log("Converting notebook");
  for (var fileName of fileNames) {
    console.log(`Converting notebook  ${fileName}\r\n`);
    const { status, stderr } = spawnSync(
      "jupyter",
      ["nbconvert", path.join(baseDir, `${fileName}.ipynb`), "--to", "script"],
      {
        stdio: "inherit"
      }
    );
    if (status) {
      throw new Error(`Failed to convert notebook:\r\n\r\n${stderr}`);
    }
    console.log(`Converted notebook ${fileName}\r\n`);
  }
}
/**
 * @typedef {Object} Host
 * @property {string} file
 * @property {string} host
 */
/**
 * @returns {Host[]}
 */
async function runNotebooks() {
  const files = fs
    .readdirSync(baseDir)
    .filter((f) => f.startsWith(filePrefix) && f.endsWith(".py"));
  const hosts = [];
  for (const f of files) {
    hosts.push({ file: f, host: await runNotebook(f) });
  }
  return hosts;
}

/**
 *
 * @param {Host[]} hosts
 */
function writeCypressSettings(hosts) {
  fs.writeFileSync(
    path.join(__dirname, "../apps/widget-e2e/cypress.env.json"),
    JSON.stringify({
      hosts
    })
  );
}

function e2e(watch) {
  const nxPath = path.join(__dirname, "../node_modules/@nrwl/cli/bin/nx.js");
  console.log("Running e2e");
  const { status, stderr } = spawnSync(
    "node",
    [nxPath, "e2e", "widget-e2e", watch ? "--watch" : undefined],
    {
      stdio: "inherit",
      cwd: path.join(__dirname, "..")
    }
  );
  if (status) {
    throw new Error(`Failed to run e2e:\r\n\r\n${stderr}`);
  }
  console.log("E2e finished\r\n");
}

async function main() {
  commander
    .option("-w, --watch", "Watch mode")
    .parse(process.argv)
    .outputHelp();
  checkIfAllNotebooksHaveTests();
  convertNotebook();
  const hosts = await runNotebooks();
  writeCypressSettings(hosts);
  e2e(commander.opts().watch);
  process.exit(0);
}

function onExit() {
  console.log("Existing e2e");
}
async function onExitRequested() {
  process.exit();
}

main();

process.stdin.resume();
process.on("SIGINT", onExitRequested);

// catches "kill pid" (for example: nodemon restart)
process.on("SIGUSR1", onExitRequested);
process.on("SIGUSR2", onExitRequested);

process.on("exit", onExit);


<|start_filename|>docs/source/landing_page/css/responsive.css<|end_filename|>
/* FOOTER MEDIA QUERY:START */
@media only screen and (min-width: 1366px) and (max-width: 1500px) {
}
@media only screen and (min-width: 1199px) and (max-width: 1366px) {
  .inner-container {
    padding-left: 15px;
    padding-right: 15px;
  }
  .btn-white,
  .btn-blue {
    font-size: 26px;
  }
  .shadow-box {
    padding: 25px 30px;
  }
  h1 {
    font-size: 90px;
  }
  h2 {
    font-size: 46px;
  }
  h3 {
    font-size: 40px;
  }
  .hero-banner p {
    font-size: 26px;
  }
}
@media only screen and (min-width: 991px) and (max-width: 1199px) {
  .inner-container {
    padding-left: 15px;
    padding-right: 15px;
  }
  h1 {
    font-size: 75px;
  }
  h2 {
    font-size: 40px;
  }
  h3 {
    font-size: 36px;
  }
  h4 {
    font-size: 24px;
  }
  h5 {
    font-size: 24px;
  }
  p {
    font-size: 20px;
  }
  .hero-banner p {
    font-size: 26px;
  }
  .tab-container .nav-pills .nav-link {
    font-size: 24px;
  }
  .tab-container .tab-content > .tab-pane p {
    font-size: 18px;
  }
  .tab-container {
    max-width: 480px;
  }
  .error-work-wrapper {
    padding-top: 120px;
  }
  .contribute-error-container {
    padding-top: 60px;
    padding-bottom: 60px;
  }
  .intall-error-container,
  .explore-toolkit-container {
    padding-top: 100px;
    padding-bottom: 100px;
  }
  .btn-white,
  .btn-blue {
    font-size: 24px;
  }
  .shadow-box {
    padding: 25px 25px;
  }
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
  .inner-container {
    padding-left: 15px;
    padding-right: 15px;
  }
  .hero-banner {
    padding-bottom: 90px;
    padding-top: 20px;
  }
  h1 {
    font-size: 70px;
  }
  h2 {
    font-size: 36px;
  }
  h3 {
    font-size: 34px;
  }
  h4 {
    font-size: 24px;
  }
  h5 {
    font-size: 20px;
  }
  p {
    font-size: 18px;
  }
  .hero-banner p {
    font-size: 24px;
  }
  .error-work-wrapper h4 {
    font-size: 28px;
  }
  .tab-container .nav-pills .nav-link {
    font-size: 22px;
  }
  .tab-container .tab-content > .tab-pane p {
    font-size: 18px;
  }
  .get-started-container .btn-wrapper {
    margin-bottom: 30px;
  }
  .tab-container {
    max-width: 500px;
  }
  .error-work-wrapper {
    padding-top: 110px;
  }
  .contribute-error-container {
    padding-top: 50px;
    padding-bottom: 50px;
  }
  .intall-error-container,
  .explore-toolkit-container {
    padding-top: 80px;
    padding-bottom: 80px;
  }
  .btn-white,
  .btn-blue {
    font-size: 22px;
  }
  .shadow-box {
    padding: 20px 20px;
  }
}
@media only screen and (min-width: 480px) and (max-width: 767px) {
  .inner-container {
    padding-left: 15px;
    padding-right: 15px;
  }
  h1 {
    font-size: 60px;
  }
  h2 {
    font-size: 32px;
  }
  h3 {
    font-size: 32px;
  }
  h4 {
    font-size: 26px;
  }
  h5 {
    font-size: 24px;
  }
  p {
    font-size: 16px;
  }
  .hero-banner p {
    font-size: 20px;
  }
  .error-work-wrapper h4 {
    font-size: 26px;
  }
  .tab-container .nav-pills .nav-link {
    font-size: 20px;
  }
  .tab-container .tab-content > .tab-pane p {
    font-size: 16px;
  }
  .get-started-container .btn-wrapper {
    margin-bottom: 30px;
  }
  .tab-container {
    max-width: 460px;
  }
  .error-work-wrapper {
    padding-top: 40px;
    padding-bottom: 20px;
    max-width: 500px;
  }
  .error-work-wrapper .img-box-wrapper {
    text-align: center;
  }
  .contribute-error-container {
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .explore-toolkit-container,
  .intall-error-container {
    padding-top: 60px;
    padding-bottom: 60px;
  }
  .footer-container {
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .shadow-box {
    padding: 20px 20px;
  }
  .btn-white,
  .btn-blue {
    font-size: 20px;
  }
}
@media only screen and (min-width: 320px) and (max-width: 767px) {
  .hero-banner {
    padding-bottom: 70px;
    padding-top: 20px;
  }
  .footer-content ul li a {
    font-size: 18px;
  }
  .hero-banner .row-bg-wrap .row-bg {
    background-position: bottom right;
  }
  .hero-banner .row-bg-wrap .row-bg-overlay {
    position: absolute;
    left: 0;
    right: 0;
    background-color: rgb(0 0 0 / 30%);
    width: 100%;
    bottom: 30px;
    top: 0px;
  }
  .error-work-container {
    margin-top: 40px;
  }
  .error-work-wrapper .custom-box-wrapper {
    margin: 0 auto;
  }
}

@media only screen and (min-width: 320px) and (max-width: 480px) {
  .inner-container {
    padding-left: 5px;
    padding-right: 5px;
  }
  h1 {
    font-size: 48px;
  }
  h2 {
    font-size: 24px;
  }
  h3 {
    font-size: 28px;
  }
  h4 {
    font-size: 24px;
  }
  h5 {
    font-size: 24px;
  }
  p {
    font-size: 16px;
  }
  .error-work-wrapper h4 {
    font-size: 24px;
  }
  .hero-banner p {
    font-size: 18px;
  }
  .tab-container .nav-pills .nav-link {
    font-size: 20px;
  }
  .tab-container .tab-content > .tab-pane p {
    font-size: 16px;
  }
  .error-work-wrapper {
    padding-top: 40px;
    padding-bottom: 20px;
  }
  .contribute-error-container {
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .explore-toolkit-container,
  .intall-error-container {
    padding-top: 60px;
    padding-bottom: 60px;
  }
  .footer-container {
    padding-top: 30px;
    padding-bottom: 30px;
  }
  .shadow-box {
    padding: 20px 20px;
  }
  .btn-white,
  .btn-blue {
    font-size: 20px;
  }
  .get-started-container .btn-wrapper {
    margin-bottom: 30px;
  }
  .tab-container {
    padding: 10px 15px 15px;
  }
}


<|start_filename|>webpack.config.js<|end_filename|>
const nrwlConfig = require("@nrwl/react/plugins/webpack.js"); // require the main @nrwl/react/plugins/webpack configuration function.

module.exports = (config) => {
  nrwlConfig(config); // first call it so that it @nrwl/react plugin adds its configs,

  config.node = {
    module: "empty",
    dgram: "empty",
    dns: "mock",
    fs: "empty",
    http2: "empty",
    net: "empty",
    tls: "empty",
    child_process: "empty"
  };

  if (process.env.debug) {
    require("fs-extra").writeJSONSync("./webpack.json", config, {
      spaces: 2
    });
  }
  return config;
};


<|start_filename|>scripts/fetch.js<|end_filename|>
const fetch = require("node-fetch");

module.exports = async function (name) {
  const res = await fetch(
    `https://registry.npmjs.org/-/package/${name}/dist-tags`
  );
  return res.json();
};
